adding a search button to google
|
|
I have a search engine i'm using, and wondered if it is possible to just add a button next to the google search button, so it'll send queries to my search engine instead to google? Example:
the idea is to send to any search engine the query, so anyone can actually choose where to search, google or somewhere else. The reason i want this, even though i do have the option to change search engines in the search bar in firefox, is so i don't need to start choosing where to search each time, just choose a button and click it. let me know if someone can do this, or help out |
|
|
That's very well possible.
|
|
|
well, i want to be able to add them myself, just need a template, but i can give an example for one i suppose:
|
|
|
i made this :)
// ==UserScript==
// @name OtherSearchEngine
// @namespace [...]
// @description Adds button "Search in [your search engine]" to main Google page.
// @include http://www.google.*/
// @include http://google.*/
// ==/UserScript==
var searchengine = "MySearchSite";
var searchstring = "http://www.mysearchsite.com/search?search=";
var luckyButton = document.getElementsByName("btnI")[0];
var newbutton = document.createElement("input");
newbutton.setAttribute("type","button");
newbutton.setAttribute("value","Search in "+searchengine);
newbutton.setAttribute("onclick","document.location = \""+searchstring+"\"+escape(document.getElementsByName(\"q\")[0].value);");
luckyButton.parentNode.appendChild(newbutton);
//alert(luckyButton.parentNode.innerHTML);
in variable searchengine you set your search engine name, and in searchstring you set search string.
see ya.
|
