Advertisement
Guest User

Untitled

a guest
Jan 5th, 2013
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function abc() {
  2.     $(function() {
  3.         // do sth
  4.     })
  5. }
  6.  
  7. function addJQuery(callback) {
  8.     "use strict";
  9.     var script = document.createElement("script");
  10.     script.textContent = "(" + callback.toString() + ")();";
  11.     document.body.appendChild(script);
  12. }
  13. if (typeof $ === 'undefined') {
  14.     if (unsafeWindow.jQuery) {
  15.         $ = unsafeWindow.jQuery;
  16.         abc();
  17.     } else {addJQuery(abc);}
  18. } else {
  19.     abc();
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement