https://gowlangsfordgallery.co.nz/lib/g/2.0/scripts/artlogic_modul…/mailinglist_signup_form_popup.js
1import fancyboxPlugin from '../plugins/fancybox-2.1.3.js'; 2 3var mailinglist_signup_form_popup = { 4 5 init: function() { 6 7 $('#mailinglist_signup_close_popup_link, #mailinglist_signup_close_popup_link a, #mailing_list_popup_overlay') 8 .off() 9 .click(function() { 10 window.galleries.mailinglist_signup_form_popup.close(); 11 return false; 12 }) 13 ; 14 15 $('a.mailinglist_signup_popup_link') 16 .off() 17 .click(function() { 18 // For accessibility - tracks which element to refocus on 19 try { 20 h.accessibility.global_variables.element_to_refocus_to = $(this); 21 } catch(error) { 22 console.error(error); 23 } 24 if ($('body').hasClass('slide-nav-active')) { 25 $('#top_nav_reveal').trigger('click'); 26 } 27 28 window.galleries.mailinglist_signup_form_popup.open(); 29 30 return false; 31 }) 32 ; 33 34 if (!$('body').hasClass('splash-loader-active')) { 35 window.galleries.mailinglist_signup_form_popup.auto_popup(); 36 } 37 if ($('#mailing_list_popup_container').hasClass('auto_popup_exit')) { 38 // Exit intent 39 if (!h.getCookie('shown_mailing_list_popup_exit_intent')) { 40 setTimeout(function() { 41 var exit_intent_timeout; 42 $(document).off('mouseout.exitintent').on("mouseout.exitintent", function(evt) { 43 exit_intent_timeout = setTimeout(function() { 44 if(evt.toElement === null && evt.relatedTarget === null) { 45 $(evt.currentTarget).off('mouseout.exitintent'); 46 $(evt.currentTarget).off('mouseover.exitintent'); 47 window.galleries.mailinglist_signup_form_popup.auto_popup(true, 'exit_intent'); 48 } 49 }, 750); 50 }); 51 $(document).off('mouseover.exitintent').on("mouseover.exitintent", function(evt) { 52 if (typeof exit_intent_timeout != 'undefined') { 53 clearTimeout(exit_intent_timeout); 54 } 55 }); 56 }, 2000); 57 } 58 } 59 60 // 61 // DEPRICATED METHOD 62 // 63 $('a#mailinglist_signup_popup_link') 64 .click(function() { 65 66 $.fancybox.open( 67 '/contact/mailinglist_signup/?modal=1', 68 { 69 type: 'ajax', 70 autoSize: false, 71 height: 'auto', 72 width: 420, 73 arrows: false, 74 prevEffect: 'fade', 75 nextEffect: 'fade', 76 closeEffect: 'fade', 77 openEffect: 'fade', 78 wrapCSS: 'fancybox_ajax_popup', 79 prevSpeed: 750, 80 nextSpeed: 750, 81 closeSpeed: 200, 82 openSpeed: 400, 83 padding: 25, 84 afterShow: function() { 85 window.galleries.mailinglist_signup_form_popup.after_popup(); 86 } 87 } 88 ); 89 90 return false;
91 }) 92 ; 93 94 }, 95 96 open: function() { 97 98 $('body').addClass('mailing_list_popup_active'); 99 setTimeout(function() { 100 $('body').addClass('mailing_list_popup_visible'); 101 h.accessibility.on_popup_opening($('#mailing_list_popup_box'), $('#mailing_list_popup_box').find('input[type!="hidden"]:first'), '#mailinglist_signup_close_popup_link a'); 102 window.galleries.mailinglist_signup_form_popup.after_popup(); 103 }, 50); 104 105 }, 106 107 close: function() { 108 109 $('body').removeClass('mailing_list_popup_visible'); 110 setTimeout(function() { 111 $('body').removeClass('mailing_list_popup_active'); 112 }, 400); 113 114 h.accessibility.on_popup_closing(); 115 116 }, 117 118 auto_popup: function(instant, context_name) { 119 instant = typeof instant != 'undefined' ? instant : false; 120 context_name = typeof context_name != 'undefined' ? '_' + context_name : ''; 121 if ($('#mailing_list_popup_container').hasClass('auto_popup')) { 122 var timeout = 1000; 123 var expiry = 3600; 124 125 if ($('#mailing_list_popup_container').attr('data-timeout')) { 126 timeout = parseFloat($('#mailing_list_popup_container').attr('data-timeout'))*1000; 127 } 128 129 if ($('#mailing_list_popup_container').attr('data-cookie-expiry')){ 130 expiry = parseFloat($('#mailing_list_popup_container').attr('data-cookie-expiry')); 131 } 132 133 if (typeof mailing_list_popup_timeout != 'undefined') { 134 clearTimeout(mailing_list_popup_timeout); 135 } 136 137 if (window.location.search == '?mailings_popup_forced=1') { 138 timeout = 2000; 139 } 140 if (instant) { 141 timeout = 0; 142 } 143 144 var mailing_list_popup_timeout = setTimeout(function() { 145 if (!$('body').hasClass('protected-path-login-mode')) { 146 if(instant || !h.getCookie('shown_mailing_list_popup' + context_name) || window.location.search == '?mailings_popup_forced=1'){ 147 148 var element_in_focus = $(':focus'); 149 if (element_in_focus.length < 1) { 150 element_in_focus = $('#logo a'); 151 } 152 153 try { 154 h.accessibility.global_variables.element_to_refocus_to = element_in_focus; 155 } catch(error) { 156 console.error(error); 157 } 158 159 window.galleries.mailinglist_signup_form_popup.open(); 160 161 $(document).off('mouseover.exitintent'); 162 $(document).off('mouseout.exitintent'); 163 164 h.setCookie('shown_mailing_list_popup' + context_name, 'true', '', expiry); // Set cookie for chosen seconds 165 } 166 } 167 }, timeout); 168 } 169 }, 170 171 after_popup: function() { 172 if (typeof google_captcha_onload != 'undefined') { 173 google_captcha_onload(); 174 } 175 } 176 177} 178 179window.galleries = window.galleries || {}; 180window.galleries.mailinglist_signup_form_popup = mailinglist_signup_form_popup; 181export default mailinglist_signup_form_popup;
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.