1(function () { 2 class BreakdanceSocialShareButtons { 3 constructor(selector) { 4 this.selector = selector; 5 this.buttons = document.querySelectorAll( 6 `${this.selector} .js-breakdance-share-button` 7 ); 8 this.buttonMobile = document.querySelector( 9 `${this.selector} .js-breakdance-share-mobile` 10 ); 11 this.init(); 12 } 13 14 // Methods 15 destroy() { 16 if (!this.buttons) return; 17 this.detachClickEvents(); 18 this.buttons = null; 19 } 20 21 update() { 22 this.destroy(); 23 this.init(); 24 } 25 26 detachClickEvents() { 27 if (this.buttons) { 28 this.buttons.forEach((socialButton) => { 29 socialButton.onclick = ""; 30 socialButton.classList.remove("is-visible"); 31 }); 32 this.buttonMobile.onclick = ""; 33 } 34 } 35 36 attachClickEvents() { 37 if (this.buttons) { 38 this.buttonMobile.onclick = () => { 39 this.buttons.forEach((socialButton) => 40 socialButton.classList.toggle("is-visible") 41 ); 42 }; 43 this.buttons.forEach((socialButton) => { 44 socialButton.onclick = function () { 45 let url = this.dataset.url 46 ? this.dataset.url 47 : window.location.href; 48 let title = encodeURIComponent(this.dataset.text ? this.dataset.text : document.title); 49 let text = title; 50 let image = ""; 51 52 const SOCIAL_SHARE_URLS = { 53 twitter: `https://twitter.com/intent/tweet?text=${text}\x20${url}`, 54 pinterest: `https://www.pinterest.com/pin/create/button/?url=${url}&media=${image}`, 55 facebook: `https://www.facebook.com/sharer.php?u=${url}`, 56 vk: `https://vkontakte.ru/share.php?url=${url}&title=${title}&description=${text}&image=${image}`, 57 linkedin: `https://www.linkedin.com/shareArticle?mini=true&url=${url}&title=${title}&summary=${text}&source=${url}`, 58 tumblr: `https://tumblr.com/share/link?url=${url}`, 59 digg: `https://digg.com/submit?url=${url}`, 60 reddit: `https://reddit.com/submit?url=${url}&title=${title}`, 61 stumbleupon: `https://www.stumbleupon.com/submit?url=${url}`, 62 pocket: `https://getpocket.com/edit?url=${url}`, 63 whatsapp: `https://api.whatsapp.com/send?text=${text} ${url}`, 64 xing: `https://www.xing.com/app/user?op=share&url=${url}`, 65 print: `print`, 66 email: `mailto:?subject=${title}&body=${text} ${url}`, 67 telegram: `https://telegram.me/share/url?url=${url}&text=${text}`, 68 skype: `https://web.skype.com/share?url=${url}`, 69 }; 70 71 let share_url = 72 SOCIAL_SHARE_URLS[this.dataset.network.toLowerCase()]; 73 if (share_url == "print") { 74 window.print(); 75 } else if (share_url) { 76 window.open(share_url, "popup", "width=600,height=480"); 77 } 78 }; 79 }); 80 } 81 } 82 83 init() { 84 this.attachClickEvents(); 85 } 86 } 87 88 window.BreakdanceSocialShareButtons = BreakdanceSocialShareButtons; 89})();
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.