1/** 2 * Gel 2022.0 3 * News & Blog Custom Asset JS 4 * @version 2022.0.1 5 * @created 2015-05-26 by Fritz Green 6 * @modified 2022-02-18 by Fritz Green 7 */ 8 9/************************** 10 *** GLOBAL VARIABLES *** 11 **************************/ 12var imgRt = ""; // base url to images 13 14// Scripts to execute when document is fully loaded 15$(function() { 16 17 // Add List Category filter listener 18 urlSelectFilterListeners('.posts-category-filter'); 19 20 // Add Show Email Subscribe Button Listener 21 subscribeLstnr(); 22 23 // Add Email Subscribe Form Listeners 24 subscribeFormLstnrs(); 25 26}); 27 28/** 29 * Toggle the Email Subscription Form Open/Closed 30 */ 31function subscribeLstnr() { 32 33 $(".post-subscribe-btn").off('keydown click').on('keydown click', function(e) { 34 if (testClickEnterSpace(e)) { 35 console.log("subscribeLstner() triggered"); 36 37 e.stopPropagation(); 38 39 var $t = $(this), $pso = $('.posts-subscribe-overlay'), a = dfFx, o = dfFxOpts, s = dfFxDur; 40 41 // Reset the errors and form 42 $('#subscription_errors').html(''); 43 $('#post-subscribe-form')[0].reset(); 44 45 // Open the overlay. 46 $pso.toggle(a, o, s); 47 48 // Add overlay handlers. 49 overlayHandler($pso, $t, a, o, s, ""); 50 } 51 }); 52 53} 54 55/** 56 * Subscribe user form handler. 57 * @returns {boolean} 58 */ 59function subscribeFormLstnrs() { 60 61 $("#post-subscribe-form").submit(function(e) { 62 e.preventDefault(); 63 64 var form = $(this); 65 66 var err = '', se = $('#subscriber_email'), sube = $('.subscribe-errors'); 67 68 var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/; 69 70 // Inline Validations 71 if ($('#subscriber_fname').val() === '') err = err+'Please provide your first name.<br>'; 72 if ($('#subscriber_lname').val() === '') err = err+'Please provide your last name.<br>'; 73 if (se.val() === '') 74 err = err+'Please provide your email address.<br>'; 75 else if (!filter.test(se.val())) 76 err = err+'Please provide a valid email address.<br>'; 77 78 if (err !== '') { 79 80 sube.html('<div class="error"><svg viewBox="0 0 100 100"><use xlink:href="#error" href="#error"></use></svg>'+err+'</div>').show('blind'); 81 82 } else { 83 84 $.ajax({ 85 86 url: 'ajax_email_subscription.php', 87 type: 'POST', 88 dataType: 'json', 89 data: form.serialize() 90 91 }).done(function(data){ 92 console.log("Here!"); 93 94 // Replace form with response output. 95 animateReplace(form, data.output).done(function() { 96 // Reset the overlay handlers. Uses the olGlbls global variable array to reset the handlers using the same settings that the overlay was initialized with. 97 overlayHandler(olGlbls["m"], olGlbls["n"], olGlbls["a"], olGlbls["o"], olGlbls["s"], olGlbls["c"]); 98 }); 99 100 }).fail(function(){ 101 console.log("oops!"); 102 sube.html('<div class="error"><svg viewBox="0 0 100 100"><use xlink:href="#error" href="#error"></use></svg><p>Something went wrong while subscribing your email address. Please contact us for help.</p></div>').show('blind'); 103 setTimeout(function(){ 104 $('#subscription_errors').hide('blind'); 105 }, 5000); 106 107 }); 108 } 109 110 return false; 111 112 }); 113}
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.