Categories: Travel

Journey Sets Half-Off – Tote&Carry

This web page was created programmatically, to learn the article in its unique location you may go to the hyperlink bellow:
https://www.totencarry.com/collections/travel-sets-half-off
and if you wish to take away this text from our website please contact us


3 && urlParts[3]) depend += urlParts[3].break up(‘+’).size;

if (this.sortBy && this.sortBy !== ‘guide’ && this.sortBy !== ‘best-selling’) {
depend++;
}
this.livelyFilters = depend;
} catch(e) {
console.error(‘Error updating lively filters:’, e);
this.livelyFilters = 0;
}
},

initPendingFilters() {
this.currentUrl = window.location.href;

// seed sortBy from URL (so counts are proper on load)
attempt catch(_) {}

attempt {
const currentPath = new URL(this.currentUrl, window.location.origin).pathname;
if (currentPath.consists of(‘/collections/’) && currentPath.break up(” > 3) {
let urlParts = currentPath.break up(”
if (urlParts.size > 3 && urlParts[3]) {
const tags = urlParts[3].break up(‘+’);
tags.forEach(tag => this.pendingFilters.add(tag));
}
}
} catch(_) {}
this.initAjaxPagination();
this.updateActiveFilters();
},

initAjaxPagination() {
doc.addEventListener(‘click on’, (e) => {
const paginationLink = e.goal.closest(‘[data-pagination-link]’);
if (paginationLink) {
e.preventDefault();
const url = paginationLink.href;
this.fetchCollection(url);
}
});
},

setupObserver() {
if (this.observer) {
this.observer.disconnect();
}
const sentinel = this.$refs.infiniteScrollSentinel;
if (!sentinel) return;

this.observer = new IntersectionObserver((entries) => {
entries.forEach(entry => {
const isDesktop = window.matchMedia(‘(min-width: 1024px)’).matches;
if (isDesktop) return;
if (entry.isIntersecting && !this.isLoadingExtra && !this.isLoading && !this.endOfCollection && this.nextPageUrl) {
this.fetchNextPage();
}
});
}, { root: null, rootMargin: ‘800px 0px’, threshold: 0 });

this.observer.observe(sentinel);
},

initInfiniteScroll() {
this.updateNextPageFrom(doc);
this.setupObserver();
},

extractNextUrlFromDocument(doc) {
if (!doc) return null;
const express = doc.querySelector(‘[data-pagination] [data-next-url]’);
if (express && express.getAttribute(‘data-next-url’)) {
return express.getAttribute(‘data-next-url’);
}
const relNext = doc.querySelector(‘[data-pagination] a[rel=next]’);
if (relNext) return relNext.href;
const ariaNext = doc.querySelector(`[data-pagination] a[aria-label*=’next’]`);
if (ariaNext) return ariaNext.href;
const pageLink = doc.querySelector(`[data-pagination] a[href*=’page=”]`);
if (pageLink) return pageLink.href;
return null;
},

updateNextPageFrom(doc) {
const nextUrl = this.extractNextUrlFromDocument(doc);
this.nextPageUrl = nextUrl;
this.endOfCollection = !nextUrl;
},

showSkeletons(depend) {
const grid = doc.querySelector(“[data-product-grid] .grid’);
if (!grid) return;
if (typeof depend !== ‘quantity’) {
attempt 4) * 2);
catch (e) {
depend = 8;
}
}
const fragment = doc.createDocumentFragment();
for (let i = 0; i < depend; i++) {
const wrapper = doc.createElement(‘div’);
wrapper.className=”flex items-stretch”;
wrapper.setAttribute(‘data-skeleton’, ”);
wrapper.innerHTML = `

`;
fragment.appendChild(wrapper);
}
grid.appendChild(fragment);
},

removeSkeletons() {
doc.querySelectorAll(‘[data-product-grid] [data-skeleton]’).forEach(el => el.take away());
},

appendProductCardsFromDoc(doc) {
const newGrid = doc.querySelector(‘[data-product-grid] .grid’);
const currentGrid = doc.querySelector(‘[data-product-grid] .grid’);
if (!newGrid || !currentGrid) return;
const productCards = newGrid.querySelectorAll(‘[data-product-card]’);
const fragment = doc.createDocumentFragment();
productCards.forEach(card => fragment.appendChild(card.cloneNode(true)));
currentGrid.appendChild(fragment);
attempt {
if (window.Alpine && typeof window.Alpine.initTree === ‘perform’) {
window.Alpine.initTree(currentGrid);
}
} catch (e) {}
},

