diff --git a/index.js b/index.js index 0c972962..0721d2b7 100644 --- a/index.js +++ b/index.js @@ -1,3 +1,5 @@ +'use strict'; + Ox.load(function() { var app = { @@ -37,26 +39,6 @@ Ox.load(function() { ); }); }, - animateLoading: function() { - var css, deg = 0, - previousTime = +new Date(); - animationInterval = setInterval(function() { - var currentTime = +new Date(), - delta = (currentTime - previousTime) / 1000, - loadingIcon = document.getElementById('loadingIcon'); - if(loadingIcon) { - previousTime = currentTime; - deg = Math.round((deg + delta * 360) % 360 / 30) * 30; - css = 'rotate(' + deg + 'deg)'; - loadingIcon.style.MozTransform = css; - loadingIcon.style.MSTransform = css; - loadingIcon.style.OTransform = css; - loadingIcon.style.WebkitTransform = css; - } else { - clearInterval(animationInterval); - } - }, 83); - }, data: { html: {}, pages: [ @@ -258,7 +240,7 @@ Ox.load(function() { .append(app.$ui.screen) .append(app.$ui.logo) .append(app.$ui.loading); - app.animateLoading(); + app.rotate(); callback(); } }); @@ -321,6 +303,26 @@ Ox.load(function() { app.$ui[element] && app.$ui[element].css(app.getCSS(element)); }); }, + rotate: function() { + var css, deg = 0, + previousTime = +new Date(), + interval = setInterval(function() { + var currentTime = +new Date(), + delta = (currentTime - previousTime) / 1000, + loadingIcon = document.getElementById('loadingIcon'); + if (loadingIcon) { + previousTime = currentTime; + deg = Math.round((deg + delta * 360) % 360 / 30) * 30; + css = 'rotate(' + deg + 'deg)'; + loadingIcon.style.MozTransform = css; + loadingIcon.style.MSTransform = css; + loadingIcon.style.OTransform = css; + loadingIcon.style.WebkitTransform = css; + } else { + clearInterval(interval); + } + }, 83); + }, setTheme: function(theme) { app.user.theme = theme; app.db(app.user);