Kevin Basil (signature)

Hacking Chimera

Next article: Ranting Again
Previous article: The Fallacy of Pro vs. Am

Written by Basil on 09/12/2002 6:30 PM. Filed under:

Share with your friends and followers:

Chris is working on some hacks for Chimera. Hacking WebsiteDefaults.strings to use JavaScript in its URIs is quite cool. Since it’s basically the same idea as a bookmarklet, I tried improving on Chris’ hack by using the Google bookmarklet that Tim developed a few years ago. As expected it works like a charm in WebsiteDefaults.strings.

Here’s the code:

javascript:Qr=document.getSelection();if(!Qr){void(Qr=prompt('What do you want to search for on Google?',''))};

Use this for SearchPageDefault in WebsiteDefaults.strings. The advantages of this code are several.

  1. Since it’s JavaScript, it runs in the context of the current page. q is a relatively common variable name. Using Qr reduces the possibility that it might collide with a variable in the current page.
  2. Qr=document.getSelection(); allows you to select some text in the current page and access the search engine directly. No prompts, just go!
  3. By omitting client=googlet from the URI, it does not falsely bloat Google’s stats. To Google, this means that a specific client was used, which is false in this case.

Keep up the good work, Chris. Let us know when you actually have something to download. I’d love to see what you’ve got.

By the way, if you are not a Mac über-poweruser like Chris, you have to ctrl-click on the Chimera icon to get the context menu, then click on “Package Contents” to access this stuff.

Share with your friends and followers:


The URL to trackback this post is:

Comments are closed.