PageSourceSearch

https://saibt.sa.edu.au/wp-content/themes/wp-saibt/js/custom.js?ver=1

js saibt.sa.edu.au collected 2026-10-03 21:37:33 UTC 23,944 bytes, 682 lines download raw bytes

1var $ = jQuery.noConflict();
2
3// Open Navigation Menu by click on mobile
4// disabled for UPA
5(function($){
6    /*$('.dropdown-menu .dropdown-toggle').on('click', function(e) {
7        if (!$(this).next().hasClass('show')) {
8            $(this).parents('.dropdown-menu').first().find('.show').removeClass("show");
9        }
10        var $subMenu = $(this).next(".dropdown-menu");
11        if ( $subMenu.hasClass( 'show') ) {
12            $subMenu.removeClass('show');
13        } else {
14            $subMenu.addClass('show');
15        }
16        //$subMenu.toggleClass('show');
17
18        $(this).parents('li.nav-item.dropdown.show').on('hidden.bs.dropdown', function(e) {
19            $('.dropdown-submenu .show').removeClass("show");
20        });
21
22        return false;
23    });*/
24})(jQuery);
25
26// Open background search panel on mobile
27/***
28$('#mobile_site_search_container').on('show.bs.dropdown', function () {
29    $('.mobile-search-overlay').addClass('active');
30    $('body').addClass('no-scroll');
31});
32
33
34// Close background search panel on mobile
35$('#mobile_site_search_container').on('hide.bs.dropdown', function () {
36    $('.mobile-search-overlay').removeClass('active');
37    $('body').removeClass('no-scroll');
38});
39***/
40
41// Toggle up/down arrows on mobile menu
42$('.mobile_nav_item_toggler').on('click', function(event) {
43    var target_element = event.target;
44    var target_element_node = event.target.nodeName;
45    console.log(target_element);
46
47    if(target_element_node == 'SPAN') {
48        var top_level_icons = $('.mobile_nav_item_toggler_icon.level-0').not($(target_element));
49        $(target_element).toggleClass("fa-chevron-down fa-chevron-up");
50    } else if(target_element_node == 'DIV') {
51        var top_level_icons = $('.mobile_nav_item_toggler_icon.level-0').not($(target_element.querySelector('span')));
52        $(target_element.querySelector('span')).toggleClass("fa-chevron-down fa-chevron-up");
53    }
54    if(top_level_icons.hasClass('fa-chevron-up')) {
55        top_level_icons.removeClass('fa-chevron-up');
56        top_level_icons.addClass('fa-chevron-down');
57    }
58});
59
60$(document).ready(function(){
61
62    $('.close-mega-menu').click(function() {
63        $('.navlink.dropdown-toggle').removeClass('show');
64        $('.dropdown-menu.megamenu').removeClass('show');
65    });
66
67    // Change hamburger menu icon
68    $('#ChangeToggle').click(function() {
69        $('#navbar-hamburger').toggleClass('d-none');
70        if($('#navbar-close').hasClass('d-none')) {
71            $('#navbar-close').removeClass('d-none');
72            $('#main_navigation_toggle').addClass('show');
73        } else {
74            $('#navbar-close').addClass('d-none');
75            $('#main_navigation_toggle').removeClass('show');
76        }
77    });
78
79    // Site Search Validation
80    $('.dropdown-menu.dropdown-menu-right').on('click', function(e) {
81        e.stopPropagation();
82    });
83    $('.site-search-form-nav').submit(function(e){
84        $('.site-search-err-nav').addClass('d-none');
85        if($('.site-search-input-nav').val() == '') {
86            e.preventDefault();
87            $('.site-search-err-nav').removeClass('d-none');
88        }
89    });
90    $('.site-search-form').submit(function(e){
91        $('.site-search-err').addClass('d-none');
92        if($('.site-search-input').val() == '') {
93            e.preventDefault();
94            $('.site-search-err').removeClass('d-none');
95        }
96    });
97
98
99    $delayClass = '';
100    $(document).on('mouseenter', '.submenu-button', function () {
101    //$('.nav-item-desktop.dropdown').hover(function() {
102        //$(this).addClass("nav-arrow-active");
103
104
105        var parentclass = $(this).parent();
106
107        $delayClass = setTimeout(function(){
108
109            $(parentclass).find('.dropdown-menu').fadeIn();
110            $(this).addClass("nav-arrow-active");
111        }, 1000);
112
113        //$(parentclass).find('.dropdown-menu').delay(800).fadeIn();
114
115
116
117
118        $this = $(this);
119
120    });
121
122    $(document).on('mouseleave', '.submenu-button', function () {
123    //$('.nav-item-desktop.dropdown').hover(function() {
124
125        $(this).removeClass("nav-arrow-active");
126
127        var parentclass = $(this).parent();
128
129        clearTimeout($delayClass);
130
131        $delayClass = setTimeout(function(){
132            $(parentclass).find('.dropdown-menu').fadeOut();
133        }, 1000);
134
135        //$(parentclass).find('button').removeClass('nav-arrow-active');
136    });
137
138    $('#menu-main-nav > .menu-item').hover(function() {
139        clearTimeout($delayClass);
140        $('#menu-main-nav .menu-item .dropdown-menu').hide();
141
142            $(this).find('.sub-menu').show();
143            $(this).find('.dropdown-menu').addClass("nav-arrow-active");
144
145    },
146    function() { // leave hover
147
148        clearTimeout($delayClass);
149        $('#menu-main-nav .menu-item .dropdown-menu').hide();
150        $delayClass = setTimeout(function(){
151
152            $(this).find('.sub-menu').hide();
153            $(this).find('.dropdown-menu').addClass("nav-arrow-active");
154        }, 1000);
155    });
156
157    $('.sub-menu .menu-item').hover(function() {
158        clearTimeout($delayClass);
159
160        $(this).parent().siblings(".submenu-button").addClass("nav-arrow-active");
161        $(this).parent().show();
162    },
163    function () { // leave hover
164
165        $(this).parent().hide();
166        $(this).parent().siblings(".submenu-button").removeClass("nav-arrow-active");
167    });
168
169    // Add smooth scrolling to all links
170    $(".a-z-content a").on('click', function(event) {
171        if (this.hash !== "") {
172            // Prevent default anchor click behavior
173            event.preventDefault();
174            // Store hash
175            var hash = this.hash;
176            // The optional number (800) specifies the number of milliseconds it takes to 
176scroll to the specified area
177            $('html, body').animate({
178                scrollTop: $(hash).offset().top
179            }, 800, function(){
180                // Add hash (#) to URL when done scrolling (default click behavior)
181                window.location.hash = hash;
182            });
183        } // End if
184    });
185
186
187    // Add card shadow on hover
188    $( '.news-events-social-feeds .media' ).hover(function(){
189        $(this).addClass( 'shadow' );
190
191    }, function(){
192        $(this).removeClass( 'shadow' );
193    });
194
195    //Scroll to top
196    var $window = $(window);
197    var $buttonTop = $('.scroll-top')
198    var scrollTimer;
199    $('.scroll-top').on('click', function () {
200        $('html, body').animate({
201            scrollTop: 0,
202        }, 400);
203    });
204
205    $window.on('scroll', function () {
206        clearTimeout(scrollTimer);
207        scrollTimer = setTimeout(function() {
208            if ($window.scrollTop() > 100) {
209                $buttonTop.addClass('scroll-top-visible');
210            } else {
211                $buttonTop.removeClass('scroll-top-visible');
212            }
213        }, 250);
214    });
215
216    var heroCarousel = $('.hero-owl-carousel');
217    let itemsCount = Number($('.hero-owl-carousel').attr("data-items"));
218    let autoplayTimeout = 5000;
219    let loops = 2;
220    heroCarousel.owlCarousel({
221        items: 1,
222        loop: true,
223        nav: true,
224        navText: [
225            '<i class="fa-light fa-chevron-left hero-owl-prev-nav"></i>',
226            '<i class="fa-light fa-chevron-right hero-owl-next-nav"></i>'
227            //'<img src="/wp-content/themes/wp-ua92/images/Home-Page-Banner-Arrow-Left.png" />',
228            //'<img src="/wp-content/themes/wp-ua92/images/Home-Page-Banner-Arrow-Right.png" />'
229        ],
230        dotsContainer: '.slider-dots-container',
231        autoplay: false,
232        autoplayHoverPause: true,
233        autoplayTimeout:autoplayTimeout,
234        /***onInitialized : owlSliderStopTimer(heroCarousel, {
235            itemsCount,
236            autoplayTimeout,
237            loops
238        }),**/
239    });
240
241    $('.play-hero-slider').on('click',function(){
242        heroCarousel.trigger('next.owl.carousel', [300]);
243
244        heroCarousel.trigger('play.owl.autoplay',[5000]);
245        //$('.play-hero-slider').addClass("disabled");
246        //$('.stop-hero-slider').removeClass("disabled");
247
248        $('.play-hero-slider').hide();
249        $('.stop-hero-slider').show();
250
251        $('.play-hero-slider').attr('aria-pressed', 'true');
252        $('.stop-hero-slider').attr('aria-pressed', 'false');
253
254    });
255
256    $('.stop-hero-slider').on('click',function(){
257        heroCarousel.trigger('stop.owl.autoplay');
258        //$('.play-hero-slider').removeClass("disabled");
259        //$('.stop-hero-slider').addClass("disabled");
260
261        $('.stop-hero-slider').hide();
262        $('.play-hero-slider').show();
263
264
265        $('.play-hero-slider').attr('aria-pressed', 'false');
266        $('.stop-hero-slider').attr('aria-pressed', 'true');
267
268    });
269
270    $('.prev-hero-slider').on('click',function(){
271        heroCarousel.trigger('prev.owl.carousel', [300]);
272    });
273
274    $('.next-hero-slider').on('click',function(){
275        heroCarousel.trigger('next.owl.carousel', [300]);
276    });
277
278    $(this).find('.owl-next').each(function(index) {
279        //Add arial-lable to to owl-next
280        $(this).attr('aria-label',"Next");
281        $(this).removeAttr('role');
282    });
283
284    $(this).find('.owl-prev').each(function(index) {
285        //Add arial-lable to to owl-prev
286        $(this).attr('aria-label',"Previous");
287        $(this).removeAttr('role');
288    });
289
290    $('.hero-carousel').each(function() {
291        var countSlider = $(".owl-dot").length;
292
293        //Find each set of dots in this carousel
294        $(this).find('.owl-dot').each(function(index) {
295            //Add one to index so it starts from 1
296            $(this).attr('aria-label', 'slide ' + (index + 1));
297        });
298
299        if (countSlider == 1) {
300            $('.slider-dots-container').hide();
301            $('.slider-control').hide();
302
303        }
304    });
305
306
307    // start additonal content College Overview
308    $(".college-overview-owl-carousel").each(function() {
309
310        var ac_row_id = $(this).attr("data-row-id");
311
312        var ac_carousel_class = '.college-overview-owl-carousel.' + ac_row_id;
313
314        var ac_carousel = $(ac_carousel_class);
315
316        let ac_carousel_items_count = Number($('.college-overview-owl-carousel').attr("data-items"));
317        //let ac_carousel_autoplay_timeout = 5000;
318        //let ac_carousel_loops = 20;
319        ac_carousel.owlCarousel({
320            items: 1,
321            loop: true,
322            nav: true,
323            dots: true,
324            navText: [
325                '<i class="fa-light fa-chevron-left carousel-owl-prev-nav"></i><span class="offscreen">Previous</span>',
326                '<i class="fa-light fa-chevron-right carousel-owl-next-nav"></i><span class="offscreen">Next</span>'
327            ],
328            dotsContainer: '.college-overview-slider-dots-container.dots-' + ac_row_id,
329            autoplay: false,
330            autoplayHoverPause: true,
331            //autoplayTimeout:ac_carousel_autoplay_timeout,
332            /**onInitialized : collegeOverviewOwlSliderStopTimer ( ac_carousel, {
333                ac_carousel_items_count,
334                ac_carousel_autoplay_timeout,
335                ac_carousel_loops
336            }),
337            **/
338        });
339
340        /****
341        // Clone dots into slide
342        var dots = jQuery( '.college-overview-slider-dots-container.dots-' + ac_row_id);
343
344        //console.log(dots.clone());
345        jQuery(ac_carousel_class + ' .owl-slide-subtitle').after(dots.clone().addClass('owl-dot-clone'));
346
347        dots.hide(); // hide orginal dots
348
349        // Set active
350        ac_carousel.on('changed.owl.carousel', function (event) {
351            var index = event.page.index;
352
353            jQuery(ac_carousel_class + ' .owl-dot-clone .owl-dot', this).removeClass('active');
354            jQuery(ac_carousel_class + ' .owl-dot-clone', this).each(function () {
355                jQuery(ac_carousel_class + ' .owl-dot', this).eq(index).addClass('active');
356            })
357        });
358
359        // Create on click event for clone
360        jQuery(ac_carousel_class + ' .owl-dot-clone .owl-dot').on('click', function () {
361            var owl = jQuery(this).closest('.custom1');
362            owl.trigger('to.owl.carousel', [jQuery(this).index(), 300]);
363        });
364        // end clone dots into slide
365        ***/
366
367        $('.college-overview-owl-carousel' ).each(function() {
368            var ac_row_id = $(this).attr("data-row-id");
369            var carousel_class = '.college-overview-owl-carousel.' + ac_row_id;
370            //var countSlider = $(carousel_class + " .owl-item.active .owl-dot").length;
371            var countSlider = $('.dots-' + ac_row_id + " .owl-dot").length;
372
373            //Find each set of dots in this carousel
374            //$(carousel_class).find('.owl-item.active .owl-dot').each(function(index) {
375                $('.dots-' + ac_row_id ).find('.owl-dot').each(function(index) {
376                //Add one to index so it starts from 1
377                $(this).attr('aria-label', 'College overview Slide ' + (index + 1));
378            });
379
380
381            if (countSlider <= 1) {
382                $(' .dots-' + ac_row_id ).hide();
383                $(carousel_class + ' .slider-control').hide();
384                $(carousel_class + ' .owl-dot-clone').hide();
385            }
386        });
387
388    });
389
390    function owlSliderStopTimer(selector, params) {
391
392        setTimeout(
393            function() {
394                selector.trigger('stop.owl.autoplay');
395                //$('.play-hero-slider').removeClass("disabled");
396                //$('.stop-hero-slider').addClass("disabled");
397
398                $('.play-hero-slider').show();
399                $('.stop-hero-slider').hide();
400
401                $('.play-hero-slider').attr('aria-pressed', 'false');
402                $('.stop-hero-slider').attr('aria-pressed', 'true');
403
404
405                //$('.play-hero-slider').css('display', 'inline-block');
406                //$('.stop-hero-slider').css('display', 'none');
407            },
408            (params.itemsCount * Number(params.autoplayTimeout) * params.loops)
409        );
410    }
411
412    function collegeOverviewOwlSliderStopTimer(selector, params) {
413
414        setTimeout(
415            function() {
416                selector.trigger('play.owl.autoplay');
417                $('.play-college-overview-slider').addClass("disabled");
418                $('.stop-college-overview-slider').removeClass("disabled");
419
420                $('.play-college-overview-slider').attr('aria-pressed', 'false');
421                $('.stop-college-overview-slider').attr('aria-pressed', 'true');
422
423            },
424            (params.itemsCount * Number(params.autoplayTimeout) * params.loops)
425        );
426    }
427
428    // Navigation accessibility
429    var menuItems = document.querySelectorAll('#menu-main-nav li.dropdown');
430    Array.prototype.forEach.call(menuItems, function (el, i) {
431        var activatingA = el.querySelector('a');
432        var customClass = $(activatingA).attr('id');
433
434        var btn = '<button class="btn-'+customClass+' submenu-button"><span><span class="visuallyhidden">show submenu for ' + activatingA.text + '</span></span></button>';
435        activatingA.insertAdjacentHTML('afterend', btn);
436
437        el.querySelector('button').addEventListener("click", function (event) {
438            var thisElement = (this.className);
439
440            //console.log( $(this).parents().hasClass('active'));
441
442            var parent_active = false;
443            if ( $(this).parents().hasClass('active') ) {
444                parent_active = true;
445            }
446
447
448            //console.log($('.'+thisElement).next().next());
449            //if (this.parentNode.className == "dropdown") {
450
451            var findclassname = "dropdown open";
452
453            if(this.parentNode.className.indexOf('dropdown') != -1 &&
454                this.parentNode.className.indexOf('open') != -1) {
455
456                this.parentNode.className = "dropdown";
457                this.parentNode.querySelector('a').setAttribute('aria-expanded', "true");
458                this.parentNode.querySelector('button').setAttribute('aria-expanded', "true");
459                //this.parentNode.querySelector('ul').setAttribute('class', "dropdown-menu open");
460                this.parentNode.querySelector('ul').setAttribute('aria-expanded', "true");
461                //$('.dropdown ul.dropdown-menu').hide();
462                $('.' + thisElement).next().next().hide();
463
464            } else if (this.parentNode.className.indexOf('dropdown') != -1) {
465                this.parentNode.className = "dropdown  open";
466                this.parentNode.querySelector('a').setAttribute('aria-expanded', "true");
467                this.parentNode.querySelector('button').setAttribute('aria-expanded', "true");
468                //this.parentNode.querySelector('ul').setAttribute('class', "dropdown-menu open");
469                this.parentNode.querySelector('ul').setAttribute('aria-expanded', "true");
470                //$('.dropdown ul.dropdown-menu').show();
471                $('.' + thisElement).next().next().show();
472
473            } else {
474                this.parentNode.className = "dropdown";
475                this.parentNode.querySelector('a').setAttribute('aria-expanded', "false");
476                this.parentNode.querySelector('button').setAttribute('aria-expanded', "false");
477                //this.parentNode.querySelector('ul').setAttribute('class', "dropdown-menu");
478                this.parentNode.querySelector('ul').setAttribute('aria-expanded', "false");
479                //$('.dropdown ul.dropdown-menu').hide();
480                $('.' + thisElement).next().next().hide();
481
482            }
483
484            if (parent_active == true) {
485                $(this).parent().addClass('active');
486            }
487            event.preventDefault();
488        });
489    });
490
491    $(document).on('click', '.submenu-button', function () {
492    //$('.submenu-button').click(function() {
493
494        if ( $(this).hasClass("nav-arrow-active") ) {
495            $(this).removeClass('nav-arrow-active');
496            $(this).siblings('.sub-menu').hide();
497
498        } else {
499            $('.submenu-button').removeClass('nav-arrow-active');
500            $('.sub-menu').hide();
501
502            $(this).addClass('nav-arrow-active');
503            $(this).siblings('.sub-menu').show();
504        }
505    });
506
507
508    var singleMenuItems = document.querySelectorAll('#menu-main-nav li');
509    Array.prototype.forEach.call(singleMenuItems, function (el, i) {
510
511        el.querySelector('a').addEventListener("focus", function (event) {
512
513            //if (this.parentNode.className == "dropdown") {
514            if (this.className.indexOf('dropdown-toggle') == -1 &&
515                this.className.indexOf('dropdown-item') == -1) {
516                $('.dropdown ul.dropdown-menu').hide();
517
518                var listItems = $("#menu-main-nav li");
519                listItems.each(function (i) {
520                    //console.log(idx);
521                    var classname = $(this).attr('class');
522                    var attributeId = $(this).attr('id');
523                    if (classname.indexOf('open') != -1 ) {
524
525                        $('#'+attributeId).removeClass("open");
526                    }
527
528                });
529            }
530
531            event.preventDefault();
532        });
533    });
534
535    var searchMenu = document.querySelectorAll('.header__navbar div.header__menu-global-search-desktop');
536    Array.prototype.forEach.call(searchMenu, function (el, i) {
537        //console.log(el);
538        el.querySelector('button').addEventListener("focus", function (event) {
539
540            $('.dropdown ul.dropdown-menu').hide();
541
542            var listItems = $("#menu-main-nav li");
543            listItems.each(function (i) {
544                //console.log(idx);
545                var classname = $(this).attr('class');
546                var attributeId = $(this).attr('id');
547                if (classname.indexOf('open') != -1) {
548
549                    $('#' + attributeId).removeClass("open");
550                }
551
552            });
553
554            event.preventDefault();
555        });
556    });
557
558    /***
559    // reduced header size (height on scroll)
560    $(document).on("scroll", function(){
561
562        if ($(document).scrollTop() > 80){
563            $(".header__navbar .header-contact .contact-item").addClass("shrink");
564            $(".header__logo.desktop").addClass("shrink");
565        } else {
566            $(".header__navbar .header-contact .contact-item").removeClass("shrink");
567            $(".header__logo.desktop").removeClass("shrink");
568        }
569
570    });***/
571});
572
573$(window).on('load', function(){
574    // Remove Table inline style attribute
575    $('th,tr,td').css('font-family','');
576});
577
578$(".event-select-widget").on('change', function(){
579    var param_value = $(this).val();
580    var param_name = $(this).prop('name');
581    var page_url = $(this).data('page-url');
582    window.location.href = page_url + '?' + param_name + '=' + param_value;
583});
584
585$(".news-select-widget").on('change', function(){
586    var param_value = $(this).val();
587    var param_name = $(this).prop('name');
588    var page_url = $(this).data('page-url');
589    window.location.href = page_url + '?' + param_name + '=' + param_value;
590});
591
592$(".future-event-select-widget").on('change', function(){
593    var param_value = $(this).val();
594    var param_name = $(this).prop('name');
595    var page_url = $(this).data('page-url');
596    window.location.href = page_url + '?' + param_name + '=' + param_value;
597});
598
599$(".events-by-month-select-widget").on('change', function(){
600    var param_value = $(this).val();
601    var param_name = $(this).prop('name');
602    var page_url = $(this).data('page-url');
603    window.location.href = page_url + '?' + param_name + '=' + param_value;
604});
605
606$(".news-by-month-select-widget").on('change', function(){
607    var param_value = $(this).val();
608    var param_name = $(this).prop('name');
609    var page_url = $(this).data('page-url');
610    window.location.href = page_url + '?' + param_name + '=' + param_value;
611});
612
613$(".blog-select-widget").on('change', function(){
614    var param_value = $(this).val();
615    var param_name = $(this).prop('name');
616    var page_url = $(this).data('page-url');
617    console.log(page_url + '?' + param_name + '=' + param_value);
618    window.location.href = page_url + '?' + param_name + '=' + param_value;
619});
620
621/***** Entry Requirements */
622$(".entry-requirements-select").on('change', function(e){
623    e.preventDefault();
624    var component_id = $(this).data('entry-req-id');
625    var option_value = $(this).val();
626
627    $(".entry-requirements-content-item-"+component_id).hide();
628    $("."+component_id+'-'+option_value).show();
629
630});
631/***** End Entry Requirements */
632
633/*** Staff Team ***/
634$(".staff-more").on('click', function(e) {
635
636    var expanded = $(this).text().trim();
637    var btn_id = $(this).attr('more-btn-id');
638    var group_id = $(this).attr('staff-team-group-id');
639
640    if (expanded == 'Show More...') {
641        $('.staff-team-group-' + group_id + ' .staff-more').text('Show More...');
642        $('.' + btn_id).text('Show Less');
643
644    } else {
645        $('.' + btn_id).text('Show More...');
646    }
647
648});
649/*** End Staff Team ***/
650
651/*** Bootstrap Mega Menu ***/
652document.addEventListener("DOMContentLoaded", function(){
653    /////// Prevent closing from click inside dropdown
654    document.querySelectorAll('.dropdown-menu').forEach(function(element){
655        element.addEventListener('click', function (e) {
656            e.stopPropagation();
657        });
658    })
659});
660/*** End Bootstrap Mega Menu ***/
661
662jQuery('.accordion  .card a').on('click', function() {
663
664    // Reference https://wordpress.org/support/topic/header-column-width/
665    var table_wrap = $(this).parent().siblings().find('.supsystic-tables-wrap');
666
667    table_wrap.each(function() {
668        //var fields = table_wrap.attr('id').split('-');
669        var fields = $(this).attr('id').split('-');
670
671        var table_id_fields = fields[2].split('_');
672
673        var table_id = table_id_fields[0];
674
675        window.supsystic.Tables.getTableInstanceById(table_id).fnAdjustColumnSizing();
676    });
677
678
679});
680
681/***
682 el.querySelector('button').addEventListener("click", function (event) {*/

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.