diff --git a/always-on-top/button.css b/always-on-top/button.css index 19e1e97..c2fef44 100644 --- a/always-on-top/button.css +++ b/always-on-top/button.css @@ -1,4 +1,4 @@ -/* +/** * notion-enhancer: integrated titlebar * (c) 2021 dragonwocky (https://dragonwocky.me/) * (https://notion-enhancer.github.io/) under the MIT license diff --git a/always-on-top/button.mjs b/always-on-top/button.mjs index 18e2954..50f0454 100644 --- a/always-on-top/button.mjs +++ b/always-on-top/button.mjs @@ -1,10 +1,10 @@ -/* +/** * notion-enhancer: always on top * (c) 2021 dragonwocky (https://dragonwocky.me/) * (https://notion-enhancer.github.io/) under the MIT license */ -export const createButton = async ({ web, components }, db) => { +export const createButton = async ({ electron, web, components }, db) => { let pinIcon = (await db.get(['pin_icon'])) || ` @@ -28,8 +28,8 @@ export const createButton = async ({ web, components }, db) => { const $button = web.html`
`, $pin = web.html``, $unpin = web.html``; - components.tooltip($pin, '**Pin window to top**'); - components.tooltip($unpin, '**Unpin window from top**'); + components.addTooltip($pin, '**Pin window to top**'); + components.addTooltip($unpin, '**Unpin window from top**'); web.render($button, $pin); $pin.addEventListener('click', () => { diff --git a/always-on-top/client.mjs b/always-on-top/client.mjs index 6ddba6a..7262f15 100644 --- a/always-on-top/client.mjs +++ b/always-on-top/client.mjs @@ -1,4 +1,4 @@ -/* +/** * notion-enhancer: always on top * (c) 2021 dragonwocky (https://dragonwocky.me/) * (https://notion-enhancer.github.io/) under the MIT license diff --git a/always-on-top/menu.mjs b/always-on-top/menu.mjs index 142659f..1250d12 100644 --- a/always-on-top/menu.mjs +++ b/always-on-top/menu.mjs @@ -1,4 +1,4 @@ -/* +/** * notion-enhancer: always on top * (c) 2021 dragonwocky (https://dragonwocky.me/) * (https://notion-enhancer.github.io/) under the MIT license diff --git a/bypass-preview/client.css b/bypass-preview/client.css index 91850ab..cae2982 100644 --- a/bypass-preview/client.css +++ b/bypass-preview/client.css @@ -1,4 +1,4 @@ -/* +/** * notion-enhancer: bypass preview * (c) 2021 dragonwocky (https://dragonwocky.me/) * (https://notion-enhancer.github.io/) under the MIT license diff --git a/bypass-preview/client.mjs b/bypass-preview/client.mjs index d0455a3..2ea3d89 100644 --- a/bypass-preview/client.mjs +++ b/bypass-preview/client.mjs @@ -1,4 +1,4 @@ -/* +/** * notion-enhancer: bypass preview * (c) 2021 dragonwocky (https://dragonwocky.me/) * (https://notion-enhancer.github.io/) under the MIT license diff --git a/calendar-scroll/client.css b/calendar-scroll/client.css index e150eb4..2cbdb62 100644 --- a/calendar-scroll/client.css +++ b/calendar-scroll/client.css @@ -1,4 +1,4 @@ -/* +/** * notion-enhancer: calendar scroll * (c) 2021 dragonwocky (https://dragonwocky.me/) * (https://notion-enhancer.github.io/) under the MIT license diff --git a/calendar-scroll/client.mjs b/calendar-scroll/client.mjs index 5c2ce93..a13851e 100644 --- a/calendar-scroll/client.mjs +++ b/calendar-scroll/client.mjs @@ -1,4 +1,4 @@ -/* +/** * notion-enhancer: calendar scroll * (c) 2021 dragonwocky (https://dragonwocky.me/) * (https://notion-enhancer.github.io/) under the MIT license diff --git a/cherry-cola/variables.css b/cherry-cola/variables.css index bccd9af..26c3341 100644 --- a/cherry-cola/variables.css +++ b/cherry-cola/variables.css @@ -1,4 +1,4 @@ -/* +/** * notion-enhancer: cherry cola * (c) 2020 Alexa Baldon (https://github.com/runargs) * (https://notion-enhancer.github.io/) under the MIT license diff --git a/code-line-numbers/client.css b/code-line-numbers/client.css index 8df4fc2..5f3a4df 100644 --- a/code-line-numbers/client.css +++ b/code-line-numbers/client.css @@ -1,4 +1,4 @@ -/* +/** * notion-enhancer: code line numbers * (c) 2020 CloudHill (https://github.com/CloudHill) * (c) 2021 dragonwocky (https://dragonwocky.me/) diff --git a/code-line-numbers/client.mjs b/code-line-numbers/client.mjs index 18be5e3..5072b39 100644 --- a/code-line-numbers/client.mjs +++ b/code-line-numbers/client.mjs @@ -1,4 +1,4 @@ -/* +/** * notion-enhancer: code line numbers * (c) 2020 CloudHill (https://github.com/CloudHill) * (c) 2021 dragonwocky (https://dragonwocky.me/) diff --git a/collapsible-headers/client.css b/collapsible-headers/client.css index 668e9ec..95e3616 100644 --- a/collapsible-headers/client.css +++ b/collapsible-headers/client.css @@ -1,4 +1,4 @@ -/* +/** * notion-enhancer: collapsible headers * (c) 2020 CloudHill (https://github.com/CloudHill) * (c) 2021 dragonwocky (https://dragonwocky.me/) diff --git a/collapsible-headers/client.mjs b/collapsible-headers/client.mjs index 07219ef..c3b7699 100644 --- a/collapsible-headers/client.mjs +++ b/collapsible-headers/client.mjs @@ -1,4 +1,4 @@ -/* +/** * notion-enhancer: collapsible headers * (c) 2020 CloudHill (https://github.com/CloudHill) * (c) 2021 dragonwocky (https://dragonwocky.me/) diff --git a/collapsible-properties/client.css b/collapsible-properties/client.css index 6905753..84eba06 100644 --- a/collapsible-properties/client.css +++ b/collapsible-properties/client.css @@ -1,4 +1,4 @@ -/* +/** * notion-enhancer: collapse properties * (c) 2021 dragonwocky (https://dragonwocky.me/) * (https://notion-enhancer.github.io/) under the MIT license diff --git a/collapsible-properties/client.mjs b/collapsible-properties/client.mjs index 6a6cc61..28f88e8 100644 --- a/collapsible-properties/client.mjs +++ b/collapsible-properties/client.mjs @@ -1,4 +1,4 @@ -/* +/** * notion-enhancer: collapse properties * (c) 2021 dragonwocky (https://dragonwocky.me/) * (https://notion-enhancer.github.io/) under the MIT license diff --git a/dark+/theme.mjs b/dark+/theme.mjs index 87bd2f3..ea464fb 100644 --- a/dark+/theme.mjs +++ b/dark+/theme.mjs @@ -1,4 +1,4 @@ -/* +/** * notion-enhancer: dark+ * (c) 2021 dragonwocky (https://dragonwocky.me/) * (https://notion-enhancer.github.io/) under the MIT license diff --git a/dark+/variables.css b/dark+/variables.css index 02205d8..306d144 100644 --- a/dark+/variables.css +++ b/dark+/variables.css @@ -1,4 +1,4 @@ -/* +/** * notion-enhancer: dark+ * (c) 2021 dragonwocky (https://dragonwocky.me/) * (https://notion-enhancer.github.io/) under the MIT license diff --git a/dracula/app.css b/dracula/app.css index fa864a5..449ffe4 100644 --- a/dracula/app.css +++ b/dracula/app.css @@ -1,4 +1,4 @@ -/* +/** * notion-enhancer: dracula * (c) 2016 Dracula Theme * (c) 2020 CloudHill diff --git a/dracula/variables.css b/dracula/variables.css index 7828796..42f0ef1 100644 --- a/dracula/variables.css +++ b/dracula/variables.css @@ -1,4 +1,4 @@ -/* +/** * notion-enhancer: dracula * (c) 2016 Dracula Theme * (c) 2020 mimishahzad diff --git a/emoji-sets/client.css b/emoji-sets/client.css index ca33b7f..81e3e7d 100644 --- a/emoji-sets/client.css +++ b/emoji-sets/client.css @@ -1,4 +1,4 @@ -/* +/** * notion-enhancer: emoji sets * (c) 2021 Arecsu * (c) 2021 dragonwocky (https://dragonwocky.me/) diff --git a/emoji-sets/client.mjs b/emoji-sets/client.mjs index 9093ec2..1e6a9bf 100644 --- a/emoji-sets/client.mjs +++ b/emoji-sets/client.mjs @@ -1,4 +1,4 @@ -/* +/** * notion-enhancer: emoji sets * (c) 2021 dragonwocky (https://dragonwocky.me/) * (https://notion-enhancer.github.io/) under the MIT license diff --git a/focus-mode/client.css b/focus-mode/client.css index 5c13d5c..d615b0c 100644 --- a/focus-mode/client.css +++ b/focus-mode/client.css @@ -1,4 +1,4 @@ -/* +/** * notion-enhancer: focus mode * (c) 2020 Arecsu * (c) 2021 dragonwocky (https://dragonwocky.me/) diff --git a/focus-mode/client.mjs b/focus-mode/client.mjs index 660ae9c..8423026 100644 --- a/focus-mode/client.mjs +++ b/focus-mode/client.mjs @@ -1,4 +1,4 @@ -/* +/** * notion-enhancer: focus mode * (c) 2020 Arecsu * (c) 2021 dragonwocky (https://dragonwocky.me/) diff --git a/font-chooser/fonts.css b/font-chooser/fonts.css index f46c4fb..f118c8d 100644 --- a/font-chooser/fonts.css +++ b/font-chooser/fonts.css @@ -1,4 +1,4 @@ -/* +/** * notion-enhancer: font chooser * (c) 2021 TorchAtlas (https://bit.ly/torchatlas/) * (c) 2021 admiraldus (https://github.com/admiraldus) diff --git a/font-chooser/fonts.mjs b/font-chooser/fonts.mjs index d6e0668..5d78cac 100644 --- a/font-chooser/fonts.mjs +++ b/font-chooser/fonts.mjs @@ -1,4 +1,4 @@ -/* +/** * notion-enhancer: font chooser * (c) 2021 TorchAtlas (https://bit.ly/torchatlas/) * (c) 2021 admiraldus (https://github.com/admiraldus diff --git a/global-block-links/client.css b/global-block-links/client.css index 701d32c..573bb27 100644 --- a/global-block-links/client.css +++ b/global-block-links/client.css @@ -1,4 +1,4 @@ -/* +/** * notion-enhancer: global block links * (c) 2021 admiraldus (https://github.com/admiraldus) * (c) 2021 dragonwocky (https://dragonwocky.me/) diff --git a/global-block-links/client.mjs b/global-block-links/client.mjs index 81d24d2..5cd864e 100644 --- a/global-block-links/client.mjs +++ b/global-block-links/client.mjs @@ -1,4 +1,4 @@ -/* +/** * notion-enhancer: global block links * (c) 2021 admiraldus (https://github.com/admiraldus) * (c) 2021 dragonwocky (https://dragonwocky.me/) @@ -44,7 +44,7 @@ export default async function ({ web, components, notion }, db) { $btns.forEach(($btn) => { if (!$btn.previousElementSibling?.classList?.contains?.(topbarCopyClass)) { const $copy = $topbarCopyTemplate.cloneNode(true); - components.tooltip($copy, '**Copy page link**'); + components.addTooltip($copy, '**Copy page link**'); $btn.before($copy); let resetButtonDelay; diff --git a/gruvbox-dark/variables.css b/gruvbox-dark/variables.css index fbc9f3b..d8ef866 100644 --- a/gruvbox-dark/variables.css +++ b/gruvbox-dark/variables.css @@ -1,4 +1,4 @@ -/* +/** * notion-enhancer: gruvbox dark * (c) 2015-2020 morhetz * (c) 2021 jordanrobinson (https://jordanrobinson.co.uk/) diff --git a/gruvbox-light/variables.css b/gruvbox-light/variables.css index ccfb8ca..ea69c5a 100644 --- a/gruvbox-light/variables.css +++ b/gruvbox-light/variables.css @@ -1,4 +1,4 @@ -/* +/** * notion-enhancer: gruvbox light * (c) 2015-2020 morhetz * (c) 2021 jordanrobinson (https://jordanrobinson.co.uk/) diff --git a/icon-sets/client.css b/icon-sets/client.css index 86e156d..0259d1e 100644 --- a/icon-sets/client.css +++ b/icon-sets/client.css @@ -1,4 +1,4 @@ -/* +/** * notion-enhancer: icon sets * (c) 2019 jayhxmo (https://jaymo.io/) * (c) 2020 CloudHill (https://github.com/CloudHill) diff --git a/icon-sets/client.mjs b/icon-sets/client.mjs index 5bd1e58..65d1871 100644 --- a/icon-sets/client.mjs +++ b/icon-sets/client.mjs @@ -1,4 +1,4 @@ -/* +/** * notion-enhancer: icon sets * (c) 2019 jayhxmo (https://jaymo.io/) * (c) 2020 CloudHill (https://github.com/CloudHill) @@ -67,7 +67,7 @@ export default async function ({ web, fs, components, notion }, db) { $spinner.remove(); if ($tooltip) { const $infoSvg = web.html`${await components.feather('info', { class: 'info' })}`; - components.tooltip($infoSvg, $tooltip, { offsetDirection: 'right' }); + components.addTooltip($infoSvg, $tooltip, { offsetDirection: 'right' }); web.render($title, $infoSvg); } })(); diff --git a/indentation-lines/client.css b/indentation-lines/client.css index 394c6e0..5f0f0c6 100644 --- a/indentation-lines/client.css +++ b/indentation-lines/client.css @@ -1,4 +1,4 @@ -/* +/** * notion-enhancer: indentation lines * (c) 2020 Alexa Baldon (https://github.com/runargs) * (c) 2021 dragonwocky (https://dragonwocky.me/) diff --git a/indentation-lines/client.mjs b/indentation-lines/client.mjs index cf48203..26440e5 100644 --- a/indentation-lines/client.mjs +++ b/indentation-lines/client.mjs @@ -1,4 +1,4 @@ -/* +/** * notion-enhancer: indentation lines * (c) 2020 Alexa Baldon (https://github.com/runargs) * (https://notion-enhancer.github.io/) under the MIT license diff --git a/integrated-titlebar/buttons.css b/integrated-titlebar/buttons.css index 7eac2c9..3cb1142 100644 --- a/integrated-titlebar/buttons.css +++ b/integrated-titlebar/buttons.css @@ -1,4 +1,4 @@ -/* +/** * notion-enhancer: integrated titlebar * (c) 2021 dragonwocky (https://dragonwocky.me/) * (https://notion-enhancer.github.io/) under the MIT license diff --git a/integrated-titlebar/buttons.mjs b/integrated-titlebar/buttons.mjs index 77a43c2..da307f5 100644 --- a/integrated-titlebar/buttons.mjs +++ b/integrated-titlebar/buttons.mjs @@ -1,4 +1,4 @@ -/* +/** * notion-enhancer: integrated titlebar * (c) 2021 dragonwocky (https://dragonwocky.me/) * (https://notion-enhancer.github.io/) under the MIT license @@ -47,10 +47,10 @@ export const createWindowButtons = async ({ electron, web, components }, db) => $close = web.html``; - components.tooltip($minimize, '**Minimize window**'); - components.tooltip($maximize, '**Maximize window**'); - components.tooltip($unmaximize, '**Unmaximize window**'); - components.tooltip($close, '**Close window**'); + components.addTooltip($minimize, '**Minimize window**'); + components.addTooltip($maximize, '**Maximize window**'); + components.addTooltip($unmaximize, '**Unmaximize window**'); + components.addTooltip($close, '**Close window**'); $minimize.addEventListener('click', () => electron.browser.minimize()); $maximize.addEventListener('click', () => electron.browser.maximize()); diff --git a/integrated-titlebar/client.mjs b/integrated-titlebar/client.mjs index 4b91f06..f3f2ad1 100644 --- a/integrated-titlebar/client.mjs +++ b/integrated-titlebar/client.mjs @@ -1,4 +1,4 @@ -/* +/** * notion-enhancer: integrated titlebar * (c) 2021 dragonwocky (https://dragonwocky.me/) * (https://notion-enhancer.github.io/) under the MIT license diff --git a/integrated-titlebar/createWindow.cjs b/integrated-titlebar/createWindow.cjs index fd9c08e..3b52680 100644 --- a/integrated-titlebar/createWindow.cjs +++ b/integrated-titlebar/createWindow.cjs @@ -1,4 +1,4 @@ -/* +/** * notion-enhancer: integrated titlebar * (c) 2021 dragonwocky (https://dragonwocky.me/) * (https://notion-enhancer.github.io/) under the MIT license diff --git a/integrated-titlebar/menu.mjs b/integrated-titlebar/menu.mjs index da86839..2e015f3 100644 --- a/integrated-titlebar/menu.mjs +++ b/integrated-titlebar/menu.mjs @@ -1,4 +1,4 @@ -/* +/** * notion-enhancer: integrated titlebar * (c) 2021 dragonwocky (https://dragonwocky.me/) * (https://notion-enhancer.github.io/) under the MIT license diff --git a/integrated-titlebar/rendererIndex.cjs b/integrated-titlebar/rendererIndex.cjs index 6aa2eb9..b160869 100644 --- a/integrated-titlebar/rendererIndex.cjs +++ b/integrated-titlebar/rendererIndex.cjs @@ -1,4 +1,4 @@ -/* +/** * notion-enhancer: integrated titlebar * (c) 2021 dragonwocky (https://dragonwocky.me/) * (https://notion-enhancer.github.io/) under the MIT license diff --git a/light+/theme.mjs b/light+/theme.mjs index daf32d4..64c7302 100644 --- a/light+/theme.mjs +++ b/light+/theme.mjs @@ -1,4 +1,4 @@ -/* +/** * notion-enhancer: light+ * (c) 2021 dragonwocky (https://dragonwocky.me/) * (https://notion-enhancer.github.io/) under the MIT license diff --git a/light+/variables.css b/light+/variables.css index 20a11f8..b641656 100644 --- a/light+/variables.css +++ b/light+/variables.css @@ -1,4 +1,4 @@ -/* +/** * notion-enhancer: light+ * (c) 2020 Lizishan * (c) 2021 dragonwocky (https://dragonwocky.me/) diff --git a/material-ocean/variables.css b/material-ocean/variables.css index bbc3117..ccafcb2 100644 --- a/material-ocean/variables.css +++ b/material-ocean/variables.css @@ -1,4 +1,4 @@ -/* +/** * notion-enhancer: material ocean * (c) 2020 Abubakar Yagoub (https://blacksuan19.tk) * (https://notion-enhancer.github.io/) under the MIT license diff --git a/menu/client.css b/menu/client.css index 13b3730..0109a3c 100644 --- a/menu/client.css +++ b/menu/client.css @@ -1,5 +1,5 @@ -/* - * notion-enhancer core: menu +/** + * notion-enhancer: menu * (c) 2021 dragonwocky (https://dragonwocky.me/) * (https://notion-enhancer.github.io/) under the MIT license */ diff --git a/menu/client.mjs b/menu/client.mjs index 5ae3183..8a057e7 100644 --- a/menu/client.mjs +++ b/menu/client.mjs @@ -1,5 +1,5 @@ -/* - * notion-enhancer core: menu +/** + * notion-enhancer: menu * (c) 2021 dragonwocky (https://dragonwocky.me/) * (https://notion-enhancer.github.io/) under the MIT license */ @@ -11,14 +11,6 @@ const notificationsURL = 'https://notion-enhancer.github.io/notifications.json'; export default async function ({ env, fs, storage, registry, web }, db) { web.addHotkeyListener(await db.get(['hotkey']), env.focusMenu); - const updateTheme = () => - storage.set(['theme'], document.querySelector('.notion-dark-theme') ? 'dark' : 'light'); - web.addDocumentObserver((mutation) => { - if (mutation.target === document.body && document.hasFocus()) updateTheme(); - }); - if (document.hasFocus()) updateTheme(); - document.addEventListener('visibilitychange', updateTheme); - const sidebarSelector = '.notion-sidebar-container .notion-sidebar > div:nth-child(4)'; await web.whenReady([sidebarSelector]); diff --git a/menu/components.mjs b/menu/components.mjs index 5d95818..20d1b23 100644 --- a/menu/components.mjs +++ b/menu/components.mjs @@ -1,5 +1,5 @@ -/* - * notion-enhancer core: menu +/** + * notion-enhancer: menu * (c) 2021 dragonwocky (https://dragonwocky.me/) * (https://notion-enhancer.github.io/) under the MIT license */ @@ -8,6 +8,10 @@ import { fmt, web, registry, components } from '../../api/index.mjs'; import { notifications } from './notifications.mjs'; +import '../../dep/jscolor.min.js'; + +import '../../dep/markdown-it.min.js'; +const md = markdownit({ linkify: true }); export const modComponents = { preview: (url) => web.html` { const $description = web.html`

- ${fmt.md.renderInline(description)} + ${md.renderInline(description)}

`; $description.querySelectorAll('a').forEach((a) => { a.target = '_blank'; @@ -69,7 +73,10 @@ export const options = { $input = $toggle.children[1]; if (opt.tooltip) { $label.prepend($tooltipIcon); - components.tooltip($tooltipIcon, opt.tooltip, { offsetDirection: 'left', maxLines: 3 }); + components.addTooltip($tooltipIcon, opt.tooltip, { + offsetDirection: 'left', + maxLines: 3, + }); } $input.addEventListener('change', async (event) => { await profileDB.set([mod.id, opt.key], $input.checked); @@ -98,7 +105,10 @@ export const options = { `, $icon = web.html`${await components.feather('chevron-down', { class: 'input-icon' })}`; if (opt.tooltip) - components.tooltip($tooltipIcon, opt.tooltip, { offsetDirection: 'left', maxLines: 3 }); + components.addTooltip($tooltipIcon, opt.tooltip, { + offsetDirection: 'left', + maxLines: 3, + }); $select.addEventListener('change', async (event) => { await profileDB.set([mod.id, opt.key], $select.value); notifications.onChange(); @@ -117,7 +127,10 @@ export const options = { $input = web.html``, $icon = web.html`${await components.feather('type', { class: 'input-icon' })}`; if (opt.tooltip) - components.tooltip($tooltipIcon, opt.tooltip, { offsetDirection: 'left', maxLines: 3 }); + components.addTooltip($tooltipIcon, opt.tooltip, { + offsetDirection: 'left', + maxLines: 3, + }); $input.addEventListener('change', async (event) => { await profileDB.set([mod.id, opt.key], $input.value); notifications.onChange(); @@ -136,7 +149,10 @@ export const options = { $input = web.html``, $icon = web.html`${await components.feather('hash', { class: 'input-icon' })}`; if (opt.tooltip) - components.tooltip($tooltipIcon, opt.tooltip, { offsetDirection: 'left', maxLines: 3 }); + components.addTooltip($tooltipIcon, opt.tooltip, { + offsetDirection: 'left', + maxLines: 3, + }); $input.addEventListener('change', async (event) => { await profileDB.set([mod.id, opt.key], $input.value); notifications.onChange(); @@ -164,7 +180,7 @@ export const options = { $input.style.color = fmt.rgbContrast(r, g, b); $input.style.padding = ''; }, - $picker = new web.jscolor($input, { + $picker = new JSColor($input, { value, format: 'rgba', previewSize: 0, @@ -176,7 +192,10 @@ export const options = { onChange: paint, }); if (opt.tooltip) - components.tooltip($tooltipIcon, opt.tooltip, { offsetDirection: 'left', maxLines: 3 }); + components.addTooltip($tooltipIcon, opt.tooltip, { + offsetDirection: 'left', + maxLines: 3, + }); $input.addEventListener('change', async (event) => { await profileDB.set([mod.id, opt.key], $input.value); notifications.onChange(); @@ -201,7 +220,10 @@ export const options = { $filename = web.html`${web.escape(filename || 'none')}`, $latest = web.render(web.html``, $filename); if (opt.tooltip) - components.tooltip($tooltipIcon, opt.tooltip, { offsetDirection: 'left', maxLines: 3 }); + components.addTooltip($tooltipIcon, opt.tooltip, { + offsetDirection: 'left', + maxLines: 3, + }); $input.addEventListener('change', (event) => { const file = event.target.files[0], reader = new FileReader(); @@ -237,7 +259,10 @@ export const options = { $input = web.html``, $icon = web.html`${await components.feather('command', { class: 'input-icon' })}`; if (opt.tooltip) - components.tooltip($tooltipIcon, opt.tooltip, { offsetDirection: 'left', maxLines: 3 }); + components.addTooltip($tooltipIcon, opt.tooltip, { + offsetDirection: 'left', + maxLines: 3, + }); $input.addEventListener('keydown', async (event) => { event.preventDefault(); const pressed = [], diff --git a/menu/markdown.css b/menu/markdown.css index 9f7ffb0..2a23626 100644 --- a/menu/markdown.css +++ b/menu/markdown.css @@ -1,5 +1,5 @@ -/* - * notion-enhancer core: menu +/** + * notion-enhancer: menu * (c) 2021 dragonwocky (https://dragonwocky.me/) * (https://notion-enhancer.github.io/) under the MIT license */ @@ -95,84 +95,3 @@ hyphens: none; line-height: 1.5; } - -/* - * https://prismjs.com/plugins/inline-color/ - */ -.markdown .inline-color-wrapper { - /* - * base64 svg (https://stackoverflow.com/a/21626701/7595472 - prevents visual glitches) - * - * - * - * - */ - background: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyIDIiPjxwYXRoIGZpbGw9ImdyYXkiIGQ9Ik0wIDBoMnYySDB6Ii8+PHBhdGggZmlsbD0id2hpdGUiIGQ9Ik0wIDBoMXYxSDB6TTEgMWgxdjFIMXoiLz48L3N2Zz4='); - background-position: center; - background-size: 110%; - display: inline-block; - height: 1.333ch; - width: 1.333ch; - margin: 0 0.333ch; - box-sizing: border-box; - border: 0.5px solid var(--theme--code_plain); - overflow: hidden; -} -.markdown .inline-color { - display: block; - height: 120%; - width: 120%; -} - -/* - * https://prismjs.com/plugins/match-braces/ - */ -.markdown .token.punctuation.brace-hover, -.markdown .token.punctuation.brace-selected { - outline: solid 1px; -} - -/* - * https://prismjs.com/plugins/show-language/ - * https://prismjs.com/plugins/copy-to-clipboard/ - */ -.markdown .code-toolbar { - position: relative; -} -.markdown .code-toolbar .toolbar-item { - position: absolute; - top: 0.35rem; - display: inline-block; - transition: opacity 200ms ease-in-out; - opacity: 0; -} -.markdown .code-toolbar .toolbar-item:first-child { - left: 0.8rem; -} -.markdown .code-toolbar .toolbar-item:last-child { - right: 0.8rem; -} -.markdown .code-toolbar:hover .toolbar-item, -.markdown .code-toolbar:focus-within .toolbar-item { - opacity: 1; -} -.markdown .code-toolbar .toolbar-item > * { - padding: 0.25rem 0.35rem; - color: var(--theme--text_secondary); - font-size: 11px; - font-family: inherit; -} -.markdown .code-toolbar .toolbar-item .copy-to-clipboard-button { - border: none; - background: none; - cursor: pointer; - border-radius: 3px; - transition: background 100ms ease-in-out; -} -.markdown .code-toolbar .toolbar-item .copy-to-clipboard-button:hover { - background: var(--theme--button-hover); -} -.markdown .code-toolbar .toolbar-item .copy-to-clipboard-button svg { - width: 1em; - margin-right: 0.5em; -} diff --git a/menu/menu.css b/menu/menu.css index ecf5bee..5a11697 100644 --- a/menu/menu.css +++ b/menu/menu.css @@ -1,5 +1,5 @@ -/* - * notion-enhancer core: menu +/** + * notion-enhancer: menu * (c) 2021 dragonwocky (https://dragonwocky.me/) * (https://notion-enhancer.github.io/) under the MIT license */ diff --git a/menu/menu.mjs b/menu/menu.mjs index 11dbca3..ab013b9 100644 --- a/menu/menu.mjs +++ b/menu/menu.mjs @@ -1,5 +1,5 @@ -/* - * notion-enhancer core: menu +/** + * notion-enhancer: menu * (c) 2021 dragonwocky (https://dragonwocky.me/) * (https://notion-enhancer.github.io/) under the MIT license */ @@ -16,9 +16,6 @@ import './styles.mjs'; const { env, fs, storage, electron, registry, web, components } = api; for (const mod of await registry.list((mod) => registry.enabled(mod.id))) { - for (const sheet of mod.css?.menu || []) { - web.loadStylesheet(`repo/${mod._dir}/${sheet}`); - } for (let script of mod.js?.menu || []) { script = await import(fs.localPath(`repo/${mod._dir}/${script}`)); script.default(api, await registry.db(mod.id)); @@ -44,13 +41,6 @@ import './styles.mjs'; web.addHotkeyListener(await db.get(['hotkey']), env.focusNotion); - const loadTheme = async () => { - document.documentElement.className = - (await storage.get(['theme'], 'light')) === 'dark' ? 'dark' : ''; - }; - document.addEventListener('visibilitychange', loadTheme); - loadTheme(); - window.addEventListener('beforeunload', (event) => { // trigger input save document.activeElement.blur(); @@ -357,7 +347,7 @@ import './styles.mjs'; $changelogNavItem = web.html``; - components.tooltip($changelogNavItem, '**Update changelog & welcome message**'); + components.addTooltip($changelogNavItem, '**Update changelog & welcome message**'); $changelogNavItem.addEventListener('click', () => { $changelogModal.scrollTop = 0; $changelogModal.classList.add('modal-visible'); diff --git a/menu/notifications.mjs b/menu/notifications.mjs index 1fbbb48..33af079 100644 --- a/menu/notifications.mjs +++ b/menu/notifications.mjs @@ -1,5 +1,5 @@ -/* - * notion-enhancer core: menu +/** + * notion-enhancer: menu * (c) 2021 dragonwocky (https://dragonwocky.me/) * (https://notion-enhancer.github.io/) under the MIT license */ @@ -7,6 +7,9 @@ import { env, fs, storage, fmt, web, components } from '../../api/index.mjs'; import { tw } from './styles.mjs'; +import '../../dep/markdown-it.min.js'; +const md = markdownit({ linkify: true }); + const notificationsURL = 'https://notion-enhancer.github.io/notifications.json'; export const notifications = { $container: web.html`
`, @@ -39,7 +42,7 @@ export const notifications = { web.render( $notification, web.html` - ${fmt.md.renderInline(message)} + ${md.renderInline(message)} `, web.html`${await components.feather(icon, { class: 'notification-icon' })}` ) @@ -158,7 +161,7 @@ export const $changelogModal = web.render(
- ${fmt.md.render(await fs.getText('repo/menu/whats-new.md'))} + ${md.render(await fs.getText('repo/menu/whats-new.md'))}
`, diff --git a/menu/router.mjs b/menu/router.mjs index 8004c71..2eb88cc 100644 --- a/menu/router.mjs +++ b/menu/router.mjs @@ -1,5 +1,5 @@ -/* - * notion-enhancer core: menu +/** + * notion-enhancer: menu * (c) 2021 dragonwocky (https://dragonwocky.me/) * (https://notion-enhancer.github.io/) under the MIT license */ diff --git a/menu/styles.mjs b/menu/styles.mjs index 8dcc8f7..63e6a41 100644 --- a/menu/styles.mjs +++ b/menu/styles.mjs @@ -1,5 +1,5 @@ -/* - * notion-enhancer core: menu +/** + * notion-enhancer: menu * (c) 2021 dragonwocky (https://dragonwocky.me/) * (https://notion-enhancer.github.io/) under the MIT license */ diff --git a/neutral/app.css b/neutral/app.css index 64afce7..7a3c3b5 100644 --- a/neutral/app.css +++ b/neutral/app.css @@ -1,4 +1,4 @@ -/* +/** * notion-enhancer: neutral * (c) 2020 Arecsu * (c) 2021 dragonwocky (https://dragonwocky.me/) diff --git a/neutral/variables.css b/neutral/variables.css index 0ad2a4a..3720638 100644 --- a/neutral/variables.css +++ b/neutral/variables.css @@ -1,4 +1,4 @@ -/* +/** * notion-enhancer: neutral * (c) 2020 Arecsu * (c) 2021 dragonwocky (https://dragonwocky.me/) diff --git a/nord/variables.css b/nord/variables.css index 29a7941..083e66c 100644 --- a/nord/variables.css +++ b/nord/variables.css @@ -1,4 +1,4 @@ -/* +/** * notion-enhancer: dracula * (c) 2016 Artic Ice Studio * (c) 2020 MANNNNEN diff --git a/outliner/client.css b/outliner/client.css index f01768e..a37d938 100644 --- a/outliner/client.css +++ b/outliner/client.css @@ -1,4 +1,4 @@ -/* +/** * notion-enhancer: outliner * (c) 2020 CloudHill (https://github.com/CloudHill) * (c) 2021 dragonwocky (https://dragonwocky.me/) diff --git a/outliner/client.mjs b/outliner/client.mjs index b4ea952..73942fd 100644 --- a/outliner/client.mjs +++ b/outliner/client.mjs @@ -1,4 +1,4 @@ -/* +/** * notion-enhancer: outliner * (c) 2020 CloudHill (https://github.com/CloudHill) * (c) 2021 dragonwocky (https://dragonwocky.me/) diff --git a/pastel-dark/app.css b/pastel-dark/app.css index 12b1dba..9664dd3 100644 --- a/pastel-dark/app.css +++ b/pastel-dark/app.css @@ -1,4 +1,4 @@ -/* +/** * notion-enhancer: pastel dark * (c) 2020 u/zenith_illinois * (c) 2021 dragonwocky (https://dragonwocky.me/) diff --git a/pastel-dark/variables.css b/pastel-dark/variables.css index 34f6366..3a09aa0 100644 --- a/pastel-dark/variables.css +++ b/pastel-dark/variables.css @@ -1,4 +1,4 @@ -/* +/** * notion-enhancer: pastel dark * (c) 2020 u/zenith_illinois * (c) 2021 dragonwocky (https://dragonwocky.me/) diff --git a/pinky-boom/variables.css b/pinky-boom/variables.css index 95a6094..d418bdf 100644 --- a/pinky-boom/variables.css +++ b/pinky-boom/variables.css @@ -1,4 +1,4 @@ -/* +/** * notion-enhancer: pinky boom * (c) 2020 mugiwarafx * (c) 2021 dragonwocky (https://dragonwocky.me/) diff --git a/playful-purple/variables.css b/playful-purple/variables.css index 7f627e4..cf82ba1 100644 --- a/playful-purple/variables.css +++ b/playful-purple/variables.css @@ -1,4 +1,4 @@ -/* +/** * notion-enhancer: playful dark * (c) 2020 Lizishan * (c) 2021 dragonwocky (https://dragonwocky.me/) diff --git a/quick-note/client.mjs b/quick-note/client.mjs index f770491..89a7d66 100644 --- a/quick-note/client.mjs +++ b/quick-note/client.mjs @@ -1,4 +1,4 @@ -/* +/** * notion-enhancer: quick note * (c) 2021 dragonwocky (https://dragonwocky.me/) * (https://notion-enhancer.github.io/) under the MIT license diff --git a/right-to-left/client.css b/right-to-left/client.css index ffe3b32..3597fcc 100644 --- a/right-to-left/client.css +++ b/right-to-left/client.css @@ -1,4 +1,4 @@ -/* +/** * notion-enhancer: right to left * (c) 2021 obahareth (https://omar.engineer) * (c) 2021 dragonwocky (https://dragonwocky.me/) diff --git a/right-to-left/client.mjs b/right-to-left/client.mjs index 9103964..decba98 100644 --- a/right-to-left/client.mjs +++ b/right-to-left/client.mjs @@ -1,4 +1,4 @@ -/* +/** * notion-enhancer: right to left * (c) 2021 obahareth (https://omar.engineer) * (c) 2021 dragonwocky (https://dragonwocky.me/) diff --git a/scroll-to-top/client.mjs b/scroll-to-top/client.mjs index 9cda8f0..396984e 100644 --- a/scroll-to-top/client.mjs +++ b/scroll-to-top/client.mjs @@ -1,4 +1,4 @@ -/* +/** * notion-enhancer: scroll to top * (c) 2021 CloudHill (https://github.com/CloudHill) * (c) 2021 dragonwocky (https://dragonwocky.me/) diff --git a/simpler-databases/client.css b/simpler-databases/client.css index e5d2d2f..eeb47e8 100644 --- a/simpler-databases/client.css +++ b/simpler-databases/client.css @@ -1,4 +1,4 @@ -/* +/** * notion-enhancer: simpler databases * (c) 2020 CloudHill (https://github.com/CloudHill) * (c) 2021 dragonwocky (https://dragonwocky.me/) diff --git a/simpler-databases/client.mjs b/simpler-databases/client.mjs index 5d13ad3..c82a6c9 100644 --- a/simpler-databases/client.mjs +++ b/simpler-databases/client.mjs @@ -1,4 +1,4 @@ -/* +/** * notion-enhancer: simpler databases * (c) 2020 CloudHill (https://github.com/CloudHill) * (c) 2021 dragonwocky (https://dragonwocky.me/) diff --git a/tabs/mod.json b/tabs/mod.json index 48f783c..ac1ef79 100644 --- a/tabs/mod.json +++ b/tabs/mod.json @@ -14,7 +14,9 @@ } ], "css": {}, - "js": {}, + "js": { + "electron": [{ "source": "rendererIndex.cjs", "target": "renderer/index.js" }] + }, "options": [ { "key": "select_modifier", diff --git a/tabs/rendererIndex.cjs b/tabs/rendererIndex.cjs new file mode 100644 index 0000000..a82e124 --- /dev/null +++ b/tabs/rendererIndex.cjs @@ -0,0 +1,11 @@ +/** + * notion-enhancer: tabs + * (c) 2021 dragonwocky (https://dragonwocky.me/) + * (https://notion-enhancer.github.io/) under the MIT license + */ + +'use strict'; + +module.exports = async function (api, db, __exports, __eval) { + console.log(123); +}; diff --git a/theming/client.mjs b/theming/client.mjs index df91662..380b260 100644 --- a/theming/client.mjs +++ b/theming/client.mjs @@ -1,12 +1,12 @@ -/* - * notion-enhancer core: theming +/** + * notion-enhancer: theming * (c) 2021 dragonwocky (https://dragonwocky.me/) * (https://notion-enhancer.github.io/) under the MIT license */ 'use strict'; -export default async function ({ web, registry }, db) { +export default async function ({ web, registry, storage, electron }, db) { const enabledThemes = await registry.list( async (m) => (await registry.enabled(m.id)) && m.tags.includes('theme') ); @@ -16,12 +16,19 @@ export default async function ({ web, registry }, db) { web.loadStylesheet('repo/theming/colors.css'); } - const updateTheme = () => + const updateTheme = () => { + storage + .set(['theme'], document.querySelector('.notion-dark-theme') ? 'dark' : 'light') + .then(() => { + electron.sendToHost('update-theme'); + }); document.documentElement.classList[ document.body.classList.contains('dark') ? 'add' : 'remove' ]('dark'); - updateTheme(); + }; web.addDocumentObserver((mutation) => { - if (mutation.target === document.body) updateTheme(); + if (mutation.target === document.body && document.hasFocus()) updateTheme(); }); + if (document.hasFocus()) updateTheme(); + document.addEventListener('visibilitychange', updateTheme); } diff --git a/theming/colors.css b/theming/colors.css index 0fc59d6..5d4f4a1 100644 --- a/theming/colors.css +++ b/theming/colors.css @@ -1,5 +1,5 @@ -/* - * notion-enhancer core: theming +/** + * notion-enhancer: theming * (c) 2021 dragonwocky (https://dragonwocky.me/) * (https://notion-enhancer.github.io/) under the MIT license */ diff --git a/theming/electronSearch.css b/theming/electronSearch.css new file mode 100644 index 0000000..16f1854 --- /dev/null +++ b/theming/electronSearch.css @@ -0,0 +1,61 @@ +/** + * notion-enhancer: theming + * (c) 2021 dragonwocky (https://dragonwocky.me/) + * (https://notion-enhancer.github.io/) under the MIT license + */ + +body > style + #container { + background: var(--theme--bg) !important; + box-shadow: var(--theme--ui_shadow, rgba(15, 15, 15, 0.05)) 0px 0px 0px 1px, + var(--theme--ui_shadow, rgba(15, 15, 15, 0.1)) 0px 3px 6px, + var(--theme--ui_shadow, rgba(15, 15, 15, 0.2)) 0px 9px 24px !important; +} + +body > style + #container #results { + color: var(--theme--text) !important; +} + +body > style + #container #prev, +body > style + #container #next { + border-color: var(--theme--ui_divider) !important; +} +body > style + #container .enabled:focus, +body > style + #container .enabled:hover { + background: var(--theme--ui_interactive-hover) !important; +} +body > style + #container .enabled:active { + background: var(--theme--ui_interactive-active) !important; +} +body > style + #container #prev svg, +body > style + #container #next svg { + fill: var(--theme--icon_secondary) !important; +} +body > style + #container #button-separator { + background: var(--theme--ui_divider) !important; +} + +body > style + #container #search-icon svg, +body > style + #container #clear-icon svg { + fill: var(--theme--icon) !important; +} +body > style + #container #input-wrap #search { + background: var(--theme--ui_input) !important; + color: var(--theme--text) !important; +} + +body > style + #container #done { + background: var(--theme--accent_blue) !important; + color: var(--theme--accent_blue-text) !important; +} +body > style + #container #done:focus, +body > style + #container #done:hover { + background: var(--theme--accent_blue-hover) !important; +} +body > style + #container #done:active { + background: var(--theme--accent_blue-active) !important; +} + +body > style + #container .enabled::after, +body > style + #container #done::after { + background: transparent !important; +} diff --git a/theming/generate-mappings.js b/theming/generate-mappings.js index 68a10cc..ffebec3 100644 --- a/theming/generate-mappings.js +++ b/theming/generate-mappings.js @@ -1,5 +1,5 @@ -/* - * notion-enhancer core: theming +/** + * notion-enhancer: theming * (c) 2021 dragonwocky (https://dragonwocky.me/) * (https://notion-enhancer.github.io/) under the MIT license */ diff --git a/theming/menu.mjs b/theming/menu.mjs new file mode 100644 index 0000000..ee31881 --- /dev/null +++ b/theming/menu.mjs @@ -0,0 +1,24 @@ +/** + * notion-enhancer: theming + * (c) 2021 dragonwocky (https://dragonwocky.me/) + * (https://notion-enhancer.github.io/) under the MIT license + */ + +'use strict'; + +export default async function ({ web, registry, storage }, db) { + await web.whenReady(); + + const loadTheme = async () => { + document.documentElement.className = + (await storage.get(['theme'], 'light')) === 'dark' ? 'dark' : ''; + }; + document.addEventListener('visibilitychange', loadTheme); + loadTheme(); + + for (const mod of await registry.list((mod) => registry.enabled(mod.id))) { + for (const sheet of mod.css?.menu || []) { + web.loadStylesheet(`repo/${mod._dir}/${sheet}`); + } + } +} diff --git a/theming/mod.json b/theming/mod.json index 805b3bc..0edbfed 100644 --- a/theming/mod.json +++ b/theming/mod.json @@ -13,12 +13,17 @@ } ], "css": { - "frame": ["variables.css"], + "frame": ["variables.css", "electronSearch.css"], "client": ["variables.css", "prism.css", "patches.css"], - "menu": ["variables.css", "prism.css"] + "menu": ["variables.css"] }, "js": { - "client": ["client.mjs"] + "client": ["client.mjs"], + "menu": ["menu.mjs"], + "electron": [ + { "source": "rendererIndex.cjs", "target": "renderer/index.js" }, + { "source": "rendererSearch.cjs", "target": "renderer/search.js" } + ] }, "options": [ { diff --git a/theming/patches.css b/theming/patches.css index 36ce28e..d959915 100644 --- a/theming/patches.css +++ b/theming/patches.css @@ -1,5 +1,5 @@ -/* - * notion-enhancer core: theming +/** + * notion-enhancer: theming * (c) 2021 dragonwocky (https://dragonwocky.me/) * (https://notion-enhancer.github.io/) under the MIT license */ diff --git a/theming/prism.css b/theming/prism.css index 6d9ae4f..42d82bc 100644 --- a/theming/prism.css +++ b/theming/prism.css @@ -1,5 +1,5 @@ -/* - * notion-enhancer core: theming +/** + * notion-enhancer: theming * (c) 2021 dragonwocky (https://dragonwocky.me/) * (https://notion-enhancer.github.io/) under the MIT license */ diff --git a/theming/rendererIndex.cjs b/theming/rendererIndex.cjs new file mode 100644 index 0000000..4a9eb23 --- /dev/null +++ b/theming/rendererIndex.cjs @@ -0,0 +1,17 @@ +/** + * notion-enhancer: theming + * (c) 2021 dragonwocky (https://dragonwocky.me/) + * (https://notion-enhancer.github.io/) under the MIT license + */ + +'use strict'; + +module.exports = async function ({ registry, web, storage }, db, __exports, __eval) { + await web.whenReady(); + + for (const mod of await registry.list((mod) => registry.enabled(mod.id))) { + for (const sheet of mod.css?.frame || []) { + web.loadStylesheet(`repo/${mod._dir}/${sheet}`); + } + } +}; diff --git a/theming/rendererSearch.cjs b/theming/rendererSearch.cjs new file mode 100644 index 0000000..e2fc1da --- /dev/null +++ b/theming/rendererSearch.cjs @@ -0,0 +1,24 @@ +/** + * notion-enhancer: theming + * (c) 2021 dragonwocky (https://dragonwocky.me/) + * (https://notion-enhancer.github.io/) under the MIT license + */ + +'use strict'; + +module.exports = async function ({ registry, web, storage, electron }, db, __exports, __eval) { + await web.whenReady(['#search']); + + const loadTheme = async () => { + document.documentElement.className = + (await storage.get(['theme'], 'light')) === 'dark' ? 'dark' : ''; + }; + document.querySelector('#search').addEventListener('focus', loadTheme); + loadTheme(); + + for (const mod of await registry.list((mod) => registry.enabled(mod.id))) { + for (const sheet of mod.css?.frame || []) { + web.loadStylesheet(`repo/${mod._dir}/${sheet}`); + } + } +}; diff --git a/theming/theme.css b/theming/theme.css index a9009a3..4c9dbb5 100644 --- a/theming/theme.css +++ b/theming/theme.css @@ -1,5 +1,5 @@ -/* - * notion-enhancer core: theming +/** + * notion-enhancer: theming * (c) 2021 dragonwocky (https://dragonwocky.me/) * (https://notion-enhancer.github.io/) under the MIT license */ @@ -165,6 +165,10 @@ body, var(--theme--ui_shadow, rgba(15, 15, 15, 0.1)) 0px 3px 6px, var(--theme--ui_shadow, rgba(15, 15, 15, 0.2)) 0px 9px 24px !important; } +[style*='z-index:'][style*='box-shadow: '][style*='font-size: 12px;'][style*='min-height: 24px; overflow: hidden; pointer-events:'] + > .notion-focusable { + color: var(--theme--text) !important; +} .notion-calendar-view .notion-selectable.notion-page-block.notion-collection-item diff --git a/theming/variables.css b/theming/variables.css index ff97211..ac62f7a 100644 --- a/theming/variables.css +++ b/theming/variables.css @@ -1,5 +1,5 @@ -/* - * notion-enhancer core: theming +/** + * notion-enhancer: theming * (c) 2021 dragonwocky (https://dragonwocky.me/) * (https://notion-enhancer.github.io/) under the MIT license */ diff --git a/topbar-icons/client.mjs b/topbar-icons/client.mjs index 8891871..0e57db2 100644 --- a/topbar-icons/client.mjs +++ b/topbar-icons/client.mjs @@ -1,4 +1,4 @@ -/* +/** * notion-enhancer: topbar icons * (c) 2020 CloudHill (https://github.com/CloudHill) * (c) 2021 dragonwocky (https://dragonwocky.me/) diff --git a/tray/client.mjs b/tray/client.mjs index cc2bd0d..051c743 100644 --- a/tray/client.mjs +++ b/tray/client.mjs @@ -1,4 +1,4 @@ -/* +/** * notion-enhancer: tray * (c) 2021 dragonwocky (https://dragonwocky.me/) * (https://notion-enhancer.github.io/) under the MIT license diff --git a/tray/createWindow.cjs b/tray/createWindow.cjs index 4756313..9b21c16 100644 --- a/tray/createWindow.cjs +++ b/tray/createWindow.cjs @@ -1,4 +1,4 @@ -/* +/** * notion-enhancer: tray * (c) 2021 dragonwocky (https://dragonwocky.me/) * (https://notion-enhancer.github.io/) under the MIT license @@ -18,11 +18,11 @@ module.exports = async function ({ env }, db, __exports, __eval) { }); const notionCreateWindow = __exports.createWindow; - __exports.createWindow = (relativeUrl = '', args, force = false) => { + __exports.createWindow = (relativeUrl = '', args) => { const windows = electron.BrowserWindow.getAllWindows(); if (windows.length) windows.forEach((win) => win.show()); - if (force || !windows.length) { + if (relativeUrl || !windows.length) { // hijack close event to hide instead const window = notionCreateWindow(relativeUrl, args); window.prependListener('close', (e) => { diff --git a/tray/main.cjs b/tray/main.cjs index 15b49fa..6bf8dbb 100644 --- a/tray/main.cjs +++ b/tray/main.cjs @@ -1,4 +1,4 @@ -/* +/** * notion-enhancer: tray * (c) 2021 dragonwocky (https://dragonwocky.me/) * (https://notion-enhancer.github.io/) under the MIT license @@ -48,9 +48,9 @@ module.exports = async function ({ env, registry }, db, __exports, __eval) { // duplicate window prevention const createWindow = () => { const { createWindow } = env.notionRequire('main/createWindow.js'); - createWindow('', null, true); + createWindow('/'); }; - electron.ipcMain.on(`notion-enhancer:create-new-window`, createWindow); + electron.ipcMain.on('notion-enhancer:create-new-window', createWindow); const contextMenu = electron.Menu.buildFromTemplate([ { diff --git a/truncated-titles/client.mjs b/truncated-titles/client.mjs index cedfc8d..872a21e 100644 --- a/truncated-titles/client.mjs +++ b/truncated-titles/client.mjs @@ -1,4 +1,4 @@ -/* +/** * notion-enhancer: truncated titles * (c) 2021 admiraldus (https://github.com/admiraldus) * (c) 2021 dragonwocky (https://dragonwocky.me/) @@ -19,7 +19,7 @@ export default async function ({ web, components }, db) { if ($elements.includes($tableTitle)) return; if ($tableTitle.scrollWidth > $tableTitle.clientWidth) { - components.tooltip( + components.addTooltip( $tableTitle.parentElement.parentElement.parentElement, web.html`${web.escape($tableTitle.innerText)}`, 750 diff --git a/tweaks/client.css b/tweaks/client.css index b5491b7..043f1c7 100644 --- a/tweaks/client.css +++ b/tweaks/client.css @@ -1,4 +1,4 @@ -/* +/** * notion-enhancer: tweaks * (c) 2021 dragonwocky (https://dragonwocky.me/) * (c) 2020 arecsu diff --git a/tweaks/client.mjs b/tweaks/client.mjs index 782d579..66a2660 100644 --- a/tweaks/client.mjs +++ b/tweaks/client.mjs @@ -1,4 +1,4 @@ -/* +/** * notion-enhancer: tweaks * (c) 2021 dragonwocky (https://dragonwocky.me/) * (https://notion-enhancer.github.io/) under the MIT license diff --git a/view-scale/client.css b/view-scale/client.css index 5fe2128..114736b 100644 --- a/view-scale/client.css +++ b/view-scale/client.css @@ -1,4 +1,4 @@ -/* +/** * notion-enhancer: view scale * (c) 2021 SP12893678 (https://sp12893678.tk/) * (c) 2021 dragonwocky (https://dragonwocky.me/) diff --git a/view-scale/client.mjs b/view-scale/client.mjs index 41b16ba..a35608b 100644 --- a/view-scale/client.mjs +++ b/view-scale/client.mjs @@ -1,4 +1,4 @@ -/* +/** * notion-enhancer: view scale * (c) 2021 SP12893678 (https://sp12893678.tk/) * (c) 2021 dragonwocky (https://dragonwocky.me/) @@ -56,8 +56,8 @@ export default async function ({ electron, web, components }, db) { $scaleMinus = web.html``; - components.tooltip($scalePlus, '**Zoom into the window**'); - components.tooltip($scaleMinus, '**Zoom out of the window**'); + components.addTooltip($scalePlus, '**Zoom into the window**'); + components.addTooltip($scaleMinus, '**Zoom out of the window**'); updateScale = () => { if (getZoomFactor() !== zoomFactor) zoomFactor = getZoomFactor(); $scaleSlider.value = Math.round(zoomFactor * 100); diff --git a/weekly-view/client.mjs b/weekly-view/client.mjs index fca52fd..a93f80c 100644 --- a/weekly-view/client.mjs +++ b/weekly-view/client.mjs @@ -1,4 +1,4 @@ -/* +/** * notion-enhancer: weekly view * (c) 2021 dragonwocky (https://dragonwocky.me/) * (https://notion-enhancer.github.io/) under the MIT license diff --git a/word-counter/client.css b/word-counter/client.css index 614e70b..bd44781 100644 --- a/word-counter/client.css +++ b/word-counter/client.css @@ -1,4 +1,4 @@ -/* +/** * notion-enhancer: word counter * (c) 2021 dragonwocky (https://dragonwocky.me/) * (https://notion-enhancer.github.io/) under the MIT license diff --git a/word-counter/client.mjs b/word-counter/client.mjs index ef61e32..30722d3 100644 --- a/word-counter/client.mjs +++ b/word-counter/client.mjs @@ -1,4 +1,4 @@ -/* +/** * notion-enhancer: word counter * (c) 2021 dragonwocky (https://dragonwocky.me/) * (https://notion-enhancer.github.io/) under the MIT license @@ -54,8 +54,8 @@ export default async function ({ web, components }, db) { $statList.querySelectorAll('.word-counter--stat').forEach(($stat) => { $stat.addEventListener('click', () => web.copyToClipboard($stat.innerText)); }); - components.tooltip($readingTooltip, '**~ 275 wpm**', { offsetDirection: 'left' }); - components.tooltip($speakingTooltip, '**~ 180 wpm**', { offsetDirection: 'left' }); + components.addTooltip($readingTooltip, '**~ 275 wpm**', { offsetDirection: 'left' }); + components.addTooltip($speakingTooltip, '**~ 180 wpm**', { offsetDirection: 'left' }); let viewFocused = false, $page;