From 140ec62491ba043cbcbc634259f73cb1fae85c52 Mon Sep 17 00:00:00 2001 From: Guilherme Nascimento Date: Mon, 25 Sep 2023 03:22:54 -0300 Subject: [PATCH 1/4] Update pjax.js --- pjax.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pjax.js b/pjax.js index f4b972b..ee5e233 100644 --- a/pjax.js +++ b/pjax.js @@ -443,7 +443,7 @@ function serialize(data) { - return new URLSearchParams(data).toString(); + return new URLSearchParams(data) + ""; } function pjaxRequest(method, url, data, el, event, cfg) @@ -469,7 +469,7 @@ if (!started) { started = true; - var url = location + "", state = history.state; + var url = location + ""; history.replaceState({ pjaxUrl: url, From 3cf1852167005f870a59de33c0fe1b3013c34ad3 Mon Sep 17 00:00:00 2001 From: Guilherme Nascimento Date: Fri, 29 Sep 2023 10:36:36 -0300 Subject: [PATCH 2/4] Improved linkSelector and formSelector --- pjax.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pjax.js b/pjax.js index ee5e233..3c6b1d7 100644 --- a/pjax.js +++ b/pjax.js @@ -25,6 +25,7 @@ ArraySlice = [].slice, PUSH = 1, REPLACE = 2, + ignoreAttr = ':not([data-pjax-ignore=true])', supported = !!( elementProto && history.pushState && ( domparser || (docImplementation && docImplementation.createHTMLDocument) @@ -520,8 +521,8 @@ remove(); config = { - linkSelector: "a:not([data-pjax-ignore]):not([href^='#']):not([href^='javascript:'])", - formSelector: "form:not([data-pjax-ignore]):not([action^='javascript:'])", + linkSelector: "a", + formSelector: "form", containers: [ "#pjax-container" ], updatecurrent: false, updatehead: true, @@ -534,6 +535,9 @@ headers: {} }; + opts.linkSelector += ignoreAttr; + opts.formSelector += ignoreAttr; + for (var k in config) { if (opts && k in opts) config[k] = opts[k]; } From d1c231885713ac58d937211e28f216059bea6e1a Mon Sep 17 00:00:00 2001 From: Guilherme Nascimento Date: Fri, 29 Sep 2023 10:44:42 -0300 Subject: [PATCH 3/4] Update pjax.js --- pjax.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pjax.js b/pjax.js index 3c6b1d7..80ba425 100644 --- a/pjax.js +++ b/pjax.js @@ -535,13 +535,13 @@ headers: {} }; - opts.linkSelector += ignoreAttr; - opts.formSelector += ignoreAttr; - for (var k in config) { if (opts && k in opts) config[k] = opts[k]; } + opts.linkSelector += ignoreAttr; + opts.formSelector += ignoreAttr; + opts = undef; if (/^(interactive|complete)$/.test(doc.readyState)) { From 55b81c79a7745818894705c3bc98a89a0bc4f590 Mon Sep 17 00:00:00 2001 From: Guilherme Nascimento Date: Wed, 17 Jul 2024 06:19:11 -0300 Subject: [PATCH 4/4] Update min files --- .editorconfig | 12 ++++++++++++ LICENSE | 2 +- README.html | 18 ++++++++++++------ examples/README.html | 2 +- pjax.css | 2 +- pjax.min.css | 2 +- pjax.min.js | 4 ++-- 7 files changed, 30 insertions(+), 12 deletions(-) create mode 100644 .editorconfig diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..51bad82 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,12 @@ +root = true + +[*] +end_of_line = lf +insert_final_newline = true +indent_style = space +indent_size = 4 +trim_trailing_whitespace = true +charset = utf-8 + +[*.md] +trim_trailing_whitespace = false diff --git a/LICENSE b/LICENSE index 2922efe..a892ddb 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2017 Guilherme Nascimento +Copyright (c) 2024 Guilherme Nascimento Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.html b/README.html index d1a1ff5..04e957a 100644 --- a/README.html +++ b/README.html @@ -1556,13 +1556,19 @@

Custom loader with PjaxPjax handler response

For create a custom responses for Pjax you can use handler event, example:

-
Pjax.start({
-    updatehead: false //Prevent remove itens in head
-});
+
Pjax.start();
+
+Pjax.on("handler", function (details, done, fail) {
+    console.log("handler request:", details.method, details.url);
+    console.log("handler target:", details.element);
+    console.log("handler mode history:", details.state); // 1 == push, 2 == replace
 
-Pjax.on("handler", function (hdata, config, done, fail) {
     setTimeout(function () {
-        done(hdata.url, '<div id="pjax-container">Foo: ' + new Date() + '</div>', config, hdata.state);
+        if (<condition for history state>) {
+            done('<div id="pjax-container">Foo: ' + new Date() + '</div>');
+        } else {
+            fail("Custom Error");
+        }
     }, 1000);
 });
-
\ No newline at end of file +
diff --git a/examples/README.html b/examples/README.html index 9d3bd84..f5c5a07 100644 --- a/examples/README.html +++ b/examples/README.html @@ -1100,4 +1100,4 @@

PJAX example with Java
java SimpleServer 9000
 
-

After navigate to http://localhost:9000/ in your browser

\ No newline at end of file +

After navigate to http://localhost:9000/ in your browser

diff --git a/pjax.css b/pjax.css index a7edf27..47797e8 100644 --- a/pjax.css +++ b/pjax.css @@ -1,7 +1,7 @@ /* * Pjax.js 0.6.7 * - * Copyright (c) 2023 Guilherme Nascimento (brcontainer@yahoo.com.br) + * Copyright (c) 2024 Guilherme Nascimento (brcontainer@yahoo.com.br) * * Released under the MIT license */ diff --git a/pjax.min.css b/pjax.min.css index 344e21f..65f8194 100644 --- a/pjax.min.css +++ b/pjax.min.css @@ -1,3 +1,3 @@ -/* Pjax.js 0.6.7 | Copyright (c) 2023 Guilherme Nascimento (brcontainer@yahoo.com.br) | Released under the MIT license */ +/* Pjax.js 0.6.7 | Copyright (c) 2024 Guilherme Nascimento (brcontainer@yahoo.com.br) | Released under the MIT license */ .pjax-loader{position:fixed;z-index:200000;left:0;top:0;width:100%;pointer-events:none}.pjax-loader .pjax-progress{width:0;height:4px;opacity:1;background-color:rgb(119,182,255);-webkit-transition:width 1.5s ease,height .8s ease,opacity .8s ease;transition:width 1.5s ease,height .8s ease,opacity .8s ease}.pjax-inload .pjax-progress{width:95%}.pjax-end .pjax-progress{width:100%}.pjax-hide{display:none} diff --git a/pjax.min.js b/pjax.min.js index 7ef9da9..66d6308 100644 --- a/pjax.min.js +++ b/pjax.min.js @@ -1,3 +1,3 @@ -/* Pjax.js 0.6.7 | Copyright (c) 2023 Guilherme Nascimento (brcontainer@yahoo.com.br) | Released under the MIT license */ +/* Pjax.js 0.6.7 | Copyright (c) 2024 Guilherme Nascimento (brcontainer@yahoo.com.br) | Released under the MIT license */ -!function(){"use strict";var e,t,n,r,a,o,i="undefined"!=typeof window?window:{},c=i.document||{},l=i.history,s=!!i.DOMParser,d=!!i.FormData,f=!!i.URLSearchParams,u={},p=c.implementation,m=i.location,h=m?m.protocol+"//"+m.host:"",v=!1,g=i.Element&&i.Element.prototype,x=[].slice,T=1,L=2,y=!!(g&&l.pushState&&(s||p&&p.createHTMLDocument)),S=[{attr:"containers",cfg:"containers"},{attr:"updatecurrent",cfg:"updatecurrent"},{attr:"updatehead",cfg:"updatehead"},{attr:"insertion",cfg:"insertion"},{attr:"loader",cfg:"loader"},{attr:"scroll-left",cfg:"scrollLeft"},{attr:"scroll-top",cfg:"scrollTop"},{attr:"done",cfg:"done"},{attr:"fail",cfg:"fail"}],j={supported:y,remove:G,start:function(e){if(y&&/^https?:$/.test(m.protocol)){for(var n in G(),t={linkSelector:"a:not([data-pjax-ignore]):not([href^='#']):not([href^='javascript:'])",formSelector:"form:not([data-pjax-ignore]):not([action^='javascript:'])",containers:["#pjax-container"],updatecurrent:!1,updatehead:!0,insertion:a,proxy:a,scrollLeft:0,scrollTop:0,nocache:!1,loader:!0,headers:{}})e&&n in e&&(t[n]=e[n]);e=a,/^(interactive|complete)$/.test(c.readyState)?k():c.addEventListener("DOMContentLoaded",k)}},request:function(e,n){v&&U(e,n.replace?L:T,n.method,n.data,a,t)},on:function(e,t){C(e,t)},off:function(e,t){C(e,t,!0)}};if(s)try{o=N("11"),s=!!(o.head&&o.title&&o.body)}catch(e){s=!1}if(f)try{(o=new FormData).append("a","1"),f="a=1"===q(o)}catch(e){f=!1}function E(){if(n)return clearTimeout(n),n=0,r.className="pjax-loader pjax-hide",void setTimeout(E,20);r||((r=c.createElement("div")).innerHTML='
',c.body.appendChild(r)),r.className="pjax-loader pjax-start",n=setTimeout((function(){n=0,r.className+=" pjax-inload"}),10)}function M(e,t,n){x.call(t?e.querySelectorAll(t):e).forEach(n),n=a}function N(e){if(s)return(new DOMParser).parseFromString(e,"text/html");var t=p.createHTMLDocument("");return/^\s*<(\!doctype|html)[^>]*>/i.test(e)?(t.documentElement.innerHTML=e,t.body&&t.head||(t=p.createHTMLDocument("")).write(e)):t.body.innerHTML=e,t}function H(e,t,n,r){var a=u[e];if(a)for(var o=0,i=a.length;o-1&&r.splice(a,1)}else r.push(t)}}function D(e,t,n,r){var o,s=n.containers,d=t&&N(t),f=d&&d.body;if(!f||!f.querySelectorAll(s.join(",")).length)return"No such containers";var p={pjaxUrl:e,pjaxData:t,pjaxConfig:n};if(r===T?l.pushState(p,"",e):r===L&&l.replaceState(p,"",e),u.dom)return H("dom",e,d);var m=n.insertion,h=n.scrollLeft>-1?+n.scrollLeft:i.scrollX||i.pageXOffset,v=n.scrollTop>-1?+n.scrollTop:i.scrollY||i.pageYOffset;n.updatehead&&d.head&&function(e){var t,n,r=[],o=c.head;M(e.head.children,a,(function(e){"TITLE"!==e.tagName&&r.push(e.outerHTML)})),M(o.children,a,(function(e){("TITLE"===e.tagName||b(e,"resource"))&&(-1===(t=r.indexOf(e.outerHTML))?e.parentNode.removeChild(e):r.splice(t,1))})),(n=e.createElement("div")).innerHTML=r.join(""),M(n.children,a,(function(e){b(e,"resource")||o.appendChild(e)})),n=r=a}(d),c.title=d.title||"";for(var g=s.length-1;g>=0;g--)(o=f.querySelector(s[g]))&&M(c,s[g],(function(e){if("append"===m||"prepend"===m){var t=c.createDocumentFragment();M(o.childNodes,a,(function(e){t.appendChild(e)})),"append"===m?e.appendChild(t):e.insertBefore(t,e.firstChild),t=a}else e.innerHTML=o.innerHTML}));i.scrollTo(h,v),d=s=a}function b(e,t){var n=e.getAttribute("data-pjax-"+t);if("true"===n||"false"===n)return"true"===n;if(!n)return"";if(!isNaN(n))return parseFloat(n);if(n.length>3){var r=n[0],a=n[n.length-1];if("["===r&&"]"===a||"{"===r&&"}"===a)try{n=JSON.parse(n)}catch(n){console.error("Invalid value in data-pjax-"+t+" attribute on element:",e)}}return n}function O(e){var n,r,a=JSON.parse(JSON.stringify(t));if(e)for(var o=S.length-1;o>=0;o--)""!==(r=b(e,(n=S[o]).attr))&&(a[n.cfg]=r);return a}function P(e,t,a,o,i,c,l,s){t.loader&&(n&&clearTimeout(n),r.className+=" pjax-end",n=setTimeout((function(){n=0,r.className+=" pjax-hide"}),1e3)),s||(s=D(e,c,t,a)),H(s?"fail":"done",e,l,s),H("then",e),i&&new Function(i).call(o)}function X(){e&&e.abort()}function U(t,n,r,o,i,c){if(X(),H("initiate",t,c),c.loader&&E(),u.handler)return H("handler",{url:t,state:n,method:r,element:i},(function(e){P(t,c,n,i,c.done,e,0,a)}),(function(e){P(t,c,n,i,c.fail,"",-1,e)}));var l=t,s=c.headers;for(var d in s["X-PJAX-Container"]=c.containers.join(","),s["X-PJAX"]="true",c.proxy&&(l=c.proxy+encodeURIComponent(l)),c.nocache&&(l=function(e){var t="_="+ +new Date;return e+(-1===e.indexOf("?")?"?":"&")+t}(l)),(e=new XMLHttpRequest).open(r,l,!0),s)e.setRequestHeader(d,s[d]);e.onreadystatechange=function(){if(4===e.readyState){var r=e.status;if(r>=200&&r<300){var o=e.getResponseHeader("X-PJAX-Container");o&&(c.containers=o.split(",")),P(e.getResponseHeader("X-PJAX-URL")||t,c,n,i,c.done,e.responseText,r,a)}else P(t,c,n,i,c.fail,"",r,"HTTP Error ("+r+")")}},e.send(o||"")}function A(e){if(0===e.button){for(var n,r=e.target;r.tagName&&"A"!==r.tagName;)r=r.parentNode;(n=r.href)&&r.matches(t.linkSelector)&&I(r.target,n)&&F("GET",n,a,r,e,O(r))}}function R(e){var n=e.target,r=n.action;if(d&&n.matches(t.formSelector)&&I(n.target,r)){var o=new FormData(n),i=String(n.method).toUpperCase(),c=n.enctype,l=O(n);if("POST"!==i&&(i="GET"),"GET"===i||"multipart/form-data"!==c){if(!f)return;o=q(o),"GET"===i?r=r.replace(/\?[\s\S]+/,"")+"?"+o:"text/plain"===c&&(o=o.replace(/&/g,"\n"),l.headers["Content-Type"]=c)}F(i,r,o,n,e,l),o=a}}function q(e){return new URLSearchParams(e).toString()}function F(e,t,n,r,a,o){a.preventDefault(),U(t,o.updatecurrent||t===m+""?L:T,e,n,r,o)}function J(e){e.state&&e.state.pjaxUrl&&(X(),D(e.state.pjaxUrl,e.state.pjaxData,e.state.pjaxConfig,a),H("history",e.state.pjaxUrl,e.state))}function k(){if(!v){v=!0;var e=m+"";l.state;l.replaceState({pjaxUrl:e,pjaxData:c.documentElement.outerHTML,pjaxConfig:t},"",e),i.addEventListener("unload",X),i.addEventListener("popstate",J),t.linkSelector&&c.addEventListener("click",A),t.formSelector&&c.addEventListener("submit",R)}}function G(){t&&v&&(c.removeEventListener("click",A),c.removeEventListener("submit",R),i.removeEventListener("unload",X),i.removeEventListener("popstate",J),v=!1,t=a)}function I(e,t){return(!(e=e.toLowerCase())||e===i.name||"_self"===e||"_top"===e&&w===i.top||"_parent"===e&&w===i.parent)&&(t===h||0===t.indexOf(h))}g&&!g.matches&&(g.matches=g.matchesSelector||g.mozMatchesSelector||g.msMatchesSelector||g.oMatchesSelector||g.webkitMatchesSelector||function(e){for(var t=this,n=(t.document||t.ownerDocument).querySelectorAll(e),r=n.length;--r>=0&&n[r]!==t;);return r>-1}),i.Pjax=j,"undefined"!=typeof module&&module.exports&&(module.exports=j),"undefined"!=typeof define&&define((function(){return j}))}(); +!function(){var e,t,r,n,a,o,i="undefined"!=typeof window?window:{},c=i.document||{},l=i.history,s=!!i.DOMParser,f=!!i.FormData,d=!!i.URLSearchParams,p={},u=c.implementation,h=i.location,m=h?h.protocol+"//"+h.host:"",v=!1,g=i.Element&&i.Element.prototype,x=[].slice,L=":not([data-pjax-ignore=true])",T=!!(g&&l.pushState&&(s||u&&u.createHTMLDocument)),y=[{attr:"containers",cfg:"containers"},{attr:"updatecurrent",cfg:"updatecurrent"},{attr:"updatehead",cfg:"updatehead"},{attr:"insertion",cfg:"insertion"},{attr:"loader",cfg:"loader"},{attr:"scroll-left",cfg:"scrollLeft"},{attr:"scroll-top",cfg:"scrollTop"},{attr:"done",cfg:"done"},{attr:"fail",cfg:"fail"}];if(s)try{s=!!((e=_("11")).head&&e.title&&e.body)}catch(j){s=!1}if(d)try{(e=new FormData).append("a","1"),d="a=1"===P(e)}catch(S){d=!1}function $(e,t,r){x.call(t?e.querySelectorAll(t):e).forEach(r),r=o}function _(e){if(s)return new DOMParser().parseFromString(e,"text/html");var t=u.createHTMLDocument("");return/^\s*<(\!doctype|html)[^>]*>/i.test(e)?(t.documentElement.innerHTML=e,t.body&&t.head||(t=u.createHTMLDocument("")).write(e)):t.body.innerHTML=e,t}function E(e,t,r,n){var a=p[e];if(a)for(var o=0,i=a.length;o-1&&n.splice(a,1)}else n.push(t)}}function H(e,t,r,n){var a,s,f,d,u,h,m=r.containers,v=t&&_(t),g=v&&v.body;if(!g||!g.querySelectorAll(m.join(",")).length)return"No such containers";var x={pjaxUrl:e,pjaxData:t,pjaxConfig:r};if(1===n?l.pushState(x,"",e):2===n&&l.replaceState(x,"",e),p.dom)return E("dom",e,v);var L=r.insertion,T=r.scrollLeft>-1?+r.scrollLeft:i.scrollX||i.pageXOffset,y=r.scrollTop>-1?+r.scrollTop:i.scrollY||i.pageYOffset;r.updatehead&&v.head&&(a=v,d=[],u=c.head,$(a.head.children,o,function(e){"TITLE"!==e.tagName&&d.push(e.outerHTML)}),$(u.children,o,function(e){("TITLE"===e.tagName||C(e,"resource"))&&(-1===(s=d.indexOf(e.outerHTML))?e.parentNode.removeChild(e):d.splice(s,1))}),(f=a.createElement("div")).innerHTML=d.join(""),$(f.children,o,function(e){C(e,"resource")||u.appendChild(e)}),f=d=o),c.title=v.title||"";for(var j=m.length-1;j>=0;j--)(h=g.querySelector(m[j]))&&$(c,m[j],function(e){if("append"===L||"prepend"===L){var t=c.createDocumentFragment();$(h.childNodes,o,function(e){t.appendChild(e)}),"append"===L?e.appendChild(t):e.insertBefore(t,e.firstChild),t=o}else e.innerHTML=h.innerHTML});i.scrollTo(T,y),v=m=o}function C(e,t){var r=e.getAttribute("data-pjax-"+t);if("true"===r||"false"===r)return"true"===r;if(!r)return"";if(!isNaN(r))return parseFloat(r);if(r.length>3){var n=r[0],a=r[r.length-1];if("["===n&&"]"===a||"{"===n&&"}"===a)try{r=JSON.parse(r)}catch(o){console.error("Invalid value in data-pjax-"+t+" attribute on element:",e)}}return r}function b(e){var t,n,a=JSON.parse(JSON.stringify(r));if(e)for(var o=y.length-1;o>=0;o--)""!==(n=C(e,(t=y[o]).attr))&&(a[t.cfg]=n);return a}function N(e,t,r,o,i,c,l,s){t.loader&&(n&&clearTimeout(n),a.className+=" pjax-end",n=setTimeout(function(){n=0,a.className+=" pjax-hide"},1e3)),s||(s=H(e,c,t,r)),E(s?"fail":"done",e,l,s),E("then",e),i&&Function(i).call(o)}function D(){t&&t.abort()}function X(e,r,i,l,s,f){if(D(),E("initiate",e,f),f.loader&&function e(){if(n){clearTimeout(n),n=0,a.className="pjax-loader pjax-hide",setTimeout(e,20);return}a||((a=c.createElement("div")).innerHTML='
',c.body.appendChild(a)),a.className="pjax-loader pjax-start",n=setTimeout(function(){n=0,a.className+=" pjax-inload"},10)}(),p.handler)return E("handler",{url:e,state:r,method:i,element:s},function(t){N(e,f,r,s,f.done,t,0,o)},function(t){N(e,f,r,s,f.fail,"",-1,t)});var d,u,h=e,m=f.headers;for(var v in m["X-PJAX-Container"]=f.containers.join(","),m["X-PJAX"]="true",f.proxy&&(h=f.proxy+encodeURIComponent(h)),f.nocache&&(h=(d=h,u="_="+ +new Date,d+(-1===d.indexOf("?")?"?":"&")+u)),(t=new XMLHttpRequest).open(i,h,!0),m)t.setRequestHeader(v,m[v]);t.onreadystatechange=function(){if(4===t.readyState){var n=t.status;if(n>=200&&n<300){var a=t.getResponseHeader("X-PJAX-Container");a&&(f.containers=a.split(",")),N(t.getResponseHeader("X-PJAX-URL")||e,f,r,s,f.done,t.responseText,n,o)}else N(e,f,r,s,f.fail,"",n,"HTTP Error ("+n+")")}},t.send(l||"")}function A(e){if(0===e.button){for(var t,n=e.target;n.tagName&&"A"!==n.tagName;)n=n.parentNode;(t=n.href)&&n.matches(r.linkSelector)&&G(n.target,t)&&U("GET",t,o,n,e,b(n))}}function O(e){var t=e.target,n=t.action;if(f&&t.matches(r.formSelector)&&G(t.target,n)){var a=new FormData(t),i=String(t.method).toUpperCase(),c=t.enctype,l=b(t);if("POST"!==i&&(i="GET"),"GET"===i||"multipart/form-data"!==c){if(!d)return;a=P(a),"GET"===i?n=n.replace(/\?[\s\S]+/,"")+"?"+a:"text/plain"===c&&(a=a.replace(/&/g,"\n"),l.headers["Content-Type"]=c)}U(i,n,a,t,e,l),a=o}}function P(e){return new URLSearchParams(e)+""}function U(e,t,r,n,a,o){a.preventDefault();var i=o.updatecurrent||t===h+""?2:1;X(t,i,e,r,n,o)}function k(e){e.state&&e.state.pjaxUrl&&(D(),H(e.state.pjaxUrl,e.state.pjaxData,e.state.pjaxConfig,o),E("history",e.state.pjaxUrl,e.state))}function q(){if(!v){v=!0;var e=h+"";l.replaceState({pjaxUrl:e,pjaxData:c.documentElement.outerHTML,pjaxConfig:r},"",e),i.addEventListener("unload",D),i.addEventListener("popstate",k),r.linkSelector&&c.addEventListener("click",A),r.formSelector&&c.addEventListener("submit",O)}}function R(){r&&v&&(c.removeEventListener("click",A),c.removeEventListener("submit",O),i.removeEventListener("unload",D),i.removeEventListener("popstate",k),v=!1,r=o)}function G(e,t){return(!(e=e.toLowerCase())||e===i.name||"_self"===e||"_top"===e&&w===i.top||"_parent"===e&&w===i.parent)&&(t===m||0===t.indexOf(m))}g&&!g.matches&&(g.matches=g.matchesSelector||g.mozMatchesSelector||g.msMatchesSelector||g.oMatchesSelector||g.webkitMatchesSelector||function(e){for(var t=(this.document||this.ownerDocument).querySelectorAll(e),r=t.length;--r>=0&&t[r]!==this;);return r>-1}),i.Pjax={supported:T,remove:R,start:function e(t){if(T&&/^https?:$/.test(h.protocol)){for(var n in R(),r={linkSelector:"a",formSelector:"form",containers:["#pjax-container"],updatecurrent:!1,updatehead:!0,insertion:o,proxy:o,scrollLeft:0,scrollTop:0,nocache:!1,loader:!0,headers:{}})t&&n in t&&(r[n]=t[n]);t.linkSelector+=L,t.formSelector+=L,t=o,/^(interactive|complete)$/.test(c.readyState)?q():c.addEventListener("DOMContentLoaded",q)}},request:function(e,t){v&&X(e,t.replace?2:1,t.method,t.data,o,r)},on:function(e,t){M(e,t)},off:function(e,t){M(e,t,!0)}}}();