move Ox.Theme.getThemes and Ox.Theme.getThemeData into Ox.Theme; Ox.UI -> Ox
This commit is contained in:
parent
86bee39b51
commit
eaaa8602e7
1 changed files with 20 additions and 3 deletions
|
@ -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 <f> Returns the names of all available themes
|
||||
() -> [s] Theme names
|
||||
@*/
|
||||
that.getThemes = function() {
|
||||
return Object.keys(Ox.THEMES);
|
||||
};
|
||||
|
||||
/*@
|
||||
getThemeData <f> Returns data for a given theme, or for the current theme
|
||||
([theme]) -> <o> Theme data
|
||||
theme <s> Theme name
|
||||
@*/
|
||||
that.getThemeData = function(theme) {
|
||||
return Ox.THEMES[theme || Ox.Theme()];
|
||||
};
|
||||
|
||||
/*@
|
||||
formatColor <f> Returns a themed colored element
|
||||
@*/
|
||||
|
|
Loading…
Reference in a new issue