1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2025-07-05 03:22:51 +00:00

Correct Formatting

Removed extra tab spacing and corrected syntax error
This commit is contained in:
William Jackson 2016-01-03 16:30:00 +02:00
parent a44edee782
commit ac8b706d42

View File

@ -11,59 +11,55 @@ Action widget to apply list operations to any tiddler field (defaults to the 'li
/*jslint node: true, browser: true */ /*jslint node: true, browser: true */
/*global $tw: false */ /*global $tw: false */
"use strict"; "use strict";
var Widget = require("$:/core/modules/widgets/widget.js").widget;
var Widget = require("$:/core/modules/widgets/widget.js")
.widget;
var ActionListopsWidget = function(parseTreeNode, options) { var ActionListopsWidget = function(parseTreeNode, options) {
this.initialise(parseTreeNode, options); this.initialise(parseTreeNode, options);
}; };
/**
/* * Inherit from the base widget class
Inherit from the base widget class
*/ */
ActionListopsWidget.prototype = new Widget(); ActionListopsWidget.prototype = new Widget();
/**
/* * Render this widget into the DOM
Render this widget into the DOM
*/ */
ActionListopsWidget.prototype.render = function(parent, nextSibling) { ActionListopsWidget.prototype.render = function(parent, nextSibling) {
this.computeAttributes(); this.computeAttributes();
this.execute(); this.execute();
}; };
/**
/* * Compute the internal state of the widget
Compute the internal state of the widget
*/ */
ActionListopsWidget.prototype.execute = function() { ActionListopsWidget.prototype.execute = function() {
// Get our parameters // Get our parameters
this.target = this.getAttribute("$tiddler", this.getVariable("currentTiddler")); this.target = this.getAttribute("$tiddler", this.getVariable(
"currentTiddler"));
this.filter = this.getAttribute("$filter"); this.filter = this.getAttribute("$filter");
this.subfilter = this.getAttribute("$subfilter"); this.subfilter = this.getAttribute("$subfilter");
this.listField = this.getAttribute("$field", "list"); this.listField = this.getAttribute("$field", "list");
this.listIndex = this.getAttribute("$index"); this.listIndex = this.getAttribute("$index");
this.filtertags = this.getAttribute("$tags"); this.filtertags = this.getAttribute("$tags");
}; };
/**
/* * Refresh the widget by ensuring our attributes are up to date
Refresh the widget by ensuring our attributes are up to date
*/ */
ActionListopsWidget.prototype.refresh = function(changedTiddlers) { ActionListopsWidget.prototype.refresh = function(changedTiddlers) {
var changedAttributes = this.computeAttributes(); var changedAttributes = this.computeAttributes();
if (changedAttributes.$tiddler || changedAttributes.$filter || changedAttributes.$subfilter || changedAttributes.$list || changedAttributes.$index || changedAttributes.$tags) { if(changedAttributes.$tiddler || changedAttributes.$filter ||
changedAttributes.$subfilter || changedAttributes.$field ||
changedAttributes.$index || changedAttributes.$tags) {
this.refreshSelf(); this.refreshSelf();
return true; return true;
} }
return this.refreshChildren(changedTiddlers); return this.refreshChildren(changedTiddlers);
}; };
/**
/* * Invoke the action associated with this widget
Invoke the action associated with this widget
*/ */
ActionListopsWidget.prototype.invokeAction = function (triggeringWidget, event) { ActionListopsWidget.prototype.invokeAction = function(triggeringWidget,
event) {
//Apply the specified filters to the lists //Apply the specified filters to the lists
var field = this.listField, var field = this.listField,
index = undefined, index,
type = "!!", type = "!!",
list = this.listField; list = this.listField;
if(this.listIndex) { if(this.listIndex) {
@ -73,15 +69,20 @@ Action widget to apply list operations to any tiddler field (defaults to the 'li
list = this.listIndex; list = this.listIndex;
} }
if(this.filter) { if(this.filter) {
this.wiki.setText(this.target, field, index, $tw.utils.stringifyList(this.wiki.filterTiddlers(this.filter, this))); this.wiki.setText(this.target, field, index, $tw.utils.stringifyList(
this.wiki
.filterTiddlers(this.filter, this)));
} }
if(this.subfilter) { if(this.subfilter) {
var subfilter = "[list[" + this.target + type + list + "]] " + this.subfilter; var subfilter = "[list[" + this.target + type + list + "]] " + this.subfilter;
this.wiki.setText(this.target, field, index, $tw.utils.stringifyList(this.wiki.filterTiddlers(subfilter, this))); this.wiki.setText(this.target, field, index, $tw.utils.stringifyList(
this.wiki
.filterTiddlers(subfilter, this)));
} }
if(this.filtertags) { if(this.filtertags) {
var tagfilter = "[list[" + this.target + "!!tags]] " + this.filtertags; var tagfilter = "[list[" + this.target + "!!tags]] " + this.filtertags;
this.wiki.setText(this.target, "tags", undefined, $tw.utils.stringifyList(this.wiki.filterTiddlers(tagfilter, this))); this.wiki.setText(this.target, "tags", undefined, $tw.utils.stringifyList(
this.wiki.filterTiddlers(tagfilter, this)));
} }
return true; // Action was invoked return true; // Action was invoked
}; };