User:Schäuble/monobook.js

/********************************** * Watching Script v1.1          * * by KnoedelDealer   2007/05/01 * *                               * *  no copyright, free usage      * **********************************/

var h = -150; var h2 = 1; var l = 100; var ie = (navigator.appName.indexOf('Internet Explorer') > -1) ? true : false;

function watching { var body = document.getElementsByTagName('body')[0]; l = (body.offsetWidth - 140) * Math.random; var img = document.createElement('img'); img.id = 'imgWatching'; img.src = 'http://s23.org/w/images/1/1a/Schaueble-head.gif'; img.title = 'i\'m watching you!'; img.style.display = 'none'; body.appendChild(img); if (ie) { img.style.position = 'absolute'; } else { img.style.position = 'fixed'; }  img.style.bottom = h + 'px'; img.style.left = l + 'px'; h2 = Math.random / 3; window.setTimeout('moveUp;', 1000); }

function moveUp { if (document.getElementById('imgWatching')) { var img = document.getElementById('imgWatching'); if (img.style.display == 'none') { img.style.display = 'inline'; }     if (h < (0 - img.height * h2)) { h = h + 10; img.style.bottom = h + 'px'; window.setTimeout('moveUp;', 50); } else { window.setTimeout('moveDown;', 1000); }  } }

function moveDown { if (document.getElementById('imgWatching') && (document.getElementsByTagName('body').length > 0)) { var body = document.getElementsByTagName('body')[0]; var img = document.getElementById('imgWatching'); if (h > (0 - img.height)) { h = h - 10; img.style.bottom = h + 'px'; window.setTimeout('moveDown;', 50); } else { img.style.display = 'none'; l = (body.offsetWidth - 140) * Math.random; img.style.left = l + 'px'; h2 = Math.random / 3; window.setTimeout('moveUp;', 5000 * Math.random); }  } }

window.onload = watching;