mirror of
https://github.com/notion-enhancer/notion-enhancer.git
synced 2025-04-19 19:19:03 +00:00
Added options to mod.js
Added the option to individually select which buttons (share, updates, favorite) to replace with icons
This commit is contained in:
parent
a03a01af26
commit
4314a3a70a
@ -16,12 +16,36 @@ module.exports = {
|
|||||||
tags: ['extension'],
|
tags: ['extension'],
|
||||||
name: 'topbar icons',
|
name: 'topbar icons',
|
||||||
desc:
|
desc:
|
||||||
'replaces the topbar buttons (share, updates, favorite) with icons.',
|
'replaces the topbar buttons with icons.',
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
key: 'share',
|
||||||
|
label: 'share',
|
||||||
|
type: 'toggle',
|
||||||
|
value: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'updates',
|
||||||
|
label: 'updates',
|
||||||
|
type: 'toggle',
|
||||||
|
value: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'favorite',
|
||||||
|
label: 'favorite',
|
||||||
|
type: 'toggle',
|
||||||
|
value: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
version: '1.0.0',
|
version: '1.0.0',
|
||||||
author: 'CloudHill',
|
author: 'CloudHill',
|
||||||
hacks: {
|
hacks: {
|
||||||
'renderer/preload.js'(store, __exports) {
|
'renderer/preload.js'(store, __exports) {
|
||||||
const icons = {
|
const icons = {
|
||||||
|
selected: [
|
||||||
|
...(store().updates ? ['updates'] : []),
|
||||||
|
...(store().favorite ? ['favorite'] : []),
|
||||||
|
],
|
||||||
share: fs.readFile(path.resolve(`${__dirname}/icons/share.svg`)),
|
share: fs.readFile(path.resolve(`${__dirname}/icons/share.svg`)),
|
||||||
updates: {
|
updates: {
|
||||||
on: fs.readFile(path.resolve(`${__dirname}/icons/updates_on.svg`)),
|
on: fs.readFile(path.resolve(`${__dirname}/icons/updates_on.svg`)),
|
||||||
@ -73,12 +97,16 @@ module.exports = {
|
|||||||
|
|
||||||
async function setIcons(buttons) {
|
async function setIcons(buttons) {
|
||||||
const buttonList = buttons.children;
|
const buttonList = buttons.children;
|
||||||
|
if (store().share) {
|
||||||
|
buttonList[0].classList.add('notion-topbar-icon');
|
||||||
buttonList[0].innerHTML = await icons.share;
|
buttonList[0].innerHTML = await icons.share;
|
||||||
|
}
|
||||||
const elements = {
|
const elements = {
|
||||||
updates: buttonList[1],
|
updates: buttonList[1],
|
||||||
favorite: buttonList[2],
|
favorite: buttonList[2],
|
||||||
};
|
};
|
||||||
for (let btn of ['updates', 'favorite']) {
|
for (let btn of icons.selected) {
|
||||||
|
elements[btn].classList.add('notion-topbar-icon')
|
||||||
elements[btn].prepend(
|
elements[btn].prepend(
|
||||||
createElement(
|
createElement(
|
||||||
`<div>${(await icons[btn].off).toString()}
|
`<div>${(await icons[btn].off).toString()}
|
||||||
|
Loading…
Reference in New Issue
Block a user