feat: add menu link to source code

This commit is contained in:
Xmader 2020-12-06 02:22:54 -05:00
parent 63bf02046a
commit 0522e5935c
No known key found for this signature in database
GPG key ID: A20B97FB9EB730E4
2 changed files with 8 additions and 0 deletions

View file

@ -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 => {

View file

@ -15,5 +15,6 @@
// @grant unsafeWindow
// @grant GM.registerMenuCommand
// @grant GM.addElement
// @grant GM.openInTab
// @run-at document-start
// ==/UserScript==