From 9b8bb14ccd4773e84c112d659560c87b8bdc6d48 Mon Sep 17 00:00:00 2001 From: kris Date: Thu, 10 Oct 2013 22:55:42 +0200 Subject: [PATCH] update fokus.min.js --- js/fokus.min.js | 28 +++++++--------------------- 1 file changed, 7 insertions(+), 21 deletions(-) diff --git a/js/fokus.min.js b/js/fokus.min.js index f008325..b54cf20 100644 --- a/js/fokus.min.js +++ b/js/fokus.min.js @@ -5,24 +5,10 @@ * * Copyright (C) 2012 Hakim El Hattab, http://hakim.se */ -(function(){var f=5;var r=0.75; -var w,v,t=0,o,b={left:0,top:0,right:0,bottom:0},h={left:0,top:0,right:0,bottom:0};function c(){if(k()&&!window.__fokused){window.__fokused=true;w=document.createElement("canvas"); -v=w.getContext("2d");w.style.position="fixed";w.style.left=0;w.style.top=0;w.style.zIndex=2147483647;w.style.pointerEvents="none";document.addEventListener("mousedown",m,false); -document.addEventListener("keyup",d,false);document.addEventListener("scroll",l,false);document.addEventListener("DOMMouseScroll",l,false);window.addEventListener("resize",e,false); -e();}}function k(){return !!("addEventListener" in document&&"pointerEvents" in document.body.style);}function s(){var x=u();v.clearRect(0,0,w.width,w.height); -v.fillStyle="rgba( 0, 0, 0, "+t+" )";v.fillRect(0,0,w.width,w.height);if(x){if(t<0.1){h=b;}else{h.left+=(b.left-h.left)*0.18;h.top+=(b.top-h.top)*0.18; -h.right+=(b.right-h.right)*0.18;h.bottom+=(b.bottom-h.bottom)*0.18;}}v.clearRect(h.left-window.scrollX-f,h.top-window.scrollY-f,(h.right-h.left)+(f*2),(h.bottom-h.top)+(f*2)); -if(x){t+=(r-t)*0.08;}else{t=Math.max((t*0.85)-0.02,0);}cancelAnimationFrame(o);if(x||t>0){if(!w.parentNode){document.body.appendChild(w);}o=requestAnimationFrame(s); -}else{document.body.removeChild(w);}}function q(A){b={left:Number.MAX_VALUE,top:Number.MAX_VALUE,right:0,bottom:0};var z=n();for(var C=0,F=z.length;C0||D>0)&&!B.nodeName.match(/^br$/gi)){b.left=Math.min(b.left,H); -b.top=Math.min(b.top,G);b.right=Math.max(b.right,H+I);b.bottom=Math.max(b.bottom,G+D);}}if(A){h=b;}if(u()){s();}}function u(){return b.leftd?b=h:(b.left+=0.18*(h.left-b.left),b.top+=0.18*(h.top-b.top),b.right+=0.18*(h.right-b.right),b.bottom+=0.18*(h.bottom-b.bottom)));l.clearRect(b.left-window.scrollX-q,b.top-window.scrollY-q,b.right-b.left+2*q,b.bottom-b.top+2*q);d=m?d+0.08*(B-d):Math.max(0.85*d-0.02,0);cancelAnimationFrame(v);m||0