Skip to content

Commit d6ff2ce

Browse files
committed
v6.7.2
Signed-off-by: Magic <[email protected]>
1 parent 6d240a7 commit d6ff2ce

File tree

4 files changed

+71
-3
lines changed

4 files changed

+71
-3
lines changed

dist/magic-userjs.meta.js

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/magic-userjs.user.js

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// ==UserScript==
2-
// @version 6.7.1
2+
// @version 6.7.2
33
// @name Magic Userscript+ : Show Site All UserJS
44
// @name:ar Magic Userscript+: عرض جميع ملفات UserJS
55
// @name:de Magic Userscript+ : Website anzeigen Alle UserJS
@@ -45,12 +45,14 @@
4545
// @grant GM_getValue
4646
// @grant GM_openInTab
4747
// @grant GM_setValue
48+
// @grant GM_registerMenuCommand
4849
// @grant GM_xmlhttpRequest
4950
// @grant GM.addElement
5051
// @grant GM.info
5152
// @grant GM.getValue
5253
// @grant GM.openInTab
5354
// @grant GM.setValue
55+
// @grant GM.registerMenuCommand
5456
// @grant GM.xmlHttpRequest
5557
// @match https://*/*
5658
// @noframes
@@ -755,6 +757,31 @@ const StorageSystem = {
755757
}
756758
}
757759
};
760+
class jsCommand {
761+
constructor() {
762+
this.cmds = [];
763+
}
764+
register(text, command) {
765+
if (!isGM) {
766+
return;
767+
}
768+
769+
if (isFN(command)) {
770+
const found = this.cmds.find(c => command === c);
771+
if (found) {
772+
return;
773+
}
774+
this.cmds.push(command);
775+
}
776+
777+
if (isFN(GM.registerMenuCommand)) {
778+
GM.registerMenuCommand(text, command);
779+
} else if (isFN(GM_registerMenuCommand)) {
780+
GM_registerMenuCommand(text, command);
781+
}
782+
}
783+
};
784+
const Command = new jsCommand();
758785
/**
759786
* @type { import("../typings/UserJS.d.ts").Network }
760787
*/
@@ -3192,6 +3219,12 @@ const init = async () => {
31923219
}
31933220
sleazyRedirect();
31943221
container.inject(primaryFN, doc);
3222+
Command.register('Inject Userscript+', () => {
3223+
container.inject(primaryFN, doc);
3224+
});
3225+
Command.register('Close Userscript+', () => {
3226+
container.remove();
3227+
});
31953228
} catch (ex) {
31963229
err(ex);
31973230
}

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"url": "https://github.com/magicoflolis/Userscript-Plus/issues"
1010
},
1111
"userJS": {
12-
"version": "6.7.1",
12+
"version": "6.7.2",
1313
"name": "Magic Userscript+ : Show Site All UserJS",
1414
"description": "Finds available userscripts for the current webpage.",
1515
"bugs": "https://github.com/magicoflolis/Userscript-Plus/issues",
@@ -62,12 +62,14 @@
6262
"GM_getValue",
6363
"GM_openInTab",
6464
"GM_setValue",
65+
"GM_registerMenuCommand",
6566
"GM_xmlhttpRequest",
6667
"GM.addElement",
6768
"GM.info",
6869
"GM.getValue",
6970
"GM.openInTab",
7071
"GM.setValue",
72+
"GM.registerMenuCommand",
7173
"GM.xmlHttpRequest"
7274
],
7375
"exclude": [],

src/UserJS/main.js

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -651,6 +651,31 @@ const StorageSystem = {
651651
}
652652
}
653653
};
654+
class jsCommand {
655+
constructor() {
656+
this.cmds = [];
657+
}
658+
register(text, command) {
659+
if (!isGM) {
660+
return;
661+
}
662+
663+
if (isFN(command)) {
664+
const found = this.cmds.find(c => command === c);
665+
if (found) {
666+
return;
667+
}
668+
this.cmds.push(command);
669+
}
670+
671+
if (isFN(GM.registerMenuCommand)) {
672+
GM.registerMenuCommand(text, command);
673+
} else if (isFN(GM_registerMenuCommand)) {
674+
GM_registerMenuCommand(text, command);
675+
}
676+
}
677+
};
678+
const Command = new jsCommand();
654679
/**
655680
* @type { import("../typings/UserJS.d.ts").Network }
656681
*/
@@ -3088,6 +3113,12 @@ const init = async () => {
30883113
}
30893114
sleazyRedirect();
30903115
container.inject(primaryFN, doc);
3116+
Command.register('Inject Userscript+', () => {
3117+
container.inject(primaryFN, doc);
3118+
});
3119+
Command.register('Close Userscript+', () => {
3120+
container.remove();
3121+
});
30913122
} catch (ex) {
30923123
err(ex);
30933124
}

0 commit comments

Comments
 (0)