On Apr 12, 9:15 pm, Dave Parker <[email protected]> wrote:
> I'm trying to get some javascript that works elsewhere in a
> "<script></script>" section to work in a checkbox like this:
>
> [_=chkokinl1(){}{}{
...
> }] eye oscillation is diminished or absent
>
> but the pair of curly brackets inside the original checkbox brackets (the
> "for" loop) seems to break the checkbox code.


As you noted, it's the use of curly brackets as delimiters for the
checkbox code that is the problem.  Because they are used as
delimiters, there's no way to also use the curly brackets within the
javascript code itself.

As a workaround, you could use InlineJavascriptPlugin to write a
global function definition, and then call that function from the
checkbox code, like this:
-----------------
<script>
window.checkboxHandler = function() {
  store.setValue("OKinL1","test",config.options.chkokinl1);
  var upd = store.getValue("OKinL1","test");
  var upd1 = (upd=="true") ? 1 : 0;
  var upd2 = Math.round((upd1*2)-1);
  store.setValue("OKinL1","wt",upd2);
  var tag=tiddler.title;
 
tids=store.sortTiddlers(store.getTaggedTiddlers(tag),'modified').reverse();
  for (var i=0; i<tids.length; i++) {
    var t2="[[" + tids[i].title + "]]";
    var t=tids[i].title;
    var wtDx=store.getValue(t,"wt");
    var newWt=Math.round(wtDx+upd2);
    store.setValue(t,"wt",newWt);
  }
}
</script>
[_=chkokinl1(){}{}{checkboxHandler();}] eye oscillation is diminished
or absent
-----------------

enjoy,
-e
Eric Shulman
TiddlyTools / ELS Design Studios

HELP ME TO HELP YOU - MAKE A CONTRIBUTION TO MY "TIP JAR"...
   http://www.TiddlyTools.com/#Donations

Professional TiddlyWiki Consulting Services...
Analysis, Design, and Custom Solutions:
   http://www.TiddlyTools.com/#Contact

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWikiDev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/tiddlywikidev?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to