On Sunday, October 11, 2020 at 11:51:14 AM UTC-7, Shareda wrote: > > TW Tones, yes, maybe I can do so, but.. I made this variable to get the > desired value from inside of my custumized link.js widget, which redraws > all internal links. The $:/hb/HighlightIntensityKW value can be changed > only by RangeWidget from UI, that's what I need. It works as i need except > of loosing current scroll position. > > Eric, can I get value of such <<hb-highlight-intensity-kw>> macro inside > of my customized link.js by some JavaScript expression? > If so, wouldn't that make it slower (compared to using a variable)? Now i > have *10 109 * linked tiddlers, and soon there will be ~ 25 000.
Now I get value by this JS line: > var highlightGain = Number(this.getVariable("hb-highlight-intensity-kw")); Macros *are* variables. Internally, in the TWCore, they are one and the same. The only difference is that the macro declaration syntax allows you to pass in optional parameters to be substituted into the macro value before returning. See https://tiddlywiki.com/#Macros, in which Jeremy writes: > Most macros are in fact just parameterised variables > <https://tiddlywiki.com/#Variables>. and > The dumpvariables <https://tiddlywiki.com/#dumpvariables%20Macro> macro > lists all variables (including macros) that are available at that position > in the widget tree. You should be able to get the value of the macro using Javascript in your customized link.js widget, as long as that widget is being rendered in a tiddler view, since the macro/variable defininition is being loaded via $:/tags/Macro/View. However, I can't test this myself since I don't have your customized code. I suggest placing the <<dumpvariables>> macro somewhere just before an occurrence of a link that uses your customized link.js code to see if it lists your hb-highlight-intensity-kw variable and value. You could also add console.log("highlight gain is:" + hightlightGain); somewhere in your link.js code, and then check the output in the browser's developer console window. -e -- 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 view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/f255395f-2b6a-47de-be89-13dd8ce7dd70o%40googlegroups.com.