Skip to content

Commit 434679e

Browse files
committed
refactor: more stringent and intuitive split
1 parent 0773b18 commit 434679e

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/ext/content-scripts/entry-userscripts.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ async function injection() {
198198
// loop through each userscript @grant value, add methods as needed
199199
for (let j = 0; j < grants.length; j++) {
200200
const grant = grants[j];
201-
const method = grant.split(".")[1] || grant.split(".")[0];
201+
const method = grant.startsWith("GM.") ? grant.slice(3) : grant;
202202
// ensure API method exists in USAPI object
203203
if (!Object.keys(USAPI).includes(method)) continue;
204204
// add granted methods

0 commit comments

Comments
 (0)