1( function( $ ) { 2 3 'use strict'; 4 5 function removeNoJsClass() { 6 $( 'html:first' ).removeClass( 'no-js' ); 7 } 8 9 /* Superfish Menu ---------------------*/ 10 function superfishSetup() { 11 12 $('.menu').superfish({ 13 delay: 200, 14 animation: {opacity:'show', height:'show'}, 15 speed: 'fast', 16 cssArrows: true, 17 autoArrows: true, 18 dropShadows: false 19 }); 20 21 // Fix Superfish menu if off screen. 22 var wapoMainWindowWidth = $(window).width(); 23 24 $('ul.menu li').mouseover(function() { 25 26 // Checks if second level menu exist. 27 var subMenuExist = $(this).find('.sub-menu').length; 28 if ( subMenuExist > 0 ) { 29 var subMenuWidth = $(this).find('.sub-menu').width(); 30 var subMenuOffset = $(this).find('.sub-menu').parent().offset().left + subMenuWidth; 31 32 // If sub menu is off screen, give new position. 33 if ( (subMenuOffset + subMenuWidth) > wapoMainWindowWidth ) { 34 var newSubMenuPosition = subMenuWidth + 3; 35 $(this).find('.sub-menu').css({ 36 right: 0, 37 }); 38 } 39 } 40 }); 41 42 $('ul.menu li li').mouseover(function() { 43 44 // Checks if third level menu exist. 45 var subMenuExist = $(this).find('.sub-menu').length; 46 if ( subMenuExist > 0 ) { 47 var subMenuWidth = $(this).find('.sub-menu').width(); 48 var subMenuOffset = $(this).find('.sub-menu').parent().offset().left + subMenuWidth; 49 50 // If sub menu is off screen, give new position. 51 if ( (subMenuOffset + subMenuWidth) > wapoMainWindowWidth ) { 52 var newSubMenuPosition = subMenuWidth + 3; 53 $(this).find('.sub-menu').css({ 54 left: -newSubMenuPosition, 55 }); 56 } 57 } 58 }); 59 } 60 61 /* Disable Superfish on mobile ---------------------*/ 62 function superfishMobile() { 63 var sf, body; 64 var breakpoint = 767; 65 body = $('body'); 66 sf = $('ul.menu'); 67 if ( body.width() >= breakpoint ) { 68 // Enable superfish when the page first loads if we're on desktop 69 sf.superfish(); 70 } 71 $(window).resize(function() { 72 if ( body.width() >= breakpoint && !sf.hasClass('sf-js-enabled') ) { 73 // You only want SuperFish to be re-enabled once (sf.hasClass) 74 sf.superfish('init'); 75 } else if ( body.width() < breakpoint ) { 76 // Smaller screen, disable SuperFish 77 sf.superfish('destroy'); 78 } 79 }); 80 } 81 82 function modifyPosts() { 83 84 /* Fit Vids ---------------------*/ 85 $('.feature-vid, .content').fitVids(); 86 87 /* Insert Line Break Before More Links ---------------------*/ 88 $('<br />').insertBefore('.content .more-link'); 89 90 /* Hide Comments When No Comments Activated ---------------------*/ 91 $('.nocomments').parent().css('display', 'none'); 92 93 /* Animate Page Scroll ---------------------*/ 94 $(".scroll").click(function(event){ 95 event.preventDefault(); 96 $('html,body').animate({scrollTop:$(this.hash).offset().top}, 500); 97 }); 98 99 } 100 101 $( document ) 102 .ready( removeNoJsClass ) 103 .ready( superfishSetup ) 104 .ready( superfishMobile ) 105 .ready( modifyPosts ) 106 .on( 'post-load', modifyPosts ); 107 108})( 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.