PageSourceSearch

https://www.jugendbudget.ch/wp-content/themes/jugendbudget/assets/js/main.js?ver=1790328888

js jugendbudget.ch collected 2026-10-05 09:54:33 UTC 8,300 bytes, 332 lines download raw bytes

1(function ($) {
2  $(window).on('scroll', function () {
3    if ($(this).scrollTop()) {
4      $('.back-to-top').fadeIn();
5    } else {
6      $('.back-to-top').fadeOut();
7    }
8  });
9
10  $(window).on('resize', function () {
11    const windowsize = $(window).width();
12    if (windowsize >= 768) {
13        $('#menu').removeAttr('style');
14    } else {
15    }
16  });
17
18  $(window).on('load', function () {
19
20  })
21
22
23
24  // Document Ready
25  $(document).ready(function () {
26    toggleMenu();
27    toggleSearch();
28    carousel();
29    changeCategory();
30    scrollToElement();
31    scrollToForm();
32    postCategoryCarousel();
33    formLanguage();
34
35    /*
36    if (!getCookie('show_banner'))
37      $('.cookie-banner').show();
38
39    $('.cookie-banner .btn.btn-primary').on('click', function() {
40      setCookie('show_banner', '1');
41      $('.cookie-banner').hide();
42    });
43    */
44
45    $('select[name="how-did-you-hear-about-the-event"]').on('select2:select', function (e) {
46        var data = e.params.data;
47        if(data.id === 'Other'){
48            $(this).parents('form').find('.other').removeClass('d-none');
49        }else{
50            $(this).parents('form').find('.other').addClass('d-none');
51        }
52    });
53
54    // $('.sib_signup_form').each(function(){
55    //   $submit = $(this).find('input[type="submit"]');
56    //   setTimeout(function(){
57    //     $submit.attr("disabled", "disabled").button('refresh');
58    //   },500)
59    //   $checkbox = $(this).find('input[type="checkbox"].required');
60    //   $checkbox.on("change", function () {
61    //       if($(this).is(':checked')){
62    //         $submit.removeAttr("disabled").button('refresh');
63    //       }else{
64    //         $submit.attr("disabled", "disabled").button('refresh');
65    //       }
66    //   });
67
68    // });
69    $('.sib_signup_form').each(function(){
70      $submit = $(this).find('input[type="submit"]');
71      $checkbox = $(this).find('input[type="checkbox"].required');
72
73      if ($checkbox.length) {
74        setTimeout(function(){
75          $submit.attr("disabled", "disabled");
76        }, 500);
77        $checkbox.on("change", function () {
78          $submit.prop("disabled", !$(this).is(':checked'));
79        });
80      }
81    });
82    //Custom Select
83    $('select').select2({
84      minimumResultsForSearch: -1
85    });
86
87    $('#category-dropdown').on('select2:select', function (e) {
88      var data = e.params.data;
89      link = data.id;
90      window.location.href = link;
91    });
92
93    $categorySelect = $('.category-dropdown select');
94    if($categorySelect.length){
95
96      $categorySelect.select2({
97        templateResult:    catColor,
98        minimumResultsForSearch: -1
99        //templateSelection: catColor,
100      });
101
102      $selected  = window.location.href;
103      $categorySelect.val($selected); // Select the option with a value of '1'
104      $categorySelect.trigger('change'); // Notify any JS components that the value changed
105    }
106
107    //Back to top Button
108    $(".back-to-top").click(function () {
109      $("html, body").animate({ scrollTop: 0 }, 1000);
110      return false;
111    });
112
113  });
114
115  function formLanguage(){
116    $("form").each(function(){
117      langInput  = $(this).find('input[type="hidden"][name="language"]');
118      if(langInput.length){
119        lang = $('html')[0].lang;
120        console.log(this)
121        langInput.val(lang);
122      }
123    })
124  }
125  function scrollToElement(){
126    $("a").click(function (){
127      var url = $(this).attr('href');
128      var hash = url.split('#');
129
130      if(hash[1]){
131        $('html, body').animate({
132            scrollTop: $('#' + hash[1]).offset().top - 150
133        }, 200);
134        return false;
135      }
136  });
137  }
138  function scrollToForm(){
139    $(".scroll-to-form").click(function (){
140      var form = $('body').find('.headlessform-holder');
141          target =  form.get(0).id;
142      $('html, body').animate({
143        scrollTop: $('#' + target).offset().top - 150
144      }, 500);
145  });
146  }
147
148
149  function changeCategory () {
150    $('#change-category').click(function(){
151      $select = $('.category-dropdown select');
152      $href   = $select.select2('val');
153
154      window.location.href = $href;
155
156    })
157  }
158  function catColor (opt) {
159    if (!opt.id) {
160        return opt.text.toUpperCase();
161    }
162
163    var color = $(opt.element).attr('data-color');
164
165    if(!color){
166       return opt.text.toUpperCase();
167    } else {
168        var $opt = $(
169           '<span class="text-holder">' + opt.text + '</span> <span class="theme-color" style="background-color: '+ color +'"></span>'
170        );
171        return $opt;
172    }
173};
174
175
176  //Carousel
177  function carousel(){
178
179      //Init the carousel
180      $(".hero.owl-carousel").owlCarousel({
181        items: 1,
182        dots: false,
183        loop: false,
184        autoplay: true,
185        mouseDrag: false,
186        //onInitialized: startProgressBar,
187        //onTranslate: resetProgressBar,
188        //onTranslated: startProgressBar
189      });
190
191      function startProgressBar() {
192        // apply keyframe animation
193        $(".slide-progress").css({
194          width: "100%",
195          transition: "width 5000ms"
196        });
197      }
198
199      function resetProgressBar() {
200        $(".slide-progress").css({
201          width: 0,
202          transition: "width 0s"
203        });
204      }
205  }
206  //Post Category Carousel
207  function postCategoryCarousel(){
208    $catSlider = $(".category-slider.owl-carousel");
209    if( $catSlider.length)
210      $catSlider.each(function(){
211        if( $(this).find('.item').length > 3){
212          $(this).owlCarousel({
213
214            dots: false,
215            nav: true,
216            loop: true,
217          //  autoplay: true,
218            responsive : {
219              0 : {
220                items: 1,
221              },
222              768 : {
223                items: 2,
224              },
225              992 : {
226                items: 3,
227              }
228            }
229          });
230        }
231      });
232
233}
234
235
236  //Toogle Search
237  function toggleSearch(){
238    $button  = $('.toggle-search');
239    $html  = $('html');
240
241    $button.click(function(){
242        $search = $(this).attr('href');
243        $($search).toggleClass('active');
244        $html.removeClass('menu-open').toggleClass('search-open');
245        $('#menu').removeClass('active');
246        return false;
247    })
248  }
249  //Toggle menu
250  function toggleMenu(){
251    $button    = $('.toggle-menu');
252    $langmenu  = $('.lang-menu > .pll-parent-menu-item');
253    $html      = $('html');
254
255
256    $langmenu.click(function(){
257      $(this).toggleClass('active');
258    })
259
260    $(document).on("click", function(event){
261      if($langmenu !== event.target && !$langmenu.has(event.target).length && !$(event.target).hasClass('pll-parent-menu-item')){
262         $langmenu.removeClass('active');
263      }
264  });
265  $('input').on('focus', function(){
266    $langmenu.removeClass('active');
267  });
268
269
270
271    $button.click(function(){
272        $menu = $(this).attr('href');
273        $($menu).toggleClass('active');
274        $html.removeClass('search-open').toggleClass('menu-open');
275        $('#search').removeClass('active');
276        if($(window).width() <= 767){
277          $($menu).slideToggle()
278        }
279
280        return false;
281    })
282
283
284
285
286  }
287
288  //Mobile Menu
289  function MobileMenu(){
290    new Mmenu(document.querySelector('#menu'), {
291        navbar: { add: false },
292        onClick: {
293          close: true,
294        },
295        "slidingSubmenus": false,
296        "extensions": [
297          //"position-back",
298          "position-top",
299          //"pagedim-black",
300        ]
301      }, {
302        // configuration
303        offCanvas: {
304            clone: true
305        },
306        // classNames: {
307        //   fixedElements: {
308        //       fixed: "header"
309        //   }
310        // }
311    });
312  }
313
314})(jQuery);
315function setCookie(c_name, value, exdays) {
316  var exdate = new Date();
317  exdate.setDate(exdate.getDate() + exdays);
318  var c_value = escape(value) + '; path=/' +((exdays == null) ? "" : "; expires=" + exdate.toUTCString());
319  document.cookie = c_name + "=" + c_value;
320}
321
322function getCookie(c_name) {
323  var i, x, y, ARRcookies = document.cookie.split(";");
324  for (i = 0; i < ARRcookies.length; i++) {
325      x = ARRcookies[i].substr(0, ARRcookies[i].indexOf("="));
326      y = ARRcookies[i].substr(ARRcookies[i].indexOf("=") + 1);
327      x = x.replace(/^\s+|\s+$/g, "");
328      if (x == c_name) {
329          return unescape(y);
330      }
331  }
332}

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.