All pastes #29878 Raw Edit

Miscellany

public text v1 · immutable
#29878 ·published 2005-11-21 04:40 UTC
rendered paste body
(function () {

   function deletepost(post) {
      del = document.createElement("span");
      del.setAttribute("style","color: red;");
      del.appendChild(document.createTextNode("SPAM"));
      post.parentNode.insertBefore(del, post);
   }

   var allListings = document.evaluate("//blockquote[2]/p/a",
         document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);

   for (var i = 0; i < allListings.snapshotLength; i++) {

      thisListing = allListings.snapshotItem(i);
      thisURL = thisListing.getAttribute('href');

      GM_xmlhttpRequest({
         method: 'GET',
         url: thisURL,
         headers: {
            'User-agent': 'Mozilla/4.0 (compatible) Greasemonkey',
            'Accept': 'application/atom+xml,application/xml,text/xml',
         },
         onload: function(responseDetails) {
            var regex = /www\..*\.\w{2,5}\W/;
            if (regex.test(responseDetails.responseText)) {
               deletepost(thisListing)
            }
         }
      });

   }
})();