function Foo1() { var bar = 'test'; }
AFAIK, itβs not possible to access a panel of variables from a global scope unless one of them writes a privileged function, for example
function Foo2() { var bar = 'test'; this.read = function(){return bar;}; }
Does Greasemonkey (or some other tool) provide any means to access the variable bar, with the exception of overriding the entire Foo1 function with Foo2? Greasemonkey has a GM_xmlhttprequest that wraps certain restrictions, so I was wondering if this could do this and save some problems.
I'm currently trying to read and write a private variable built into a function, which itself is also in a separate .js include. Thus, I cannot directly modify the script, and I need to load .js using AJAX, perform the modification, and then overwrite the original script. This is very cumbersome, and I would like this method to be easier.
source share