File: //home/lenf4658/www/wp-content/themes/wpmedia/js/infinite-scroll-custom.js
/*! For license information please see infinite-scroll-custom.js.LICENSE.txt */
!function(){var t,e={158:function(t){var e,i;e="undefined"!=typeof window?window:this,i=function(){function t(){}let e=t.prototype;return e.on=function(t,e){if(!t||!e)return this;let i=this._events=this._events||{},n=i[t]=i[t]||[];return n.includes(e)||n.push(e),this},e.once=function(t,e){if(!t||!e)return this;this.on(t,e);let i=this._onceEvents=this._onceEvents||{};return(i[t]=i[t]||{})[e]=!0,this},e.off=function(t,e){let i=this._events&&this._events[t];if(!i||!i.length)return this;let n=i.indexOf(e);return-1!=n&&i.splice(n,1),this},e.emitEvent=function(t,e){let i=this._events&&this._events[t];if(!i||!i.length)return this;i=i.slice(0),e=e||[];let n=this._onceEvents&&this._onceEvents[t];for(let s of i)n&&n[s]&&(this.off(t,s),delete n[s]),s.apply(this,e);return this},e.allOff=function(){return delete this._events,delete this._onceEvents,this},t},t.exports?t.exports=i():e.EvEmitter=i()},47:function(t){var e,i;e=this,i=function(t){let e={extend:function(t,e){return Object.assign(t,e)},modulo:function(t,e){return(t%e+e)%e},makeArray:function(t){return Array.isArray(t)?t:null==t?[]:"object"==typeof t&&"number"==typeof t.length?[...t]:[t]},removeFrom:function(t,e){let i=t.indexOf(e);-1!=i&&t.splice(i,1)},getParent:function(t,e){for(;t.parentNode&&t!=document.body;)if((t=t.parentNode).matches(e))return t},getQueryElement:function(t){return"string"==typeof t?document.querySelector(t):t},handleEvent:function(t){let e="on"+t.type;this[e]&&this[e](t)},filterFindElements:function(t,i){return(t=e.makeArray(t)).filter((t=>t instanceof HTMLElement)).reduce(((t,e)=>{if(!i)return t.push(e),t;e.matches(i)&&t.push(e);let n=e.querySelectorAll(i);return t=t.concat(...n)}),[])},debounceMethod:function(t,e,i){i=i||100;let n=t.prototype[e],s=e+"Timeout";t.prototype[e]=function(){clearTimeout(this[s]);let t=arguments;this[s]=setTimeout((()=>{n.apply(this,t),delete this[s]}),i)}},docReady:function(t){let e=document.readyState;"complete"==e||"interactive"==e?setTimeout(t):document.addEventListener("DOMContentLoaded",t)},toDashed:function(t){return t.replace(/(.)([A-Z])/g,(function(t,e,i){return e+"-"+i})).toLowerCase()}},i=t.console;return e.htmlInit=function(n,s){e.docReady((function(){let o="data-"+e.toDashed(s),l=document.querySelectorAll(`[${o}]`),r=t.jQuery;[...l].forEach((t=>{let e,l=t.getAttribute(o);try{e=l&&JSON.parse(l)}catch(e){return void(i&&i.error(`Error parsing ${o} on ${t.className}: ${e}`))}let h=new n(t,e);r&&r.data(t,s,h)}))}))},e},t.exports?t.exports=i(e):e.fizzyUIUtils=i(e)},163:function(t,e,i){!function(e,n){t.exports?t.exports=n(e,i(717),i(47)):n(e,e.InfiniteScroll,e.fizzyUIUtils)}(window,(function(t,e,i){class n{constructor(t,e){this.element=t,this.infScroll=e,this.clickHandler=this.onClick.bind(this),this.element.addEventListener("click",this.clickHandler),e.on("request",this.disable.bind(this)),e.on("load",this.enable.bind(this)),e.on("error",this.hide.bind(this)),e.on("last",this.hide.bind(this))}onClick(t){t.preventDefault(),this.infScroll.loadNextPage()}enable(){this.element.removeAttribute("disabled")}disable(){this.element.disabled="disabled"}hide(){this.element.style.display="none"}destroy(){this.element.removeEventListener("click",this.clickHandler)}}return e.create.button=function(){let t=i.getQueryElement(this.options.button);t&&(this.button=new n(t,this))},e.destroy.button=function(){this.button&&this.button.destroy()},e.Button=n,e}))},717:function(t,e,i){!function(e,n){t.exports?t.exports=n(e,i(158),i(47)):e.InfiniteScroll=n(e,e.EvEmitter,e.fizzyUIUtils)}(window,(function(t,e,i){let n=t.jQuery,s={};function o(t,e){let l=i.getQueryElement(t);if(l){if((t=l).infiniteScrollGUID){let i=s[t.infiniteScrollGUID];return i.option(e),i}this.element=t,this.options={...o.defaults},this.option(e),n&&(this.$element=n(this.element)),this.create()}}o.defaults={},o.create={},o.destroy={};let l=o.prototype;Object.assign(l,e.prototype);let r=0;l.create=function(){let t=this.guid=++r;if(this.element.infiniteScrollGUID=t,s[t]=this,this.pageIndex=1,this.loadCount=0,this.updateGetPath(),this.getPath&&this.getPath()){this.updateGetAbsolutePath(),this.log("initialized",[this.element.className]),this.callOnInit();for(let t in o.create)o.create[t].call(this)}},l.option=function(t){Object.assign(this.options,t)},l.callOnInit=function(){let t=this.options.onInit;t&&t.call(this,this)},l.dispatchEvent=function(t,e,i){this.log(t,i);let s=e?[e].concat(i):i;if(this.emitEvent(t,s),!n||!this.$element)return;let o=t+=".infiniteScroll";if(e){let i=n.Event(e);i.type=t,o=i}this.$element.trigger(o,i)};let h={initialized:t=>`on ${t}`,request:t=>`URL: ${t}`,load:(t,e)=>`${t.title||""}. URL: ${e}`,error:(t,e)=>`${t}. URL: ${e}`,append:(t,e,i)=>`${i.length} items. URL: ${e}`,last:(t,e)=>`URL: ${e}`,history:(t,e)=>`URL: ${e}`,pageIndex:function(t,e){return`current page determined to be: ${t} from ${e}`}};l.log=function(t,e){if(!this.options.debug)return;let i=`[InfiniteScroll] ${t}`,n=h[t];n&&(i+=". "+n.apply(this,e))},l.updateMeasurements=function(){this.windowHeight=t.innerHeight;let e=this.element.getBoundingClientRect();this.top=e.top+t.scrollY},l.updateScroller=function(){let e=this.options.elementScroll;if(e){if(this.scroller=!0===e?this.element:i.getQueryElement(e),!this.scroller)throw new Error(`Unable to find elementScroll: ${e}`)}else this.scroller=t},l.updateGetPath=function(){let t=this.options.path;if(!t)return;let e=typeof t;"function"!=e?"string"==e&&t.match("{{#}}")?this.updateGetPathTemplate(t):this.updateGetPathSelector(t):this.getPath=t},l.updateGetPathTemplate=function(t){this.getPath=()=>{let e=this.pageIndex+1;return t.replace("{{#}}",e)};let e=t.replace(/(\\\?|\?)/,"\\?").replace("{{#}}","(\\d\\d?\\d?)"),i=new RegExp(e),n=location.href.match(i);n&&(this.pageIndex=parseInt(n[1],10),this.log("pageIndex",[this.pageIndex,"template string"]))};let a=[/^(.*?\/?page\/?)(\d\d?\d?)(.*?$)/,/^(.*?\/?\?page=)(\d\d?\d?)(.*?$)/,/(.*?)(\d\d?\d?)(?!.*\d)(.*?$)/],c=o.getPathParts=function(t){if(t)for(let e of a){let i=t.match(e);if(i){let[,t,e,n]=i;return{begin:t,index:e,end:n}}}};l.updateGetPathSelector=function(t){let e=document.querySelector(t);if(!e)return;let i=e.getAttribute("href"),n=c(i);if(!n)return;let{begin:s,index:o,end:l}=n;this.isPathSelector=!0,this.getPath=()=>s+(this.pageIndex+1)+l,this.pageIndex=parseInt(o,10)-1,this.log("pageIndex",[this.pageIndex,"next link"])},l.updateGetAbsolutePath=function(){let t=this.getPath();if(t.match(/^http/)||t.match(/^\//))return void(this.getAbsolutePath=this.getPath);let{pathname:e}=location,i=t.match(/^\?/),n=e.substring(0,e.lastIndexOf("/")),s=i?e:n+"/";this.getAbsolutePath=()=>s+this.getPath()},o.create.hideNav=function(){let t=i.getQueryElement(this.options.hideNav);t&&(t.style.display="none",this.nav=t)},o.destroy.hideNav=function(){this.nav&&(this.nav.style.display="")},l.destroy=function(){this.allOff();for(let t in o.destroy)o.destroy[t].call(this);delete this.element.infiniteScrollGUID,delete s[this.guid],n&&this.$element&&n.removeData(this.element,"infiniteScroll")},o.throttle=function(t,e){let i,n;return e=e||200,function(){let s=+new Date,o=arguments,l=()=>{i=s,t.apply(this,o)};i&&s<i+e?(clearTimeout(n),n=setTimeout(l,e)):l()}},o.data=function(t){let e=(t=i.getQueryElement(t))&&t.infiniteScrollGUID;return e&&s[e]},o.setJQuery=function(t){n=t},i.htmlInit(o,"infinite-scroll"),l._init=function(){};let{jQueryBridget:u}=t;return n&&u&&u("infiniteScroll",o,n),o}))},774:function(t,e,i){!function(e,n){t.exports?t.exports=n(e,i(717),i(47)):n(e,e.InfiniteScroll,e.fizzyUIUtils)}(window,(function(t,e,i){let n=e.prototype;Object.assign(e.defaults,{history:"replace"});let s=document.createElement("a");return e.create.history=function(){if(!this.options.history)return;s.href=this.getAbsolutePath(),(s.origin||s.protocol+"//"+s.host)==location.origin&&(this.options.append?this.createHistoryAppend():this.createHistoryPageLoad())},n.createHistoryAppend=function(){this.updateMeasurements(),this.updateScroller(),this.scrollPages=[{top:0,path:location.href,title:document.title}],this.scrollPage=this.scrollPages[0],this.scrollHistoryHandler=this.onScrollHistory.bind(this),this.unloadHandler=this.onUnload.bind(this),this.scroller.addEventListener("scroll",this.scrollHistoryHandler),this.on("append",this.onAppendHistory),this.bindHistoryAppendEvents(!0)},n.bindHistoryAppendEvents=function(e){let i=e?"addEventListener":"removeEventListener";this.scroller[i]("scroll",this.scrollHistoryHandler),t[i]("unload",this.unloadHandler)},n.createHistoryPageLoad=function(){this.on("load",this.onPageLoadHistory)},e.destroy.history=n.destroyHistory=function(){this.options.history&&this.options.append&&this.bindHistoryAppendEvents(!1)},n.onAppendHistory=function(t,e,i){if(!i||!i.length)return;let n=i[0],o=this.getElementScrollY(n);s.href=e,this.scrollPages.push({top:o,path:s.href,title:t.title})},n.getElementScrollY=function(e){if(this.options.elementScroll)return e.offsetTop-this.top;return e.getBoundingClientRect().top+t.scrollY},n.onScrollHistory=function(){let t=this.getClosestScrollPage();t!=this.scrollPage&&(this.scrollPage=t,this.setHistory(t.title,t.path))},i.debounceMethod(e,"onScrollHistory",150),n.getClosestScrollPage=function(){let e,i;e=this.options.elementScroll?this.scroller.scrollTop+this.scroller.clientHeight/2:t.scrollY+this.windowHeight/2;for(let t of this.scrollPages){if(t.top>=e)break;i=t}return i},n.setHistory=function(t,e){let i=this.options.history;i&&history[i+"State"]&&(history[i+"State"](null,t,e),this.options.historyTitle&&(document.title=t),this.dispatchEvent("history",null,[t,e]))},n.onUnload=function(){if(0===this.scrollPage.top)return;let e=t.scrollY-this.scrollPage.top+this.top;this.destroyHistory(),scrollTo(0,e)},n.onPageLoadHistory=function(t,e){this.setHistory(t.title,e)},e}))},48:function(t,e,i){var n;window,t.exports&&(t.exports=(n=i(717),i(484),i(610),i(774),i(163),i(792),n))},484:function(t,e,i){!function(e,n){t.exports?t.exports=n(e,i(717)):n(e,e.InfiniteScroll)}(window,(function(t,e){let i=e.prototype;Object.assign(e.defaults,{loadOnScroll:!0,checkLastPage:!0,responseBody:"text",domParseResponse:!0}),e.create.pageLoad=function(){this.canLoad=!0,this.on("scrollThreshold",this.onScrollThresholdLoad),this.on("load",this.checkLastPage),this.options.outlayer&&this.on("append",this.onAppendOutlayer)},i.onScrollThresholdLoad=function(){this.options.loadOnScroll&&this.loadNextPage()};let n=new DOMParser;function s(t){let e=document.createDocumentFragment();return t&&e.append(...t),e}return i.loadNextPage=function(){if(this.isLoading||!this.canLoad)return;let{responseBody:t,domParseResponse:e,fetchOptions:i}=this.options,s=this.getAbsolutePath();this.isLoading=!0,"function"==typeof i&&(i=i());let o=fetch(s,i).then((i=>{if(!i.ok){let t=new Error(i.statusText);return this.onPageError(t,s,i),{response:i}}return i[t]().then((o=>("text"==t&&e&&(o=n.parseFromString(o,"text/html")),204==i.status?(this.lastPageReached(o,s),{body:o,response:i}):this.onPageLoad(o,s,i))))})).catch((t=>{this.onPageError(t,s)}));return this.dispatchEvent("request",null,[s,o]),o},i.onPageLoad=function(t,e,i){return this.options.append||(this.isLoading=!1),this.pageIndex++,this.loadCount++,this.dispatchEvent("load",null,[t,e,i]),this.appendNextPage(t,e,i)},i.appendNextPage=function(t,e,i){let{append:n,responseBody:o,domParseResponse:l}=this.options;if(!("text"==o&&l)||!n)return{body:t,response:i};let r=t.querySelectorAll(n),h={body:t,response:i,items:r};if(!r||!r.length)return this.lastPageReached(t,e),h;let a=s(r),c=()=>(this.appendItems(r,a),this.isLoading=!1,this.dispatchEvent("append",null,[t,e,r,i]),h);return this.options.outlayer?this.appendOutlayerItems(a,c):c()},i.appendItems=function(t,e){t&&t.length&&(function(t){let e=t.querySelectorAll("script");for(let t of e){let e=document.createElement("script"),i=t.attributes;for(let t of i)e.setAttribute(t.name,t.value);e.innerHTML=t.innerHTML,t.parentNode.replaceChild(e,t)}}(e=e||s(t)),this.element.appendChild(e))},i.appendOutlayerItems=function(i,n){let s=e.imagesLoaded||t.imagesLoaded;if(s)return new Promise((function(t){s(i,(function(){let e=n();t(e)}))}));this.isLoading=!1},i.onAppendOutlayer=function(t,e,i){this.options.outlayer.appended(i)},i.checkLastPage=function(t,e){let i,{checkLastPage:n,path:s}=this.options;if(n){if("function"==typeof s){if(!this.getPath())return void this.lastPageReached(t,e)}"string"==typeof n?i=n:this.isPathSelector&&(i=s),i&&t.querySelector&&(t.querySelector(i)||this.lastPageReached(t,e))}},i.lastPageReached=function(t,e){this.canLoad=!1,this.dispatchEvent("last",null,[t,e])},i.onPageError=function(t,e,i){return this.isLoading=!1,this.canLoad=!1,this.dispatchEvent("error",null,[t,e,i]),t},e.create.prefill=function(){if(!this.options.prefill)return;this.options.append&&(this.updateMeasurements(),this.updateScroller(),this.isPrefilling=!0,this.on("append",this.prefill),this.once("error",this.stopPrefill),this.once("last",this.stopPrefill),this.prefill())},i.prefill=function(){let t=this.getPrefillDistance();this.isPrefilling=t>=0,this.isPrefilling?(this.log("prefill"),this.loadNextPage()):this.stopPrefill()},i.getPrefillDistance=function(){return this.options.elementScroll?this.scroller.clientHeight-this.scroller.scrollHeight:this.windowHeight-this.element.clientHeight},i.stopPrefill=function(){this.log("stopPrefill"),this.off("append",this.prefill)},e}))},610:function(t,e,i){!function(e,n){t.exports?t.exports=n(e,i(717),i(47)):n(e,e.InfiniteScroll,e.fizzyUIUtils)}(window,(function(t,e,i){let n=e.prototype;return Object.assign(e.defaults,{scrollThreshold:400}),e.create.scrollWatch=function(){this.pageScrollHandler=this.onPageScroll.bind(this),this.resizeHandler=this.onResize.bind(this);let t=this.options.scrollThreshold;(t||0===t)&&this.enableScrollWatch()},e.destroy.scrollWatch=function(){this.disableScrollWatch()},n.enableScrollWatch=function(){this.isScrollWatching||(this.isScrollWatching=!0,this.updateMeasurements(),this.updateScroller(),this.on("last",this.disableScrollWatch),this.bindScrollWatchEvents(!0))},n.disableScrollWatch=function(){this.isScrollWatching&&(this.bindScrollWatchEvents(!1),delete this.isScrollWatching)},n.bindScrollWatchEvents=function(e){let i=e?"addEventListener":"removeEventListener";this.scroller[i]("scroll",this.pageScrollHandler),t[i]("resize",this.resizeHandler)},n.onPageScroll=e.throttle((function(){this.getBottomDistance()<=this.options.scrollThreshold&&this.dispatchEvent("scrollThreshold")})),n.getBottomDistance=function(){let e,i;return this.options.elementScroll?(e=this.scroller.scrollHeight,i=this.scroller.scrollTop+this.scroller.clientHeight):(e=this.top+this.element.clientHeight,i=t.scrollY+this.windowHeight),e-i},n.onResize=function(){this.updateMeasurements()},i.debounceMethod(e,"onResize",150),e}))},792:function(t,e,i){!function(e,n){t.exports?t.exports=n(e,i(717),i(47)):n(e,e.InfiniteScroll,e.fizzyUIUtils)}(window,(function(t,e,i){let n=e.prototype;function s(t){l(t,"none")}function o(t){l(t,"block")}function l(t,e){t&&(t.style.display=e)}return e.create.status=function(){let t=i.getQueryElement(this.options.status);t&&(this.statusElement=t,this.statusEventElements={request:t.querySelector(".infinite-scroll-request"),error:t.querySelector(".infinite-scroll-error"),last:t.querySelector(".infinite-scroll-last")},this.on("request",this.showRequestStatus),this.on("error",this.showErrorStatus),this.on("last",this.showLastStatus),this.bindHideStatus("on"))},n.bindHideStatus=function(t){let e=this.options.append?"append":"load";this[t](e,this.hideAllStatus)},n.showRequestStatus=function(){this.showStatus("request")},n.showErrorStatus=function(){this.showStatus("error")},n.showLastStatus=function(){this.showStatus("last"),this.bindHideStatus("off")},n.showStatus=function(t){o(this.statusElement),this.hideStatusEventElements(),o(this.statusEventElements[t])},n.hideAllStatus=function(){s(this.statusElement),this.hideStatusEventElements()},n.hideStatusEventElements=function(){for(let t in this.statusEventElements){s(this.statusEventElements[t])}},e}))}},i={};function n(t){var s=i[t];if(void 0!==s)return s.exports;var o=i[t]={exports:{}};return e[t].call(o.exports,o,o.exports,n),o.exports}t=n(48),function(e){"use strict";var i=document.getElementById("infinite-container"),n=document.querySelector(".inf-pagination .next");if(void 0!==i&&null!=i&&void 0!==n&&null!=n)"gmr-infinite"==gmrobjinf.inf?new t(i,{path:".inf-pagination .next",append:".post",history:!1,status:".page-load-status"}):new t(i,{path:".inf-pagination .next",append:".post",history:!1,scrollThreshold:!1,button:".view-more-button",status:".page-load-status"});else{var s=document.querySelector(".view-more-button");void 0!==s&&null!=s&&(s.style.display="none")}}(window.infScroll)}();