diff --git a/pace.js b/pace.js index 0831a47..3e9219a 100644 --- a/pace.js +++ b/pace.js @@ -378,32 +378,28 @@ _WebSocket = window.WebSocket; extendNative = function(to, from) { - var e, key, _results; - _results = []; - for (key in from.prototype) { + var key; + for (key in from) { try { if ((to[key] == null) && typeof from[key] !== 'function') { if (typeof Object.defineProperty === 'function') { - _results.push(Object.defineProperty(to, key, { + Object.defineProperty(to, key, { get: (function(key) { return function() { - return from.prototype[key]; + return from[key]; }; })(key), configurable: true, enumerable: true - })); + }); } else { - _results.push(to[key] = from.prototype[key]); + to[key] = from[key]; } - } else { - _results.push(void 0); } } catch (_error) { - e = _error; } } - return _results; + to.prototype = from.prototype; }; ignoreStack = []; @@ -983,4 +979,4 @@ } } -}).call(this); \ No newline at end of file +}).call(this); diff --git a/pace.min.js b/pace.min.js index b82e257..b3879fe 100644 --- a/pace.min.js +++ b/pace.min.js @@ -3,4 +3,4 @@ * https://github.com/CodeByZach/pace/ * Licensed MIT © HubSpot, Inc. */ -!function(){function o(t,e){return function(){return t.apply(e,arguments)}}var u,c,i,s,n,y,t,l,v,r,a,p,e,h,w,b,f,g,d,m,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=[].slice,K={}.hasOwnProperty,Q=function(t,e){for(var n in e)K.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},V=[].indexOf||function(t){for(var e=0,n=this.length;e\n
\n\n
',null!=t.firstChild?t.insertBefore(this.el,t.firstChild):t.appendChild(this.el)}return this.el},$.prototype.finish=function(){var t=this.getElement();return t.className=t.className.replace("pace-active","pace-inactive"),document.body.className=document.body.className.replace("pace-running ","pace-done ")},$.prototype.update=function(t){return this.progress=t,y.trigger("progress",t),this.render()},$.prototype.destroy=function(){try{this.getElement().parentNode.removeChild(this.getElement())}catch(t){n=t}return this.el=void 0},$.prototype.render=function(){var t,e,n,r,s,o,i;if(null==document.querySelector(T.target))return!1;for(t=this.getElement(),r="translate3d("+this.progress+"%, 0, 0)",s=0,o=(i=["webkitTransform","msTransform","transform"]).length;sT.eventLag.sampleCount&&o.shift(),e=h(o),++s>=T.eventLag.minSamples&&ethis.progress&&(this.progress+=this.catchup*t),e=1-Math.pow(this.progress/100,T.easeFactor),this.progress+=e*this.rate*t,this.progress=Math.min(this.lastProgress+T.maxProgressPerFrame,this.progress),this.progress=Math.max(0,this.progress),this.progress=Math.min(100,this.progress),this.lastProgress=this.progress,this.progress},v=it,b=e=_=w=E=N=null,y.running=!1,q=function(){if(T.restartOnPushState)return y.restart()},null!=window.history.pushState&&(I=window.history.pushState,window.history.pushState=function(){return q(),I.apply(window.history,arguments)}),null!=window.history.replaceState&&(G=window.history.replaceState,window.history.replaceState=function(){return q(),G.apply(window.history,arguments)}),l={ajax:u,elements:k,document:B,eventLag:Q},(x=function(){var t,e,n,r,s,o,i,a;for(y.sources=N=[],e=0,r=(o=["ajax","elements","document","eventLag"]).length;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\n
\n\n
',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=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=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;nO.eventLag.sampleCount&&s.shift(),t=y(s),++r>=O.eventLag.minSamples&&t=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