fallenswordhelper / legacy_issues

0 stars 0 forks source link

Comment from JT regarding jQuery detect logic #1134

Open gschizas opened 9 years ago

gschizas commented 9 years ago

Originally reported on Google Code with ID 1135

JT Burke says
with grease monkey how come you use a timeout to test for jQuery?
var $ = unsafeWindow.jQuery;

$(function(){
    $('#GM').html('GM initialised')
});
worked fine

JT Burke says
i tested it on the live version too

JT Burke says
id rather you use jquery where possible as its more cross-browser compatible
and more robust

Reported by fraserstanton on 2011-03-17 00:07:52

gschizas commented 9 years ago
If you're going to use this method you'll probably want to either include a backup version
of jQuery (and components) via requires just incase you hit a page where jQuery isn't
included and initialise jQuery yourself or if it isn't loaded simply don't run anything.
I'll do some testing on fall backs and such if I get time.

I think the current timeout checking loop would carry on forever anyway if jQuery isn't
included (Probably not a good thing).

Fallen Sword will continue to utilise jQuery and jQuery UI for the foreseeable future.
We'll likely produce a list of modules we include on the Tools forum in the near future.

I may even whip up a beginners toolkit so people can create their own mini-mods, we'll
see about that tough.

Reported by jtburke88 on 2011-03-17 00:18:55

gschizas commented 9 years ago
FS uses jquery 1.4 (or later), which will generate error if used with @require. So the
only way to use jquery in FSH is to load it in the page (not in GM), then gets the
$ object from unsafeWindow. Fortunately, FS already loads it for us, so FSH just waits
until jquery available.
We might need to include a jquery backup as in the 1st link below, but that might complicate
the problem unnecessarily.
Details: 
+ http://joanpiedra.com/jquery/greasemonkey/
+ http://forum.jquery.com/topic/importing-jquery-1-4-1-into-greasemonkey-scripts-generates-an-error

Reported by ipodseeker on 2011-03-17 05:11:51

gschizas commented 9 years ago
Hmm loading without the @require is a bit of a pain. So long as we use the same jQuery
modules/files on every page there shouldn't be a problem. I don't think there's many
pages without these files right now and it's likely we'll be adding them to every page
anyway for the tooltip framework to work.

It's probably easier for HCS to include jQuery (and relevant plugins) on every page
for you. I'll speak to hoof I'm sure there wouldn't be much of a problem.

Reported by jtburke88 on 2011-03-17 10:06:32

gschizas commented 9 years ago
pretty sure this issue is closed.

Reported by Vong.Help on 2012-01-11 14:29:51