Created
June 14, 2013 18:43
-
-
Save mallowlabs/5784239 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Google Multi Search | |
// @author mallowlabs | |
// @version 0.0.3 | |
// @namespace http://mallowlabs.s206.xrea.com/ | |
// @published 2007-01-11 | |
// @modified 2007-01-17 | |
// @license public domain | |
// @description : Add Blog and Code search option to Google search | |
// @include http://www.google.co*/ | |
// @include http://www.google.co*/webhp* | |
// ==/UserScript== | |
(function() { | |
var ginput = document.getElementsByTagName('input'); | |
var par; | |
for (var i = 0; i<ginput.length; i++){ | |
if(ginput[i].id == 'all') { | |
par = ginput[i].parentNode; | |
} | |
} | |
if (par!=null) { | |
par.innerHTML = par.innerHTML | |
+ "<input id='blog' type='radio' name='lr' value='lang_ja'>" | |
+ "<label for='blog' >" | |
+ decodeURI("%E3%83%96%E3%83%AD%E3%82%B0%E3%81%8B%E3%82%89%E6%A4%9C%E7%B4%A2") | |
+ "</label>" | |
+ "<input id='src' type='radio' name='lr' value='lang_ja'>" | |
+ "<label for='src' >" | |
+ decodeURI("%E3%82%BD%E3%83%BC%E3%82%B9%E3%82%B3%E3%83%BC%E3%83%89%E3%81%8B%E3%82%89%E6%A4%9C%E7%B4%A2") | |
+ "</label>"; | |
for (var i = 0; i < par.childNodes.length; i++ ){ | |
if(par.childNodes.item(i).tagName == 'INPUT') | |
switch (i/2){ | |
case 0:case 1: | |
par.childNodes.item(i).addEventListener('click', | |
function(e){ | |
var f = document.getElementsByTagName('form')[0]; | |
f.setAttribute('action', '/search'); | |
} | |
, false); | |
break; | |
case 2: | |
par.childNodes.item(i).addEventListener('click', | |
function(e){ | |
var f = document.getElementsByTagName('form')[0]; | |
f.setAttribute('action', 'http://blogsearch.google.com/'); | |
} | |
, false); | |
break; | |
case 3: | |
par.childNodes.item(i).addEventListener('click', | |
function(e){ | |
var f = document.getElementsByTagName('form')[0]; | |
f.setAttribute('action', 'http://www.google.com/codesearch'); | |
} | |
, false); | |
break; | |
} | |
} | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment