Peanut Benefits: Lower Cholesterol with This Method
- لكن الفول السوداني يمكن أن يصبح ضارا إذا تم تناوله مملحا أو مقليا أو مطليا بالسكر؛ إذ يمكن أن يرفع ضغط الدم ويمتص الدهون المتحولة ويزيد مقاومة الأنسولين،...
- للاستفادة القصوى، يُنصح بإدراج الفول السوداني ضمن نظام غذائي متوازن مثل حمية البحر الأبيض المتوسط، مع الخضراوات والفواكه والحبوب الكاملة.
- This JavaScript code provides a function to parse social media links and extract relevant information, such as the source platform and the unique identifier of the post or...
This is an advertisement.
وداني، يقلل خطر الإصابة بأمراض القلب والسكتة الدماغية ويحسن مستويات الكوليسترول.
لكن الفول السوداني يمكن أن يصبح ضارا إذا تم تناوله مملحا أو مقليا أو مطليا بالسكر؛ إذ يمكن أن يرفع ضغط الدم ويمتص الدهون المتحولة ويزيد مقاومة الأنسولين، خاصة لدى المصابين بالسكري أو الدهون الزائدة في البطن. الإفراط في تناوله، حتى النوع الصحي، قد يؤدي أيضا إلى زيادة الوزن ويقوض الفوائد القلبية.
للاستفادة القصوى، يُنصح بإدراج الفول السوداني ضمن نظام غذائي متوازن مثل حمية البحر الأبيض المتوسط، مع الخضراوات والفواكه والحبوب الكاملة. وزبدة الفول السوداني الطبيعية بنسبة 100٪، دون إضافات من السكر أو الزيوت المهدرجة، تبقى خيارا صحيا مناسبا.
replaceOembeds();
function replaceOembeds() {
var allEmbeds = document.getElementsByTagName("OEMBED");
while (allEmbeds.length != 0) {
replaceOembedWithHtml(allEmbeds[0], extractLinkFromOembed(allEmbeds[0]));
allEmbeds = document.getElementsByTagName("OEMBED");
}
runYoutubeLazyLoad();
}
function replaceOembedWithHtml(element, sourceData) {
if (sourceData.source.toLowerCase() === "youtube") {
var html="
';
replaceElementWithHtml(element, html);
} else if (sourceData.source.toLowerCase() === "instagram") {
var html="
';
replaceElementWithHtml(element, html);
} else if (sourceData.source.toLowerCase() === "twitter") {
var html="
';
replaceElementWithHtml(element,html);
} else if (sourceData.source.toLowerCase() === "facebook") {
loadfbApi();
var html="
'
replaceElementWithHtml(element, html);
} else {
replaceElementWithHtml(element, "");
}
}
function extractLinkFromOembed(element) {
return getUrlSource(element.getAttribute("url"));
}
function getUrlSource(url) {
var ytRegex = /http(?:s?)://(?:www.)?youtu(?:be.com/watch?v=|.be/)([w-_]*)(&(amp;)?[w?=]*)?/;
var instaRegex = /(https?://www.)?instagram.com(/p/(w+)/?)/;
var twitterRegex = /twitter.com/.*/status(?:es)?/([^/?]+)/;
var fbRegex = /^https?://www.facebook.com.*/(video(```html
Table of Contents
This JavaScript code provides a function to parse social media links and extract relevant information, such as the source platform and the unique identifier of the post or video.
Functionality
The parseSocialMediaLink function takes a URL as input and attempts to identify the social media platform based on regular expressions. It currently supports YouTube,Instagram,Twitter (X),and Facebook.
Code breakdown
function parseSocialMediaLink(url) {
const ytRegex = /^(?:https?://)?(?:www.)?(?:youtube.com/(?:[^/ns]+/S+/|(?:v|e(?:mbed)?)/|S*?[?&]v=)|youtu.be/)([a-zA-Z0-9_-]{11})/;
const instaRegex = /^(?:https?://)?(?:www.)?instagram.com/(?:p/|reel/)([a-zA-Z0-9_-]+)/;
const twitterRegex = /^(?:https?://)?(?:www.)?twitter.com/(?:[^/]+)/status/([0-9]+)/;
const fbRegex = /^(?:https?://)?(?:www.)?facebook.com/(?:[^/]+)/posts/([0-9]+)/;
if (ytRegex.test(url)) {
return {
source: "Youtube",
url: url,
id: ytRegex.exec(url)[1]
};
}
if (instaRegex.test(url)) {
return {
source: "Instagram",
url: url,
id: instaRegex.exec(url)[3]
};
}
if (twitterRegex.test(url)) {
return {
source: "Twitter",
url: url,
id: twitterRegex.exec(url)[1]
};
}
if (fbRegex.test(url)) {
return {
source: "Facebook",
url: url,
id: fbRegex.exec(url)[1]
};
}
return {
source: "Unknown",
url: url,
id: ""
};
}
function replaceElementWithHtml(element, html) {
var str = html;
var Obj = element; //any element to be fully replaced
if (obj.outerHTML) { //if outerHTML is supported
Obj.outerHTML = str; ///it's simple replacement of whole element with content
}
}
The function returns an object with the following properties:
source: The name of the social media platform (e.g., "Youtube", "Instagram", "Twitter", "Facebook", or "Unknown").url: The original URL.id: the unique identifier of the post or video.
Regular Expressions
The code utilizes regular expressions to match the URL patterns of each social media platform. Here's a breakdown:
- YouTube:
/^(?:https?://)?(?:www.)?(?:youtube.com/(?:[^/ns]+/S+/|(?:v|e(?:mbed)?)/|S*?[?&]v=)|youtu.be/)([a-zA-Z0-9_-]{11})/ - Instagram:
/^(?:https?://)?(?:www.)?instagram.com/(?:p/|reel/)([a-zA-Z0-9_-]+)/ - Twitter (X):
/^(?:https?://)?(?:www.)?twitter.com/(?:[^/]+)/status/([0-9]+)/ - Facebook:
/^(?:https?://)?(?:www.)?facebook.com/(?:[^/]+)/posts/([0-9]+)/
