>
>
> <a href="#" onclick="var x=2;callMyFunction();" style="color:AliceBlue">
> click</a>
>
> ...which is pure evil,
> throwing all the different aspects of a program
> into one bucket where eventually
> you never find the right spot
> ...or manage to manage that code, ever again.
>

>From the gentleman who brought this bit of code:

<a 
> href="javascript:void((function()%7Bvar%20e%3D%22%5B!is%5Bshadow%5D!is%5Bsystem%5D%5D%22%2Ct%3Dprompt(%22Please%20define%20a%20filter...%22%2Ce)%3Be%3Dt%7C%7Ce%3Bvar%20n%3D%5B%5D%3B%24tw.utils.each(%24tw.wiki.filterTiddlers(e)%2Cfunction(e)%7Bvar%20t%3D0%2Cr%3D%24tw.wiki.getTiddler(e)%3Bn.push(%7Btitle%3Ae%2Csize%3A%24tw.wiki.getTiddlerAsJson(e).length.toString()%2Cfields%3AObject.keys(r.fields).length%2Ctype%3Ar.fields%5B%22type%22%5D%7C%7C%22%22%7D)%7D)%3Bn.sort(function(e%2Ct)%7Breturn%20t.size-e.size%7D)%3Bvar%20r%3D%22%22%3B%24tw.utils.each(n%2Cfunction(e)%7Br%2B%3De.size%2B%22%20%5B%5B%22%2Be.title%2B%22%5D%5D%2C%20%22%2Be.fields%2B%22%20fields%22%2B(e.type%3F%22%2C%20%22%2Be.type%3A%22%22)%2B%22%5Cn%22%7D)%3Bvar%20i%3D%22%24%3A%2FStoryList%22%2Cs%3D%22%24%3A%2Ftemp%2Ftiddler-sizes%22%2Co%3D%24tw.wiki.getTiddlerList(i)%3B%24tw.wiki.addTiddler(new%20%24tw.Tiddler(%7Btitle%3As%2Ctext%3A'%22%22%22%5Cn'%2Br%2B'%22%22%22'%7D))%3Bif(o.indexOf(s)%3D%3D%3D-1)%7Bo.unshift(s)%7D%24tw.wiki.addTiddler(new%20%24tw.Tiddler(%7Btitle%3Ai%7D%2C%24tw.wiki.getTiddler(i)%2C%7Blist%3Ao%7D))%3Bconsole.log(r)%7D)())%3B"
>  
> title="Bookmark me!">tiddler sizes</a>


in 
http://tbdemo.tiddlyspot.com/#Draft%20of%20%27Console%20Log%20Of%20Tiddler%20Sizes%27

I'm not sure, though, that you answered Mat's question: How do I integrate 
a javascript into TW?

Only some non-TW javascripts can be incorporated in TW at all. Nothing 
requiring a modification of the <body> element such as <body 
onload="dynAnimation8()"> will work. Nothing that uses a OnClick= like 
"<input type="button" value="  1  " onClick="head1()">" will work because 
TW with its security concerns strips away the "OnClick." Nothing that 
requires the script to be located at a specific location such as 
immediately after a textarea will work. Javascripts that can be completely 
contained in the <head></head> section and interact with named elements or 
windows components may work. Javascripts that can be completely self 
contained like Tobias' Console Log Of Tiddler Sizes may work.

Scripts that are stored in the <head></head> section can be handled in TW 
by giving the tiddler the tag "$:/tags/RawMarkup" 

You can invoke a javascript by using the same trick Tobias used in the bit 
of code above by entering <a href="javascript:head1()">Click here for 
javascript head1</a>. You can use this, sometimes, to get around the 
OnClick restriction.

If a task is possible using TW systems and components, then do it that way. 
If you're going to play with Javascripts and TW, then do lot's of backups. 



 

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywiki.
For more options, visit https://groups.google.com/d/optout.

Reply via email to