1(function ($) { 2 // Functions 3 var lastScrollTop = 0; 4 var windowloaded = false; 5 var initLastScrollTop = function () { 6 var st = $(window).scrollTop(); 7 lastScrollTop = st; 8 }; 9 var isScrollDown = function () { 10 var st = $(window).scrollTop(); 11 return (st > lastScrollTop); 12 }; 13 var initMobileMenu = function () { 14 if (!$('.astroid-mobile-menu').length) { 15 return; 16 } 17 $('.astroid-mobile-menu').astroidMobileMenu(); 18 $('#astroid-offcanvas').find('ul.menu').astroidMobileMenu(); 19 $('.astroid-mobile-menu').removeClass('d-none'); 20 $('.astroid-sidebar-menu .nav-item-caret').click(function () { 21 $(this).parent('li').siblings('li').children('ul').slideUp(); 22 $(this).parent('li').siblings('li').children('.nav-item-caret').removeClass('open'); 23 $(this).toggleClass('open'); 24 $(this).siblings('ul').slideToggle(); 25 }); 26 $('.astroid-sidebar-collapsable').click(function () { 27 $('#astroid-header').toggleClass('expanded'); 28 }); 29 }; 30 var initDisplay = function () { 31 setTimeout(function () { 32 $('.d-init').removeClass('d-none'); 33 }, 100); 34 }; 35 var initBackToTop = function () { 36 $(window).scroll(function () { 37 if ($(this).scrollTop() >= 200) { // If page is scrolled more than 200px 38 $('#astroid-backtotop').fadeIn(200); // Fade in the arrow 39 } else { 40 $('#astroid-backtotop').fadeOut(200); // Else fade out the arrow 41 } 42 }); 43 $('#astroid-backtotop').click(function () { // When arrow is clicked 44 $('body,html').animate({ 45 scrollTop: 0 // Scroll to top of body 46 }, 500); 47 }); 48 }; 49 50 var initHeader = function () { 51 var stickyHeader = $('#astroid-sticky-header'); 52 53 var _header = $('header'); 54 if (!_header.length) { 55 return false; 56 } 57 58 var _headerTop = _header.offset().top; 59 var _headerHeight = _header.height(); 60 var _headerBottom = _headerTop + _headerHeight; 61 62 if (!stickyHeader.length) { 63 return; 64 } 65 66 var _winScroll = $(window).scrollTop(); 67 68 var _breakpoint = deviceBreakpoint(true); 69 70 if (_breakpoint == 'xl' || _breakpoint == 'lg') { 71 if (stickyHeader.hasClass('header-sticky-desktop') && (_winScroll > _headerBottom)) { 72 stickyHeader.removeClass('d-none'); 73 stickyHeader.addClass('d-flex'); 74 } else if (stickyHeader.hasClass('header-stickyonscroll-desktop') && (_winScroll > _headerBottom) && !isScrollDown()) { 75 stickyHeader.removeClass('d-none'); 76 stickyHeader.addClass('d-flex'); 77 } else { 78 stickyHeader.removeClass('d-flex'); 79 stickyHeader.addClass('d-none'); 80 } 81 } else if (_breakpoint == 'sm' || _breakpoint == 'md') { 82 if (stickyHeader.hasClass('header-static-tablet')) { 83 return; 84 } 85 if (stickyHeader.hasClass('header-sticky-tablet') && (_winScroll > _headerBottom)) { 86 stickyHeader.removeClass('d-none'); 87 stickyHeader.addClass('d-flex'); 88 } else if (stickyHeader.hasClass('header-stickyonscroll-tablet') && (_winScroll > _headerBottom) && !isScrollDown()) { 89 stickyHeader.addClass('d-flex'); 90 stickyHeader.removeClass('d-none'); 91 } else { 92 stickyHeader.addClass('d-none'); 93 stickyHeader.removeClass('d-flex'); 94 } 95 } else { 96 if (stickyHeader.hasClass('header-static-mobile')) { 97 return; 98 } 99 if (stickyHeader.hasClass('header-sticky-mobile') && (_winScroll > _headerBottom)) { 100 stickyHeader.addClass('d-flex'); 101 stickyHeader.removeClass('d-none'); 102 } else if (stickyHeader.hasClass('header-stickyonscroll-mobile') && (_winScroll > _headerBottom) && !isScrollDown()) { 103 stickyHeader.addClass('d-flex'); 104 stickyHeader.removeClass('d-none'); 105 } else { 106 stickyHeader.addClass('d-none'); 107 stickyHeader.removeClass('d-flex'); 108 } 109 } 110 }; 111 112 var initEmptyHeaderContent = function () { 113 $('.header-left-section:empty').each(function () { 114 if (!$.trim($(this).html())) { 115 $(this).prop('hidden', true); 116 } 117 }); 118 119 $('.header-center-section:empty').each(function () { 120 if (!$.trim($(this).html())) { 121 $(this).prop('hidden', true); 122 } 123 }); 124 125 $('.header-right-section:empty').each(function () { 126 if (!$.trim($(this).html())) { 127 $(this).prop('hidden', true); 128 } 129 }); 130 }; 131 132 var initTooltip = function () { 133 if ($('[data-toggle="tooltip"]').length) { 134 $('[data-toggle="tooltip"]').tooltip(); 135 } 136 }; 137 138 var initAnimations = function () { 139 var bindAnimation = function () { 140 $('[data-animation]').each(function () { 141 var _animation = $(this).data('animation');
142 var _delay = $(this).data('animation-delay'); 143 var _duration = $(this).data('animation-duration'); 144 if (_animation != '' && elementInViewport($(this)) && !$(this).hasClass('animation-done')) { 145 if (_delay != '' && _delay != 0 && _delay != '0' && _delay != undefined) { 146 _delay = parseInt(_delay); 147 } else { 148 _delay = 0; 149 } 150 151 if (_duration != '' && _duration != 0 && _duration != '0' && _duration != undefined) { 152 _duration = parseInt(_duration) + 10; 153 } else { 154 _duration = 1010; 155 } 156 157 var _this = this; 158 $(_this).css('animation-duration', _duration + 'ms'); 159 setTimeout(function () { 160 $(_this).css('visibility', 'visible'); 161 $(_this).addClass('animated'); 162 $(_this).addClass(_animation); 163 $(_this).addClass('animation-done'); 164 setTimeout(function () { 165 $(_this).removeClass('animated'); 166 $(_this).removeClass(_animation); 167 }, (_duration + _delay)); 168 }, _delay); 169 } 170 }); 171 }; 172 173 $(window).on("scroll", function () { 174 bindAnimation(); 175 }); 176 bindAnimation(); 177 }; 178 179 var initProgressBar = function () { 180 $('.progress-bar-viewport-animation').each(function () { 181 var _this = $(this); 182 if (!_this.hasClass('viewport-animation-done') && elementInViewport(_this)) { 183 var _width = _this.data('value'); 184 _width = parseInt(_width); 185 _this.css('width', _width + '%'); 186 } 187 }); 188 } 189 190 var elementInViewport = function (element) { 191 var _this = element; 192 var _this_top = _this.offset().top; 193 return (_this_top <= window.pageYOffset + parseInt(window.innerHeight)) && (_this_top >= window.pageYOffset); 194 }; 195 196 var deviceBreakpoint = function (_return) { 197 if ($('.astroid-breakpoints').length == 0) { 198 var _breakpoints = '<div class="astroid-breakpoints d-none"><div class="d-block d-sm-none device-xs"></div><div class="d-none d-sm-block d-md-none device-sm"></div><div class="d-none d-md-block d-lg-none device-md"></div><div class="d-none d-lg-block d-xl-none device-lg"></div><div class="d-none d-xl-block device-xl"></div></div>'; 199 $('body').append(_breakpoints); 200 } 201 var _sizes = ['xs', 'sm', 'md', 'lg', 'xl']; 202 var _device = 'undefined';
203 _sizes.forEach(function (_size) { 204 var _visiblity = $('.astroid-breakpoints .device-' + _size).css('display'); 205 if (_visiblity == 'block') { 206 _device = _size; 207 return false; 208 } 209 }); 210 if (_return) { 211 return _device; 212 } else { 213 $('body').removeClass('astroid-device-xs').removeClass('astroid-device-sm').removeClass('astroid-device-md').removeClass('astroid-device-lg').removeClass('astroid-device-xl'); 214 $('body').addClass('astroid-device-' + _device); 215 } 216 }; 217 218 var initPreloader = function () { 219 $("#astroid-preloader").removeClass('d-flex').addClass('d-none'); 220 }; 221 222 // Events 223 var docReady = function () { 224 initDisplay(); 225 initMobileMenu(); 226 //initMegamenu(); 227 //initSubmenu(); 228 initBackToTop(); 229 initHeader(); 230 initEmptyHeaderContent(); 231 initTooltip(); 232 deviceBreakpoint(false); 233 }; 234 235 var winLoad = function () { 236 initAnimations(); 237 deviceBreakpoint(false); 238 initPreloader(); 239 initProgressBar(); 240 windowloaded = true; 241 }; 242 243 var winResize = function () { 244 deviceBreakpoint(false); 245 initHeader(); 246 }; 247 248 var winScroll = function () { 249 initHeader(); 250 initLastScrollTop(); 251 if (windowloaded) { 252 initProgressBar(); 253 } 254 deviceBreakpoint(false); 255 }; 256 257 $(docReady); 258 $(window).on('load', winLoad); 259 $(window).on('resize', winResize); 260 $(window).on('scroll', winScroll); 261 window.addEventListener("orientationchange", winResize); 262})($ast); 263 264/* 265 * Add missing Mootools when Bootstrap is loaded 266 * This fix creates dummy implementations for the missing Mootools functions. 267 * It requires that you have jQuery loaded and if you are dealing with Mootools + jQuery is a good idea to add the call just before this javascript code. 268 * This issue shouldn't affect Bootstrap 3 templates but the fix explained here should be compatible with both. 269 */ 270(function ($) { 271 $(document).ready(function () { 272 var bootstrapLoaded = (typeof $().tooltip == 'function'); 273 var mootoolsLoaded = (typeof MooTools != 'undefined'); 274 if (bootstrapLoaded && mootoolsLoaded) { 275 Element.implement({ 276 hide: function () { 277 return this; 278 }, 279 show: function (v) { 280 return this; 281 }, 282 slide: function (v) { 283 return this; 284 } 285 }); 286 } 287 }); 288})($ast);
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.