Cannot find that topic

del.icio.us Topdecker

By Mike Sugarbaker Last update Sep 14, 2005 — Installed 582 times. Daily Installs: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
/*
 del.icio.us Topdecker, copyright 2005 Mike Sugarbaker.
 version 2 with code (c) 2006 Jesse Wolfe
 http://www.gibberish.com/hacks/gm/
 version 2
 Released under the GPL license
 http://www.gnu.org/copyleft/gpl.html

 The magic Firefox bookmark to make this work:

 http://del.icio.us/YOUR-USERNAME-HERE/%s?topdeck=please

 1) replace YOUR-USERNAME-HERE with your del.icio.us username.
 2) bookmark the resulting URL in Firefox.
 3) give it a keyword, something like 'dt'.
 4) type 'dt <tagname>' into the location bar to go to your most
recently bookmarked URL with that tagname.

alternate function
 http://del.icio.us/YOUR-USERNAME-HERE/%s?topdeck=all

 1) replace YOUR-USERNAME-HERE with your del.icio.us username.
 2) bookmark the resulting URL in Firefox.
 3) give it a keyword, something like 'dtall'.
 4) type 'dtall <tagname>' into the location bar to open your 10 most recent bookmarked URLs with that tagname.


*/
// ==UserScript==
// @name          del.icio.us Topdecker
// @namespace     http://www.gibberish.com/hacks/gm/
// @description   Takes you to your most recent del.icio.us bookmark with a given tag (with the aid of a Firefox bookmark keyword)
// @include       http://del.icio.us/*
// ==/UserScript==

(function(){
       function get_anchors()
	   {
               var thehits = document.evaluate(
                       "//ol[@class='posts']/li/h4/a",
                       document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null
               );
               var myhits = [];
               for (var i = 0; i < thehits.snapshotLength; i++) 
			   {
                 myhits[i] = thehits.snapshotItem(i);
               }
               // that should get us the As
               return myhits;
       }

       if (window.location.search.indexOf("topdeck=all") != -1)
       {
               var myhits = get_anchors();
               var counta = 1;
               while(counta < myhits.length && counta < 10)
			   {
                 var s = "";
                 s += myhits[counta];
                 //alert(myhits[l]);
                 GM_openInTab(myhits[counta]);
                 counta++;
               }
               window.location.replace(myhits[0]);
       }
       if (window.location.search.indexOf("topdeck=please") != -1)
       {
               var myhits = get_anchors();
               window.location.replace(myhits[0]);
       }
})();