1var Popup = (function () { 2 3 // Local variables 4 // s == settings 5 var s = {}, 6 isExitPopupShown = false, 7 previousY = 0, 8 isPopupVisible = false; 9 10 // Show popup every... 11 var setCookie = function() { 12 Cookies.set('popup-shown', 'true', { 13 expires: 3 14 }); 15 }; 16 17 var close = function() { 18 s.popupOverlayEl.addClass('visuallyhidden'); 19 s.popupEl.addClass('visuallyhidden'); 20 21 isPopupVisible = false; 22 }; 23 24 var show = function() { 25 // If another popup is already visible - don't show the next one 26 if (!isPopupVisible) { 27 s.popupOverlayEl.removeClass('visuallyhidden'); 28 29 // Show the popup 30 s.popupEl.removeClass('visuallyhidden'); 31 32 isPopupVisible = true; 33 setCookie(); 34 } 35 }; 36 37 var init = function(config) { 38 s = config; 39 40 // Handle popup close events 41 42 // On outside popup click 43 s.popupOverlayEl.on('click', close); 44 45 // On "x" click 46 s.closeEl.on('click', close); 47 48 // But do nothing when clicked inside popup 49 s.popupEl.on('click', function (e) { 50 e.stopPropagation(); 51 }); 52 53 // Autoshow popup after x seconds 54 if (!Cookies.get('popup-shown')) { 55 56 // Show 1st time - autoshow 57 window.setTimeout(function () { 58 show(); 59 }, 5000); 60 61 // Show 2nd time - on exit 62 $(document).on('mousemove', function (e) { 63 if (e.pageY - $(document).scrollTop() <= 20 && previousY > e.pageY && !isExitPopupShown) { 64 show(); 65 isExitPopupShown = true; 66 } 67 68 previousY = e.pageY; 69 }); 70 } 71 }; 72 73 return { 74 init: init 75 }; 76 77})();
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.