async fetchNextPage() {
if (!this.nextPageUrl || this.isLoadingExtra || this.isLoading) return;
this.isLoadingExtra = true;
this.showSkeletons();
attempt {
const response = await fetch(this.nextPageUrl);
const html = await response.textual content();
const parser = new DOMParser();
const doc = parser.parseFromString(html, ‘textual content/html’);
this.appendProductCardsFromDoc(doc);
this.updateNextPageFrom(doc);
} catch (error) {
console.error(‘Error fetching subsequent web page:’, error);
} lastly {
this.removeSkeletons();
this.isLoadingExtra = false;
}
},

async fetchCollection(url, updateHistory = true) {
if (this.isLoading) return;
this.isLoading = true;

attempt {
const response = await fetch(url, { credentials: ‘same-origin’ });
const html = await response.textual content();
const parser = new DOMParser();
const doc = parser.parseFromString(html, ‘textual content/html’);

const newProductGrid = doc.querySelector(‘[data-product-grid]’);
const presentProductGrid = doc.querySelector(‘[data-product-grid]’);
const newPagination = doc.querySelector(‘[data-pagination]’);
const currentPagination = doc.querySelector(‘[data-pagination]’);

if (updateHistory) window.historical past.pushState({}, ”, url);

// preserve reactive URL/kind in sync for active-state + counters
this.currentUrl = url;
attempt ‘guide’;
catch(_) {}
this.updateActiveFilters();

if (presentProductGrid && newProductGrid) {
presentProductGrid.innerHTML = newProductGrid.innerHTML;
}
if (currentPagination && newPagination) {
currentPagination.innerHTML = newPagination.innerHTML;
}

const newFilters = doc.querySelector(‘[data-collection-filters]’);
const presentFilters = doc.querySelector(‘[data-collection-filters]’);
if (presentFilters && newFilters) {
presentFilters.innerHTML = newFilters.innerHTML;
}

const newAppliedFilters = doc.querySelector(‘[data-applied-filters]’);
const currentAppliedFilters = doc.querySelector(‘[data-applied-filters]’);
if (currentAppliedFilters && newAppliedFilters) {
currentAppliedFilters.innerHTML = newAppliedFilters.innerHTML;
}

const newCount = doc.querySelector(‘[data-product-count]’);
const currentCount = doc.querySelector(‘[data-product-count]’);
if (currentCount && newCount) {
currentCount.textContent = newCount.textContent;
}

// Re-broadcast present inventory config so freshly-inserted product playing cards choose it up
doc.dispatchEvent(new CustomEvent(‘tnc:stock-config’, { element: window.__stockMeterConfig || { enabled:false } }));

// Sync pendingFilters from the brand new URL
this.syncPendingFiltersFromUrl();

// Reset infinite scroll state and observer primarily based on the brand new DOM
this.updateNextPageFrom(doc);
this.setupObserver();

if (url.consists of(‘web page=”)) {
const collectionTop = doc.querySelector(“[data-collection-top]’);
if (collectionTop) collectionTop.scrollIntoView({ habits: ‘easy’ });
}
} catch (error) {
console.error(‘Error fetching assortment:’, error);
} lastly {
this.isLoading = false;
}
},

handlePopState(occasion) {
this.currentUrl = window.location.href;
this.fetchCollection(this.currentUrl, false);
},

updateUrl(url) { this.fetchCollection(url); },

updateSortAndFilter(sortValue) {
if (sortValue === ‘available-true’) {
this.togglePendingFilter(‘filter.v.availability=1’);
this.applySelectedFilters();
} else {
attempt {
const url = new URL(this.currentUrl, window.location.origin);
url.searchParams.set(‘sort_by’, sortValue);
this.fetchCollection(url.toString());
} catch(e) {
console.error(‘Error updating kind:’, e);
}
}
},

togglePendingFilter(filterValue) {
if (this.pendingFilters.has(filterValue)) this.pendingFilters.delete(filterValue);
else this.pendingFilters.add(filterValue);
},

