Skip to content

Commit

Permalink
v6.7.2
Browse files Browse the repository at this point in the history
Signed-off-by: Magic <[email protected]>
  • Loading branch information
magicoflolis committed Sep 26, 2024
1 parent 6d240a7 commit d6ff2ce
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 3 deletions.
4 changes: 3 additions & 1 deletion dist/magic-userjs.meta.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

35 changes: 34 additions & 1 deletion dist/magic-userjs.user.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// ==UserScript==
// @version 6.7.1
// @version 6.7.2
// @name Magic Userscript+ : Show Site All UserJS
// @name:ar Magic Userscript+: عرض جميع ملفات UserJS
// @name:de Magic Userscript+ : Website anzeigen Alle UserJS
Expand Down Expand Up @@ -45,12 +45,14 @@
// @grant GM_getValue
// @grant GM_openInTab
// @grant GM_setValue
// @grant GM_registerMenuCommand
// @grant GM_xmlhttpRequest
// @grant GM.addElement
// @grant GM.info
// @grant GM.getValue
// @grant GM.openInTab
// @grant GM.setValue
// @grant GM.registerMenuCommand
// @grant GM.xmlHttpRequest
// @match https://*/*
// @noframes
Expand Down Expand Up @@ -755,6 +757,31 @@ const StorageSystem = {
}
}
};
class jsCommand {
constructor() {
this.cmds = [];
}
register(text, command) {
if (!isGM) {
return;
}

if (isFN(command)) {
const found = this.cmds.find(c => command === c);
if (found) {
return;
}
this.cmds.push(command);
}

if (isFN(GM.registerMenuCommand)) {
GM.registerMenuCommand(text, command);
} else if (isFN(GM_registerMenuCommand)) {
GM_registerMenuCommand(text, command);
}
}
};
const Command = new jsCommand();
/**
* @type { import("../typings/UserJS.d.ts").Network }
*/
Expand Down Expand Up @@ -3192,6 +3219,12 @@ const init = async () => {
}
sleazyRedirect();
container.inject(primaryFN, doc);
Command.register('Inject Userscript+', () => {
container.inject(primaryFN, doc);
});
Command.register('Close Userscript+', () => {
container.remove();
});
} catch (ex) {
err(ex);
}
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"url": "https://github.com/magicoflolis/Userscript-Plus/issues"
},
"userJS": {
"version": "6.7.1",
"version": "6.7.2",
"name": "Magic Userscript+ : Show Site All UserJS",
"description": "Finds available userscripts for the current webpage.",
"bugs": "https://github.com/magicoflolis/Userscript-Plus/issues",
Expand Down Expand Up @@ -62,12 +62,14 @@
"GM_getValue",
"GM_openInTab",
"GM_setValue",
"GM_registerMenuCommand",
"GM_xmlhttpRequest",
"GM.addElement",
"GM.info",
"GM.getValue",
"GM.openInTab",
"GM.setValue",
"GM.registerMenuCommand",
"GM.xmlHttpRequest"
],
"exclude": [],
Expand Down
31 changes: 31 additions & 0 deletions src/UserJS/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -651,6 +651,31 @@ const StorageSystem = {
}
}
};
class jsCommand {
constructor() {
this.cmds = [];
}
register(text, command) {
if (!isGM) {
return;
}

if (isFN(command)) {
const found = this.cmds.find(c => command === c);
if (found) {
return;
}
this.cmds.push(command);
}

if (isFN(GM.registerMenuCommand)) {
GM.registerMenuCommand(text, command);
} else if (isFN(GM_registerMenuCommand)) {
GM_registerMenuCommand(text, command);
}
}
};
const Command = new jsCommand();
/**
* @type { import("../typings/UserJS.d.ts").Network }
*/
Expand Down Expand Up @@ -3088,6 +3113,12 @@ const init = async () => {
}
sleazyRedirect();
container.inject(primaryFN, doc);
Command.register('Inject Userscript+', () => {
container.inject(primaryFN, doc);
});
Command.register('Close Userscript+', () => {
container.remove();
});
} catch (ex) {
err(ex);
}
Expand Down

0 comments on commit d6ff2ce

Please sign in to comment.