1
0
Fork 0
forked from 0x2620/oxjs

support opera until failure screen

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

View file

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