File "pace.min.js"
Full Path: /home/humancap/cl.humancap.com.my/admin/assets/javascripts/plugins/pace.min.js
File size: 13.06 KB
MIME-type: text/plain
Charset: utf-8
/*!
* pace.js v1.2.4
* https://github.com/CodeByZach/pace/
* Licensed MIT © HubSpot, Inc.
*/
(function(){var t,e,n,r,s,o,i,u,a,c,l,p,h,f,g,d,m,y,v,w,b,k,S,q,L,x,P,T,R,j,O,E,M,A,C,N,_,F,U,W,X,D,H,I,z,G,B,J,K,Q=[].slice,V={}.hasOwnProperty,Y=function(t,e){for(var n in e)V.call(e,n)&&(t[n]=e[n]);function r(){this.constructor=t}return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},Z=[].indexOf||function(t){for(var e=0,n=this.length;e<n;e++)if(e in this&&this[e]===t)return e;return-1},$=function(t,e){return function(){return t.apply(e,arguments)}};for(k={className:"",catchupTime:100,initialRate:.03,minTime:250,ghostTime:100,maxProgressPerFrame:20,easeFactor:1.25,startOnPageLoad:!0,restartOnPushState:!0,restartOnRequestAfter:500,target:"body",elements:{checkInterval:100,selectors:["body"]},eventLag:{minSamples:10,sampleCount:3,lagThreshold:30},ajax:{trackMethods:["GET"],trackWebSockets:!0,ignoreURLs:[]}},j=function(){var t;return null!=(t="undefined"!=typeof performance&&null!==performance&&"function"==typeof performance.now?performance.now():void 0)?t:+new Date},E=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame,b=window.cancelAnimationFrame||window.mozCancelAnimationFrame,d=function(t,e,n){return"function"==typeof t.addEventListener?t.addEventListener(e,n,!1):function(){if("function"!=typeof t["on"+e]||"object"!=typeof t["on"+e].eventListeners){var r=new u;"function"==typeof t["on"+e]&&r.on(e,t["on"+e]),t["on"+e]=function(t){return r.trigger(e,t)},t["on"+e].eventListeners=r}else r=t["on"+e].eventListeners;r.on(e,n)}()},null==E&&(E=function(t){return setTimeout(t,50)},b=function(t){return clearTimeout(t)}),A=function(t){var e,n;return e=j(),(n=function(){var r;return(r=j()-e)>=33?(e=j(),t(r,(function(){return E(n)}))):setTimeout(n,33-r)})()},M=function(){var t,e,n;return n=arguments[0],e=arguments[1],t=3<=arguments.length?Q.call(arguments,2):[],"function"==typeof n[e]?n[e].apply(n,t):n[e]},S=function(){var t,e,n,r,s,o,i;for(e=arguments[0],o=0,i=(r=2<=arguments.length?Q.call(arguments,1):[]).length;o<i;o++)if(n=r[o])for(t in n)V.call(n,t)&&(s=n[t],null!=e[t]&&"object"==typeof e[t]&&null!=s&&"object"==typeof s?S(e[t],s):e[t]=s);return e},y=function(t){var e,n,r,s,o;for(n=e=0,s=0,o=t.length;s<o;s++)r=t[s],n+=Math.abs(r),e++;return n/e},L=function(t,e){var n,r,s;if(null==t&&(t="options"),null==e&&(e=!0),s=document.querySelector("[data-pace-"+t+"]")){if(n=s.getAttribute("data-pace-"+t),!e)return n;try{return JSON.parse(n)}catch(t){return r=t,"undefined"!=typeof console&&null!==console?console.error("Error parsing inline pace options",r):void 0}}},i=function(){function t(){}return t.prototype.on=function(t,e,n,r){var s;return null==r&&(r=!1),null==this.bindings&&(this.bindings={}),null==(s=this.bindings)[t]&&(s[t]=[]),this.bindings[t].push({handler:e,ctx:n,once:r})},t.prototype.once=function(t,e,n){return this.on(t,e,n,!0)},t.prototype.off=function(t,e){var n,r,s;if(null!=(null!=(r=this.bindings)?r[t]:void 0)){if(null==e)return delete this.bindings[t];for(n=0,s=[];n<this.bindings[t].length;)this.bindings[t][n].handler===e?s.push(this.bindings[t].splice(n,1)):s.push(n++);return s}},t.prototype.trigger=function(){var t,e,n,r,s,o,i,u,a;if(n=arguments[0],t=2<=arguments.length?Q.call(arguments,1):[],null!=(i=this.bindings)?i[n]:void 0){for(s=0,a=[];s<this.bindings[n].length;)r=(u=this.bindings[n][s]).handler,e=u.ctx,o=u.once,r.apply(null!=e?e:this,t),o?a.push(this.bindings[n].splice(s,1)):a.push(s++);return a}},t}(),c=window.Pace||{},window.Pace=c,S(c,i.prototype),O=c.options=S({},k,window.paceOptions,L()),I=0,G=(J=["ajax","document","eventLag","elements"]).length;I<G;I++)!0===O[F=J[I]]&&(O[F]=k[F]);a=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return Y(e,t),e}(Error),e=function(){function t(){this.progress=0}return t.prototype.getElement=function(){var t;if(null==this.el){if(!(t=document.querySelector(O.target)))throw new a;this.el=document.createElement("div"),this.el.className="pace pace-active",document.body.className=document.body.className.replace(/(pace-done )|/,"pace-running ");var e=""!==O.className?" "+O.className:"";this.el.innerHTML='<div class="pace-progress'+e+'">\n <div class="pace-progress-inner"></div>\n</div>\n<div class="pace-activity"></div>',null!=t.firstChild?t.insertBefore(this.el,t.firstChild):t.appendChild(this.el)}return this.el},t.prototype.finish=function(){var t;return(t=this.getElement()).className=t.className.replace("pace-active","pace-inactive"),document.body.className=document.body.className.replace("pace-running ","pace-done ")},t.prototype.update=function(t){return this.progress=t,c.trigger("progress",t),this.render()},t.prototype.destroy=function(){try{this.getElement().parentNode.removeChild(this.getElement())}catch(t){a=t}return this.el=void 0},t.prototype.render=function(){var t,e,n,r,s,o,i;if(null==document.querySelector(O.target))return!1;for(t=this.getElement(),r="translate3d("+this.progress+"%, 0, 0)",s=0,o=(i=["webkitTransform","msTransform","transform"]).length;s<o;s++)e=i[s],t.children[0].style[e]=r;return(!this.lastRenderedProgress||this.lastRenderedProgress|0!==this.progress|0)&&(t.children[0].setAttribute("data-progress-text",(0|this.progress)+"%"),this.progress>=100?n="99":(n=this.progress<10?"0":"",n+=0|this.progress),t.children[0].setAttribute("data-progress",""+n)),c.trigger("change",this.progress),this.lastRenderedProgress=this.progress},t.prototype.done=function(){return this.progress>=100},t}(),u=function(){function t(){this.bindings={}}return t.prototype.trigger=function(t,e){var n,r,s,o,i;if(null!=this.bindings[t]){for(i=[],r=0,s=(o=this.bindings[t]).length;r<s;r++)n=o[r],i.push(n.call(this,e));return i}},t.prototype.on=function(t,e){var n;return null==(n=this.bindings)[t]&&(n[t]=[]),this.bindings[t].push(e)},t}(),H=window.XMLHttpRequest,D=window.XDomainRequest,X=window.WebSocket,q=function(t,e){var n,r;for(n in r=[],e.prototype)try{null==t[n]&&"function"!=typeof e[n]?"function"==typeof Object.defineProperty?r.push(Object.defineProperty(t,n,{get:function(t){return function(){return e.prototype[t]}}(n),configurable:!0,enumerable:!0})):r.push(t[n]=e.prototype[n]):r.push(void 0)}catch(t){t}return r},T=[],c.ignore=function(){var t,e,n;return e=arguments[0],t=2<=arguments.length?Q.call(arguments,1):[],T.unshift("ignore"),n=e.apply(null,t),T.shift(),n},c.track=function(){var t,e,n;return e=arguments[0],t=2<=arguments.length?Q.call(arguments,1):[],T.unshift("track"),n=e.apply(null,t),T.shift(),n},_=function(t){var e;if(null==t&&(t="GET"),"track"===T[0])return"force";if(!T.length&&O.ajax){if("socket"===t&&O.ajax.trackWebSockets)return!0;if(e=t.toUpperCase(),Z.call(O.ajax.trackMethods,e)>=0)return!0}return!1},l=function(t){function e(){var t,n=this;e.__super__.constructor.apply(this,arguments),t=function(t){var e;return e=t.open,t.open=function(r,s,o){return _(r)&&n.trigger("request",{type:r,url:s,request:t}),e.apply(t,arguments)}},window.XMLHttpRequest=function(e){var n;return n=new H(e),t(n),n};try{q(window.XMLHttpRequest,H)}catch(t){}if(null!=D){window.XDomainRequest=function(){var e;return e=new D,t(e),e};try{q(window.XDomainRequest,D)}catch(t){}}if(null!=X&&O.ajax.trackWebSockets){window.WebSocket=function(t,e){var r;return r=null!=e?new X(t,e):new X(t),_("socket")&&n.trigger("request",{type:"socket",url:t,protocols:e,request:r}),r};try{q(window.WebSocket,X)}catch(t){}}}return Y(e,t),e}(u),z=null,N=function(t){var e,n,r,s;for(n=0,r=(s=O.ajax.ignoreURLs).length;n<r;n++)if("string"==typeof(e=s[n])){if(-1!==t.indexOf(e))return!0}else if(e.test(t))return!0;return!1},(x=function(){return null==z&&(z=new l),z})().on("request",(function(e){var n,r,s,o,i;if(o=e.type,s=e.request,i=e.url,!N(i))return c.running||!1===O.restartOnRequestAfter&&"force"!==_(o)?void 0:(r=arguments,"boolean"==typeof(n=O.restartOnRequestAfter||0)&&(n=0),setTimeout((function(){var e,n,i,u,a;if("socket"===o?s.readyState<1:0<(i=s.readyState)&&i<4){for(c.restart(),a=[],e=0,n=(u=c.sources).length;e<n;e++){if((F=u[e])instanceof t){F.watch.apply(F,r);break}a.push(void 0)}return a}}),n))})),t=function(){function t(){this.complete=$(this.complete,this);var t=this;this.elements=[],x().on("request",(function(){return t.watch.apply(t,arguments)}))}return t.prototype.watch=function(t){var e,n,r,s;if(r=t.type,e=t.request,s=t.url,!N(s))return n="socket"===r?new f(e,this.complete):new g(e,this.complete),this.elements.push(n)},t.prototype.complete=function(t){return this.elements=this.elements.filter((function(e){return e!==t}))},t}(),g=function(t,e){var n,r,s,o,i=this;if(this.progress=0,null!=window.ProgressEvent)for(d(t,"progress",(function(t){return t.lengthComputable?i.progress=100*t.loaded/t.total:i.progress=i.progress+(100-i.progress)/2})),n=0,r=(o=["load","abort","timeout","error"]).length;n<r;n++)d(t,o[n],(function(){return e(i),i.progress=100}));else s=t.onreadystatechange,t.onreadystatechange=function(){var n;return 0===(n=t.readyState)||4===n?(e(i),i.progress=100):3===t.readyState&&(i.progress=50),"function"==typeof s?s.apply(null,arguments):void 0}},f=function(t,e){var n,r,s,o=this;for(this.progress=0,n=0,r=(s=["error","open"]).length;n<r;n++)d(t,s[n],(function(){return e(o),o.progress=100}))},r=function(){function t(t){var e,n,r,o;for(null==t&&(t={}),this.complete=$(this.complete,this),this.elements=[],null==t.selectors&&(t.selectors=[]),n=0,r=(o=t.selectors).length;n<r;n++)e=o[n],this.elements.push(new s(e,this.complete))}return t.prototype.complete=function(t){return this.elements=this.elements.filter((function(e){return e!==t}))},t}(),s=function(){function t(t,e){this.selector=t,this.completeCallback=e,this.progress=0,this.check()}return t.prototype.check=function(){var t=this;return document.querySelector(this.selector)?this.done():setTimeout((function(){return t.check()}),O.elements.checkInterval)},t.prototype.done=function(){return this.completeCallback(this),this.completeCallback=null,this.progress=100},t}(),n=function(){function t(){var t,e,n=this;this.progress=null!=(e=this.states[document.readyState])?e:100,t=document.onreadystatechange,document.onreadystatechange=function(){return null!=n.states[document.readyState]&&(n.progress=n.states[document.readyState]),"function"==typeof t?t.apply(null,arguments):void 0}}return t.prototype.states={loading:0,interactive:50,complete:100},t}(),o=function(){var t,e,n,r,s,o=this;this.progress=0,t=0,s=[],r=0,n=j(),e=setInterval((function(){var i;return i=j()-n-50,n=j(),s.push(i),s.length>O.eventLag.sampleCount&&s.shift(),t=y(s),++r>=O.eventLag.minSamples&&t<O.eventLag.lagThreshold?(o.progress=100,clearInterval(e)):o.progress=3/(t+3)*100}),50)},h=function(){function t(t){this.source=t,this.last=this.sinceLastUpdate=0,this.rate=O.initialRate,this.catchup=0,this.progress=this.lastProgress=0,null!=this.source&&(this.progress=M(this.source,"progress"))}return t.prototype.tick=function(t,e){var n;return null==e&&(e=M(this.source,"progress")),e>=100&&(this.done=!0),e===this.last?this.sinceLastUpdate+=t:(this.sinceLastUpdate&&(this.rate=(e-this.last)/this.sinceLastUpdate),this.catchup=(e-this.progress)/O.catchupTime,this.sinceLastUpdate=0,this.last=e),e>this.progress&&(this.progress+=this.catchup*t),n=1-Math.pow(this.progress/100,O.easeFactor),this.progress+=n*this.rate*t,this.progress=Math.min(this.lastProgress+O.maxProgressPerFrame,this.progress),this.progress=Math.max(0,this.progress),this.progress=Math.min(100,this.progress),this.lastProgress=this.progress,this.progress},t}(),U=null,C=null,v=null,W=null,m=null,w=null,c.running=!1,P=function(){if(O.restartOnPushState)return c.restart()},null!=window.history.pushState&&(B=window.history.pushState,window.history.pushState=function(){return P(),B.apply(window.history,arguments)}),null!=window.history.replaceState&&(K=window.history.replaceState,window.history.replaceState=function(){return P(),K.apply(window.history,arguments)}),p={ajax:t,elements:r,document:n,eventLag:o},(R=function(){var t,n,r,s,o,i,u,a;for(c.sources=U=[],n=0,s=(i=["ajax","elements","document","eventLag"]).length;n<s;n++)!1!==O[t=i[n]]&&U.push(new p[t](O[t]));for(r=0,o=(a=null!=(u=O.extraSources)?u:[]).length;r<o;r++)F=a[r],U.push(new F(O));return c.bar=v=new e,C=[],W=new h})(),c.stop=function(){return c.trigger("stop"),c.running=!1,v.destroy(),w=!0,null!=m&&("function"==typeof b&&b(m),m=null),R()},c.restart=function(){return c.trigger("restart"),c.stop(),c.start()},c.go=function(){var t;return c.running=!0,v.render(),t=j(),w=!1,m=A((function(e,n){var r,s,o,i,u,a,l,p,f,g,d,m,y,b,k;for(100-v.progress,s=g=0,o=!0,a=d=0,y=U.length;d<y;a=++d)for(F=U[a],f=null!=C[a]?C[a]:C[a]=[],l=m=0,b=(u=null!=(k=F.elements)?k:[F]).length;m<b;l=++m)i=u[l],o&=(p=null!=f[l]?f[l]:f[l]=new h(i)).done,p.done||(s++,g+=p.tick(e));return r=g/s,v.update(W.tick(e,r)),v.done()||o||w?(v.update(100),c.trigger("done"),setTimeout((function(){return v.finish(),c.running=!1,c.trigger("hide")}),Math.max(O.ghostTime,Math.max(O.minTime-(j()-t),0)))):n()}))},c.start=function(t){S(O,t),c.running=!0;try{v.render()}catch(t){a=t}return document.querySelector(".pace")?(c.trigger("start"),c.go()):setTimeout(c.start,50)},"function"==typeof define&&define.amd?define((function(){return c})):"object"==typeof exports?module.exports=c:O.startOnPageLoad&&c.start()}).call(this);