1// Check for jQuery. 2if (typeof jQuery === 'undefined') { 3 // Check if require is a defined function. 4 if (typeof require === 'function') { 5 jQuery = $ = require('jquery'); 6 // Else use the dollar sign alias. 7 } else { 8 jQuery = $; 9 } 10} 11//animate.css extended 12$.fn.extend({ 13 animatecss: function(animationName, callback) { 14 var animationEnd = (function(el) { 15 var animations = { 16 animation: 'animationend', 17 OAnimation: 'oAnimationEnd', 18 MozAnimation: 'mozAnimationEnd', 19 WebkitAnimation: 'webkitAnimationEnd', 20 }; 21 22 for (var t in animations) { 23 if (el.style[t] !== undefined) { 24 return animations[t]; 25 } 26 } 27 })(document.createElement('div')); 28 29 this.addClass('animated ' + animationName).one(animationEnd, function() { 30 $(this).removeClass('animated ' + animationName); 31 32 if (typeof callback === 'function') callback(); 33 }); 34 35 return this; 36 }, 37}); 38 39/* 40$('#yourElement').animatecss('bounce'); 41or; 42$('#yourElement').animatecss('bounce', function() { 43 // Do somthing after animation 44}); 45*/ 46 47 48// sidenav 49$.fn.sidenav = function(options){ 50 var sn = this; 51 52 var settings = $.extend({ 53 // These are the defaults. 54 type: 'overlay', // overlay | overlay-no-animation | push | push-opacity | fullscreen 55 eventType:'click', 56 minwidth:'0', 57 maxwidth:'250px', 58 opacity: '0.4' 59 }, options ); 60 61 switch(settings.type) 62 { 63 case 'overlay': 64 $('[toggle-sidenav]').on(settings.eventType,function(){ 65 if($(sn).width() > 0){ 66 // if open then close 67 $(sn).css('width',settings.minwidth); 68 } 69 else { 70 // if close then open 71 $(sn).css('width',settings.maxwidth); 72 } 73 }) 74 break; 75 case 'overlay-no-animation': 76 $('[toggle-sidenav]').on(settings.eventType,function(){ 77 if($(sn).width() > 0){ 78 // if open then close 79 $(sn).hide(); 80 $(sn).css('width',settings.minwidth); 81 } 82 else { 83 // if close then open 84 $(sn).css('width',settings.maxwidth); 85 $(sn).show(); 86 } 87 }) 88 break; 89 case 'push': 90 $('[toggle-sidenav]').on(settings.eventType,function(){ 91 if($(sn).width() > 0){ 92 // if open then close 93 $(sn).css('width',settings.minwidth); 94 $('#main').css('margin-left',settings.minwidth); 95 } 96 else { 97 // if close then open 98 $(sn).css('width',settings.maxwidth); 99 $('#main').css('margin-left',settings.maxwidth); 100 } 101 }) 102 break; 103 case 'push-opacity': 104 $('[toggle-sidenav]').on(settings.eventType,function(){ 105 if($(sn).width() > 0){ 106 // if open then close 107 $(sn).css('width',settings.minwidth); 108 $('#main').css('margin-left',settings.minwidth); 109 $('.divoverlay').remove(); 110 } 111 else { 112 // if close then open 113 $(sn).css('width',settings.maxwidth); 114 $('#main').css('margin-left',settings.maxwidth); 115 $('body').append('<div class="divoverlay"></div>'); 116 $('.divoverlay').css('background-color',"rgba(0,0,0,"+ settings.opacity +")"); 117 } 118 }) 119 break; 120 case 'fullscreen': 121 $('[toggle-sidenav]').on(settings.eventType,function(){ 122 if($(sn).width() > 0){ 123 // if open then close 124 $(sn).css('width',settings.minwidth); 125 } 126 else { 127 // if close then open 128 $(sn).css('width','100%'); 129 $(sn).css('text-align','center'); 130 } 131 }) 132 break; 133 default: 134 console.log('Error. wrong type selected in sidenav'); 135 break; 136 } 137 138 // callbacks 139 $( this ).after(function(){ 140 if (typeof callback === 'function') callback(); 141 }) 142 } 143 144 145// MENU NAVBAR 146 147$('.navbar a').click(function(){ 148 $(this).siblings().removeClass('active'); 149 $(this).addClass('active'); 150}) 151 152/* Toggle between adding and removing the "responsive" class to topnav when the user clicks on the icon */ 153$('.menu-icon').on('click',function() { 154 if($('.navbar .nav').is(':visible')) 155 { 156 $('.navbar .nav').removeClass('navhide'); 157 $('.menu-icon i.mdi').removeClass('mdi-close'); 158 $('.menu-icon i.mdi').addClass('mdi-menu'); 159 //$('.navbar .nav').css('display','none'); 160 $( ".navbar .nav" ).animate({ 161 height: "toggle" 162 }, 500, function() { 163 // Animation complete. 164 }); 165 166 } 167 else { 168 $('.menu-icon i.mdi').removeClass('mdi-menu'); 169 $('.menu-icon i.mdi').addClass('mdi-close'); 170 $( ".navbar .nav" ).animate({ 171 height: "toggle" 172 }, 500, function() { 173 // Animation complete. 174 }); 175 } 176}) 177 178 179$('.dropdown-trigger').click(function(){ 180 var dcontent = $(this).attr('data-target'); 181 var winwidth = $('body').width(); 182 var dp = $(this); 183 var dph = dp.outerHeight(); 184 var position = dp.position(); 185 var dcwd = parseInt((winwidth - $('#'+dcontent).outerWidth())); 186 if(parseInt(position.left + $('#'+dcontent).outerWidth()) >= winwidth){ 187 var leftp = dcwd; 188 } else { 189 var leftp = position.left; 190 } 191// console.log('fullwidth = '+winwidth + '\n leftposition = '+position.left+'\n dcontentwidth = '+$('#'+dcontent).width() +'\n dcwd='+dcwd); 192 var topp = parseInt(position.top + dph); 193 $('#'+dcontent).css('left',leftp); 194 $('#'+dcontent).css('top',topp); 195 $('#'+dcontent).slideToggle(300); 196 197 // hide on mouse move 198 $(this).focusout(function() { 199 $('#'+dcontent).hide(300); 200 }); 201 202}) 203 204 205$('.dropdown').click(function(){ 206 var dcontent = $(this).attr('data-target'); 207 var winwidth = $('body').width(); 208 var winheight = $('body').height(); 209 var dp = $(this); 210 var dph = dp.outerHeight(); 211 var position = dp.position(); 212 var dcwd = parseInt((winwidth - $('#'+dcontent).outerWidth())); 213 var dchg = parseInt((position.top - $('#'+dcontent).outerHeight()) ); 214 var topp = parseInt(position.top + dph); 215 216 // width left 217 if(parseInt(position.left + $('#'+dcontent).outerWidth()) >= winwidth){ 218 var leftp = dcwd; 219 } else { 220 var leftp = position.left; 221 } 222 // height top 223 if(parseInt(position.top + $('#'+dcontent).outerWidth()) >= winheight){ 224 var topp = dchg; 225 } else { 226 var topp = parseInt(position.top + $(this).outerHeight()); 227 } 228// console.log('fullwidth = '+winwidth + '\n leftposition = '+position.left+'\n dcontentwidth = '+$('#'+dcontent).width() +'\n dcwd='+dcwd); 229 $('#'+dcontent).css('left',leftp); 230 $('#'+dcontent).css('top',topp); 231 $('#'+dcontent).addClass('drop-content'); 232 $('#'+dcontent).slideToggle(300); 233 234 // hide on mouse move 235 $(this).focusout(function(){ 236 $('#'+dcontent).hide(300); 237 $('#'+dcontent).removeClass('drop-content'); 238 }); 239 240}) 241 242 243$(document).mouseup(function(e) 244{ 245 var container = $("sidenav"); 246 247 // if the target of the click isn't the container nor a descendant of the container 248 if (!container.is(e.target) && container.has(e.target).length === 0) 249 { 250 container.hide(); 251 } 252}); 253 254// Parallax 255function parallax(){ 256 257 $('.parallax .layer').each(function(index, item){ 258 // console.log(item); 259 $(item).css('background-image',"url('"+$(item).attr('imgsrc')+"')"); 260 }); 261 window.addEventListener('scroll', function(event) { 262 var depth, i, layer, layers, len, movement, topDistance, translate3d; 263 topDistance = this.pageYOffset; 264 layers = document.querySelectorAll(".parallax .layer"); 265 for (i = 0, len = layers.length; i < len; i++) { 266 layer = layers[i]; 267 depth = layer.getAttribute('data-depth'); 268 movement = -(topDistance * depth); 269 translate3d = 'translate3d(0, ' + movement + 'px, 0)'; 270 layer.style['-webkit-transform'] = translate3d; 271 layer.style['-moz-transform'] = translate3d; 272 layer.style['-ms-transform'] = translate3d;
273 layer.style['-o-transform'] = translate3d; 274 layer.style.transform = translate3d; 275 } 276 }); 277} 278 279 280 281 282// SlideShow 283 284/////////////// 285 286// LAZY SCROLL // Thanks to css-tricks.com for this code. 287// Select all links with hashes 288$('a[href*="#"]') 289 // Remove links that don't actually link to anything 290 .not('[href="#"]') 291 .not('[href="#0"]') 292 .click(function(event) { 293 // On-page links 294 if ( 295 location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') 296 && 297 location.hostname == this.hostname 298 ) { 299 // Figure out element to scroll to 300 var target = $(this.hash); 301 target = target.length ? target : $('[name=' + this.hash.slice(1) + ']'); 302 // Does a scroll target exist? 303 if (target.length) { 304 // Only prevent default if animation is actually gonna happen 305 event.preventDefault(); 306 $('html, body').animate({ 307 scrollTop: target.offset().top 308 }, 1000, function() { 309 // Callback after animation 310 // Must change focus! 311 var $target = $(target); 312 $target.focus(); 313 if ($target.is(":focus")) { // Checking if the target was focused 314 return false; 315 } else { 316 $target.attr('tabindex','-1'); // Adding tabindex for elements not focusable 317 $target.focus(); // Set focus again 318 }; 319 }); 320 } 321 } 322 }); 323//////// 324 325 326$(document).ready(function(){ 327 // NAVBAR 328 if (screen.width < 767) { 329 $(".navbar .nav").hide(); 330 } 331 $('.dropdown').click(function(){ 332 return false; 333 }) 334}) 335 336 337 338$(document).ready(function(){ 339 parallax(); 340 $('#loader').fadeOut(); 341})
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.