1jQuery.noConflict(); 2jQuery(document).ready(function($){ 3 "use strict"; 4 5 /** 6 * Keyboard navigation links 7 */ 8 if( $("ul.wdt-primary-nav").length ) { 9 var $children = $("ul.wdt-primary-nav").find(".menu-item-has-children a"); 10 var $sub_menu = $("ul.wdt-primary-nav").find(".sub-menu a"); 11 var $a = $("ul.wdt-primary-nav > li > a"); 12 13 $( $a ).focus(function() { 14 $(this).parent("li").addClass('focus'); 15 }).blur(function(){ 16 $(this).parent("li").removeClass('focus'); 17 }); 18 19 $( $children ).focus(function(){ 20 $(this).parents(".menu-item-has-children").addClass('focus'); 21 }).blur(function(){ 22 $(this).parents(".menu-item-has-children").removeClass('focus'); 23 }); 24 25 $( $sub_menu ).focus(function(){ 26 $(this).parent("li").addClass('focus'); 27 }).blur(function(){ 28 $(this).parent("li").removeClass('focus'); 29 }); 30 } 31 32 jQuery(document).on('keydown', function( event ) { 33 34 if(!jQuery('body').hasClass('nav-is-visible')) { 35 return; 36 } 37 38 var tabKey = event.keyCode === 9; 39 var shiftKey = event.shiftKey; 40 var escKey = event.keyCode === 27; 41 42 if(escKey) { 43 jQuery('.mobile-menu-overlay').trigger('click'); 44 } 45 46 var activeItem = jQuery(':focus'); 47 if(activeItem.parent().hasClass('menu-item')) { 48 49 if( shiftKey && tabKey ) { 50 51 var activeMenuItem = activeItem.parent('.menu-item'); 52 if(activeMenuItem.prev().hasClass('menu-item-has-children')) { 53 event.preventDefault(); 54 activeMenuItem.prev().find('a:first').focus(); 55 } 56 57 } else if( !shiftKey && tabKey ) { 58 59 var activeMenuItem = activeItem.parent('.menu-item'); 60 if(activeMenuItem.next().hasClass('menu-item-has-children')) { 61 event.preventDefault(); 62 activeMenuItem.next().find('a:first').focus(); 63 } else if(activeMenuItem.hasClass('menu-item-has-children')) { 64 event.preventDefault(); 65 activeMenuItem.next().find('a:first').focus(); 66 } else if(activeMenuItem.attr('class') == jQuery('.mobile-menu .menu-item:last').attr('class')) { 67 event.preventDefault(); 68 jQuery('.mobile-menu').find('.close-nav:first a').focus(); 69 } else if(activeMenuItem.attr('class') == activeMenuItem.parent('.sub-menu').find('.menu-item:last').attr('class')) { 70 event.preventDefault(); 71 activeMenuItem.parent('.sub-menu').find('.close-nav:first a').focus(); 72 } 73 74 } 75 76 } else { 77 78 if( shiftKey && tabKey ) { 79 80 if(activeItem.parent('li').hasClass('close-nav')){ 81 event.preventDefault(); 82 if(activeItem.closest('.sub-menu').length){ 83 activeItem.closest('.sub-menu').find('.menu-item:last a').focus(); 84 } else { 85 jQuery('.mobile-menu .menu-item-depth-0:last a').focus(); 86 } 87 } 88 89 } 90 91 } 92 93 }); 94 95 /** 96 * Desktop Menu Animation 97 */ 98 99 $('.animate-menu-item').parents('.menu-item').find('a') 100 .mouseenter(function() { 101 var animation_class = $(this).parents('.menu-item').find('.animate-menu-item').attr('data-animation'); 102 $(this).parents('.menu-item').find('.animate-menu-item').addClass(animation_class); 103 }) 104 .mouseleave(function() { 105 var animation_class = $(this).parents('.menu-item').find('.animate-menu-item').attr('data-animation'); 106 $(this).parents('.menu-item').find('.animate-menu-item').removeClass(animation_class); 107 }); 108 109 /** 110 * Mobile Menu 111 */ 112 113 var clicked = "false"; 114 $('.menu-trigger').on('click', function( event ){ 115 event.preventDefault(); 116 117 if (clicked == "false") { 118 $('html, body').css('overflow', 'hidden'); 119 clicked = "true"; 120 121 var menuItem = $(this).parents('.wdt-header-menu').find('.wdt-primary-nav:not(.wdt-secondary-nav)').clone(); 122 123 // Remove animation Class 124 $('[data-animation]', menuItem ).each(function(ix, ele ){ 125 $(ele).removeClass('animate-menu-item'); 126 }); 127 128 $('<div class="mobile-menu" />').appendTo( $("body") ); 129 menuItem.appendTo('.mobile-menu'); 130 $('<div class="mobile-menu-overlay"></div>').appendTo( $("body") ); 131 132 $('.mobile-menu').toggleClass('nav-is-visible'); 133 $('.mobile-menu-overlay').toggleClass('is-visible'); 134 $('body').toggleClass('nav-is-visible'); 135 136 $('.mobile-menu').find('.close-nav:first a').focus(); 137 138 // Initializing mobile nav 139 initializeMobileNav(); 140 } else { 141 closeMobNav(); 142 } 143 144 }); 145 146 // Closing Mobile Nav 147 function closeMobNav() { 148 149 var scrollPos = $(window).scrollTop(); 150 151 $('html, body').css('overflow', 'auto'); 152 clicked = "false"; 153 154 $('.mobile-menu, .mobile-menu-overlay').removeClass('is-visible'); 155 $('body').removeClass('nav-is-visible'); 156 157 $('.mobile-menu').remove(); 158 $('.mobile-menu-overlay').remove(); 159 160 $('.menu-trigger').focus(); 161 $(window).scrollTop(scrollPos); 162 } 163 164 // Initialize mobile nav 165 function initializeMobileNav() { 166 167 $('li.close-nav').on('click', function(event) { 168 closeMobNav(); 169 }); 170 171 $('.mobile-menu-overlay').on('click', function(event) { 172 closeMobNav(); 173 }); 174 175 // Sub Menu in Mobile Menu 176 $('.menu-item-has-children > a, .page_item_has_children > a').on('click', function(event) { 177 if ( $('body').hasClass('nav-is-visible') ) { 178 event.preventDefault(); 179 var a = $(this).clone(); 180 $(this).next('.sub-menu').find('.see-all').html(a); 181 } 182 183 var selected = $(this); 184 if( selected.next('ul').hasClass('is-hidden') ) { 185 selected.next('ul.sub-menu').removeClass('is-hidden'); 186 } else { 187 selected.next('ul.sub-menu').addClass('is-hidden'); 188 } 189 }); 190 191 $('.menu-item-has-children > a, .page_item_has_children > a').on('click', function(event) { 192 193 var selected = $(this);
194 selected.next('.sub-menu:not(.is-hidden)').find('a:first').focus(); 195 196 }); 197 198 // Go Back in Mobile Menu 199 $('.go-back').on('click', function(event) { 200 $(this).parent('ul:not(.menu)').addClass('is-hidden'); 201 event.preventDefault(); 202 $(this).parents('.menu-item').find('a:first').focus(); 203 }); 204 205 } 206 207 // For Video Post 208 if( $("div.wdt-video-wrap").length ) { 209 $("div.wdt-video-wrap").fitVids(); 210 } 211 212 // Smart Resize 213 $(window).on("resize", function() { 214 // Blog Isotope 215 if( $(".apply-isotope").length ) { 216 $(".apply-isotope").isotope({itemSelector : '.column',transformsEnabled:false,masonry: { columnWidth: '.grid-sizer' } }); 217 } 218 }); 219 220 if( $('.single .entry-thumb.single-preview-img a.mag-pop, a.lightbox-preview-img').length ) { 221 $('.single .entry-thumb.single-preview-img a.mag-pop, a.lightbox-preview-img').magnificPopup({ 222 type: 'image', 223 closeOnContentClick: false, 224 closeBtnInside: false, 225 mainClass: 'mfp-with-zoom mfp-img-mobile', 226 image: { 227 verticalFit: true, 228 titleSrc: function(item) { 229 return item.el.attr('title') + ' · <a class="image-source-link" href="'+item.el.attr('href')+'" target="_blank">image source</a>'; 230 } 231 }, 232 zoom: { 233 enabled: true, 234 duration: 300, // don't foget to change the duration also in CSS 235 opener: function(element) { 236 return element.find('img'); 237 } 238 } 239 }); 240 } 241 242 $("select").each(function() { 243 $(this).select2(); 244 }); 245 246}); 247 248(function ($) { 249 $(window).on('load', function() { 250 251 // Gallery Post Slider 252 if( ($("ul.entry-gallery-post-slider").length) && ( $("ul.entry-gallery-post-slider li").length > 1 ) ){ 253 $("ul.entry-gallery-post-slider").bxSlider({mode: 'fade', auto:false, video:true, pager:'', autoHover:true, adaptiveHeight:false, responsive: true }); 254 } 255 256 // Blog Isotope 257 if( $(".apply-isotope").length ) { 258 $(".apply-isotope").isotope({itemSelector : '.column',transformsEnabled:false,masonry: { columnWidth: '.grid-sizer' } }); 259 } 260 261 // Blog Equal Height 262 if( $('.tpl-blog-holder.apply-equal-height').length ) { 263 $(".tpl-blog-holder.apply-equal-height article").matchHeight({ property:"min-height" }); 264 } 265 }); 266})(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.