From d8b796acb9275e74324c3ea04324314ecbe1b664 Mon Sep 17 00:00:00 2001 From: Brandon Mathis Date: Tue, 7 Jun 2011 10:45:01 -0400 Subject: Another massive commit: 1. Major improvements to the responsive styling. 2. Toggleable sidebar 3. Upgraded to modernizr 2.0 which includes Respond.js 4. IE7-9 testing and fixes 5. New theming system which should make forkers happy 6. New rake task for installing Octopress themes 7. Magic --- source/javascripts/libs/jXHR.js | 85 ----------------------------------------- 1 file changed, 85 deletions(-) delete mode 100644 source/javascripts/libs/jXHR.js (limited to 'source/javascripts/libs/jXHR.js') diff --git a/source/javascripts/libs/jXHR.js b/source/javascripts/libs/jXHR.js deleted file mode 100644 index 6775655c..00000000 --- a/source/javascripts/libs/jXHR.js +++ /dev/null @@ -1,85 +0,0 @@ -// jXHR.js (JSON-P XHR) -// v0.1 (c) Kyle Simpson -// MIT License - -(function(global){ - var SETTIMEOUT = global.setTimeout, // for better compression - doc = global.document, - callback_counter = 0; - - global.jXHR = function() { - var script_url, - script_loaded, - jsonp_callback, - scriptElem, - publicAPI = null; - - function removeScript() { try { scriptElem.parentNode.removeChild(scriptElem); } catch (err) { } } - - function reset() { - script_loaded = false; - script_url = ""; - removeScript(); - scriptElem = null; - fireReadyStateChange(0); - } - - function ThrowError(msg) { - try { publicAPI.onerror.call(publicAPI,msg,script_url); } catch (err) { throw new Error(msg); } - } - - function handleScriptLoad() { - if ((this.readyState && this.readyState!=="complete" && this.readyState!=="loaded") || script_loaded) { return; } - this.onload = this.onreadystatechange = null; // prevent memory leak - script_loaded = true; - if (publicAPI.readyState !== 4) ThrowError("Script failed to load ["+script_url+"]."); - removeScript(); - } - - function fireReadyStateChange(rs,args) { - args = args || []; - publicAPI.readyState = rs; - if (typeof publicAPI.onreadystatechange === "function") publicAPI.onreadystatechange.apply(publicAPI,args); - } - - publicAPI = { - onerror:null, - onreadystatechange:null, - readyState:0, - open:function(method,url){ - reset(); - internal_callback = "cb"+(callback_counter++); - (function(icb){ - global.jXHR[icb] = function() { - try { fireReadyStateChange.call(publicAPI,4,arguments); } - catch(err) { - publicAPI.readyState = -1; - ThrowError("Script failed to run ["+script_url+"]."); - } - global.jXHR[icb] = null; - }; - })(internal_callback); - script_url = url.replace(/=\?/,"=jXHR."+internal_callback); - fireReadyStateChange(1); - }, - send:function(){ - SETTIMEOUT(function(){ - scriptElem = doc.createElement("script"); - scriptElem.setAttribute("type","text/javascript"); - scriptElem.onload = scriptElem.onreadystatechange = function(){handleScriptLoad.call(scriptElem);}; - scriptElem.setAttribute("src",script_url); - doc.getElementsByTagName("head")[0].appendChild(scriptElem); - },0); - fireReadyStateChange(2); - }, - setRequestHeader:function(){}, // noop - getResponseHeader:function(){return "";}, // basically noop - getAllResponseHeaders:function(){return [];} // ditto - }; - - reset(); - - return publicAPI; - }; -})(window); - -- cgit v1.2.1