martes, 11 de agosto de 2009

¿Quieres poner a Shin Chan paseando por tu web?


Powered by UploadFileSystem.COM
Powered by UploadFileSystem.COM
Powered by UploadFileSystem.COM
Powered by UploadFileSystem.COM
Powered by UploadFileSystem.COM
Powered by UploadFileSystem.COM
Powered by UploadFileSystem.COM
Powered by UploadFileSystem.COM
Powered by UploadFileSystem.COM
Powered by UploadFileSystem.COM
Powered by UploadFileSystem.COM
Powered by UploadFileSystem.COM

Simplemente pega este código en el BODY de tu página:

<div id='ss_myShinChanDiv'/>

y luego pega este código en la sección HEAD de tu página:
 
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/prototype/1.6.0.3/prototype.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/scriptaculous/1.8.2/scriptaculous.js"></script>

<script type="text/javascript">
/*ORIGINAL SCRIPT BY SERGIO VIUDES 2009*/

var ss_walking = false;
var ss_killShinChan = false;

function ss_scrollTop(){
return window.pageYOffset ? window.pageYOffset : Math.max(document.body.scrollTop,document.documentElement.scrollTop);
}

function ss_scrollLeft(){
return window.pageXOffset ? window.pageXOffset : Math.max(document.body.scrollLeft,document.documentElement.scrollLeft);
}

//Get window size
function ss_getWindowSize(w) {
var width, height;
w = w ? w : window;
this.width = w.innerWidth || (w.document.documentElement.clientWidth || w.document.body.clientWidth);
this.height = w.innerHeight || (w.document.documentElement.clientHeight || w.document.body.clientHeight);

return this;
}

//Set images
var ss_walkImages = new Array();
ss_walkImages.push("http://www.uploadfilesystem.com/thumbs/09/08/11/tn_wK108835.jpg");
ss_walkImages.push("http://www.uploadfilesystem.com/thumbs/09/08/11/tn_jDG09379.jpg");

var ss_images = new Array();
ss_images.push("http://www.uploadfilesystem.com/thumbs/09/08/11/tn_Lyo09054.jpg");
ss_images.push("http://www.uploadfilesystem.com/thumbs/09/08/11/tn_WAq09083.jpg");
ss_images.push("http://www.uploadfilesystem.com/thumbs/09/08/11/tn_oly09121.jpg");
ss_images.push("http://www.uploadfilesystem.com/thumbs/09/08/11/tn_5xz09150.jpg");
ss_images.push("http://www.uploadfilesystem.com/thumbs/09/08/11/tn_XSE09179.jpg");
ss_images.push("http://www.uploadfilesystem.com/thumbs/09/08/11/tn_XRc09256.jpg");
ss_images.push("http://www.uploadfilesystem.com/thumbs/09/08/11/tn_Vu109289.jpg");
ss_images.push("http://www.uploadfilesystem.com/thumbs/09/08/11/tn_yCQ09320.jpg");
ss_images.push("http://www.uploadfilesystem.com/thumbs/09/08/11/tn_qvx09343.jpg");
ss_images.push("http://www.uploadfilesystem.com/thumbs/09/08/11/tn_34H09410.jpg");

//Create img tag
var ss_myShinChanDiv = $('ss_myShinChanDiv');
ss_myShinChanDiv.style.position = 'absolute';
ss_myShinChanDiv.style.left = ss_myShinChanDiv.style.top = '0px';
ss_myShinChanDiv.style.cursor = 'pointer';
ss_myShinChanDiv.style.zIndex = '9999';
var ss_myShinChanImage = $(Builder.node("img", {id: "ss_myShinChanImage", onclick: "ss_killShinChan = confirm('Quieres quitar a Shin-Chan?'); if(ss_killShinChan) Effect.DropOut('ss_myShinChanDiv');", src: ss_getRandomImage(ss_images)}));

function ss_getRandomImage(imgArray){
return imgArray[parseInt(Math.random() * imgArray.length)];
}

function ss_getRandomPosition(){
var x,y;
var windowSize = ss_getWindowSize();
this.x = ss_scrollLeft() + parseInt(Math.random() * windowSize.width) - ss_myShinChanImage.offsetWidth;
this.y = ss_scrollTop() + parseInt(Math.random() * windowSize.height) - ss_myShinChanImage.offsetHeight;
if(0 > this.x) this.x = 0;
if(0 > this.y) this.y = 0;

return this;
}

function ss_animate(){
//Change walking status
ss_walking = !ss_walking;
//Set image
ss_myShinChanImage.src = ss_getRandomImage(ss_walking ? ss_walkImages : ss_images);
//If walking, shinchan must move around the page
if(ss_walking){
var randomPosition = ss_getRandomPosition();
new Effect.Move('ss_myShinChanDiv', { x: randomPosition.x, y: randomPosition.y, mode: 'absolute', duration:5 });
}

if(!ss_killShinChan)
setTimeout("ss_animate();", 5000);
}

document.observe('dom:loaded', function(){
//Append image tag
ss_myShinChanDiv.appendChild(ss_myShinChanImage);

//Start animation!!
setTimeout("ss_animate();", 5000);
});


</script>


No hay comentarios:

Publicar un comentario en la entrada