1// Set Cookie 2function wcmd_setCookie(cname, cvalue, exdays) { 3 var d = new Date(); 4 d.setTime(d.getTime() + (exdays*24*60*60*1000)); 5 var expires = "expires="+d.toUTCString(); 6 document.cookie = cname + "=" + cvalue + "; " + expires + ";path=/"; 7} 8 9// Get Cookie 10function wcmd_getCookie(cname) { 11 var name = cname + "="; 12 var ca = document.cookie.split(';'); 13 for(var i=0; i<ca.length; i++) { 14 var c = ca[i]; 15 while (c.charAt(0)==' ') c = c.substring(1); 16 if (c.indexOf(name) != -1) return c.substring(name.length,c.length); 17 } 18 return ""; 19} 20 21function wcmd_isEmail(email) { 22 var regex = /^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/; 23 return regex.test(email); 24} 25function open_wcmd_modal() { 26 if( wcmd.wcmd_home == 'yes' && wcmd.is_home != '1' ) return; 27 if( jQuery('#wcmd_modal').length > 0 ){ 28 var overlayClick = wcmd.overlay_click == 'yes' ? true : false; 29 jQuery.magnificPopup.open({ 30 items: { 31 src: '#wcmd_modal' 32 }, 33 type: 'inline', 34 removalDelay: 1000, 35 closeOnBgClick: overlayClick, 36 callbacks: { 37 beforeOpen: function() { 38 this.st.mainClass = wcmd.effect; 39 }, 40 beforeClose: function() { 41 if( wcmd.hinge == 'yes' ) 42 this.content.addClass('hinge'); 43 else 44 jQuery('.mfp-wrap').css('background', 'transparent'); 45 }, 46 close: function() { 47 if( wcmd.hinge == 'yes' ) 48 this.content.removeClass('hinge'); 49 wcmd_setCookie( 'wcmd', 'yes', wcmd.cookie_length ); 50 }, 51 open: function(){ 52 jQuery('.mfp-wrap').css('background', wcmd.overlayColor); 53 } 54 } 55 }); 56 } 57} 58 59jQuery(document).ready(function($) { 60 if( wcmd_getCookie('wcmd') != 'yes' && wcmd.wcmd_popup != 'yes' ) { 61 if( wcmd.exit_intent == 'yes' ) 62 $(document).on( 'mouseleave', open_wcmd_modal ); 63 else if( wcmd.only_btn != 'yes' ) 64 setTimeout( open_wcmd_modal, wcmd.delay*1000 ); 65 } 66 if( wcmd.btn_trigger == 'yes' ){ 67 $('body').on('click','.wcmd-trigger',function(e){ 68 e.preventDefault(); 69 open_wcmd_modal(); 70 }); 71 } 72 73 function wcmd_close_popup(){ 74 $.magnificPopup.close(); 75 } 76 $('.wcmd-form').submit(function() { 77 msg = ''; 78 $form = $(this); 79 $form.find('.wcmd-validation').removeClass('success').hide(); 80 if(wcmd_isEmail($form.find('.wcmd_email').val())) { 81 $form.parents('.wcmd-form-wrapper,#wcmd_modal').find('.wcmd-loading ').show(); 82 $.post( 83 wcmd.ajax_url, 84 {email: $form.find('.wcmd_email').val(), fname: $form.find('.wcmd_fname').val(), lname: $form.find('.wcmd_lname').val(), action: 'wcmd_subscribe'}, 85 function(data) { 86 var response = jQuery.parseJSON(data); 87 $form.parents('.wcmd-form-wrapper,#wcmd_modal').find('.wcmd-loading ').hide(); 88 if( typeof response.status !== "undefined" && response.status == 'error' ) 89 $form.find('.wcmd-validation').html(response.error).css('display','inline-block'); 90 else{ 91 if( wcmd.close_time > 0 && $('.mfp-ready').length > 0 ) 92 setTimeout( wcmd_close_popup, wcmd.close_time*1000 ); 93 $form.find('.wcmd-validation').html(wcmd.success).addClass('success').css('display','inline-block'); 94 } 95 }); 96 } 97 else 98 $form.find('.wcmd-validation').html( wcmd.valid_email ).css('display','inline-block'); 99 100 return false; 101 }); 102 103});
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.