From 0522e5935cacff69ecefe6213e9dfa47426a4fec Mon Sep 17 00:00:00 2001 From: Xmader Date: Sun, 6 Dec 2020 02:22:54 -0500 Subject: [PATCH] feat: add menu link to source code --- src/intro.js | 7 +++++++ src/meta.js | 1 + 2 files changed, 8 insertions(+) diff --git a/src/intro.js b/src/intro.js index e9a040d..c930b79 100644 --- a/src/intro.js +++ b/src/intro.js @@ -5,6 +5,13 @@ const _GM = typeof GM == 'object' ? GM : undefined; const gmId = '' + Math.random(); w[gmId] = _GM; +if (_GM && _GM.registerMenuCommand && _GM.openInTab) { + // add buttons to the userscript manager menu + _GM.registerMenuCommand( + '** Source Code **', + () => _GM.openInTab(_GM.info.script.homepage, { active: true }) + ) +} // script loader new Promise(resolve => { diff --git a/src/meta.js b/src/meta.js index 46a3d90..0355a0a 100644 --- a/src/meta.js +++ b/src/meta.js @@ -15,5 +15,6 @@ // @grant unsafeWindow // @grant GM.registerMenuCommand // @grant GM.addElement +// @grant GM.openInTab // @run-at document-start // ==/UserScript==