Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove initiateAdAlert() #528

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 0 additions & 30 deletions src/assets/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ class App extends AppHelpers {
this.initiateStickyMenu();
}
this.initAddToCart();
this.initiateAdAlert();
this.initiateDropdowns();
this.initiateModals();
this.initiateCollapse();
Expand Down Expand Up @@ -201,35 +200,6 @@ isElementLoaded(selector){
header.style.height = height + 'px';
}

/**
* Because salla caches the response, it's important to keep the alert disabled if the visitor closed it.
* by store the status of the ad in local storage `salla.storage.set(...)`
*/
initiateAdAlert() {
let ad = this.element(".salla-advertisement");

if (!ad) {
return;
}

if (!salla.storage.get('statusAd-' + ad.dataset.id)) {
ad.classList.remove('hidden');
}

this.onClick('.ad-close', function (event) {
event.preventDefault();
salla.storage.set('statusAd-' + ad.dataset.id, 'dismissed');

anime({
targets: '.salla-advertisement',
opacity: [1, 0],
duration: 300,
height: [ad.clientHeight, 0],
easing: 'easeInOutQuad',
});
});
}

initiateDropdowns() {
this.onClick('.dropdown__trigger', ({ target: btn }) => {
btn.parentElement.classList.toggle('is-opened');
Expand Down
2 changes: 1 addition & 1 deletion src/assets/js/partials/product-card.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ class ProductCard extends HTMLElement {
this.product?.donation? this.classList.add('s-product-card-donation') : '';
this.shadowOnHover? this.classList.add('s-product-card-shadow') : '';
this.product?.is_out_of_stock? this.classList.add('s-product-card-out-of-stock') : '';
this.isInWishlist = !salla.config.isGuest() && salla.storage.get('salla::wishlist', []).includes(this.product.id);
this.isInWishlist = !salla.config.isGuest() && salla.storage.get('salla::wishlist', []).includes(Number(this.product.id));
this.innerHTML = `
<div class="${!this.fullImage ? 's-product-card-image' : 's-product-card-image-full'}">
<a href="${this.product?.url}">
Expand Down
4 changes: 1 addition & 3 deletions src/views/pages/customer/wishlist.twig
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,4 @@
</div>
{% endblock %}

{% block scripts %}
<script defer src="{{ 'customer.js' | asset }}"></script>
{% endblock %}