PageSourceSearch

https://bbw-berufliche-schulen.de/templates/app.js

js bbw-berufliche-schulen.de collected 2026-10-04 01:40:08 UTC 22,246 bytes, 649 lines download raw bytes

1/*
2 * Author: Karsten Baumgardt
3 */
4var App = function () {
5    //Fixed Header
6    function handleHeader() {
7        jQuery(window).scroll(function () {
8            if (jQuery(window).scrollTop() > 100) {
9                jQuery('.header-fixed .header-sticky').addClass('header-fixed-shrink');
10            } else {
11                jQuery('.header-fixed .header-sticky').removeClass('header-fixed-shrink');
12            }
13        });
14    }
15
16    //Header Mega Menu
17    function handleMegaMenu() {
18        jQuery(document).on('click', '.navbar .dropdown-menu', function (e) {
19            e.stopPropagation();
20        })
21    }
22
23    // Collapse für die Studienagebote
24    function handleCollapse() {
25        $('.card .collapse').on('show.bs.collapse', function () { // Was pasiert beim Öffnen
26            $(this).parent().addClass("active");
27        });
28
29        $('.card .collapse').on('hide.bs.collapse', function () { // Was pasiert beim schliesen
30            $(this).parent().removeClass("active");
31        });
32
33        $(".card .collapse").on("shown.bs.collapse", function () {
34            var selected = $(this);
35            var collapseh = $(".header").height() + 100;
36            $.scrollTo(selected, 500, {
37                offset: -(collapseh)
38            });
39          console.log(selected);
40          console.log(collapseh);
41        });
42    }
43
44    // Collapse für die Filerelemente in der Aside
45    function handleCollapseFilter() {
46        //$('.content .panel-default').first().addClass("active").children(".panel-collapse").addClass("in"); // Erstes Element anzeigen
47        $('.panel-filter .panel-collapse').on('show.bs.collapse', function () { // Was pasiert beim Öffnen
48            $(this).parent().addClass("active");
49        });
50
51        $('.panel-filter .panel-collapse').on('hide.bs.collapse', function () { // Was pasiert beim schliesen
52            $(this).parent().removeClass("active");
53        });
54    }
55
56    // Collapse für Box
57    function handleCollapsebox() {
58        $('.teaser .collapse').on('show.bs.collapse', function () { // Was pasiert beim Öffnen
59            $(this).parent().addClass("active").find('a').html('schliessen');
60        });
61
62        $('.teaser .collapse').on('hide.bs.collapse', function () { // Was pasiert beim schliesen
63            $(this).parent().removeClass("active").find('a').html('mehr erfahren');
64        });
65
66    }
67  		function handleEqualheight() {
68            if( typeof $().matchHeight === "function" ){
69              $('.data-eqh').matchHeight({
70                  property: 'min-height',
71              });
72            }  
73        }
74   
75    //Collaps für Weiterbildung Anmeldung
76    function handleCollapseAnmeldung() {
77        //$('.content .panel-default').first().addClass("active").children(".panel-collapse").addClass("in"); // Erstes Element anzeigen
78        $('.panel-formular .panel-collapse').on('show.bs.collapse', function () { // Was pasiert beim Öffnen
79            $(this).parent().addClass("active");
80        });
81
82        $('.panel-formular .panel-collapse').on('hide.bs.collapse', function () { // Was pasiert beim schliesen
83            $(this).parent().removeClass("active");
84        });
85    }
86    
87
88    //Menu für Mobile - Smartphone anpassen.
89    function handleMobMenu() {
90        function MobMenu() {
91            //console.log('mob');
92            $('.header .mega-menu .menu-border').removeClass('data-eqh');
93            $('.header .mega-menu .menu-border').css("height", "40");
94
95            $('.has-mega-menu .menuhead a').on('click', function (e) {
96
97                if ($(this).parent().hasClass('has-children')) {
98                    e.stopPropagation();
99                    var sublist = $(this).parent().next('ul');
100                    var subheight = sublist.outerHeight();
101                    $('.navbar-nav').css({
102                        transform: 'translateX(-100%)',
103                        position: 'relative',
104                        margin: '0px',
105                        visibility: 'hidden'
106                    });
107                    $('.navbar-collapse').css({
108                        height: subheight
109
110                    });
111                    sublist.fadeIn('fast');
112                    sublist.css('visibility', 'visible');
113                    return false;
114                } else {
115                    return true;
116                }
117            });
118
119            $('ul.sub .headline .backlink').click(function () {
120                $('.navbar-nav').css({
121                    transform: 'translateX(0%)',
122                    position: 'relative',
123                    margin: '0',
124                    visibility: 'visible'
125                });
126                $('.navbar-collapse').removeAttr('style');
127                $(this).parent().parent().hide();
128            });
129
130            $('.navbar-collapse').on('show.bs.collapse', function () { // Was pasiert beim schliesen
131                console.log("aufmachen");
132                $('.wrapper').addClass("menu");
133                $('.navbar-toggle').addClass("open");
134            });
135
136            $('.navbar-collapse').on('hide.bs.collapse', function () { // Was pasiert beim schliesen
137                $('.navbar-nav').removeAttr('style');
138                $('.wrapper').removeClass("menu");
139                $('.navbar-toggle').removeClass("open");
140            });
141        }
142
143        if (jQuery(window).width() <= 991) {
144            MobMenu();
145            contactboxmobile();
146        };
147      
148        if (jQuery(window).width() >= 991) {
149           handlecontactbox();
150        };
151
152        jQuery(window).resize(function () {
153            if (jQuery(window).width() <= 991) {
154                MobMenu();
155                contactboxmobile();
156                //console.log("kleiner 768");
157            }
158
159            if (jQuery(window).width() > 991) {
160                $(".menu-border .sub").show();
161                $('.has-mega-menu h4 a').off('click');
162                handlecontactbox()
163                //console.log("grösser 768");
164            }
165        });
166
167    }
168  
169   function handlecontactbox() {
170        $(window).scroll(function () {
171            var scrollPos = $(document).scrollTop();
172            if (scrollPos >= '600') {
173              //$(".stud-berater").addClass("show");
174                  $(".contact-box").fadeIn();
175            } else {
176              //  $(".stud-berater").removeClass("show");
177                $(".contact-box").fadeOut();
178            }
179        });
180       }
181  
182  	function contactboxmobile() {
183        $(window).scroll(function () {
184            var scrollPos = $(document).scrollTop();
185            if (scrollPos >= '600') {
186              //$(".stud-berater").addClass("show");
187                  $(".contact-box-mobile").fadeIn();
188            } else {
189              //  $(".stud-berater").removeClass("show");
190                $(".contact-box-mobile").fadeOut();
191            }
192        });
193       } 
194
195
196    function pagination() {
197        $('body').on('click', '#massnahme_pagination li', function () {
198            var page = $(this).attr('data-page');
199            var activePage = $('#massnahme_pagination li.active').attr('data-page');
200            var page_zahl = $('#massnahme_pagination').attr('data-pagezahl');
201            var kategorie = $('#pagination_form input[name="kategorie"]').val();
202            var sorting = $('select.orderBy').val();
203
204            if (typeof page === "undefined") {
205                if ($(this).hasClass('next')) activePage++;
206                if ($(this).hasClass('prev')) activePage--;
207
208                if (activePage <= 1) activePage = 1;
209                if (activePage >= page_zahl) activePage = page_zahl;
210
211                page = activePage;
212            }
213            $("#massnahme_pagination li").removeClass('active');
214            $(this).addClass('active');
215            $('#pagination_form input[name="activePage"]').val(page);
216            $('#page').html(page);
217            $('#angebotlist').css("opacity", "0.5");
218            $("#angebotlist").load("/index.php?id=233b5bd4863715a
218d892100157eafb6a1&kategorie=" + kategorie + "&activePage=" + page + "&sorting=" + sorting, function () {
219                $.scrollTo('.filter-result', 500, {
220                    offset: -200
221                });
222                $('#angebotlist').css("opacity", "1");               
223            });
224        });
225
226        $('select.orderBy').on('change', function () {
227            $('#massnahme_pagination li.active').trigger('click');
228        });
229      
230      
231      
232    }
233
234    function angebotPopover() {
235            $("[data-toggle=popover]").popover({
236                html: true,
237                container: 'body',
238                content: function () {
239                    var content = $(this).attr("data-popover-content");
240                    return $(content).children(".popover-body").html();
241                },
242                title: function () {
243                    var title = $(this).attr("data-popover-content");
244                    return $(title).children(".popover-heading").html();
245                }
246            });
247    }
248
249      //Animate Dropdown
250      function initAnimateDropdown () {
251        function MenuMode() {
252            jQuery('.dropdown').on('show.bs.dropdown', function () {
253                // jQuery(this).find('.dropdown-menu').first().stop(true, true).fadeIn('fast');
254                $('.wrapper').addClass("menu");
255            });
256            jQuery('.dropdown').on('hide.bs.dropdown', function () {
257                // jQuery(this).find('.dropdown-menu').first().stop(true, true).fadeOut();
258                $('.wrapper').removeClass("menu");
259            });
260        }
261
262        jQuery(window).resize(function () {
263            if (jQuery(window).width() > 768) {
264                MenuMode();
265            }
266        });
267
268        if (jQuery(window).width() > 768) {
269            MenuMode();
270        }
271
272        $(".dropdown .close").on('click', function () {
273            $(".dropdown").removeClass("show");
274          	$(".dropdown-menu").removeClass("show");
275            $('.wrapper').removeClass("menu");
276            console.log('close');
277        });
278    }
279    
280      /**
281       * Pagination nur mit Form senden
282       * Keine Load oder Ajax
283       * created: IDP
284       */
285      function pagination2(){
286	      	$('body').on('click','#massnahme_pagination_2 li', function(){
287	      		var page = $(this).attr('data-page');
288	      		var page_zahl = $('#massnahme_pagination_2').attr('data-pagezahl');
289	      		//var activePage = $('#massnahme_pagination_2 li.active').attr('data-page');
290	      		var activePage = $('#pagination_form input[name="activePage"]').val(); 
291	              var sorting = $('select.orderBy').val();
292	              
293	              if (typeof page === "undefined") {
294	                  if ( $(this).hasClass('next') ) activePage++;
295	                  if ( $(this).hasClass('prev') ) activePage--;
296	                  if (activePage <= 1) activePage = 1;
297	                  if (activePage >= page_zahl) activePage = page_zahl;
298	                  page = activePage;
299	              }
300	              $('#pagination_form input[name="activePage"]').val(page); 
301	              setDATA('page',page);
302	              //Form Senden
303	              $('#pagination_form').submit();
304	      	});
305        if (getDATA('page')) {
306        var collapseh = $(".header").height();
307            $.scrollTo('#angebote', 500, {
308                offset: -(collapseh)
309            });
310         removeDATA('page');
311      }
312      }  
313      
314      
315    function handleUnveil() {
316       //JQuery Unveil zum nachlader der Bilder
317      if( typeof $().unveil === "function" ){  
318        $("img.unveil").unveil(200, function () {
319              $(this).load(function () {
320                  this.style.opacity = 1;
321                  handleEqualheight()               
322              });
323          });
324      }
325    }
326
327    function handleVenobox() {
328    	if( typeof $('.swipebox').venobox === "function" ){      		
329    		$('.swipebox').venobox();
330    	} 
331    }
332
333    function handleFitVids() {
334        //JQuery FitVids - Youtube Videos Responsive
335        $(".article .video").fitVids();
336    }
337
338    function handleDatepicker() {
339        $('#datumR').datepicker({
340            language: "de",
341            autoclose: true,
342            todayHighlight: true
343        });
344    }
345
346
347    // Bootstrap Modal über Ajax laden - Link muss data-toggle="ajaxmodal" haben.
348    function handleajaxModal() {
349        $('[data-toggle="ajaxModal"]').on('click',
350            function (e) {
351                $('#ajaxModal').remove();
352                e.preventDefault();
353                var $this = $(this)
354                    , $remote = $this.data('remote') || $this.attr('href')
355                    , $modal = $('<div class="modal fade" id="ajaxModal" tabindex="-1" role="dialog" aria-labelledby="Standortinformation"><div class="modal-body"></div></div>');
356                $('body').append($modal);
357                $modal.modal({ keyboard: false });
358                $modal.load($remote);
359            }
360        );
361    }
362  
363  function handlePopupScroll() {
364    	//Newsletter Seminare
365    console.log('popup');
366     if (jQuery(window).width() >= 768) {
367     
368     $('#slidepopup').addClass('show');
369     
370    $(window).scroll(function () {
371      if(typeof $.cookie === "function" && !$.cookie('Popup')) {
372        if ($(this).scrollTop() > 300) {
373            $('#slidepopup').addClass('show');
374        } else {
375            $('#slidepopup').removeClass('show');
376        }
377      }
378    });
379
380    
381    $('#slidepopup .close').click(function () {
382        $('#slidepopup').removeClass('show');
383        $.cookie('Popup', 'false' , { path: '/' });
384        return false;
385    });
386      
387    $('#slidepopup .link-button').click(function () {
388      	$('#slidepopup').removeClass('show');
389        $.cookie('Popup', 'false',  { path: '/' });
390        let popUrl = $('#slidepopup .link-button').attr('href', result);
391        console.log (popUrl);
392    	window.location.href = popUrl;
393      return false;
394    	     
395    });
396  }
397    
398      if (jQuery(window).width() <= 768) {
399    $(window).scroll(function () {
400      if(typeof $.cookie === "function" && !$.cookie('Popup')) {
401        if ($(this).scrollTop() > 300) {
402            $('#slidepopupmobil').addClass('show');
403        } else {
404            $('#slidepopupmobil').removeClass('show');
405        }
406      }
407    });
408
409    
410    $('#slidepopupmobil .close').click(function () {
411        $('#slidepopupmobil').removeClass('show');
412        $.cookie('Popup', 'false' , { path: '/' });
413        return false;
414    });
415      
416    $('#slidepopupmobil .link-button').click(function () {
417      	$('#slidepopupmobil').removeClass('show');
418        $.cookie('Popup', 'false',  { path: '/' });
419        let popUrl = $('#slidepopupmobil .link-button').attr('href', result);
420        console.log (popUrl);
421    	window.location.href = popUrl;
422      return false;
423    	     
424    });
425  }
426     
427 
428    
429   }
430  
431  //Local speichern
432var bbwStorage = localStorage;
433function setDATA( key, val ){ bbwStorage.setItem(key,val); }
434function getDATA( key ){ return bbwStorage.getItem(key); }
435function removeDATA( key ){  bbwStorage.removeItem(key); }
436  
437   
438
439    //Bootstrap Tooltips and Popovers
440    function handleBootstrap() {
441		
442        /*Tooltips*/
443        jQuery('.tooltips').tooltip();
444        jQuery('.tooltips-show').tooltip('show');
445        jQuery('.tooltips-hide').tooltip('hide');
446        jQuery('.tooltips-toggle').tooltip('toggle');
447        jQuery('.tooltips-destroy').tooltip('destroy');
448
449        /*Popovers*/
450        jQuery('.popovers').popover();
451        jQuery('.popovers-show').popover('show');
452        jQuery('.popovers-hide').popover('hide');
453        jQuery('.popovers-toggle').popover('toggle');
454        jQuery('.popovers-destroy').popover('destroy');
455    }
456
457    return {
458        init: function () {
459            handleBootstrap();
460            handleHeader();
461            handleMegaMenu();
462            handleCollapse();
463            handleCollapseFilter();
464            //handlecontactbox(); 
465            //handleCollapsebox();
466            //handleCollapseAnmeldung()
467            handlePopupScroll();
468            handleMobMenu();
469            handleUnveil();
470            handleVenobox()
471            //handleFitVids();
472            //handleDatepicker();
473            //handleajaxModal();
474            pagination();
475            pagination2();
476            angebotPopover();
477            initAnimateDropdown();
478            handleEqualheight();
479            
480        },
481
482        //Parallax Backgrounds
483        initParallaxBg: function () {
484            jQuery(window).load(function () {
485                jQuery('.parallaxBg').parallax("50%", 0.2);
486                jQuery('.parallaxBg1').parallax("50%", 0.4);
487                jQuery('.statement-section').parallax("50%", 0.3);
488            });
489        },
490
491        //Scroll Bar
492        initScrollBar: function () {
493            jQuery('.mCustomScrollbar').mCustomScrollbar({
494                theme: "minimal",
495                scrollInertia: 200,
496                scrollEasing: "linear"
497            });
498        },
499
500        //Form Validierung mit Parsley incl. aller Filterfunktionen im Infomaterial 
501        initParsley: function (form) {
502          
503          $(form).parsley();
504          
505          /*  
506          $(form).parsley({
507                errorsContainer: function (ParsleyField) {
508                    return ParsleyField.$element.attr("title");
509                },
510                errorsWrapper: false
511            });
512            Parsley.addMessages('de', {
513                defaultMessage: "Die Eingabe scheint nicht korrekt zu sein.",
514                type: {
515                    email: "Die Eingabe muss eine gültige E-Mail-Adresse sein.",
516                },
517                required: "Dies ist ein Pflichtfeld.",
518            });
519            Parsley.setLocale('de');
520
521            // when there is an error, display the tooltip with the error message
522            $.listen('parsley:field:error', function (fieldInstance) {
523                var messages = ParsleyUI.getErrorsMessages(fieldInstance);
524                fieldInstance.$element.tooltip('destroy');
525                fieldInstance.$element.tooltip({
526                    animation: false,
527                    container: 'body',
528                    placement: 'top',
529                    title: messages
530                });
531            });
532            // destroy tooltip when field is valid
533            $.listen('parsley:field:success', function (fieldInstance) {
534                fieldInstance.$element.tooltip('destroy');
535            });
536            */
537        },
538      
539      	initvalidateForm: function (formid) {
540		var Form = $('#' + formid);
541        //Form[0].checkValidity();
542        var isValid = true;
543        var Items = [];
544        FormArea = Form;
545        if (typeof formArea !== "undefined") {
546            FormArea = Form.find('#' + formArea);
547        }
548        FormArea.find('[required="required"]').each(function (key, item) {
549            if (!item.validity.valid) {
550                Items.push(item);
551                isValid = false;
552            }
553        });
554        if (!isValid) {
555            Form[0].classList.add('was-validated');
556        }
557          console.log(Items);
558        return Items;
559		},
560
561        // Slider funktion für alle möglichkeiten
562        initslider: function (art) {
563            switch (true) {
564                case (art == 'partner'):
565                    anzahl1 = 2;
566                    anzahl2 = 4;
567                    anzahl3 = 6;
568                    loop = true;
569                    navigation = false;
570                    autoplay = true;
571                    navigationTextLeft = '';
572                    navigationTextRight = '';
573                    slideclass = '.partner-slider';
574                    break;
575                case (art == 'teaser'):
576                    anzahl1 = 1;
577                    anzahl2 = 2;
578                    anzahl3 = 3;
579                    loop = false;
580                    autoplay = false;
581                    navigation = true;
582                    navigationTextLeft = '<i class="fa fa-angle-left"></i>';
583                    navigationTextRight = '<i class="fa fa-angle-right"></i>';
584                    slideclass = '.teaser-slider';
585                    break;
586                case (art == 'galerie'):
587                    anzahl1 = 2;
588                    anzahl2 = 3;
589                    anzahl3 = 4;
590                    loop = false;
591                    autoplay = false;
592                    navigation = true;
593                    navigationTextLeft = '<i class="fa fa-angle-left"></i>';
594                    navigationTextRight = '<i class="fa fa-angle-right"></i>';
595                    slideclass = '.galerie-slider';
596                    break;
597                default:
598            }
599
600
601        },
602
603        
604
605      
606    }
607
608}();
609
610jQuery(document).ready(function () {               
611    App.init(); 
612});
613
614
615/**
616 * jquery API RPC
617 * @param methodName
618 * @param parameters
619 * @param success_callback
620 * @param error_callback
621 * @returns
622 */
623function json_rpc( methodName, parameters, success_callback, error_callback ){
624
625	if (typeof parameters !== 'object' ) {
626		parameters = {};
627	}
628	
629	var ajaxOption = {
630			url: '/api.php?provider=json-2.0',
631			data:JSON.stringify( { jsonrpc:'2.0', method:methodName, params:parameters } ),
632			type:'POST',
633			dataType:'json',
634			async: ( parameters.async==0  ) ? ( false ) : ( true )
635	};
636	
637	var http = $.ajax( ajaxOption );
638	
639	if( typeof success_callback==='function' ){
640		http.success( success_callback );
641	}
642
643	if( typeof error_callback==='function' ){
644		http.error( error_callback );
645	}
646	
647	return http;
648};
649

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.