Created
August 6, 2020 20:25
-
-
Save forivall/373425de70964c8c271020cab3650048 to your computer and use it in GitHub Desktop.
bookmarklet to update links to open vscode
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
document.querySelector('svg').querySelectorAll('a').forEach(function (a) { | |
var u = new URL(a.href.baseVal, document.location.href); | |
u.protocol = 'vscode:'; | |
u.pathname = u.pathname.replace(/^\/*/, '//file/'); | |
a.href.baseVal = u.href; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
minified:
javascript:document.querySelector('svg').querySelectorAll('a').forEach(function(a,u){u=new URL(a.href.baseVal,document.location.href);u.protocol='vscode:';u.pathname=u.pathname.replace(/^\/*/,'//file/');a.href.baseVal=u.href})