tuff_ghost: (Default)
[personal profile] tuff_ghost posting in [community profile] ao3some
If your userscript @requires jQuery, and your users are on Firefox, it's going to break JS running on Ao3 since the latest deploy, particularly the JS which shows modal boxes and hides the Share code on works.

If you're like me you were @requiring jQuery because you wanted your script to run in Chrome on Tampermonkey (where your script is sandboxed away from the host jQuery instance), and you didn't want to maintain two different copies of your script for Greasemonkey and Tampermonkey.

So, @require jQuery breaks stuff in Firefox, but you still need jQuery in Chrome. The solution is to get your jQuery instance from unsafeWindow.jQuery - this will point to the host instance of jQuery.


(function($) {
// your code which uses jQuery normally as $
})(unsafeWindow.jQuery);

Date: 2013-04-04 10:40 pm (UTC)
jjhunter: closeup of jjhunter's blue skinned Glitch in flight (glitch jj 2)
From: [personal profile] jjhunter
From your keyboard to admin's ear!

Date: 2013-04-04 11:21 pm (UTC)
jjhunter: The shorthand declares the function `cs50`, i.e. the cs class, takes input type `student` and returns output type 'god' (cs50)
From: [personal profile] jjhunter
Well, as one of the people who has been *plagued* by wacky navigation display issues using the site on Firefox since the most recent site deploy, you have my deep & abiding thanks.

Date: 2013-04-05 06:16 am (UTC)
amalthia: (Default)
From: [personal profile] amalthia
is this something individual users can update in the script?

Date: 2013-04-06 06:58 am (UTC)
amalthia: (Default)
From: [personal profile] amalthia
I'll give it a try. :) Thanks!

Date: 2013-04-05 03:34 pm (UTC)
poulpette: A man with a puzzled face (SoT - Richard o_ô)
From: [personal profile] poulpette
Could you please expand a bit on what you mean by // your code which uses jQuery normally as $?

Date: 2013-04-05 06:04 pm (UTC)
poulpette: cropped picture of an illustrated octopus (Default)
From: [personal profile] poulpette
It does, thank you very much. I wasn't sure that was what you meant. Does this also mean that I'd be using whatever version of jQuery the AO3 is currently using?

Date: 2013-04-05 06:42 pm (UTC)
From: (Anonymous)
Yep. It's not just the same source, it's the same instance, so you should even have access to whatever jQuery plugins the host site is running. (which is actually the whole reason for this post; userscripts were replacing the host instance after a plugin had loaded, killing the plugin)

Date: 2013-04-05 08:22 pm (UTC)
poulpette: Stick-figure of a smiling head, raising heart pompoms. Bottom half says YAY!!! (Misc - devs = awesome)
From: [personal profile] poulpette
So I suppose I no longer need the @require line? and the script will still run for Chrome users?

Thank you for you help :)

Date: 2013-04-06 08:54 pm (UTC)
tinny: Something Else holding up its colorful drawing - "be different" (Default)
From: [personal profile] tinny
Thank you so much, this is really helping. I had figured out that it worked again when I disabled Greasemonkey, but since there wasn't just one specific script wrong, but all of the ao3 scripts I've installed, I didn't know who to ask first.

Date: 2013-04-14 04:20 am (UTC)
flamebyrd: (Default)
From: [personal profile] flamebyrd
Thanks very much for this! I had one script that included jQuery and had scratched my head for a long time trying to figure out how to include the Archive's jQuery instance.

On a somewhat unrelated note... A while back I made my own clone of TumblrSavior for the archive (literally a clone - I used all his code too, with permission). Now I want to tweak it to be a little more intelligent and use jQuery, but I see you've already made a more intelligent version! I wanted to add the ability to filter by Work ID, and for my own education I'd like to try adding a configuration interface (using GM_setValue etc, or possibly http://userscripts.org/guides/11).

Anyway tl;dr, I don't think userscripts.org supports forking, so do you mind if I use your code as a basis for this? It seems like your approach is pretty much the same as the one I was pondering. XD

Date: 2013-04-14 04:53 am (UTC)
flamebyrd: (Default)
From: [personal profile] flamebyrd
*nods* I think userscripts.org is a great place to store them, just for the ease-of-installation factor.

Thanks, I'll also look into localStorage - I had considered it but my non-comprehensive Googling indicated that it might be a little flakey with userscripts.

June 2021

S M T W T F S
  12345
6789101112
1314 1516171819
20212223242526
27282930   

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated May. 22nd, 2025 01:34 pm
Powered by Dreamwidth Studios