Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- From@ http://subsimple.com/bookmarklets/collection_links.php
- javascript: (function() {
- var x, n, nD, z, i, h = '';
- function htmlEscape(s) {
- s = s.replace(/&/g, '&');
- s = s.replace(/>/g, '>');
- s = s.replace(/</g, '<');
- return s;
- }
- function attrQuoteEscape(s) {
- s = s.replace(/&/g, '&');
- s = s.replace(/"/g, '"');
- return s;
- }
- x = prompt("Leave blank to list all links or filter links on this page containing this word/phrase:", "");
- n = 0;
- if(x != null) {
- x = x.toLowerCase();
- nD = window.open().document;
- h += '<html>
- <head>
- <title>Links containing "' + htmlEscape(x) + '"</title>
- <base target="_blank">
- </head>
- <body>
- ' + 'List of links on <a href="' + attrQuoteEscape(location.href) + '">' + htmlEscape(location.href) + '</a><br>
- with link text/target URL containing "' + htmlEscape(x) + '"<br>
- <hr>
- <table>';
- z = document.links;
- for(i = 0; i < z.length; ++i) {
- if((z[i].innerHTML && z[i].innerHTML.toLowerCase().indexOf(x) != -1) || z[i].href.toLowerCase().indexOf(x) != -1) {
- h += '<tr><td>' + (++n) + '. ' + z[i].innerHTML + '</td><td><a href="' + htmlEscape(z[i].href) + '">' + htmlEscape(z[i].href) + '</a></td</tr>';
- }
- }
- h += '
- </table>
- </body>
- </html>';
- nD.writeln(h);
- nD.close();
- }
- })();
Advertisement
Add Comment
Please, Sign In to add comment