This commit is contained in:
rolux 2012-05-30 00:28:29 +02:00
parent c12c49d4d1
commit f3490dc8d5

View file

@ -1,3 +1,5 @@
'use strict';
Ox.load(function() { Ox.load(function() {
var app = { 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: { data: {
html: {}, html: {},
pages: [ pages: [
@ -258,7 +240,7 @@ Ox.load(function() {
.append(app.$ui.screen) .append(app.$ui.screen)
.append(app.$ui.logo) .append(app.$ui.logo)
.append(app.$ui.loading); .append(app.$ui.loading);
app.animateLoading(); app.rotate();
callback(); callback();
} }
}); });
@ -321,6 +303,26 @@ Ox.load(function() {
app.$ui[element] && app.$ui[element].css(app.getCSS(element)); 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) { setTheme: function(theme) {
app.user.theme = theme; app.user.theme = theme;
app.db(app.user); app.db(app.user);