1var method = FrontendBusiness.prototype; 2 3function FrontendBusiness() { 4 var self = this; 5 6 self._body = $("body"); 7 8 self.setClickEvents(); 9} 10 11method.setClickEvents = function () { 12 var self = this; 13 14 self._body 15 .off("click", "#send-business-contact-form .btn-submit") 16 .on("click", "#send-business-contact-form .btn-submit", function (ev) { 17 var form = $(this).closest("form"); 18 var data = form.serializeArray(); 19 20 self.doSend(data); 21 }); 22}; 23 24method.doSend = function (data) { 25 var self = this; 26 27 var notification_container = $(".notification_container"); 28 var notification_html = ''; 29 30 $.ajax({ 31 type: 'POST', 32 dataType: 'json', 33 data: data, 34 beforeSend: function () { 35 self.startLoading(); 36 }, 37 error: function (resp) { 38 self.stopLoading(); 39 notification_html += '<div class="alert alert-danger" role="alert">Interner Fehler, bitte wende Dich an den Administrator.</div>'; 40 }, 41 success: function (resp) { 42 self.stopLoading(); 43 44 if (resp.error_messages !== undefined && resp.error_messages.length !== 0) { 45 notification_html += '<div class="alert alert-danger mb-0" role="alert">'; 46 for (var key1 in resp.error_messages) { 47 var err1 = resp.error_messages[key1]; 48 notification_html += '<i class="fa fa-times"></i> ' + err1 + '<br />'; 49 } 50 notification_html += '</div>'; 51 } else if (resp.success_messages !== undefined && resp.success_messages.length !== 0) { 52 for (var key2 in resp.success_messages) { 53 var err2 = resp.success_messages[key2]; 54 notification_html += '<div class="alert alert-success text-center mb-0" role="alert">' + err2 + '</div>'; 55 } 56 57 $("#send-business-contact-form .btn-submit").slideUp(); 58 } 59 60 notification_container.html(notification_html); 61 notification_container.slideDown(); 62 } 63 }); 64}; 65 66method.startLoading = function (text) { 67 var loader = $(".ajax-loading"); 68 loader.removeClass("d-none"); 69 70 if (text !== undefined) { 71 loader.find("h3").html(text); 72 } 73}; 74 75method.stopLoading = function (delay) { 76 var loader = $(".ajax-loading"); 77 78 delay = delay === undefined ? 0 : delay; 79 80 setTimeout(function () { 81 loader.addClass("d-none"); 82 loader.find("h3").html(""); 83 }, delay); 84}; 85 86FrontendBusiness = new FrontendBusiness();
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.