Server IP : 15.235.198.142 / Your IP : 216.73.216.208 Web Server : Apache/2.4.58 (Ubuntu) System : Linux ballsack 6.8.0-45-generic #45-Ubuntu SMP PREEMPT_DYNAMIC Fri Aug 30 12:02:04 UTC 2024 x86_64 User : www-data ( 33) PHP Version : 8.3.6 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/yme/wp-content/themes/oceanwp/assets/src/js/wp-plugins/woocommerce/ |
Upload File : |
import { fadeIn, fadeOut, visible } from "../../lib/utils"; class WooDisplayCart { #elements; constructor() { this.#setElements(); this.#start(); this.#setupEventListeners(); } #setElements = () => { this.#elements = { overlayCart: document.querySelector(".owp-cart-overlay"), body: document.body, quickViewModal: document.querySelector("#owp-qv-wrap"), quickViewContent: document.querySelector("#owp-qv-content"), header: document.querySelector("#site-header"), html: document.querySelector("html"), }; }; #start = () => {}; #setupEventListeners = () => { jQuery("body").on("added_to_cart", this.#onAddToCartBtn); this.#elements.overlayCart?.addEventListener("click", this.#closeOverlay); window.addEventListener("resize", this.#closeOverlay); }; #onAddToCartBtn = (event, fragments, cart_hash, $button, ontrigger = '') => { if( fragments !== undefined && fragments.e_manually_triggered ) { return; } if( ontrigger ) { jQuery(document).on(ontrigger, this.showCart) } else { this.showCart(); } }; #closeOverlay = (event) => { if (visible(this.#elements.overlayCart)) { fadeOut(this.#elements.overlayCart); this.#elements.body.classList.remove("show-cart"); } }; showCart = () => { fadeIn(this.#elements.overlayCart); this.#elements.body.classList.add("show-cart"); if (!!this.#elements.quickViewModal) { this.#elements.html.style.overflow = ""; this.#elements.html.style.marginRight = ""; this.#elements.html.classList.remove("owp-qv-open"); fadeOut(this.#elements.quickViewModal); this.#elements.quickViewModal.classList.remove("is-visible"); setTimeout(() => { this.#elements.quickViewContent.innerHTML = ""; }, 600); } if ( !!this.#elements.header && !this.#elements.header.classList.contains("fixed-scroll") ) { this.#elements.html.scrollTo({ top: 0, behavior: "smooth", }); } }; } new WooDisplayCart();