Erhalten Sie einen einmaligen Gutscheincode mit 15% Rabatt
Der Rabatt ist gültig für alle Produkte, auch die mit reduziertem Preis, innerhalb von 60 Tagen nach der Newsletter-Anmeldung. Eine Kombination mit anderen Rabattcodes ist nicht möglich.
You are on our German website!
The website is in German language. Would you like to be redirected to our Englisch website for a better experience?
$(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\/legal-disclosure","name":"German","image":"https:\/\/cdn02.plentymarkets.com\/6wg68w8zahno\/frontend\/assets\/imgs\/flags\/German.png"},{"lang":"en","locale":"en","url":"https:\/\/www.morgenland-rugs.com\/legal-disclosure","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\/legal-disclosure","name":"English","image":"https:\/\/cdn02.plentymarkets.com\/6wg68w8zahno\/frontend\/assets\/imgs\/flags\/UK.png"},{"lang":"fr","locale":"fr","url":"https:\/\/www.morgenland-tapis.fr\/legal-disclosure","name":"French","image":"https:\/\/cdn02.plentymarkets.com\/6wg68w8zahno\/frontend\/assets\/imgs\/flags\/France.png"},{"lang":"nl","locale":"nl","url":"https:\/\/www.morgenland-tapijt.nl\/legal-disclosure","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\/legal-disclosure","name":"Swedish","image":"https:\/\/cdn02.plentymarkets.com\/6wg68w8zahno\/frontend\/assets\/imgs\/flags\/Sweden.png"},{"lang":"ch","locale":"de-CH","url":"https:\/\/www.morgenland-teppiche.ch\/legal-disclosure","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\/legal-disclosure","name":"Norwegian","image":"https:\/\/cdn02.plentymarkets.com\/6wg68w8zahno\/frontend\/assets\/imgs\/flags\/Norway.png"},{"lang":"da","locale":"da","url":"https:\/\/www.morgenland-taepper.com\/legal-disclosure","name":"Danish","image":"https:\/\/cdn02.plentymarkets.com\/6wg68w8zahno\/frontend\/assets\/imgs\/flags\/Denmark.png"},{"lang":"es","locale":"es","url":"https:\/\/www.morgenland-alfombra.es\/legal-disclosure","name":"Spanish","image":"https:\/\/cdn02.plentymarkets.com\/6wg68w8zahno\/frontend\/assets\/imgs\/flags\/Spain.png"},{"lang":"it","locale":"it","url":"https:\/\/www.morgenland-tappeto.it\/legal-disclosure","name":"Italian","image":"https:\/\/cdn02.plentymarkets.com\/6wg68w8zahno\/frontend\/assets\/imgs\/flags\/Italy.png"},{"lang":"pl","locale":"pl","url":"https:\/\/www.morgenland-dywany.pl\/legal-disclosure","name":"Polish","image":"https:\/\/cdn02.plentymarkets.com\/6wg68w8zahno\/frontend\/assets\/imgs\/flags\/Poland.png"},{"lang":"pt","locale":"pt","url":"https:\/\/www.morgenland-tapetes.pt\/legal-disclosure","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\/legal-disclosure","name":"Czech","image":"https:\/\/cdn02.plentymarkets.com\/6wg68w8zahno\/frontend\/assets\/imgs\/flags\/Czech-Republic.png"}], a = {"lang":"at","name":"Austria","image":"https:\/\/cdn02.plentymarkets.com\/6wg68w8zahno\/frontend\/assets\/imgs\/flags\/Austria.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 German 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();
});