1( function( $ ) { 2 'use strict'; 3 4 var isRtl = $( 'body' ).hasClass( 'rtl' ); 5 6 // Set up mobile menu toggle button. 7 ( function() { 8 var $menu = $( '#site-navigation' ); 9 var $menuLink = $( 'a.mobile-menu-toggle' ); 10 var $menuButton = $( '<button />', { 'class': 'mobile-menu-toggle', 'aria-expanded': false } ).append( $menuLink.children() ); 11 var $searchBar = $( '.site-header-search-bar' ); 12 13 $menuLink.replaceWith( $menuButton ); 14 15 $menuButton.on( 'click.nur', function() { 16 $menu.toggleClass( 'is-toggled' ); 17 $searchBar.toggleClass( 'is-toggled' ); 18 $( this ).toggleClass( 'is-toggled' ).attr( 'aria-expanded', $menu.hasClass( 'is-toggled' ) ); 19 } ); 20 } () ); 21 22 // Set up mobile menu submenu toggle buttons. 23 ( function() { 24 var $container = $( '#site-navigation' ); 25 var $toggleButton = $( '<button />', { 'class': 'sub-menu-toggle', 'aria-expanded': false } ) 26 .append( $( '<span />', { 'class': 'sub-menu-toggle-icon' } ) ) 27 .append( $( '<span />', { 'class': 'screen-reader-text', 'text': nurScreenReaderText.expand } ) ); 28 29 $container.find( '.menu-item-has-children > a, .page_item_has_children > a' ) 30 .filter( function() { 31 return $( this ).closest( '.children, .sub-menu' ).length == 0; 32 } ) 33 .after( $toggleButton ); 34 35 $container.find( '.current-menu-ancestor > .sub-menu-toggle' ) 36 .addClass( 'is-toggled' ) 37 .attr( 'aria-expanded', 'true' ) 38 .find( '.screen-reader-text' ) 39 .text( nurScreenReaderText.collapse ); 40 $container.find( '.current-menu-ancestor > .children, .current-menu-ancestor > .sub-menu' ) 41 .filter( function() { 42 return $( this ).parent().closest( '.children, .sub-menu' ).length == 0; 43 } ) 44 .addClass( 'is-toggled' ); 45 46 $container.on( 'click.nur', '.sub-menu-toggle', function( event ) { 47 var $this = $( this ); 48 49 event.preventDefault(); 50 $this.toggleClass( 'is-toggled' ); 51 $this.next( '.children, .sub-menu' ).toggleClass( 'is-toggled' ); 52 $this.attr( 'aria-expanded', $this.hasClass( 'is-toggled' ) ); 53 $this.find( '.screen-reader-text' ) 54 .text( $this.hasClass( 'is-toggled' ) ? nurScreenReaderText.collapse : nurScreenReaderText.expand ); 55 } ); 56 } () ); 57 58 // Fix for secondary navigation submenu toggling on touch devices. 59 ( function() { 60 $( '.top-bar' ).on( 'click.nur', '.secondary-navigation .menu-item-has-children > a, .secondary-navigation .page_item_has_children > a', function( event ) { 61 event.preventDefault(); 62 } ); 63 } () ); 64 65 // Add has-focus class to menu items parents 66 $( '.primary-navigation, .secondary-navigation' ).on( 'focus.nur blur.nur', 'a', function( event ) { 67 if ( event.type === 'focusin' ) { 68 $( this ).parents().addClass( 'has-focus' ); 69 } else { 70 $( this ).parents().removeClass( 'has-focus' ); 71 } 72 } ); 73 74 // Smooth scroll to top 75 $( 'a[href="#top"]' ).on( 'click.nur', function() { 76 $( 'html, body' ).animate( { scrollTop: 0 }, 1000 ); 77 return false; 78 } ); 79 80 // Make videos fit their container 81 // Check if exists 82 if(typeof fitvids === 'function'){ 83 fitvids(); 84 }else if (typeof fitVids === 'function'){ 85 fitVids(); 86 } 87 88 function countDecimalPlaces( num ) { 89 var match = ( '' + num ).match( /\.(\d+)$/ ); 90 return ( match && match[1] ) ? match[1].length : 0; 91 } 92 93 // Counter Box animation 94 if ( $( '.counter-box' ).length ) { 95 // Prepare animations 96 $( '.counter-box .counter-box-number' ).each( function() { 97 var $this = $( this ); 98 var numberParts = $this.text().match( /^(\D*)(\d+(?:\.\d+)?)(.*)$/ ); 99 var number, decimals, duration, numberAnim; 100 101 if ( ! numberParts ) { 102 return; 103 } 104 105 number = Number( numberParts[2] ); 106 decimals = countDecimalPlaces( numberParts[2] ); 107 duration = 0.5 + Math.random(); 108 numberAnim = new CountUp( this, 0, number < 3000 ? number : number * 0.98, decimals, duration, { 109 prefix: numberParts[1], 110 suffix: numberParts[3], 111 } ); 112 113 $this.text( '0' ); 114 $this.data( 'number', number ); 115 $this.data( 'number-animation', numberAnim ); 116 $this.addClass( 'js-count-up' ); 117 } ); 118 119 // Trigger the animation when Counter Box enters the viewport 120 $( '.counter-box' ).waypoint( { 121 offset: '95%', 122 handler: function() { 123 $( this.element || this ).find( '.js-count-up' ).each( function() { 124 var $this = $( this ); 125 var number = $this.data( 'number' ); 126 var numberAnim = $this.data( 'number-animation' ); 127 128 $this.removeClass( 'js-count-up' ); 129 $this.removeData( [ 'number', 'number-animation' ] ); 130 131 if ( numberAnim ) { 132 numberAnim.start( function() { 133 numberAnim.update( number ); 134 } ); 135 } 136 } ); 137 }, 138 } ); 139 } 140 141} ( 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.