PageSourceSearch

https://www.museum-joanneum.at/typo3temp/assets/compressed/cart-e07a232f6edaa3f6ed563dc9fe7f778d.js?1787647515

js museum-joanneum.at collected 2026-09-24 08:47:17 UTC 6,760 bytes, 185 lines download raw bytes

1$( document ).ready(function() {
2
3    $(".submitBT").click(function () {
4        $("[data-required='true']").each(function (index, element) {
5            if ($(element).val() === '') {
6                $(element).parent().addClass("error");
7            } else {
8                $(element).parent().removeClass("error");
9            }
10        });
11
12        $("[data-required-selectize-select='true']").each(function (index, element) {
13            /* IS Multi Select */
14            if (typeof $(element).val() === 'object') {
15                if ($.isEmptyObject($(element).val())) {
16                    $(element).parent().addClass("error");
17                } else {
18                    $(element).parent().removeClass("error");
19                }
20            }
21
22            /* IS Single Select */
23            if (typeof $(element).val() === 'string') {
24                if ($(element).val() === "") {
25                    $(element).parent().addClass("error");
26                } else {
27                    $(element).parent().removeClass("error");
28                }
29            }
30        });
31
32        $("[data-required-email='true']").each(function (index, element) {
33            if ($(element).val() === "") {
34                $(element).parent().addClass("error");
35            } else {
36                if (!validateEmail($(element).val())) {
37                    $(element).parent().addClass("error");
38                } else {
39                    $(element).parent().removeClass("error");
40                }
41            }
42        });
43
44        $("[data-required-rechnung-radio='true']").each(function (index, element) {
45            if (!$('input[class=zahlungsartRadio]:checked').val()) {
46                $('.zahlungsart-header').addClass("error");
47            } else {
48                $('.zahlungsart-header').removeClass("error");
49            }
50        });
51
52        $("[data-required-checkbox='true']").each(function (index, element) {
53            if (!$(element).is(':checked')) {
54                $(element).parent().addClass('error');
55            } else {
56                $(element).parent().removeClass('error');
57            }
58        });
59
60
61        if($(this).closest("form").find(".error").length === 0){
62            $(this).closest("form").submit();
63        }
64
65
66    });
67
68    $(".patenschaft-item-cart,.patenschaft-remove-cart").click(function () {
69        $.post($(this).data("url"), {
70            item: $(this).data("item"),
71            donation: $("#donation").val(),
72            donation_time: $("#donation_time").find(":selected").val()
73        }, function(result){
74            $("#patenschaft-cart-total").html(result.total);
75            if(result.cartType === "remove"){
76                window.location.reload(); /* Reload Page after Removing an Item from Cart */
77            }else if(result.cartType === "add"){
78                /*$(".patenschaft-item-cart").find("p").html("Warenkorb anpassen");
79                $(".patenschaft-item-cart").find("svg").hide()
80                */
81                window.location.reload();
82            }
83        });
84    });
85    $(".patenschaft-item-cart-out,.patenschaft-remove-cart-out").click(function () {
86        var clickedBtn = $(this);
87        $.post($(this).data("url"), {
88            item: $(this).data("item"),
89            donation: $(this).siblings("a").find(".donation_input").val(),
90            donation_time: $(this).siblings("a").find(".donation_time_input").val(),
91        }, function(result){
92            $("#patenschaft-cart-total").html(result.total);
93            if(result.cartType === "remove"){
94                window.location.reload(); /* Reload Page after Removing an Item from Cart */
95            }else if(result.cartType === "add"){
96                console.log($(this));
97                console.log($(this).find("p"));
98                clickedBtn.find("p").html("Warenkorb anpassen");
99               // clickedBtn.find("svg").hide();
100            }
101
102        });
103    });
104
105   $("#donation_time,#donation").change(function () {
106       var input = $(this).val();
107       var minInput = $(this).attr("min");
108       if(parseInt(input) < parseInt(minInput)){
109           $(this).attr("value",minInput);
110           $(this).val(minInput);
111       }
112
113       calculateSingleItem();
114   });
115
116   //adjust time in the card view
117    $(".years-field.card").each(function (index, element) {
118        var input = $(this).val();
119        var minInput = $(this).attr("min");
120        if(parseInt(input) < parseInt(minInput)){
121            $(this).attr("value",parseInt(minInput));
122            $.post($(this).data("url"), {
123                item: $(this).data("item"),
124                donation: $(this).data("donation"),
125                donation_time: $(this).val()
126            }, function(result){
127                window.location.reload();  /* Reload Page after Removing an Item from Cart */
128            });
129        }
130
131    });
132
133
134   /* warenkorb action - add Years */
135   $(".tx-ms-patenschaft-cart .years-field").change(function () {
136       var input = $(this).val();
137       var minInput = $(this).attr("min");
138       if(parseInt(input) < parseInt(minInput))
139           $(this).attr("value",parseInt(minInput));
140       $.post($(this).data("url"), {
141           item: $(this).data("item"),
142           donation: $(this).data("donation"),
143           donation_time: $(this).val()
144       }, function(result){
145          window.location.reload();  /* Reload Page after Removing an Item from Cart */
146       });
147   });
148
149   $(".checkout-cta").click(function () {
150       $(this).hide();
151       $(".years-field").attr("readonly", "readonly");
152       $(".tx-ms-patenschaft-checkout").show();
153       $('#bTag-selectized').attr("readonly", "readonly");
154       $('#bMonat-selectized').attr("readonly", "readonly");
155   });
156
157   calculateSingleItem();
158
159   $("select[data-selectize='true']").selectize(window.selectizeOptions); /* Options for Selectize.js  set by public/ms_includes/formulare_2020/JavaScript/forms.js */
160
161    $('#donation').keyup(function(event) {
162        var input = $(this).val();
163        var reg = /^(\d+)?([.,]\d{0,2})?$/;
164        // Check if input matches the regular expression
165        if (!reg.test(input)) {
166            // Remove last character if it doesn't match the pattern
167            $(this).val(input.substring(0, input.length-1));
168        }
169    });
170
171
172
173});
174function validateEmail(email) {
175    var filter = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})(\.[a-z]{2,}(?:\.[a-z]{2})?)$/i;
176
177    if (!filter.test(email)) return false;
178    return true;
179}
180
181function calculateSingleItem(){
182    let donation = parseFloat($("#donation").val());
183    let donation_time = parseInt($("#donation_time").find(":selected").val());
184    $("#kulturpatenschaft-total-singleitem").html(parseFloat(donation * donation_time).toFixed(2));
185}

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.