mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2026-10-04 15:11:41 +00:00
More joy of linting
This commit is contained in:
@@ -256,7 +256,7 @@ options: optional hashmap of options
|
|||||||
*/
|
*/
|
||||||
exports.compileFilter = function(filterString,options) {
|
exports.compileFilter = function(filterString,options) {
|
||||||
var defaultFilterRunPrefix = (options || {}).defaultFilterRunPrefix || "or";
|
var defaultFilterRunPrefix = (options || {}).defaultFilterRunPrefix || "or";
|
||||||
var cacheKey = filterString + '|' + defaultFilterRunPrefix;
|
var cacheKey = filterString + "|" + defaultFilterRunPrefix;
|
||||||
if(!this.filterCache) {
|
if(!this.filterCache) {
|
||||||
this.filterCache = Object.create(null);
|
this.filterCache = Object.create(null);
|
||||||
this.filterCacheCount = 0;
|
this.filterCacheCount = 0;
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ Widget to set multiple variables at once from a list of names and a list of valu
|
|||||||
var Widget = require("$:/core/modules/widgets/widget.js").widget;
|
var Widget = require("$:/core/modules/widgets/widget.js").widget;
|
||||||
|
|
||||||
var SetMultipleVariablesWidget = function(parseTreeNode,options) {
|
var SetMultipleVariablesWidget = function(parseTreeNode,options) {
|
||||||
this.initialise(parseTreeNode,options);
|
this.initialise(parseTreeNode,options);
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -24,52 +24,52 @@ SetMultipleVariablesWidget.prototype = new Widget();
|
|||||||
Render this widget into the DOM
|
Render this widget into the DOM
|
||||||
*/
|
*/
|
||||||
SetMultipleVariablesWidget.prototype.render = function(parent,nextSibling) {
|
SetMultipleVariablesWidget.prototype.render = function(parent,nextSibling) {
|
||||||
this.parentDomNode = parent;
|
this.parentDomNode = parent;
|
||||||
this.computeAttributes();
|
this.computeAttributes();
|
||||||
this.execute();
|
this.execute();
|
||||||
this.renderChildren(parent,nextSibling);
|
this.renderChildren(parent,nextSibling);
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Compute the internal state of the widget
|
Compute the internal state of the widget
|
||||||
*/
|
*/
|
||||||
SetMultipleVariablesWidget.prototype.execute = function() {
|
SetMultipleVariablesWidget.prototype.execute = function() {
|
||||||
// Setup our variables
|
// Setup our variables
|
||||||
this.setVariables();
|
this.setVariables();
|
||||||
// Construct the child widgets
|
// Construct the child widgets
|
||||||
this.makeChildWidgets();
|
this.makeChildWidgets();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
SetMultipleVariablesWidget.prototype.setVariables = function() {
|
SetMultipleVariablesWidget.prototype.setVariables = function() {
|
||||||
// Set the variables
|
// Set the variables
|
||||||
var self = this,
|
var self = this,
|
||||||
filterNames = this.getAttribute("$names",""),
|
filterNames = this.getAttribute("$names",""),
|
||||||
filterValues = this.getAttribute("$values","");
|
filterValues = this.getAttribute("$values","");
|
||||||
this.variableNames = [];
|
this.variableNames = [];
|
||||||
this.variableValues = [];
|
this.variableValues = [];
|
||||||
if(filterNames && filterValues) {
|
if(filterNames && filterValues) {
|
||||||
this.variableNames = this.wiki.filterTiddlers(filterNames,this,{defaultFilterRunPrefix: "all"});
|
this.variableNames = this.wiki.filterTiddlers(filterNames,this,{defaultFilterRunPrefix: "all"});
|
||||||
this.variableValues = this.wiki.filterTiddlers(filterValues,this,{defaultFilterRunPrefix: "all"});
|
this.variableValues = this.wiki.filterTiddlers(filterValues,this,{defaultFilterRunPrefix: "all"});
|
||||||
$tw.utils.each(this.variableNames,function(varname,index) {
|
$tw.utils.each(this.variableNames,function(varname,index) {
|
||||||
self.setVariable(varname,self.variableValues[index]);
|
self.setVariable(varname,self.variableValues[index]);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Refresh the widget by ensuring our attributes are up to date
|
Refresh the widget by ensuring our attributes are up to date
|
||||||
*/
|
*/
|
||||||
SetMultipleVariablesWidget.prototype.refresh = function(changedTiddlers) {
|
SetMultipleVariablesWidget.prototype.refresh = function(changedTiddlers) {
|
||||||
var filterNames = this.getAttribute("$names",""),
|
var filterNames = this.getAttribute("$names",""),
|
||||||
filterValues = this.getAttribute("$values",""),
|
filterValues = this.getAttribute("$values",""),
|
||||||
variableNames = this.wiki.filterTiddlers(filterNames,this,{defaultFilterRunPrefix: "all"}),
|
variableNames = this.wiki.filterTiddlers(filterNames,this,{defaultFilterRunPrefix: "all"}),
|
||||||
variableValues = this.wiki.filterTiddlers(filterValues,this,{defaultFilterRunPrefix: "all"});
|
variableValues = this.wiki.filterTiddlers(filterValues,this,{defaultFilterRunPrefix: "all"});
|
||||||
if(!$tw.utils.isArrayEqual(this.variableNames,variableNames) || !$tw.utils.isArrayEqual(this.variableValues,variableValues)) {
|
if(!$tw.utils.isArrayEqual(this.variableNames,variableNames) || !$tw.utils.isArrayEqual(this.variableValues,variableValues)) {
|
||||||
this.refreshSelf();
|
this.refreshSelf();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return this.refreshChildren(changedTiddlers);
|
return this.refreshChildren(changedTiddlers);
|
||||||
};
|
};
|
||||||
|
|
||||||
exports["setmultiplevariables"] = SetMultipleVariablesWidget;
|
exports["setmultiplevariables"] = SetMultipleVariablesWidget;
|
||||||
|
|||||||
Reference in New Issue
Block a user