1$(document).ready(function() { 2 initSmoothScrolling(); 3 //initLightboxOnEvents(); 4 5 $('[data-submit]').on('change', function() { 6 submitForm($(this), $(this).data('submit')); 7 }); 8 $('[data-submit-click]').on('click', function() { 9 if($(this).hasClass('disabled')) 10 { 11 var msg; 12 if(typeof $(this).data('msg') != 'undefined') msg = $(this).data('msg'); 13 $(this).closest('.input-group').after('<em class="error d-block">'+msg+'</em>'); 14 return false; 15 } 16 else 17 { 18 submitForm($(this), $(this).data('submit-click')); 19 } 20 21 }); 22 if($('.validation-service').length) 23 { 24 initValueCheck($('.validation-service')); 25 } 26}); 27 28function submitForm(elem, formId) { 29 if(elem.attr('data-clear') != undefined) 30 { 31 var clearFields = elem.data('clear'); 32 33 clearFields.forEach(function (field, index) 34 { 35 if($('#'+field).length) $('#'+field).remove(); 36 }); 37 } 38 $('#'+formId).submit(); 39} 40 41 42 43function initSmoothScrolling() 44{ 45 var hash = window.location.hash; 46 47 if(hash && $(hash).length) 48 { 49 $('html, body').animate({ 50 scrollTop:($(hash).offset().top-800) 51 },'1'); 52 } 53 54} 55 56 57function initValueCheck(form) { 58 59 form.on('submit',function(e) { 60 var error = 0; 61 var formId = form.attr('id'); 62 63 $('#'+formId+' [required="required"]').each(function() { 64 65 $(this).closest('.input-col').children('.error').remove(); 66 var elemError = 0; 67 var errorDiv = document.createElement('div'); 68 errorDiv.className = 'error py-0 alert alert-danger'; 69 70 71 if($(this).val() == '') 72 { 73 elemError++; 74 error++; 75 errorDiv.innerText = 'Bitte füllen Sie dieses Feld aus'; 76 } 77 //if(elemError > 0 && ($(this)[0].nodeName == 'TEXTAREA' || $(this)[0].nodeName == 'TEXTAREA')) 78 if(elemError > 0 && $(this).data('append-ok') == true) 79 { 80 var checkBtn = document.createElement('span'); 81 checkBtn.innerText = 'OK' 82 checkBtn.className = 'btn btn-link py-0 px-1 mx-2 bg-white'; 83 checkBtn.setAttribute('data-submit-click',formId); 84 checkBtn.addEventListener('click', function (e) { 85 submitForm($(this), formId); 86 }); 87 88 var icon = document.createElement('i'); 89 icon.className = 'fas fa-lg fa-check-circle'; 90 91 checkBtn.prepend(icon); 92 errorDiv.appendChild(checkBtn); 93 } 94 95 if(elemError > 0) $(this).closest('.input-col').append(errorDiv); 96 }); 97 98 $('[data-eval]').each(function() { 99 $(this).closest('.input-col').children('.error').remove(); 100 var elemError = 0; 101 var errorDiv = document.createElement('div'); 102 errorDiv.className = 'error py-0 alert alert-danger'; 103 104 switch($(this).data('eval')) 105 { 106 case 'images': 107 var target = '#'+$(this).data('rel'); 108 var uploaded = 0; 109 var deleted = 0; 110 111 if($(this).val() != '') { 112 uploaded = $(this).val().split(',').length; 113 } 114 if($(target).val() != '') { 115 deleted = $(target).val().split(',').length; 116 } 117 var diff = parseInt(uploaded-deleted); 118 119 if(diff < 1) 120 { 121 elemError++; 122 error++; 123 errorDiv.innerText = 'Bitte laden Sie eine Datei hoch'; 124 $('#'+formId).after('<div class="error py-0 alert alert-danger">Bitte laden Sie eine Datei hoch</div>'); 125 } 126 127 break; 128 case 'client': 129 if($(this).val()) 130 { 131 var pattern = /[0-9]{3}[A-Z][0-9]{6}/i; 132 var number = $(this).val(); 133 var match = pattern.exec(number); 134 if (match != null && match[0] == number) { 135 } 136 else 137 { 138 elemError++; 139 error++; 140 errorDiv.innerText = 'Falsche Kundennummer'; 141 } 142 } 143 break; 144 145 case 'bg': 146 if($(this).val()) 147 { 148 var prefix = $(this).data('prefix'); 149 //var pattern = /+prefix+\/\/[0-9]{7}/i; 150 var pattern = RegExp(prefix+'//[0-9]{7}', 'i'); 151 var number = prefix+'//'+$(this).val(); 152 var match = pattern.exec(number); 153 if (match != null && match[0] == number) { 154 } 155 else 156 { 157 elemError++; 158 error++; 159 errorDiv.innerText = 'Falsche BG-Nummmer'; 160 } 161 } 162 break; 163 164 case 'emailsimple': 165 var pattern = /^[-a-z0-9~!$%^&*_=+}{\'?]+(\.[-a-z0-9~!$%^&*_=+}
165{\'?]+)*@([a-z0-9_][-a-z0-9_]*(\.[-a-z0-9_]+)*\.([a-z][a-z]+)|([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}))(:[0-9]{1,5})?$/i 166 var email = $(this).val(); 167 var match = pattern.exec(email); 168 if (match != null && match[0] == email) { 169 } 170 else 171 { 172 elemError++; 173 error++; 174 errorDiv.innerText = 'Ungültige E-Mail-Adresse'; 175 } 176 break; 177 case 'email': 178 var pattern = /^[-a-z0-9~!$%^&*_=+}{\'?]+(\.[-a-z0-9~!$%^&*_=+}{\'?]+)*@([a-z0-9_][-a-z0-9_]*(\.[-a-z0-9_]+)*\.([a-z][a-z]+)|([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}))(:[0-9]{1,5})?$/i 179 var email = $(this).val(); 180 var match = pattern.exec(email); 181 var target = $(this).data('target'); 182 if (match != null && match[0] == email) { 183 } 184 else 185 { 186 elemError++; 187 error++; 188 errorDiv.innerText = 'Ungültige E-Mail-Adresse'; 189 } 190 if(email.toLowerCase() != $(target).val().toLowerCase()) 191 { 192 elemError++; 193 error++; 194 errorDiv.innerText = 'Wiederholung der E-Mail-Adresse nicht richtig'; 195 } 196 break; 197 198 case 'zip': 199 var zip = $(this).val(); 200 var target = '#'+$(this).attr('list'); 201 const list = $(target+' option').map(function() { 202 return this.value; 203 }).get(); 204 205 if(list.includes(zip) == false) 206 { 207 elemError++; 208 error++; 209 errorDiv.innerText = 'Die PLZ gehört nicht in die Zuständigkeit des Jobcenters'; 210 } 211 break; 212 213 case 'required-bool': 214 if(!$(this).is(':checked')) 215 { 216 elemError++; 217 error++; 218 errorDiv.innerText = 'Pflichtangabe'; 219 } 220 break; 221 222 case 'double': 223 var pattern = new RegExp('[0-9]+(,[0-9]+)?'); 224 225 if(!pattern.test($(this).val())){ 226 elemError++; 227 error++; 228 errorDiv.innerText = 'Bitte nur Zahlen und Kommata'; 229 } 230 break; 231 232 case 'int': 233 var pattern = new RegExp('[0-9]+'); 234 235 if(!pattern.test($(this).val())){ 236 elemError++; 237 error++; 238 errorDiv.innerText = 'Bitte nur Zahlen'; 239 } 240 break; 241 default: 242 e.preventDefault(); 243 } 244 if(elemError > 0) $(this).closest('.input-col').append(errorDiv); 245 }); 246 if(error > 0) { 247 e.preventDefault(); 248 } 249 250 }); 251} 252 253/** 254 * Add or replace a value/key pair to a url query 255 * 256 * @see http://stackoverflow.com/questions/5999118/add-or-update-query-string-parameter 257 */ 258function updateQueryStringParameter(uri, key, value) { 259 var re = new RegExp("([?|&])" + key + "=.*?(&|$)", "i"); 260 separator = uri.indexOf('?') !== -1 ? "&" : "?"; 261 if (uri.match(re)) { 262 return uri.replace(re, '$1' + key + "=" + value + '$2'); 263 } else { 264 return uri + separator + key + "=" + value; 265 } 266}
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.