Date: 2013-04-05 04:12 pm (UTC)
tuff_ghost: (Default)
From: [personal profile] tuff_ghost
That comment is just meant to represent the rest of any userscript's code. Because it's wrapped in a closure, you can have your own reference to jQuery inside, and name it whatever you want (the conventional $ being preferable to "unsafeWindow.jQuery" for terseness/cleanliness) without reassigning $ in the global scope.

Does this make more sense?

(function($) {
    // 500 lines of code where you do all kinds of cool stuff
    // using jQuery, but referencing it as $ rather than unsafeWindow.jQuery
    $('body').addClass('sparkly');
})(unsafeWindow.jQuery)
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting

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. 28th, 2025 04:45 pm
Powered by Dreamwidth Studios