1let Share = (function() { 2 'use strict'; 3 4 init(); 5 function init() { 6 bindEvents(); 7 } 8 9 /** 10 * Binds necessary event handlers. 11 */ 12 function bindEvents() { 13 $(window).on('click scroll resize', hideDropdown); 14 $('body').on('click', '.js-share', showDropdown); 15 } 16 17 /** 18 * Removes dropdown from DOM. 19 */ 20 function hideDropdown(e) { 21 $('.js-share-dropdown').remove(); 22 $('.share-overlay').remove(); 23 } 24 25 /** 26 * Slides dropdown from bottom if on mobile or positions under 27 * the button on desktop. 28 */ 29 function showDropdown(e) { 30 let $this = $(this); 31 let facebookLink = $this.data('facebook'); 32 let twitterLink = $this.data('twitter'); 33 let $dropdown = $('<div class="share-dropdown js-share-dropdown">' + 34 '<h6 class="share-dropdown__headline">Share</h6>' + 35 '<a class="share-dropdown__item share-dropdown__item--facebook" href="' + facebookLink + '" target="_blank">Facebook</a>' + 36 '<a class="share-dropdown__item share-dropdown__item--twitter" href="' + twitterLink + '" target="_blank">Twitter</a>' + 37 //'<a class="share-dropdown__item share-dropdown__item--email" href="' + emailLink + '" target="_blank">Email</a>' + 38 '</div>'); 39 let $overlay = $('<div class="share-overlay"></div>'); 40 41 // Hide visible dropdowns 42 hideDropdown(); 43 44 // Get dropdown position 45 let left = e.pageX; 46 let top = e.pageY + 36; 47 $dropdown.css({ 48 'top': top, 49 'left': left 50 }); 51 52 $('body').append($overlay).append($dropdown); 53 setTimeout(function() { $dropdown.addClass('is-visible'); }, 100); 54 55 e.preventDefault(); 56 e.stopPropagation(); 57 } 58 59 return self; 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.