%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /home/t/r/a/tradesc/www/relax/wp-content/themes/flatsome/assets/js/
Upload File :
Create Path :
Current File : /home/t/r/a/tradesc/www/relax/wp-content/themes/flatsome/assets/js/flatsome-relay.js

!function(){"use strict";const e=".2";const t="flatsome",a=".ux-relay",r=".ux-relay__pagination",o=".ux-relay__load-more-button",n=".ux-relay__nav-button";class s{constructor(){this.$body=jQuery(document.body),jQuery(`${o}`,this.$body).length>0&&this.loadMore(),jQuery(`${r}`,this.$body).length>0&&this.pagination(),jQuery(`${n}`,this.$body).length>0&&this.nextPrev()}nextPrev(){this.$body.on(`click.${t}${n}`,`${n}`,(e=>{e.preventDefault();const t=jQuery(e.currentTarget),r=t.closest(`${a}`),o=r.data("flatsome-relay");if(!o)return void this.logError("data attribute empty or missing");const{tag:n,atts:s}=o,l=t.data("flatsome-dir");"next"===l?o.currentPage++:"prev"===l&&o.currentPage--,s.page_number=o.currentPage,this.sendAjaxRequest(r,n,s,o,null,(function(e,t){t.find(".ux-relay__nav-button--next").prop("disabled",o.currentPage>=o.totalPages),t.find(".ux-relay__nav-button--prev").prop("disabled",o.currentPage<=1)}))}))}loadMore(){this.$body.on(`click.${t}${o}`,`${o}`,(e=>{e.preventDefault();const t=jQuery(e.currentTarget),r=t.closest(`${a}`),o=r.data("flatsome-relay");if(!o)return void this.logError("data attribute empty or missing");const{tag:n,atts:s}=o;o.currentPage++,s.page_number=o.currentPage,r.attr("data-flatsome-relay",JSON.stringify(o)),this.sendAjaxRequest(r,n,s,o,t)}))}pagination(){this.$body.on(`click.${t}${r}`,".ux-relay__pagination.page-numbers a",(e=>{e.preventDefault();const t=jQuery(e.currentTarget),r=t.closest(`${a}`),o=r.data("flatsome-relay");if(!o)return void this.logError("data attribute empty or missing");const{tag:n,atts:s}=o,l=t.attr("href").split("#/page/")[1];o.currentPage=l,s.page_number=o.currentPage,this.sendAjaxRequest(r,n,s,o)}))}sendAjaxRequest(t,a,r,o){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null;n?n.addClass("loading"):function(t){let a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"boolean"==typeof a&&(a={processing:a});const{style:r="normal",position:o="",processing:n=!0}=a;let s;if("string"==typeof t?s=document.querySelector(t):t instanceof Element?s=t:t instanceof jQuery&&(s=t.get(0)),!s)return;if(!n){const e=s.querySelector(".ux-loader");return e&&e.remove(),void Array.from(s.children).forEach((e=>{e.style.opacity=""}))}"static"===window.getComputedStyle(s).position&&(s.style.position="relative");const l=function(e,t){const a=["ux-loader"];["normal","spotlight"].includes(e)&&a.push(`ux-loader--style-${e}`),["sticky"].includes(t)&&a.push(`ux-loader--position-${t}`);const r=document.createElement("div");r.className=a.join(" ");const o=document.createElement("div");o.className="ux-loader__inner";const n=document.createElement("div");return n.className="loading-spin centered",o.appendChild(n),r.appendChild(o),r}(r,o);s.insertAdjacentElement("afterbegin",l),Array.from(s.children).forEach((t=>{t!==l&&(t.style.opacity=e)}))}(t.find(".row"));const l=t.data("flatsome-relay-request");l&&"function"==typeof l.abort&&l.abort();const i=jQuery.ajax({url:flatsomeVars.ajaxurl,data:{action:"flatsome_ajax_apply_shortcode",tag:a,atts:r}}).done((e=>{n&&n.toggleClass("loading"),t.data("flatsome-relay-request",null),this.handleAjaxSuccess(e,t,o,n,s),this.$body.trigger("flatsome-relay-request-done",[e,t,o,n])})).fail((e=>{"abort"!==e.statusText&&this.showError(e,t)}));t.data("flatsome-relay-request",i)}handleAjaxSuccess(e,t,a){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;if(!e.success)return this.showError(e.data,t);if("string"!=typeof e.data)return console.error("Element ajax error:",e.data);const n=jQuery(e.data),s=r?t.find("[data-packery-options]"):n.find("[data-packery-options]"),l=s.length,i=r?t.find(".row"):n.find(".row");n.find("[data-animate]").removeAttr("data-animate");"product"!==a.postType&&"post"!==a.postType||(()=>{const e=n.find(".col");if(r){let t=parseInt(r.find(".ux-relay__current-count").text(),10);t+=parseInt(a.postCount,10),r.find(".ux-relay__current-count").text(t),l?s.imagesLoaded((()=>{s.packery().append(e).packery("appended",e).packery("layout").on("layoutComplete",(function(){i.hasClass("equalize-box")&&jQuery(document).trigger("flatsome-equalize-box")}))})):i.append(e),Flatsome.attach(e)}else this.$body.trigger("flatsome-relay-before-replace-element",[t,n]),i.fadeOut(0),Flatsome.detach(t),t.replaceWith(n),i.fadeIn(),s.length&&s.imagesLoaded((()=>{s.packery()})),Flatsome.attach(n);!l&&i.hasClass("equalize-box")&&jQuery(document).trigger("flatsome-equalize-box"),r&&a.currentPage>=a.totalPages&&r.hide(),o&&"function"==typeof o&&o(t,n)})()}showError(e,t){this.$body.hasClass("admin-bar")&&t.before('<div class="container error"><p>Element ajax error: '+e+"</p></div>"),this.logError(e)}logError(e){console.error("Element ajax error:",e)}}jQuery((()=>new s))}();

Zerion Mini Shell 1.0