diff --git a/source/Ox.UI/js/Core/UI.js b/source/Ox.UI/js/Core/UI.js index 7ac50e11..d50146d9 100644 --- a/source/Ox.UI/js/Core/UI.js +++ b/source/Ox.UI/js/Core/UI.js @@ -1,7 +1,59 @@ 'use strict'; +//@ Ox.DIMENSIONS Names of horizontal and vertical dimensions +Ox.DIMENSIONS = Ox.UI.DIMENSIONS = { + horizontal: ['width', 'height'], + vertical: ['height', 'width'] +}; + +//@ Ox.EDGES Names of horizontal and vertical edges +Ox.EDGES = Ox.UI.EDGES = { + horizontal: ['left', 'right', 'top', 'bottom'], + vertical: ['top', 'bottom', 'left', 'right'] +}; + +//@ Ox.SCOLLBAR_SIZE Size of scrollbars +Ox.SCROLLBAR_SIZE = Ox.UI.SCROLLBAR_SIZE = $.browser.webkit ? 8 : (function() { + var inner = Ox.$('

').css({ + height: '200px', + width: '100%' + }), + outer = Ox.$('

').css({ + height: '150px', + left: 0, + overflow: 'hidden', + position: 'absolute', + top: 0, + visibility: 'hidden', + width: '200px' + }).append(inner).appendTo($('body')), + width = inner[0].offsetWidth; + outer.css({overflow: 'scroll'}); + width = 1 + width - (inner[0].offsetWidth == width + ? outer[0].clientWidth : inner[0].offsetWidth); + outer.remove(); + return width; +})(); + +//@ Ox.UI_PATH Path of Ox UI +Ox.UI_PATH = Ox.UI.PATH = Ox.PATH + 'Ox.UI/'; + +//@ Ox.elements Reference to all Ox Elements +Ox.elements = Ox.$elements = Ox.UI.elements = {}; + /*@ -Ox.getImageURL Returns the URL of an Ox.UI image +Ox.getImageData Returns properties of an Ox UI image + (url) -> Image Name +@*/ +Ox.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]) + : null; +}); + +/*@ +Ox.getImageURL Returns the URL of an Ox UI image (name[, color[, theme]]) -> Image URL name Image name color Color name or RGB values @@ -9,7 +61,16 @@ Ox.getImageURL Returns the URL of an Ox.UI image @*/ Ox.getImageURL = Ox.cache(function(name, color, theme) { var colorName, - image = images[name], + colors = { + marker: { + '#000000': 'videoMarkerBorder', + '#FFFFFF': 'videoMarkerBackground' + }, + symbol: { + '#FF0000': 'symbolWarningColor' + } + }, + image = Ox.IMAGES[name], themeData, type = Ox.toDashes(name).split('-')[0]; color = color || 'default'; @@ -51,30 +112,15 @@ Ox.getOxElement = function(element) { return Ox.elements[$(element).data('oxid')]; }; +/*@ +Ox.hideScreen hide loading screen + () -> hide loading screen +@*/ +Ox.hideScreen = Ox.UI.hideLoadingScreen = function() { + Ox.LoadingScreen.hide(); +}; + //@ Ox.isOxElement Returns `true` if a DOM element is an Ox.Element Ox.isOxElement = Ox.UI.isOxElement = function(element) { return !!$(element).data('oxid'); }; - -//@ Ox.SCOLLBAR_SIZE size of scrollbars -Ox.SCROLLBAR_SIZE = Ox.UI.SCROLLBAR_SIZE = $.browser.webkit ? 8 : (function() { - var inner = Ox.$('

').css({ - height: '200px', - width: '100%' - }), - outer = Ox.$('

').css({ - height: '150px', - left: 0, - overflow: 'hidden', - position: 'absolute', - top: 0, - visibility: 'hidden', - width: '200px' - }).append(inner).appendTo($('body')), - width = inner[0].offsetWidth; - outer.css({overflow: 'scroll'}); - width = 1 + width - (inner[0].offsetWidth == width - ? outer[0].clientWidth : inner[0].offsetWidth); - outer.remove(); - return width; -})(); \ No newline at end of file