1 2(function () { 3 'use strict'; 4 5 function buildShareUrl(baseUrl, parameters) { 6 const url = new URL(baseUrl); 7 8 Object.keys(parameters).forEach(function (key) { 9 url.searchParams.set(key, parameters[key]); 10 }); 11 12 return url.toString(); 13 } 14 15 function updateShareLink(id, href) { 16 const link = document.getElementById(id); 17 18 if (!(link instanceof HTMLAnchorElement)) { 19 return; 20 } 21 22 link.href = href; 23 link.rel = 'noopener noreferrer'; 24 } 25 26 document.addEventListener('DOMContentLoaded', function () { 27 const currentUrl = window.location.href; 28 const currentTitle = document.title; 29 30 updateShareLink( 31 'facebook-share', 32 buildShareUrl('https://www.facebook.com/sharer/sharer.php', { 33 u: currentUrl 34 }) 35 ); 36 37 updateShareLink( 38 'twitter-share', 39 buildShareUrl('https://twitter.com/intent/tweet', { 40 url: currentUrl, 41 text: currentTitle 42 }) 43 ); 44 45 updateShareLink( 46 'telegram-share', 47 buildShareUrl('https://t.me/share/url', { 48 url: currentUrl, 49 text: currentTitle 50 }) 51 ); 52 53 updateShareLink( 54 'whatsapp-share', 55 buildShareUrl('https://api.whatsapp.com/send', { 56 text: currentTitle + '\n' + currentUrl 57 }) 58 ); 59 }); 60})();
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.