(function () {
window.kepixel = window.kepixel || {};
window.kepixel.clientId = "al_sweed";
window.kepixel.siteId = "salla_salla_storefront_events_tag_al_sweed";
window.kepixel.sourceType = "Salla";
window.kepixel.sourceMethod = "Salla Storefront Events Tag";
window.kepixel.publicToken = "kpx_pub_baed6913a58d4b7c9d97ceeaf7d6";
window.kepixel.collectUrl = "https://us-central1-enaya-care-d5774.cloudfunctions.net/kpxCollect";
if (!window.__kepixelSallaLoaderInstalled) {
window.__kepixelSallaLoaderInstalled = true;
var script = document.createElement("script");
script.setAttribute("data-cfasync", "false");
script.src = "https://kepixel-tag.web.app/kpx-salla-runtime.js";
script.async = false;
script.onload = function () {
console.log("[Kepixel Salla] runtime loaded", window.kepixelSalla);
};
script.onerror = function () {
console.error("[Kepixel Salla] runtime failed to load");
};
(document.head || document.documentElement).appendChild(script);
}
})();
document.addEventListener("DOMContentLoaded", initTables);
window.addEventListener("load", initTables);
function initTables() {
setTimeout(renderMultiColTables, 500);
setTimeout(renderMultiColTables, 1500);
setTimeout(renderMultiColTables, 3000);
}
function renderMultiColTables() {
var selectors = [
".product-details__description",
".product__description",
"#description",
".description-content",
"article",
".pro-details",
];
selectors.forEach(function (selector) {
document.querySelectorAll(selector).forEach(processContainer);
});
}
function processContainer(targetElement) {
if (!targetElement || targetElement.dataset.tableDone) return;
var htmlContent = targetElement.innerHTML;
var regex = /\|جدول\|([\s\S]*?)\|الجدول\|/g;
if (!regex.test(htmlContent)) return;
var newHtml = htmlContent.replace(regex, function (match, tableContent) {
var cleanText = tableContent
.replace(/
/gi, "\n")
.replace(/<\/p>/gi, "\n")
.replace(/<[^>]*>/g, "")
.replace(/ /g, " ");
var rows = cleanText.split("\n");
var tableHTML = '
';
var isFirstRow = true;
rows.forEach(function (row) {
row = row.trim();
if (!row) return;
var cols = row.split("|");
if (isFirstRow) {
tableHTML += "";
cols.forEach(col => tableHTML += "| " + col.trim() + " | ");
tableHTML += "
";
isFirstRow = false;
} else {
tableHTML += "";
cols.forEach(col => tableHTML += "| " + col.trim() + " | ");
tableHTML += "
";
}
});
tableHTML += "
";
return tableHTML;
});
targetElement.innerHTML = newHtml;
targetElement.dataset.tableDone = "1";
}
document.addEventListener("DOMContentLoaded", function () {
function renderFAQ() {
var selectors = [
".product-details__description",
".product__description",
"#description",
".description-content",
"article",
".pro-details",
];
for (var i = 0; i < selectors.length; i++) {
var found = document.querySelectorAll(selectors[i]);
if (found.length > 0) {
found.forEach(processFAQ);
}
}
}
function processFAQ(targetElement) {
var htmlContent = targetElement.innerHTML;
var faqRegex = /\|اسئلة\|([\s\S]*?)\|نهاية\|/g;
if (htmlContent.match(faqRegex)) {
var faqData = [];
var newHtml = htmlContent.replace(faqRegex, function(match, faqContent) {
var cleanText = faqContent
.replace(/
/gi, "\n")
.replace(/<\/p>/gi, "\n")
.replace(/<[^>]*>/g, "")
.replace(/ /g, " ");
var lines = cleanText.split('\n');
var faqHTML = '';
var currentQ = '';
var currentA = '';
for (var i = 0; i < lines.length; i++) {
var line = lines[i].trim();
if (!line) continue;
if (line.indexOf('س:') === 0 || line.indexOf('س :') === 0) {
if (currentQ && currentA) {
faqData.push({ question: currentQ, answer: currentA });
}
if (currentQ) { faqHTML += '
'; }
currentQ = line.replace(/س\s*:\s*/, '').trim();
currentA = '';
faqHTML += '';
faqHTML += '
' + currentQ + '
';
} else if (line.indexOf('ج:') === 0 || line.indexOf('ج :') === 0) {
currentA = line.replace(/ج\s*:\s*/, '').trim();
faqHTML += '
' + currentA + '
';
faqHTML += '
';
}
}
if (currentQ && currentA) {
faqData.push({ question: currentQ, answer: currentA });
}
if (currentQ) { faqHTML += ''; }
faqHTML += '';
if (faqData.length > 0) { addFAQSchema(faqData); }
return faqHTML;
});
targetElement.innerHTML = newHtml;
}
}
function addFAQSchema(faqData) {
var oldSchema = document.getElementById('faq-schema');
if (oldSchema) { oldSchema.remove(); }
var schemaData = {
"@context": "https://schema.org",
"@type": "FAQPage",
"mainEntity": []
};
for (var i = 0; i < faqData.length; i++) {
schemaData.mainEntity.push({
"@type": "Question",
"name": faqData[i].question,
"acceptedAnswer": { "@type": "Answer", "text": faqData[i].answer }
});
}
var script = document.createElement('script');
script.id = 'faq-schema';
script.type = 'application/ld+json';
script.text = JSON.stringify(schemaData);
document.head.appendChild(script);
}
renderFAQ();
setTimeout(renderFAQ, 1500);
});
/* =========================================================
Schema — Organization + WebSite + BreadcrumbList
أُضيف تلقائياً — لا تعدّل الكود أعلاه
========================================================= */
(function () {
// Organization + WebSite
var s = document.createElement('script');
s.type = 'application/ld+json';
s.textContent = JSON.stringify({
"@context": "https://schema.org",
"@graph": [
{
"@type": "OnlineStore",
"@id": "https://loanihomes.com/#organization",
"name": "لواني هومز",
"alternateName": "Loani Homes",
"url": "https://loanihomes.com",
"logo": {
"@type": "ImageObject",
"url": "https://cdn.files.salla.network/theme/1452029177/11a050eb-10df-4c7e-8d09-c242778eaa30.webp"
},
"description": "متجر إلكتروني سعودي متخصص في الأثاث المنزلي والديكور: كنب، غرف نوم، أسرّة، مراتب، مفارش، سجاد، وطاولات طعام. شحن لجميع مناطق المملكة.",
"address": {
"@type": "PostalAddress",
"addressLocality": "الرس",
"addressRegion": "القصيم",
"postalCode": "58883",
"addressCountry": "SA"
},
"taxID": "302280477700003",
"contactPoint": {
"@type": "ContactPoint",
"telephone": "+966504806043",
"contactType": "customer service",
"areaServed": "SA",
"availableLanguage": ["ar"]
},
"sameAs": [
"https://www.instagram.com/loanihomes",
"https://x.com/loanihomes",
"https://www.tiktok.com/@loani.homes",
"https://wa.me/966504806043",
"https://eauthenticate.saudibusiness.gov.sa/certificate-details/0000264068"
]
},
{
"@type": "WebSite",
"@id": "https://loanihomes.com/#website",
"url": "https://loanihomes.com",
"name": "لواني هومز",
"inLanguage": "ar",
"publisher": { "@id": "https://loanihomes.com/#organization" },
"potentialAction": {
"@type": "SearchAction",
"target": {
"@type": "EntryPoint",
"urlTemplate": "https://loanihomes.com/search?q={search_term_string}"
},
"query-input": "required name=search_term_string"
}
}
]
});
document.head.appendChild(s);
// BreadcrumbList تلقائي لصفحات التصنيفات
var path = decodeURIComponent(window.location.pathname);
var m = path.match(/^\/(.+)\/(c\d+)$/);
if (m) {
var bc = document.createElement('script');
bc.type = 'application/ld+json';
bc.textContent = JSON.stringify({
"@context": "https://schema.org",
"@type": "BreadcrumbList",
"itemListElement": [
{ "@type": "ListItem", "position": 1, "name": "الرئيسية", "item": "https://loanihomes.com" },
{ "@type": "ListItem", "position": 2, "name": m[1].replace(/-/g, ' '), "item": "https://loanihomes.com" + window.location.pathname }
]
});
document.head.appendChild(bc);
}
})();
/* Loani Homes: BlogPosting structured data */
(function () {
function addBlogPostingSchema() {
if (location.pathname.indexOf('/blog/') < 0 || location.pathname.indexOf('/a-') < 0) return;
if ([].some.call(document.querySelectorAll('script[type="application/ld+json"]'), function (node) {
return node.textContent.indexOf('"@type":"BlogPosting"') >= 0;
})) return;
var heading = document.querySelector('h1');
var canonical = document.querySelector('link[rel="canonical"]');
if (!heading || !canonical) return;
var headline = heading.textContent.trim();
if (!headline) return;
var data = {
'@context': 'https://schema.org', '@type': 'BlogPosting',
headline: headline, mainEntityOfPage: canonical.href,
publisher: { '@type': 'Organization', name: 'لواني هومز', url: 'https://loanihomes.com/' }
};
var description = document.querySelector('meta[name="description"]');
if (description && description.content) data.description = description.content;
var author = document.querySelector('a[href*="/blog/author/"]');
if (author && author.textContent.trim()) {
data.author = { '@type': 'Person', name: author.textContent.trim(), url: author.href };
var dateNode = author.parentElement.querySelector('div span');
var months = { 'يناير':'01','فبراير':'02','مارس':'03','أبريل':'04','مايو':'05','يونيو':'06','يوليو':'07','أغسطس':'08','سبتمبر':'09','أكتوبر':'10','نوفمبر':'11','ديسمبر':'12' };
var parts = dateNode ? dateNode.textContent.trim().split(' ').filter(Boolean) : [];
if (parts.length === 3 && months[parts[1]]) data.datePublished = parts[2] + '-' + months[parts[1]] + '-' + ('0' + parts[0]).slice(-2);
}
var cover = [].find.call(document.querySelectorAll('img[alt]'), function (img) {
return img.alt.trim() === headline && img.src.indexOf('cdn.salla') >= 0;
});
if (cover) data.image = cover.src;
var script = document.createElement('script');
script.type = 'application/ld+json';
script.textContent = JSON.stringify(data);
document.head.appendChild(script);
}
if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', addBlogPostingSchema);
else addBlogPostingSchema();
})();