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