fix Ox.App in Firefox 3.6 to show loading screen, fixes #393

This commit is contained in:
j 2012-02-17 10:24:42 +00:00
parent 1a6da64b6b
commit f919d64044
3 changed files with 9 additions and 6 deletions

View file

@ -47,7 +47,8 @@ Ox.API = function(options, callback) {
Ox.forEach(result.data.actions, function(val, key) { Ox.forEach(result.data.actions, function(val, key) {
that[key] = function(/*data, age, callback*/) { that[key] = function(/*data, age, callback*/) {
var data = {}, age = -1, callback = null; var data = {}, age = -1, callback = null;
Ox.forEach(arguments, function(argument) { //Ox.makeArray required for Firefox 3.6 because Ox.isArguments fails
Ox.forEach(Ox.makeArray(arguments), function(argument) {
if (Ox.isObject(argument)) { if (Ox.isObject(argument)) {
data = argument; data = argument;
} else if (Ox.isNumber(argument)) { } else if (Ox.isNumber(argument)) {

View file

@ -81,11 +81,12 @@ window.Ox = {
} }
function loadScript(script, callback) { function loadScript(script, callback) {
var element = document.createElement('script'); var element = document.createElement('script'),
head = document.head || document.getElementsByTagName( "head" )[0] || document.documentElement;
element.onload = callback; element.onload = callback;
element.src = path + script + '?' + parseInt(Math.random() * 1000000); element.src = path + script + '?' + parseInt(Math.random() * 1000000);
element.type = 'text/javascript'; element.type = 'text/javascript';
document.head.appendChild(element); head.appendChild(element);
} }
} }

View file

@ -68,6 +68,7 @@ Ox.loadFile = (function() {
var cache = {}; var cache = {};
return function (file, callback) { return function (file, callback) {
var element, var element,
head = document.head || document.getElementsByTagName( "head" )[0] || document.documentElement,
request, request,
type = file.split('.').pop(), type = file.split('.').pop(),
isImage = type != 'css' && type != 'js'; isImage = type != 'css' && type != 'js';
@ -94,7 +95,7 @@ Ox.loadFile = (function() {
element.onload = addFileToCache; element.onload = addFileToCache;
} }
} }
document.head.appendChild(element); head.appendChild(element);
} else { } else {
addFileToCache(); addFileToCache();
} }