From 7bede7774824956ada71e09cc881e328f4a78ea8 Mon Sep 17 00:00:00 2001 From: rolux Date: Mon, 25 Apr 2011 15:38:47 +0200 Subject: [PATCH] speed up css transform --- source/js/Ox.UI/Ox.UI.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/source/js/Ox.UI/Ox.UI.js b/source/js/Ox.UI/Ox.UI.js index 823adbb1..f2bca1f4 100644 --- a/source/js/Ox.UI/Ox.UI.js +++ b/source/js/Ox.UI/Ox.UI.js @@ -26,10 +26,13 @@ Ox.load.UI = function(options, callback) { version: 5 } ], - browserSupported = false; + browserSupported = false, + loadingInterval; browsers.forEach(function(browser) { - var match = browser.regexp(navigator.userAgent); + // fixme: check if this remains broken in wekbit nightlies + // var match = browser.regexp(navigator.userAgent); + var match = browser.regexp.exec(navigator.userAgent); if (match && match[1] >= browser.version) { browserSupported = true; } @@ -92,7 +95,8 @@ Ox.load.UI = function(options, callback) { .appendTo(div); }); */ - var deg = 0, element, interval, + var deg = 0, + element, src = Ox.PATH + 'svg/Ox.UI.' + options.theme + '/symbolLoading.svg' Ox.loadFile(src, function() { element = Ox.element('') @@ -107,13 +111,12 @@ Ox.load.UI = function(options, callback) { e.preventDefault() }) .appendTo(div); - setTimeout(function rotate() { + loadingInterval = setInterval(function() { deg = (deg + 30) % 360; element.css({ MozTransform: 'rotate(' + deg + 'deg)', WebkitTransform: 'rotate(' + deg + 'deg)' }); - Ox.element('OxLoadingScreen')[0] && setTimeout(rotate, 83); }, 83); }); } @@ -267,6 +270,7 @@ Ox.load.UI = function(options, callback) { $div.remove(); }); } else { + clearInterval(loadingInterval); $div.remove(); } });