PageSourceSearch

https://bechinger.ch/js/script.js?128285

js bechinger.ch collected 2026-10-05 10:29:31 UTC 11,383 bytes, 269 lines download raw bytes

1jQuery(document).ready(function ($) {
2
3    $(document).on('click', '#bestellung-button', function (e) {
4
5        var valid = true;
6        $('.validate-form').find('.validate-me').each(function () {
7            if ($(this).val().length === 0) {
8                $(this).addClass('is-invalid');
9                valid = false;
10            } else {
11                $(this).removeClass('is-invalid');
12            }
13        });
14
15        if (!valid) {
16            e.preventDefault();
17            return false;
18        }
19    });
20
21    $(document).on('submit', '.validate-form', function (e) {
22        var valid = true;
23        $('.validate-form').find('.validate-me').each(function () {
24            if ($(this).val().length === 0) {
25                $(this).addClass('is-invalid');
26                valid = false;
27            } else {
28                $(this).removeClass('is-invalid');
29            }
30        });
31        if (!valid) {
32            e.preventDefault();
33            return false;
34        }
35    });
36
37    // date and time picker min: new Date()
38    var datepicker = $('.datepicker').pickadate({
39        monthsFull: ['Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember'],
40        weekdaysShort: ['So', 'Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa'],
41        today: 'Heute',
42        clear: 'leeren',
43        close: 'schliessen',
44        format: 'd.m.yyyy',
45        formatSubmit: 'd.m.yyyy',
46        hiddenSuffix: '',
47		min: +1,
48        max: false
49    });
50
51    // date and time picker min: new Date()
52    var datepickerdez = $('.datepickerdez').pickadate({
53        monthsFull: ['Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember'],
54        weekdaysShort: ['So', 'Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa'],
55        today: 'Heute',
56        clear: 'leeren',
57        close: 'schliessen',
58        format: 'd.m.yyyy',
59        formatSubmit: 'd.m.yyyy',
60        hiddenSuffix: '',
61        //min: new Date(2022,11,1),
62       // min: new Date(),
63        min: +1, //morgen
64        max: false,
65        disable: [
66            1,
67            new Date(2025,11,24),
68            new Date(2025,11,25),
69            new Date(2025,11,26),
70            new Date(2025,11,27),
71            new Date(2026,0,1),
72            new Date(2026,0,2),
73            new Date(2026,0,3)
74        ]
75    });
76
77    var timepicker = $('.timepicker').pickatime({
78        format: 'H:i',
79        formatSubmit: 'H:i',
80        interval: 15,
81        min: [7, 0],
82        max: [18, 30],
83        //disable: [12, 13],
84        hiddenSuffix: '',
85        clear: 'leeren'
86    });
87
88    // tooltip
89    $('[data-toggle="tooltip"]').tooltip();
90
91    // wysiwyg
92    $('#intro-text').wysihtml5({
93        "font-styles": true,
94        "link": true,
95        "image": false,
96        "color": false,
97        "blockquote": false
98    });
99
100    // slideshow
101    $('.slideshow').slick({
102        arrows: false,
103        autoplay: true,
104        fade: true
105    });
106
107    // bestellung meattype
108       $('input[name="art"]').change(function () {
109        var text = $('label[for="' + $(this).attr('id') + '"]').text();
110	    $('.js-meattype').text(text);
111		if (text == 'keines') {
112            $('.js-meattype-formpart').slideUp();
113			document.getElementById('rind').value="";
114			document.getElementById('kalb').value="";
115			document.getElementById('schwein').value="";
116			document.getElementById('poulet').value="";
117			document.getElementById('lamm').value="";
118			document.getElementById('pferd').value="";
119			document.getElementById('nierli').value="";
120			document.getElementById('leberli').value="";
121			document.getElementById('cipo').value="";
122			document.getElementById('speck').value="";
123	//changed to delete all fields of fondue and slideUp, 9.12.2019/mhu
124        } else {
125            $('.js-meattype-formpart').slideDown();
126        }
127
128    });
129
130    if ($('.tablefilter').length) {
131        var tf = new TableFilter(document.querySelector('.tablefilter'), {
132            base_path: '/js/tablefilter/',
133            alternate_rows: true,
134            rows_counter: {
135                text: 'Angezeigt: '
136            },
137            auto_filter: {
138                delay: 100 //milliseconds
139            },
140            col_6: 'none',
141            status_bar: true,
142            extensions: [{name: 'sort'}],
143            themes: [{name: 'transparent'}],
144            watermark: ['Suchen...', 'Suchen...', 'Suchen...', 'Suchen...', 'Suchen...', 'Suchen...']
145        });
146        tf.init();
147    }
148
149    $(document).on('click', '.saveandpdf', function (e) {
150        $($(this).data('target')).val($(this).data('value'));
151    });
152
153    $(document).on('click', '.itemrow', function () {
154        var currentid = $(this).data('edititem');
155        var type = $(this).data('type');
156        var redirect = $(this).data('redirect');
157        var out = '<form id="edititem" class="form-horizontal" action="/edit" method="post" enctype="multipart/form-data">';
158        if (redirect) {
159            out += '<input type="hidden" name="redirect" value="' + redirect + '">';
160        }
161        out += getHiddenFields($(this).data('hidden'));
162
163        $(this).find('.itemvalue').each(function (index) {
164            var key = $(this).data('key');
165            out += '<div class="form-group"><label for="" class="col-sm-4 control-label">' + $(this).data('label') + '</label>';
166            if ($(this).data('editor') == 'checkbox') {
167                var checked = $(this).data('value') == true ? 'checked' : '';
168                out += '<div class="col-sm-8"><input type="hidden" name="' + key + '" value="false"><input type="checkbox" class="form-control" name="' + key + '" value="true" ' + checked + '></div></div>';
169            } else if ($(this).data('editor') == 'checkboxes') {
170                var opts = $(this).data('checkboxes');
171                var checkedvalues = $(this).data('checked');
172                out += '<div class="col-sm-8">';
173                $.each(opts, function (index, item) {
174                    var checked = '';
175                    $.each(checkedvalues, function (i, ch) {
176                        if (item.id == ch.id) {
177                            checked = 'checked';
178                        }
179                    });
180
181                    out += '<label><input type="checkbox" name="' + key + '" value="' + item.id + '" ' + checked + '> ' + item.group + '</label><br>';
182                });
183                out += '</div></div>';
184            } else if ($(this).data('editor') == 'textarea') {
185                out += '<div class="col-sm-8"><textarea class="form-control" placeholder="' + $(this).data('label') + '" name="' + key + '" rows="10">' + $(this).data('value') + '</textarea></div></div>';
186            } else if ($(this).data('editor') == 'select') {
187                out += '<div class="col-sm-8"><select class="form-control" name="' + key + '"><option value=""></option>';
188                var opts = $(this).data('options');
189                var label = $(this).data('optionlabels');
190                var val = $(this).data('value');
191                $.each(opts, function (index, item) {
192                    if (item.id == val) {
193                        out += '<option selected="selected" value="' + item.id + '">' + item[label] + '</option>';
194                    } else {
195                        out += '<option value="' + item.id + '">' + item[label] + '</option>';
196                    }
197                });
198                out += '</select></div></div>';
199            } else if ($(this).data('editor') == 'number') {
200                out += '<div class="col-sm-8"><input type="' + $(this).data('editor') + '" step="any" class="form-control" placeholder="' + $(this).data('label') + '" name="' + key + '" value="' + $(this).data('value') + '"></div></div>';
201            } else {
202                out += '<div class="col-sm-8"><input type="' + $(this).data('editor') + '" class="form-control" placeholder="' + $(this).data('label') + '" name="' + key + '" value="' + $(this).data('value') + '"></div></div>';
203            }
204        });
205
206        out += '</form>';
207        out += getRemoveForm(type, currentid, redirect);
208        var modalfooter = '<input type="submit" class="btn btn-outline-danger" form="deleteform" value="Löschen"><input class="btn btn-outline-success" type="submit" value="Speichern" form="edititem">';
209
210        $('#edititemmodal .modal-body').html(out);
211        $('#edititemmodal .modal-footer').html(modalfooter);
212        $('#edititemmodal').modal('show');
213    });
214
215// create new item
216    $(document).on('click', '.newitem', function () {
217        var out = '<form id="createitem" class="form-horizontal" action="/create" method="post"><input type="hidden" name="type" value="' + $(this).data('type') + '"><input type="hidden" name="createitem" value="true">';
218        out += getHiddenFields($(this).data('hidden'));
219        var arr = $(this).data('key');
220        var optionlabel = $(this).data('optionlabels');
221        $.each(arr, function (index, item) {
222            //skip id field
223            if (item.key == 'id') {
224                return true;
225            } else if (item.key == 'password') {
226                out += '<div class="form-group"><label>' + item.label + '</label>';
227                out += '<input type="password" class="form-control" name="' + item.key + '" value="" autocomplete="nope"></div>';
228            } else if (item.editor == 'select') {
229
230                out += '<div class="form-group"><label>' + item.label + '</label>';
231                out += '<select class="form-control" name="' + item.key + '" >';
232                $.each(item.values, function (i, v) {
233                    out += '<option value="' + v.id + '">' + v[optionlabel] + '</option>';
234                })
235                out += '</select></div>';
236            } else if (item.editor == 'checkbox') {
237                out += '<div class="form-group"><div class="checkbox"><input type="hidden" name="' + item.key + '" value="false"><label><input type="checkbox" name="' + item.key + '" value="true"> ' + item.label + '</label></div></div>';
238            } else {
239                out += '<div class="form-group"><label>' + item.label + '</label>';
240                out += '<input type="text" class="form-control" name="' + item.key + '" value="" required autocomplete="nope"></div>';
241            }
242        });
243        out += '</form>';
244        var modalfooter = '<button type="button" class="btn btn-outline-secondary" data-dismiss="modal">Abbrechen</button><input class="btn btn-outline-success" type="submit" value="Speichern" form="createitem">';
245
246        $('#edititemmodal .modal-body').html(out);
247        $('#edititemmodal .modal-footer').html(modalfooter);
248        $('#edititemmodal').modal('show');
249    });
250
251
252// template functions
253    var getRemoveForm = function (type, id, redirect) {
254        return '<form id="deleteform" class="" role="form" action="/delete" method="post"><input type="hidden" name="type" value="' +
255            type + '"><input type="hidden" name="deleteitem" value="' +
256            id + '"></form>';
257    };
258
259    var getHiddenFields = function (hidden) {
260        var result = "";
261        if (hidden) {
262            $.each(hidden, function (index, element) {
263                result += '<input type="hidden" name="' + element.name + '" value="' + element.value + '">';
264            });
265        }
266        return result;
267    };
268
269});

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.