Open johnd0e opened 4 years ago
Violentmonkey shows script names:
Violentmonkey does it by adding a special comment to the script element's textContent:
'\n//# sourceURL=' + browser.extension.getURL(`${name}.user.js#${scriptId}`);
A bonus feature is an automatic redirection to a real script editor URL using webRequest.onBeforeRequest when choosing "open in new tab" in the devtools context menu for the script. This particular thing doesn't work in Firefox though as extension URLs aren't reported to webRequest in FF, but welp there's no "open in new tab" in FF's devtools anyway.
E.g. I want to set breakpoint in script source. So I press F12 to open Chrome DevTools and go to
Sources
tab. In left pane there is a tree with many domains, includingTampermonkey
. And there are all my scripts inside of it, shown in formchrome-extension://dhdgffkkebhmkfjojejmpbldmpobfkfo/userscript.html?id=02a585a6-c478-409d-98d9-d0ac3d13441b
The problem is that I have a lot of scripts, so it's hard to find which one is needed.
I wish the source name was more meaningful, e.g.
<myscriptname>.html?id=02a585a6-c478-409d-98d9-d0ac3d13441b
Just add debugger
at the beginning of the script should do the trick. For ES5 script, add it to the beginning of IIFE.
P.S. it's really painful to debug in Firefox+TM as the script jumps randomly when I click next line.
I've added a name parameter to the URL which should allow to distinguish the scripts.
I've added a name parameter to the URL which should allow to distinguish the scripts.
Yes, the name parameter works and thank you for that,
but it contains percent encoding, in the following example it's %20
instead of ` (space), and there's a preceding
userscript.html?name=and a trailing
&id=___` :
i.e. userscript.html?name=GitHub%2520Code%2520Colors.user.js&id=01363ab9-5fe6-4b27-9f13-9cdc5c47a852
instead of GitHub Code Colors.user.js
Could the percentage encoding and the preceding and trailing parts be removed, so that the name is displayed plain, like in ViolentMonkey: ?
P.S. Using latest TM beta 4.10.6109 in Chrome 79.
E.g. I want to set breakpoint in script source. So I press F12 to open Chrome DevTools and go to
Sources
tab. In left pane there is a tree with many domains, includingTampermonkey
. And there are all my scripts inside of it, shown in formchrome-extension://dhdgffkkebhmkfjojejmpbldmpobfkfo/userscript.html?id=02a585a6-c478-409d-98d9-d0ac3d13441b
The problem is that I have a lot of scripts, so it's hard to find which one is needed.
I wish the source name was more meaningful, e.g.
<myscriptname>.html?id=02a585a6-c478-409d-98d9-d0ac3d13441b