Tiddler Code/*** |''Name''|TimelineExcludeNamePlugin| |''Description''|Provides a timeline that excludes a given name or "nobody"| |''Authors''|Ian Epperson| |''Version''|0.1| |''Status''|@@alpha@@| |''Source''| | |''CodeRepository''| | |''License''|[[Creative Commons Attribution-ShareAlike 3.0 License|http://creativecommons.org/licenses/by-sa/3.0/]]| |''Requires''| | |''Keywords''|timeline| !Description Allows replacing the timeline with a macro that will hide any tiddler edited by a given name or "nobody". Designed to allow a user to edit as "nobody" to provide a raw blank file for use by others. The edits are hidden from the timeline. !Usage {{{ <<timelineExcludeName>> <<timelineExcludeName "nada">> }}} !Revision History !!v0.1 (2010-10-06) * initial release !To Do * documentation !Code ***/ //{{{ config.macros.timelineExcludeName = { handler: function(place,macroName,params) { var exName = params[0] || "nobody"; var field = "modified" var tiddlers = store.reverseLookup("tags","excludeLists",false,field); var lastDay = ""; var last = params[1] ? tiddlers.length-Math.min(tiddlers.length,parseInt(params[1])) : 0; var dateFormat = params[2] || config.views.wikified.dateFormat; for(var t=tiddlers.length-1; t>=last; t--) { var tiddler = tiddlers[t]; if(tiddler["modifier"] == exName) { continue; } var theDay = tiddler[field].convertToLocalYYYYMMDDHHMM().substr(0,8); if(theDay != lastDay) { var ul = document.createElement("ul"); addClass(ul,"timeline"); place.appendChild(ul); createTiddlyElement(ul,"li",null,"listTitle",tiddler[field].formatString(dateFormat)); lastDay = theDay; } createTiddlyElement(ul,"li",null,"listLink").appendChild(createTiddlyLink(place,tiddler.title,true)); } }, } //}}} |
TiddlyWiki >