Skip to content

Instantly share code, notes, and snippets.

@drguildo
Last active August 30, 2015 13:54
Show Gist options
  • Save drguildo/147121 to your computer and use it in GitHub Desktop.
Save drguildo/147121 to your computer and use it in GitHub Desktop.
A bookmarklet that prompts the user for a search pattern and lists all links on the current page that match it.
// javascript:(function(){var x,nD,z,i;x=prompt("Pattern:", "");if(x!=null){nD=window.open().document;nD.writeln('<pre>');z=document.links;for(i=0;i<z.length;++i){if(z[i].href.indexOf(x)!=-1){nD.writeln(z[i].href);}}nD.writeln('</pre>');nD.close();}})();
javascript:(
function(){
var x,nD,z,i;
x=prompt("Pattern:", "");
if(x!=null) {
nD = window.open().document;
nD.writeln('<pre>');
z = document.links;
for (i = 0; i < z.length; ++i) {
if (z[i].href.indexOf(x) != -1 ) {
nD.writeln(z[i].href);
}
}
nD.writeln('</pre>');
nD.close();
}
}
)();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment