in Ox.UI loader, use Ox.$ and .bind()

This commit is contained in:
rolux 2012-04-15 14:17:19 +02:00
parent 5a90520186
commit 53cb716130

View file

@ -52,8 +52,9 @@ Ox.load.UI = function(options, callback) {
});
Ox.documentReady(function() {
Ox.element('body')
.addClass('OxTheme' + Ox.toTitleCase(options.theme || 'classic'));
Ox.$('body').addClass(
'OxTheme' + Ox.toTitleCase(options.theme || 'classic')
);
options.showScreen && showScreen();
});
@ -61,7 +62,7 @@ Ox.load.UI = function(options, callback) {
function showScreen() {
var body = Ox.element('body'),
var body = Ox.$('body'),
css = {
position: 'absolute',
left: 0,
@ -72,7 +73,7 @@ Ox.load.UI = function(options, callback) {
MozUserSelect: 'none',
WebkitUserSelect: 'none'
},
div = Ox.element('<div>')
div = Ox.$('<div>')
.addClass('OxLoadingScreen')
.css({
position: 'absolute',
@ -96,7 +97,7 @@ Ox.load.UI = function(options, callback) {
// SVG transform performs worse than CSS transform
var src = Ox.PATH + 'Ox.UI/themes/' + options.theme + '/svg/symbolLoadingAnimated.svg'
Ox.loadFile(src, function() {
Ox.element('<img>')
Ox.$('<img>')
.attr({
src: src
})
@ -104,8 +105,10 @@ Ox.load.UI = function(options, callback) {
width: '32px',
height: '32px'
}, css))
.mousedown(function(e) {
e.preventDefault()
.bind({
mousedown: function(e) {
e.preventDefault();
}
})
.appendTo(div);
});
@ -114,7 +117,7 @@ Ox.load.UI = function(options, callback) {
element,
src = Ox.PATH + 'Ox.UI/themes/' + options.theme + '/svg/symbolLoading.svg'
Ox.loadFile(src, function() {
element = Ox.element('<img>')
element = Ox.$('<img>')
.attr({
src: src
})
@ -122,8 +125,10 @@ Ox.load.UI = function(options, callback) {
width: '32px',
height: '32px'
}, css))
.mousedown(function(e) {
e.preventDefault()
.bind({
mousedown: function(e) {
e.preventDefault()
}
})
.appendTo(div);
loadingInterval = setInterval(function() {
@ -155,14 +160,14 @@ Ox.load.UI = function(options, callback) {
});
});
function showIcons() {
var box = Ox.element('<div>')
var box = Ox.$('<div>')
.css(Ox.extend({
width: (browsers.length * 72) + 'px',
height: '72px'
}, css))
.appendTo(div);
browsers.forEach(function(browser, i) {
var link = Ox.element('<a>')
var link = Ox.$('<a>')
.attr({
href: browser.url,
title: (browser.name == 'Chrome Frame' ? 'Install' : 'Download')
@ -175,7 +180,7 @@ Ox.load.UI = function(options, callback) {
height: '72px',
})
.appendTo(box);
Ox.element('<img>')
Ox.$('<img>')
.attr({
src: browser.src
})
@ -185,8 +190,10 @@ Ox.load.UI = function(options, callback) {
border: 0,
cursor: 'pointer'
}, css))
.mousedown(function(e) {
e.preventDefault();
.bind({
mousedown: function(e) {
e.preventDefault();
}
})
.appendTo(link);
});