(function () {
"use strict";
const hostname = location.hostname.replace(/^www\./, "");
if (hostname !== "kyefkhwlan.com") return;
function setupKyefSEO() {
if (!document.head) return;
/*
* 1. META ROBOTS
* Apply to ALL pages.
* Never override existing robots directives.
*/
const existingRobots = document.head.querySelector(
'meta[name="robots" i]'
);
if (!existingRobots) {
const robots = document.createElement("meta");
robots.setAttribute("name", "robots");
robots.setAttribute(
"content",
"index, follow, max-image-preview:large, " +
"max-snippet:-1, max-video-preview:-1"
);
document.head.appendChild(robots);
}
/*
* The following additions are homepage-only.
*/
if (location.pathname !== "/") return;
/*
* 2. WEB SITE SCHEMA
* Check recursively for existing WebSite schema.
*/
function hasWebSite(value) {
if (!value || typeof value !== "object") {
return false;
}
if (Array.isArray(value)) {
return value.some(hasWebSite);
}
const types = [].concat(value["@type"] || []);
if (types.includes("WebSite")) {
return true;
}
return Object.values(value).some(hasWebSite);
}
const schemaExists = Array.from(
document.querySelectorAll(
'script[type="application/ld+json"]'
)
).some(el => {
try {
return hasWebSite(
JSON.parse(el.textContent)
);
} catch (error) {
return false;
}
});
if (!schemaExists) {
const schema = {
"@context": "https://schema.org",
"@type": "WebSite",
"@id": "https://kyefkhwlan.com/#website",
"url": "https://kyefkhwlan.com/",
"name": "كيف خولان",
"alternateName": [
"مؤسسة كيف خولان",
"Kyef Khwlan"
],
"inLanguage": "ar"
};
const script = document.createElement("script");
script.id = "kyefkhwlan-website-schema";
script.type = "application/ld+json";
script.textContent = JSON.stringify(schema);
document.head.appendChild(script);
}
/*
* 3. OPEN GRAPH SITE NAME
* Homepage only.
*/
if (!document.head.querySelector(
'meta[property="og:site_name" i]'
)) {
const og = document.createElement("meta");
og.setAttribute("property", "og:site_name");
og.setAttribute("content", "كيف خولان");
document.head.appendChild(og);
}
}
// Run as early as possible.
if (document.head) {
setupKyefSEO();
} else {
document.addEventListener(
"DOMContentLoaded",
setupKyefSEO,
{ once: true }
);
}
})();
/* salla code*/
/* Add custom Js styles below */
(function () {
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) {
var htmlContent = targetElement.innerHTML;
var regex = /\|جدول\|([\s\S]*?)\|الجدول\|/g;
if (!htmlContent.match(regex)) 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 = '
| " + col.trim() + " | "; }); tableHTML += "
|---|
| " + col.trim() + " | "; }); tableHTML += "
' + currentA + '
'; faqHTML += '