diff --git a/CHANGELOG.md b/CHANGELOG.md
index ce6bed9..2f6586a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -26,8 +26,7 @@ a flexibility update.
- improved: additional menu option descriptions on hover.
- improved: listen to prefers-color-scheme to better change theme in night shift.
- bugfix: removed messenger emoji set as the provider no longer supports it.
-- bugfix: remove shadow around light mode board headers
- \+ minor text colour fixes for night shift theming.
+- bugfix: remove shadow around light mode board headers.
- bugfix: properly detect/respond to `EACCES`/`EBUSY` errors.
- bugfix: night shift checks every interaction,
will respond to system changes without any manual changes.
@@ -52,7 +51,8 @@ a flexibility update.
- theme: "material ocean" = an oceanic colour palette.
- theme: "dracula" = a theme based on the popular dracula color palette
originally by zeno rocha and friends.
-- extension: "tabs" = have multiple notion pages open in a single window.
+- extension: "tabs" = have multiple notion pages open in a single window. tabs can be controlled
+ with keyboard shortcuts and dragged/reordered within/between windows.
- extension: "scroll to top" = add an arrow above the help button to scroll back to the top of a page.
- extension: "tweaks" = common style/layout changes. includes:
- new: make transitions snappy/0s.
diff --git a/pkg/loader.js b/pkg/loader.js
index 8a81f0c..7cc5729 100644
--- a/pkg/loader.js
+++ b/pkg/loader.js
@@ -8,12 +8,12 @@
const fs = require('fs-extra'),
path = require('path'),
- helpers = require('./helpers.js'),
+ { __notion, getEnhancements, createElement } = require('./helpers.js'),
store = require('./store.js');
module.exports = function (__file, __exports) {
__file = __file
- .slice(path.resolve(`${helpers.__notion}/app`).length + 1)
+ .slice(path.resolve(`${__notion}/app`).length + 1)
.replace(/\\/g, '/');
if (__file === 'main/security.js') {
@@ -54,47 +54,51 @@ module.exports = function (__file, __exports) {
]);
}
- const modules = helpers.getEnhancements();
- for (let mod of [
+ let modules = getEnhancements();
+ modules = [
...modules.loaded.filter((m) => m.tags.includes('core')),
...modules.loaded.filter((m) => !m.tags.includes('core')).reverse(),
- ]) {
- if (
- mod.alwaysActive ||
- store('mods', { [mod.id]: { enabled: false } })[mod.id].enabled
- ) {
- if (
- __file === 'renderer/preload.js' &&
- fs.pathExistsSync(
- path.resolve(`${__dirname}/../mods/${mod.dir}/styles.css`)
- )
- ) {
- document.addEventListener('readystatechange', (event) => {
- if (document.readyState !== 'complete') return false;
+ ];
+ if (__file === 'renderer/preload.js') {
+ document.addEventListener('readystatechange', (event) => {
+ if (document.readyState !== 'complete') return false;
+ for (let mod of modules) {
+ if (
+ (mod.alwaysActive ||
+ store('mods', { [mod.id]: { enabled: false } })[mod.id].enabled) &&
+ fs.pathExistsSync(
+ path.resolve(`${__dirname}/../mods/${mod.dir}/styles.css`)
+ )
+ ) {
for (let rules of [
`enhancement://${mod.dir}/styles.css`,
...(mod.fonts || []),
]) {
- document
- .querySelector('head')
- .appendChild(
- helpers.createElement(``)
- );
+ document.head.appendChild(
+ createElement(``)
+ );
}
+ }
+ }
+ });
+ }
+ for (let mod of modules) {
+ if (
+ (mod.alwaysActive ||
+ store('mods', { [mod.id]: { enabled: false } })[mod.id].enabled) &&
+ mod.hacks &&
+ mod.hacks[__file]
+ ) {
+ mod.hacks[__file]((...args) => {
+ if (!args.length) return store(mod.id, mod.defaults);
+ if (args.length === 1 && typeof args[0] === 'object')
+ return store(mod.id, { ...mod.defaults, ...args[0] });
+ const other_mod = modules.find((m) => m.id === args[0]);
+ return store(args[0], {
+ ...(other_mod ? other_mod.defaults : {}),
+ ...(args[1] || {}),
});
- }
- if (mod.hacks && mod.hacks[__file]) {
- mod.hacks[__file]((...args) => {
- if (!args.length) return store(mod.id, mod.defaults);
- if (args.length === 1 && typeof args[0] === 'object')
- return store(mod.id, { ...mod.defaults, ...args[0] });
- const other_mod = modules.loaded.find((m) => m.id === args[0]);
- return store(args[0], {
- ...(other_mod ? other_mod.defaults : {}),
- ...(args[1] || {}),
- });
- }, __exports);
- }
+ }, __exports);
}
}
};