forked from DecibelInsight/insertionQuery
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinsQ.min.js
More file actions
4 lines (4 loc) · 1.92 KB
/
insQ.min.js
File metadata and controls
4 lines (4 loc) · 1.92 KB
1
2
3
4
// insertionQuery v0.2.1 (2013-11-23)
// license:MIT
// naugtur <naugtur@gmail.com> (http://naugtur.pl/)
var insertionQ=function(){"use strict";function a(a,b){var d,e="insQ_"+h++,f=function(a){(a.animationName===e||a[j]===e)&&(c(a.target)||b(a.target))};d=document.createElement("style"),d.innerHTML="@keyframes "+e+" { from { outline: 1px solid transparent } to { outline: 0px solid transparent } }\n@"+k+"keyframes "+e+" { from { outline: 1px solid transparent } to { outline: 0px solid transparent } }\n"+a+" { animation-duration: 0.001s; animation-name: "+e+"; "+k+"animation-duration: 0.001s; "+k+"animation-name: "+e+"; } ",document.head.appendChild(d);var g=setTimeout(function(){document.addEventListener("animationstart",f,!1),document.addEventListener("MSAnimationStart",f,!1),document.addEventListener("webkitAnimationStart",f,!1)},20);return{destroy:function(){clearTimeout(g),d&&(document.head.removeChild(d),d=null),document.removeEventListener("animationstart",f),document.removeEventListener("MSAnimationStart",f),document.removeEventListener("webkitAnimationStart",f)}}}function b(a){a["-+-"]=!0}function c(a){return g&&a["-+-"]===!0}function d(a){return c(a.parentNode)?a:d(a.parentNode)}function e(a){for(b(a),a=a.firstChild;a;a=a.nextSibling)void 0!==a&&1===a.nodeType&&e(a)}function f(f,g){var h=[],i=function(){var a;return function(){clearTimeout(a),a=setTimeout(function(){h.forEach(e),g(h),h=[]},10)}}();return a(f,function(a){if(!c(a)){b(a);var e=d(a);h.indexOf(e)<0&&h.push(e),i()}})}var g,h=100,i=!1,j="animationName",k="",l="Webkit Moz O ms Khtml".split(" "),m="",n=document.createElement("div");if(n.style.animationName&&(i=!0),i===!1)for(var o=0;o<l.length;o++)if(void 0!==n.style[l[o]+"AnimationName"]){m=l[o],j=m+"AnimationName",k="-"+m.toLowerCase()+"-",i=!0;break}return function(b,c){return i&&b.match(/[^{}]/)?(g=c?!1:!0,g&&e(document.body),{every:function(c){return a(b,c)},summary:function(a){return f(b,a)}}):!1}}();