Far scollrare la Title Bar del browser in stile WinAmp

22 Maggio 2008

Per l’angolo del cazzeggio, ecco uno scriptino che simula il famoso effetto di WinAmp che fa scrollare il titolo della canzone nella titlebar e di conseguenza nella taskbar. Rispetto a winamp però questo script fa scrollare il testo desiderato anche nella tab! Utilissimo se usato con Greasemonkey e giochi come Travian

ScrollingTitleBar={
	title:'',
	title_current:'',
	play:true,
	spaces:50,
	updateEvery:100,
	update:function(){
		var s=this.title_current;
		document.title=s.replace(/ /g,String.fromCharCode(160));
		this.title_current=s.substring(1,s.length)+s.substring(0,1)
		if(ScrollingTitleBar.play)setTimeout("ScrollingTitleBar.update()",ScrollingTitleBar.updateEvery);
	},
	start:function(q){
		ScrollingTitleBar.title=q;
		ScrollingTitleBar.title_current=q;
		for(var i=0;i<ScrollingTitleBar.spaces;i++)ScrollingTitleBar.title_current=" "+ScrollingTitleBar.title_current;
		ScrollingTitleBar.play=true;
		ScrollingTitleBar.update();
	},
	stop:function(q){
		ScrollingTitleBar.title_current=ScrollingTitleBar.title;
		ScrollingTitleBar.play=false;
	}
}

ScrollingTitleBar.start("Arctic Monkeys - A view from the afternoon");

Entry Filed under: JavaScript. .

Leave a Comment

Required

Required, hidden

Some HTML allowed:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <pre> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Trackback this post  |  Subscribe to the comments via RSS Feed


Mephit

Mephit logo
PHP project for D&D players www.mephit.it

Documentazione

Motori di ricerca

Utility

Categorie

Meta

Archivi