diff --git a/source/Ox.UI/js/Core/Theme.js b/source/Ox.UI/js/Core/Theme.js index 87824aa8..7cfab653 100644 --- a/source/Ox.UI/js/Core/Theme.js +++ b/source/Ox.UI/js/Core/Theme.js @@ -15,7 +15,7 @@ Ox.Theme = (function() { }; function getTheme() { - var classNames = Ox.UI.$body.attr('class'), + var classNames = Ox.$body.attr('class'), theme = ''; classNames && Ox.forEach(classNames.split(' '), function(className) { if (Ox.startsWith(className, 'OxTheme')) { @@ -85,7 +85,7 @@ Ox.Theme = (function() { function setTheme(theme) { var currentTheme = getTheme(); if (theme != currentTheme && Ox.contains(that.getThemes(), theme)) { - Ox.UI.$body + Ox.$body .addClass( 'OxTheme' + theme[0].toUpperCase() @@ -119,7 +119,7 @@ Ox.Theme = (function() { $('img').add('input[type="image"]').not('.OxColor') .each(function(element) { var $element = $(this), - data = Ox.UI.getImageData($element.attr('src')); + data = Ox.getImageData($element.attr('src')); data && $element.attr({ src: Ox.getImageURL(data.name, data.color, theme) }); @@ -129,6 +129,23 @@ Ox.Theme = (function() { return that; } + /*@ + getThemes Returns the names of all available themes + () -> [s] Theme names + @*/ + that.getThemes = function() { + return Object.keys(Ox.THEMES); + }; + + /*@ + getThemeData Returns data for a given theme, or for the current theme + ([theme]) -> Theme data + theme Theme name + @*/ + that.getThemeData = function(theme) { + return Ox.THEMES[theme || Ox.Theme()]; + }; + /*@ formatColor Returns a themed colored element @*/