User Tools

Site Tools


bookmarklet_--_open_all_image_links

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
bookmarklet_--_open_all_image_links [2011/04/24 21:43] – created tkbletscbookmarklet_--_open_all_image_links [2011/04/24 21:56] (current) tkbletsc
Line 6: Line 6:
 </code> </code>
  
-You can read or modify the current page by referring to ''document.''whatever.  Here's one that opens a new tab with all image links from a page:+You can read or modify the current page by referring to ''document'' Here's one that opens a new tab with all image links from a page:
  
 <code=javascript> <code=javascript>
Line 14: Line 14:
  var doc = "data:text/html,<html><head><title>Images of '"+document.title+"'</title></head>";  var doc = "data:text/html,<html><head><title>Images of '"+document.title+"'</title></head>";
  doc += "<body style='text-align:center; font-family: Verdana, sans-serif; font-size:80%;'><H1>Images of <a href='"+document.URL+"'>"+document.title+"</a></h1>";  doc += "<body style='text-align:center; font-family: Verdana, sans-serif; font-size:80%;'><H1>Images of <a href='"+document.URL+"'>"+document.title+"</a></h1>";
 + seen = {};
  for(var i = 0; i < document.links.length; i++) {  for(var i = 0; i < document.links.length; i++) {
  link = document.links[i].href;  link = document.links[i].href;
- if (link.match(regex)) {+ if (link.match(regex) && !seen[link]) {
  doc += "<img src='"+link+"'><br>\n";  doc += "<img src='"+link+"'><br>\n";
  doc += "<a href='"+link+"'>"+link+"</a><p>";  doc += "<a href='"+link+"'>"+link+"</a><p>";
 + seen[link] = 1;
  }  }
  }  }
bookmarklet_--_open_all_image_links.1303706628.txt.gz · Last modified: by tkbletsc

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki