From 2a5b4033dd5cb6c4a496833eb774f498852d7954 Mon Sep 17 00:00:00 2001 From: BackuPs Date: Thu, 19 Nov 2026 09:15:11 +0100 Subject: [PATCH 1/2] Add appendToParent option for progress element insertion --- pace.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pace.js b/pace.js index 49b42ed..6cd72f2 100644 --- a/pace.js +++ b/pace.js @@ -21,6 +21,7 @@ easeFactor: 1.25, startOnPageLoad: true, restartOnPushState: true, + appendToParent: false, restartOnRequestAfter: 500, target: 'body', elements: { @@ -284,7 +285,7 @@ activity.className = 'pace-activity'; this.el.appendChild(progress); this.el.appendChild(activity); - if (targetElement.firstChild != null) { + if (targetElement.firstChild != null && options.appendToParent === false ) { targetElement.insertBefore(this.el, targetElement.firstChild); } else { targetElement.appendChild(this.el); @@ -991,4 +992,4 @@ } } -}).call(this); \ No newline at end of file +}).call(this); From 897aebb30c499af14aeaad439f6c96917a2e4c6c Mon Sep 17 00:00:00 2001 From: BackuPs Date: Thu, 19 Nov 2026 09:16:08 +0100 Subject: [PATCH 2/2] Add appendToParent option for progress element insertion --- pace.min.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pace.min.js b/pace.min.js index a246640..d9f994e 100644 --- a/pace.min.js +++ b/pace.min.js @@ -2,4 +2,5 @@ * pace.js v1.3.1 * https://github.com/CodeByZach/pace/ * Licensed MIT © HubSpot, Inc. and Zachary Miller - */(function(){var O,Y,Q,V,Z,$,ee,C,q,u,te,re,F,ne,se,E,w,ie,g,R,x,X,v,L,oe,U,D,y,ue,d,l,T,I,ae,b,H,P,p,_,W,k,M,z,A,j,le,ce,B,fe,pe,S=[].slice,he={}.hasOwnProperty,ge=function(t,e){for(var r in e)he.call(e,r)&&(t[r]=e[r]);function n(){this.constructor=t}return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},we=[].indexOf||function(t){for(var e=0,r=this.length;e=33?(e=d(),t(n,function(){return T(r)})):setTimeout(r,33-n)},r()},I=function(){var t,e,r;return r=arguments[0],e=arguments[1],t=3<=arguments.length?S.call(arguments,2):[],typeof r[e]=="function"?r[e].apply(r,t):r[e]},v=function(){var t,e,r,n,s,i,o;for(e=arguments[0],n=2<=arguments.length?S.call(arguments,1):[],i=0,o=n.length;i=100?n="99":(n=this.progress<10?"0":"",n+=this.progress|0),e.children[0].setAttribute("data-progress",""+n)),u.trigger("change",this.progress),this.lastRenderedProgress=this.progress},t.prototype.done=function(){return this.progress>=100},t})(),C=(function(){function t(){this.bindings={}}return t.prototype.trigger=function(e,r){var n,s,i,o,a;if(this.bindings[e]!=null){for(o=this.bindings[e],a=[],s=0,i=o.length;s=0)return!0}return!1},te=(function(t){ge(e,t);function e(){var r,n=this;e.__super__.constructor.apply(this,arguments),r=function(s){var i;return i=s.open,s.open=function(o,a,f){return P(o)&&n.trigger("request",{type:o,url:a,request:s}),i.apply(s,arguments)}},window.XMLHttpRequest=function(s){var i;return i=new z(s),r(i),i};try{L(window.XMLHttpRequest,z)}catch(s){}if(M!=null){window.XDomainRequest=function(){var s;return s=new M,r(s),s};try{L(window.XDomainRequest,M)}catch(s){}}if(k!=null&&l.ajax.trackWebSockets){window.WebSocket=function(s,i){var o;return i!=null?o=new k(s,i):o=new k(s),P("socket")&&n.trigger("request",{type:"socket",url:s,protocols:i,request:o}),o};try{L(window.WebSocket,k)}catch(s){}}}return e})(C),j=null,U=function(){return j==null&&(j=new te),j},H=function(t){var e,r,n,s;for(s=l.ajax.ignoreURLs,r=0,n=s.length;re.sampleCount&&o.shift(),r=ie(o),++i>=e.minSamples&&r=100&&(this.done=!0),r===this.last?this.sinceLastUpdate+=e:(this.sinceLastUpdate&&(this.rate=(r-this.last)/this.sinceLastUpdate),this.catchup=(r-this.progress)/l.catchupTime,this.sinceLastUpdate=0,this.last=r),r>this.progress&&(this.progress+=this.catchup*e),n=1-Math.pow(this.progress/100,l.easeFactor),this.progress+=n*this.rate*e,this.progress=Math.min(this.lastProgress+l.maxProgressPerFrame,this.progress),this.progress=Math.max(0,this.progress),this.progress=Math.min(100,this.progress),this.lastProgress=this.progress,this.progress},t})(),_=null,b=null,g=null,W=null,w=null,R=null,u.running=!1,D=function(){if(l.restartOnPushState)return u.restart()},window.history.pushState!=null&&(ce=window.history.pushState,window.history.pushState=function(){return D(),ce.apply(window.history,arguments)}),window.history.replaceState!=null&&(pe=window.history.replaceState,window.history.replaceState=function(){return D(),pe.apply(window.history,arguments)}),re={ajax:O,elements:V,document:Q,eventLag:$},(ue=function(){var t,e,r,n,s,i,o,a;for(u.sources=_=[],i=["ajax","elements","document","eventLag"],e=0,n=i.length;e=33?(e=E(),t(r,(function(){return j(n)}))):setTimeout(n,33-r)})()},C=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,o,s,i;for(e=arguments[0],s=0,i=(r=2<=arguments.length?Q.call(arguments,1):[]).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,o,s,i;if(null!=this.bindings[t]){for(i=[],r=0,o=(s=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,o,s){return M(r)&&n.trigger("request",{type:r,url:o,request:t}),e.apply(t,arguments)}},window.XMLHttpRequest=function(e){var n;return n=new I(e),t(n),n};try{q(window.XMLHttpRequest,I)}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&&_.ajax.trackWebSockets){window.WebSocket=function(t,e){var r;return r=null!=e?new X(t,e):new X(t),M("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,A=function(t){var e,n,r,o;for(n=0,r=(o=_.ajax.ignoreURLs).length;nt.sampleCount&&s.shift(),e=y(s),++o>=t.minSamples&&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)/_.catchupTime,this.sinceLastUpdate=0,this.last=e),e>this.progress&&(this.progress+=this.catchup*t),n=1-Math.pow(this.progress/100,_.easeFactor),this.progress+=n*this.rate*t,this.progress=Math.min(this.lastProgress+_.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,O=null,w=null,W=null,m=null,v=null,c.running=!1,L=function(){if(_.restartOnPushState)return c.restart()},null!=window.history.pushState&&(B=window.history.pushState,window.history.pushState=function(){return L(),B.apply(window.history,arguments)}),null!=window.history.replaceState&&(K=window.history.replaceState,window.history.replaceState=function(){return L(),K.apply(window.history,arguments)}),p={ajax:t,elements:r,document:n,eventLag:s},(R=function(){var t,n,r,o,s,i,u,a;for(c.sources=U=[],n=0,o=(i=["ajax","elements","document","eventLag"]).length;n