@Alex, Yes I found this in the magical Javascript Missing Manual :D I am currently doing this via the view template <span> method - because I was to lazy to add the line to every tiddler with a table :D I will definitely try the simplified code tips - thx ELS ! (beginning to learn JS - so I tend to take the long route . . .)
the actual code is pretty small, so back to my original question - is it better to leave it as a script - or convert to a plugin? Last Question - the original code had (1) problem, when I had tables inside tabs (via the tabs macro) it only rendered highlighting on the first tab, will the simplified code or a plugin version fix this? Off to experiment - Thank You for all of the suggestions !! On Jul 13, 12:16 pm, Alex Hough <[email protected]> wrote: > RE: > > <span macro='tiddler TableHighlight'></span> > > A penny just dropped! I have a TW with <<tiddler tiddlerScripts>> in > all the tiddlers. I knew there was a simple way. "Come in!", as the > kids at Alsager Comprehensive School used to say. > > This is the kind of thing that should be saved. Its a valuable > question with an excellent answer which goes further than answering > the initial question. It illuminates something else. > > @Mike, is that example from the Javascript Missing Manual? > > Alex > > 2009/7/13 Eric Shulman <[email protected]>: > > > > > > >> <script> > > ... > >> (function($) { > >> $(document).ready(function( ) { > >> $('table.sortable tbody tr').mouseover(function(){ > > ... > >> }); > >> $('table.sortable tbody tr').mouseout(function(){ > > ... > >> })}); > >> })(jQuery); > >> </script> > > > It seems that the intent of your script is to use jQuery selectors, > > e.g., $('table.sortable tbody tr'), to add mouseover/mouseout handlers > > to any table row elements of specific tiddler content, each time that > > tiddler is displayed. If this is the case, then the use of "$ > > (document).ready(...)" is not correct here. That function is used to > > register a 'callback' handler that is invoked when the document is > > initially loaded... an event that occurs just once, *prior* to any > > TiddlyWiki code being invoked (not even the TW core!), and long before > > any inline script can be applied to *rendered* tiddler content. > > > Try this simplified [[TableHighlight]] code structure: > > > <script> > > jQuery('table.sortable tbody tr').mouseover(function(){ ... }); > > jQuery('table.sortable tbody tr').mouseout(function(){ ... }); > > jQuery('table.twtable tbody tr').mouseover(function(){ ... }); > > jQuery('table.twtable tbody tr').mouseout(function(){ ... }); > > </script> > > > Then, to invoke this script, just place > > <<tiddler TableHighlight>> > > at the end of any desired tiddler content. Or... if you want to apply > > the script to *every* tiddler, add the following at the end of the > > [[ViewTemplate]]: > > <span macro='tiddler TableHighlight'></span> > > > enjoy, > > -e > > Eric Shulman > > TiddlyTools / ELS Design Studios > > --http://www.multiurl.com/g/64 --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

