.اشترك في نشرتنا الإخبارية لتحصل على أهم و أبرز أخبار اليوم
');
printWindow.document.close();
printWindow.print();
});
$("#btnShareInstagram").on("click", function () {
var link = document.location.href;
var encoded = encodeURIComponent(link);
var instagramShareUrl = "https://www.instagram.com/?url=" + encoded;
window.open(instagramShareUrl, '_blank', 'width=550,height=420');
});
$("#btnShareLinkedIn").on("click", function () {
var link = document.location.href;
var encoded = encodeURIComponent(link);
var linkedinShareUrl = "https://www.linkedin.com/shareArticle?mini=true&url=" + encoded + "&title=" + encodedTitle;
window.open(linkedinShareUrl, '_blank', 'width=550,height=420');
});
$("#btnShareFBMobile").on("click", function () {
var link = document.location.href;
var pageTitle = encodeURIComponent(link);
window.open('https://www.facebook.com/sharer/sharer.php?u=' + link, 'facebook-share-dialog', 'width=626,height=436');
});
$("#btnShareTwitterMobile").on("click", function () {
var link = document.location.href;
var encoded = encodeURIComponent(link);
var twitterShareUrl = "https://twitter.com/intent/tweet?text=" + encodedTitle + "&url=" + encoded;
window.open(twitterShareUrl, '_blank', 'width=550,height=420');
});
$("#btnShareMessengerMobile").on("click", function () {
var link = document.location.href;
var encoded = encodeURIComponent(link);
var messengerShareUrl = "fb-messenger://share/?link=" + encoded;
window.open(messengerShareUrl, '_blank', 'width=550,height=420');
});
$("#btnShareTelegramMobile").on("click", function () {
var link = document.location.href; // Get the current page URL
var encoded = encodeURIComponent(link); // Encode the URL
var telegramShareUrl = "https://t.me/share/url?url=" + encoded + "&text=" + encodedTitle;
window.open(telegramShareUrl, '_blank', 'width=550,height=420');
});
$("#btnShareWhatsappMobile").on("click", function () {
var link = document.location.href;
var encoded = encodeURIComponent(link);
var whatsappShareUrl = "https://api.whatsapp.com/send?text=" + encodedTitle + " " + encoded;
window.open(whatsappShareUrl, '_blank', 'width=550,height=420');
});
$("#btnShareMailMobile").on("click", function () {
var link = document.location.href;
var encoded = encodeURIComponent(link);
var mailShareUrl = "mailto:?subject=" + encodedTitle + "&body=" + encoded;
window.open(mailShareUrl, '_blank', 'width=550,height=420');
});
$("#btnSharePrintMobile").on("click", function () {
// print only article content
var printContents = document.querySelector(".topSection .title").innerHTML;
printContents += document.querySelector(".imgContainer").outerHTML;
printContents += document.querySelector(".bodyText").innerHTML;
// print printContents
var printWindow = window.open('', '', 'height=400,width=800');
printWindow.document.write('
');
printWindow.document.write('body {direction: rtl;}
');
printWindow.document.close();
printWindow.print();
});
$("#btnShareInstagramMobile").on("click", function () {
var link = document.location.href;
var encoded = encodeURIComponent(link);
var instagramShareUrl = "https://www.instagram.com/?url=" + encoded;
window.open(instagramShareUrl, '_blank', 'width=550,height=420');
});
$("#btnShareLinkedInMobile").on("click", function () {
var link = document.location.href;
var encoded = encodeURIComponent(link);
var linkedinShareUrl = "https://www.linkedin.com/shareArticle?mini=true&url=" + encoded + "&title=" + encodedTitle;
window.open(linkedinShareUrl, '_blank', 'width=550,height=420');
});
})
document.addEventListener('DOMContentLoaded', () => {
const articleId = document.getElementById('articleId').value;
const authorName = document.getElementById('authorName').value;
if (articleId && authorName) {
gtag('event', 'view', {
'event_category': 'Article',
'event_label': authorName,
'value': 1
});
}
});