Add theme overview on hover

This commit is contained in:
ClemDee 2019-06-05 14:28:06 +02:00
parent bfba5ff33b
commit 3dbced46f1

View file

@ -272,12 +272,26 @@ define([
setTheme(lastTheme, $block);
$block.find('a').click(function () {
var isHovering = false;
var $aThemes = $block.find('a');
$aThemes.mouseenter(function () {
isHovering = true;
var theme = $(this).attr('data-value');
setTheme(theme, $block);
});
$aThemes.mouseleave(function () {
if (isHovering) {
setTheme(lastTheme, $block);
Common.setAttribute(themeKey, lastTheme);
}
});
$aThemes.click(function () {
isHovering = false;
var theme = $(this).attr('data-value');
setTheme(theme, $block);
Common.setAttribute(themeKey, theme);
});
if ($drawer) { $drawer.append($block); }
if (cb) { cb(); }
};