[themes] refactoring
This commit is contained in:
parent
d14cc1e94f
commit
4749a5ea15
|
@ -219,6 +219,10 @@ define([
|
||||||
$('body').addClass(theme_name);
|
$('body').addClass(theme_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( !document.body.className.match(/theme-type-/) ) {
|
||||||
|
document.body.classList.add('theme-type-' + themes_map[theme_name].type);
|
||||||
|
}
|
||||||
|
|
||||||
var obj = get_current_theme_colors(name_colors);
|
var obj = get_current_theme_colors(name_colors);
|
||||||
obj.type = themes_map[theme_name].type;
|
obj.type = themes_map[theme_name].type;
|
||||||
obj.name = theme_name;
|
obj.name = theme_name;
|
||||||
|
@ -261,10 +265,8 @@ define([
|
||||||
|
|
||||||
setTheme: function (id, force) {
|
setTheme: function (id, force) {
|
||||||
if ( (this.currentThemeId() != id || force) && !!themes_map[id] ) {
|
if ( (this.currentThemeId() != id || force) && !!themes_map[id] ) {
|
||||||
var classname = document.body.className.replace(/theme-[\w-]+\s?/, '');
|
document.body.className = document.body.className.replace(/theme-[\w-]+\s?/gi, '').trim();
|
||||||
document.body.className = classname;
|
document.body.classList.add(id, 'theme-type-' + themes_map[id].type);
|
||||||
|
|
||||||
$('body').addClass(id);
|
|
||||||
|
|
||||||
var obj = get_current_theme_colors(name_colors);
|
var obj = get_current_theme_colors(name_colors);
|
||||||
obj.type = themes_map[id].type;
|
obj.type = themes_map[id].type;
|
||||||
|
|
Loading…
Reference in a new issue