Google

Subscribe to Google 9 posts, 4 voices

 
stojshic Scriptwright

Can anyone please go to http://www.google.cn/webhp?hl=zh-CN. Do you see that cool icons (below searchbar). Is it possible to write a script that will do something like that? It would be really great script...

 
znerp Scriptwright

FYI, I recall someone asking a similar question before, but it looks like nothing ever came of that.

 
Mikado Scriptwright

Absolutely useless, I hope they have preference to disable these. Although I like that Google used background and javascript instead of flash crap.

 
stojshic Scriptwright

@znerp, thanks for linking that post, I didn't saw it because I searched for Chinese version, I didn't know that there is Korean version, too.
@Mikado Why do you think it's useless? It's much easier to navigate with these icons then with text in US version. And it looks much prettier... I think it's absolutely usable if you use few google apps (notepad, reader, gmail....)

 
Mikado Scriptwright

Specially for 12yo girls...

var FRAMEDELAY = 50,
	names = ['Gmail', 'Calendar', 'Toolbar', 'Desktop', 'Picasa', 'YouTube', 'Notebook'],
	urls = ['http://mail.google.com/', 'http://www.google.com/calendar', 'http://toolbar.google.com/', 'http://desktop.google.com/', 'http://picasa.google.com/', 'http://youtube.com/', 'http://www.google.com/notebook'];

var place = document.getElementsByTagName('center')[0].insertBefore(document.createElement('div'), document.forms[0].nextSibling);
place.innerHTML = '<table style="font-size:13px"><tr valign="bottom" align="center"></tr></table>';
place = place.firstChild.rows[0];

for (var i = 0; i < 7; i++) {
	new icon(names[i], urls[i], i);
}

GM_addStyle('.GM_stupidicon{width:52px;height:37px;background:#fff url(http://img519.imageshack.us/img519/6129/svcspriteallqf5.gif) no-repeat scroll 0 0}\
			.GM_blocklink{display:block;margin:0 6px 0 6px}');

function icon(name, url, index) {
	this.name = name;
	this.url = url;
	this.x = 0;
	this.y = 'px ' + index * -37 + 'px';
	this.moving = false;
	with (place.insertCell(-1)) {
		innerHTML = '<a href="' + url + '" class="GM_blocklink"><div class="GM_stupidicon"></div>' + name + '</a>';
		firstChild.addEventListener('mouseover', animstart(this), true);
		firstChild.addEventListener('mouseout', animend(this), true);
		this.obj = firstChild.firstChild;
	}
	this.obj.style.backgroundPosition = '0' + this.y;
}

function animstart(ico) {
	return function(e) {
		if (ico.moving) clearInterval(ico.moving);
		ico.moving = setInterval(movebg, FRAMEDELAY, ico, 1);
	}
}

function animend(ico) {
	return function(e) {
		if (ico.moving) clearInterval(ico.moving);
		ico.moving = setInterval(movebg, FRAMEDELAY, ico, -1);
	}
}

function movebg(ico, dir) {
	if ((dir == 1 && ico.x == 6) || (dir == -1 && ico.x == 0)) { clearTimeout(ico.moving); return; }
	ico.x += dir;
	ico.obj.style.backgroundPosition = -ico.x * 52 + ico.y;
}
 
znerp Scriptwright

TBH, I quite like this. It's something I'll never use, kinda like the "I'm Feeling Lucky" button or my appendix, but it's cool to know it's there.

 
barryoni User

Hi Mikado,
I tried to put your script and it's show up but with none of the cool icons effect.
what do I miss here?

Thanks.

 
znerp Scriptwright

barryoni, copy Mikado's code into notepad and add the following code at the top...

// ==UserScript==
// @name           Google Icons
// @include        http://www.google.com/
// ==/UserScript==
Then save this on your desktop as googleicons.user.js. Then simply drag this file onto firefox (or select 'File' -> 'Open File' and select the file. You should then be prompted to install the script and you're done!

 
barryoni User

Hi znerp, Thank you very much! (-:
Bless you God!