1$(document).ready( 2 function () { 3 const showDetailConditions = { 4 maxDownloads: 0, 5 maxPictures: 5, 6 maxText: 599, 7 socialAllowed: { 8 facebook: false, 9 youtube: false, 10 linkedin: false, 11 twitter: false, 12 xing: false, 13 instagram: false 14 } 15 }; 16 17 function showDetailPage(ele, conditions = null) 18 { 19 if (!conditions) { conditions = showDetailConditions; 20 } 21 let downloads = $(ele) 22 .find(".downloads") 23 .children().length; 24 let pictures = $(ele) 25 .find(".pictures") 26 .children().length; 27 let text = $(ele) 28 .find(".teaser") 29 .text().length; 30 let social = { 31 facebook: $(ele).find(".facebook").length >= 1 ? true : false, 32 youtube: $(ele).find(".youtube").length >= 1 ? true : false, 33 linkedin: $(ele).find(".linkedin").length >= 1 ? true : false, 34 twitter: $(ele).find(".twitter").length >= 1 ? true : false, 35 xing: $(ele).find(".xing").length >= 1 ? true : false, 36 instagram: $(ele).find(".instagram").length >= 1 ? true : false 37 }; 38 // console.log(downloads, conditions.maxDownloads); 39 if (conditions.maxDownloads != null && downloads > conditions.maxDownloads) { 40 $(ele) 41 .find(".more-button") 42 .show(); 43 } 44 // console.log(pictures, conditions.maxPictures); 45 if (conditions.maxPictures != null && pictures > conditions.maxPictures) { 46 $(ele) 47 .find(".more-button") 48 .show(); 49 } 50 // console.log(text, conditions.maxText); 51 if (conditions.maxText != null && text > conditions.maxText) { 52 $(ele) 53 .find(".more-button") 54 .show(); 55 } 56 // console.log(social, conditions.socialAllowed); 57 if (JSON.stringify(social) !== JSON.stringify(conditions.socialAllowed)) { 58 $(ele) 59 .find(".more-button") 60 .show(); 61 } 62 } 63 64 if ($("#businesscard-card-title").length > 0) { 65 let companyTitle = $("#businesscard-card-title").val(); 66 let categoryUid = $("#businesscard-card-category-uid").val(); 67 let categoryTitle = $("#businesscard-card-category-title").val(); 68 let link = $(".breadcrumb-custom a:last-child").attr("href"); 69 $("#page-title").text(companyTitle); 70 $(".businesscard-create-button").replaceWith( 71 $(".businesscard-edit-button") 72 ); 73 $(".breadcrumb-custom").append( 74 '<a href="' + 75 link + 76 "#acc-content-" + 77 categoryUid + 78 '">' + 79 categoryTitle + 80 "</a>" 81 ); 82 $(".breadcrumb-custom").append('<a href="#">' + companyTitle + "</a>"); 83 } 84 85 $(".card-one, .card-two, .card-three, .card-four") 86 .find(".more-button") 87 .hide(); 88 89 $(".card-one").each( 90 function () { 91 let conditions = showDetailConditions; 92 showDetailPage(this); 93 } 94 ); 95 96 $(".card-two").each( 97 function () { 98 let conditions = showDetailConditions; 99 conditions.maxPictures = null; 100 showDetailPage(this); 101 } 102 ); 103 104 $(".card-three").each( 105 function () { 106 // let conditions = showDetailConditions; 107 // conditions.maxPictures = null; 108 // showDetailPage(this); 109 } 110 ); 111 112 $(".card-four").each( 113 function () { 114 let conditions = showDetailConditions; 115 conditions.maxPictures = 1; 116 conditions.maxDownloads = 1; 117 showDetailPage(this); 118 } 119 ); 120 121 // FUCKING IE 11 BUG FIX 122 $("button[data-submit-form]").click( 123 function () { 124 $($(this).data("submitForm")).submit(); 125 } 126 ); 127 128 $("form.validate-businesscard").each( 129 function () {
130 $(this).validate( 131 { 132 rules: { 133 "tx_businesscard_businesscard[newCards][email]": { 134 required: true, 135 email: true 136 }, 137 "tx_businesscard_businesscard[newCards][mainid]": { 138 required: true 139 }, 140 "tx_businesscard_businesscard[newCards][xing]": { 141 url: true 142 }, 143 "tx_businesscard_businesscard[newCards][instagram]": { 144 url: true 145 }, 146 "tx_businesscard_businesscard[newCards][linkedin]": { 147 url: true 148 }, 149 "tx_businesscard_businesscard[newCards][youtube]": { 150 url: true 151 }, 152 "tx_businesscard_businesscard[newCards][twitter]": { 153 url: true 154 }, 155 "tx_businesscard_businesscard[newCards][facebook]": { 156 url: true 157 }, 158 "tx_businesscard_businesscard[newCards][companytitle]": { 159 required: true, 160 minlength: 2 161 }, 162 "tx_businesscard_businesscard[newCards][text]": { 163 required: true, 164 minlength: 50 165 }, 166 "tx_businesscard_businesscard[newCards][postnr]": { 167 required: true, 168 maxlength: 6, 169 minlength: 1 170 }, 171 "tx_businesscard_businesscard[newCards][function]": { 172 required: true, 173 minlength: 2 174 }, 175 "tx_businesscard_businesscard[newCards][firstname]": { 176 required: true, 177 minlength: 2 178 }, 179 "tx_businesscard_businesscard[newCards][lastname]": { 180 required: true, 181 minlength: 2 182 }, 183 "tx_businesscard_businesscard[newCards][street]": { 184 required: true, 185 minlength: 2 186 }, 187 "tx_businesscard_businesscard[newCards][city]": { 188 required: true, 189 minlength: 2 190 }, 191 "tx_businesscard_businesscard[newCards][phone]": { 192 required: true, 193 minlength: 3 194 }, 195 "tx_businesscard_businesscard[newCards][fax]": { 196 minlength: 3 197 } 198 }, 199 messages: { 200 "tx_businesscard_businesscard[newCards][email]": { 201 required: "Bitte geben Sie Ihre E-Mail-Adresse an.", 202 email: "Bitte geben Sie eine gültige E-Mail-Adresse an.", 203 remote: "Die eingegebene E-Mail Adresse existiert bereits." 204 }, 205 "tx_businesscard_businesscard[newCards][phone]": { 206 required: "Bitte geben Sie Ihre Telefon-Nummer ein.", 207 number: "Bitte geben Sie eine Gültige Telefon-Nummer an." 208 }, 209 "tx_businesscard_businesscard[newCards][fax]": { 210 required: 211 "Bitte geben Sie Ihre Fax-Nummer ein. Wir benötigen sie für Rückfragen zu Ihren Einträgen.", 212 number: "Bitte geben Sie eine Gültige Fax-Nummer an." 213 }, 214 "tx_businesscard_businesscard[newCards][firstname]": { 215 required: " Bitte geben Sie Ihren Vornamen ein.", 216 minlength: 217 "Der eingegebene Vorname ist zu kurz! Bitte geben Sie mindestens {0} Zeichen ein." 218 }, 219 "tx_businesscard_businesscard[newCards][lastname]": { 220 required: "Bitte geben Sie Ihren Nachnamen ein.", 221 minlength: 222 "Der eingegebene Nachname ist zu kurz! Bitte geben Sie mindestens {0} Zeichen ein." 223 }, 224 "tx_businesscard_businesscard[newCards][address]": { 225 required: "Bitte geben Sie Ihre Adresse ein. ", 226 minlength:
227 "Bitte vervollständigen Sie Ihre Adresse! Geben Sie zumindest {0} Zeichen ein." 228 }, 229 "tx_businesscard_businesscard[newCards][street]": { 230 required: "Bitte geben Sie Ihre Adresse ein. ", 231 minlength: 232 "Bitte vervollständigen Sie Ihre Adresse! Geben Sie zumindest {0} Zeichen ein." 233 }, 234 "tx_businesscard_businesscard[newCards][postnr]": { 235 required: "Bitte geben Sie Ihre Postleitzahl ein.", 236 minlength: 237 "Bitte geben Sie eine gültige Postleitzahl ({0} Zahlen) ein.", 238 maxlength: 239 "Bitte geben Sie eine gültige Postleitzahl ein. Max. {0} Zahlen." 240 }, 241 "tx_businesscard_businesscard[newCards][city]": { 242 required: "Bitte geben Sie Ihren Wohnort an.", 243 minlength: "Bitte geben Sie mindestens {0} Zeichen ein." 244 }, 245 "tx_businesscard_businesscard[newCards][maincategory]": { 246 required: "Bitte wählen Sie eine Kategorie für Ihren Eintrag." 247 }, 248 "tx_businesscard_businesscard[newCards][subcategory]": { 249 required: "Bitte wähle Sie eine Unterkategorie für Ihren Eintrag." 250 }, 251 "tx_businesscard_businesscard[newCards][companytitle]": { 252 required: "Bitte geben Sie Ihrem Beitrag einen Titel.", 253 minlength: 254 "Ihr Beitragstitel ist zu kurz! Bitte geben Sie mindestens {0} Zeichen ein." 255 }, 256 "tx_businesscard_businesscard[newCards][text]": { 257 required: "Bitte geben Sie einen Beitragstext ein.", 258 minlength: 259 "Ihr Beitragstext ist zu kurz. Bitte geben Sie mindestens {0} Zeichen ein." 260 }, 261 262 "tx_businesscard_businesscard[newCards][function]": { 263 required: "Bitte geben Sie die Funktion des Ansprechpartners an.", 264 minlength: 265 "Die eingegebene Funktion des Ansprechpartners ist zu kurz! Bitte geben Sie mindestens {0} Zeichen ein." 266 } 267 }, 268 errorPlacement: function (error, element) { 269 var elem = $(element); 270 error.insertAfter(element); 271 }, 272 submitHandler: function (form) { 273 let formData = new FormData(form); 274 let hasError = false; 275 console.log("test"); 276 $(".dropzone").each( 277 function () { 278 if ($(this).hasClass("dz-error-in")) { 279 this.scrollIntoView(); 280 hasError = true; 281 return; 282 } 283 let name = $(this).data("name"); 284 for (var i = 0; i < this.dropzone.files.length; i++) { 285 formData.append(name, this.dropzone.files[i]); 286 } 287 } 288 ); 289 for (var p of formData) { 290 let name = p[0]; 291 let value = p[1]; 292 293 // console.log(name, value); 294 } 295 if (hasError) { return; 296 } 297 298 $.ajax( 299 { 300 url: $(form).attr("action"), 301 method: "POST", 302 data: formData, 303 processData: false, 304 contentType: false, 305 success: function (response) { 306 // console.log(form); 307 // console.log($(form).find("div[data-open-modal]")); 308 $( 309 $(form) 310 .find("div[data-open-modal]") 311 .data("closeModal") 312 ).modal("hide"); 313 $( 314 $(form) 315 .find("div[data-open-modal]") 316 .data("openModal") 317 ).modal("show"); 318 $(form).trigger("reset"); 319 // $(".dropzone").each(function() { 320 // this.dropzone.removeAllFiles(); 321 // }); 322 } 323 } 324 ); 325 }, 326 ignore: ":hidden:not(.validate-hidden)" 327 } 328 ); 329 } 330 ); 331 332 //Filter Employees 333 334 if ($("#employees").length) { 335 $("#employees .no-result").hide(); 336 var employeeList = new List( 337 "employees", { 338 valueNames: [ 339 "full-txt-search", 340 "function", 341 "department", 342 "tel", 343 "fax", 344 "email", 345 "mobil", 346 "acc-content" 347 ] 348 } 349 ); 350 351 function updateEmployeeList() 352 { 353 var values_department = $("#selectedDepartment").val(); 354 employeeList.filter( 355 function (item) { 356 var departmentFilter = true; 357 if (values_department != "undefined" 358 && values_department != undefined 359 && values_department != null 360 ) { 361 departmentFilter = item 362 .values() 363 .department.includes(values_department); 364 } 365 366 console.log(departmentFilter) 367 368 return departmentFilter; 369 } 370 );
371 employeeList.update(); 372 } 373 374 $("#selectedDepartment").change(updateEmployeeList); 375 employeeList.on( 376 "updated", function (list) { 377 if (list.matchingItems.length > 0) { 378 $("#employees .no-result").hide(); 379 } else { 380 $("#employees .no-result").show(); 381 } 382 } 383 ); 384 385 employeeList.update(); 386 } 387 388 // Politicians Filter 389 390 if ($("#politicians").length) { 391 $("#politicians .no-result").hide(); 392 var politiciansList = new List( 393 "politicians", { 394 valueNames: [ 395 "full-txt-search", 396 "partyaffiliation", 397 "name", 398 "function", 399 "pol-party", 400 "tel", 401 "mobil", 402 "fax", 403 "email", 404 "acc-content", 405 "address-acc-content" 406 // { name: "partyaffiliation", attr: "data-partyaffiliation" } 407 ] 408 } 409 ); 410 411 function updatePoliticiansList() { 412 413 var values_partyaffiliation = $("#selectedPartyaffiliation").val(); 414 politiciansList.filter(function(item) { 415 var partyaffiliationFilter = true; 416 417 if ( 418 values_partyaffiliation != "undefined" && 419 values_partyaffiliation != undefined && 420 values_partyaffiliation != null 421 ) { 422 partyaffiliationFilter = item 423 .values() 424 .partyaffiliation.includes(values_partyaffiliation); 425 } 426 return partyaffiliationFilter; 427 }); 428 politiciansList.update(); 429 } 430 $("#selectedPartyaffiliation").change(updatePoliticiansList); 431 politiciansList.on( 432 "updated", function (list) { 433 if (list.matchingItems.length > 0) { 434 $("#politicians .no-result").hide(); 435 } else { 436 $("#politicians .no-result").show(); 437 } 438 } 439 ); 440 politiciansList.update(); 441 } 442 } 443);
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.