PageSourceSearch

https://www.kaunergrat.at/_assets/3a3b477bd7f04c2ba94978df6dd27fb7/Js/quickanfrage.js?1790861982

js kaunergrat.at collected 2026-10-02 12:15:25 UTC 6,252 bytes, 183 lines download raw bytes

1(function ($) {
2  $.fn.ajaxValidate = function (options) {
3    var $form = $(this),
4      defaultOptions;
5
6    defaultOptions = {};
7    options = $.extend(defaultOptions, options);
8
9    $form.find(".formloader").hide();
10    $form.on("submit.coo-ajaxvalidate", function (event) {
11      var $submitbutton = $(this),
12        globalAnfrageOptions = {};
13
14      if (Bh.plugins && Bh.plugins.anfrage) {
15        globalAnfrageOptions = Bh.plugins.anfrage;
16      }
17
18      event.preventDefault();
19
20      /*
21				Anfrage-Submit Hooks
22				Damit hat man in den einzelnen Projekten die Möglichkeit,
23				die Anfrage zu validieren und den Datentransfer abzubrechen, bevor
24				die Bakehouse validierung frontend und serverseitig beginnt.
25			*/
26      if (globalAnfrageOptions.onSubmitHooks) {
27        $.each(
28          globalAnfrageOptions.onSubmitHooks,
29          function (index, hookFunction) {
30            if (typeof hookFunction == "function") {
31              hookFunction.call(this, event);
32            }
33          },
34        );
35
36        if (event.isImmediatePropagationStopped()) {
37          return;
38        }
39      }
40
41      $form.find(".formloader").show();
42      $form.find('#bigmsg,[data-mailform-bigmsg="true"]').remove();
43      /* get some values from elements on the page: */
44      var formdata = $form.serialize() + "&uservalidation=1";
45      var url = $form.attr("action");
46
47      $.post(url, formdata, function (data) {
48        var response = data;
49        if (response.state == "success") {
50          var proccessSubmit = function () {
51            $form.off("submit.coo-ajaxvalidate");
52            $form.on("submit", function (e) {
53              if ($(this).hasClass("bh-state-form-submitting")) {
54                e.preventDefault();
55              } else {
56                $form.addClass("bh-state-form-submitting");
57
58                $form.append(
59                  '<input type="hidden" name="tx_cooquickanfrage_anfrageform[data][validation_timestamp]" value="' +
60                    response.timestamp +
61                    '" />' +
62                    '<input type="hidden" name="tx_cooquickanfrage_anfrageform[data][validation_token]" value="' +
63                    response.token +
64                    '" />',
65                );
66                if ($form.attr("data-success-action") == "event") {
67                  e.preventDefault();
68                  var formdata = new FormData($form.get(0));
69                  formdata.append(
70                    "success-action",
71                    $form.attr("data-success-action"),
72                  );
73                  $.ajax({
74                    url: $form.attr("action"),
75                    type: $form.attr("method"),
76                    data: formdata,
77                    processData: false,
78                    contentType: false,
79                    success: function (result) {
80                      $form.find(".formloader").hide();
81                      $form.trigger("bh-form-success", [{ result: result }]);
82                    },
83                  });
84                }
85              }
86            });
87            $form.submit();
88          };
89
90          var $gdprField = $form.find(
91            '[name="tx_cooquickanfrage_anfrageform[data][gdpr]"]:last, [name="tx_cooquickanfrage_anfrageform[data][dsgvo]"]:last, [name="tx_cooquickanfrage_anfrageform[data][datenschutz]"]:last',
92          );
93          if ($gdprField.length > 1) {
94            console.warn(
95              'Bakehouse Anfrage: Es gibt mehrere Datenschutz-Eingabe-Felder, es sollte nur eines der folgenden Felder verwendet werden ["gdpr","dsgvo","datenschutz"]',
96            );
97          } else if (
98            ($gdprField.length && $gdprField.val() == 1) ||
99            !Bh.settings ||
100            !Bh.settings.gdpr
101          ) {
102            proccessSubmit();
103          } else {
104            Bh.lastFocusedElement = $(document.activeElement);
105            var modal = Bh.modal.create(
106              "gdpr",
107              {
108                footer: true,
109                closeMethods: ["overlay", "button", "escape"],
110                onOpen: function () {
111                  $(".bh-modal-content").find(":focusable").first().focus();
112                },
113                onClose: function () {
114                  if (Bh.lastFocusedElement.length) {
115                    Bh.lastFocusedElement.focus();
116                  }
117                },
118              },
119              {
120                headline: Bh.messages.gdpr_popup_headline,
121                text: Bh.messages.gdpr_popup_content,
122              },
123            );
124
125            modal.addFooterBtn(
126              Bh.messages.gdpr_popup_cancel,
127              "tingle-btn bh-modal-abort",
128              function () {
129                $form.find(".formloader").hide();
130                modal.close();
131              },
132            );
133            modal.addFooterBtn(
134              Bh.messages.gdpr_popup_accept,
135              "tingle-btn bh-modal-accept",
136              function () {
137                $form.append(
138                  '<input type="hidden" name="tx_cooquickanfrage_anfrageform[data][gdpr]" value="1" />',
139                );
140                proccessSubmit();
141                modal.close();
142              },
143            );
144            modal.open();
145          }
146        } else {
147          $form.find(".formloader").hide();
148          //render Errors
149          try {
150            var json = data;
151          } catch (e) {
152            alert("ajaxValidateCatchedError in base.js: no json");
153            return false;
154          }
155
156          if ($form.find(".errorBox").length < 1) {
157            $form.prepend('<div class="errorBox">');
158          } else {
159            $form.find(".errorBox").html("");
160          }
161
162          var offset = 100;
163          if (globalAnfrageOptions.scrollOffsetOnError) {
164            offset = globalAnfrageOptions.scrollOffsetOnError;
165          }
166          $("html,body").animate(
167            {
168              scrollTop: $form.find(".errorBox").offset().top - offset,
169            },
170            0,
171          );
172
173          var errorcontent = "";
174          $.each(json, function (i, item) {
175            errorcontent += "<div>" + item + "</div>";
176          });
177
178          $form.find(".errorBox").html(errorcontent);
179        }
180      });
181    });
182  };
183})(jQuery);

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.