On Sun, Jan 31, 2010 at 10:48 PM, Kia <[email protected]> wrote:
>
>> [1]http://joanpiedra.com/jquery/greasemonkey/
>> [2]http://userscripts.org/scripts/review/50771
>
> Maby I'm looking at the wrong place, but url [2] is using @resource,
> and Google Chrome does not support @require and @resource.

Sorry, you're right: I meant @resource, not @require. The principle is
however the same since the resource is downloaded only once.
@resource and @require are relatively new additions to the GM header
keywords.  Browsers like Chrome or Opera in which support for
userscripts was inspired on GM don't currently have direct equivalent
to these, as far as I know, but I'm not using any of these browsers,
so check for yourself whether this is true. As I pointed out, if
@resource is not available in Chrome, you can still use the original
method of Joan Piedra.

>
> Url [1] looks interesting. But will it work if Google already has
> jQuery loaded on a specific page?

You can check for the presence of the jQuery object in the page
(unsafeWindow.jQuery). There is however the risk that jQuery is not
fully loaded at the time your script runs, so to be sure you'll have
to defer everything until the 'load' event to be sure (i.e., put your
whole script inside a onload handler), which might or might not be an
option, depending on what you're attempting to do.
The second, most obvious approach, is to spend 15 minutes of your
precious life only once and check every page the script is intended to
run on and check whether jQuery is already running there, but I assume
you've already considered this option.

-- 
You received this message because you are subscribed to the Google Groups 
"greasemonkey-users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/greasemonkey-users?hl=en.

Reply via email to