1 2(function PvsInxmail() { 3 4 /** 5 * @constructor 6 */ 7 function PvsInxmail() { 8 9 /** 10 * that 11 * @type {PvsInxmail} 12 */ 13 var that = this; 14 15 /** 16 * hiddenClass 17 * @type {string} 18 */ 19 this.hiddenClass = 'hidden'; 20 21 /** 22 * formSelector 23 * @type {string} 24 */ 25 this.formSelector = '.form-inxmail'; 26 27 /** 28 * @method init 29 */ 30 this.init = function () { 31 that.initAjaxForm(); 32 }; 33 34 /** 35 * @method ajaxSubmit 36 * @description ajax submit 37 */ 38 this.ajaxSubmit = function (url, formData, $form) { 39 that.appendFormMessageHtml($form); 40 41 $.ajax({ 42 url: url, 43 type: 'POST', 44 data: formData, 45 success: function (result) { 46 that.appendFormMessageHtml($form, result); 47 }, 48 error: function (result) { 49 that.appendFormMessageHtml($form, result); 50 } 51 }); 52 }; 53 54 /** 55 * @method replaceFormHtml 56 * @description replaces the form html 57 */ 58 this.appendFormMessageHtml = function ($form, html = '') { 59 var $container = $form.find('[data-container="inxmail-form-messages"]'); 60 61 $container.html(html); 62 63 if (html !== '') { 64 $('body').animate({scrollTop: $form.offset().top}, 'slow'); 65 } 66 }; 67 68 /** 69 * @method initAjaxForm 70 * @description init ajax form handling 71 */ 72 this.initAjaxForm = function () { 73 $('body').on('submit', that.formSelector, function (e) { 74 var $this = $(this), 75 $form = $this.closest('form'), 76 url = $form.attr('data-ajax-url'), 77 $frcResponse = $form.find('input[name="frc-captcha-response"]'), 78 $captchaField = $form.find('input[name*="[captcha]"]'), 79 formData; 80 81 // Copy Friendly Captcha response to hidden captcha field 82 if ($frcResponse.length && $captchaField.length && $frcResponse.val()) { 83 $captchaField.val($frcResponse.val()); 84 } 85 86 formData = $form.serialize(); 87 88 // Remove frc-captcha-response from serialized data 89 formData = formData.replace(/&?frc-captcha-response=[^&]*&?/g, '').replace(/^&|&$/g, ''); 90 91 if (url !== undefined && url !== '') { 92 e.preventDefault(); 93 94 that.ajaxSubmit(url, formData, $form); 95 } 96 }); 97 } 98 99 this.init(); 100 } 101 102 $(document).ready(function () { 103 var pvsInxmail = new PvsInxmail(); 104 }); 105 106})();
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.