Form of googlevoice habré

In recent years, often looking for something on the website, and Google to me somehow familiar than the internal search engines of sites. Therefore, for cases when the internal search is not enough Habra, made a userjs that adds a little mold.

habragoogle

The script habragoogle.user.js.

UPD: vawerv made customized Yandex and googlemock in the style of Habra.
Script — habrahabr-with-yandex-n-google-search-forms.user.js.


Code first:
Copy Source | Copy HTML<br/>// ==UserScript==<br/>// @name Google search on habr.ru<br/>// @include http://habrahabr.ru/search/*<br/>// ==/UserScript==<br/> <br/>(function(){<br/>var cntn = document.getElementById("main-content");<br/> <br/>if(cntn) {<br/> var gsearch = document.createElement("div");<br/> gsearch.style.paddingLeft = "35px";<br/> gsearch.style.marginBottom = "30px";<br/> <br/> var elem = document.createElement("form");<br/> elem.action = "http://www.google.ru/search";<br/> var text = document.createElement("input");<br/> text.type = "text";<br/> text.name = "q";<br/> text.value = "";<br/> <br/> var ss = document.createElement("input");<br/> ss.type = "hidden";<br/> ss.name = "sitesearch";<br/> ss.value = "habrahabr.ru";<br/> <br/> var dmns = document.createElement("input");<br/> dmns.type = "hidden";<br/> dmns.name = "domains";<br/> dmns.value = "habrahabr.ru";<br/> <br/> var submit = document.createElement("input");<br/> submit.type = "submit";<br/> submit.name = "btnG";<br/> submit.value = "Google Search";<br/> <br/> elem.appendChild(text);<br/> elem.appendChild(ss);<br/> elem.appendChild(dmns);<br/> elem.appendChild(submit);<br/> <br/> gsearch.appendChild(elem)<br/> cntn.insertBefore(gsearch,cntn.firstChild);<br/>}})(); <br/>


UPD: Google and Yandex.
image

I don't know Javascript, the code was written intuitively. Works on Opera 10.10, how is it with other versions and browsers do not know.
Article based on information from habrahabr.ru

Комментарии

Популярные сообщения из этого блога

Vkontakte sync with address book for iPhone. How it was done

Automatically create Liquibase migrations for PostgreSQL

What part of the archived web