Well, I solved it in a different manner. I run everything I can in script
scope, load settings into an object, then export that object into
unsafeWindow via cloneInto() and run the rest in page scope via script tag
injection.
It works for simple scripts that don't need to call priviledged calls from
pages scope. If you do need it, you might want to use
addEventListener()/postMessage() combo.


2014-07-15 3:33 GMT+04:00 Dr Sr <[email protected]>:

> Same here, half a dozen scripts broken. The easiest way is to use "@grant
> none <http://wiki.greasespot.net/@grant>", so your script runs in the
> page context and can carry on as before. Replace "unsafeWindow" with
> "window". You lose access to all the GM_ calls, but if you're only using
> GM_getValue()/setValue() anyway, see the compatibility shim in the above
> link for a drop-in replacement that uses localStorage.
>
> On Sunday, July 13, 2014 12:57:16 AM UTC+12, TheVindicar wrote:
>>
>> Where can I read about writing scripts in accordance with new API? Since
>> now I can't even iterate over page-defined jQuery collection using
>> script-defined callback, every single one of my scripts is broken.
>>
>> Pretty much all of them use the same scheme:
>> 1. load settings into object via GM_getValue()
>> 2. find and modify some DOM nodes according to the settings
>> 3. (optionally) replace some functions in the target page with my own
>> versions
>>
>> Now I fail to understand how do I do that using cloneInto() and
>> exportFunction(). The fact Firefox shows wrong line number in error message
>> doesn't help either.
>>
>  --
> You received this message because you are subscribed to a topic in the
> Google Groups "greasemonkey-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/greasemonkey-users/SXfpyvcQofQ/unsubscribe
> .
> To unsubscribe from this group and all its topics, 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/greasemonkey-users.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"greasemonkey-users" 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/greasemonkey-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to