Stack Apps is a question and answer site for apps, scripts, and development with the Stack Exchange API. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Code

// ==UserScript==
// @name        StackExchange SymbolHound Search
// @description Uses SymbolHound instead of regular search if query begins with "sh:".
// @version     1.1
// @include     http://stackoverflow.com/*
// @include     http://*.stackoverflow.com/*
// @include     http://serverfault.com/*
// @include     http://*.serverfault.com/*
// @include     http://superuser.com/*
// @include     http://*.superuser.com/*
// @include     http://stackexchange.com/*
// @include     http://*.stackexchange.com/*
// @include     http://stackapps.com/*
// @include     http://*.stackapps.com/*
// @include     http://askubuntu.com/*
// @include     http://*.askubuntu.com/*
// @include     http://answers.onstartups.com/*
// @include     http://*.answers.onstartups.com/*
// ==/UserScript==

document.getElementById("search").addEventListener("submit", function(event){
    var q = document.getElementById("search")["q"].value;
    if (!RegExp("^sh:").test(q))
        return;
    event.preventDefault();
    document.location = "http://symbolhound.com/?q=" +
        encodeURIComponent(q.substr(3)) +
        "&l=&e=&n=&u=" +
        document.domain;    
});

About

Ever wanted to search for && on Stack Overflow but couldn't? SymbolHound makes it possible!

From their website:

SymbolHound is a new search engine that doesn't ignore special characters. This means you can easily search the web for symbols like &, %, and ^, or even less common characters such as ©, ¬, and µ.

See also: SymbolHound: Search Stack Overflow for special characters

With this User Script, you can override the built-in search with SymbolHound's.

Just begin type in your query as usual in the search in the upper right corner, but prefix it with sh:.

Examples:

  • sh:&&
  • sh:php <<<
  • sh:difference between == and ===

License

I hereby release this script in the public domain.

Platform

This user script has been tested in Google Chrome 17.0.963.6 and Mozilla Firefox 8.0 with Greasemonkey 0.9.13.

share|improve this question

You must log in to answer this question.

Browse other questions tagged .