Dashboard
PHP:
8.4.22
OS:
Linux
User:
provencez
/
/
home
/
provencez
/
www
/
wp-content
/
plugins
/
flexa-block
/
build
/
blocks
/
post-grid
📤 Upload
📝 New File
📁 New Folder
Close
Editing: view.js
(()=>{"use strict";const e="data-flexa-post-grid",t=".flexa-post-grid__grid",r=".flexa-pagination",n="is-loading";function o(o){const a=o.getAttribute(e);a&&(o.hasAttribute("data-flexa-loadmore")?function(r,n){const o=r.querySelector(".flexa-pagination-loadmore"),a=o?o.querySelector(".flexa-pagination-loadmore__btn"):null;if(!o||!a)return;const i=parseInt(o.getAttribute("data-total")||"1",10)||1;let c=parseInt(o.getAttribute("data-page")||"1",10)||1;a.addEventListener("click",()=>{const s=c+1;if(s>i||a.disabled)return;const d=new window.URL(window.location.href);d.searchParams.set(n,String(s)),a.disabled=!0,window.fetch(d.toString(),{credentials:"same-origin"}).then(e=>{if(!e.ok)throw new Error("HTTP "+e.status);return e.text()}).then(d=>{const l=(new window.DOMParser).parseFromString(d,"text/html"),u=window.CSS&&window.CSS.escape?window.CSS.escape(n):n.replace(/"/g,'\\"'),w=l.querySelector(`[${e}="${u}"]`),f=w?w.querySelector(t):null,S=r.querySelector(t);if(!f||!S)throw new Error("instance not found");Array.from(f.children).forEach(e=>S.appendChild(e)),c=s,o.setAttribute("data-page",String(c)),a.disabled=!1,c>=i&&o.remove()}).catch(()=>{a.disabled=!1})})}(o,a):o.addEventListener("click",i=>{if(i.defaultPrevented||0!==i.button||i.metaKey||i.ctrlKey||i.shiftKey||i.altKey)return;const c=i.target,s=c?c.closest(`${r} a.page-numbers`):null;if(!s||!o.contains(s))return;const d=s.getAttribute("href");d&&(i.preventDefault(),function(o,a,i){const c=o.querySelector(t);c&&c.classList.add(n),window.fetch(i,{credentials:"same-origin"}).then(e=>{if(!e.ok)throw new Error("HTTP "+e.status);return e.text()}).then(c=>{const s=(new window.DOMParser).parseFromString(c,"text/html");if(!function(n,o,a){const i=window.CSS&&window.CSS.escape?window.CSS.escape(o):o.replace(/"/g,'\\"'),c=a.querySelector(`[${e}="${i}"]`);if(!c)return!1;const s=c.querySelector(t),d=n.querySelector(t);if(s&&d)d.replaceWith(s);else if(!s)return!1;const l=c.querySelector(r),u=n.querySelector(r);return l&&u?u.replaceWith(l):l&&!u?(n.querySelector(".flexa-post-grid__inner")||n).appendChild(l):!l&&u&&u.remove(),!0}(o,a,s))throw new Error("instance not found");try{window.history.pushState({flexaPostGrid:a},"",i)}catch(e){}const d=o.querySelector(t);d&&d.classList.remove(n)}).catch(()=>{window.location.href=i})}(o,a,d))}))}function a(){document.querySelectorAll(`[${e}]`).forEach(o),window.addEventListener("popstate",e=>{e.state&&e.state.flexaPostGrid&&window.location.reload()})}"loading"===document.readyState?document.addEventListener("DOMContentLoaded",a):a()})();
Save
Cancel