1"use strict"; 2 3function isOldIE() { 4 const ua = window.navigator.userAgent; //Check the userAgent property of the window.navigator object 5 const msie = ua.indexOf("MSIE "); // IE 10 or older 6 const trident = ua.indexOf("Trident/"); //IE 11 7 8 return msie > 0 || trident > 0; 9} 10 11//function to show alert if it's IE 12function ShowIEAlert() { 13 if (isOldIE()) { 14 document.body.innerHTML += 15 "<div style='position: fixed;bottom: 0;left: 0;right: 0;height: max-content;z-index: 100;background: transparent;'> <div class='container' style='text-align: center;padding: 8px;font-size: 1.125rem;color: red;background: yellow;'>Sie verwenden den Internet Explorer. <br> Dieser Browser ist veraltet und wird von dieser Website nicht mehr unterstützt! <br> Die Seite kann deshalb nicht korrekt dargestellt werden.<br> Bitte benutzen Sie einen aktuellen Browser.</div><div>"; 16 } 17 return isOldIE(); 18} 19 20ShowIEAlert(); 21 22Dropzone.autoDiscover = false; 23 24$(document).ready(function () { 25 /* ScrollTop */ 26 $("body").materialScrollTop({ 27 revealElement: $("script"), 28 revealPosition: "bottom", 29 }); 30 31 if (window.location.href.includes("infoscreen")) { 32 if (document.getElementById("klaro") != null && document.getElementById("klaro") != undefined) { 33 document.getElementById("klaro").style.display = "none"; 34 } 35 let cookieBanner = document.getElementsByClassName("klaro we_cookie_consent"); 36 if (cookieBanner[0] != null && cookieBanner[0] != undefined) { 37 cookieBanner[0].style.display = "none"; 38 } 39 } 40 41 $(".gizaccordion") 42 .find(".searchfilter-searchbox") 43 .on("input", function () { 44 var filterText = $(".gizaccordion").find(".searchfilter-searchbox")[0].value; 45 $.each($(".gizaccordion * .accordion"), function (i, accordion) { 46 //if ($(".gizaccordion * .accordion:nth-child(" + (i + 1) + ") > .card > .card-header > .acctitle").html().toLowerCase().includes(filterText.toLowerCase())) { 47 if ( 48 $(".gizaccordion * .accordion:nth-child(" + (i + 1))[0] 49 .innerText.toLowerCase() 50 .includes(filterText.toLowerCase()) 51 ) { 52 $(".gizaccordion * .accordion:nth-child(" + (i + 1) + ")").css("display", "inherit"); 53 } else { 54 $(".gizaccordion * .accordion:nth-child(" + (i + 1) + ")").css("display", "none"); 55 } 56 }); 57 }); 58 59 $("select.category").select2({ 60 placeholder: "Kategorie", 61 closeOnSelect: true, 62 }); 63 $("select.year").select2({ 64 placeholder: "Jahr", 65 closeOnSelect: true, 66 }); 67 $("select.topic").select2({ 68 placeholder: "Thema", 69 closeOnSelect: true, 70 }); 71 $("select.committees").select2({ 72 placeholder: "Ausschüsse", 73 closeOnSelect: true, 74 }); 75 $("select.section").select2({ 76 placeholder: "Parteien", 77 closeOnSelect: true, 78 }); 79 80 $("div[data-slick]").slick(); 81 82 //slick fix cloned on infinite // 83 Array.from(document.querySelectorAll(".slick-cloned a.lightbox")).forEach(function (element) { 84 let gid = element.getAttribute("rel"); 85 element.removeAttribute("rel"); 86 element.addEventListener("click", (e) => { 87 e.preventDefault(); 88 e.stopPropagation(); 89 let href = element.getAttribute("href"); 90 document.querySelector("a.lightbox[rel=" + gid + '][href="' + href + '"]').click(); 91 }); 92 }); 93 94 var $magicLine = $("#magic-line"); 95 let activeItem = "#navbar li.active"; 96 let magicLineTopAdder = 45; 97 98 function setMagicLine() { 99 if ($("#magic-line").length && $(activeItem).length) { 100 $magicLine 101 .width($(activeItem).width()) 102 .css("left", $(activeItem).position().left) 103 .css("top", $(activeItem).position().top + magicLineTopAdder) 104 .data("origWidth", $(activeItem).width()) 105 .data("origLeft", $(activeItem).position().left) 106 .data("origTop", $(activeItem).position().top + magicLineTopAdder); 107 } else { 108 $magicLine.width(0).css("left", 0).css("top", 0); 109 } 110 } 111 112 setMagicLine(); 113 $(window).resize(function () { 114 setMagicLine(); 115 }); 116 $("nav.sticky-top .nav-item").hover( 117 function () { 118 if ($("#magic-line").length && $(activeItem).length) { 119 $magicLine.stop().animate({ 120 left: $(this).position().left, 121 width: $(this).width(), 122 top: $(this).position().top + magicLineTopAdder, 123 }); 124 } else { 125 if ($magicLine.hasClass("magicline-first")) { 126 $magicLine.stop().animate({ 127 left: $(this).position().left, 128 width: $(this).width(), 129 top: $(this).position().top + magicLineTopAdder, 130 }); 131 } else { 132 $magicLine 133 .width($(this).width()) 134 .css("left", $(this).position().left) 135 .css("top", $(this).position().top + magicLineTopAdder); 136 $magicLine.addClass("magicline-first"); 137 } 138 } 139 }, 140 function () { 141 if ($magicLine.data("origWidth") != null) 142 $magicLine.stop().animate({ 143 width: $magicLine.data("origWidth"), 144 left: $magicLine.data("origLeft"), 145 top: $magicLine.data("origTop"), 146 }); 147 } 148 ); 149 150 function scrollToElement(element, duration) { 151 $("html, body").animate( 152 { 153 scrollTop: $(element).offset().top, 154 }, 155 duration 156 ); 157 } 158 159 function getUrlVars() { 160 var vars = {}; 161 var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function (m, key, value) { 162 vars[key] = value; 163 }); 164 return vars; 165 } 166 167 function openAccordionPerId(id) { 168 if (id != undefined && id != "" && id != null) { 169 $(id).collapse("show"); 170 $(id).one("shown.bs.collapse", function (event) { 171 scrollToElement($(event.target).parent().find(".card-header")[0]); 172 }); 173 if (typeof slickAccGallery !== "undefined") slickAccGallery($(id).find(".dot-slider-small")); 174 } 175 } //Open accordion per link hash 176 openAccordionPerId(window.location.hash); 177 openAccordionPerId("#" + getUrlVars()["open_acc"]); 178 179 $(".main-nav-submenu .dropdown-item").on("click", function () { 180 openAccordionPerId(this.hash); 181 }); // Gallery for Accordion 182 183 // Download 184 $(".download .progress").hide(); 185 $(".download").click(function () { 186 var progressBar = $(this).find(".progress-bar")[0]; 187 $($(this).find(".progress")[0]).show(); 188 var ele = this; 189 var page_url = $(ele).data("filepath"); 190 $(progressBar).attr("aria-valuenow", 0); 191 $(progressBar).css({ 192 width: 0, 193 }); 194 var req = new XMLHttpRequest(); 195 req.open("POST", page_url, true); 196 req.addEventListener( 197 "progress", 198 function (evt) { 199 if (evt.lengthComputable) { 200 var percentComplete = evt.loaded / evt.total; 201 $(progressBar).attr("aria-valuenow", percentComplete); 202 $(progressBar).css({ 203 width: percentComplete * 100 + "%", 204 }); 205 } 206 }, 207 false 208 ); 209 req.responseType = "blob"; 210 211 req.onreadystatechange = function () { 212 if (req.readyState === 4 && req.status === 200) { 213 var filename = $(ele).data("filename"); 214 215 if (typeof window.chrome !== "undefined") { 216 // Chrome version 217 var link = document.createElement("a"); 218 link.href = window.URL.createObjectURL(req.response); 219 link.download = filename; 220 link.click(); 221 } else if (typeof window.navigator.msSaveBlob !== "undefined") { 222 // IE version 223 var blob = new Blob([req.response], { 224 type: "application/force-download", 225 }); 226 window.navigator.msSaveBlob(blob, filename); 227 } else { 228 // Firefox version 229 var file = new File([req.response], filename, { 230 type: "application/force-download", 231 }); 232 window.open(URL.createObjectURL(file)); 233 } 234 } 235 }; 236 237 req.send(); 238 }); // Politik - Suchfilter Focus 239 $(".searchfilter-searchbox").on("focus focusout", function () { 240 $(".form-control-feedback").toggleClass("active-search"); 241 }); 242 243 // PDF Reader 244 // Lazy PDF Reader 245 246 $(document).on("shown.bs.collapse", ".collapse", function (event) { 247 var collapseEl = event.target; 248 var $collapse = $(collapseEl); 249
250 var $readers = $collapse.find(".pdf-reader").filter(function () { 251 return $(this).closest(".collapse")[0] === collapseEl; 252 }); 253 254 if (!$readers.length) return; 255 256 $readers.each(function () { 257 var $reader = $(this); 258 259 if ($reader.data("pdf-loaded")) return; 260 261 initPdfReader($reader); 262 $reader.data("pdf-loaded", true); 263 }); 264 }); 265 266 267 function initPdfReader($reader) { 268 //console.log("init Pdf reader"); 269 var input = $reader.find(".pdf-input-viewer")[0]; 270 if (!input) return; 271 272 var pdfUrl = input.value; 273 var pdfID = input.id; 274 275 var pdfDoc = null; 276 var pageNum = 1; 277 var pageIsRendering = false; 278 var pageNumIsPending = null; 279 var scale = 2; 280 281 var canvas = $reader.find("canvas")[0]; 282 var ctx = canvas.getContext("2d"); 283 284 var $loader = $reader.find(".pdf-loader"); 285 var $pageNum = $reader.find(".page-num"); 286 var $pageCount = $reader.find(".page-count"); 287 288 function renderPage(num) { 289 pageIsRendering = true; 290 291 pdfDoc.getPage(num).then(function (page) { 292 var viewport = page.getViewport({ 293 scale: scale 294 }); 295 296 canvas.height = viewport.height; 297 canvas.width = viewport.width; 298 299 var renderCTX = { 300 canvasContext: ctx, 301 viewport: viewport 302 }; 303 304 page.render(renderCTX).promise.then(function () { 305 pageIsRendering = false; 306 307 if (pageNumIsPending !== null) { 308 renderPage(pageNumIsPending); 309 pageNumIsPending = null; 310 } 311 }); 312 313 $pageNum.text(num); 314 }); 315 } 316 317 function queueRenderPage(num) { 318 if (pageIsRendering) { 319 pageNumIsPending = num; 320 } else { 321 renderPage(num); 322 } 323 } 324 325 function showPrevPage() { 326 if (pageNum <= 1) return; 327 328 pageNum--; 329 queueRenderPage(pageNum); 330 } 331 332 function showNextPage() { 333 if (pageNum >= pdfDoc.numPages) return; 334 335 pageNum++; 336 queueRenderPage(pageNum); 337 } 338 339 $loader.show(); 340 341 pdfjsLib.getDocument(pdfUrl).promise.then(function (pdfDoc_) { 342 pdfDoc = pdfDoc_; 343 344 $pageCount.text(pdfDoc.numPages); 345 346 renderPage(pageNum); 347 initSwipe(pdfID, showPrevPage, showNextPage); 348 }).finally(function () { 349 $loader.hide(); 350 }); 351 352 $reader.find(".prev-page").on("click", showPrevPage); 353 $reader.find(".next-page").on("click", showNextPage); 354 } 355 356 357 function initSwipe(pdfID, showPrevPage, showNextPage) { 358 var touchsurface = document.getElementById("touchsurface-" + pdfID); 359 if (!touchsurface) return; 360 361 var startX = 0; 362 363 touchsurface.addEventListener("touchstart", function (e) { 364 startX = e.changedTouches[0].pageX; 365 }, false); 366 367 touchsurface.addEventListener("touchend", function (e) { 368 var dist = e.changedTouches[0].pageX - startX; 369 370 if (Math.abs(dist) < 30) return; 371 372 if (dist > 0) { 373 showPrevPage(); 374 } else { 375 showNextPage(); 376 } 377 }, false); 378 } 379 380 /* ##### SCHME WEBWERK ##### */ 381 382 // Prevent Errors 383 (function () { 384 if (typeof EventTarget !== "undefined") { 385 const originalAddEventListener = EventTarget.prototype.addEventListener; 386 387 const overrideTypes = ["touchstart", "touchmove", "wheel"]; 388 389 EventTarget.prototype.addEventListener = function (type, fn, options) { 390 if (!overrideTypes.includes(type)) { 391 return originalAddEventListener.call(this, type, fn, options); 392 } 393 394 let newOptions; 395 if (typeof options === "object" && options !== null) { 396 newOptions = Object.assign({}, options, { passive: false }); 397 } else if (typeof options === "boolean" || options === undefined) { 398 newOptions = { passive: false }; 399 } 400 401 return originalAddEventListener.call(this, type, fn, newOptions); 402 }; 403 } 404 })(); 405 406 //Dropzone error viewer 407 function addErrorsToDropzone(dropzone) { 408 let errorText = ""; 409 410 $(dropzone) 411 .find(".dz-error") 412 .each(function () { 413 let text = $(this).find(".dz-error-message span").text(); 414 if (!errorText.includes(text)) errorText += "<p>" + text + "</p>"; 415 }); 416 $(dropzone).find(".error-text").html(errorText); 417 if (errorText != "") $(dropzone).addClass("dz-error-in"); 418 else $(dropzone).removeClass("dz-error-in"); 419 } 420 421 // Dropzone Events 422 $(".dropzone").each(function () { 423 let ele = this; 424 //Add existing files into dropzone 425 $(this).dropzone({ 426 url: $(ele).attr("data-url"), 427 // url: window.location.pathname, 428 // autoProcessQueue: false, 429 addRemoveLinks: true, 430 uploadMultiple: true, 431 acceptedFiles: $(this).data("allowedTypes"), 432 maxFiles: $(this).data("maxFiles"), 433 maxFilesize: $(this).data("maxFileSize"), 434 dictFileTooBig: "Datei zu groÃ.", 435 dictInvalidFileType: "Falscher Datentyp", 436 dictRemoveFile: "Entfernen", 437 dictMaxFilesExceeded: "Maximal " + $(this).data("maxFiles") + " Dateien!", 438 success: function (file, responseText) { 439 // var response = JSON.parse(responseText); 440 // console.log(responseText); 441 }, 442 init: function () { 443 // for (let i = 0; i < existingFiles.length; i++) {
444 // this.emit("addedfile", existingFiles[i]); 445 // this.emit("thumbnail", existingFiles[i], "img/buerger.jpg"); 446 // this.emit("complete", existingFiles[i]); 447 // } 448 this.on("removedfile", function (file) { 449 addErrorsToDropzone(ele); 450 }); 451 this.on("addedfile", function (file) { 452 var ext = file.name.split(".").pop(); 453 if (ext.indexOf("pdf") != -1) { 454 $(file.previewElement).find(".dz-image img").attr("src", "img/pdf.png"); 455 } else if (ext.indexOf("doc") != -1) { 456 $(file.previewElement).find(".dz-image img").attr("src", "img/word.png"); 457 } else if (ext.indexOf("xls") != -1 || ext.indexOf("csv") != -1) { 458 $(file.previewElement).find(".dz-image img").attr("src", "img/excel.png"); 459 } 460 if (this.files.length >= $(ele).data("maxFiles")) { 461 $(".dz-hidden-input").prop("disabled", true); 462 } 463 addErrorsToDropzone(ele); 464 }); 465 this.on("error", function (file, error, xhr) { 466 addErrorsToDropzone(ele); 467 }); 468 }, 469 }); 470 }); 471 472 // FUCKING IE 11 BUG FIX 473 // $("button[data-submit-form]").click(function() { 474 // $($(this).data("submitForm")).submit(); 475 // }); 476 477 // add a method. calls one built-in method, too. 478 jQuery.validator.addMethod( 479 "passwordChecker", 480 function (value, element) { 481 if ($(this).prop("required") || value != "") { 482 let parent = $(element).parent(); 483 var ucase = new RegExp("[A-Z]+"); 484 var lcase = new RegExp("[a-z]+"); 485 var num = new RegExp("[0-9]+"); 486 let bool = true; 487 if (parent.find(".password-validation").length > 0) { 488 let resetTooltip = function (object, boolean) { 489 if (boolean) { 490 object.removeClass("invalid"); 491 object.addClass("valid"); 492 } else { 493 object.removeClass("valid"); 494 object.addClass("invalid"); 495 bool = false;
496 } 497 }; 498 resetTooltip(parent.find("[data-ruleid='min-chars']"), $(element).val().length >= 8); 499 resetTooltip(parent.find("[data-ruleid='uppercase']"), ucase.test($(element).val())); 500 resetTooltip(parent.find("[data-ruleid='lowercase']"), lcase.test($(element).val())); 501 resetTooltip(parent.find("[data-ruleid='number']"), num.test($(element).val())); 502 } 503 return bool; 504 } 505 return true; 506 }, 507 "Dein Passwort muss Folgendes enthalten:" 508 ); 509 510 jQuery.extend(jQuery.validator.messages, { 511 url: "Bitte einen gültigen Link eingeben.", 512 date: "Bitte ein gültiges Datum eintragen.", 513 }); 514 515 // Zeigt den Versteckten inhalt sobald die richtige Option ausgewählt wird 516 // läuft alles über "data-show-content" 517 $("select").change(function () { 518 let idToShow = $($("option:selected", this)).data("showContent"); 519 if (idToShow != null && idToShow != undefined) { 520 $(idToShow).addClass("d-block d-sm-block d-md-block d-lg-block"); 521 $(idToShow).removeClass("d-none d-sm-none d-md-none d-lg-none"); 522 } 523 $(this) 524 .find("option") 525 .each(function () { 526 let idToHide = $(this).data("showContent"); 527 if (idToHide != null && idToHide != undefined && idToShow != idToHide) { 528 $(idToHide).addClass("d-none d-sm-none d-md-none d-lg-none"); 529 $(idToHide).removeClass("d-block d-sm-block d-md-block d-lg-block"); 530 } 531 }); 532 }); 533 534 // DatePicker / DateTimePicker / RangePicker / StartDate / EndDate 535 536 const daysOfWeek = ["So", "Mo", "Di", "Mi", "Do", "Fr", "Sa"]; 537 const monthNames = ["Januar", "Februar", "März", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember"]; 538 539 $('input[name="dateTimePicker"]').daterangepicker({ 540 singleDatePicker: true, 541 showDropdowns: true, 542 showWeekNumbers: true, 543 timePicker: true, 544 timePicker24Hour: true, 545 locale: { 546 format: "DD.MM.YYYY HH:mm", 547 separator: " - ", 548 applyLabel: "Bestätigen", 549 cancelLabel: "Abbrechen", 550 fromLabel: "Von", 551 toLabel: "Bis", 552 weekLabel: "W", 553 daysOfWeek: daysOfWeek, 554 monthNames: monthNames, 555 }, 556 opens: "center", 557 applyButtonClasses: "btn-inline-primary", 558 cancelClass: "btn-outline-primary", 559 }); 560 $('input[name="datePicker"]').daterangepicker({ 561 singleDatePicker: true, 562 showDropdowns: true, 563 showWeekNumbers: true, 564 locale: { 565 format: "DD.MM.YYYY", 566 separator: " - ", 567 applyLabel: "Bestätigen", 568 cancelLabel: "Abbrechen", 569 fromLabel: "Von", 570 toLabel: "Bis", 571 weekLabel: "W", 572 daysOfWeek: daysOfWeek, 573 monthNames: monthNames, 574 }, 575 opens: "center", 576 applyButtonClasses: "btn-inline-primary", 577 cancelClass: "btn-outline-primary", 578 }); 579 580 const initialStartDate = moment().subtract(1, "year"); 581 const initialEndDate = moment(); 582 const initialFuturStartDate = moment(); 583 const initialFuturEndDate = moment().add(1, "year"); 584 585 $('input[name="dateRangePicker"]').daterangepicker({ 586 showDropdowns: true, 587 showWeekNumbers: true, 588 locale: { 589 format: "DD.MM.YYYY", 590 separator: " - ", 591 applyLabel: "Bestätigen", 592 cancelLabel: "Zurücksetzen", 593 fromLabel: "Von", 594 toLabel: "Bis", 595 weekLabel: "W", 596 daysOfWeek: daysOfWeek, 597 monthNames: monthNames, 598 }, 599 autoApply: false, 600 autoUpdateInput: false, 601 opens: "center", 602 applyButtonClasses: "btn-inline-primary", 603 cancelClass: "btn-outline-primary", 604 }); 605 606 $('input[name="dateRangePicker"]').on("apply.daterangepicker", function (ev, picker) { 607 $(this).val(picker.startDate.format("DD.MM.YYYY") + " - " + picker.endDate.format("DD.MM.YYYY")); 608 }); 609 610 $('input[name="dateRangePickerFutur"]').daterangepicker({ 611 showDropdowns: true, 612 showWeekNumbers: true, 613 /*startDate: initialFuturStartDate, 614 endDate: initialFuturEndDate, 615 minDate: initialFuturStartDate, 616 maxDate: initialFuturEndDate,*/ 617 locale: { 618 format: "DD.MM.YYYY", 619 separator: " - ", 620 applyLabel: "Bestätigen", 621 cancelLabel: "Zurücksetzen", 622 fromLabel: "Von", 623 toLabel: "Bis", 624 weekLabel: "W", 625 daysOfWeek: daysOfWeek, 626 monthNames: monthNames, 627 }, 628 autoApply: false, 629 autoUpdateInput: false, 630 opens: "center", 631 applyButtonClasses: "btn-inline-primary", 632 cancelClass: "btn-outline-primary", 633 }); 634 $('input[name="startDate"]').daterangepicker({ 635 singleDatePicker: true, 636 showDropdowns: true, 637 showWeekNumbers: true, 638 timePicker: true, 639 timePicker24Hour: true, 640 locale: { 641 format: "DD.MM.YYYY HH:mm", 642 separator: " - ", 643 applyLabel: "Bestätigen", 644 cancelLabel: "Abbrechen", 645 fromLabel: "Von", 646 toLabel: "Bis", 647 weekLabel: "W", 648 daysOfWeek: daysOfWeek, 649 monthNames: monthNames, 650 }, 651 opens: "center", 652 startDate: moment().add(3, "days").startOf("day"),
653 applyButtonClasses: "btn-inline-primary", 654 cancelClass: "btn-outline-primary", 655 }); 656 $('input[name="endDate"]').daterangepicker({ 657 singleDatePicker: true, 658 showDropdowns: true, 659 showWeekNumbers: true, 660 timePicker: true, 661 timePicker24Hour: true, 662 locale: { 663 format: "DD.MM.YYYY HH:mm", 664 separator: " - ", 665 applyLabel: "Bestätigen", 666 cancelLabel: "Abbrechen", 667 fromLabel: "Von", 668 toLabel: "Bis", 669 weekLabel: "W", 670 daysOfWeek: daysOfWeek, 671 monthNames: monthNames, 672 }, 673 opens: "center", 674 startDate: moment().add(3, "days").endOf("day"), 675 applyButtonClasses: "btn-inline-primary", 676 cancelClass: "btn-outline-primary", 677 }); 678 679 // DELETE ALL DUPLICATE ENTRYS IN A SELECT 680 if ($(".no-duplicate-select").length) { 681 var seen = {}; 682 $(".no-duplicate-select > option").each(function () { 683 var txt = this.text; 684 if (seen[txt]) $(this).remove(); 685 else seen[txt] = true; 686 }); 687 } 688 689 // FILTER ANNOUNCEMENT 690 if ($("#announcement").length) { 691 $("#announcement .no_elements").hide(); 692 693 var annList = new List("announcement", { 694 valueNames: ["announcement-element"], 695 }); 696 697 annList.on("updated", function (list) { 698 if (list.matchingItems.length > 0) { 699 $("#announcement .no_elements").hide(); 700 } else { 701 $("#announcement .no_elements").show(); 702 } 703 }); 704 705 annList.update(); 706 } 707 708 // FILTER ACTS 709 710 $('div[id^="act"]').each(function () { 711 //console.log(this.id.slice(3)); 712 let act_id = this.id; 713 if ($("#" + act_id).length) { 714 $("#no-elements-" + act_id).hide(); 715 716 var actList = new List(act_id, { 717 valueNames: [ 718 "act-search", 719 { 720 name: "accordion", 721 attr: "data-date", 722 }, 723 ], 724 }); 725 726 function updateActList() { 727 let startDate = moment($("#selectedDate").data("daterangepicker").startDate).unix(); 728 let endDate = moment($("#selectedDate").data("daterangepicker").endDate).unix(); 729 actList.filter(function (item) { 730 let filterer = moment(item.values().accordion, "DD.MM.YYYY").unix(); //.unix(); 731 //console.log(actList); 732 var partyaffiliationFilter = true; 733 734 if (startDate != "undefined" && startDate != undefined && startDate != null) partyaffiliationFilter = (startDate < filterer) & (endDate > filterer); 735 return partyaffiliationFilter; 736 }); 737 actList.update(); 738 } 739 740 $("#selectedDate").change(updateActList); 741 actList.on("updated", function (list) { 742 if (list.matchingItems.length > 0) { 743 $("#no-elements-" + act_id).hide(); 744 } else { 745 $("#no-elements-" + act_id).show(); 746 } 747 }); 748 749 actList.update(); 750 } 751 }); 752 /*if ($("#act").length) { 753 $("#act .no_elements").hide(); 754 console.log('Test 734'); 755 console.log($("#act")); 756 757 var actList = new List("act", { 758 valueNames: ["act-search", { 759 name: "accordion", 760 attr: "data-date" 761 }] 762 }); 763 console.log(actList); 764 function updateActList() { 765 console.log('Test 745'); 766 let startDate = moment( 767 $("#selectedDate").data("daterangepicker").startDate 768 ).unix(); 769 let endDate = moment( 770 $("#selectedDate").data("daterangepicker").endDate 771 ).unix(); 772 actList.filter(function(item) { 773 let filterer = moment(item.values().accordion, "DD.MM.YYYY").unix(); //.unix(); 774 //console.log(actList); 775 var partyaffiliationFilter = true; 776 777 if ( 778 startDate != "undefined" && 779 startDate != undefined && 780 startDate != null 781 ) 782 partyaffiliationFilter = 783 (startDate < filterer) & (endDate > filterer); 784 return partyaffiliationFilter; 785 }); 786 actList.update(); 787 } 788 console.log('Test 768'); 789 console.log(actList); 790 791 $("#selectedDate").change(updateActList); 792 actList.on("updated", function(list) { 793 if (list.matchingItems.length > 0) { 794 $("#act .no_elements").hide(); 795 } else { 796 $("#act .no_elements").show(); 797 } 798 }); 799 console.log('Test 778'); 800 actList.update(); 801 }*/ 802 803 // Filter NEWS AND TERMS 804 805 if ($("#news").length) { 806 $("#news .no_elements").hide(); 807 var newsList = new List("news", { 808 valueNames: [ 809 "news-element", 810 { 811 name: "news_category", 812 attr: "data-category", 813 }, 814 { 815 name: "news_box", 816 attr: "data-date", 817 }, 818 { 819 name: "news_box", 820 attr: "data-title", 821 }, 822 ], 823 }); 824 825 const initialCategory = $("#selectCategory").val(); 826 const initialDateRange = $("#selectedDate").data("daterangepicker"); 827 828 function updateNewsList() { 829 /*let startDate = moment( 830 $("#selectedDate").data("daterangepicker").startDate 831 ).unix(); 832 let endDate = moment( 833 $("#selectedDate").data("daterangepicker").endDate 834 ).unix();*/ 835 newsList.filter(function (item) { 836 /* let dateFilter = moment(item.values().news_box, "DD.MM.YYYY").unix(); //.unix(); 837 var dateFilterBoolean = true; 838 let review = $("#selectedDate").val(); 839 840 if ( 841 review != "undefined" && 842 review != undefined && 843 review != null && 844 review != "" 845 ) 846 dateFilterBoolean = (startDate < dateFilter) & (endDate > dateFilter); 847 */ 848 let categoryFilter = $("#selectCategory").val(); 849 var categoryFilterBoolean = true; 850 851 if (categoryFilter != "undefined" && categoryFilter != undefined && categoryFilter != null) categoryFilterBoolean = item.values().news_category.includes(categoryFilter); 852 return categoryFilterBoolean; 853 });
854 newsList.update(); 855 } 856 857 if ($("#selectedDate").length > 0) { 858 updateNewsList(); 859 } 860 861 var beforeStartDate = initialStartDate, 862 beforeEndDate = initialEndDate; 863 864 /*$('#selectedDate').on('hide.daterangepicker', function(ev, picker) { 865 //do something, like clearing an input 866 //$("#selectedDate").data('daterangepicker').setStartDate(moment(beforeStartDate)); 867 //$("#selectedDate").data('daterangepicker').setEndDate(moment(beforeEndDate)); 868 }); 869 870 $('#selectedDate').on('cancel.daterangepicker', function(ev, picker) { 871 //do something, like clearing an input 872 $("#selectedDate").data('daterangepicker').setStartDate(moment(initialStartDate)); 873 $("#selectedDate").data('daterangepicker').setEndDate(moment(initialEndDate)); 874 updateNewsList(); 875 }); 876 877 $('#selectedDate').on('apply.daterangepicker', function(ev, picker) { 878 //do something, like clearing an input 879 beforeStartDate = $("#selectedDate").data('daterangepicker').startDate; 880 beforeEndDate = $("#selectedDate").data('daterangepicker').endDate; 881 updateNewsList(); 882 });*/ 883 884 //$("#selectedDate").change(updateNewsList); 885 $("#selectCategory").change(updateNewsList); 886 newsList.on("updated", function (list) { 887 if (list.matchingItems.length > 0) { 888 $("#news .no_elements").hide(); 889 } else { 890 $("#news .no_elements").show(); 891 } 892 }); 893 newsList.update(); 894 } 895 896 if ($("#term").length) { 897 $("#term .no_elements").hide(); 898 899 var terminList = new List("term", { 900 valueNames: [ 901 "termin-search", 902 { 903 name: "termine", 904 attr: "data-date", 905 }, 906 { 907 name: "term_category", 908 attr: "data-category", 909 }, 910 { 911 name: "termine", 912 attr: "data-title", 913 }, 914 ], 915 }); 916 917 function updateTerminList() { 918 /*let startDate = moment( 919 $("#selectedDate").data("daterangepicker").startDate 920 ).unix(); 921 let endDate = moment( 922 $("#selectedDate").data("daterangepicker").endDate 923 ).unix();*/ 924 terminList.filter(function (item) { 925 /*let filterer = moment(item.values().termine, "DD.MM.YYYY").unix(); //.unix(); 926 927 var partyaffiliationFilter = true; 928 929 if ( 930 startDate != "undefined" && 931 startDate != undefined && 932 startDate != null 933 ) 934 partyaffiliationFilter = (startDate < filterer) & (endDate > filterer); 935 */ 936 let categoryFilter = $("#selectCategory").val(); 937 var categoryFilterBoolean = true; 938 939 if (categoryFilter != "undefined" && categoryFilter != undefined && categoryFilter != null) categoryFilterBoolean = item.values().term_category.includes(categoryFilter); 940 //console.log(categoryFilterBoolean); 941 942 return categoryFilterBoolean; 943 }); 944 terminList.update(); 945 } 946 947 //$("#selectedDate").change(updateTerminList); 948 $("#selectCategory").change(updateTerminList); 949 950 terminList.on("updated", function (list) { 951 if (list.matchingItems.length > 0) { 952 $("#term .no_elements").hide(); 953 } else { 954 $("#term .no_elements").show(); 955 } 956 }); 957 terminList.update(); 958 } 959 960 //if ($("#selectedDate").length > 0) { 961 // updateTerminList(); 962 //} 963 964 //only click without drag 965 var isDragging = false; 966 $("a[target].slick-slide") 967 .on("click", function (e) { 968 e.preventDefault(); 969 if (!isDragging) { 970 var tab = window.open($(this).attr("href"), $(this).attr("target")); 971 tab.focus(); 972 } 973 }) 974 .mousedown(function () { 975 isDragging = false; 976 }) 977 .mousemove(function () { 978 isDragging = true; 979 }); 980 981 $(".slick-slide") 982 .find("a[target]") 983 .on("click", function (e) { 984 e.preventDefault(); 985 if (!isDragging) { 986 var tab = window.open($(this).attr("href"), $(this).attr("target")); 987 tab.focus(); 988 } 989 }) 990 .mousedown(function () { 991 isDragging = false; 992 }) 993 .mousemove(function () { 994 isDragging = true; 995 }); 996 997 var storageService = function () { 998 var STORAGE_KEY = "bookmarkitems"; 999 var bookmarkitems = {}; 1000 1001 var init = function () { 1002 bookmarkitems = localStorage.getItem(STORAGE_KEY); 1003 if (bookmarkitems) { 1004 bookmarkitems = JSON.parse(bookmarkitems); 1005 } else { 1006 bookmarkitems = {}; 1007 } 1008 }; 1009 1010 var set = function (key, value) { 1011 bookmarkitems[key] = value; 1012 updateStorage(); 1013 }; 1014 1015 var get = function (key) { 1016 return bookmarkitems[key]; 1017 }; 1018 1019 var updateStorage = function () { 1020 localStorage.setItem(STORAGE_KEY, JSON.stringify(bookmarkitems)); 1021 }; 1022 1023 return { 1024 init: init, 1025 set: set, 1026 get: get, 1027 updateStorage: updateStorage, 1028 }; 1029 }; 1030 1031 function removeMarkerItem(arrayPos, markerKey, marker) { 1032 marker.init(); 1033 let items = marker.get(markerKey); 1034 items.splice(arrayPos, 1); 1035 marker.set(markerKey, items); 1036 location.reload(); 1037 } 1038 1039 // Bookmark functions for Sites 1040 1041 $(".bookmarkme").on("click", function () { 1042 var marker = storageService(); 1043 let markerKey = "sites"; 1044 let url = window.location.href; 1045 1046 let pathnames = window.location.pathname.split("/"); 1047 let dateToday = moment().format("D.MM.YYYY"); 1048 pathnames.shift(); 1049 let siteLink = { 1050 url: url, 1051 pathnames: pathnames, 1052 date: dateToday, 1053 }; 1054 1055 marker.init(); 1056 if (marker.get(markerKey) === undefined) { 1057 marker.set(markerKey, [siteLink]); 1058 } else { 1059 let sites = marker.get(markerKey); 1060 sites.push(siteLink); 1061 marker.set(markerKey, sites); 1062 } 1063 }); 1064 1065 if ($("#markedSites").length > 0) { 1066 var marker = storageService(); 1067 let markerKey = "sites"; 1068 1069 marker.init(); 1070 if (marker.get(markerKey) === undefined || marker.get(markerKey).length <= 0) { 1071 $("#markedSites").html("<p>Keine gemerkte Inhalte gefunden.</p>"); 1072 } else { 1073 let sites = marker.get(markerKey); 1074 $("#markedSites").append('<div class="container"></div>');
1075 sites.forEach((site, index) => { 1076 var fullPath = ""; 1077 site.pathnames.forEach((path) => { 1078 fullPath += "<span class='markerBreadcrumb'>" + path + "</span> "; 1079 }); 1080 1081 $("#markedSites .container").append( 1082 '<div class="row">' + 1083 '<div class="col-12 col-sm-12 col-md-12 col-lg-10">' + 1084 "<p>Gemerkt am: " + 1085 site.date + 1086 "<br>" + 1087 '<a href="' + 1088 site.url + 1089 '">' + 1090 fullPath + 1091 "</a>" + 1092 "</div>" + 1093 '<div class="col-12 col-sm-12 col-md-12 col-lg-2">' + 1094 '<button type="button" class="btn btn-outline-primary merken-btn w-100 w-sm-100 remove-marker" data-position="' + 1095 index + 1096 '">' + 1097 '<svg class="merken-svg-wrapper" xmlns="http://www.w3.org/2000/svg" viewBox="-4 -2 35 35">' + 1098 "<g>" + 1099 "<g>" + 1100 '<polygon class="icon-top-merken" points="23.51 28.35 4.91 28.35 3.18 4.42 25.24 4.42 23.51 28.35"></polygon>' + 1101 '<line class="icon-top-merken" x1="0.6" y1="4.42" x2="27.82" y2="4.42"></line>' + 1102 '<polygon class="icon-top-merken" points="16.98 0.6 11.35 0.6 10.15 4.42 18.27 4.42 16.98 0.6"></polygon>' + 1103 '<line class="icon-top-merken" x1="14.22" y1="8.27" x2="14.22" y2="24.42"></line>' + 1104 '<line class="icon-top-merken" x1="19.95" y1="8.27" x2="18.88" y2="24.42"></line>' + 1105 '<line class="icon-top-merken" x1="8.49" y1="8.27" x2="9.56" y2="24.42"></line>' + 1106 "</g>" + 1107 "</g>" + 1108 "</svg>" + 1109 "</button>" + 1110 "</div>" + 1111 "</div>" 1112 ); 1113 }); 1114 } 1115 } 1116 1117 $(".remove-marker").on("click", function () { 1118 let arrayPos = $(this).data().position; 1119 let markerKey = "sites"; 1120 var marker = storageService(); 1121 removeMarkerItem(arrayPos, markerKey, marker); 1122 }); 1123 1124 // Bookmark functions for News 1125 1126 $(".bookmarknews").on("click", function () { 1127 var marker = storageService(); 1128 let markerKey = "news"; 1129 let url = window.location.href; 1130 let title = $("#page-title").text().trim(); 1131 let dateToday = moment().format("D.MM.YYYY"); 1132 1133 let siteLink = { 1134 url: url, 1135 date: dateToday, 1136 title: title, 1137 }; 1138 1139 marker.init(); 1140 if (marker.get(markerKey) === undefined) { 1141 marker.set(markerKey, [siteLink]); 1142 } else { 1143 let sites = marker.get(markerKey); 1144 sites.push(siteLink); 1145 marker.set(markerKey, sites); 1146 } 1147 }); 1148 1149 if ($("#markedNews").length > 0) { 1150 var marker = storageService(); 1151 let markerKey = "news"; 1152 1153 marker.init(); 1154 if (marker.get(markerKey) === undefined || marker.get(markerKey).length <= 0) { 1155 $("#markedNews").html("<p>Keine gemerkte Inhalte gefunden.</p>"); 1156 } else { 1157 let sites = marker.get(markerKey); 1158 let type = ""; 1159 $("#markedNews").append('<div class="container"></div>'); 1160 sites.forEach((site, index) => { 1161 switch (site.type) { 1162 case "announcement": 1163 type = "Kundmachung"; 1164 break; 1165 case "act": 1166 type = "Verordnung"; 1167 break; 1168 default: 1169 type = "Neuigkeit"; 1170 break; 1171 } 1172 1173 $("#markedNews .container").append( 1174 '<div class="row">' + 1175 '<div class="col-12 col-sm-12 col-md-12 col-lg-10">' + 1176 "<p>Gemerkt am: " + 1177 site.date + 1178 " [" + 1179 type + 1180 "]<br>" + 1181 '<a href="' + 1182 site.url + 1183 '">' + 1184 site.title + 1185 "</a>" + 1186 "</div>" + 1187 '<div class="col-12 col-sm-12 col-md-12 col-lg-2">' + 1188 '<button type="button" class="btn btn-outline-primary merken-btn w-100 w-sm-100 remove-marker-news" data-position="' + 1189 index + 1190 '">' + 1191 '<svg class="merken-svg-wrapper" xmlns="http://www.w3.org/2000/svg" viewBox="-4 -2 35 35">' + 1192 "<g>" + 1193 "<g>" + 1194 '<polygon class="icon-top-merken" points="23.51 28.35 4.91 28.35 3.18 4.42 25.24 4.42 23.51 28.35"></polygon>' + 1195 '<line class="icon-top-merken" x1="0.6" y1="4.42" x2="27.82" y2="4.42"></line>' + 1196 '<polygon class="icon-top-merken" points="16.98 0.6 11.35 0.6 10.15 4.42 18.27 4.42 16.98 0.6"></polygon>' + 1197 '<line class="icon-top-merken" x1="14.22" y1="8.27" x2="14.22" y2="24.42"></line>' + 1198 '<line class="icon-top-merken" x1="19.95" y1="8.27" x2="18.88" y2="24.42"></line>' + 1199 '<line class="icon-top-merken" x1="8.49" y1="8.27" x2="9.56" y2="24.42"></line>' + 1200 "</g>" + 1201 "</g>" + 1202 "</svg>" + 1203 "</button>" + 1204 "</div>" + 1205 "</div>" 1206 ); 1207 }); 1208 } 1209 } 1210 1211 $(".remove-marker-news").on("click", function () { 1212 let arrayPos = $(this).data().position; 1213 let markerKey = "news"; 1214 var marker = storageService(); 1215 removeMarkerItem(arrayPos, markerKey, marker); 1216 }); 1217 1218 // Bookmark functions for Term 1219 1220 $(".bookmarkterm").on("click", function () { 1221 var marker = storageService(); 1222 let markerKey = "term"; 1223 let url = window.location.href; 1224 let title = $("#page-title").text().trim(); 1225 let dateToday = moment().format("D.MM.YYYY"); 1226 1227 let siteLink = { 1228 url: url, 1229 date: dateToday, 1230 title: title, 1231 }; 1232 1233 marker.init(); 1234 if (marker.get(markerKey) === undefined) { 1235 marker.set(markerKey, [siteLink]); 1236 } else { 1237 let sites = marker.get(markerKey); 1238 sites.push(siteLink); 1239 marker.set(markerKey, sites); 1240 } 1241 }); 1242 1243 if ($("#markedTerm").length > 0) { 1244 var marker = storageService(); 1245 let markerKey = "term"; 1246 1247 marker.init(); 1248 if (marker.get(markerKey) === undefined || marker.get(markerKey).length <= 0) { 1249 $("#markedTerm").html("<p>Keine gemerkte Inhalte gefunden.</p>"); 1250 } else { 1251 let terms = marker.get(markerKey); 1252 $("#markedTerm").append('<div class="container"></div>');
1253 terms.forEach((site, index) => { 1254 $("#markedTerm .container").append( 1255 '<div class="row">' + 1256 '<div class="col-12 col-sm-12 col-md-12 col-lg-10">' + 1257 "<p>Gemerkt am: " + 1258 site.date + 1259 "<br>" + 1260 '<a href="' + 1261 site.url + 1262 '">' + 1263 site.title + 1264 "</a>" + 1265 "</div>" + 1266 '<div class="col-12 col-sm-12 col-md-12 col-lg-2">' + 1267 '<button type="button" class="btn btn-outline-primary merken-btn w-100 w-sm-100 remove-marker-term" data-position="' + 1268 index + 1269 '">' + 1270 '<svg class="merken-svg-wrapper" xmlns="http://www.w3.org/2000/svg" viewBox="-4 -2 35 35">' + 1271 "<g>" + 1272 "<g>" + 1273 '<polygon class="icon-top-merken" points="23.51 28.35 4.91 28.35 3.18 4.42 25.24 4.42 23.51 28.35"></polygon>' + 1274 '<line class="icon-top-merken" x1="0.6" y1="4.42" x2="27.82" y2="4.42"></line>' + 1275 '<polygon class="icon-top-merken" points="16.98 0.6 11.35 0.6 10.15 4.42 18.27 4.42 16.98 0.6"></polygon>' + 1276 '<line class="icon-top-merken" x1="14.22" y1="8.27" x2="14.22" y2="24.42"></line>' + 1277 '<line class="icon-top-merken" x1="19.95" y1="8.27" x2="18.88" y2="24.42"></line>' + 1278 '<line class="icon-top-merken" x1="8.49" y1="8.27" x2="9.56" y2="24.42"></line>' + 1279 "</g>" + 1280 "</g>" + 1281 "</svg>" + 1282 "</button>" + 1283 "</div>" + 1284 "</div>" 1285 ); 1286 }); 1287 } 1288 } 1289 1290 $(".remove-marker-term").on("click", function () { 1291 let arrayPos = $(this).data().position; 1292 let markerKey = "term"; 1293 var marker = storageService(); 1294 removeMarkerItem(arrayPos, markerKey, marker); 1295 }); 1296 1297 $(".marker-act").on("click", function () { 1298 var marker = storageService(); 1299 let markerKey = "news"; 1300 let acc = $(this).data().acc; 1301 let url = window.location.href.split("?")[0] + "?open_acc=" + acc; 1302 let title = $('.card-header[data-target="#' + acc + '"]') 1303 .text() 1304 .trim(); 1305 let dateToday = moment().format("D.MM.YYYY"); 1306 1307 let siteLink = { 1308 url: url, 1309 date: dateToday, 1310 title: title, 1311 type: "act", 1312 }; 1313 1314 marker.init(); 1315 if (marker.get(markerKey) === undefined) { 1316 marker.set(markerKey, [siteLink]); 1317 } else { 1318 let sites = marker.get(markerKey); 1319 sites.push(siteLink); 1320 marker.set(markerKey, sites); 1321 } 1322 }); 1323 1324 // Bookmark functions for Busineesscard 1325 1326 $(".card-marker").on("click", function () { 1327 var marker = storageService(); 1328 let markerKey = "cards"; 1329 let card = $(this).data().card; 1330 let type = $(this).data().type; 1331 let url = window.location.href.split("?")[0] + "?card=" + card; 1332 let name = $("#" + card + " .name") 1333 .text() 1334 .trim(); 1335 let dateToday = moment().format("D.MM.YYYY"); 1336 1337 let siteLink = { 1338 url: url, 1339 date: dateToday, 1340 name: name, 1341 type: type, 1342 }; 1343 1344 marker.init(); 1345 if (marker.get(markerKey) === undefined) { 1346 marker.set(markerKey, [siteLink]); 1347 } else { 1348 let cards = marker.get(markerKey); 1349 cards.push(siteLink); 1350 marker.set(markerKey, cards); 1351 } 1352 }); 1353 1354 if ($("#markedCards").length > 0) { 1355 var marker = storageService(); 1356 let markerKey = "cards"; 1357 1358 marker.init(); 1359 if (marker.get(markerKey) === undefined || marker.get(markerKey).length <= 0) { 1360 $("#markedCards").html("<p>Keine gemerkte Inhalte gefunden.</p>"); 1361 } else { 1362 let cards = marker.get(markerKey); 1363 let type = ""; 1364 $("#markedCards").append('<div class="container"></div>'); 1365 cards.forEach((card, index) => { 1366 switch (card.type) { 1367 case "politician": 1368 type = "Politiker"; 1369 break; 1370 case "employee": 1371 type = "Mitarbeiter"; 1372 break; 1373 } 1374 1375 $("#markedCards .container").append( 1376 '<div class="row">' + 1377 '<div class="col-12 col-sm-12 col-md-12 col-lg-10">' + 1378 "<p>Gemerkt am: " + 1379 card.date + 1380 " [" + 1381 type + 1382 "]<br>" + 1383 '<a href="' + 1384 card.url + 1385 '">' + 1386 card.name + 1387 "</a>" + 1388 "</div>" + 1389 '<div class="col-12 col-sm-12 col-md-12 col-lg-2">' + 1390 '<button type="button" class="btn btn-outline-primary merken-btn w-100 w-sm-100 remove-marker-card" data-position="' + 1391 index + 1392 '">' + 1393 '<svg class="merken-svg-wrapper" xmlns="http://www.w3.org/2000/svg" viewBox="-4 -2 35 35">' + 1394 "<g>" + 1395 "<g>" + 1396 '<polygon class="icon-top-merken" points="23.51 28.35 4.91 28.35 3.18 4.42 25.24 4.42 23.51 28.35"></polygon>' + 1397 '<line class="icon-top-merken" x1="0.6" y1="4.42" x2="27.82" y2="4.42"></line>' + 1398 '<polygon class="icon-top-merken" points="16.98 0.6 11.35 0.6 10.15 4.42 18.27 4.42 16.98 0.6"></polygon>' + 1399 '<line class="icon-top-merken" x1="14.22" y1="8.27" x2="14.22" y2="24.42"></line>' + 1400 '<line class="icon-top-merken" x1="19.95" y1="8.27" x2="18.88" y2="24.42"></line>' + 1401 '<line class="icon-top-merken" x1="8.49" y1="8.27" x2="9.56" y2="24.42"></line>' + 1402 "</g>" + 1403 "</g>" + 1404 "</svg>" + 1405 "</button>" + 1406 "</div>" + 1407 "</div>" 1408 ); 1409 }); 1410 } 1411 } 1412 1413 $(".remove-marker-card").on("click", function () { 1414 let arrayPos = $(this).data().position; 1415 let markerKey = "cards"; 1416 var marker = storageService(); 1417 removeMarkerItem(arrayPos, markerKey, marker); 1418 }); 1419 1420 /**revert accordian Header wrap**/ 1421 /** accordion header wrap in tag a */ 1422 1423 /*$(".accordion .card-header").wrap('<a href="#" rel="nofollow" class="card-header-wrap-a"/>'); 1424 1425 $(document).on('keydown', '.card-header-wrap-a', function (e) { 1426 var key = e.which; 1427 if(key == 13) { 1428 $(this).find(".card-header").trigger("click"); 1429 return false;
1430 } 1431}); 1432 1433 $(document).on("click", ".card-header-wrap-a",function(event){ 1434 event.preventDefault(); 1435 1436 $(this).find(".card-header").trigger("click"); 1437 1438 });*/ 1439 1440 /**revert download link**/ 1441 /** add attribute href for tag a in download link for focus */ 1442 1443 /* $(".download").each(function(){ 1444 var linkDownload = $(this); 1445 linkDownload.attr("href","#"); 1446 1447 }); 1448 1449 $(".download").click(function(event){ 1450 event.preventDefault(); 1451 })*/ 1452 1453 //alt + 0 --- Startseite 1454 //alt + 1 --- Inhalt 1455 //alt + 2 --- Suche 1456 //alt + 3 --- Kontakt 1457 document.onkeyup = function (e) { 1458 if (e.altKey && e.which == 48) { 1459 //alt + 0 --- Startseite 1460 window.location = "/"; 1461 } else if (e.altKey && e.which == 49) { 1462 //alt + 1 --- Inhalt 1463 window.location.hash = "#page-content"; 1464 } else if (e.altKey && e.which == 50) { 1465 //alt + 2 --- Suche 1466 focusSearchField(); 1467 } else if (e.altKey && e.which == 51) { 1468 //alt + 3 --- Kontakt 1469 window.location.hash = "#page-footer"; 1470 } 1471 }; 1472 1473 $(".skiplink.content").click(function () { 1474 window.location.hash = "#page-content"; 1475 }); 1476 1477 $(".skiplink.contact").click(function () { 1478 window.location.hash = "#page-footer"; 1479 }); 1480 1481 $("a.skiplink.search").click(function () { 1482 focusSearchField(); 1483 }); 1484 1485 /* menu items accessibility 1486 var menus = document.querySelectorAll('.dropdown'); 1487 var navlinks = document.querySelectorAll('.nav-link'); 1488 const event = new Event('mouseover',{ bubbles: true, cancelable: false }) 1489 1490 console.log('menu => ', menus); 1491 menus.forEach(menu => { 1492 menu.addEventListener( 'mouseover', function(e) { 1493 //e.target.style.background = "pink"; 1494 console.log('item'); 1495 //this.querySelector('.nav-link').classList.add('show'); 1496 //this.lastElementChild.classList.add('show'); 1497 }); 1498 menu.addEventListener( 'focus', function(e) { 1499 this.querySelector('.nav-link').classList.remove('show'); 1500 this.lastElementChild.classList.remove('show'); 1501 }); 1502 });*/ 1503 1504 /* navlinks.forEach(link => { 1505 link.addEventListener('focus', function(e) { 1506 //e.target.style.background = "pink"; 1507 //console.log('item'+e); 1508 //link.classList.add('activeFocus'); 1509 //has focus open dropdown menu 1510 link.parentElement.style.background = "pink"; 1511 var parent = link.parentNode.parentNode; 1512 console.log(parent) 1513 //parent.children[1].style.display = "block"; 1514 parent.dispatchEvent(event); 1515 }); 1516 link.addEventListener('blur', function(e) { 1517 //link.classList.remove('activeFocus'); 1518 }); 1519 }); */ 1520}); 1521 1522window.addEventListener("load", activateStickyFooter); 1523 1524function activateStickyFooter() { 1525 adjustFooterCssTopToSticky(); 1526 window.addEventListener("resize", adjustFooterCssTopToSticky); 1527} 1528 1529function adjustFooterCssTopToSticky() { 1530 const footer = document.querySelector(".section-footer"); 1531 const bounding_box = footer.getBoundingClientRect(); 1532 const footer_height = bounding_box.height; 1533 const window_height = window.innerHeight; 1534 const above_footer_height = bounding_box.top - getCssTopAttribute(footer); 1535 if (above_footer_height + footer_height <= window_height) { 1536 const new_footer_top = window_height - (above_footer_height + footer_height); 1537 footer.style.top = new_footer_top + "px"; 1538 document.querySelector("#content-footer").style.top = new_footer_top + "px"; 1539 document.querySelector("#content-footer").style.position = "relative"; 1540 document.querySelector("#content-footer").style.borderTop = "1px solid #dedede"; 1541 } else if (above_footer_height + footer_height > window_height) { 1542 footer.style.top = null; 1543 } 1544} 1545 1546function getCssTopAttribute(htmlElement) { 1547 const top_string = htmlElement.style.top; 1548 if (top_string === null || top_string.length === 0) { 1549 return 0; 1550 } 1551 const extracted_top_pixels = top_string.substring(0, top_string.length - 2); 1552 return parseFloat(extracted_top_pixels); 1553} 1554 1555//scroll to accordion and open all parents 1556if (location.href.indexOf("#") != -1) { 1557 //console.log(location.hash); 1558 var elementHash = location.hash; 1559 var accCardHeader = $(elementHash).children(".card-header"); 1560 var accCardContent = $(elementHash).children(".card-content"); 1561 accCardHeader.removeClass("collapsed"); 1562 accCardHeader.attr("aria-expanded", "true"); 1563 accCardContent.addClass("show"); 1564 var parentAcc = $(elementHash).parent().parent().parent().parent().parent().parent(); 1565 while (parentAcc.hasClass("acc-gemeinde")) { 1566 parentAcc = $(elementHash).parent().parent().parent().parent().parent().parent(); 1567 elementHash = "#" + parentAcc.attr("id"); 1568 1569 var accCardHeader = $(elementHash).children(".card-header"); 1570 var accCardContent = $(elementHash).children(".card-content"); 1571 accCardHeader.removeClass("collapsed"); 1572 accCardHeader.attr("aria-expanded", "true"); 1573 accCardContent.addClass("show"); 1574 } 1575 window.scrollTo(window.scrollX, window.scrollY - 100); 1576} 1577 1578function focusSearchField() { 1579 $(".header-search-front:visible input:first").focus(); 1580}
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.