--
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 greasemonkey-us...@googlegroups.com.
To post to this group, send email to greasemon...@googlegroups.com.
Visit this group at http://groups.google.com/group/greasemonkey-users.
For more options, visit https://groups.google.com/d/optout.
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 <drsrfro...@gmail.com>:
Same here, half a dozen scripts broken. The easiest way is to use "@grant none", 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 greasemonkey-users+unsub...@googlegroups.com.
To unsubscribe from this group and all its topics, send an email to greasemonkey-us...@googlegroups.com.
To unsubscribe from this group and all its topics, send an email to greasemonkey-users+unsubscribe@googlegroups.com.
To post to this group, send email to greasemon...@googlegroups.com.
Visit this group at http://groups.google.com/group/greasemonkey-users.
For more options, visit https://groups.google.com/d/optout.
To unsubscribe from this group and all its topics, send an email to greasemonkey-us...@googlegroups.com.
To unsubscribe from this group and all its topics, send an email to greasemonkey-users+unsubscribe@googlegroups.com.
To post to this group, send email to greasemon...@googlegroups.com.
Visit this group at http://groups.google.com/group/greasemonkey-users.
For more options, visit https://groups.google.com/d/optout.
To unsubscribe from this group and all its topics, send an email to greasemonkey-us...@googlegroups.com.
To unsubscribe from this group and all its topics, send an email to greasemonkey-us...@googlegroups.com.
// Native handler
handle = ontype && cur[ ontype ];
if ( handle && jQuery.acceptData( cur ) && handle.apply && handle.apply( cur, data ) === false ) {
event.preventDefault();
}
handle() is a page-scope function, and jQuery tries to call it while passing script-scope data object as parameter.
handle.apply( cur, data )
Of course, it doesn't end well. I was unable to quickfix it by inserting a call to cloneInto(), as for some reason it returns an error when I attempt to export data.
You could file a bug to jQuery developers, but I'm unsure if they will try to fix it - after all, jQuery wasn't specifically intended to be used in userscripts.
It's not just click() - any time jQuery does something like this, you will run into problems.
So the only way to work around it I can think of is to inject jQuery into the target page and work there, using postMessage() or user-defined events to communicate with priviledged code...
--
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 greasemonkey-us...@googlegroups.com.
To unsubscribe from this group and all its topics, send an email to greasemonkey-users+unsub...@googlegroups.com.
To unsubscribe from this group and all its topics, send an email to greasemonkey-us...@googlegroups.com.
To unsubscribe from this group and all its topics, send an email to greasemonkey-us...@googlegroups.com.