1/** 2 * Theme frontend scripts 3 * 4 * @package Reykjavik 5 * @copyright WebMan Design, Oliver Juhas 6 * 7 * @since 1.0.0 8 * @version 2.0.0 9 * 10 * Contents: 11 * 12 * 10) Basics 13 * 20) Content 14 * 30) Custom header 15 */ 16 17 18 19 20 21( function( $ ) { 22 23 'use strict'; 24 25 26 27 28 29 /** 30 * 10) Basics 31 */ 32 33 var 34 $breakpoints = ( 'undefined' !== typeof $reykjavikBreakpoints ) ? ( $reykjavikBreakpoints ) : ( { 'xl' : 1280 } ), 35 $introMedia = $( document.getElementById( 'intro-media' ) ); 36 37 38 39 /** 40 * Tell CSS that JS is enabled... 41 */ 42 43 $( '.no-js' ) 44 .removeClass( 'no-js' ); 45 46 47 48 /** 49 * Fixing Recent Comments widget multiple appearances 50 */ 51 52 $( '.widget_recent_comments ul' ) 53 .attr( 'id', '' ); 54 55 56 57 /** 58 * Back to top link 59 */ 60 61 if ( parseInt( $breakpoints['xl'] ) < window.innerWidth ) { 62 63 $( '.back-to-top' ) 64 .on( 'click', function( e ) { 65 66 // Processing 67 68 // Scroll the page to top. 69 $( 'html, body' ) 70 .animate( { 71 scrollTop : 0 72 }, 600 ); 73 74 // Reset focus on top of the page. 75 $( 'body' ) 76 .attr( 'tabindex', 0 ) 77 .focus(); 78 79 // Do not alter URL in browser. 80 return false; 81 82 } ); 83 84 } 85 86 87 88 /** 89 * Primary menu fallback 90 */ 91 92 $( '#menu-primary.menu-fallback .menu-item-has-children > a' ) 93 .append( ' <span class="expander" aria-hidden="true"></span>' ); 94 95 96 97 98 99 /** 100 * 20) Content 101 */ 102 103 /** 104 * Comment form improvements 105 * 106 * Set input fields placeholders from field labels. 107 */ 108 109 $( document.getElementById( 'commentform' ) )
110 .find( 'input[type="text"], input[type="email"], input[type="url"], textarea' ) 111 .each( function( index, el ) { 112 113 // Helper variables 114 115 var 116 $this = $( el ); 117 118 119 // Processing 120 121 $this 122 .attr( 'placeholder', $this.prev( 'label' ).text() ) 123 .prev( 'label' ) 124 .addClass( 'screen-reader-text' ); 125 126 } ); 127 128 129 130 131 132 /** 133 * 30) Custom header 134 */ 135 136 if ( $introMedia.length ) { 137 $introMedia 138 .parent( '.intro-special' ) 139 .addClass( 'intro-special-has-media' ); 140 } 141 142 $( document ) 143 .on( 'wp-custom-header-video-loaded', function() { 144 145 // Processing 146 147 $introMedia 148 .addClass( 'has-header-video' ); 149 150 } ); 151 152 153 154 155 156} )( 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.