Utility Scripts for FireGestures
I wrote some scripts of internet search of words in clipboard for FireGestures.
FireGesture is a very useful addon to enable flexible mouse gestures on Firefox. It has a extension scheme with that user defined gestures and functions can be added. User functions should be written by Javascipt. A little before I downloaded a script named "open URL in clipboard", and I wrote some scripts from it.
- Web Search
- Wikipedia search
- Image Search
- Map Search
- Video Search
- Dictionary Search
Base script
Base scripts of those are identical as follows. The default behavier is open new tab to show the page. (It can be changed with some flags in the script.)
const IN_NEW_TAB = true;
const IN_BACKGROUND = true;
var str = readFromClipboard();
if (!str) return;
str = encodeURIComponent(str);
str = "http://www.google.co.jp/search?hl=ja&source=hp&q=" + str + "&aq=f&aqi=g10&aql=&oq=&gs_rfai=";
if (IN_NEW_TAB)
gBrowser.loadOneTab(str, null, null, null, IN_BACKGROUND, false);
else
gBrowser.loadURI(str);
And then replace the red line to other URL of search engine sites for each media. The followings are my setting living in Japan, so that URLs are Japanse sites. Please change them to fit your country environment.
- Web Search: Gesture: letter "G" (ULDRUL), URL ("http://www.google.co.jp/search?hl=ja&source=hp&q=" + str + "&aq=f&aqi=g10&aql=&oq=&gs_rfai=")
- Wikipedia search: Gesture: letter "W" (DUDU), URL("http://ja.wikipedia.org/w/index.php?search=" + str)
- Image Search: letter "GI" (ILDRULD), URL("http://images.google.co.jp/images?hl=ja&source=imghp&q=" + str + "&gbv=2&aq=f&aqi=g4&aql=&oq=&gs_rfai=")
- Map Search: letter "M" (UDUD), URL("http://maps.google.co.jp/maps?f=q&source=s_q&hl=ja&geocode=&q=" + str + "&ie=UTF8")
- Video Search: letter "Y"(DRUDLUR), URL("http://www.youtube.com/results?search_query=" + str)
- Dictionary: letter "D"(DRUL), URL("http://www.weblio.jp/content/" + str)