ajaxify 8.1.5 → 8.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/ajaxify.js CHANGED
@@ -15,6 +15,15 @@ Ajaxifies the whole site, dynamically replacing the elements specified in "eleme
15
15
 
16
16
  */
17
17
 
18
+ let $;
19
+
20
+ //Module global helpers
21
+ let rootUrl = location.origin, inlineclass = "ajy-inline",
22
+ bdy,
23
+ qa=(s,o=document)=>o.querySelectorAll(s),
24
+ qs=(s,o=document)=>o.querySelector(s);
25
+
26
+
18
27
  // The main plugin - Ajaxify
19
28
  // Is passed the global options
20
29
  // Checks for necessary pre-conditions - otherwise gracefully degrades
@@ -22,7 +31,7 @@ Ajaxifies the whole site, dynamically replacing the elements specified in "eleme
22
31
  // Calls Pronto
23
32
  class Ajaxify { constructor(options) {
24
33
  String.prototype.iO = function(s) { return this.toString().indexOf(s) + 1; }; //Intuitively better understandable shorthand for String.indexOf() - String.iO()
25
- let $ = this;
34
+ $ = this;
26
35
 
27
36
  //Options default values
28
37
  $.s = {
@@ -43,11 +52,10 @@ $.s = {
43
52
  asyncdef : true, // default async value for dynamically inserted external scripts, false = synchronous / true = asynchronous
44
53
  alwayshints : false, // strings, - separated by ", " - if matched in any external script URL - these are always loaded on every page load
45
54
  inline : true, // true = all inline scripts loaded, false = only specific inline scripts are loaded
46
- inlinesync : true, // synchronise inline scripts loading by adding a central tiny delay to all of them
47
55
  inlinehints : false, // strings - separated by ", " - if matched in any inline scripts - only these are executed - set "inline" to false beforehand
48
56
  inlineskip : "adsbygoogle", // strings - separated by ", " - if matched in any inline scripts - these are NOT are executed - set "inline" to true beforehand
49
57
  inlineappend : true, // append scripts to the main content element, instead of "eval"-ing them
50
- intevents: true, // intercept events that are fired only on classic page load and simulate their trigger on ajax page load ("DOMContentLoaded", "load")
58
+ intevents: true, // intercept events that are fired only on classic page load and simulate their trigger on ajax page load ("DOMContentLoaded")
51
59
  style : true, // true = all style tags in the head loaded, false = style tags on target page ignored
52
60
  prefetchoff : false, // Plugin pre-fetches pages on hoverIntent - true = set off completely // strings - separated by ", " - hints to select out
53
61
 
@@ -62,36 +70,13 @@ $.s = {
62
70
 
63
71
  $.pass = 0; $.currentURL = ""; $.h = {};
64
72
  $.parse = (s, pl) => (pl = document.createElement('div'), pl.insertAdjacentHTML('afterbegin', s), pl.firstElementChild); // HTML parser
65
- $.trigger = (t, e) => { let ev = document.createEvent('HTMLEvents'); ev.initEvent("pronto." + t, true, false); ev.data = e ? e : $.Rq("e"); window.dispatchEvent(ev); document.dispatchEvent(ev); }
66
- $.internal = (url) => { if (!url) return false; if (typeof(url) === "object") url = url.href; if (url==="") return true; return url.substring(0,rootUrl.length) === rootUrl || !url.iO(":"); }
73
+ $.trigger = (t, e) => { let ev = document.createEvent('HTMLEvents'); ev.initEvent("pronto." + t, true, false); ev.data = e ? e : $.Rq("e"); window.dispatchEvent(ev); document.dispatchEvent(ev); };
74
+ $.internal = (url) => { if (!url) return false; if (typeof(url) === "object") url = url.href; if (url==="") return true; return url.substring(0,rootUrl.length) === rootUrl || !url.iO(":"); };
67
75
  $.intevents = () => {
68
- let iFn = function (a, b, c = false) { if ((this === document || this === window) && a=="DOMContentLoaded") setTimeout(b); else this.ael(a,b,c);} // if "DOMContentLoaded" - execute function, else - add event listener
76
+ let iFn = function (a, b, c = false) { if ((this === document || this === window) && a=="DOMContentLoaded") setTimeout(b); else this.ael(a,b,c);}; // if "DOMContentLoaded" - execute function, else - add event listener
69
77
  EventTarget.prototype.ael = EventTarget.prototype.addEventListener; // store original method
70
78
  EventTarget.prototype.addEventListener = iFn; // start intercepting event listener addition
71
- }
72
-
73
- //Module global variables
74
- let rootUrl = location.origin, api = window.history && window.history.pushState && window.history.replaceState,
75
-
76
- //Regexes for escaping fetched HTML of a whole page - best of Baluptons Ajaxify
77
- //Makes it possible to pre-fetch an entire page
78
- docType = /<\!DOCTYPE[^>]*>/i,
79
- tagso = /<(html|head|link)([\s\>])/gi,
80
- tagsod = /<(body)([\s\>])/gi,
81
- tagsc = /<\/(html|head|body|link)\>/gi,
82
-
83
- //Helper strings
84
- div12 = '<div class="ajy-$1"$2',
85
- divid12 = '<div id="ajy-$1"$2',
86
- linki = '<link rel="stylesheet" type="text/css" href="*" />',
87
- linkr = 'link[href*="!"]',
88
- scrr = 'script[src*="!"]',
89
- inlineclass = "ajy-inline";
90
-
91
- //Global helpers
92
- let doc=document, bdy,
93
- qa=(s,o=doc)=>o.querySelectorAll(s),
94
- qs=(s,o=doc)=>o.querySelector(s);
79
+ };
95
80
 
96
81
  function _copyAttributes(el, $S, flush) { //copy all attributes of element generically
97
82
  if (flush) [...el.attributes].forEach(e => el.removeAttribute(e.name)); //delete all old attributes
@@ -117,71 +102,6 @@ class Hints { constructor(h) { let _ = this;
117
102
 
118
103
  function lg(m){ $.s.verbosity && console && console.log(m); }
119
104
 
120
- // The stateful Cache class
121
- // Usage - parameter "o" values:
122
- // none - returns currently cached page
123
- // <URL> - returns page with specified URL
124
- // <object> - saves the page in cache
125
- // f - flushes the cache
126
- class Cache { constructor() {
127
- let d = false;
128
-
129
- this.a = function (o) {
130
- if (!o) return d;
131
-
132
- if (typeof o === "string") { //URL or "f" passed
133
- if(o === "f") { //"f" passed -> flush
134
- $.pages("f"); //delegate flush to $.pages
135
- lg("Cache flushed");
136
- } else d = $.pages($.memory(o)); //URL passed -> look up page in memory
137
-
138
- return d; //return cached page
139
- }
140
-
141
- if (typeof o === "object") {
142
- d = o;
143
- return d;
144
- }
145
- };
146
- }}
147
-
148
- // The stateful Memory class
149
- // Usage: $.memory(<URL>) - returns the same URL if not turned off internally
150
- class Memory { constructor(options) {
151
- $.h.memoryoff = new Hints($.s.memoryoff);
152
-
153
- this.a = function (h) {
154
- if (!h || $.s.memoryoff === true) return false;
155
- if ($.s.memoryoff === false) return h;
156
- return $.h.memoryoff.find(h) ? false : h;
157
- };
158
- }}
159
-
160
- // The stateful Pages class
161
- // Usage - parameter "h" values:
162
- // <URL> - returns page with specified URL from internal array
163
- // <object> - saves the passed page in internal array
164
- // false - returns false
165
- class Pages { constructor() {
166
- let d = [], i = -1;
167
-
168
- this.a = function (h) {
169
- if (typeof h === "string") {
170
- if(h === "f") d = [];
171
- else if((i=_iPage(h)) !== -1) return d[i][1];
172
- }
173
-
174
- if (typeof h === "object") {
175
- if((i=_iPage(h[0])) === -1) d.push(h);
176
- else d[i] = h;
177
- }
178
-
179
- if (typeof h === "boolean") return false;
180
- };
181
-
182
- let _iPage = h => d.findIndex(e => e[0] == h)
183
- }}
184
-
185
105
  // The GetPage class
186
106
  // First parameter (o) is a switch:
187
107
  // empty - returns cache
@@ -192,10 +112,21 @@ class Pages { constructor() {
192
112
  // otherwise - returns selection of current page to client
193
113
 
194
114
  class GetPage { constructor() {
195
- let rsp = 0, cb = 0, plus = 0, rt = "", ct = 0, rc = 0, ac = 0;
196
-
115
+ let rsp = 0, cb = 0, plus = 0, rt = "", ct = 0, rc = 0, ac = 0,
116
+
117
+ //Regexes for escaping fetched HTML of a whole page - best of Baluptons Ajaxify
118
+ //Makes it possible to pre-fetch an entire page
119
+ docType = /<\!DOCTYPE[^>]*>/i,
120
+ tagso = /<(html|head|link)([\s\>])/gi,
121
+ tagsod = /<(body)([\s\>])/gi,
122
+ tagsc = /<\/(html|head|body|link)\>/gi,
123
+
124
+ //Helper strings
125
+ div12 = '<div class="ajy-$1"$2',
126
+ divid12 = '<div id="ajy-$1"$2';
127
+
197
128
  this.a = function (o, p, p2) {
198
- if (!o) return $.cache();
129
+ if (!o) return $.cache.g();
199
130
 
200
131
  if (o.iO("/")) {
201
132
  cb = p;
@@ -214,11 +145,11 @@ class GetPage { constructor() {
214
145
  if (o === "-") return _lSel(p);
215
146
  if (o === "x") return rsp;
216
147
 
217
- if (!$.cache()) return;
218
- if (o === "body") return qs("#ajy-" + o, $.cache());
219
- if (o === "script") return qa(o, $.cache());
148
+ if (!$.cache.g()) return;
149
+ if (o === "body") return qs("#ajy-" + o, $.cache.g());
150
+ if (o === "script") return qa(o, $.cache.g());
220
151
 
221
- return qs((o === "title") ? o : ".ajy-" + o, $.cache());
152
+ return qs((o === "title") ? o : ".ajy-" + o, $.cache.g());
222
153
  };
223
154
  let _lSel = $t => (
224
155
  $.pass++,
@@ -230,18 +161,13 @@ let _lSel = $t => (
230
161
  ),
231
162
  _lPage = (h, pre) => {
232
163
  if (h.iO("#")) h = h.split("#")[0];
233
- if ($.Rq("is") || !$.cache(h)) return _lAjax(h, pre);
164
+ if ($.Rq("is") || !$.cache.l(h)) return _lAjax(h, pre);
234
165
 
235
166
  plus = 0;
236
167
  if (cb) return cb();
237
168
  },
238
169
  _ld = ($t, $h) => {
239
- if(!$h) {
240
- lg("Inserting placeholder for ID: " + $t.getAttribute("id"));
241
- var tagN = $t.tagName.toLowerCase();
242
- $t.parentNode.replaceChild($.parse("<" + tagN + " id='" + $t.getAttribute("id") + "'></" + tagN + ">"), $t);
243
- return;
244
- }
170
+ if(!$h) return; //no input
245
171
 
246
172
  var $c = $h.cloneNode(true); // clone element node (true = deep clone)
247
173
  qa("script", $c).forEach(e => e.parentNode.removeChild(e));
@@ -249,10 +175,10 @@ let _lSel = $t => (
249
175
  $t.innerHTML = $c.innerHTML;
250
176
  },
251
177
  _lEls = $t =>
252
- $.cache() && !_isBody($t) && $t.forEach(function($el) {
253
- _ld($el, qs("#" + $el.getAttribute("id"), $.cache()));
178
+ $.cache.g() && !_isBody($t) && $t.forEach(function($el) {
179
+ _ld($el, qs("#" + $el.getAttribute("id"), $.cache.g()));
254
180
  }),
255
- _isBody = $t => $t[0].tagName.toLowerCase() == "body" && (_ld(bdy, qs("#ajy-body", $.cache())), 1),
181
+ _isBody = $t => $t[0].tagName.toLowerCase() == "body" && (_ld(bdy, qs("#ajy-body", $.cache.g())), 1),
256
182
  _lAjax = (hin, pre) => {
257
183
  var ispost = $.Rq("is");
258
184
  if (pre) rt="p"; else rt="c";
@@ -289,7 +215,7 @@ let _lSel = $t => (
289
215
  }).finally(() => rc--); // reset active request counter
290
216
  },
291
217
  _cl = c => (plus = 0, (!c) ? cb = 0 : 0), // clear plus AND/OR callback
292
- _cache = (href, h, err) => $.cache($.parse(_parseHTML(h))) && ($.pages([href, $.cache()]), 1) && cb && cb(err),
218
+ _cache = (href, h, err) => $.cache.s($.parse(_parseHTML(h))) && ($.pages.p([href, $.cache.g()]), 1) && cb && cb(err),
293
219
  _isHtml = x => (ct = x.headers.get("content-type")) && (ct.iO("html") || ct.iO("form-")),
294
220
  _parseHTML = h => document.createElement("html").innerHTML = _replD(h).trim(),
295
221
  _replD = h => String(h).replace(docType, "").replace(tagso, div12).replace(tagsod, divid12).replace(tagsc, "</div>")
@@ -306,7 +232,7 @@ class Scripts { constructor() {
306
232
  $.h.inlinehints = new Hints($.s.inlinehints);
307
233
  $.h.inlineskip = new Hints($.s.inlineskip);
308
234
 
309
- this.a = function (o) {
235
+ this.a = function (o) {
310
236
  if (o === "i") {
311
237
  if(!$s) $s = {};
312
238
  return true;
@@ -349,7 +275,7 @@ let _allstyle = $s =>
349
275
  return qs("body").appendChild(sc);
350
276
  },
351
277
  _addstyle = t => qs("head").appendChild($.parse('<style>' + t + '</style>')),
352
- _addScripts = $s => ( $.addAll($s.c, "href"), $.s.inlinesync ? setTimeout(() => $.addAll($s.j, "src")) : $.addAll($s.j, "src"))
278
+ _addScripts = $s => ($.addAll($s.c, "href"), $.addAll($s.j, "src"))
353
279
  }}
354
280
 
355
281
  // The DetScripts plugin - stands for "detach scripts"
@@ -380,7 +306,11 @@ let _rel = (lk, v) => Array.prototype.filter.call(lk, e => e.getAttribute("rel")
380
306
  // href - operate on stylesheets in the new selection
381
307
  // src - operate on JS scripts
382
308
  class AddAll { constructor() {
383
- let $scriptsO = [], $sCssO = [], $sO = [], PK = 0, url = 0;
309
+ let $scriptsO = [], $sCssO = [], $sO = [], PK = 0, url = 0,
310
+ linki = '<link rel="stylesheet" type="text/css" href="*" />',
311
+ linkr = 'link[href*="!"]',
312
+ scrr = 'script[src*="!"]';
313
+
384
314
  $.h.alwayshints = new Hints($.s.alwayshints);
385
315
 
386
316
  this.a = function ($this, pk) {
@@ -566,7 +496,7 @@ class Frms { constructor() {
566
496
 
567
497
  q.preventDefault(); //prevent default form action
568
498
  return(false); //success -> disable default behaviour
569
- })
499
+ });
570
500
  });
571
501
  });
572
502
  };
@@ -647,22 +577,6 @@ class Scrolly { constructor() {
647
577
  let _scrll = o => setTimeout(() => window.scrollTo(0, o), 10) //delay of 10 milliseconds on all scroll effects
648
578
  }}
649
579
 
650
- // The hApi plugin - manages operations on the History API centrally
651
- // Second parameter (p) - set global currentURL
652
- // Switch (o) values:
653
- // = - perform a replaceState, using currentURL
654
- // otherwise - perform a pushState, using currentURL
655
- class HApi { constructor() {
656
-
657
- this.a = function (o, p) {
658
- if(!o) return; //ensure operator
659
- if(p) $.currentURL = p; //if p given -> update current URL
660
-
661
- if(o === "=") history.replaceState({ url: $.currentURL }, "state-" + $.currentURL, $.currentURL); //perform replaceState
662
- else if ($.currentURL !== window.location.href) history.pushState({ url: $.currentURL }, "state-" + $.currentURL, $.currentURL); //perform pushState
663
- };
664
- }}
665
-
666
580
  // The Pronto plugin - Pronto variant of Ben Plum's Pronto plugin - low level event handling in general
667
581
  // Works on a selection, passed to Pronto by the selection, which specifies, which elements to Ajaxify
668
582
  // Switch (h) values:
@@ -684,7 +598,7 @@ class Pronto { constructor() {
684
598
  if($.s.idleTime) $.slides = new classSlides($).a; //initialise optional slideshow sub-plugin
685
599
  $.scrolly = new Scrolly().a; //initialise scroll effects sub-plugin
686
600
  $.offsets = new Offsets().a;
687
- $.hApi = new HApi().a;
601
+ $.hApi = new HApi();
688
602
  _init_p(); //initialise Pronto sub-plugin
689
603
  return $this; //return query selector for chaining
690
604
  }
@@ -701,7 +615,7 @@ class Pronto { constructor() {
701
615
  }
702
616
  };
703
617
  let _init_p = () => {
704
- $.hApi("=", window.location.href);
618
+ $.hApi.r(window.location.href);
705
619
  window.addEventListener("popstate", _onPop);
706
620
  if ($.s.prefetchoff !== true) {
707
621
  _on("mouseenter", $.s.selector, _preftime); // start prefetch timeout
@@ -734,13 +648,13 @@ let _init_p = () => {
734
648
  if(!href || _exoticKey(t)) return;
735
649
  if(href.substr(-1) ==="#") return true;
736
650
  if(_hashChange()) {
737
- $.hApi("=", href);
651
+ $.hApi.r(href);
738
652
  return true;
739
653
  }
740
654
 
741
655
  $.scrolly("+");
742
656
  _stopBubbling(e);
743
- if($.Rq("=")) $.hApi("=");
657
+ if($.Rq("=")) $.hApi.r();
744
658
  if($.s.refresh || !$.Rq("=")) _request(notPush);
745
659
  },
746
660
  _request = notPush => {
@@ -782,7 +696,7 @@ let _init_p = () => {
782
696
  var href = $.Rq("h"), title;
783
697
  href = $.Rq("c", href);
784
698
 
785
- $.hApi($.Rq("p") ? "+" : "=", href);
699
+ if($.Rq("p")) $.hApi.p(href); else $.hApi.r(href);
786
700
  if(title = $.fn("title")) qs("title").innerHTML = title.innerHTML;
787
701
  $.Rq("C", $.fn("-", $gthis));
788
702
  $.frms("a");
@@ -823,7 +737,7 @@ $.init = () => {
823
737
 
824
738
  let run = () => {
825
739
  $.s = Object.assign($.s, options);
826
- $.pages = new Pages().a;
740
+ ($.pages = new Pages()).f();
827
741
  $.pronto = new Pronto().a;
828
742
  if (load()) {
829
743
  $.pronto($.s.elements, "i");
@@ -831,7 +745,7 @@ let run = () => {
831
745
  }
832
746
  },
833
747
  load = () => {
834
- if (!api || !$.s.pluginon) {
748
+ if (!(window.history && window.history.pushState && window.history.replaceState) || !$.s.pluginon) {
835
749
  lg("Gracefully exiting...");
836
750
  return false;
837
751
  }
@@ -841,13 +755,48 @@ let run = () => {
841
755
  if ($.s.intevents) $.intevents(); // intercept events
842
756
  $.scripts = new Scripts().a;
843
757
  $.scripts("i");
844
- $.cache = new Cache().a;
845
- $.memory = new Memory().a;
758
+ $.cache = new Cache();
759
+ $.memory = new Memory(); $.h.memoryoff = new Hints($.s.memoryoff);
846
760
  $.fn = $.getPage = new GetPage().a;
847
761
  $.detScripts = new DetScripts().a;
848
762
  $.addAll = new AddAll().a;
849
763
  $.Rq = new RQ().a;
850
764
  return true;
851
- }
765
+ };
852
766
  $.init(); // initialize Ajaxify on definition
853
- }}
767
+ }}
768
+
769
+ // The stateful Cache class
770
+ // this.d = entire current page (as an object)
771
+ class Cache {
772
+ g(){ return this.d } //getter
773
+ s(v){ return this.d = v } //setter
774
+ l(u){ let v = $.memory.l(u); return this.s(v === false ? v : $.pages.l(v)) } //lookup URL and load
775
+ }
776
+
777
+ // The stateful Memory class
778
+ // Usage: $.memory.l(<URL>) - returns the same URL if not turned off internally
779
+ class Memory {
780
+ l(h) {
781
+ if (!h || $.s.memoryoff === true) return false;
782
+ if ($.s.memoryoff === false) return h;
783
+ return $.h.memoryoff.find(h) ? false : h;
784
+ }
785
+ }
786
+
787
+ // The stateful Pages class
788
+ // this.d = Array of pages - [0] = URL // [1] = reference to whole page
789
+ class Pages {
790
+ f(){ this.d = [] } //flush
791
+ l(u){ if (this.P(u)) return this.d[this.i][1] } //lookup URL and return page
792
+ p(o){ if(this.P(o[0])) this.d[this.i]=o; else this.d.push(o) } //update or push page passed as an object
793
+ P(u){ return (this.i = this.d.findIndex(e => e[0] == u)) + 1 } //lookup page index and store in "i"
794
+ }
795
+
796
+ // The HAPi class
797
+ // operates on $.currentURL - manages operations on the History API centrally(replaceState / pushState)
798
+ class HApi {
799
+ r(h) { let c = this.u(h); history.replaceState({ url: c }, "state-" + c, c); } //perform replaceState
800
+ p(h) { let c = this.u(h); if (c !== window.location.href) history.pushState({ url: c }, "state-" + c, c); } //perform pushState
801
+ u(h) { if(h) $.currentURL = h; return $.currentURL; } //update currentURL if given and return always
802
+ }
package/ajaxify.min.js CHANGED
@@ -1 +1 @@
1
- class Ajaxify{constructor(options){String.prototype.iO=function(t){return this.toString().indexOf(t)+1};let $=this;$.s={elements:"body",selector:"a:not(.no-ajaxy)",forms:"form:not(.no-ajaxy)",canonical:!1,refresh:!1,requestDelay:0,scrolltop:"s",bodyClasses:!1,deltas:!0,asyncdef:!0,alwayshints:!1,inline:!0,inlinesync:!0,inlinehints:!1,inlineskip:"adsbygoogle",inlineappend:!0,intevents:!0,style:!0,prefetchoff:!1,verbosity:0,memoryoff:!1,cb:0,pluginon:!0,passCount:!1},$.pass=0,$.currentURL="",$.h={},$.parse=((t,e)=>(e=document.createElement("div"),e.insertAdjacentHTML("afterbegin",t),e.firstElementChild)),$.trigger=((t,e)=>{let r=document.createEvent("HTMLEvents");r.initEvent("pronto."+t,!0,!1),r.data=e||$.Rq("e"),window.dispatchEvent(r),document.dispatchEvent(r)}),$.internal=(t=>!!t&&("object"==typeof t&&(t=t.href),""===t||(t.substring(0,rootUrl.length)===rootUrl||!t.iO(":")))),$.intevents=(()=>{EventTarget.prototype.ael=EventTarget.prototype.addEventListener,EventTarget.prototype.addEventListener=function(t,e,r=!1){this!==document&&this!==window||"DOMContentLoaded"!=t?this.ael(t,e,r):setTimeout(e)}});let rootUrl=location.origin,api=window.history&&window.history.pushState&&window.history.replaceState,docType=/<\!DOCTYPE[^>]*>/i,tagso=/<(html|head|link)([\s\>])/gi,tagsod=/<(body)([\s\>])/gi,tagsc=/<\/(html|head|body|link)\>/gi,div12='<div class="ajy-$1"$2',divid12='<div id="ajy-$1"$2',linki='<link rel="stylesheet" type="text/css" href="*" />',linkr='link[href*="!"]',scrr='script[src*="!"]',inlineclass="ajy-inline",doc=document,bdy,qa=(t,e=doc)=>e.querySelectorAll(t),qs=(t,e=doc)=>e.querySelector(t);function _copyAttributes(t,e,r){r&&[...t.attributes].forEach(e=>t.removeAttribute(e.name)),[...e.attributes].forEach(e=>t.setAttribute(e.nodeName,e.nodeValue))}function _on(t,e,r,n=document){n.addEventListener(t,function(t){for(var n=t.target;n&&n!=this;n=n.parentNode)if(n.matches(e)){r(n,t);break}},!!t.iO("mo"))}class Hints{constructor(t){let e=this;e.list="string"==typeof t&&t.length>0&&t.split(", "),e.find=(t=>!(!t||!e.list)&&e.list.some(e=>t.iO(e)))}}function lg(t){$.s.verbosity&&console&&console.log(t)}class Cache{constructor(){let t=!1;this.a=function(e){return e?"string"==typeof e?("f"===e?($.pages("f"),lg("Cache flushed")):t=$.pages($.memory(e)),t):"object"==typeof e?t=e:void 0:t}}}class Memory{constructor(t){$.h.memoryoff=new Hints($.s.memoryoff),this.a=function(t){return!(!t||!0===$.s.memoryoff)&&(!1===$.s.memoryoff?t:!$.h.memoryoff.find(t)&&t)}}}class Pages{constructor(){let t=[],e=-1;this.a=function(n){if("string"==typeof n)if("f"===n)t=[];else if(-1!==(e=r(n)))return t[e][1];if("object"==typeof n&&(-1===(e=r(n[0]))?t.push(n):t[e]=n),"boolean"==typeof n)return!1};let r=e=>t.findIndex(t=>t[0]==e)}}class GetPage{constructor(){let t=0,e=0,r=0,n="",s=0,i=0,o=0;this.a=function(s,l,d){if(!s)return $.cache();if(s.iO("/")){if(e=l,r==s)return;return c(s)}if("+"===s)return r=l,e=d,c(l,!0);if("a"!==s){if("s"===s)return(i?1:0)+n;if("-"===s)return a(l);if("x"===s)return t;if($.cache())return"body"===s?qs("#ajy-"+s,$.cache()):"script"===s?qa(s,$.cache()):qs("title"===s?s:".ajy-"+s,$.cache())}else i>0&&(p(),o.abort())};let a=t=>($.pass++,d(t),qa("body > script").forEach(t=>!!t.classList.contains(inlineclass)&&t.parentNode.removeChild(t)),$.scripts(!0),$.scripts("s"),$.scripts("c")),c=(t,n)=>(t.iO("#")&&(t=t.split("#")[0]),$.Rq("is")||!$.cache(t)?u(t,n):(r=0,e?e():void 0)),l=(t,e)=>{if(e){var r=e.cloneNode(!0);qa("script",r).forEach(t=>t.parentNode.removeChild(t)),_copyAttributes(t,r,!0),t.innerHTML=r.innerHTML}else{lg("Inserting placeholder for ID: "+t.getAttribute("id"));var n=t.tagName.toLowerCase();t.parentNode.replaceChild($.parse("<"+n+" id='"+t.getAttribute("id")+"'></"+n+">"),t)}},d=t=>$.cache()&&!f(t)&&t.forEach(function(t){l(t,qs("#"+t.getAttribute("id"),$.cache()))}),f=t=>"body"==t[0].tagName.toLowerCase()&&(l(bdy,qs("#ajy-body",$.cache())),1),u=(e,r)=>{var s=$.Rq("is");n=r?"p":"c",o=new AbortController,i++,fetch(e,{method:s?"POST":"GET",cache:"default",mode:"same-origin",headers:{"X-Requested-With":"XMLHttpRequest"},body:s?$.Rq("d"):null,signal:o.signal}).then(n=>{if(n.ok&&y(n))return t=n,n.text();r||(location.href=e,p(),$.pronto(0,$.currentURL))}).then(r=>{if(p(1),r)return t.responseText=r,h(e,r)}).catch(t=>{if("AbortError"!==t.name)try{return $.trigger("error",t),lg("Response text : "+t.message),h(e,t.message,t)}catch(t){}}).finally(()=>i--)},p=t=>(r=0,t?0:e=0),h=(t,r,n)=>$.cache($.parse(g(r)))&&($.pages([t,$.cache()]),1)&&e&&e(n),y=t=>(s=t.headers.get("content-type"))&&(s.iO("html")||s.iO("form-")),g=t=>document.createElement("html").innerHTML=m(t).trim(),m=t=>String(t).replace(docType,"").replace(tagso,div12).replace(tagsod,divid12).replace(tagsc,"</div>")}}class Scripts{constructor(){let $s=!1,txt=0;$.h.inlinehints=new Hints($.s.inlinehints),$.h.inlineskip=new Hints($.s.inlineskip),this.a=function(t){return"i"===t?($s||($s={}),!0):"s"===t?_allstyle($s.y):"1"===t?($.detScripts($s),_addScripts($s)):"c"===t?!(!$.s.canonical||!$s.can)&&$s.can.getAttribute("href"):"d"===t?$.detScripts($s):t&&"object"==typeof t?_onetxt(t):void($.scripts("d")||_addScripts($s))};let _allstyle=t=>!$.s.style||!t||(qa("style",qs("head")).forEach(t=>t.parentNode.removeChild(t)),t.forEach(t=>_addstyle(t.textContent))),_onetxt=t=>!(txt=t.textContent).iO(").ajaxify(")&&!txt.iO("new Ajaxify(")&&($.s.inline&&!$.h.inlineskip.find(txt)||t.classList.contains("ajaxy")||$.h.inlinehints.find(txt))&&_addtxt(t),_addtxt=$s=>{if(txt&&txt.length){if($.s.inlineappend||$s.getAttribute("type")&&!$s.getAttribute("type").iO("text/javascript"))try{return _apptxt($s)}catch(t){}try{eval(txt)}catch(t){lg("Error in inline script : "+txt+"\nError code : "+t)}}},_apptxt=t=>{let e=document.createElement("script");_copyAttributes(e,t),e.classList.add(inlineclass);try{e.appendChild(document.createTextNode(t.textContent))}catch(r){e.text=t.textContent}return qs("body").appendChild(e)},_addstyle=t=>qs("head").appendChild($.parse("<style>"+t+"</style>")),_addScripts=t=>($.addAll(t.c,"href"),$.s.inlinesync?setTimeout(()=>$.addAll(t.j,"src")):$.addAll(t.j,"src"))}}class DetScripts{constructor(){let t=0,e=0,r=0;this.a=function(s){if(!(t=$.pass?$.fn("head"):qs("head")))return!0;e=qa($.pass?".ajy-link":"link",t),r=$.pass?$.fn("script"):qa("script"),s.c=n(e,"stylesheet"),s.y=qa("style",t),s.can=n(e,"canonical"),s.j=r};let n=(t,e)=>Array.prototype.filter.call(t,t=>t.getAttribute("rel").iO(e))}}class AddAll{constructor(){let t=[],e=[],r=[],n=0,s=0;$.h.alwayshints=new Hints($.s.alwayshints),this.a=function(d,f){if(d.length){if("n"===$.s.deltas)return!0;if(n=f,!$.s.deltas)return i(d);t="href"==n?e:r,$.pass?d.forEach(function(e){var r=e;if(s=r.getAttribute(n),a(r))return l(),void c(r);s?t.some(t=>t==s)||(t.push(s),c(r)):"href"==n||r.classList.contains("no-ajaxy")||$.scripts(r)}):o(d)}};let i=t=>t.forEach(t=>c(t)),o=e=>e.forEach(e=>(s=e.getAttribute(n))?t.push(s):0),a=t=>"always"==t.getAttribute("data-class")||$.h.alwayshints.find(s),c=t=>{if(s=t.getAttribute(n),"href"==n)return qs("head").appendChild($.parse(linki.replace("*",s)));if(!s)return $.scripts(t);var e=document.createElement("script");e.async=$.s.asyncdef,_copyAttributes(e,t),qs("head").appendChild(e)},l=()=>qa(("href"==n?linkr:scrr).replace("!",s)).forEach(t=>t.parentNode.removeChild(t))}}class RQ{constructor(){let t=0,e=0,r=0,n=0,s=0,i=0,o=!1;this.a=function(c,l,d){if("="===c)return l?i===$.currentURL||i===o:i===$.currentURL;if("!"===c)return o=i;if("?"===c){let t=$.fn("s");return t.iO("0")||l||$.fn("a"),"1c"===t&&l?!1:("1p"===t&&l&&(!$.s.memoryoff||$.fn("a")),!0)}if("v"===c){if(!l)return!1;if(a(l,d),!$.internal(i))return!1;c="i"}return"i"===c?(t=!1,e=null,r=!0,n=!1,i):"h"===c?(l&&("string"==typeof l&&(s=0),i=l.href?l.href:l),i):"e"===c?(l&&a(l,d),s||i):"p"===c?(void 0!==l&&(r=l),r):"is"===c?(void 0!==l&&(t=l),t):"d"===c?(l&&(e=l),e):"C"===c?(void 0!==l&&(n=l),n):"c"===c?!n||n===l||l.iO("#")||l.iO("?")?l:n:void 0};let a=(t,e)=>i="string"!=typeof(s=t)?s.currentTarget&&s.currentTarget.href||e&&e.href||s.currentTarget.action||s.originalEvent.state.url:s}}class Frms{constructor(){let t=0,e=0;this.a=function(s,i){$.s.forms&&s&&("d"===s&&(e=i),"a"===s&&e.forEach(e=>{Array.prototype.filter.call(qa($.s.forms,e),function(t){let e=t.getAttribute("action");return $.internal(e&&e.length>0?e:$.currentURL)}).forEach(e=>{e.addEventListener("submit",e=>{t=e.target,i=r();var s="get",o=t.getAttribute("method");o.length>0&&"post"==o.toLowerCase()&&(s="post");var a,c=t.getAttribute("action");return a=c&&c.length>0?c:$.currentURL,$.Rq("v",e),"get"==s?a=n(a,i):($.Rq("is",!0),$.Rq("d",i)),$.trigger("submit",a),$.pronto(0,{href:a}),e.preventDefault(),!1})})}))};let r=()=>{let e=new FormData(t),r=qs("input[name][type=submit]",t);return r&&e.append(r.getAttribute("name"),r.value),e},n=(t,e)=>{let r="";for(var[n,s]of(t.iO("?")&&(t=t.substring(0,t.iO("?"))),e.entries()))r+=`${n}=${encodeURIComponent(s)}&`;return`${t}?${r.slice(0,-1)}`}}}class Offsets{constructor(){let t=[],e=-1;this.a=function(n){if("string"==typeof n)return n=n.iO("?")?n.split("?")[0]:n,-1===(e=r(n))?0:t[e][1];var s=$.currentURL,i=s.iO("?")?s.split("?")[0]:s,o=i.iO("#")?i.split("#")[0]:i,a=[o,document.documentElement&&document.documentElement.scrollTop||document.body.scrollTop];-1===(e=r(o))?t.push(a):t[e]=a};let r=e=>t.findIndex(t=>t[0]==e)}}class Scrolly{constructor(){"scrollRestoration"in history&&(history.scrollRestoration="manual"),this.a=function(e){if(e){var r=e;if("+"!==e&&"!"!==e||(e=$.currentURL),"+"!==r&&e.iO("#")&&e.iO("#")<e.length-1){let r=qs("#"+e.split("#")[1]);if(!r)return;let n=r.getBoundingClientRect();t(n.top+window.pageYOffset-document.documentElement.clientTop)}else{if("s"===$.s.scrolltop)return"+"===r&&$.offsets(),void("!"===r&&t($.offsets(e)));"+"!==r&&$.s.scrolltop&&t(0)}}};let t=t=>setTimeout(()=>window.scrollTo(0,t),10)}}class HApi{constructor(){this.a=function(t,e){t&&(e&&($.currentURL=e),"="===t?history.replaceState({url:$.currentURL},"state-"+$.currentURL,$.currentURL):$.currentURL!==window.location.href&&history.pushState({url:$.currentURL},"state-"+$.currentURL,$.currentURL))}}}class Pronto{constructor(){let t=0,e=0,r=0;$.h.prefetchoff=new Hints($.s.prefetchoff),this.a=function(e,r){if(r)return"i"===r?(bdy=document.body,e.length||(e="body"),t=qa(e),$.frms=(new Frms).a,$.s.idleTime&&($.slides=new classSlides($).a),$.scrolly=(new Scrolly).a,$.offsets=(new Offsets).a,$.hApi=(new HApi).a,n(),e):"object"==typeof r?($.Rq("h",r),void c()):void(r.iO("/")&&($.Rq("h",r),c(!0)))};let n=()=>{$.hApi("=",window.location.href),window.addEventListener("popstate",d),!0!==$.s.prefetchoff&&(_on("mouseenter",$.s.selector,s),_on("mouseleave",$.s.selector,i),_on("touchstart",$.s.selector,o)),_on("click",$.s.selector,a,bdy),$.frms("d",qa("body")),$.frms("a"),$.frms("d",t),$.s.idleTime&&$.slides("i")},s=(t,e)=>(i(),r=setTimeout(()=>o(t,e),150)),i=()=>clearTimeout(r),o=(t,e)=>{if(!0!==$.s.prefetchoff&&$.Rq("?",!0)){var r=$.Rq("v",e,t);$.Rq("=",!0)||!r||$.h.prefetchoff.find(r)||$.fn("+",r,()=>!1)}},a=(t,e,r)=>{if($.Rq("?")){var n=$.Rq("v",e,t);if(n&&!p(t)){if("#"===n.substr(-1))return!0;if(h())return $.hApi("=",n),!0;$.scrolly("+"),(t=>(t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation()))(e),$.Rq("=")&&$.hApi("="),!$.s.refresh&&$.Rq("=")||c(r)}}},c=t=>{$.Rq("!"),t&&$.Rq("p",!1),$.trigger("request"),$.fn($.Rq("h"),t=>{t&&(lg("Error in _request : "+t),$.trigger("error",t)),l()})},l=()=>{$.trigger("beforeload"),$.s.requestDelay?(e&&clearTimeout(e),e=setTimeout(f,$.s.requestDelay)):f()},d=t=>{var e=window.location.href;$.Rq("i"),$.Rq("h",e),$.Rq("p",!1),$.scrolly("+"),e&&e!==$.currentURL&&($.trigger("request"),$.fn(e,l))},f=()=>{if($.trigger("load"),$.s.bodyClasses){var e=$.fn("body").getAttribute("class");bdy.setAttribute("class",e||"")}var r,n=$.Rq("h");n=$.Rq("c",n),$.hApi($.Rq("p")?"+":"=",n),(r=$.fn("title"))&&(qs("title").innerHTML=r.innerHTML),$.Rq("C",$.fn("-",t)),$.frms("a"),$.scrolly("!"),u(n),$.trigger("render"),$.s.passCount&&(qs("#"+$.s.passCount).innerHTML="Pass: "+$.pass),$.s.cb&&$.s.cb()},u=t=>{t="/"+t.replace(rootUrl,""),void 0!==window.ga?window.ga("send","pageview",t):void 0!==window._gaq&&window._gaq.push(["_trackPageview",t])},p=t=>{var e=$.Rq("h"),r=$.Rq("e"),n=r.currentTarget.target||t.target;return r.which>1||r.metaKey||r.ctrlKey||r.shiftKey||r.altKey||"_blank"===n||e.iO("wp-login")||e.iO("wp-admin")},h=()=>{var t=$.Rq("e");return t.hash&&t.href.replace(t.hash,"")===window.location.href.replace(location.hash,"")||t.href===window.location.href+"#"}}}$.init=(()=>{let t=options;return t&&"string"==typeof t?$.pronto(0,t):("complete"===document.readyState||"loading"!==document.readyState&&!document.documentElement.doScroll?run():document.addEventListener("DOMContentLoaded",run),$)});let run=()=>{$.s=Object.assign($.s,options),$.pages=(new Pages).a,$.pronto=(new Pronto).a,load()&&($.pronto($.s.elements,"i"),$.s.deltas&&$.scripts("1"))},load=()=>api&&$.s.pluginon?(lg("Ajaxify loaded..."),$.s.intevents&&$.intevents(),$.scripts=(new Scripts).a,$.scripts("i"),$.cache=(new Cache).a,$.memory=(new Memory).a,$.fn=$.getPage=(new GetPage).a,$.detScripts=(new DetScripts).a,$.addAll=(new AddAll).a,$.Rq=(new RQ).a,!0):(lg("Gracefully exiting..."),!1);$.init()}}
1
+ let $,rootUrl=location.origin,inlineclass="ajy-inline",bdy,qa=(t,e=document)=>e.querySelectorAll(t),qs=(t,e=document)=>e.querySelector(t);class Ajaxify{constructor(options){function _copyAttributes(t,e,r){r&&[...t.attributes].forEach(e=>t.removeAttribute(e.name)),[...e.attributes].forEach(e=>t.setAttribute(e.nodeName,e.nodeValue))}function _on(t,e,r,s=document){s.addEventListener(t,function(t){for(var s=t.target;s&&s!=this;s=s.parentNode)if(s.matches(e)){r(s,t);break}},!!t.iO("mo"))}String.prototype.iO=function(t){return this.toString().indexOf(t)+1},$=this,$.s={elements:"body",selector:"a:not(.no-ajaxy)",forms:"form:not(.no-ajaxy)",canonical:!1,refresh:!1,requestDelay:0,scrolltop:"s",bodyClasses:!1,deltas:!0,asyncdef:!0,alwayshints:!1,inline:!0,inlinehints:!1,inlineskip:"adsbygoogle",inlineappend:!0,intevents:!0,style:!0,prefetchoff:!1,verbosity:0,memoryoff:!1,cb:0,pluginon:!0,passCount:!1},$.pass=0,$.currentURL="",$.h={},$.parse=((t,e)=>(e=document.createElement("div"),e.insertAdjacentHTML("afterbegin",t),e.firstElementChild)),$.trigger=((t,e)=>{let r=document.createEvent("HTMLEvents");r.initEvent("pronto."+t,!0,!1),r.data=e||$.Rq("e"),window.dispatchEvent(r),document.dispatchEvent(r)}),$.internal=(t=>!!t&&("object"==typeof t&&(t=t.href),""===t||(t.substring(0,rootUrl.length)===rootUrl||!t.iO(":")))),$.intevents=(()=>{EventTarget.prototype.ael=EventTarget.prototype.addEventListener,EventTarget.prototype.addEventListener=function(t,e,r=!1){this!==document&&this!==window||"DOMContentLoaded"!=t?this.ael(t,e,r):setTimeout(e)}});class Hints{constructor(t){let e=this;e.list="string"==typeof t&&t.length>0&&t.split(", "),e.find=(t=>!(!t||!e.list)&&e.list.some(e=>t.iO(e)))}}function lg(t){$.s.verbosity&&console&&console.log(t)}class GetPage{constructor(){let t=0,e=0,r=0,s="",n=0,i=0,o=0,a=/<\!DOCTYPE[^>]*>/i,l=/<(html|head|link)([\s\>])/gi,c=/<(body)([\s\>])/gi,d=/<\/(html|head|body|link)\>/gi;this.a=function(n,a,l){if(!n)return $.cache.g();if(n.iO("/")){if(e=a,r==n)return;return u(n)}if("+"===n)return r=a,e=l,u(a,!0);if("a"!==n){if("s"===n)return(i?1:0)+s;if("-"===n)return f(a);if("x"===n)return t;if($.cache.g())return"body"===n?qs("#ajy-"+n,$.cache.g()):"script"===n?qa(n,$.cache.g()):qs("title"===n?n:".ajy-"+n,$.cache.g())}else i>0&&(m(),o.abort())};let f=t=>($.pass++,p(t),qa("body > script").forEach(t=>!!t.classList.contains(inlineclass)&&t.parentNode.removeChild(t)),$.scripts(!0),$.scripts("s"),$.scripts("c")),u=(t,s)=>(t.iO("#")&&(t=t.split("#")[0]),$.Rq("is")||!$.cache.l(t)?g(t,s):(r=0,e?e():void 0)),h=(t,e)=>{if(e){var r=e.cloneNode(!0);qa("script",r).forEach(t=>t.parentNode.removeChild(t)),_copyAttributes(t,r,!0),t.innerHTML=r.innerHTML}},p=t=>$.cache.g()&&!y(t)&&t.forEach(function(t){h(t,qs("#"+t.getAttribute("id"),$.cache.g()))}),y=t=>"body"==t[0].tagName.toLowerCase()&&(h(bdy,qs("#ajy-body",$.cache.g())),1),g=(e,r)=>{var n=$.Rq("is");s=r?"p":"c",o=new AbortController,i++,fetch(e,{method:n?"POST":"GET",cache:"default",mode:"same-origin",headers:{"X-Requested-With":"XMLHttpRequest"},body:n?$.Rq("d"):null,signal:o.signal}).then(s=>{if(s.ok&&q(s))return t=s,s.text();r||(location.href=e,m(),$.pronto(0,$.currentURL))}).then(r=>{if(m(1),r)return t.responseText=r,v(e,r)}).catch(t=>{if("AbortError"!==t.name)try{return $.trigger("error",t),lg("Response text : "+t.message),v(e,t.message,t)}catch(t){}}).finally(()=>i--)},m=t=>(r=0,t?0:e=0),v=(t,r,s)=>$.cache.s($.parse(w(r)))&&($.pages.p([t,$.cache.g()]),1)&&e&&e(s),q=t=>(n=t.headers.get("content-type"))&&(n.iO("html")||n.iO("form-")),w=t=>document.createElement("html").innerHTML=b(t).trim(),b=t=>String(t).replace(a,"").replace(l,'<div class="ajy-$1"$2').replace(c,'<div id="ajy-$1"$2').replace(d,"</div>")}}class Scripts{constructor(){let $s=!1,txt=0;$.h.inlinehints=new Hints($.s.inlinehints),$.h.inlineskip=new Hints($.s.inlineskip),this.a=function(t){return"i"===t?($s||($s={}),!0):"s"===t?_allstyle($s.y):"1"===t?($.detScripts($s),_addScripts($s)):"c"===t?!(!$.s.canonical||!$s.can)&&$s.can.getAttribute("href"):"d"===t?$.detScripts($s):t&&"object"==typeof t?_onetxt(t):void($.scripts("d")||_addScripts($s))};let _allstyle=t=>!$.s.style||!t||(qa("style",qs("head")).forEach(t=>t.parentNode.removeChild(t)),t.forEach(t=>_addstyle(t.textContent))),_onetxt=t=>!(txt=t.textContent).iO(").ajaxify(")&&!txt.iO("new Ajaxify(")&&($.s.inline&&!$.h.inlineskip.find(txt)||t.classList.contains("ajaxy")||$.h.inlinehints.find(txt))&&_addtxt(t),_addtxt=$s=>{if(txt&&txt.length){if($.s.inlineappend||$s.getAttribute("type")&&!$s.getAttribute("type").iO("text/javascript"))try{return _apptxt($s)}catch(t){}try{eval(txt)}catch(t){lg("Error in inline script : "+txt+"\nError code : "+t)}}},_apptxt=t=>{let e=document.createElement("script");_copyAttributes(e,t),e.classList.add(inlineclass);try{e.appendChild(document.createTextNode(t.textContent))}catch(r){e.text=t.textContent}return qs("body").appendChild(e)},_addstyle=t=>qs("head").appendChild($.parse("<style>"+t+"</style>")),_addScripts=t=>($.addAll(t.c,"href"),$.addAll(t.j,"src"))}}class DetScripts{constructor(){let t=0,e=0,r=0;this.a=function(n){if(!(t=$.pass?$.fn("head"):qs("head")))return!0;e=qa($.pass?".ajy-link":"link",t),r=$.pass?$.fn("script"):qa("script"),n.c=s(e,"stylesheet"),n.y=qa("style",t),n.can=s(e,"canonical"),n.j=r};let s=(t,e)=>Array.prototype.filter.call(t,t=>t.getAttribute("rel").iO(e))}}class AddAll{constructor(){let t=[],e=[],r=[],s=0,n=0;$.h.alwayshints=new Hints($.s.alwayshints),this.a=function(d,f){if(d.length){if("n"===$.s.deltas)return!0;if(s=f,!$.s.deltas)return i(d);t="href"==s?e:r,$.pass?d.forEach(function(e){var r=e;if(n=r.getAttribute(s),a(r))return c(),void l(r);n?t.some(t=>t==n)||(t.push(n),l(r)):"href"==s||r.classList.contains("no-ajaxy")||$.scripts(r)}):o(d)}};let i=t=>t.forEach(t=>l(t)),o=e=>e.forEach(e=>(n=e.getAttribute(s))?t.push(n):0),a=t=>"always"==t.getAttribute("data-class")||$.h.alwayshints.find(n),l=t=>{if(n=t.getAttribute(s),"href"==s)return qs("head").appendChild($.parse('<link rel="stylesheet" type="text/css" href="*" />'.replace("*",n)));if(!n)return $.scripts(t);var e=document.createElement("script");e.async=$.s.asyncdef,_copyAttributes(e,t),qs("head").appendChild(e)},c=()=>qa(("href"==s?'link[href*="!"]':'script[src*="!"]').replace("!",n)).forEach(t=>t.parentNode.removeChild(t))}}class RQ{constructor(){let t=0,e=0,r=0,s=0,n=0,i=0,o=!1;this.a=function(l,c,d){if("="===l)return c?i===$.currentURL||i===o:i===$.currentURL;if("!"===l)return o=i;if("?"===l){let t=$.fn("s");return t.iO("0")||c||$.fn("a"),"1c"===t&&c?!1:("1p"===t&&c&&(!$.s.memoryoff||$.fn("a")),!0)}if("v"===l){if(!c)return!1;if(a(c,d),!$.internal(i))return!1;l="i"}return"i"===l?(t=!1,e=null,r=!0,s=!1,i):"h"===l?(c&&("string"==typeof c&&(n=0),i=c.href?c.href:c),i):"e"===l?(c&&a(c,d),n||i):"p"===l?(void 0!==c&&(r=c),r):"is"===l?(void 0!==c&&(t=c),t):"d"===l?(c&&(e=c),e):"C"===l?(void 0!==c&&(s=c),s):"c"===l?!s||s===c||c.iO("#")||c.iO("?")?c:s:void 0};let a=(t,e)=>i="string"!=typeof(n=t)?n.currentTarget&&n.currentTarget.href||e&&e.href||n.currentTarget.action||n.originalEvent.state.url:n}}class Frms{constructor(){let t=0,e=0;this.a=function(n,i){$.s.forms&&n&&("d"===n&&(e=i),"a"===n&&e.forEach(e=>{Array.prototype.filter.call(qa($.s.forms,e),function(t){let e=t.getAttribute("action");return $.internal(e&&e.length>0?e:$.currentURL)}).forEach(e=>{e.addEventListener("submit",e=>{t=e.target,i=r();var n="get",o=t.getAttribute("method");o.length>0&&"post"==o.toLowerCase()&&(n="post");var a,l=t.getAttribute("action");return a=l&&l.length>0?l:$.currentURL,$.Rq("v",e),"get"==n?a=s(a,i):($.Rq("is",!0),$.Rq("d",i)),$.trigger("submit",a),$.pronto(0,{href:a}),e.preventDefault(),!1})})}))};let r=()=>{let e=new FormData(t),r=qs("input[name][type=submit]",t);return r&&e.append(r.getAttribute("name"),r.value),e},s=(t,e)=>{let r="";for(var[s,n]of(t.iO("?")&&(t=t.substring(0,t.iO("?"))),e.entries()))r+=`${s}=${encodeURIComponent(n)}&`;return`${t}?${r.slice(0,-1)}`}}}class Offsets{constructor(){let t=[],e=-1;this.a=function(s){if("string"==typeof s)return s=s.iO("?")?s.split("?")[0]:s,-1===(e=r(s))?0:t[e][1];var n=$.currentURL,i=n.iO("?")?n.split("?")[0]:n,o=i.iO("#")?i.split("#")[0]:i,a=[o,document.documentElement&&document.documentElement.scrollTop||document.body.scrollTop];-1===(e=r(o))?t.push(a):t[e]=a};let r=e=>t.findIndex(t=>t[0]==e)}}class Scrolly{constructor(){"scrollRestoration"in history&&(history.scrollRestoration="manual"),this.a=function(e){if(e){var r=e;if("+"!==e&&"!"!==e||(e=$.currentURL),"+"!==r&&e.iO("#")&&e.iO("#")<e.length-1){let r=qs("#"+e.split("#")[1]);if(!r)return;let s=r.getBoundingClientRect();t(s.top+window.pageYOffset-document.documentElement.clientTop)}else{if("s"===$.s.scrolltop)return"+"===r&&$.offsets(),void("!"===r&&t($.offsets(e)));"+"!==r&&$.s.scrolltop&&t(0)}}};let t=t=>setTimeout(()=>window.scrollTo(0,t),10)}}class Pronto{constructor(){let t=0,e=0,r=0;$.h.prefetchoff=new Hints($.s.prefetchoff),this.a=function(e,r){if(r)return"i"===r?(bdy=document.body,e.length||(e="body"),t=qa(e),$.frms=(new Frms).a,$.s.idleTime&&($.slides=new classSlides($).a),$.scrolly=(new Scrolly).a,$.offsets=(new Offsets).a,$.hApi=new HApi,s(),e):"object"==typeof r?($.Rq("h",r),void l()):void(r.iO("/")&&($.Rq("h",r),l(!0)))};let s=()=>{$.hApi.r(window.location.href),window.addEventListener("popstate",d),!0!==$.s.prefetchoff&&(_on("mouseenter",$.s.selector,n),_on("mouseleave",$.s.selector,i),_on("touchstart",$.s.selector,o)),_on("click",$.s.selector,a,bdy),$.frms("d",qa("body")),$.frms("a"),$.frms("d",t),$.s.idleTime&&$.slides("i")},n=(t,e)=>(i(),r=setTimeout(()=>o(t,e),150)),i=()=>clearTimeout(r),o=(t,e)=>{if(!0!==$.s.prefetchoff&&$.Rq("?",!0)){var r=$.Rq("v",e,t);$.Rq("=",!0)||!r||$.h.prefetchoff.find(r)||$.fn("+",r,()=>!1)}},a=(t,e,r)=>{if($.Rq("?")){var s=$.Rq("v",e,t);if(s&&!h(t)){if("#"===s.substr(-1))return!0;if(p())return $.hApi.r(s),!0;$.scrolly("+"),(t=>(t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation()))(e),$.Rq("=")&&$.hApi.r(),!$.s.refresh&&$.Rq("=")||l(r)}}},l=t=>{$.Rq("!"),t&&$.Rq("p",!1),$.trigger("request"),$.fn($.Rq("h"),t=>{t&&(lg("Error in _request : "+t),$.trigger("error",t)),c()})},c=()=>{$.trigger("beforeload"),$.s.requestDelay?(e&&clearTimeout(e),e=setTimeout(f,$.s.requestDelay)):f()},d=t=>{var e=window.location.href;$.Rq("i"),$.Rq("h",e),$.Rq("p",!1),$.scrolly("+"),e&&e!==$.currentURL&&($.trigger("request"),$.fn(e,c))},f=()=>{if($.trigger("load"),$.s.bodyClasses){var e=$.fn("body").getAttribute("class");bdy.setAttribute("class",e||"")}var r,s=$.Rq("h");s=$.Rq("c",s),$.Rq("p")?$.hApi.p(s):$.hApi.r(s),(r=$.fn("title"))&&(qs("title").innerHTML=r.innerHTML),$.Rq("C",$.fn("-",t)),$.frms("a"),$.scrolly("!"),u(s),$.trigger("render"),$.s.passCount&&(qs("#"+$.s.passCount).innerHTML="Pass: "+$.pass),$.s.cb&&$.s.cb()},u=t=>{t="/"+t.replace(rootUrl,""),void 0!==window.ga?window.ga("send","pageview",t):void 0!==window._gaq&&window._gaq.push(["_trackPageview",t])},h=t=>{var e=$.Rq("h"),r=$.Rq("e"),s=r.currentTarget.target||t.target;return r.which>1||r.metaKey||r.ctrlKey||r.shiftKey||r.altKey||"_blank"===s||e.iO("wp-login")||e.iO("wp-admin")},p=()=>{var t=$.Rq("e");return t.hash&&t.href.replace(t.hash,"")===window.location.href.replace(location.hash,"")||t.href===window.location.href+"#"}}}$.init=(()=>{let t=options;return t&&"string"==typeof t?$.pronto(0,t):("complete"===document.readyState||"loading"!==document.readyState&&!document.documentElement.doScroll?run():document.addEventListener("DOMContentLoaded",run),$)});let run=()=>{$.s=Object.assign($.s,options),($.pages=new Pages).f(),$.pronto=(new Pronto).a,load()&&($.pronto($.s.elements,"i"),$.s.deltas&&$.scripts("1"))},load=()=>window.history&&window.history.pushState&&window.history.replaceState&&$.s.pluginon?(lg("Ajaxify loaded..."),$.s.intevents&&$.intevents(),$.scripts=(new Scripts).a,$.scripts("i"),$.cache=new Cache,$.memory=new Memory,$.h.memoryoff=new Hints($.s.memoryoff),$.fn=$.getPage=(new GetPage).a,$.detScripts=(new DetScripts).a,$.addAll=(new AddAll).a,$.Rq=(new RQ).a,!0):(lg("Gracefully exiting..."),!1);$.init()}}class Cache{g(){return this.d}s(t){return this.d=t}l(t){let e=$.memory.l(t);return this.s(!1===e?e:$.pages.l(e))}}class Memory{l(t){return!(!t||!0===$.s.memoryoff)&&(!1===$.s.memoryoff?t:!$.h.memoryoff.find(t)&&t)}}class Pages{f(){this.d=[]}l(t){if(this.P(t))return this.d[this.i][1]}p(t){this.P(t[0])?this.d[this.i]=t:this.d.push(t)}P(t){return(this.i=this.d.findIndex(e=>e[0]==t))+1}}class HApi{r(t){let e=this.u(t);history.replaceState({url:e},"state-"+e,e)}p(t){let e=this.u(t);e!==window.location.href&&history.pushState({url:e},"state-"+e,e)}u(t){return t&&($.currentURL=t),$.currentURL}}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ajaxify",
3
- "version": "8.1.5",
3
+ "version": "8.1.6",
4
4
  "description": "Ajaxify - The Ajax Plugin",
5
5
  "main": "ajaxify.min.js",
6
6
  "scripts": {