Allright I think I understand - the script needs the tiddler to be called "SomeList".... Could this be made generic? So I can use my newly created button on any tiddler in which it is present?
YS Måns Mårtensson On 28 Aug., 00:03, Måns <[email protected]> wrote: > Thanks a lot for reminding me of how to make the script usable as a > clickable button - and the lazy slider solved some other problems I've > had with mediacontent, which started to early in IE .. - But > > I've written this in a tiddler called ListeMakro: > <script label="ListT"> > var titles=store.getTiddlerText("SomeList").readBracketedList(); > for (var i=0; i<titles.length; i++) store.setTiddlerTag(titles > [i],'tagName',true); // true=set, false=clear > </script> > > and put in a custom viewtemplate (only used for tiddlers tagged with a > certain tag) like this: > <span class macro='tiddler ListeMakro'></span> > > I should now be able to run the macro on a bracketed list: > I tried: > [[12 34]] > [[56 78]] > [[910 1112]] > > But got this error:" TypeError: Cannot call method 'readBracketedList' > of null" > I have also tried a list like this: > 1 > 2 > 3 > 4 > > - But got the same error. > > What am I doing wrong? > > YS Måns Mårtensson > > On 27 Aug., 21:35, Eric Shulman <[email protected]> wrote: > > > > > > For not having this script invoked every > > > time you open this tiddler, simply place it in a slider, for example > > > NestedSliders: > > > > +++ > > > <script> > > > var titles=store.getTiddlerText("SomeList").readBracketedList(); > > > for (var i=0; i<titles.length; i++) > > > store.setTiddlerTag(titles[i],'tagName',true); // true=set, > > > false=clear > > > </script> > > > === > > > To prevent the script from being immediately invoked, you have to use > > a "lazy" slider (by adding the "..." syntax), like this: > > > +++[click to run]... > > <script> > > ... > > </script> > > === > > > However, this only invokes the script the first time the slider is > > opened. A much better (and simpler) way to defer processing is to use > > the label="..." syntax of InlineJavascriptPlugin to create an > > 'onclick' script: > > > <script label="click to run"> > > ... > > </script> > > > enjoy, > > -e --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "TiddlyWiki" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/tiddlywiki?hl=en -~----------~----~----~----~------~----~------~--~---

