Created
December 10, 2010 19:50
-
-
Save tobsn/736705 to your computer and use it in GitHub Desktop.
Revisions
-
Tobias O. revised this gist
Dec 16, 2010 . 1 changed file with 6 additions and 6 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,27 +1,27 @@ (function(j,q,u,e,r,y,R,o,x){try{o=jQuery;if(o&&(!R||(R&&o.fn.jquery==R))){x=true}}catch(er){}if(!x||(R&&o.fn.jquery!=R)){(q=j.createElement(q)).type='text/javascript';if(r){q.async=true}q.src='//ajax.googleapis.com/ajax/libs/jquery/'+(R||1)+'/jquery.min.js';u=j.getElementsByTagName(u)[0];q.onload=q.onreadystatechange=(function(){if(!e&&(!this.readyState||this.readyState=='loaded'||this.readyState=='complete')){e=true;x=jQuery;jQuery.noConflict(true)(function(){y(x)});q.onload=q.onreadystatechange=null;u.removeChild(q)}});u.appendChild(q)}else{y(o)}})(document,'script','head',false,false,(function($){$(function(){ /* code goes here */ console.log($.fn.jquery); })})); // readable: (function (j, q, u, e, r, y, R, o, x ) { // IE8 undefined crash fix try { // check if we can assign jQuery o=jQuery; // if jquery is defined and version is not set or version is set and matches the existing one if( o && ( !R || ( R && o.fn.jquery == R ) ) ) { x = true; } } catch(er) {} // if jquery isnt set or version is defined and its not matching if( !x || ( R && o.fn.jquery != R ) ) { (q = j.createElement(q)).type = 'text/javascript'; if (r) { q.async = true; } // dont need http|https - /1/ means latest 1.x version q.src = '//ajax.googleapis.com/ajax/libs/jquery/'+(R||1)+'/jquery.min.js'; u = j.getElementsByTagName(u)[0]; // onload event for callback q.onload = q.onreadystatechange = (function () { -
Tobias O. revised this gist
Dec 13, 2010 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -39,7 +39,7 @@ u.appendChild(q); } else { // jquery is already there and version matches or we dont care about version y( o ); } // async callback -
Tobias O. revised this gist
Dec 13, 2010 . 1 changed file with 48 additions and 33 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,37 +1,52 @@ (function(j,q,u,e,r,y,r,o,x){try{o=jQuery;if(o&&(!r||(r&&o.fn.jquery==r))){x=true}}catch(r){}if(!x||(r&&o.fn.jquery!=r)){(q=j.createElement(q)).type='text/javascript';if(r){q.async=true}q.src='//ajax.googleapis.com/ajax/libs/jquery/'+(r||1)+'/jquery.min.js';u=j.getElementsByTagName(u)[0];q.onload=q.onreadystatechange=(function(){if(!e&&(!this.readyState||this.readyState=='loaded'||this.readyState=='complete')){e=true;x=jQuery;jQuery.noConflict(true)(function(){y(x)});q.onload=q.onreadystatechange=null;u.removeChild(q)}});u.appendChild(q)}else{y(o)}})(document,'script','head',false,false,(function($){$(function(){ /* code goes here */ console.log($.fn.jquery); })})); // readable: (function (j, q, u, e, r, y, r, o, x ) { // IE8 undefined crash fix try { // check if we can assign jQuery o=jQuery; // if jquery is defined and version is not set or version is set and matches the existing one if( o && ( !r || ( r && o.fn.jquery == r ) ) ) { x = true; } } catch(r) {} // if jquery isnt set or version is defined and its not matching if( !x || ( r && o.fn.jquery != r ) ) { (q = j.createElement(q)).type = 'text/javascript'; if (r) { q.async = true; } // dont need http|https - /1/ means latest 1.x version q.src = '//ajax.googleapis.com/ajax/libs/jquery/'+(r||1)+'/jquery.min.js'; u = j.getElementsByTagName(u)[0]; // onload event for callback q.onload = q.onreadystatechange = (function () { // first fire when completely loaded and parsed & check if this happened before if (!e && (!this.readyState || this.readyState == 'loaded' || this.readyState == 'complete')) { e = true; // copy space into new var, release control and execute callbacks with passed in own version of jQ x = jQuery; jQuery.noConflict(true)(function(){y(x);}); // IE memory leak protection q.onload = q.onreadystatechange = null; u.removeChild(q); } }); u.appendChild(q); } else { // jquery is already there and version matches y( o ); } // async callback })(document, 'script', 'head', false, false, (function ($) { $(function(){ /* code goes here */ console.log( $.fn.jquery ); }); // version if needed - optional (see compressed version above) }),'1.4.2'); -
Tobias O. revised this gist
Dec 10, 2010 . 1 changed file with 6 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -8,19 +8,25 @@ if (typeof(jQuery) == 'undefined') { (q = j.createElement(q)).type = 'text/javascript'; if (r) { q.async = true; } // dont need http|https - /1/ means latest 1.x version q.src = '//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js'; u = j.getElementsByTagName(u)[0]; // onload event for callback q.onload = q.onreadystatechange = (function () { // first fire when completely loaded and parsed & check if this happened before if (!e && (!this.readyState || this.readyState == 'loaded' || this.readyState == 'complete')) { e = true; // execute your jquery code now y(); // IE memory leak protection q.onload = q.onreadystatechange = null; u.removeChild(q); } }); u.appendChild(q); } else { // looks like jquery is already loaded - just execute code right away y(); } // async callback -
Tobias O. revised this gist
Dec 10, 2010 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ (function(j,q,u,e,r,y){if(typeof(jQuery)=='undefined'){(q=j.createElement(q)).type='text/javascript';if(r){q.async=true;}q.src='//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js';u=j.getElementsByTagName(u)[0];q.onload=q.onreadystatechange=(function(){if(!e&&(!this.readyState||this.readyState=='loaded'||this.readyState=='complete')){e=true;y();q.onload=q.onreadystatechange=null;u.removeChild(q);}});u.appendChild(q);}else{y();}})(document,'script','head',false,false,(function(){$(function(){ /* code goes here */ });})); -
Tobias O. revised this gist
Dec 10, 2010 . 1 changed file with 10 additions and 8 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,28 +1,30 @@ (function(j,q,u,e,r,y){if(typeof(jQuery)=='undefined'){(q=j.createElement(q)).type='text/javascript';q.src='//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js';u=j.getElementsByTagName(u)[0];q.onload=q.onreadystatechange=(function(){if(!e&&(!this.readyState||this.readyState=='loaded'||this.readyState=='complete')){e=true;y();q.onload=q.onreadystatechange=null;u.removeChild(q);}});u.appendChild(q);}else{y();}})(document,'script','head',false,false,(function(){$(function(){ /* code goes here */ });})); // readable: (function (j, q, u, e, r, y) { if (typeof(jQuery) == 'undefined') { (q = j.createElement(q)).type = 'text/javascript'; if (r) { q.async = true; } q.src = '//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js'; u = j.getElementsByTagName(u)[0]; q.onload = q.onreadystatechange = (function () { if (!e && (!this.readyState || this.readyState == 'loaded' || this.readyState == 'complete')) { e = true; y(); q.onload = q.onreadystatechange = null; u.removeChild(q); } }); u.appendChild(q); } else { y(); } // async callback })(document, 'script', 'head', false, false, (function () { $(function(){ /* code goes here */ }); -
Tobias O. revised this gist
Dec 10, 2010 . 1 changed file with 6 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ (function(j,q,e,r,y){if(typeof(jQuery)=='undefined'){(q=j.createElement(q)).type='text/javascript';q.src='//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js';e=j.getElementsByTagName(e)[0];q.onload=q.onreadystatechange=(function(){if(!r&&(!this.readyState||this.readyState=='loaded'||this.readyState=='complete')){r=true;y();q.onload=q.onreadystatechange=null;e.removeChild(q);}});e.appendChild(q);}else{y();}})(document,'script','head',false,(function(){$(function(){ /* code goes here */ });})); // readable: @@ -23,5 +23,7 @@ y(); } })(document, 'script', 'head', false, (function () { $(function(){ /* code goes here */ }); })); -
Tobias O. renamed this gist
Dec 10, 2010 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
Tobias O. created this gist
Dec 10, 2010 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,27 @@ (function(j,q,e,r,y){if(typeof(jQuery)=='undefined'){(q=j.createElement(q)).type='text/javascript';q.src='//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js';e=j.getElementsByTagName(e)[0];q.onload=q.onreadystatechange=(function(){if(!r&&(!this.readyState||this.readyState=='loaded'||this.readyState=='complete')){r=true;y();q.onload=q.onreadystatechange=null;e.removeChild(q);}});e.appendChild(q);}else{y();}})(document,'script','head',false,(function(){ /* code goes here */ })); // readable: (function (j, q, e, r, y) { if (typeof(jQuery) == 'undefined') { (q = j.createElement(q)).type = 'text/javascript'; q.src = '//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js'; e = j.getElementsByTagName(e)[0]; q.onload = q.onreadystatechange = (function () { if (!r && (!this.readyState || this.readyState == 'loaded' || this.readyState == 'complete')) { r = true; y(); q.onload = q.onreadystatechange = null; e.removeChild(q); } }); e.appendChild(q); } else { y(); } })(document, 'script', 'head', false, (function () { /* code goes here */ }));