Skip to content

Instantly share code, notes, and snippets.

@kezabelle
Last active December 12, 2015 04:49
Show Gist options
  • Save kezabelle/4717179 to your computer and use it in GitHub Desktop.
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!
(() ->
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]"
)()
(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