clearAllFilters() {
this.pendingFilters.clear();
this.sortBy = ‘guide’;
this.fetchCollection(”
},

syncPendingFiltersFromUrl() {
attempt {
this.pendingFilters.clear();
const url = new URL(this.currentUrl, window.location.origin);

// Sync question param filters
url.searchParams.forEach((worth, key) => {
if (key.startsWith(‘filter.’)) {
this.pendingFilters.add(`${key}=${worth}`);
}
});

// Sync tag filters
const path = url.pathname;
if (path.consists of(‘/collections/’) && path.break up(” > 3) {
const urlParts = path.break up(”
if (urlParts.size > 3 && urlParts[3]) {
const tags = urlParts[3].break up(‘+’);
tags.forEach(tag => {
if (tag) this.pendingFilters.add(tag);
});
}
}
} catch(e) {
console.error(‘Error syncing filters:’, e);
}
},

applySelectedFilters() {
attempt {
let collectionUrl = ”
let sortParam = this.sortBy;

let tagFilters = [];
let questionFilters = [];

this.pendingFilters.forEach(filter => );

let newUrl = collectionUrl;
if (tagFilters.size > 0) newUrl += ” + tagFilters.be a part of(‘+’);

// preserve non-filter params from currentUrl (e.g., ?view=)
const saved = new URL(this.currentUrl, window.location.origin);
const params = new URLSearchParams();
saved.searchParams.forEach((v, ok) => {
if (ok === ‘web page’) return;
if (ok.startsWith(‘filter.’)) return;
params.set(ok, v);
});

if (sortParam && sortParam !== ‘guide’) params.set(‘sort_by’, sortParam);
questionFilters.forEach(q => {
const [k, v] = q.break up(‘=’);
if (ok && typeof v !== ‘undefined’) params.set(ok, v);
});

const qs = params.toString();
if (qs) newUrl += (newUrl.consists of(‘?’) ? ‘&’ : ‘?’) + qs;

this.fetchCollection(newUrl);
} catch(e) {
console.error(‘Error making use of filters:’, e);
}
},

toggleFilter(filterValue) {
attempt {
let collectionUrl = ”
const path = new URL(this.currentUrl, window.location.origin).pathname;
let tags = [];
let sortParam = this.sortBy;

if (path.consists of(‘/collections/’) && path.break up(” > 3) {
let urlParts = path.break up(”
if (urlParts.size > 3 && urlParts[3]) tags = urlParts[3].break up(‘+’);
}

const idx = tags.indexOf(filterValue);
if (idx !== -1) tags.splice(idx, 1); else tags.push(filterValue);

let newUrl = `${collectionUrl}${tags.size > 0 ? ” + tags.be a part of(‘+’) : ”}`;

// protect non-filter params (+ optionally available sort_by)
const saved = new URL(this.currentUrl, window.location.origin);
const params = new URLSearchParams();
saved.searchParams.forEach((v, ok) => {
if (ok === ‘web page’) return;
if (ok.startsWith(‘filter.’)) return;
params.set(ok, v);
});
if (sortParam && sortParam !== ‘guide’) params.set(‘sort_by’, sortParam);

const qs = params.toString();
if (qs) newUrl += (newUrl.consists of(‘?’) ? ‘&’ : ‘?’) + qs;

this.livelyFilters = tags.size + (params.has(‘sort_by’) ? 1 : 0);
this.fetchCollection(newUrl);
} catch(e) {
console.error(‘Error toggling filter:’, e);
}
},

toggleColorFilter(filterValue) { this.toggleFilter(filterValue); }
}

x-init=”
initPendingFilters();
initInfiniteScroll();
window.addEventListener(‘popstate’, handlePopState);

data-collection-top
>

Filter & kind

(0)

No merchandise discovered

Try checking your spelling or utilizing totally different phrases.

View all merchandise


This web page was created programmatically, to learn the article in its unique location you may go to the hyperlink bellow:
https://www.totencarry.com/collections/travel-sets-half-off
and if you wish to take away this text from our website please contact us

fooshya

Share
Published by
fooshya

Recent Posts

Fair Day Brings Meals and Enjoyable

This web page was created programmatically, to learn the article in its unique location you'll…

25 seconds ago

Swimming and Pilates lovers should not going to love this the missed exercise that could be safer and simpler for unhealthy knees

This web page was created programmatically, to learn the article in its unique location you…

13 minutes ago

After the dying of El Mencho, is it protected to journey to Mexico as a vacationer?

This web page was created programmatically, to learn the article in its unique location you…

17 minutes ago

Travel consultants weigh in on holidays to Mexico

This web page was created programmatically, to learn the article in its authentic location you…

40 minutes ago

get the Samsung Galaxy S26 Ultra free of charge at T-Mobile — no trade-in required

This web page was created programmatically, to learn the article in its unique location you…

1 hour ago

Woot Simply Dropped a Model New Sale on PS5 and Switch Games That Options A few of the Finest Bargains of the 12 months So Far

This web page was created programmatically, to learn the article in its authentic location you'll…

1 hour ago