1/** 2 * Social Share Links - Dynamically set social media sharing URLs 3 * Only runs if social share elements exist on the page 4 */ 5(function () { 6 'use strict'; 7 8 // Check if social share elements exist before proceeding 9 const socialContainer = document.querySelector('.social-share'); 10 if (!socialContainer) { 11 // No social share buttons on this page, skip 12 return; 13 } 14 15 try { 16 const link = encodeURI(window.location.href); 17 const titleElement = document.querySelector('title'); 18 const msg = titleElement ? encodeURIComponent(titleElement.textContent) : ''; 19 const title = msg; // Same as msg 20 21 // Facebook 22 const fb = document.querySelector('.facebook'); 23 if (fb) { 24 fb.href = `https://www.facebook.com/share.php?u=${link}`; 25 } 26 27 // Twitter 28 const twitter = document.querySelector('.twitter'); 29 if (twitter) { 30 twitter.href = `http://twitter.com/share?&url=${link}&text=${msg}&hashtags=maritime,maritime-news`; 31 } 32 33 // LinkedIn 34 const linkedIn = document.querySelector('.linkedin'); 35 if (linkedIn) { 36 linkedIn.href = `https://www.linkedin.com/sharing/share-offsite/?url=${link}`; 37 } 38 39 // Reddit 40 const reddit = document.querySelector('.reddit'); 41 if (reddit) { 42 reddit.href = `http://www.reddit.com/submit?url=${link}&title=${title}`; 43 } 44 45 // WhatsApp 46 const whatsapp = document.querySelector('.whatsapp'); 47 if (whatsapp) { 48 whatsapp.href = `https://api.whatsapp.com/send?text=${msg}: ${link}`; 49 } 50 51 // Telegram 52 const telegram = document.querySelector('.telegram'); 53 if (telegram) { 54 telegram.href = `https://telegram.me/share/url?url=${link}&text=${msg}`; 55 } 56 } catch (error) { 57 console.warn('Social share links initialization failed:', error); 58 } 59})();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.