mirror of
https://github.com/notion-enhancer/notion-enhancer.git
synced 2025-04-07 22:19:02 +00:00
night shift checks every interaction to respond to system changes
This commit is contained in:
parent
904cae5375
commit
cacb6554c7
@ -27,6 +27,7 @@ module.exports = {
|
|||||||
const observer = new MutationObserver(process);
|
const observer = new MutationObserver(process);
|
||||||
observer.observe(notion_elem, {
|
observer.observe(notion_elem, {
|
||||||
attributes: true,
|
attributes: true,
|
||||||
|
subtree: true,
|
||||||
});
|
});
|
||||||
function process(list, observer) {
|
function process(list, observer) {
|
||||||
const mode = `notion-app-inner notion-${
|
const mode = `notion-app-inner notion-${
|
||||||
@ -34,8 +35,7 @@ module.exports = {
|
|||||||
? 'dark'
|
? 'dark'
|
||||||
: 'light'
|
: 'light'
|
||||||
}-theme`;
|
}-theme`;
|
||||||
if (list[0].target.className !== mode)
|
if (notion_elem.className !== mode) notion_elem.className = mode;
|
||||||
list[0].target.className = mode;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user