Loading...

Filtr dywanów

document.querySelectorAll("article.product").forEach(function(t){let e=t.querySelectorAll(".variation-item"),a=t.querySelectorAll(".product-list-item");e.length>0&&e.forEach(function(t){t.addEventListener("click",function(){e.forEach(function(e){e.dataset.id===t.dataset.id?e.classList.add("active"):e.classList.remove("active")}),a.forEach(function(e){e.dataset.id===t.dataset.id?e.classList.add("active"):e.classList.remove("active")})})})});
$(document).ready(function() { function setCookie(n, v, d) { var e = d ? "; expires=" + new Date(Date.now() + d * 864e5).toUTCString() : ""; document.cookie = n + "=" + (v || "") + e + "; path=/"; } function getCookie(n) { var e = n + "=", c = document.cookie.split(';'); for (var i = 0; i < c.length; i++) { var s = c[i].trim(); if (s.indexOf(e) == 0) return s.substring(e.length); } return null; } function fetchData() { if (getCookie('geoLocationModalShown')) return; fetch("https://morgenland-cpanel.eu/api/morgenland-info").then(function(r) { if (!r.ok) throw new Error('HTTP error! status: ' + r.status); return r.json(); }).then(function(d) { var c = normalizeCountryCode(d.data.countryCode), l = [{"lang":"de","locale":"de","url":"https:\/\/www.morgenland-teppiche.de\/kleine-teppiche","name":"German","image":"https:\/\/cdn02.plentymarkets.com\/6wg68w8zahno\/frontend\/assets\/imgs\/flags\/German.png"},{"lang":"en","locale":"en","url":"https:\/\/www.morgenland-rugs.com\/small-rugs","name":"English","image":"https:\/\/cdn02.plentymarkets.com\/6wg68w8zahno\/frontend\/assets\/imgs\/flags\/USA.png"},{"lang":"uk","locale":"en-gb","url":"https:\/\/www.morgenland-rugs.co.uk\/small-rugs","name":"English","image":"https:\/\/cdn02.plentymarkets.com\/6wg68w8zahno\/frontend\/assets\/imgs\/flags\/UK.png"},{"lang":"fr","locale":"fr","url":"https:\/\/www.morgenland-tapis.fr\/petits-tapis","name":"French","image":"https:\/\/cdn02.plentymarkets.com\/6wg68w8zahno\/frontend\/assets\/imgs\/flags\/France.png"},{"lang":"nl","locale":"nl","url":"https:\/\/www.morgenland-tapijt.nl\/kleine-tapijten","name":"Dutch","image":"https:\/\/cdn02.plentymarkets.com\/6wg68w8zahno\/frontend\/assets\/imgs\/flags\/Netherland.png"},{"lang":"se","locale":"sv-SE","url":"https:\/\/www.morgenland-mattor.se\/sma","name":"Swedish","image":"https:\/\/cdn02.plentymarkets.com\/6wg68w8zahno\/frontend\/assets\/imgs\/flags\/Sweden.png"},{"lang":"at","locale":"de-AT","url":"https:\/\/www.morgenland-teppiche.at\/kleine-teppiche","name":"Austria","image":"https:\/\/cdn02.plentymarkets.com\/6wg68w8zahno\/frontend\/assets\/imgs\/flags\/Austria.png"},{"lang":"ch","locale":"de-CH","url":"https:\/\/www.morgenland-teppiche.ch\/kleine-teppiche","name":"Swiss German","image":"https:\/\/cdn02.plentymarkets.com\/6wg68w8zahno\/frontend\/assets\/imgs\/flags\/Switzerland.png"},{"lang":"nn","locale":"no-NO","url":"https:\/\/www.morgenland-tepper.com\/sma","name":"Norwegian","image":"https:\/\/cdn02.plentymarkets.com\/6wg68w8zahno\/frontend\/assets\/imgs\/flags\/Norway.png"},{"lang":"da","locale":"da","url":"https:\/\/www.morgenland-taepper.com\/sma","name":"Danish","image":"https:\/\/cdn02.plentymarkets.com\/6wg68w8zahno\/frontend\/assets\/imgs\/flags\/Denmark.png"},{"lang":"es","locale":"es","url":"https:\/\/www.morgenland-alfombra.es\/alfombras-pequenas","name":"Spanish","image":"https:\/\/cdn02.plentymarkets.com\/6wg68w8zahno\/frontend\/assets\/imgs\/flags\/Spain.png"},{"lang":"it","locale":"it","url":"https:\/\/www.morgenland-tappeto.it\/tappeti-piccoli","name":"Italian","image":"https:\/\/cdn02.plentymarkets.com\/6wg68w8zahno\/frontend\/assets\/imgs\/flags\/Italy.png"},{"lang":"pt","locale":"pt","url":"https:\/\/www.morgenland-tapetes.pt\/tapetes-pequenos","name":"Portuguese","image":"https:\/\/cdn02.plentymarkets.com\/6wg68w8zahno\/frontend\/assets\/imgs\/flags\/Portguese.png"},{"lang":"cz","locale":"cs-CZ","url":"https:\/\/www.morgenland-koberce.cz\/male-koberce","name":"Czech","image":"https:\/\/cdn02.plentymarkets.com\/6wg68w8zahno\/frontend\/assets\/imgs\/flags\/Czech-Republic.png"}], a = {"lang":"pl","name":"Polish","image":"https:\/\/cdn02.plentymarkets.com\/6wg68w8zahno\/frontend\/assets\/imgs\/flags\/Poland.png"}, f = findActiveUrl(l, c); if (shouldShowModal(f, a, c)) { updateModal(f); $('#geoLocationModal').modal('show'); $('#geoLocationModal').attr('aria-hidden', 'false'); setCookie('geoLocationModalShown', 'true', 3); } }).catch(function(e) { console.error('Fetch error:', e.message); }); } function normalizeCountryCode(c) { return c.toLowerCase() === "gb" ? "uk" : c.toLowerCase(); } function findActiveUrl(l, c) { var d = l.filter(function(u) { return u.lang === 'en'; })[0]; return l.find(function(u) { return u.lang === c; }) || d; } function shouldShowModal(foundUrl, activeUrl, countryCode) { if (!foundUrl || countryCode === activeUrl.lang) return false; var exceptions = { 'de': ['at', 'ch'], 'uk': ['en'], 'en': ['uk'], 'at': ['de', 'ch'], 'ch': ['de', 'at'] }; var activeExceptions = exceptions[activeUrl.lang] || []; return !activeExceptions.includes(foundUrl.lang); } function updateModal(f) { var b = document.querySelector('#redirectButton'), t = document.querySelector('#geoLocationText'), bt = document.querySelector('#redirectButtonText'), bi = document.querySelector('#redirectButtonImage'); b.href = f.url; t.textContent = "The website is in Polish language. Would you like to be redirected to our {name} website for a better experience?".replace("{name}", f.name); bi.src = bi['data-src'] = f.image; bi.alt = f.name; bt.textContent = "Redirect to {name} Site".replace("{name}", f.name); } fetchData(); });