-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpika-min.js
5 lines (5 loc) · 12.6 KB
/
pika-min.js
1
2
3
4
5
/**
* @license PikaJS v3.2.3
* © 2021-2023 Scott Ogrin - MIT License
*/
var __$=window.$;window.Pika=function(t,e,s,r,o,a,f,u,c,h,l,p,d,v,m,y,g,x,b,T,w,S,C,E,J,R,H,L,A,N,k,D,O){return $=function(t,e){return new $.i(t,e)},$.extend=function(t){for(var e,i=1,n=arguments;i<n[g];i++)if(e=n[i])for(j in e)t[j]=e[j];return t},$.extend($,{Version:"3.2.3",Bubble:!1,Ajax:{url:o,type:"GET",data:o,processData:!0,responseType:o,contentType:"application/x-www-form-urlencoded; charset=UTF-8",headers:{"X-Requested-With":"XMLHttpRequest",Accept:"text/javascript, text/html, application/xml, text/xml, */*"},timeout:0,before:o,done:o,fail:o,always:o},Js:{},ajax:function(t){var e=o,i=o,s=o,r=$.Ajax,a="setRequestHeader";if(!t.url||!$.t(t.url,"s"))return!1;e=t.url,t.type?t.type=t.type.toUpperCase():t.type=r.type,t.data=t.data||r.data,t[l]=t[l]||r[l],t[p]=t[p]||r[p],t[d]=t[d]||r[d],t[v]=t[v]||r[v],t[m]=t[m]||b(r[m]),i=t.data,"GET"==t.type&&(t[l]=!0,t[d]=!1),i instanceof FormData&&"GET"!=t.type?(t[l]=!1,t[d]=!1):t[l]&&(i==o||$.t(i,"s")||(i=$.toS(i)));var f=new XMLHttpRequest;if("GET"==t.type&&i!=o&&""!=i&&(e=e+(/\?/.test(e)?"&":"?")+i),f.open(t.type,e),"GET"!=t.type&&!1!==t[d]&&f[a]("Content-Type",t[d]),t[v]!==o)for(n in t[v])f[a](n,t[v][n]);$.t(t.before,"f")&&t.before(),f.onreadystatechange=function(){if(4==f.readyState){var e=o,i=o,n=f.status,r=f.statusText;if(n>=200&&n<300||304==n){if(s&&clearTimeout(s),"text"===(i=f.responseType||"text")&&$.t(f.responseText,"s"))if("script"==t[p]){var a=f.responseText,u=$.R();a.match(/^<script[^>]*>/)==o&&(a="<script>"+a+"<\/script>"),$.H(a,u),e="",a=o,o,$.execJS(u)}else e=f.responseText;else e=f.response;$.t(t.done,"f")&&t.done(e,i,n,r)}else $.t(t.fail,"f")&&t.fail(e,i,n,r);$.t(t.always,"f")&&O((function(){t.always(e,i,n,r)}),1)}},t[m]>0&&(s=O((function(){f.abort()}),t[m])),"GET"==t.type||i==o?f.send():f.send(i)},cOff:function(t){var e=0,i=0;if(t[c])do{e+=t.offsetTop||0,i+=t.offsetLeft||0,t=t.offsetParent}while(t);return{top:e,left:i,x:i,y:e}},doToS:function(t,e,i){var n;if(Array.isArray(e))for(var s=0,r=e[g];s<r;s++)/\[\]$/.test(t)?i(t,e[s]):$.doToS(t+"["+($.t(e[s],"o")&&e[s]!=o?s:"")+"]",e[s],i);else if($.t(e,"o"))for(n in e)$.doToS(t+"["+n+"]",e[n],i);else i(t,e)},execJS:function(t){if(!$.t($.Js[t])){for(var e=0,i=$.Js[t].txt[g];e<i;e++)$.t($.Js[t].txt[e])||$.JS($.Js[t].txt[e],$.Js[t].doc[e]);delete $.Js[t]}},first:function(t){for(t=t.firstChild;t&&1!==t[R];)t=t.nextSibling;return t},findR:function(t,e,i,n){if(!t)return t;for(i=i||0,n=n||0,$.t(i,"n")&&(n=i,i=o);t=t[e];)if(1===t[R]&&(!i||$(t).is(i))&&!(--n>=0))return t},getTags:function(t,e){var i,n="querySelectorAll",s="toLowerCase";return i=$.t(t[n])?[]:t[n](e||"*"),/^u/.test(typeof e)||e&&t.nodeName&&t.nodeName[s]()===e[s]()?$.merge([t],i):i},H:function(e,i,n){var s,r=String(e),a=o,u=t;if(a=r.match(/<[^>]+?>/im)==o?u.createTextNode(r):u.createRange().createContextualFragment(r),(s=$.getTags(a,"script"))[g]>0){$.Js[i]={txt:[],doc:[]};for(var h=0,l=s[g];h<l;h++)s[h].textContent&&($.Js[i].txt.push(s[h].textContent),$.Js[i].doc.push(s[h][f]),s[h][c]&&s[h][c].removeChild(s[h]))}if(!$.t(n)){var p=u[J]("div");p[L](a),a=p[H],p=o}return a},JS:function(e,i){var n=(i=i||t)[J]("script");n.text=e,i.head[L](n)[c].removeChild(n)},longHex:function(t){return"#"+t.match(/[^#]/g).map((function(t){return t+t})).join("")},merge:function(t,e){for(var i=+e[g],n=0,s=t[g];n<i;n++)t[s++]=e[n];return t[g]=s,t},rgb2Hex:function(t){return"#"+t.match(/\b(\d+)\b/g).map((function(t){return("0"+b(t).toString(16)).slice(-2)})).join("")},R:function(){return Math.random().toString(36).substr(2,7)},S:function(t){(t=t||window.event).preventDefault(),t.stopPropagation()},t:function(t,e){return/^u/.test(typeof e)?/^u/.test(typeof t):{b:/^bo/,n:/^n/,i:/bi/,s:/st/,y:/sy/,f:/^f/,o:/^o/}[e].test(typeof t)},T:function(t){$(t)[E]((function(t){(t=$(t)).visible()?t.hide():t.show()}))},toS:function(t){var e,i=[],n=encodeURIComponent,s=function(t,e){var s=$.t(e,"f")?e():e;i[i[g]]=n(t)+"="+n(s==o?"":s)};if(Array.isArray(t))for(var r=0,a=t[g];r<a;r++)s(t[r].name,t[r].value);else for(e in t)$.doToS(e,t[e],s);return i.join("&")},each:function(t,e){for(var i=Object.keys(t),n=0,s=i[g];n<s&&!1!==e.call(t,i[n],t[i[n]]);++n);},doEl:function(t){var e,i=!1;return $.t(t,"o")&&t[g]>0&&t[0]instanceof Element?e=t[0]:(i=$.R(),e=$.H(t,i)),[e,i]},debounce:function(t,e,i){var n;return e=e||100,i=i||!1,function(){var s=this,r=arguments;n?clearTimeout(n):i&&t.apply(s,r),n=O((function(){i||t.apply(s,r),n=o}),e)}}}),$.i=function(n,s){e.push.apply(this,n?n[R]||n==window?[n]:""+n===n?/</.test(n)?((i=t[J](s||"q"))[H]=n,i.children):(s&&$(s)[0]||t).querySelectorAll(n):/f/.test(typeof n)?/c/.test(t.readyState)?n():$(t).on("DOMContentLoaded",n):n:e)},$.i.prototype=$.extend($.fn=$.prototype=e,{is:function(t){return this[0].matches(t)},select:function(t){var e=[];return this[E]((function(i){$(t,i)[E]((function(t){e.push(t)}))})),$(e)},parent:function(){return $(this[0][c])},remove:function(){if(0!=this[g]){var t=this[0][c];if(t){var e=this[0].outerHTML;return t.removeChild(this[0]),e}}},html:function(t){return $.t(t)?this[0][H]:this.update(t)},text:function(t){return $.t(t)?this[0].innerText:(this[0].innerText=t,this)},update:function(t){var e=$.R();return this[0][H]=$.H(t,e,1),$.execJS(e),this},replace:function(t){var e,i=this[0][c];if(i){var n=$.doEl(t);e=i.replaceChild(n[0],this[0]),n[1]&&$.execJS(n[1])}return $.t(e)?this:$(e)},append:function(t){var e;if([1,11,9].indexOf(this[0][R])>=0){var i=$.doEl(t);e=this[0][L](i[0]),i[1]&&$.execJS(i[1])}return $.t(e)?this:$(e)},prepend:function(t){var e;if([1,11,9].indexOf(this[0][R])>=0){var i=$.doEl(t);e=this[0][A](i[0],this[0].firstChild),i[1]&&$.execJS(i[1])}return $.t(e)?this:$(e)},before:function(t){var e,i=this[0][c];if(i){var n=$.doEl(t);e=i[A](n[0],this[0]),n[1]&&$.execJS(n[1])}return $.t(e)?this:$(e)},after:function(t){var e,i=this[0][c];if(i){var n=$.doEl(t);e=i[A](n[0],this[0].nextSibling),n[1]&&$.execJS(n[1])}return $.t(e)?this:$(e)},up:function(t,e){return $(0===arguments[g]?this[0][c]:$.findR(this[0],c,t,e))},down:function(t,e){return 0===arguments[g]?$($.first(this[0])):(t=t||0,e=e||0,$.t(t,"n")&&(e=t,t="*"),$($(this).select(t)[e]))},previous:function(t,e){return $($.findR(this[0],"previousSibling",t,e))},next:function(t,e){return $($.findR(this[0],"nextSibling",t,e))},first:function(){return $(this[0])},last:function(){return $(this[this[g]-1])},eq:function(t){if($.t(t,"n")&&this[g]>t&&t in this)return $(this[t])},children:function(t){var e=[],i=this[0].children;if(!$.t(i))for(var n=0,s=i[g];n<s;n++)($.t(t)||$(i[n]).is(t))&&e.push(i[n]);return $(e)},siblings:function(t){var e=[];if(this[0][c])for(var i=this[0][c].firstChild;i;)1!==i[R]||this[0]===i||t&&!$(i).is(t)||e.push(i),i=i.nextSibling;return $(e)},wrap:function(t){var e=$.R(),i="pika-wrap-"+$.R(),n=$.H('<div id="'+i+'">'+t+"</div>",e);this[0][c][A](n,this[0]);for(var s=$("div#"+i)[0];s.firstElementChild;)s=s.firstElementChild;return s[L](this[0]),(s=$("div#"+i)[0]).replaceWith.apply(s,s.childNodes),$.execJS(e),this},unwrap:function(){return this[0][c].replaceWith.apply(this[0][c],this[0][c].childNodes),this},contains:function(t){for(var e=0,i=this[g];e<i;++e)if($(this[e])[0].contains($(t)[0]))return!0;return!1},attr:function(t,e){return e||""==e?(this[0][k](t,e),this):this[0][N](t)},removeAttr:function(t){return this[0][D](t),this},hasClass:function(t){return(" "+(this[0].className.match(/[^\s]+/g)||[]).join(" ")+" ").indexOf(" "+t+" ")>-1},addClass:function(t){return this[E]((function(e){e.classList.add.apply(e.classList,t.split(/\s/))})),this},removeClass:function(t){return this[E]((function(e){if($.t(t))e.className="";else{var i=e.classList;i.remove.apply(i,t.split(/\s/))}})),""==this[0].className&&this.removeAttr("class"),this},toggleClass:function(t,e){var i=t.split(/\s/);return this[E]((function(t){for(var n=t.classList,s=0,r=i[g];s<r;++s)$.t(e)?n.contains(i[s])?n.remove.apply(n,[i[s]]):n.add.apply(n,[i[s]]):e?n.add.apply(n,[i[s]]):n.remove.apply(n,[i[s]])})),this},val:function(t){if($.t(t)){if("SELECT"==this[0].nodeName&&this[0][N]("multiple")!=o){var e=[];return this.select("option")[E]((function(t){t[N]("selected")!=o&&e.push(t.value)})),e}return this[0].value}return this[0].value=t,this},show:function(t){return this[E]((function(e){"none"==e[y].display&&(e[y].display=o,""==$(e).attr("style")&&e[D]("style")),"none"==$(e).css("display")&&(e[y].display=t||("SPAN"==e.tagName?"inline-block":"block"))})),this},hide:function(){return this[E]((function(t){t[y].display="none"})),this},visible:function(){return"none"!==this.css("display")},css:function(e,i){if($.t(e,"s")&&$.t(i)){var n=this[0][y][e];if(!n||"auto"==n){var s=t[u].getComputedStyle(this[0],o);n=s?s[e]:o}return n==o?o:"opacity"==e?n?parseFloat(n):1:n.match(/^rgb\(/)!=o?$.rgb2Hex(n):n.match(/^#\d{3}$/)!=o?$.longHex(n):"auto"==n?o:n}var r={};return $.t(e,"s")&&$.t(i,"s")?r[e]=i:r=e,this[E]((function(t){for(var e in r){var i=String(r[e]);i.match(/^#\d{3}$/)!=o&&(i=$.longHex(i)),t[y][e]=i}})),this},cOff:function(){return $.cOff(this[0])},offset:function(){var t=this[0].getBoundingClientRect();return{top:t.top+this[0][f][u].pageYOffset-this[0][f][a].clientTop,left:t.left+this[0][f][u].pageXOffset-this[0][f][a].clientLeft}},offsetParent:function(){for(var e=this[0].offsetParent;e&&"static"==$(e).css("position");)e=e.offsetParent;return e==o?$(t[a]):$(e)},position:function(){var t,e,i={top:0,left:0};return"fixed"==this.css("position")?e=this[0].getBoundingClientRect():(t=this.offsetParent(),e=this.offset(),"html"!=t[0].nodeName&&(i=t.offset()),i={top:i.top+b(t.css("borderTopWidth")),left:i.left+b(t.css("borderLeftWidth"))}),{top:e.top-i.top-b(this.css("marginTop")),left:e.left-i.left-b(this.css("marginLeft"))}},getDimensions:function(){var t=this.css("display");if(t&&"none"!==t)return{width:this[0].offsetWidth,height:this[0].offsetHeight};var e=this[0][y],i={visibility:e.visibility,position:e[h],display:e.display},n={visibility:"hidden",display:"block"};"fixed"!==i[h]&&(n[h]="absolute"),this.css(n);var s={width:this[0].offsetWidth,height:this[0].offsetHeight};return this.css(i),s},getHeight:function(){return this.getDimensions().height},getWidth:function(){return this.getDimensions().width},on:function(t,e){var i;if(!$.t(this[0]))return t=t.split(s),this.map((function(n){(s[i=t[0]+(n.pid$=n.pid$||++r)]=s[i]||[]).push([e,t[1]]),n.addEventListener(t[0],e)})),this},off:function(t,e){t=t.split(s);var i="removeEventListener";return this.map((function(n){var r,o;if(evts=s[t[0]+n.pid$],r=evts&&evts[g])for(;o=evts[--r];)e&&e!=o[0]||t[1]&&t[1]!=o[1]||(n[i](t[0],o[0]),evts.splice(r,1));else!t[1]&&n[i](t[0],e)})),this},_on:function(t,e,i,n){if(!$.t(this[0])){var r=!1,o=t.split(s);return n=$.t(n)?!$.Bubble:n,o[0]!=T&&o[0]!=w||(r=!0,t=(o[0]==T?S:C)+($.t(o[1])?"":"."+o[1])),this.on(t,(function(t){var s=t.target;!s||!$(s).is(e)&&!$(e).contains(s)||r&&(!r||t[x]&&(t[x]===s||$(s).contains(t[x])))||(n&&$.S(t),i.call(r||$(s).is(e)?$(s):$(s).up(e),t))})),this}},one:function(t,e,i){if(!$.t(this[0])){var n=!1,r=t.split(s);i=$.t(i)?!$.Bubble:i,r[0]!=T&&r[0]!=w||(n=!0,t=(r[0]==T?S:C)+($.t(r[1])?"":"."+r[1]));var o=this;return this.on(t,(function(s){i&&$.S(s),n&&s[x]&&(s[x]===s.target||s.target.contains(s[x]))||(e.call($(s.target),s),o.off(t))})),this}},formData:function(t){var e=[],i=this[0],n=encodeURIComponent,s=Array.prototype.slice;return $.t(i,"o")&&"FORM"==i.nodeName?!$.t(t)&&0==t||!$.t(FormData,"f")?(s.call(i.elements)[E]((function(t){t.name&&!t.disabled&&-1==["file","reset","submit","button"].indexOf(t.type)&&("select-multiple"==t.type?s.call(t.options)[E]((function(i){i.selected&&e.push(n(t.name)+"="+n(i.value))})):(-1==["checkbox","radio"].indexOf(t.type)||t.checked)&&e.push(n(t.name)+"="+n(t.value)))})),e.join("&").replace(/%20/g,"+")):new FormData(i):e},blank:function(){var t,e=this[0];return t="SELECT"==e.tagName?e.value:e.value||e[H],/^\s*$/.test(t)},data:function(t,e){return $.t(e)?this[0][N]("data-"+t):(this[E]((function(i){i[k]("data-"+t,e)})),this)},removeData:function(t){return this[0][D]("data-"+t),this},each:function(t,e){for(var i=0,n=this[g];i<n&&(!(i in this)||!1!==t.call($(this[i])));i++);},focus:function(){return this[0].focus(),this},blur:function(){return this[0].blur(),this},find:function(t){return this.select(t)},dimensions:function(){return this.getDimensions()},width:function(){return this.getWidth()},height:function(){return this.getHeight()}}),$}(document,[],/\.(.+)/,0,null,"documentElement","ownerDocument","defaultView","parentNode","position","processData","returnType","contentType","headers","timeout","style","length","relatedTarget",parseInt,"mouseenter","mouseleave","mouseover","mouseout","forEach","createElement","nodeType","innerHTML","appendChild","insertBefore","getAttribute","setAttribute","removeAttribute",setTimeout),Pika.noConflict=function(){return window.$===Pika&&(window.$=__$),Pika},window.Pika=window.$=Pika;