-
Notifications
You must be signed in to change notification settings - Fork 0
/
enot.js
23 lines (23 loc) · 11 KB
/
enot.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
(function(){function fa(a,b){if(a)for(var c=z.parse(a+""),d=c[0].split(/\s*,\s*/),e=0;e<d.length;e++)b(z.stringify(d[e],c),e)}function ga(a,b){var c=this===window?document:this;return"string"==typeof a?b?ha.call(c.querySelectorAll(a),0):c.querySelector(a):a instanceof Node||a===window||!a.length?b?[a]:a:ha.call(a,0)}function t(a,b,c){a=A.get(a);if(!b)return a||{};if(!a||!a[b])return[];b=a[b];c&&c.length&&(b=b.filter(function(a){return ia(a,c)}));return b}function ia(a,b){if(a.b)for(var c=b.length;c--;)if(a.b.indexOf(0<=
b[c]))return!0}function p(a,b,c){if(!a)return a;var d=a.on||a.addEventListener||a.addListener;b.split(/\s+/).forEach(function(b){var f=b.split(".");b=f.shift();if(d)if(ja.freeze(a,"on"+b))d.call(a,b,c),ja.a(a,"on"+b);else return a;Ca.add(a,b,c,f)});return a}function L(a,b,c,d){return Da(a,b,L.wrap(a,b,c,d))}function r(a,b,c){if(!a)return a;var d;if(void 0===c){var e=Ea(arguments,1),f=a.removeAll||a.removeAllListeners;f&&f.apply(a,e);if(b)b.split(/\s+/).forEach(function(b){var c=b.split(".");b=c.shift();
d=M(a,b,c);for(c=d.length;c--;)r(a,b,d[c])});else for(b in d=M(a),d)r(a,b);return a}var q=a.off||a.removeEventListener||a.removeListener;b.split(/\s+/).forEach(function(b){var d=b.split(".");b=d.shift();if(q)if(ka.freeze(a,"off"+b))q.call(a,b,c),ka.a(a,"off"+b);else return a;M.remove(a,b,c,d)});return a}function la(a,b,c,d){var e,f=b;Fa(a)||a===Ga?("undefined"!==typeof Event&&b instanceof Event?f=b:(f=Ha.createEvent("CustomEvent"),f.initCustomEvent(b,d,!0,c)),e=a.dispatchEvent):N&&a instanceof N?
(f=N.Event(b,c),f.detail=c,e=d?targte.trigger:a.triggerHandler):e=a.emit||a.trigger||a.fire||a.dispatchEvent||a.raise;var q=O(arguments,2);if(e&&ma.freeze(a,"emit"+b))return e.apply(a,[f].concat(q)),ma.a(a,"emit"+b),a;e=Ia(a,f);e=O(e);for(f=0;f<e.length;f++)e[f]&&e[f].apply(a,q);return a}function P(a,b,c,d){return na(a,b,P.wrap(a,b,c,d))}function B(a,b,c){if(a){var d=a.once||a.one||a.addOnceEventListener||a.addOnceListener,e;e=B.wrap(a,b,c,Ja);b.split(/\s+/).forEach(function(b){if(d&&oa.freeze(a,
"one"+b)){var q=d.call(a,b,c);oa.a(a,"one"+b);return q}Ka(a,b,e)});return e}}function Q(a,b,c,d){return pa(a,b,Q.wrap(a,b,c,d))}function R(a,b,c,d){return qa(a,b,R.wrap(a,b,c,d))}function S(a,b,c,d){return ra(a,b,S.wrap(a,b,c,d))}function sa(a){if(a){for(var b in s)a[b]=s[b];return a}}function D(a){return function(){a.apply(this,[this].concat(La(arguments)));return this}}function ta(a,b){if(!b)return v(a)?a:[a];if(a===window)a===[T];else if(!Ma(a)&&!v(a))return[a];b=ua(a,b);var c,d,e=E.parse(b);if(c=
/:(parent|closest|next|prev|root)(?:\\([0-9]+))?/.exec(e[0])){d=c[1];var f=c.index,q=E.stringify(e[c[2]],e);c=c[0];f&&(a=va(a,E.stringify(e[0].slice(0,f),e)));d=U(a,V[d],q);if(!d)return null;if(v(d)&&!d.length)return d;e=E.stringify(e[0].slice(f+c.length).trim(),e);e=ua(d,e);d=ta(d,e)}else d=va(a,b);return d}function va(a,b){return v(a)?U(a,function(a,b){return ga.call(a,b,!0)},b):ga.call(a,b,!0)}function U(a,b,c){var d=[];v(a)||(a=[a]);for(var e=a.length,f;e--;)(f=a[e])&&(f=b(f,c))&&(d=[].concat(f,
d));return d}function ua(a,b){if(!Na(b))return b;b=b.trim();if(!wa){if(":scope"===b.slice(0,6))b=b.slice(6);else if(">"!==b[0])return b;var c=(1E9*Math.random()>>>0)+Oa++;U(a,function(a,b){a.setAttribute("data-__qr",b);return a},c);b='[data-__qr="'+c+'"]'+b}else if(">"===b[0])return":scope "+b;return b}function m(a){if(!a)return a;for(var b in w)a[b]=w[b];return a}function F(a,b){var c=b[0],d=b[1];Pa(d)||W(c)?(c=null,d=b[0],b=C(b,0)):b=C(b,1);if(d)if(b=C(b,1),d&&"object"===typeof d&&d.constructor===
Object)for(var e in d)fa(e,function(b){F(a,[c,b].concat(d[b]))});else W(d)?fa(d,function(d){var e=G(d),g;g=c;e=e[0];g||(g=[document]);g=e?"window"===e?[window]:"document"===e?[document]:Qa(g,e,!0):Ra(g)?g:[g];for(var e=0,h=g.length;e<h;e++)a.apply(g[e],[g[e],d].concat(b))}):a.apply(c,[c,d].concat(b))}function G(a){var b=["",""],c=a.match(/[\w\.\:\$\-]+(?:\:[\w\.\:\-\$]+(?:\(.+\))?)*$/)[0];b[0]=a.slice(0,-c.length).trim();a="on"===c.slice(0,2)?H(c.slice(2)):c;b[1]=a;return b}function Sa(a,b,c){if(c){var d=
c,e=xa.parse(b);b=e[0].split(":");var f=b.shift();b.sort(function(a,b){return"once"===a||"one"===a?-1:"once"===b||"one"===b?1:0}).forEach(function(b){var g=b.split("\\");b=g[0];(g=xa.stringify(e[g[1]],e))||(g=function(a,b,d){X(a,b,d);X(a,b,c)});l[b]&&(d=l[b](a,f,d,g))});return d}}window.Emitter=m;var k,u,Y,I,H,x,y,ya,n,h,z,Z,J,aa;k=function(a){return"undefined"!==typeof document&&a instanceof Node};u=function(a){return!(!a||!a.apply)};Y=function(a){return a instanceof Array};var A=new WeakMap;t.remove=
function(a,b,c,d){a=A.get(a);if(!a||!a[b])return!1;b=a[b];if(d&&d.length&&!ia(c,d))return!1;for(d=0;d<b.length;d++)if(b[d]===c||b[d].fn===c){b.splice(d,1);break}};t.add=function(a,b,c,d){c&&(A.has(a)||A.set(a,{}),a=A.get(a),(a[b]=a[b]||[]).push(c),d&&d.length&&(c.b=d))};I=function(a,b){if(a.contains)return a.contains(b);var c=a.compareDocumentPosition(b);return 0===c||c&16};H=function(a){return(a+"").toLowerCase()};H=function(a){return a.toLowerCase()};"use strict";h=Element.prototype;var za=h.matches||
h.matchesSelector||h.webkitMatchesSelector||h.mozMatchesSelector||h.msMatchesSelector||h.c;x=function(a,b){if(za)return za.call(a,b);for(var c=a.parentNode.querySelectorAll(b),d=0;d<c.length;d++)if(c[d]==a)return!0;return!1};y=function(a){return"string"===typeof a||a instanceof String};(function(a){function b(a){for(var b=[],c=0;c<a.length;c++)-1===b.indexOf(a[c])&&b.push(a[c]);return b}function c(a){var b=new Set;return a.filter(function(a){if(!b.has(a))return b.add(a),!0})}function d(a){var b=[];
(new Set(a)).forEach(function(a){b.push(a)});return b}function e(){var a=!1;(new Set([!0])).forEach(function(b){a=b});return a}ya="Set"in a?"function"===typeof Set.prototype.forEach&&e()?d:c:b}).call(this,"undefined"!==typeof global?global:"undefined"!==typeof self?self:"undefined"!==typeof window?window:{});var ha=[].slice;n={freeze:function(a,b){var c=K.get(a);if(c&&c[b])return!1;c||(c={},K.set(a,c));return c[b]=!0},a:function(a,b){var c=K.get(a);if(!c||!c[b])return!1;c[b]=null;return!0},isFrozen:function(a,
b){var c=K.get(a);return c&&c[b]}};var K=new WeakMap;h=h=function(a,b,c){var d=[],e=a.length;if(0===e)return d;b=0>b?Math.max(0,b+e):b||0;for(void 0!==c&&(e=0>c?c+e:c);e-- >b;)d[e-b]=a[e];return d};var ja=n,Ca=t;p.wrap=function(a,b,c,d){function e(){if(d.apply(a,arguments))return c.apply(a,arguments)}e.fn=c;return e};z={parse:function(a,b){function c(a){return"\\"+d.push(a.slice(1,-1))}if("string"!==typeof a)return[a];var d=[],e;b=b||"()";for(var f=new RegExp(["\\",b[0],"[^\\",b[0],"\\",b[1],"]*\\",
b[1]].join(""));a!=e;)e=a,a=a.replace(f,c);d.unshift(a);return d},stringify:function(a,b,c){function d(a){return c[0]+b[a.slice(1)]+c[1]}var e;if(!a)return"";"string"!==typeof a&&(c=b,b=a,a=b[0]);for(c=c||"()";a!=e;)e=a,a=a.replace(/\\[0-9]+/,d);return a}};Z=function(a){return Y(a)||a&&!y(a)&&!a.nodeType&&("undefined"!=typeof window?a!=window:!0)&&!u(a)&&"number"===typeof a.length};var ba=document,Ta=ba.documentElement;J=function(a,b){if(!k(a))throw Error("Bad argument "+a);if(a===ba)return Ta;if(!b||
(k(b)?a==b:x(a,b)))return a;for(;(a=a.parentNode)&&a!==ba;)if(!b||(k(b)?a==b:x(a,b)))return a};var ca=document,Ua=ca.documentElement,Da=p;L.wrap=function(a,b,c,d){function e(){var a=arguments,b=this;setTimeout(function(){c.apply(b,a)},d)}u(d)&&(a=d,d=c,c=a);e.fn=c;return e};var ka=n,Ea=h,M=t,ma=n,O=h,Fa=k,Ia=t;aa=function(a,b){if(a){var c=arguments;if(y(b))c=O(arguments,2),b.split(/\s+/).forEach(function(b){b=b.split(".")[0];la.apply(this,[a,b].concat(c))});else return la.apply(this,c)}};var N="undefined"===
typeof jQuery?void 0:jQuery,Ha="undefined"===typeof document?void 0:document,Ga="undefined"===typeof window?void 0:window,Va={"\u2325":18,alt:18,option:18,backspace:8,capslock:20,caps:20,clear:12,context:93,"\u2318":91,cmd:91,command:91,"\u2303":17,ctrl:17,control:17,del:46,"delete":46,down:40,end:35,"\u2386":13,enter:13,"return":13,esc:27,escape:27,home:36,insert:45,left:37,pagedown:34,"pg-down":34,pageup:33,"pg-up":33,pause:19,right:39,"\u21e7":16,shift:16,space:32,tab:9,up:38,F1:112,F2:113,F3:114,
F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123,leftmouse:1,rightmouse:3,middlemouse:2,"*":106,"+":107,plus:107,"-":109,minus:109,";":186,semicolon:186,"=":187,equals:187,",":188,dash:189,".":190,"/":191,"`":192,"~":192,"[":219,"\\":220,"]":221,"'":222},Wa=H,na=p;P.wrap=function(a,b,c,d){if(d)return d=Y(d)?d:y(d)?d.split(/\s*,\s*/):[d],d=d.map(Wa),na.wrap(a,b,c,function(a){for(var b=void 0!==a.which?a.which:a.keyCode,c=d.length;c--;)if(a=d[c],b==a||Va[a]==b)return!0})};var oa=n,
Ka=p,Ja=r;B.wrap=function(a,b,c,d){function e(){d(a,b,e);c.apply(a,arguments)}e.fn=c;return e};var pa=p,Aa="undefined"!==typeof document?J:null;Q.wrap=function(a,b,c,d){if(Aa){if(u(d)){var e=d;d=c;c=e}return pa.wrap(a,b,c,function(b){b=b.target;return I(a,b)?(b=Aa(b,d))&&I(a,b)?!1:!0:!1})}};var qa=p;R.wrap=function(a,b,c,d){function e(){c.apply(a,arguments);r(a,b,e);setTimeout(function(){qa(a,b,e)},d)}if(u(d)){var f=d;d=c;c=f}e.fn=c;return e};var ra=p,Ba="undefined"!==typeof document?J:null;S.wrap=
function(a,b,c,d){if(Ba){if(u(d)){var e=d;d=c;c=e}return ra.wrap(a,b,c,function(b){var c=b.target;if(c!==a&&(c=Ba(c,d))&&a!==c&&I(a,c))return b.delegateTarget=c,!0})}};var Xa=document.documentElement;n={closest:J,parent:function(a,b){if(!k(a))throw Error("Bad argument "+a);if(a===ca)return Ua;for(;(a=a.parentNode)&&a!==ca;)if(!b||(k(b)?a==b:x(a,b)))return a},prev:function(a,b){if(!k(a))throw Error("Bad argument "+a);for(;a=a.previousSibling;)if(1===a.nodeType&&(!b||(k(b)?a===b:x(a,b))))return a},
next:function(a,b){if(!k(a))throw Error("Bad argument "+a);for(;a=a.nextSibling;)if(1===a.nodeType&&(!b||(k(b)?a===b:x(a,b))))return a},root:function(){return Xa}};var La=h,s=sa.prototype;s.on=D(p);s.once=D(B);s.off=D(r);s.emit=D(aa);s.listeners=function(a){return t(this,a)};s.hasListeners=function(a){return!!t(this,a).length};var T=document,V=n,v=Z,Na=y,Ma=k,E=z,Ya=ya,wa=!0;try{T.querySelector(":scope")}catch(bb){wa=!1}n=function(a,b,c){"string"===typeof a&&(c=b,b=a,a=T);if(!a)return c?[]:null;a=
ta(a,b);return!c&&v(a)?a[0]:Ya(a)};var Oa=Date.now()%1E9,da;for(da in V)n[da]=V[da];var C=h,Pa=u,W=y,Ra=Z,Qa=n,xa=z,w=m.prototype=Object.create(sa.prototype);w.on=function(a,b,c){Za(this,a,b,c);return this};w.once=function(a,b,c){$a(this,a,b,c);return this};w.off=function(a,b){r(this,a,b);X(this,a,b);return this};w.emit=function(){ab.apply(this,[this].concat(C(arguments)));return this};var ea=new WeakMap,Za=m.on=function(){F(function(a,b,c){if(c){var d=G(b);b=d[1].split(":")[0];var d=Sa(a,d[1],c),
e;(e=ea.get(c))||ea.set(c,e={});(e[b]||(e[b]=[])).push(d);p(a,b,d)}},arguments);return m},X=m.off=function(){F(function(a,b,c){b=G(b)[1].split(":")[0];if(c){if(c=ea.get(c))if(c=c[b])for(var d=c.length;d--;)r(a,b,c[d])}else r(a,b,c)},arguments);return m},ab=m.emit=function(){F(function(a,b){W(b)&&(b=G(b)[1].split(":")[0]);aa.apply(a,[a,b].concat(C(arguments,2)))},arguments);return m},$a=m.once=function(){B.apply(this,arguments);return m},l={};l.on=l.delegate=S.wrap;l.not=Q.wrap;l.pass=l.keypass=P.wrap;
l.one=l.once=B.wrap;l.throttle=R.wrap;l.later=L.wrap})();