diff --git a/source/Ox/js/Request.js b/source/Ox/js/Request.js index 03ccef2b..4d56bd37 100644 --- a/source/Ox/js/Request.js +++ b/source/Ox/js/Request.js @@ -83,105 +83,6 @@ Ox.getAsync = function(urls, get, callback) { urls.some(Ox.isArray) ? getSerial() : getParallel(); }; -/* -Ox.getFile = (function() { - - var cache = {}; - - function getFile(file, callback) { - var element, - head = document.head - || document.getElementsByTagName('head')[0] - || document.documentElement, - request, - type = file.split('.').pop(), - isImage = type != 'css' && type != 'js'; - if (!cache[file]) { - if (isImage) { - element = new Image(); - element.onload = addFileToCache; - element.src = file; - } else { - if (!findFileInHead()) { - element = document.createElement( - type == 'css' ? 'link' : 'script' - ); - element[ - type == 'css' ? 'href' : 'src' - ] = file + '?' + (Ox.DEBUG ? Ox.random(1000000) : Ox.VERSION); - element.type = type == 'css' ? 'text/css' : 'text/javascript'; - if (type == 'css') { - element.rel = 'stylesheet'; - waitForCSS() - } else { - element.onload = element.onreadystatechange = function() { - - }; - } - if (/MSIE/.test(navigator.userAgent)) { - // fixme: find a way to check - // if css/js have loaded in msie - setTimeout(addFileToCache, 2500); - } else { - if (type == 'css') { - waitForCSS(); - } else { - element.onload = addFileToCache; - } - } - head.appendChild(element); - } else { - addFileToCache(); - } - } - } else { - callback(); - } - function addFileToCache() { - if (isImage) { - // for an image, save the element itself, - // so that it remains in the browser cache - cache[file] = element; - callback(element); - } else { - cache[file] = true; - callback(); - } - } - function findFileInHead() { - return Ox.slice( - document.getElementsByTagName(type == 'css' ? 'link' : 'script') - ).map(function(element) { - return element[type == 'css' ? 'href' : 'src'] == file; - }).reduce(function(prev, curr) { - return prev || curr; - }, false); - } - function waitForCSS() { - var error = false; - try { - element.sheet.cssRule; - } catch (e) { - error = true; - setTimeout(function() { - waitForCSS(); - }, 25); - } - !error && addFileToCache(); - } - }; - - return function(files, callback) { - Ox.getAsync(files, function(file, callback) { - getFile(file, function(images) { - callback(images ? {file: images} : {}); - }); - }, callback); - }; - -}()); -*/ - (function() { var cache = {},