PageSourceSearch

https://www.digitalbotschafter-rlp.de/wp-content/themes/digibo/js/main.js?ver=17a4b3d

js digitalbotschafter-rlp.de collected 2026-10-07 08:57:02 UTC 4,950 bytes, 191 lines download raw bytes

1/**** HEADER SEARCH ****/
2function bodyHideSearchHandler() {
3    hideHeaderSearch();
4    jQuery('body').off('click', bodyHideSearchHandler);
5    jQuery('body').off('keyup', bodySearchKeyListener);
6}
7
8function bodySearchKeyListener(e) {
9    if (e.which === 27) {
10        hideHeaderSearch();
11        jQuery('body').off('click', bodyHideSearchHandler);
12        jQuery('body').off('keyup', bodySearchKeyListener);
13    }
14}
15
16function showHeaderSearch() {
17    jQuery('#headerSearch').show(50, function () {
18        jQuery('#headerSearch').addClass('active');
19        jQuery('#headerSearchInput').focus();
20
21        jQuery('body').on('click', bodyHideSearchHandler);
22        jQuery('body').on('keyup', bodySearchKeyListener);
23
24        jQuery('#headerSearch').on('click', function (e) {
25            e.stopPropagation();
26        });
27    });
28}
29
30function hideHeaderSearch() {
31    jQuery('#headerSearch').on('transitionend', function () {
32        jQuery('#headerSearch').off('transitionend');
33        jQuery('#headerSearch').hide();
34    });
35
36    jQuery('#headerSearch').removeClass('active');
37}
38
39jQuery(function () {
40    jQuery('#headerSearchForm').on('submit', function (e) {
41        if (jQuery('#headerSearchInput').val() == '') {
42            e.preventDefault();
43        }
44    });
45});
46/**** /HEADER SEARCH ****/
47
48
49/**** MOBILE MENU ****/
50var menuAnimationRunning = false;
51
52function showMobileMenu() {
53    if (menuAnimationRunning) {
54        return false;
55    }
56
57    menuAnimationRunning = true;
58
59    jQuery('#mobileOverlay').show(100, function () {
60        jQuery('#mobileOverlay').on('transitionend', function () {
61            menuAnimationRunning = false;
62            jQuery('#mobileOverlay').off('transitionend');
63        });
64
65        jQuery('#mobileOverlay').addClass('active');
66    });
67}
68
69function hideMobileMenu() {
70    if (menuAnimationRunning) {
71        return false;
72    }
73
74    menuAnimationRunning = true;
75
76    jQuery('#mobileOverlay').on('transitionend', function () {
77        jQuery('#mobileOverlay').hide(100, function () {
78            menuAnimationRunning = false;
79            jQuery('#mobileOverlay').off('transitionend');
80        });
81    });
82
83    jQuery('#mobileOverlay').removeClass('active');
84}
85/**** /MOBILE MENU ****/
86
87
88/**** UTILITIES ****/
89function isDesktop() {
90    return window.innerWidth >= 1024;
91}
92
93function isMobile() {
94    return window.innerWidth < 1024;
95}
96/**** /UTILITIES ****/
97
98
99/**** SCROLL TO ANCHOR ****/
100if (window.location.hash != '') {
101    setTimeout(function() {
102        jQuery(function(){
103            var targetEl = jQuery(window.location.hash);
104            if ( targetEl.length == 0 ) return false;
105
106            var targetTop = targetEl.position().top;
107
108            window.scroll({
109                top: targetTop - jQuery('#topHeader').height(),
110                left: 0,
111                behavior: 'smooth'
112            });
113        });
114    }, 500);
115}
116/**** /SCROLL TO ANCHOR ****/
117
118
119/**** EVENT REGISTRATION FORM ****/
120jQuery(function(){
121    if ( !jQuery('body').is('.page-id-341') ) {
122        return true;
123    }
124
125    const registerForm = jQuery('form.digiboForm');
126    if ( registerForm.length !== 1 ) {
127        console.error('Could not find register-form');
128        return false;
129    }
130
131    const startDateInput = jQuery('#input_2_2');
132    const endDateInput = jQuery('#input_2_3');
133
134    endDateInput.add(startDateInput).on('change', function(){
135
136        endDateInput.parent().find('.notice').remove();
137
138        const endVal = endDateInput.val();
139        if ( !endVal ) {
140            return true;
141        }
142
143        const endDate = getDateObjectFromDateString(endVal);
144        if ( !endDate ) {
145            return true;
146        }
147
148        const startVal = startDateInput.val();
149        if ( !startVal ) {
150            return true;
151        }
152
153        const startDate = getDateObjectFromDateString(startVal);
154        if ( !startDate ) {
155            return true;
156        }
157
158        if ( endDate.getTime() < startDate.getTime() ) {
159            const notice = jQuery('<span class="notice endBeforeStart">Bitte beachten: Das Enddatum darf nicht vor ' +
160                'dem Startdatum liegen!</span>');
161
162            notice.on('click', function(e){
163                const triggerEl = jQuery(e.currentTarget);
164                triggerEl.remove();
165            });
166
167            endDateInput.parent().append(notice);
168
169            return false;
170        }
171    });
172});
173
174
175function getDateObjectFromDateString(inputVal) {
176    const inputSplitVal = inputVal.split('.');
177    if ( inputSplitVal.length !== 3 ) {
178        console.error('could not split input-date string');
179        return false;
180    }
181    const dateString = inputSplitVal[2] + '-' + inputSplitVal[1] + '-' + inputSplitVal[0] + ' 00:00';
182    const dateObj = new Date(dateString);
183
184    if ( !dateObj.getTime() ) {
185        console.error('could build Date object from input "'+dateString+'"');
186        return false;
187    }
188
189    return dateObj;
190}
191/**** /EVENT REGISTRATION FORM ****/

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.