support opera until failure screen

This commit is contained in:
rolux 2011-04-25 13:08:06 +02:00
parent ecde8e7f87
commit 735ddc9d4a
3 changed files with 33 additions and 28 deletions

View file

@ -79,13 +79,7 @@ Ox.App = (function() {
}; };
}); });
that.api.init(getUserData(), function(result) { that.api.init(getUserData(), function(result) {
var $div = $('div'); Ox.UI.hideLoadingScreen();
$('img').remove();
$div.animate({
opacity: 0
}, 1000, function() {
$div.remove();
});
that.triggerEvent({ that.triggerEvent({
load: result.data load: result.data
}); });

View file

@ -43,8 +43,6 @@ Ox.load.UI = function(options, callback) {
function showScreen() { function showScreen() {
console.log('showScreen')
var body = Ox.element('body'), var body = Ox.element('body'),
css = { css = {
position: 'absolute', position: 'absolute',
@ -106,7 +104,6 @@ Ox.load.UI = function(options, callback) {
browsers.forEach(function(browser) { browsers.forEach(function(browser) {
browser.src = Ox.PATH + 'png/ox.ui/browser' + browser.name + '128.png'; browser.src = Ox.PATH + 'png/ox.ui/browser' + browser.name + '128.png';
Ox.loadFile(browser.src, function() { Ox.loadFile(browser.src, function() {
Ox.print(counter)
++counter == browsers.length && showIcons(); ++counter == browsers.length && showIcons();
}); });
}); });
@ -158,25 +155,24 @@ Ox.load.UI = function(options, callback) {
$.getJSON(Ox.PATH + 'json/Ox.UI.json', function(files) { $.getJSON(Ox.PATH + 'json/Ox.UI.json', function(files) {
var promises = []; var promises = [];
files.forEach(function(file) { files.forEach(function(file) {
// fixme: opera doesnt fire onload for svg
if ($.browser.opera && Ox.endsWith(file, '.svg')) {
return;
}
var dfd = new $.Deferred(); var dfd = new $.Deferred();
Ox.loadFile(Ox.PATH + file, function() { Ox.loadFile(Ox.PATH + file, function() {
dfd.resolve(); dfd.resolve();
}); });
promises.push(dfd.promise()) promises.push(dfd.promise());
}); });
Ox.print(promises.length)
$.when.apply(null, promises) $.when.apply(null, promises)
.done(function() { .done(function() {
Ox.print('promises done')
$(function() { $(function() {
var $div;
Ox.Theme(options.theme); Ox.Theme(options.theme);
if (browserSupported && options.showScreen && options.hideScreen) { if (options.showScreen && options.hideScreen) {
$div = $('.OxLoadingScreen'); Ox.UI.hideLoadingScreen();
//$div.find('img').remove();
$div.animate({
opacity: 0
}, 1000, function() {
$div.remove();
});
} }
callback(browserSupported); callback(browserSupported);
}); });
@ -214,7 +210,6 @@ Ox.load.UI = function(options, callback) {
} }
}()); }());
Ox.UI.elements = {};
Ox.UI.DEFAULT_THEME = 'classic'; // fixme: needed? Ox.UI.DEFAULT_THEME = 'classic'; // fixme: needed?
Ox.UI.DIMENSIONS = { Ox.UI.DIMENSIONS = {
horizontal: ['width', 'height'], horizontal: ['width', 'height'],
@ -224,6 +219,7 @@ Ox.load.UI = function(options, callback) {
horizontal: ['left', 'right', 'top', 'bottom'], horizontal: ['left', 'right', 'top', 'bottom'],
vertical: ['top', 'bottom', 'left', 'right'] vertical: ['top', 'bottom', 'left', 'right']
}; };
Ox.UI.elements = {};
Ox.UI.getImagePath = function(filename) { Ox.UI.getImagePath = function(filename) {
// fixme: not the best idea to do this here // fixme: not the best idea to do this here
if (filename == 'symbolPlay.svg') { if (filename == 'symbolPlay.svg') {
@ -232,6 +228,23 @@ Ox.load.UI = function(options, callback) {
return Ox.PATH + filename.split('.').pop() + return Ox.PATH + filename.split('.').pop() +
'/Ox.UI.' + Ox.Theme() + '/' + filename; '/Ox.UI.' + Ox.Theme() + '/' + filename;
}; };
Ox.UI.hideLoadingScreen = function() {
Ox.print('hideLoadingScreen')
var $div = $('.OxLoadingScreen'),
error = $div.is('.OxError');
//$div.find('img').remove();
$div.animate({
opacity: error ? 0.9 : 0
}, 1000, function() {
if (error) {
$div.click(function() {
$div.remove();
});
} else {
$div.remove();
}
});
};
Ox.UI.IMAGE_CACHE = []; Ox.UI.IMAGE_CACHE = [];
Ox.UI.SCROLLBAR_SIZE = $.browser.mozilla ? 16 : 12; Ox.UI.SCROLLBAR_SIZE = $.browser.mozilla ? 16 : 12;
// fixme: the follwing should be deprecated // fixme: the follwing should be deprecated

View file

@ -196,15 +196,13 @@ Ox.loadFile = (function() {
callback(); callback();
} }
function addFileToCache() { function addFileToCache() {
type == 'svg' && Ox.print('addToCache', file)
if (type == 'css' || type == 'js') { if (type == 'css' || type == 'js') {
cache['file'] = true; cache['file'] = true;
callback(); callback();
} else { } else {
cache['file'] = element; cache['file'] = element;
callback({ callback(element);
width: element.width,
height: element.heigth
});
} }
} }
function findFileInHead() { function findFileInHead() {
@ -1239,7 +1237,7 @@ Ox.documentReady = (function() {
var callbacks = []; var callbacks = [];
document.onreadystatechange = function() { document.onreadystatechange = function() {
if (document.readyState == 'complete') { if (document.readyState == 'complete') {
Ox.print('document has become ready', callbacks); //Ox.print('document has become ready', callbacks);
callbacks.forEach(function(callback) { callbacks.forEach(function(callback) {
callback(); callback();
}); });
@ -1248,11 +1246,11 @@ Ox.documentReady = (function() {
}; };
return function(callback) { return function(callback) {
if (document.readyState == 'complete') { if (document.readyState == 'complete') {
Ox.print('document is ready') //Ox.print('document is ready')
callback(); callback();
} else { } else {
callbacks.push(callback); callbacks.push(callback);
Ox.print('document is not ready', callbacks) //Ox.print('document is not ready', callbacks)
} }
} }
}()); }());