1(function( $ ) { 2 'use strict'; 3 4 /** 5 * All of the code for your public-facing JavaScript source 6 * should reside in this file. 7 * 8 * Note that this assume you're going to use jQuery, so it prepares 9 * the $ function reference to be used within the scope of this 10 * function. 11 * 12 * From here, you're able to define handlers for when the DOM is 13 * ready: 14 * 15 * $(function() { 16 * 17 * }); 18 * 19 * Or when the window is loaded: 20 * 21 * $( window ).load(function() { 22 * 23 * }); 24 * 25 * ...and so on. 26 * 27 * Remember that ideally, we should not attach any more than a single DOM-ready or window-load handler 28 * for any particular page. Though other scripts in WordPress core, other plugins, and other themes may 29 * be doing this, we should try to minimize doing that in our own work. 30 */ 31 32 $(document).ready(function(){ 33 $('.datepicker').datepicker({ 34 yearRange: "-99:+50", 35 //dateFormat : aol_public.date_format, 36 changeMonth: true, 37 changeYear: true, 38 }); 39 40 /*Setting Textarea Charchter Counter*/ 41 $('textarea, input[type=text]').keyup(function() { 42 43 var characterCount = $(this).val().length, 44 current = $(this).parent().find('.current'), 45 maximum = $(this).parent().find('.maximum'), 46 theCount = $(this).parent().find('.the-count'); 47 48 current.text(characterCount); 49 50 51 /*This isn't entirely necessary, just playin around*/ 52 if (characterCount < 70) { 53 current.css('color', '#666'); 54 } 55 if (characterCount > 70 && characterCount < 90) { 56 current.css('color', '#6d5555'); 57 } 58 if (characterCount > 90 && characterCount < 100) { 59 current.css('color', '#793535'); 60 } 61 if (characterCount > 100 && characterCount < 120) { 62 current.css('color', '#841c1c'); 63 } 64 if (characterCount > 120 && characterCount < 139) { 65 current.css('color', '#8f0001'); 66 } 67 68 if (characterCount >= 140) { 69 maximum.css('color', '#8f0001'); 70 current.css('color', '#8f0001'); 71 theCount.css('font-weight','bold'); 72 } else { 73 maximum.css('color','#666'); 74 theCount.css('font-weight','normal'); 75 } 76 77 78 }); 79 /*Ends Textarea Charchter Counter*/ 80 81 /*Submit Application Form*/ 82 $( ".aol_app_form" ).submit(function(){ 83 var datastring = new FormData(document.getElementById("aol_app_form")); 84 $.ajax({ 85 url: aol_public.ajaxurl, 86 type: 'POST', 87 dataType: 'json', 88 data: datastring, 89 //async: false, 90 cache: false, 91 contentType: false, 92 processData: false, 93 beforeSend: function(){ 94 $('#aol_form_status').removeClass(); 95 $('#aol_form_status').html('<img src="'+aol_public.url+'/images/loading.gif" />'); 96 $('#aol_form_status').addClass('alert alert-warning'); 97 $(".aol-form-button").prop('disabled', true); 98 }, 99 success:function(response){ 100 $(document).trigger('afterAppSubmit', response); //Custom event on ajax completiong 101 102 if(response['success']==true){ 103 $('#aol_form_status').removeClass(); 104 $('#aol_form_status').addClass('alert alert-success'); 105 $('#aol_form_status').html(response['message']); 106 $(".aol-form-button").prop('disabled', false); 107 if(response['hide_form']==true) $('.aol_app_form').slideUp(); //Show a sliding effecnt. 108 109 //Divert to thank you page. 110 if(response.divert != null){ 111 var page = response.divert; 112 window.location.href = stripslashes(page); 113 } 114 } 115 else if(response['success']==false){ 116 $('#aol_form_status').removeClass(); 117 $('#aol_form_status').addClass('alert alert-danger'); 118 $('#aol_form_status').html(response['error']); 119 $(".aol-form-button").prop('disabled', false); 120 } 121 //If response is not jSon. 122 else{ 123 $('#aol_form_status').addClass('alert alert-danger'); 124 $('#aol_form_status').html('Form saved with errors. Please contact us for more information. '); 125 $(".aol-form-button").prop('disabled', false); 126 } 127 }, 128 error: function(xhr, type, error){ 129 $('#aol_form_status').removeClass(); 130 $('#aol_form_status').addClass('alert alert-danger'); 131 $('#aol_form_status').html('An unexpected error occured with error code: <u>' + xhr.status + " " + xhr.statusText+'</u>. '+error+'. Please contact us for more information.'); 132 $(".aol-form-button").prop('disabled', false); 133 }, 134 // Custom XMLHttpRequest 135 xhr: function () { 136 $('progress').attr({ 137 value: 0, 138 }); 139 var myXhr = $.ajaxSettings.xhr(); 140 if (myXhr.upload) { 141 // For handling the progress of the upload 142 myXhr.upload.addEventListener('progress', function (e) { 143 if (e.lengthComputable) { 144 $('progress').attr({ 145 value: e.loaded, 146 max: e.total, 147 }); 148 } 149 }, false); 150 } 151 return myXhr; 152 }, 153 }); 154 return false;
155 }); 156 157 //Separator Code 158 $('.aol_multistep').click(function() { 159 $('fieldset').hide(); 160 var load = $(this).data('load'); 161 if( load == 'next' ) $(this).parent("fieldset").next("fieldset").show(); 162 else if( load == 'back' ) $(this).parent("fieldset").prev("fieldset").show(); else $(this).parent("fieldset").previous("fieldset").show(); 163 164 return false; 165 }); 166 }) 167 168})( jQuery ); 169 170function stripslashes (str) { 171 return (str + '').replace(/\\(.?)/g, function (s, n1) { 172 switch (n1) { 173 case '\\': 174 return '\\'; 175 case '0': 176 return '\u0000'; 177 case '': 178 return ''; 179 default: 180 return n1; 181 } 182 }); 183 } 184 185function limitText(limitField, limitNum) { 186 if (limitField.value.length > limitNum) { 187 limitField.value = limitField.value.substring(0, limitNum); 188 } 189}
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.