// ==UserScript==
// @name	    Rewrite NY Times Links From Bloglines
// @namespace   http://www.longhighway.com/monkeyisland
// @description	Rewrites New York Times links in Bloglines feeds to ask for the printer-friendly (ad-free) version of the page.
// @include	    http://www.bloglines.com/myblogs*
// ==/UserScript==
// Based on	http://neugierig.org/software/greasemonkey/nytlink.user.js

(function() {
  var xpath = "//a[starts-with(@href,'http://www.nytimes.com/')]";
  var res = document.evaluate(xpath, document, null,
                              XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
  var i, link;
  for (i = 0; link = res.snapshotItem(i); i++) {
    var add;
    if (link.href.search(/\?/) >= 0) {
      add = '&';
    } else {
      add = '?';
    }
    link.href = link.href + add + 'pagewanted=print';
  }
})();

// vim: set ts=2 sw=2 et :
