fix Ox.UI loader

This commit is contained in:
rlx 2014-09-25 19:08:03 +02:00
parent 61bb4b782e
commit 01f563b102

View file

@ -51,6 +51,13 @@ Ox.load.UI = function(options, callback) {
browserSupported = false, browserSupported = false,
isInternetExplorer = /MSIE/.test(navigator.userAgent); isInternetExplorer = /MSIE/.test(navigator.userAgent);
browsers.forEach(function(browser) {
var match = browser.regexp && browser.regexp.exec(navigator.userAgent);
if (match && match[1] >= browser.version) {
browserSupported = true;
}
});
Ox.UI = {}; // FIXME: remove Ox.UI = {}; // FIXME: remove
Ox.LoadingScreen = (function() { Ox.LoadingScreen = (function() {
@ -198,16 +205,16 @@ Ox.load.UI = function(options, callback) {
return { return {
hide: function() { hide: function() {
$div.animate({ $screen.animate({
opacity: browserSupported ? 0 : 0.9 opacity: browserSupported ? 0 : 0.9
}, 1000, function() { }, 1000, function() {
if (browserSupported) { if (browserSupported) {
clearInterval(loadingInterval); clearInterval(loadingInterval);
$div.remove(); $screen.remove();
} else { } else {
$div.on({ $screen.on({
click: function() { click: function() {
$div.remove(); $screen.remove();
} }
}); });
} }
@ -220,13 +227,6 @@ Ox.load.UI = function(options, callback) {
}()); }());
browsers.forEach(function(browser) {
var match = browser.regexp && browser.regexp.exec(navigator.userAgent);
if (match && match[1] >= browser.version) {
browserSupported = true;
}
});
Ox.documentReady(function() { Ox.documentReady(function() {
Ox.$('body').addClass('OxTheme' + Ox.toTitleCase(options.theme)); Ox.$('body').addClass('OxTheme' + Ox.toTitleCase(options.theme));
options.showScreen && Ox.LoadingScreen.show(); options.showScreen && Ox.LoadingScreen.show();