[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [OT] Something about google search



Thanks for all.

1] I installed the greasymonkey.

2] I download the  Add Links to Google Bar form
http://userscripts.org/scripts/review/115780

3]  : I don't know how to set the mail.google.com to the host of
www.google.com, changed  (document.location.host == "www.google.com"
not work)

~/.mozilla/firefox/fs7z3prz.default/gm_scripts/Add_Links_to_Google_Bar$
more 115780.user.js

// ==UserScript==
// @name          Add Links to Google Bar
// @version       1.0
// @namespace     http://nitinjain.info
// @description	  Adds new links to the Google Bar
// @license       GPL v2
// @include       https://*.google.com/*
// @include       http://*.google.com/*
// @include       http://*.google.com.*

// ==/UserScript==
var docment=null;
if (document.location.host == "mail.google.com")
	docment = document.getElementById('canvas_frame').contentDocument;
else
	docment = document;
var googlebar = docment.getElementById('gbz').getElementsByClassName('gbtc')[0]
;
var newLinks =[];

// Add your links here..
//newLinks.push({name: 'Facebook', href: 'http://www.facebook.com'});
//newLinks.push({name: 'Yahoo', href: 'http://www.yahoo.com'});
//newLinks.push({name: 'Bing', href: 'http://www.bing.com'});

newLinks.push({name: 'Scholar', href: 'http://scholar.google.com.sg/schhp?hl=en
'})

// Finish your custom links..

for (var i = 0; i < newLinks.length; i++) {
	var newli = document.createElement('li');
	newli.setAttribute('class', 'gbt');
	googlebar.appendChild(newli);
	var newlink = document.createElement('a');
	newlink.setAttribute('href', newLinks[i].href);
	newlink.setAttribute('class', 'gbzt');
	newli.appendChild(newlink);
	var span1 = document.createElement('span');
	span1.setAttribute('class', 'gbtb2');
	newlink.appendChild(span1);
	var textlink = document.createElement('span');
	textlink.setAttribute('class', 'gbts');
	textlink.innerHTML = newLinks[i].name;
	newlink.appendChild(textlink);

}

Thanks again,

Best regards,


Reply to: