Last active
December 12, 2015 04:49
-
-
Save kezabelle/4717179 to your computer and use it in GitHub Desktop.
Attempting to put django's silly namespaced jQuery back into the global namespace, yay pollution. Now with a CoffeeScript generated version! Is that better? I don't even know!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(() -> | |
if django?.jQuery? | |
# standard access via $ | |
window.$ = django.jQuery if not window.$ | |
# in case something is explicitly asking for jQuery. | |
window.jQuery = django.jQuery if not window.jQuery | |
# can we log the information? | |
if console?.log? | |
console.log "version #{ django.jQuery.fn.jquery.toString() } of jQuery applied to window[$|jQuery]" | |
)() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
if ((typeof django !== "undefined" && django !== null ? django.jQuery : void 0) != null) { | |
if (!window.$) { | |
window.$ = django.jQuery; | |
} | |
if (!window.jQuery) { | |
window.jQuery = django.jQuery; | |
} | |
if ((typeof console !== "undefined" && console !== null ? console.log : void 0) != null) { | |
return console.log("version " + (django.jQuery.fn.jquery.toString()) + " of jQuery applied to window[$|jQuery]"); | |
} | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment