TiddlyWiki.org

Ticket #170: Ticket170.patch

File Ticket170.patch, 4.1 kB (added by SaqImtiaz, 10 months ago)
  • main.js

    old new  
    8383        invokeParamifier(params,"onstart"); 
    8484        if(story.isEmpty()) { 
    8585                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); 
    8987        } 
    9088        window.scrollTo(0,0); 
    9189} 
  • Paramifiers.js

    old new  
    6060config.paramifiers.tag = { 
    6161        onstart: function(v) { 
    6262                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); 
    6564        } 
    6665}; 
    6766 
     
    9291        } 
    9392}; 
    9493 
     94 
  • Story.js

    old new  
    3131}; 
    3232 
    3333//# Display several tiddlers given their titles in an array. Parameters same as displayTiddler(), except: 
    34 //# titles - array of string titles 
     34//# titles - array of tiddlers or string titles 
    3535Story.prototype.displayTiddlers = function(srcElement,titles,template,animate,unused,customFields,toggle) 
    3636{ 
    3737        for(var t = titles.length-1;t>=0;t--) 
     
    4343//# custom fields were provided, then an attempt is made to retrieve the tiddler from the server 
    4444//# srcElement - reference to element from which this one is being opened -or- 
    4545//#              special positions "top", "bottom" 
    46 //# title - title of tiddler to display 
     46//# tiddler - tiddler or title of tiddler to display 
    4747//# template - the name of the tiddler containing the template -or- 
    4848//#            one of the constants DEFAULT_VIEW_TEMPLATE and DEFAULT_EDIT_TEMPLATE -or- 
    4949//#            null or undefined to indicate the current template if there is one, DEFAULT_VIEW_TEMPLATE if not 
    5050//# animate - whether to perform animations 
    5151//# customFields - an optional list of name:"value" pairs to be assigned as tiddler fields (for edit templates) 
    5252//# toggle - if true, causes the tiddler to be closed if it is already opened 
    53 Story.prototype.displayTiddler = function(srcElement,title,template,animate,unused,customFields,toggle) 
     53Story.prototype.displayTiddler = function(srcElement,tiddler,template,animate,unused,customFields,toggle) 
    5454{ 
     55        var title = (tiddler instanceof Tiddler)? tiddler.title : tiddler;   
    5556        var place = document.getElementById(this.container); 
    5657        var tiddlerElem = document.getElementById(this.idPrefix + title); 
    5758        if(tiddlerElem) { 
     
    490491        this.closeAllTiddlers(); 
    491492        highlightHack = new RegExp(useRegExp ?   text : text.escapeRegExp(),useCaseSensitive ? "mg" : "img"); 
    492493        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); 
    497495        highlightHack = null; 
    498496        var q = useRegExp ? "/" : "'"; 
    499497        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])); 
    501499        else 
    502500                displayMessage(config.macros.search.failureMsg.format([q + text + q])); 
    503501}; 
     
    599597                window.location.hash = t; 
    600598}; 
    601599 
     600 
  • Utilities.js

    old new  
    183183        var e = ev ? ev : window.event; 
    184184        var tag = this.getAttribute("tag"); 
    185185        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); 
    190187        return false; 
    191188} 
    192189 
     
    290287        return g.codes[name][b]; 
    291288} 
    292289 
     290