Ticket #170: Ticket170.patch
| File Ticket170.patch, 4.1 kB (added by SaqImtiaz, 10 months ago) |
|---|
-
main.js
old new 83 83 invokeParamifier(params,"onstart"); 84 84 if(story.isEmpty()) { 85 85 var tiddlers = store.filterTiddlers(store.getTiddlerText("DefaultTiddlers")); 86 for(var t=0; t<tiddlers.length; t++) { 87 story.displayTiddler("bottom",tiddlers[t].title); 88 } 86 story.displayTiddlers(null,tiddlers); 89 87 } 90 88 window.scrollTo(0,0); 91 89 } -
Paramifiers.js
old new 60 60 config.paramifiers.tag = { 61 61 onstart: function(v) { 62 62 var tagged = store.getTaggedTiddlers(v,"title"); 63 for(var t=0; t<tagged.length; t++) 64 story.displayTiddler("bottom",tagged[t].title,null,false,null); 63 story.displayTiddlers(null,tagged,null,false,null); 65 64 } 66 65 }; 67 66 … … 92 91 } 93 92 }; 94 93 94 -
Story.js
old new 31 31 }; 32 32 33 33 //# Display several tiddlers given their titles in an array. Parameters same as displayTiddler(), except: 34 //# titles - array of string titles34 //# titles - array of tiddlers or string titles 35 35 Story.prototype.displayTiddlers = function(srcElement,titles,template,animate,unused,customFields,toggle) 36 36 { 37 37 for(var t = titles.length-1;t>=0;t--) … … 43 43 //#Â custom fields were provided, then an attempt is made to retrieve the tiddler from the server 44 44 //# srcElement - reference to element from which this one is being opened -or- 45 45 //# special positions "top", "bottom" 46 //# ti tle -title of tiddler to display46 //# tiddler - tiddler or title of tiddler to display 47 47 //# template - the name of the tiddler containing the template -or- 48 48 //# one of the constants DEFAULT_VIEW_TEMPLATE and DEFAULT_EDIT_TEMPLATE -or- 49 49 //# null or undefined to indicate the current template if there is one, DEFAULT_VIEW_TEMPLATE if not 50 50 //# animate - whether to perform animations 51 51 //# customFields - an optional list of name:"value" pairs to be assigned as tiddler fields (for edit templates) 52 52 //# toggle - if true, causes the tiddler to be closed if it is already opened 53 Story.prototype.displayTiddler = function(srcElement,ti tle,template,animate,unused,customFields,toggle)53 Story.prototype.displayTiddler = function(srcElement,tiddler,template,animate,unused,customFields,toggle) 54 54 { 55 var title = (tiddler instanceof Tiddler)? tiddler.title : tiddler; 55 56 var place = document.getElementById(this.container); 56 57 var tiddlerElem = document.getElementById(this.idPrefix + title); 57 58 if(tiddlerElem) { … … 490 491 this.closeAllTiddlers(); 491 492 highlightHack = new RegExp(useRegExp ? text : text.escapeRegExp(),useCaseSensitive ? "mg" : "img"); 492 493 var matches = store.search(highlightHack,"title","excludeSearch"); 493 var titles = []; 494 for(var t=0;t<matches.length;t++) 495 titles.push(matches[t].title); 496 this.displayTiddlers(null,titles); 494 this.displayTiddlers(null,matches); 497 495 highlightHack = null; 498 496 var q = useRegExp ? "/" : "'"; 499 497 if(matches.length > 0) 500 displayMessage(config.macros.search.successMsg.format([ titles.length.toString(),q + text + q]));498 displayMessage(config.macros.search.successMsg.format([matches.length.toString(),q + text + q])); 501 499 else 502 500 displayMessage(config.macros.search.failureMsg.format([q + text + q])); 503 501 }; … … 599 597 window.location.hash = t; 600 598 }; 601 599 600 -
Utilities.js
old new 183 183 var e = ev ? ev : window.event; 184 184 var tag = this.getAttribute("tag"); 185 185 var tagged = store.getTaggedTiddlers(tag); 186 var titles = []; 187 for(var t=0; t<tagged.length; t++) 188 titles.push(tagged[t].title); 189 story.displayTiddlers(this,titles); 186 story.displayTiddlers(this,tagged); 190 187 return false; 191 188 } 192 189 … … 290 287 return g.codes[name][b]; 291 288 } 292 289 290