topical media & game development

talk show tell print

mashup-flickr-09-findimageswithxpath.user.js / js



  // ==UserScript==
  // @name          Find Images with XPath
  // @namespace     http://www.dopiaza.org/flickr/greasemonkey/
  // @description   Find all images in a page
  // @include       http://www.flickr.com/*
  // @include       http://flickr.com/*
  // ==/UserScript==
  
  var imgElements = document.evaluate(
    "//img[@width='75']",
    document,
    null,
    XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,
    null);
  
  for (var i = 0; i < imgElements.snapshotLength; i++) 
  {
    var img = imgElements.snapshotItem(i);
    
    var src = img.getAttribute('src');
  
    GM_log("Found Image: " + src);    
  }
  


(C) Æliens 20/2/2008

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.