PageSourceSearch

https://www.samrc.ac.za/themes/gavias_winnex/js/main.js?v=v=8f7c41ad

js samrc.ac.za collected 2026-10-02 02:21:04 UTC 13,786 bytes, 410 lines download raw bytes

1(function ($) {
2  "use strict";
3    
4    var $event = $.event,
5    $special, resizeTimeout;
6    $special = $event.special.debouncedresize = {
7      setup: function () {
8        $(this).on("resize", $special.handler);
9      },
10      teardown: function () {
11        $(this).off("resize", $special.handler);
12      },
13      handler: function (event, execAsap) {
14        var context = this,
15          args = arguments,
16          dispatch = function () {
17            event.type = "debouncedresize";
18            $event.dispatch.apply(context, args);
19          };
20
21          if (resizeTimeout) {
22            clearTimeout(resizeTimeout);
23          }
24
25        execAsap ? dispatch() : resizeTimeout = setTimeout(dispatch, $special.threshold);
26      },
27    threshold: 150
28  };
29
30  //------- OWL carousle init  ---------------
31  jQuery(document).ready(function(){
32    function init_carousel_owl(){
33      $('.init-carousel-owl').each(function(){
34        var items = $(this).data('items') ? $(this).data('items') : 5;
35        var items_lg = $(this).data('items_lg') ? $(this).data('items_lg') : 4;
36        var items_md = $(this).data('items_md') ? $(this).data('items_md') : 3;
37        var items_sm = $(this).data('items_sm') ? $(this).data('items_sm') : 2;
38        var items_xs = $(this).data('items_xs') ? $(this).data('items_xs') : 1;
39        var loop = $(this).data('loop') ? $(this).data('loop') : false;
40        var speed = $(this).data('speed') ? $(this).data('speed') : 200;
41        var auto_play = $(this).data('auto_play') ? $(this).data('auto_play') : false;
42        var auto_play_speed = $(this).data('auto_play_speed') ? $(this).data('auto_play_speed') : false;
43        var auto_play_timeout = $(this).data('auto_play_timeout') ? $(this).data('auto_play_timeout') : 1000;
44        var auto_play_hover = $(this).data('auto_play_hover') ? $(this).data('auto_play_hover') : true;
45        var navigation = $(this).data('navigation') ? $(this).data('navigation') : false;
46        var rewind_nav = $(this).data('rewind_nav') ? $(this).data('rewind_nav') : true;
47        var pagination = $(this).data('pagination') ? $(this).data('pagination') : false;
48        var mouse_drag = $(this).data('mouse_drag') ? $(this).data('mouse_drag') : false;
49        var touch_drag = $(this).data('touch_drag') ? $(this).data('touch_drag') : false;
50        var fade = $(this).data('fade') ? $(this).data('fade') : false;
51        $(this).owlCarousel({
52            nav: navigation,
53            autoplay: auto_play,
54            autoplayTimeout: auto_play_timeout,
55            autoplaySpeed: auto_play_speed,
56            autoplayHoverPause: auto_play_hover,
57            navText: [ '<i class="gv-icon-164"></i>', '<i class="gv-icon-165"></i>' ],
58            autoHeight: false,
59            loop: loop, 
60            dots: pagination,
61            rewind: rewind_nav,
62            smartSpeed: speed,
63            mouseDrag: mouse_drag,
64            touchDrag: touch_drag,
65            responsive : {
66                0 : {
67                  items: 1,
68                  nav: false
69                },
70                600 : {
71                  items : items_xs,
72                  nav: false
73                },
74                768 : {
75                  items : items_sm,
76                  nav: false
77                },
78                992: {
79                  items : items_md
80                },
81                1200: {
82                  items: items_lg
83                },
84                1400: {
85                  items: items
86                }
87            }
88        });
89        $(this).on('translated.owl.carousel', function (event) { 
90          toggleArrows($(this));
91        }); 
92     }); 
93    }  
94
95    function toggleArrows(elm){ 
96      elm.find(".owl-item").removeClass('active-effect');
97      elm.find(".owl-item.active").addClass('active-effect');
98    }
99    init_carousel_owl();
100
101    $(document).scroll(function() {
102      var scroll = $(this).scrollTop();
103      $('.init-carousel-owl').each(function(){
104        var top = $(this).offset().top;
105        if (scroll >= top - 300) {
106          $(this).find(".owl-item.active").addClass('active-effect');
107        }
108      });
109    });
110
111    //===== Gallery ============
112    $("a[data-rel^='prettyPhoto[g_gal]']").prettyPhoto({
113        animation_speed:'normal',
114        social_tools: false,
115    });
116
117    //===== Popup video ============
118    $('.popup-video').magnificPopup({
119      type: 'iframe',
120      fixedContentPos: false
121    });
122
123    $('.gallery-popup').each(function(){
124      $(this).magnificPopup({
125        delegate: 'a.image-popup', 
126        type: 'image',
127        gallery: {
128          enabled: true
129        },
130      });
131    });
132
133  });
134
135  //===== AOS ============
136  var wow = new WOW({
137    boxClass:     'wow',     
138    animateClass: 'animated', 
139    offset:       0,          
140    mobile:       false,      
141    live:         false,      
142  });
143  wow.init();
144
145  $(document).ready(function () {
146    if ($(window).width() > 780) {
147      if ( $.fn.jpreLoader ) {
148        var $preloader = $( '.js-preloader' );
149        $preloader.jpreLoader({
150          autoClose: true,
151        }, function() {
152          $preloader.addClass( 'preloader-done' );
153          $( 'body' ).trigger( 'preloader-done' );
154          $( window ).trigger( 'resize' );
155        });
156      }
157    }else{
158      $('body').removeClass('js-preloader');
159    };
160
161    var $container = $('.post-masonry-style');
162    $container.imagesLoaded( function(){
163      $container.masonry({
164        itemSelector : '.item-masory',
165        gutterWidth: 0,
166        columnWidth: 1,
167      }); 
168    });
169
170    $('.gva-search-region .icon').on('click',function(e){
171      if($(this).parent().hasClass('show')){
172        $(this).parent().removeClass('show');
173      }else{
174        $(this).parent().addClass('show');
175      }
176      e.stopPropagation();
177    })
178
179    /*======Offcavas===============*/
180    $('#menu-bar').on('click',function(e){
181      if($('.gva-offcanvas-mobile').hasClass('show-view')){
182        $(this).removeClass('show-view');
183        $('.gva-offcanvas-mobile').removeClass('show-view');
184      }else{
185        $(this).addClass('show-view');
186        $('.gva-offcanvas-mobile').addClass('show-view'); 
187      }
188      e.stopPropagation();
189    })
190    $('.close-offcanvas').on('click', function(e){
191      $('.gva-offcanvas-mobile').removeClass('show-view');
192      $('#menu-bar').removeClass('show-view');
193    });
194
195    /*========== Click Show Sub Menu ==========*/
196    $('.gva-navigation a').on('click','.nav-plus',function(){
197      if($(this).hasClass('nav-minus') == false){
198        $(this).parent('a').parent('li').find('> ul').slideDown();
199        $(this).addClass('nav-minus');
200      }else{
201        $(this).parent('a').parent('li').find('> ul').slideUp();
202        $(this).removeClass('nav-minus');
203      }
204      return false;
205    });
206
207    /* ============ Isotope ==============*/
208    if ( $.fn.isotope ) {
209      $( '.isotope-items' ).each(function() {
210        var _pid = $(this).data('pid');
211        var $el = $( this ),
212            $filter = $( '.portfolio-filter a.' + _pid ),
213            $loop =  $( this );
214
215        $loop.isotope();
216
217        $loop.imagesLoaded(function() {
218          $loop.isotope( 'layout' );
219        });
220
221        if ( $filter.length > 0 ) {
222
223          $filter.on( 'click', function( e ) {
224            e.preventDefault();
225            var $a = $(this);
226            $filter.removeClass( 'active' );
227            $a.addClass( 'active' );
228            $loop.isotope({ filter: $a.data( 'filter' ) });
229          });
230        };
231      });
232    };
233
234    //==== Customize =====
235    $('.gavias-skins-panel .control-panel').click(function(){
236        if($(this).parents('.gavias-skins-panel').hasClass('active')){
237            $(this).parents('.gavias-skins-panel').removeClass('active');
238        }else $(this).parents('.gavias-skins-panel').addClass('active');
239    });
240
241    $('.gavias-skins-panel .layout').click(function(){
242        $('body').removeClass('wide-layout').removeClass('boxed');
243        $('body').addClass($(this).data('layout'));
244        $('.gavias-skins-panel .layout').removeClass('active');
245        $(this).addClass('active');
246        var $container = $('.post-masonry-style');
247        $container.imagesLoaded( function(){
248            $container.masonry({
249                itemSelector : '.item-masory',
250                gutterWidth: 0,
251                columnWidth: 1,
252            }); 
253        });
254    });
255
256    /*-------------Milestone Counter----------*/
257    jQuery('.milestone-block').each(function() {
258      jQuery(this).appear(function() {
259        var $endNum = parseInt(jQuery(this).find('.milestone-number').text());
260        jQuery(this).find('.milestone-number').countTo({
261          from: 0,
262          to: $endNum,
263          speed: 4000,
264          refreshInterval: 60,
265          formatter: function (value, options) {
266            value = value.toFixed(options.decimals);
267            value = value.replace(/\B(?=(\d{3})+(?!\d))/g, ',');
268            return value;
269          }
270        });
271      },{accX: 0, accY: 0});
272    });
273
274    /*----------- Animation Progress Bars --------------------*/
275    $("[data-progress-animation]").each(function() {
276      var $this = $(this);
277      $this.appear(function() {
278        var delay = ($this.attr("data-appear-animation-delay") ? $this.attr("data-appear-animation-delay") : 1);
279        if(delay > 1) $this.css("animation-delay", delay + "ms");
280        setTimeout(function() { $this.animate({width: $this.attr("data-progress-animation")}, 800);}, delay);
281      }, {accX: 0, accY: -50});
282    });
283  
284    /*------------Pie Charts---------------------------*/
285    var pieChartClass = 'pieChart',
286      pieChartLoadedClass = 'pie-chart-loaded';
287    
288    function initPieCharts() {
289      var chart = $('.' + pieChartClass);
290      chart.each(function() {
291        $(this).appear(function() {
292          var $this = $(this),
293            chartBarColor = ($this.data('bar-color')) ? $this.data('bar-color') : "#93CB40",
294            chartBarWidth = ($this.data('bar-width')) ? ($this.data('bar-width')) : 150
295          if( !$this.hasClass(pieChartLoadedClass) ) {
296            $this.easyPieChart({
297              animate: 2000,
298              size: chartBarWidth,
299              lineWidth: 5,
300              scaleColor: false,
301              trackColor: "#DCDEE0",
302              barColor: chartBarColor,
303              lineCap: 'square',
304            }).addClass(pieChartLoadedClass);
305          }
306        });
307      });
308    }
309    initPieCharts();
310
311    // ====== mb_YTPlayer video background ==============================
312    if (!jQuery.browser.mobile){
313      $(".youtube-bg").mb_YTPlayer();
314    }
315
316    // ======Fixed top Menu Bar==========================================
317    if($('.gv-sticky-menu').length > 0){
318      $('.gv-sticky-menu').each(function(){
319        var sticky = new Waypoint.Sticky({
320          element: $(this)[0]
321        });
322      })
323    }
324
325    if($('#header > .topbar').length > 0){
326      $('#header > .topbar').each(function(){
327        var sticky2 = new Waypoint.Sticky({
328          element: $(this)[0]
329        });
330      })
331    }
332
333    //===== Gallery ============
334    $(".lightGallery").lightGallery({
335      selector: '.image-item .zoomGallery'
336    });
337
338    // ======Text Typer=================================================
339    $("[data-typer-targets]", ".rotate-text").typer();
340  });
341
342
343  var animationDimensions = function() {
344    var gavias_height = $(window).height();
345    $('.bb-container.full-screen').each(function(){
346      $(this).css('height', gavias_height);
347    });
348  }
349
350  $(document).ready(function(){
351    if($('.full-screen').length > 0){
352      animationDimensions();
353    }
354  })
355
356  $(window).load(function(){
357    $('#gva-preloader').remove();
358    if($('.full-screen').length > 0){
359      animationDimensions();
360    }
361  });
362
363  $(window).on("debouncedresize", function(event) {
364    if($('.full-screen').length > 0){
365     setTimeout(function() {
366        animationDimensions();
367      }, 50);
368    }
369  });
370
371  $(document).ready(function(){
372  
373    $('.gsc-map .link-close-content a').on('click', function(e){
374      e.preventDefault();
375      $(this).parents('.content-inner').addClass('close-content');
376    })
377    $('.gsc-map .link-open-content').on('click', function(e){
378      e.preventDefault();
379      $(this).parents('.gsc-map').find('.content-inner').removeClass('close-content');
380    })
381
382    $( '.cbp-qtrotator' ).each(function(){
383      $(this).cbpQTRotator();
384    })
385
386  });
387
388  $(window).load(function(){
389    if($('.block-gavias-sliderlayer, .before-help-region, .block-gavias-slider').length > 0){
390      var html_help = $('.gav-help-region').html();
391      $('.gav-help-region').remove();
392      html_help = '<div class="help gav-help-region">' + html_help + '</div>';
393      if($('.before-help-region').length > 0){
394        $('.before-help-region').first().append(html_help);
395      }else if($('.block-gavias-sliderlayer').length > 0){
396        $('.block-gavias-sliderlayer').first().after(html_help);
397      }else if($('.block-gavias-slider').length > 0){
398        $('.block-gavias-slider').first().after(html_help);
399      }
400      $('.gav-help-region').show();
401    }else{
402      var html_help = $('.gav-help-region').html();
403      $('.gav-help-region').remove();
404      html_help = '<div class="help gav-help-region">' + html_help + '</div>';
405      $('#page-main-content').first().before(html_help);
406      $('.gav-help-region').show();
407    }
408  });
409
410})(jQuery);

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.