PageSourceSearch

https://nzforensics.co.nz/public/js/forms.js?v6?1791008487179

js nzforensics.co.nz collected 2026-10-04 08:43:28 UTC 26,693 bytes, 683 lines download raw bytes

1app.registerValidationPlugin = function() {
2   $.fn.FormValidation = function(options){
3        return this.each(function(){
4            $(this).on('submit', function(){
5                formval.FormValidationWithError = false;
6                formval.submitted = true;
7                $(this).find('.required').each(function(){
8                    formval.validateRequired($(this));
9                });
10                $(this).find('.email').each(function(){
11                    if($(this).val() != ''){
12                        formval.validateEmail($(this));
13                    }
14                });
15                $(this).find('.numeric').each(function(){
16                	formval.validateNumeric($(this));
17                });
18                $(this).find('.url').each(function(){
19                	formval.validateURL($(this));
20                });
21                $(this).find('.match').each(function(){
22                	formval.validateMatch($(this));
23                });
24                if(formval.FormValidationWithError){
25                    return false;
26                }
27            });
28            $(this).find('.required, .email, .numeric, .url, .match').on('focus', function(){
29                formval.removeValidation($(this));
30            });
31            $(this).find('.required').on('blur', function(){
32                formval.validateRequired($(this));
33            });
34            $(this).find('.email').bind('blur keyup', function(){
35                if($(this).val() != ''){
36                    formval.validateEmail($(this));
37                }
38            });
39            $(this).find('.numeric').bind('blur keyup', function(){
40				   formval.validateNumeric($(this));
41            });
42            $(this).find('.numeric').on('keydown', function(e){
43                if(!e.shiftKey){
44                    var theKey = String.fromCharCode(e.keyCode);
45                    if(/[^0-9-()+\d]/.test(theKey) == true & e.keyCode != 8 & e.keyCode != 9 & e.keyCode != 37 & e.keyCode != 38 & e.keyCode != 39 & e.keyCode != 40 & e.keyCode != 96 & e.keyCode != 97 & e.keyCode != 98 & e.keyCode != 99 & e.keyCode != 100 & e.keyCode != 101 & e.keyCode != 102 & e.keyCode != 103 & e.keyCode != 104 & e.keyCode != 105 & e.keyCode != 190 & e.keyCode != 110){
46                        e.preventDefault();
47                    }
48                }else{
49                    e.preventDefault();
50                }
51            });
52            $(this).find('.url').bind('blur keyup', function(){
53				   formval.validateURL($(this));
54            });
55            $(this).find('.match').bind('blur keyup', function(){
56				   formval.validateURL($(this));
57            });
58        });
59    }    
60}
61
62
63app.registerFormEvents = function () {
64   var m = this;
65   
66   app.registerValidationPlugin();
67   app.postSubmitActionUrl = '';
68
69   $(".fnc-contact").off().on("click", function (e) {
70      app.showContactForm(this);
71   });
72
73   $(".fnc-guestbook-entry").off().on("click", function (e) {
74      app.showGuestbookForm(this);
75   });
76
77
78   $(".fnc-stock-enquiry").off().on("click", function (e) {
79     // console.log("fnc-stock-enquiry");
80      app.showContactForm(this, "stockquestion");
81   });
82
83   $(".fnc-subscribe-form").parents("form").off().on("submit", function (event) {
84      var input = this;
85      var docId = "history_" + app.g(0);
86      var subscribeForm = corridor(input);
87      console.log("subscribe-form", subscribeForm);
88   });
89
90
91   $(".fnc-submit-contact-form").parents("form").off().on("submit", function (event) {
92      var input = this;
93      var docId = "history_" + app.g(0);
94      var contactForm = corridor(input);
95      contactForm._id = docId;
96      contactForm.pdb = m.sessionDbName;
97      if (!contactForm.type) {
98         contactForm.type = 7; // custom form
99      }
100      
101      if (contactForm.type == 7 || contactForm.type == 12) { // custom form message, stock question
102         if (contactForm.content.length < 5) {
103            alert("Please provide a message.");
104            event.preventDefault();
105            return false;
106         }
107         
108         if (contactForm.email.length < 5) {
109            alert("Please provide a email address.");
110            event.preventDefault();
111            return false;
112         }
113      }
114      
115      if (contactForm.email && contactForm.phone) {
116         if (contactForm.email.length < 5 || contactForm.phone.length < 5) {
117            alert("Please provide an email address or contact telephone number.");
118            event.preventDefault();
119            return false;
120         }
121      }
122
123      var doc = {
124         _id: docId,
125         contentType: 'history',
126         url: window.location.host,
127         contactEmail: contactForm.email,
128         subject: contactForm.subject,
129         type: contactForm.type, 
130         metadata: JSON.stringify(contactForm)
131      }
132     // app.db.put(doc, function callback(err, result) {
133         //if (!err) {
134           // console.log('Successfully committed contact form! ID:' + docId);
135            //app.sync();
136            
137            $.ajax({
138               url: '/api/form/submit',
139               type: 'POST',
140               contentType: 'application/json',
141               data: JSON.stringify({
142                  _csrf: csrf_token,
143                  form: doc
144               }),
145               dataType: 'json',
146               success: function (d) {
147                  try {
148                     $('#dialog-send-confirm').modal('show');
149                     $('.fnc-navigate-home').off().on("click", function (ev) {
150                        $('#dialog-send-confirm').modal('hide');
151                        switch (app.postSubmitActionUrl) {
152                           case "_current":
153                              window.location = window.location.pathname;
154                              $("body").fadeOut(1000);
155                              break;
156                           case "_event":
157                              $( "window" ).trigger( "contactformsubmitted" );
158                              break;
159                           default:
160                              window.location = "/";
161                              $("body").fadeOut(1000);
162                              break;
163                        }
164                        
165                     });
166                  }
167                  catch(e) {
168                     window.location = "/";
169                     $("body").fadeOut(1000);
170                  }
171               },
172               failure: function () {
173                  alert("There was a problem submitting this form, please try again.");
174               }
175            });
176         //}
177      //});
178      event.preventDefault();
179      return false;
180   });
181   
182   $('.mj-forms').FormValidation();
183
184   $('.datepicker').each(function(){
185    $(this).datetimepicker({
186         format  : $(this).attr('data-date-format')
187     }); 
188   });
189   
190   $('.timepicker').each(function(){
191    $(this).datetimepicker({
192         format  : $(this).attr('data-time-format')
193     }); 
194   });
195   
196   $(document).on('submit', '.mj-forms', function(){
197     // get form object
198     var el = $(this).closest('form');
199   
200     // set button placeholder
201     $(el).find('[name=submit]').prop('disabled', true).innerHTML = 'Sending...';
202   
203     // remove any alert boxes
204     $(el).find('.alert').remove();
205      var fields = [];
206      var fldObj = {};
207      $(this).closest('form').find(".mj-form-field").each(function(i) { 
208         var fldName = $(this).children(":first").attr("name");
209         if (!fldName) {
210            fldName = $(this).children(":first").children(":first").attr("name");
211         }
212         fields.push({  
213            name: fldName
214         }) 
215         fldObj[fldName] = {};
216      });
217      $(this).closest('form').find(".mj-form-label").each(function(i) { 
218         fldObj[fields[i].name].name = $(this).text();
219         fldObj[fields[i].name].type = $(this).attr("class").replace("mj-form-label","").trim();
220      });
221   
222      // get all datas needed
223      var serialized_data = new FormData(this)
224      serialized_data.append('data-send-to', $(this).closest('form').attr('data-send-to'));
225      serialized_data.append('data-bcc', $(this).closest('form').attr('data-bcc'));
226      serialized_data.append('data-from-name', $(this).closest('form').attr('data-from-name'));
227      serialized_data.append('data-from-email', $(this).closest('form').attr('data-from-email'));
228      serialized_data.append('data-subject', $(this).closest('form').attr('data-subject'));
229      serialized_data.append('data-form', JSON.stringify(fldObj));
230      serialized_data.append('data-body', decodeURIComponent($(this).closest('form').attr('data-body')));
231      serialized_data.append('_csrf', csrf_token);
232      serialized_data.append('data-url', window.location.host);
233     
234      // get file data
235      $(this).closest('form').find('.mjFormBuilder_file').each(function(){
236         serialized_data.append('data-' + ($(this).attr('name')).replace('[]', '') + '-allowed-file-extensions', $(this).attr('data-allowed-file-extensions'));
237         serialized_data.append('data-' + ($(this).attr('name')).replace('[]', '') + '-maximum-file-size', $(this).attr('data-maximum-file-size'));
238      });
239   
240      // sending email
241      $.ajax({
242         type        : 'post',
243         dataType    : 'json',
244         data        : serialized_data,
245         processData : false, 
246         contentType : false,
247         cache       : false,
248         url         : '/api/form/formbuilder',
249         success     : function(data){
250             $('html, body').animate({scrollTop:$(el).offset().top});
251             if(data.success && data.error == ''){
252                 $(el).prepend('<div class="alert alert-success" role="alert">
252' + decodeURIComponent($(el).attr('data-confirmation-message')) + '</div>');
253                 $(el).find('input, select, textarea').val('');
254             }else{
255                 var errmsg = '';
256                 if(data.error == ''){
257                     errmsg += data.waiting_time > 0 && data.captcha ? "This form requires that you wait 30 seconds between submissions. Please try again in " + data.waiting_time + " seconds.\n" : '';
258                     errmsg += !data.captcha ? "Invalid reCaptcha.\n" : '';
259                 }else{
260                     errmsg += data.error;
261                 }
262                 $(el).prepend('<div class="alert alert-danger" role="alert">' + errmsg + '</div>');
263             }
264             $(el).find('[name=submit]').prop('disabled', false).innerHTML = 'Submit';
265         },
266         error   : function(param1, param2, param3){
267             console.log(param2);
268         }
269      });
270      
271      
272      // prevent default
273      return false;
274   });
275}
276
277app.processContactFormPostAction = function(doc) {
278   switch (app.postSubmitActionUrl) {
279      case "_current":
280         window.location = window.location.pathname;
281         $("body").fadeOut(1000);
282         break;
283      case "_event":
284         console.log("contactformsubmitted event");
285        // debugger;
286         $( app ).trigger( "contactformsubmitted", doc );
287         break;
288      default:
289         window.location = "/";
290         $("body").fadeOut(1000);
291         break;
292   }
293   app.postSubmitActionUrl = "";
294}
295
296
297app.showContactForm = function (m, mode) {
298   var c = {
299      title: "Contact Us",
300      subject: "Please fill out the form below",
301      mode: "contact",
302      context: "site",
303      contextId: 0,
304      contextCode: "",
305      locId: 0,
306      locName: "", 
307      userId: "",
308      userName: "",
309      custId: app.ls.profile.custId,
310      parentId: 0,
311      type: 27, // EMAIL MESSAGE
312      showConfirmationDialog: true
313   }
314
315   $(".form-price-match").css("display", "none");
316   $(".form-address-info").css("display", "none");
317   $(".form-item-review").css("display", "none");   
318   
319   if ($(m).attr("data-mode")) {
320      mode = $(m).attr("data-mode");// figure out what type of form
321   }
322   
323   if (!mode) {
324      mode = "contact";
325   }
326   
327   if ($(m).attr("disable-confirmation-dialog")) {
328      c.showConfirmationDialog = false;
329   }
330
331   switch (mode) {
332      case "stockenquiry": 
333      case "stockquestion": {
334         c.title = "Stock Enquiry";
335         var prd = $($(m).parents(".product-item")[0]);
336         c.type = 12; //HISTORY_STOCK_QUESTION = 12;
337         c.context = prd.attr("data-group-tree");
338         c.contextId = prd.attr("data-prd-id");
339         c.contextCode = prd.attr("data-prd-code");
340         c.template = $(m).attr("data-template");
341         c.locId = $(m).attr("data-location-id");
342         c.locName = $(m).attr("data-location-name");
343         
344         c.subject = prd.attr("data-item-name") + (c.locName ? " in " + c.locName : "") + " (" + c.contextCode + ")";
345         break;
346      }
347      case "productquestion": {
348         c.title = "Ask a question about this Item";
349         var prd = $($(m).parents(".product-item")[0]);
350         c.type = 2; //HISTORY_PRODUCT_QUESTION = 2;
351         c.context = prd.attr("data-group-tree");
352         c.contextId = prd.attr("data-prd-id");
353         c.contextCode = prd.attr("data-prd-code");
354         c.template = $(m).attr("data-template");
355         c.subject = prd.attr("data-item-name") + " (" + c.contextCode + ")";
356         break;
357      }
358      case "review": {
359         c.title = "Item Review";
360         var prd = $($(m).parents(".product-item")[0]);
361         c.type = 9; //HISTORY_REVIEW = 9
362         c.context = prd.attr("data-group-tree");
363         c.contextId = prd.attr("data-prd-id");
364         c.contextCode = prd.attr("data-prd-code");
365         c.template = $(m).attr("data-template");
366         c.subject = prd.attr("data-item-name") + " (" + c.contextCode + ")";
367         $(".form-item-review").css("display", "block");   
368         $("#contact-item-review").rating({ theme: 'krajee-svg', min: 1, max: 5, size: 'sm' });
369         break;
370      }
371      case "auctionquestion": {
372         c.title = "Auction Enquiry";
373         var prd = $($(m).parents(".auction-item")[0]);
374         c.type = 4; //HISTORY_AUCTION_QUESTION = 4;
375         c.context = prd.attr("data-group-tree");
376         c.contextId = prd.attr("data-prd-id");
377         c.contextCode = prd.attr("data-prd-code");
378         c.template = $(m).attr("data-template");
379         c.subject = prd.attr("data-item-name") + " (" + c.contextCode + ") Auction";
380         break;
381      }
382      case "pricequestion": {
383         c.title = "Price Enquiry";
384         var prd = $($(m).parents(".product-item")[0]);
385         c.type = 14; //HISTORY_PRICE_QUESTION = 14;
386         c.context = prd.attr("data-group-tree");
387         c.contextId = prd.attr("data-prd-id");
388         c.contextCode = prd.attr("data-prd-code");
389         $(".form-price-match").css("display", "block");
390         c.template = $(m).attr("data-template");
391         c.subject = prd.attr("data-item-name") + " (" + c.contextCode + ")";
392         break;
393      }
394      case "guestbook": {
395         c.title = "Guestbook Entry";
396         c.type = 37; //HISTORY_GUESTBOOK_ENTRY = 37
397         c.context = $(m).attr("data-page-name");
398         c.contextId = $(m).attr("data-page-id");
399         c.template = $(m).attr("data-template");
400         c.subject = "Guestbook Entry";
401         break;
402      }
403      case "message": {
404         c.title = "Website Message";
405         c.type = 27; //HISTORY_EMAIL_MESSAGE = 27;
406         c.subject = "General website question or enquiry";
407         break;
408      }
409      case "reply": {
410         var msg = $($(m).parents(".message-item")[0]);
411         c.title = (msg.attr("data-subject").indexOf("Re") == -1 ? "Re: " : "") + msg.attr("data-subject");
412         c.parentId = msg.attr("data-hst-id");
413         c.template = $(m).attr("data-template");
414         c.type = 27; //HISTORY_EMAIL_MESSAGE = 27;
415         c.subject = c.title;
416         break;
417      }
418      case "userform": {
419         c.title = "User Form";
420         var prd = $($(m).parents(".product-item")[0]);
421         c.type = 7; //HISTORY_USERFORM = 7;
422         c.context = prd.attr("data-group-tree");
423         c.contextId = prd.attr("data-prd-id");
424         c.contextCode = prd.attr("data-prd-code");
425         c.template = $(m).attr("data-template");
426         c.subject = prd.attr("data-item-name") + (c.contextCode ? (" (" + c.contextCode + ")") : "");
427         break;
428      }
429      case "directorycontact": {
430         c.title = $(m).attr("data-desc");
431         c.type = 7; //HISTORY_USERFORM = 7;
432         c.context =$(m).attr("data-group-tree");
433         c.contextId = $(m).attr("data-cust-id");
434         c.contextCode = $(m).attr("data-desc");
435         c.subject = $(m).attr("data-subject");
436         c.template = $(m).attr("data-template");
437         $(".form-address-info").css("display", "block");
438         break;
439      }
440      case "resultsubmission": {
441         c.title = $(m).attr("data-desc");
442         c.type = 7; //HISTORY_USERFORM = 7;
443         c.context =$(m).attr("data-group-tree");
444         c.contextId = $(m).attr("data-cust-id");
445         c.contextCode = $(m).attr("data-desc");
446         c.subject = $(m).attr("data-subject");
447         c.template = $(m).attr("data-template");
448         app.postSubmitActionUrl = "_event";
449         break;
450      }
451   }
452
453   if ($(m).attr("data-title")) {
454      c.title = $(m).attr("data-title");//  set the title override if any
455   }
456
457   // fill in the system fields
458   $("#contact-title-label").text(c.title);
459   $("#contact-subject-label").text(c.subject);
460
461   $("#contact-type").val(c.type);
462   $("#contact-template").val(c.template);
463   $("#contact-mode").val(c.mode);
464   $("#contact-context").val(c.context);
465   $("#contact-context-id").val(c.contextId);
466   $("#contact-context-code").val(c.contextCode);
467   $("#contact-subject").val(c.subject);
468   $("#contact-loc-id").val(c.locId);
469   $("#contact-loc-name").val(c.locName);
470   $("#contact-user-id").val(c.userId);
471   $("#contact-user-name").val(c.userName);
472
473   if (app.ls.profile.custId > 0) {
474      $("#contact-name").css("display", "none");
475      $("#contact-email").css("display", "none");
476      $("#contact-phone").css("display", "none");
477      
478      $("#contact-name").val((app.ls.profile.firstname ? app.ls.profile.firstname : "") + " " + (app.ls.profile.lastname ? app.ls.profile.lastname : ""));
479      $("#contact-email").val(app.ls.profile.email);
480      $("#contact-phone").val(app.ls.profile.phone);
481      
482      $("#contact-cust-id").val(app.ls.profile.custId);
483   } 
484
485   $("#contact-modal").modal("show");
486
487   $("#contact-form").off().on("submit", function (e) {
488      var input = this; //document.querySelector('#contact-form');
489      var docId = "history_" + app.g(0);
490      var contactForm = corridor(input);
491      contactForm._id = docId; 
492      contactForm.pdb = m.sessionDbName;
493      contactForm.mode = mode;
494      var doc = {
495         _id: docId,  
496         contentType: "history", 
497         url: window.location.host,
498         contactEmail: contactForm.email,
499         subject: contactForm.subject,
500         type: contactForm.type,
501         custId: contactForm.custId,
502         parentId: contactForm.parentId,
503         template: contactForm.template,
504         metadata: JSON.stringify(contactForm)
505      }
506   
507      if (contactForm.contextId) {
508         doc.prdId = contactForm.contextId;
509      }
510
511      if (doc.type == 9) { // product Review
512         if (contactForm["item-review-score"] < 1) {
513            alert("Please provide a review score.");
514            return false;
515         }
516      }
517      
518      if (doc.type == 7 || doc.type == 12) {  // contact and stock enquiry forms
519         if (contactForm.body.length < 3) {
520            alert("Please provide a message with your query.");
521            return false;
522         }
523      }
524      
525      if (contactForm.email.length < 5 && contactForm.phone.length < 5) {
526         alert("Please provide an email address or contact telephone number.");
527         e.preventDefault();
528         return false;
529      }
530
531     
532      app.db.put(doc, function callback(err, result) {
533         if (!err) {
534            //console.log('Successfully committed form! ID: ' + docId);
535            //app.sync();
536            
537            $.ajax({
538               url: '/api/form/submit',
539               type: 'POST',
540               contentType: 'application/json',
541               data: JSON.stringify({
542                  _csrf: csrf_token,
543                  form: doc
544               }),
545               dataType: 'json',
546               success: function (d) {
547                  if (typeof gtag_report_conversion !== "undefined") gtag_report_conversion();
548                  if (c.showConfirmationDialog) {
549                     $('#dialog-send-confirm').modal('show');
550                  } else {
551                     app.processContactFormPostAction(doc);
552                  }
553                  
554                  $('.fnc-navigate-home').off().on("click", function (ev) {
555                     $('#dialog-send-confirm').modal('hide');
556                     app.processContactFormPostAction(doc);
557                  });
558               },
559               failure: function () {
560                  alert("There was a problem submitting this form, please try again.");
561               }
562            });
563
564         }
565      });
566      event.preventDefault();
567      $("#contact-modal").modal("hide");
568      return false;
569   });
570};
571
572var formval = {
573   error_messages: {
574	required 	: 'This field is required',
575	email 		: 'Invalid e-mail address',
576	numeric 	: [
577		'This field must be numeric',
578		'This field must be at least {minimum}',
579		'This field must not exceed to {maximum}',
580		'This field must be at least {minimum} and must not exceed to {maximum}'
581	],
582	url 		: 'Invalid URL',
583	match 		: 'This field should match {match} field value'
584   },
585   FormValidationWithError: false,
586   submitted: false,
587   FormValidationErrMsg: '',
588
589   validateRequired: function(el){
590       if($(el).val() == '' || $(el).val() == null){
591           this.FormValidationWithError = true;
592           this.FormValidationErrMsg = formval.error_messages.required;
593           this.fnError($(el));
594       }else{
595       	if(!$(el).hasClass('email') && !$(el).hasClass('numeric') && !$(el).hasClass('url')){
596           	this.removeValidation($(el));
597       	}
598       }
599   },
600
601   validateEmail: function (el){
602      if(/^[a-zA-Z0-9]+[a-zA-Z0-9_.-]+[a-zA-Z0-9_-]+@[a-zA-Z0-9]+[a-zA-Z0-9.-]+[a-zA-Z0-9]+.[a-z]{2,4}$/.test($(el).val()) == false){
603         this.FormValidationWithError = true;
604         this.FormValidationErrMsg = formval.error_messages.email;
605         this.fnError($(el));
606      }else{
607         this.removeValidation($(el));
608      }
609   },
610
611   validateNumeric: function (el){
612   	if($(el).val() != ''){
613   		if((!isNaN(parseFloat($(el).val())) && isFinite($(el).val())) == false){
614   			this.FormValidationWithError = true;
615   			this.FormValidationErrMsg = formval.error_messages.numeric[0];
616   		}else{
617   			if($(el).attr('data-minimum') && !$(el).attr('data-maximum') && parseFloat($(el).val()) < parseFloat($(el).attr('data-minimum'))){
618   				this.FormValidationWithError = true;
619   				this.FormValidationErrMsg = formval.error_messages.numeric[1].replace('{minimum}', $(el).attr('data-minimum'));
620   				this.fnError($(el));
621   			}else if($(el).attr('data-maximum') && !$(el).attr('data-minimum') && parseFloat($(el).val()) > parseFloat($(el).attr('data-maximum'))){
622   				this.FormValidationWithError = true;
623   				this.FormValidationErrMsg = formval.error_messages.numeric[2].replace('{maximum}', $(el).attr('data-maximum'));
624   				this.fnError($(el));
625   			}else if($(el).attr('data-maximum') && $(el).attr('data-minimum') && (parseFloat($(el).val()) > parseFloat($(el).attr('data-maximum')) || parseFloat($(el).val()) < parseFloat($(el).attr('data-minimum')))){
626   				this.FormValidationWithError = true;
627   				this.FormValidationErrMsg = (formval.error_messages.numeric[3].replace('{minimum}', $(el).attr('data-minimum'))).replace('{maximum}', $(el).attr('data-maximum'));
628   				this.fnError($(el));
629   			}else{
630   				this.removeValidation($(el));
631   			}
632   		}
633   	}else{
634   		if(!$(el).hasClass('required')){
635   			this.removeValidation($(el));
636   		}
637   	}
638   },
639
640   validateURL: function (el){
641   	if($(el).val() != ''){
642   		if(!/^(https?|s?ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test($(el).val())){
643   			this.FormValidationWithError = true;
644   			this.FormValidationErrMsg = formval.error_messages.url;
645   			this.fnError($(el));
646   		}else{
647   			this.removeValidation($(el));
648   		}
649   	} else {
650   		if(!$(el).hasClass('required')){
651   			this.removeValidation($(el));
652   		}
653   	}
654   },
655
656   validateMatch: function(el){
657   	if($(el).val() != $('[name=' + $(el).attr('data-match-field') + ']').val()){
658   		this.FormValidationWithError = true;
659   		this.FormValidationErrMsg = formval.error_messages.match.replace('{match}', $(el).attr('data-match-field-label'));
660   		this.fnError($(el));
661   	}else{
662   		this.removeValidation($(el));
663   	}
664   },
665
666   removeValidation: function (el){
667       $(el).closest('.form-group').removeClass('has-error');
668       $(el).siblings('.validation').slideUp(400, function(){
669           $(this).remove();
670       });
671   },
672
673   fnError: function (el){
674       if($(el).siblings('.validation').size() == 0){
675           $(el).parent().append('<div class="validation">' + formval.FormValidationErrMsg + '</div>');
676           $(el).closest('.form-group').addClass('has-error');
677           $(el).siblings('.validation').stop(true, true).slideDown(400);
678       }
679       $('.validation').on('click', function(){
680           $(this).siblings().first().focus();
681       });
682   }
683}

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.