mirror of
https://github.com/notion-enhancer/notion-enhancer.git
synced 2025-04-04 20:59:02 +00:00
make it possible to enabled/disable multiple extensions
This commit is contained in:
parent
fac7a72654
commit
a57b7ca57a
@ -21,7 +21,7 @@ complete rewrite with node.js.
|
||||
- theme: "neutral" = smoother colours and fonts, designed to be more pleasing to the eye.
|
||||
- theme: "gameish" = a purple, "gamer-styled" theme with a blocky-font.
|
||||
- theme: "pastel dark" = a true dark theme with a hint of pastel.
|
||||
- extension: "emojiset" = pick from a variety of emoji styles to use.
|
||||
- extension: "emoji sets" = pick from a variety of emoji styles to use.
|
||||
- extension: "night shift" = sync dark/light theme with the system (overrides normal theme setting).
|
||||
- extension: "right-to-left" = enables auto rtl/ltr text direction detection. (ported from [github.com/obahareth/notion-rtl](https://github.com/obahareth/notion-rtl).)
|
||||
|
||||
|
@ -373,7 +373,8 @@ window['__start'] = async () => {
|
||||
? 1
|
||||
: a.name.localeCompare(b.name)
|
||||
)) {
|
||||
const menuStore = store('mods', { [mod.id]: { enabled: false } }),
|
||||
const enabled = store('mods', { [mod.id]: { enabled: false } })[mod.id]
|
||||
.enabled,
|
||||
author =
|
||||
typeof mod.author === 'object'
|
||||
? mod.author
|
||||
@ -384,9 +385,7 @@ window['__start'] = async () => {
|
||||
};
|
||||
mod.elem = createElement(`
|
||||
<section class="${
|
||||
mod.tags.includes('core') || menuStore[mod.id].enabled
|
||||
? 'enabled'
|
||||
: 'disabled'
|
||||
mod.tags.includes('core') || enabled ? 'enabled' : 'disabled'
|
||||
}" id="${mod.id}">
|
||||
<div class="meta">
|
||||
<h3 ${
|
||||
@ -394,7 +393,7 @@ window['__start'] = async () => {
|
||||
? `>${mod.name}`
|
||||
: `class="toggle">
|
||||
<input type="checkbox" id="enable_${mod.id}"
|
||||
${menuStore[mod.id].enabled ? 'checked' : ''} />
|
||||
${enabled ? 'checked' : ''} />
|
||||
<label for="enable_${mod.id}">
|
||||
<span class="name">${mod.name}</span>
|
||||
<span class="switch"><span class="dot"></span></span>
|
||||
@ -420,8 +419,13 @@ window['__start'] = async () => {
|
||||
const $enable = mod.elem.querySelector(`#enable_${mod.id}`);
|
||||
if ($enable)
|
||||
$enable.addEventListener('click', (event) => {
|
||||
menuStore[mod.id].enabled = $enable.checked;
|
||||
mod.elem.className = menuStore[mod.id].enabled ? 'enabled' : 'disabled';
|
||||
store('mods', { [mod.id]: { enabled: false } })[mod.id].enabled =
|
||||
$enable.checked;
|
||||
mod.elem.className = store('mods', { [mod.id]: { enabled: false } })[
|
||||
mod.id
|
||||
].enabled
|
||||
? 'enabled'
|
||||
: 'disabled';
|
||||
search();
|
||||
modified();
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user