HEX
Server: Apache
System: Linux webd006.cluster128.gra.hosting.ovh.net 6.18.42-ovh-vps-grsec-zfs+ #1 SMP PREEMPT_DYNAMIC Wed Aug 5 15:59:48 CEST 2026 x86_64
User: zwafgyp (177615)
PHP: 7.4.33
Disabled: _dyuweyrj4,_dyuweyrj4r,dl
Upload Files
File: /home/zwafgyp/lacalita/wp-content/plugins/rey-core/inc/modules/compare/script.js
!function(e){"use strict";var t={init:function(){return this.cookie_key="rey_compare_ids_"+reyParams.site_id,this.logged_in=rey.vars.logged_in,this},getProducts:function(){if("undefined"!=typeof Cookies){var e=Cookies.get(this.cookie_key);return e?e.split("|").map((function(e){return parseInt(e)})):[]}},setProduct:function(t){if("undefined"!=typeof Cookies){t=parseInt(t);var a=this.getProducts();-1===a.indexOf(t)&&(a.push(t),Cookies.set(this.cookie_key,a.join("|")),e(document).trigger("reycore/woocommerce/compare/added_product",[a,t]))}},removeProduct:function(t,a,o){if("undefined"!=typeof Cookies){t=parseInt(t);var r=this.getProducts();r.splice(a,1),Cookies.set(this.cookie_key,r.join("|")),o||e(document).trigger("reycore/woocommerce/compare/removed_product",[r,t])}},removeAll:function(){"undefined"!=typeof Cookies&&Cookies.set(this.cookie_key,"")},updateCounters:function(t){t||(t=this.getProducts());var a=e(".rey-compareCounter-number");t.length?a.text(t.length).removeClass("--empty"):a.text("0").addClass("--empty")},save:function(a,o){a||(a=this.getProducts()),this.logged_in&&(e(".rey-compareBtn").addClass("--disabled"),rey.ajax.request("compare_add_to_user",{params:{cache:!1},cb:function(a){t.animateButtons(),e(".rey-compareBtn").removeClass("--disabled --doing"),o&&o(a)}}))},animateButtons:function(t){var a=e(t?".rey-compareBtn[data-id="+t+"]":".rey-compareBtn.--doing");a.addClass("--animate"),setTimeout((function(){a.removeClass("--animate")}),500)},toggleButtonAttributes:function(t,a){var o;a?(t.addClass("--in-compare"),o=reyParams.compare_text_rm):(t.removeClass("--in-compare"),o=reyParams.compare_text_add),t.attr({title:o,"aria-label":o}),t.is("[data-rey-tooltip]")&&t.attr("data-rey-tooltip",o);var r=e(".rey-compareBtn-text",t);r.length&&r.text(o)}},a=function(){var a=this;this.init=function(){this.isComparePage=e("body.rey-compare-page").length,this.$siteMain=e("body.rey-compare-page .rey-siteContent"),this.$emptyPage=e(".rey-compare-emptyPage",this.$siteMain),this.$compareWrapper=e(".rey-compareWrapper"),this.isComparePage&&(this.base=t.init(),this.refreshData(),this.checkPageIds(),this.cleanupPage(),this.events())},this.refreshData=function(t){t=t||document,this.$pageTable=e(".rey-comparePage-table",t),this.$pageTableScroll=e(".rey-comparePage-scroll",t)},this.events=function(){e(document).on("reycore/woocommerce/compare/added_product reycore/woocommerce/compare/removed_product",(function(e,t,o){a.cleanupPage()}))},this.checkPageIds=function(){if(this.isComparePage){var e=a.base.getProducts();e.length&&(this.$compareWrapper.children().length&&parseInt(this.$pageTable.attr("data-count"))===e.length||this.getComparePageContent())}},this.getComparePageContent=function(){this.$siteMain.addClass("--loading"),rey.ajax.request("compare_get_page_content",{cb:function(t){if(a.$siteMain.length){var o=e(t.data),r=a.$compareWrapper.html(o);a.refreshData(r),a.dragEvents(),a.$siteMain.removeClass("--loading"),a.$compareWrapper.removeClass("--empty"),e(document).on("click",".rey-compare-removeBtn",(function(t){t.preventDefault();var o=e(this),r=parseInt(o.attr("data-id")||""),s=a.base.getProducts();if(!isNaN(r)){var i=s.indexOf(r);-1!==i&&(a.base.removeProduct(r,i),e("td[data-id="+r+"], th[data-id="+r+"]",a.$pageTable).remove(),a.cleanupPage())}}))}}})},this.cleanupPage=function(){if(this.isComparePage&&this.$siteMain.length){e(".woocommerce-notices-wrapper, .rey-loopHeader",this.$siteMain).remove();var t=a.base.getProducts();t.length?(this.$pageTable.attr("data-count",t.length),rey.dom.setProperty("--products-count",t.length,this.$pageTable[0])):this.$compareWrapper.addClass("--empty")}},this.dragEvents=function(){if(rey.vars.is_desktop){var e,t,a=this.$pageTableScroll,o=!1;a.on("mousedown",(function(r){o=!0,a.addClass("--active"),e=r.pageX-a.offset().left,t=a[0].scrollLeft})),a.on("mouseleave",(function(){o=!1,a.removeClass("--active")})),a.on("mouseup",(function(){o=!1,a.removeClass("--active")})),a.on("mousemove",(function(r){if(o){r.preventDefault();var s=3*(r.pageX-a.offset().left-e);a.scrollLeft(t-s)}}))}},this.init()},o=function(t){var a=this;return this.init=function(){this.base=t,this.$recentBtn=e(".rey-compare-recentBtn"),this.$recentProducts=e(".rey-compareNotice-recentProducts"),this.$recentProductsList=e(".rey-compareNotice-recentProducts-inner"),this.$afterPanel=e(".rey-compareNotice-wrapper"),this.$panelTitle=e(".rey-compareTitle"),this.$afterPanel.removeClass("--hidden"),this.events()},this.events=function(){this.$recentBtn.on("click",(function(t){t.preventDefault();var o=e(this);if(o.addClass("--disabled"),a.$recentProducts.hasClass("--visible"))return o.removeClass("--disabled"),a.$recentProducts.removeClass("--visible"),void a.$recentProductsList.empty();a.getRecentProducts()})),e(document).on("click",".rey-compare-recentProducts-add",(function(t){t.preventDefault();var o=e(this),r=o.attr("data-id")||"";r&&(a.base.base.setProduct(r),o.addClass("--disabled"))})),e(document).on("click",".rey-compare-resetBtn",(function(t){t.preventDefault(),a.base.base.removeAll(),a.base.base.updateCounters(),a.base.base.save(!1,(function(){a.base.base.logged_in&&a.$panelTitle.removeClass("--loading")})),a.base.base.toggleButtonAttributes(e(".rey-compareBtn")),setTimeout((function(){a.$afterPanel.removeClass("--visible")}),1e3)})),e(document).on("click",".rey-compareClose",(function(e){e.preventDefault(),a.hideNotice()})),e(document).on("keyup",(function(e){27==e.keyCode&&a.hideNotice()}))},this.showNotice=function(){"notice"===reyParams.compare_after_add&&(this.$afterPanel.addClass("--visible"),a.base.base.logged_in&&this.$panelTitle.addClass("--loading"))},this.hideNotice=function(){"notice"===reyParams.compare_after_add&&(this.$afterPanel.removeClass("--visible"),this.$recentProducts.removeClass("--visible"))},this.getRecentProducts=function(){this.$recentProducts.addClass("--loading --visible"),rey.ajax.request("compare_get_viewed_products",{params:{cache:!1},cb:function(t){if(a.$recentProducts.removeClass("--loading"),t.data){var o=a.$recentProductsList.html(t.data),r=a.base.base.getProducts();e.each(r,(function(t,a){e(".rey-compare-recentProducts-add[data-id="+a+"]",o).addClass("--disabled")})),"undefined"!=typeof SimpleScrollbar&&SimpleScrollbar.initEl(e(".rey-compare-recentProducts",o)[0])}}})},this.init()},r=function(a){var r=this;return this.init=function(){this.base=t.init(),this.base.updateCounters(),this._notice=new o(this),this.events()},this.events=function(){e(document).on("click",".rey-compareBtn",(function(t){t.preventDefault();var a=e(this),o=parseInt(a.attr("data-id")||""),s=r.base.getProducts();if(!isNaN(o)){if(a.hasClass("--supports-ajax")&&a.addClass("--doing"),a.hasClass("--in-compare")){var i=s.indexOf(o);if(-1!==i)return r.base.removeProduct(o,i),void r.base.toggleButtonAttributes(a)}r._notice.showNotice(),r.base.setProduct(o),r.base.toggleButtonAttributes(a,!0)}})),e(document).on("reycore/woocommerce/compare/added_product reycore/woocommerce/compare/removed_product",(function(e,t,a){r.base.updateCounters(t),r.base.save(t,(function(){r.base.logged_in&&r._notice.$panelTitle.removeClass("--loading")})),r.base.logged_in||r.base.animateButtons(a)}))},this.init()};document.addEventListener("rey-DOMContentLoaded",(function(t){e.reyCompare=new r,new a}));var s=function(t){e.reyCompare||(e.reyCompare=new r);var a=e(t),o=e.reyCompare.base.getProducts();o.length&&(e.reyCompare.base.toggleButtonAttributes(e("li.product .rey-compareBtn",a)),e.each(o,(function(t,o){var r=e('li.product .rey-compareBtn[data-id="'+o+'"]',a);r.length&&e.reyCompare.base.toggleButtonAttributes(r,!0)})))};rey.hooks.addAction("elementor/element/lazy_loaded",(function(e){s(e)})),rey.hooks.addAction("elementor/content/lazy_loaded",(function(e){s(e)}))}(jQuery);