44 lines
1.6 KiB
JavaScript
44 lines
1.6 KiB
JavaScript
|
(function() {
|
||
|
var image = new Image(),
|
||
|
src = document.scripts ?
|
||
|
document.scripts[0].getAttribute('src')
|
||
|
.replace('js/ox.load.js', 'png/ox.ui.classic/loading.png') :
|
||
|
'/static/oxjs/build/png/ox.ui.classic/loading.png';
|
||
|
image.src = src;
|
||
|
image.onload = function() {
|
||
|
var deg = 0,
|
||
|
img = document.createElement('img'),
|
||
|
key,
|
||
|
style = {
|
||
|
position: 'absolute',
|
||
|
left: 0,
|
||
|
top: 0,
|
||
|
right: 0,
|
||
|
bottom: 0,
|
||
|
width: '32px',
|
||
|
height: '32px',
|
||
|
margin: 'auto',
|
||
|
//opacity: 0,
|
||
|
MozUserSelect: 'none',
|
||
|
WebkitUserSelect: 'none'
|
||
|
};
|
||
|
img.setAttribute('src', src);
|
||
|
for (var key in style) {
|
||
|
img.style[key] = style[key];
|
||
|
}
|
||
|
document.body ? loaded() : document.addEventListener('DOMContentLoaded', loaded, false);
|
||
|
function loaded() {
|
||
|
//var opacity = 0;
|
||
|
document.removeEventListener('DOMContentLoaded', loaded, false);
|
||
|
//document.body.style.background = 'rgb(240, 240, 240)';
|
||
|
document.body.appendChild(img);
|
||
|
setInterval(function() {
|
||
|
//opacity += 0.083
|
||
|
deg = (deg + 30) % 360;
|
||
|
//img.style.opacity = Math.max(opacity, 1);
|
||
|
img.style.MozTransform = 'rotate(' + deg + 'deg)';
|
||
|
img.style.WebkitTransform = 'rotate(' + deg + 'deg)';
|
||
|
}, 83);
|
||
|
}
|
||
|
}
|
||
|
})();
|