[themes] refactoring

This commit is contained in:
Maxim Kadushkin 2021-05-25 17:16:00 +03:00
parent d14cc1e94f
commit 4749a5ea15

View file

@ -219,6 +219,10 @@ define([
$('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);
obj.type = themes_map[theme_name].type;
obj.name = theme_name;
@ -261,10 +265,8 @@ define([
setTheme: function (id, force) {
if ( (this.currentThemeId() != id || force) && !!themes_map[id] ) {
var classname = document.body.className.replace(/theme-[\w-]+\s?/, '');
document.body.className = classname;
$('body').addClass(id);
document.body.className = document.body.className.replace(/theme-[\w-]+\s?/gi, '').trim();
document.body.classList.add(id, 'theme-type-' + themes_map[id].type);
var obj = get_current_theme_colors(name_colors);
obj.type = themes_map[id].type;