From f2141d792dd5be49323f2c419f8544c085d95c8a Mon Sep 17 00:00:00 2001 From: rlx <0x0073@0x2620.org> Date: Thu, 25 Sep 2014 19:41:23 +0200 Subject: [PATCH] move Ox. etc. into Core/UI.js, re-add some aliases --- source/Ox.UI/js/Core/UI.js | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/source/Ox.UI/js/Core/UI.js b/source/Ox.UI/js/Core/UI.js index 51f98e03..1ec116c8 100644 --- a/source/Ox.UI/js/Core/UI.js +++ b/source/Ox.UI/js/Core/UI.js @@ -38,6 +38,18 @@ Ox.SCROLLBAR_SIZE = Ox.UI.SCROLLBAR_SIZE = $.browser.webkit ? 8 : (function() { //@ Ox.UI_PATH Path of Ox UI Ox.UI_PATH = Ox.UI.PATH = Ox.PATH + 'Ox.UI/'; +Ox.documentReady(function() { + // FIXME: use Ox.$foo everywhere! + //@ Ox.$body jQuery-wrapped body + Ox.$body = Ox.UI.$body = $('body'); + //@ Ox.$document jQuery-wrapped document + Ox.$document = Ox.UI.$document = $(document); + //@ Ox.$head jQuery-wrapped head + Ox.$head = Ox.UI.$head = $('head'); + //@ Ox.$window jQuery-wrapped window + Ox.$window = Ox.UI.$window = $(window); +}); + //@ Ox.$elements Reference to all Ox Elements Ox.$elements = Ox.UI.elements = {}; @@ -45,7 +57,7 @@ Ox.$elements = Ox.UI.elements = {}; Ox.getImageData Returns properties of an Ox UI image (url) -> Image Name @*/ -Ox.getImageData = Ox.cache(function(url) { +Ox.getImageData = Ox.UI.getImageData = Ox.cache(function(url) { var str = 'data:image/svg+xml;base64,'; return Ox.startsWith(url, str) ? JSON.parse(atob(url.split(',')[1]).match(//)[1]) @@ -59,7 +71,7 @@ Ox.getImageURL Returns the URL of an Ox UI image color Color name or RGB values theme Theme name @*/ -Ox.getImageURL = Ox.cache(function(name, color, theme) { +Ox.getImageURL = Ox.UI.getImageURL = Ox.cache(function(name, color, theme) { var colorName, colors = { marker: { @@ -108,13 +120,12 @@ Ox.getImageURL = Ox.cache(function(name, color, theme) { }); //@ Ox.getOxElement Returns the Ox.Element of a DOM element, or `undefined` -Ox.getOxElement = function(element) { +Ox.getOxElement = Ox.UI.getOxElement = function(element) { return Ox.$elements[$(element).data('oxid')]; }; /*@ -Ox.hideScreen hide loading screen - () -> hide loading screen +Ox.hideScreen Hide and remove Ox UI loading screen @*/ Ox.hideScreen = Ox.UI.hideLoadingScreen = function() { Ox.UILoadingScreen.hide();