From 657bec2fa432a676f60baf43cd7533f0373ab41b Mon Sep 17 00:00:00 2001 From: Emir <31805948+admiraldus@users.noreply.github.com> Date: Sun, 13 Dec 2020 20:19:12 +0300 Subject: [PATCH] global linking blocks: option: show the page link button --- mods/admiraldus-global-linking-blocks/mod.js | 64 ++++++++++++++------ 1 file changed, 44 insertions(+), 20 deletions(-) diff --git a/mods/admiraldus-global-linking-blocks/mod.js b/mods/admiraldus-global-linking-blocks/mod.js index fa20dd3..b965e5b 100644 --- a/mods/admiraldus-global-linking-blocks/mod.js +++ b/mods/admiraldus-global-linking-blocks/mod.js @@ -19,6 +19,14 @@ module.exports = { link: 'https://github.com/admiraldus', avatar: 'https://raw.githubusercontent.com/admiraldus/admiraldus/main/module.gif', }, + options: [ + { + key: 'hidePageButton', + label: 'show the page link button', + type: 'toggle', + value: true, + }, + ], hacks: { 'renderer/preload.js'(store, __exports) { document.addEventListener('readystatechange', () => { @@ -43,27 +51,43 @@ module.exports = { const pageClass = 'admiraldus-glb-page-button'; const blockClass = 'admiraldus-glb-block-button'; const spanClass = 'admiraldus-glb-span-hide'; - /** - * Create the page link button and append it to the topbar. - * - * @return {create} Returns "create()" if not appended. - */ - const pageButton = !function create() { - const target = x$.sel('.notion-topbar-share-menu'); - const attr = [ - `class="${pageClass}" role="button" tabindex="0"`, - `class="${spanClass}"`, - ]; - const html = x$.el( - `