PageSourceSearch

https://www.bgn.de/_assets/8e2c5f5173553784a39ec3d71762d1eb/JavaSc…/CenterOfCompetenceFrontend.js?1790589337

js bgn.de collected 2026-10-02 10:36:16 UTC 3,496 bytes, 114 lines download raw bytes

1$(document).ready(function () {
2  $('.centersofcompetence__form').each(function () {
3    let obj = new CentersOfCompetence($(this));
4    obj.initBindings($(this).find(".coe_searchTerm"), $(this).find(".coe_submit"));
5  });
6});
7
8function CentersOfCompetence(_this) {
9  let myInput;
10  let myButtom;
11  let list;
12
13  this.initBindings = function (inputfield, cta) {
14    myInput = inputfield;
15    myButtom = cta;
16    list = $(".centersofcompetence__list");
17    addAction();
18  }
19
20  function addAction() {
21    myButtom.click(function (e) {
22      e.preventDefault();
23
24      $.ajax({
25        url: "/?centersofcompetence=search",
26        method: "GET",
27        dataType: "json",
28        data: {
29          zip: myInput.val()
30        },
31        beforeSend: function (data, a, b) {
32          myFadeOut();
33        },
34        complete: function (data, a, b) {
35          myFadeIn();
36        },
37        error: function (data, a, b) {
38          addErrorMessage(data.responseJSON);
39        },
40        success: function (data, a, b) {
41          myReplaceContent(data);
42        }
43      });
44    })
45  }
46
47  function addErrorMessage(message) {
48    let p = $("<p>").append(message).addClass("error box info");
49    list.append(p);
50  }
51
52  function myFadeOut() {
53    list.fadeOut(2, function (o) {
54      $(this).html("");
55    });
56  }
57
58  function myFadeIn() {
59    list.fadeIn();
60  }
61
62  function myReplaceContent(data) {
63    list.append($("<hr>"));
64    $("<p>").append("Ihre Suche nach der Postleitzahl " + myInput.val() + " lieferte folgendes Ergebnis:")
65      .appendTo(list);
66
67    if (data.length > 0) {
68      if (data.length > 1) {
69        $("<p>").append("Es wurden " + data.length + " Kompetenzzentren gefunden.")
70          .appendTo(list);
71      } else {
72        $("<p>").append("Es wurde " + data.length + " Kompetenzzentrum gefunden.")
73          .appendTo(list);
74      }
75      let cont = $("<div>").addClass("row");
76      $.each(data, function () {
77        let inner = $(".centersofcompetence__contacttemplate").clone();
78        replaceContactInfo(inner, this);
79        $("<div>").addClass("col-md-6").append(inner.html()).appendTo(cont);
80      });
81
82      list.append($("<div>").addClass("listwrap").append(cont));
83
84    } else if (data.length == 1) {
85      let inner = $(".centersofcompetence__contacttemplate").clone();
86      replaceContactInfo(inner, data[0]);
87      list.html(inner.html());
88    } else {
89      addErrorMessage("Es wurde kein Kompetenzzentrum gefunden");
90    }
91  }
92
93  function replaceContactInfo(obj, data) {
94    obj.find(".centersofcompetenceType").append(data.type);
95
96    let head = obj.find(".centersofcompetenceHeadline");
97    head.append($("<strong>").append(data.name));
98
99    let address = obj.find(".centersofcompetenceAddress");
100    if (data.location != undefined && data.location != '')
101      address.append($("<p>")).append(data.location);
102    address.append($("<p>").append(data.address)).append($("<p>").append(data.zip + " " + data.city));
103
104    let contactinfo = obj.find(".centersofcompetenceContactInfo");
105    if (data.phone != undefined && data.phone != "")
106      contactinfo.append($("<p>").append("Fon: " + data.phone));
107    if (data.fax != undefined && data.fax != "")
108      contactinfo.append($("<p>").append("Fax: " + data.fax));
109    if (data.mobile != undefined && data.mobile != "")
110      contactinfo.append($("<p>").append("Mobil: " + data.mobile));
111    if (data.email != undefined && data.email != "")
112      contactinfo.append($("<p>").append("E-Mail: " + data.email));
113  }
114}

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.