JS Anti klik


/* ============================= ===== no click ===== script by Gerard Ferrandez - ge1doot - April 28, 2007 ========================= */ var xm = 0; var ym = 0; document.onmousemove = function(e){ if (window.event) e=window.event; xm = e.clientX; ym = e.clientY; } var noclick = { O : [], run : function() { for (var i = 0, o; o = noclick.O[i]; i++) o.anim(); }, resize : function() { for (var i = 0, o; o = noclick.O[i]; i++) o.resize(); }, init : function(){ for (var i = 0, o; o = document.body.getElementsByTagName("*")[i]; i++){ if (o.className.indexOf('noclick') >= 0) { o.l0 = o.style.left; o.t0 = o.style.top; o.resize = function() { this.style.left = this.l0; this.style.top = this.t0; for (var nx = 0, ny = 0, o = this.offsetParent; o != null; o = o.offsetParent) nx += o.offsetLeft, ny += o.offsetTop; this.x0 = nx; this.y0 = ny; this.ox = this.offsetLeft; this.oy = this.offsetTop; this.rx = (this.style.position == 'absolute') ? 0 : this.ox; this.ry = (this.style.position == 'absolute') ? 0 : this.oy; this.px = this.ox; this.py = this.oy; this.nw = this.offsetWidth / 2; this.nh = this.offsetHeight / 2; this.dp = Math.max(this.offsetWidth, this.offsetHeight); } o.anim = function() { var xmm = xm - this.x0 - this.nw; var ymm = ym - this.y0 - this.nh; var dx = xmm - this.px; var dy = ymm - this.py; var d = Math.sqrt(dx * dx + dy * dy); this.px += ((this.ox - this.px) * .2); this.py += ((this.oy - this.py) * .2); if(d < this.dp && d > 0 ){ this.px = xmm - (this.dp * (xmm - this.px) / d); this.py = ymm - (this.dp * (ymm - this.py) / d); } this.style.left = Math.round(this.px - this.rx) + 'px'; this.style.top = Math.round(this.py - this.ry) + 'px'; } o.resize(); this.O.push(o); } } setInterval(noclick.run, 16); } } onload = function () { noclick.init(); } function resize() { noclick.resize(); } onresize = resize;

Tidak ada komentar:

Posting Komentar