/*\ title: $:/core/modules/macros/list.js type: application/javascript module-type: macro List macro \*/ (function(){ /*jslint node: true, browser: true */ /*global $tw: false */ "use strict"; exports.info = { name: "list", dependentAll: true, // Tiddlers containing <> macro are dependent on every tiddler params: { type: {byPos: 0, type: "text"}, filter: {byName: true, type: "filter"}, template: {byName: true, type: "tiddler"}, templateText: {byName: true, type: "text"}, editTemplate: {byName: true, type: "tiddler"}, editTemplateText: {byName: true, type: "text"}, emptyMessage: {byName: true, type: "text"} } }; exports.executeMacro = function() { // Get the list of tiddlers object this.getTiddlerList(); // Create the list frame element var attributes = {"class": ["tw-list-frame"]}; if(this.classes) { $tw.utils.pushTop(attributes["class"],this.classes); } this.listFrame = $tw.Tree.Element("div",attributes,[]); // Create each list element for(var t=0; t t) { for(var n=index-1; n>=t; n--) { this.removelistElement(n); } } // Refresh the node we're reusing this.listFrame.children[t].refreshInDom(changes); } } // Remove any left over elements if(this.listFrame.children.length > this.list.length) { for(t=this.listFrame.children.length-1; t>=this.list.length; t--) { this.removeStoryElement(t); } } }; })();