مد في التوقيتات رسميًا .. مواعيد فتح وغلق المحال في عيد الأضحى 2025 تتغير لمدة 5 أيام – اعرف التوقيتات الديقيقة لكل نشاطاطاطاطzy
05 يونيو, 2025 06:17 م
characteristic replaceOembeds() {
var allEmbeds = doc.getElementsByTagName(“OEMBED”);
while (allEmbeds.dimension != 0) {
replaceOembedWithHtml(allEmbeds(0), extractLinkFromOembed(allEmbeds(0)));
allEmbeds = doc.getElementsByTagName(“OEMBED”);
}
runYoutubeLazyLoad();
}
characteristic replaceOembedWithHtml(part, sourceData) {
if (sourceData.provide.toLowerCase() === “youtube”) {
var html=”
‘;
replaceElementWithHtml(part, html);
} else if (sourceData.provide.toLowerCase() === “instagram”) {
var html=”
‘;
replaceElementWithHtml(part, html);
} else if (sourceData.provide.toLowerCase() === “twitter”) {
var html=”
‘;
replaceElementWithHtml(part, html);
} else if (sourceData.provide.toLowerCase() === “facebook”) {
loadfbApi();
var html=”
‘
replaceElementWithHtml(part, html);
} else {
replaceElementWithHtml(part, “”);
}
}
characteristic extractLinkFromOembed(part) {
return getUrlSource(part.getAttribute(“url”));
}
characteristic getUrlSource(url) {
var ytRegex = /http(?:s?)://(?:www.)?youtu(?:be.com/gape?v=|.be/)((w-_)*)(&(amp;)?(w?=)*)?/;
var instaRegex = /(https?://www.)?instagram.com(/p/(w+)/?)/;
var twitterRegex = /twitter.com/.*/situation(?:es)?/((^/?)+)/;
var fbRegex = /^https?://www.facebook.com.*/(video(s)?|gape|story|posts)(.php?|/).+$/;
if (ytRegex.take a look at(url)) {
return {
provide: “Youtube”,
url: url,
identification: ytRegex.exec(url)(1)
};
}
if (instaRegex.take a look at(url)) {
return {
provide: “Instagram”,
url: url,
identification: instaRegex.exec(url)(3)
};
}
if (twitterRegex.take a look at(url)) {
return {
provide: “Twitter”,
url: url,
identification: twitterRegex.exec(url)(1)
};
}
if (fbRegex.take a look at(url)) {
return {
provide: “Fb”,
url: url,
identification: fbRegex.exec(url)(1)
};
}
return {
provide: “Unknown”,
url: url,
identification: “”
};
}
characteristic replaceElementWithHtml(part, html) {
var str = html;
var Obj = part; //any part to be fully changed
if (Obj.outerHTML) { //if outerHTML is supported
Obj.outerHTML = str; ///or no longer it’s uncomplicated substitute of complete part with contents of str var
} else { //if outerHTML is never any longer supported, there’s a uncommon however crossbrowsered trick
var tmpObj = doc.createElement(“div”);
tmpObj.innerHTML = ‘‘;
ObjParent = Obj.parentNode; //Okey, part must be parented
ObjParent.replaceChild(tmpObj, Obj); //right here we placing our temporary files as an substitute of our target, so we can accumulate it then and change it into regardless of we desire to interchange to
ObjParent.innerHTML = ObjParent.innerHTML.change(‘
‘, str);
}
}
characteristic loadfbApi() {
var js = doc.createElement(‘script’);
js.src=”
doc.body.appendChild(js);
}
characteristic runYoutubeLazyLoad() {
/// youtube lazyload
var youtube = doc.querySelectorAll(“.youtube”);
for (var i = 0; i < youtube.dimension; i++) { var provide = "https://img.youtube.com/vi/" + youtube(i).dataset.embed + "http://192.168.2.55/0.jpg"; var image = contemporary Image(); image.src = "https://www.christian-dogma.com/topics/ch/resources/photography/no.jpg"; image.classList.add('lazyload'); image.setAttribute("files-src", provide); image.setAttribute("alt", "youtube"); image.addEventListener("load", characteristic () { youtube(i).appendChild(image); }(i)); youtube(i).addEventListener("click", characteristic () { var iframe = doc.createElement("iframe"); iframe.setAttribute("frameborder", "0"); iframe.setAttribute("allowfullscreen", ""); iframe.setAttribute("src", "https://www.youtube.com/embed/" + this.dataset .embed + "?rel=0&showinfo=0&autoplay=1"); this.innerHTML = ""; this.appendChild(iframe); }); }; }
Source hyperlink