24 November 2008 - 11:15ABC Meme
From bsmedberg [benjamin.smedbergs.us].. but a little more automated.
1) In Firefox 3.1, copy the following block of code and paste it into the “Code:” line in the Error Console (cmd-shift-J) then hit enter:
C=Components;d=C.classes['@mozilla.org/browser/nav-history-service;1'].getService(C.interfaces.nsPIPlacesDatabase).DBConnection;for(o=[],c=97;c<123;c++){h=String.fromCharCode(c);q=d.createStatement('SELECT title t, url u FROM moz_inputhistory JOIN moz_places ON id=place_id WHERE input LIKE \''+h+'%\' ORDER BY use_count DESC LIMIT 1');if(q.step())o.push(['<b>',h,'</b>: <a href="',q.row.u,'">',q.row.t,'</a>'].join(''))}open('data:text/html,'+o.join('<br/>\n'))
2) View source to copy the generated html to put in your blog. (I’ve added emphasis for what I was trying to match.)
a: Amazon.com: Online Shopping for Electronics, Apparel, Computers, Books, DVDs & more
b: Bank of America | Home | Personal
c: Capital One Online Banking | Capital One Online Banking
d: Digg – All News, Videos, & Images
e: edilee
f: Firefox Builds • mozillaZine Forums
g: Video Game Cheats, Reviews, FAQs, Message Boards, and More – GameFAQs
h: Hulu – House
i: The Internet Movie Database (IMDb)
j: Joystiq
k: Kotaku, the Gamer’s Guide
l: The LLVMdev November 2008 Archive by thread
m: Mac Rumors: Apple Mac Rumors and News You Care About
n: Gaming Discussion – NeoGAF
o: OrderStatus
p: Planet Mozilla
q: PhD Qualifying Examination | University of Illinois at Urbana-Champaign
r: Google Reader
s: JavaScript Shell 1.4
t: tinderbox: Firefox
u: Gmail – Search results – edilee@gmail.com (unread)
v: Apple – Support – Discussions – New MacBook connected to external VGA …
w: Firefox3.1/StatusMeetings – MozillaWiki
x: xkcd – A Webcomic – Drapes
y: Bug 465076 – Yet another Ctrl+Tab / All Tabs design revision
z: Craig Zilles, Department of Computer Sciences
The pages listed here are those that I visit frequently, so it’s not the best way to see the word searching ability of the location bar; however, it’s interesting to see that all but one site matches on the title. It’s also neat to know that I only need to type a single letter and hit enter [addons.mozilla.org] to go to those sites. 🙂
7 Comments | Tags: Add-on, AwesomeBar, Mozilla
This is not the same as the method described by bsmedberg. With this technique I get different results for some letters. Also I get no results for i, k, o, v, y or z.
Right. The short piece of code I provided only uses the adaptive data, so the reason why you don’t get any results for some letters is that you haven’t used them.
Could you post the code that the awesome bar itself uses to get the first result for a typed letter so that it is an automated version of Benjamin’s steps?
[…] Ed Lee (aka Mardak) has an excellent code snippet for producing these lists right from the Error Console in Firefox 3.1. […]
Error: uncaught exception: [Exception… “Component returned failure code: 0x80570018 (NS_ERROR_XPC_BAD_IID) [nsIJSCID.getService]” nsresult: “0x80570018 (NS_ERROR_XPC_BAD_IID)” location: “JS frame :: javascript:%20C=Components;d=C.classes[‘@mozilla.org/browser/nav-history-service;1’].getService(C.interfaces.nsPIPlacesDatabase).DBConnection;for(o=[],c=97;c<123;c++){h=String.fromCharCode(c);q=d.createStatement(‘SELECT%20title%20t,%20url%20u%20FROM%20moz_inputhistory%20JOIN%20moz_places%20ON%20id=place_id%20WHERE%20input%20LIKE%20\”+h+’%25\’%20ORDER%20BY%20use_count%20DESC%20LIMIT%201’);if(q.step())o.push([‘‘,h,’:%20‘,q.row.t,’‘].join(”))}open(‘data:text/html,’+o.join(‘\n’)) :: :: line 1″ data: no]
Make sure you’re using Firefox 3.1 if you’re using that code in the Error Console.
[…] pages in his browser history. Hmm, sounds like a meme in the making! Mardak previous posted some code to do something like this… I’ve modified it to create a list of 10 random Wikipedia […]