b69d3d7edd
- replace gulp with rollup - remove JS output from repo
21 lines
498 B
JavaScript
21 lines
498 B
JavaScript
/**
|
|
* Add listener for theme mode toggle
|
|
*/
|
|
const $toggleElem = $('.mode-toggle');
|
|
|
|
export function modeWatcher() {
|
|
if ($toggleElem.length === 0) {
|
|
return;
|
|
}
|
|
|
|
$toggleElem.off().on('click', (e) => {
|
|
const $target = $(e.target);
|
|
let $btn =
|
|
$target.prop('tagName') === 'button'.toUpperCase()
|
|
? $target
|
|
: $target.parent();
|
|
|
|
modeToggle.flipMode(); // modeToggle: `_includes/mode-toggle.html`
|
|
$btn.trigger('blur'); // remove the clicking outline
|
|
});
|
|
}
|