أديب يتحدث عن الأرصاد وعاصفة الإسكندرية وتصريحات مثيرة لللدهشة تقلب مواقع التواصل الاجتماعيي


01 يونيو, 2025 04:00 ص

characteristic replaceOembeds() {
var allEmbeds = chronicle.getElementsByTagName(“OEMBED”);

while (allEmbeds.measurement != 0) {
replaceOembedWithHtml(allEmbeds(0), extractLinkFromOembed(allEmbeds(0)));
allEmbeds = chronicle.getElementsByTagName(“OEMBED”);
}

runYoutubeLazyLoad();

}

characteristic replaceOembedWithHtml(ingredient, sourceData) {
if (sourceData.supply.toLowerCase() === “youtube”) {
var html=”

” +
‘ +
‘ +
‘ +
‘ +

‘ +

‘;

replaceElementWithHtml(ingredient, html);
} else if (sourceData.supply.toLowerCase() === “instagram”) {
var html=”

‘;

replaceElementWithHtml(ingredient, html);
} else if (sourceData.supply.toLowerCase() === “twitter”) {
var html=”

‘;
replaceElementWithHtml(ingredient, html);
} else if (sourceData.supply.toLowerCase() === “facebook”) {

loadfbApi();

var html=”


replaceElementWithHtml(ingredient, html);
} else {
replaceElementWithHtml(ingredient, “”);
}

}

characteristic extractLinkFromOembed(ingredient) {
return getUrlSource(ingredient.getAttribute(“url”));
}

characteristic getUrlSource(url) {
var ytRegex = /http(?:s?)://(?:www.)?youtu(?:be.com/imagine?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)?|imagine|myth|posts)(.php?|/).+$/;

if (ytRegex.test(url)) {
return {
supply: “Youtube”,
url: url,
id: ytRegex.exec(url)(1)
};
}

if (instaRegex.test(url)) {
return {
supply: “Instagram”,
url: url,
id: instaRegex.exec(url)(3)
};
}

if (twitterRegex.test(url)) {
return {
supply: “Twitter”,
url: url,
id: twitterRegex.exec(url)(1)
};
}

if (fbRegex.test(url)) {
return {
supply: “Fb”,
url: url,
id: fbRegex.exec(url)(1)
};

}

return {
supply: “Unknown”,
url: url,
id: “”
};
}

characteristic replaceElementWithHtml(ingredient, html) {
var str = html;
var Obj = ingredient; //any ingredient to be fully replaced
if (Obj.outerHTML) { //if outerHTML is supported
Obj.outerHTML = str; ///it be easy change of whole ingredient with contents of str var
} else { //if outerHTML will not be any longer supported, there’s a rare nonetheless crossbrowsered trick
var tmpObj = chronicle.createElement(“div”);
tmpObj.innerHTML = ‘‘;
ObjParent = Obj.parentNode; //Okey, ingredient would possibly peaceful be parented
ObjParent.replaceChild(tmpObj, Obj); //here we inserting our temporary knowledge as an change of our purpose, so we are in a position to hunt down it then and replace it into no matter we want to replace to
ObjParent.innerHTML = ObjParent.innerHTML.replace(‘

‘, str);
}
}
characteristic loadfbApi() {
var js = chronicle.createElement(‘script’);
js.src=”
chronicle.physique.appendChild(js);
}
characteristic runYoutubeLazyLoad() {
/// youtube lazyload
var youtube = chronicle.querySelectorAll(“.youtube”);

for (var i = 0; i < youtube.measurement; i++) { var supply = "https://img.youtube.com/vi/" + youtube(i).dataset.embed + "http://192.168.2.55/0.jpg"; var portray = unique Order(); portray.src = "https://www.christian-dogma.com/themes/ch/resources/photos/no.jpg"; portray.classList.add('lazyload'); portray.setAttribute("knowledge-src", supply); portray.setAttribute("alt", "youtube"); portray.addEventListener("load", characteristic () { youtube(i).appendChild(portray); }(i)); youtube(i).addEventListener("click on", characteristic () { var iframe = chronicle.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); }); }; }

Provide link

Exit mobile version