1/** 2 * Theme frontend scripts 3 * 4 * @package Icelander 5 * @copyright WebMan Design, Oliver Juhas 6 * 7 * @since 1.0.0 8 * @version 1.4.0 9 * 10 * Contents: 11 * 12 * 10) Basics 13 * 20) Content 14 * 30) Custom header 15 * 40) Sticky header 16 */ 17 18( function( $ ) { 19 20 'use strict'; 21 22 23 24 25 26 /** 27 * 10) Basics 28 */ 29 30 var 31 $breakpoints = ( 'undefined' !== typeof $icelanderBreakpoints ) ? ( $icelanderBreakpoints ) : ( { 'xl' : 1280 } ), 32 $introMedia = $( document.getElementById( 'intro-media' ) ), 33 $compactLayoutProjects = $( '.portfolio-style-compact .posts .type-wm_projects' ); 34 35 36 37 /** 38 * Tell CSS that JS is enabled... 39 */ 40 41 $( '.no-js' ) 42 .removeClass( 'no-js' ); 43 44 45 46 /** 47 * Fixing Recent Comments widget multiple appearances 48 */ 49 50 $( '.widget_recent_comments ul' ) 51 .attr( 'id', '' ); 52 53 54 55 /** 56 * Back to top link 57 */ 58 59 if ( parseInt( $breakpoints['xl'] ) < window.innerWidth ) { 60 61 $( '.back-to-top' ) 62 .on( 'click', function( e ) { 63 64 // Processing 65 66 // Scroll the page to top. 67 $( 'html, body' ) 68 .animate( { 69 scrollTop : 0 70 }, 600 ); 71 72 // Reset focus on top of the page. 73 $( 'body' ) 74 .attr( 'tabindex', 0 ) 75 .focus(); 76 77 // Do not alter URL in browser. 78 return false; 79 80 } ); 81 82 } 83 84 85 86 /** 87 * Responsive videos 88 */ 89 90 if ( $().fitVids ) { 91 92 $( document.getElementById( 'page' ) ) 93 .fitVids(); 94 95 } // /fitVids 96 97 98 99 /** 100 * Primary menu fallback 101 */ 102 103 $( '#menu-primary.menu-fallback .menu-item-has-children > a' ) 104 .append( ' <span class="expander" aria-hidden="true"></span>' ); 105 106 107 108 109 110 /** 111 * 20) Content 112 */ 113 114 /** 115 * Comment form improvements 116 * 117 * Set input fields placeholders from field labels. 118 */ 119 120 $( document.getElementById( 'commentform' ) )
121 .find( 'input[type="text"], input[type="email"], input[type="url"], textarea' ) 122 .each( function( index, el ) { 123 124 // Helper variables 125 126 var 127 $this = $( el ); 128 129 130 // Processing 131 132 $this 133 .attr( 'placeholder', $this.prev( 'label' ).text() ) 134 .prev( 'label' ) 135 .addClass( 'screen-reader-text' ); 136 137 } ); 138 139 140 141 /** 142 * Compact projects layout focus 143 */ 144 145 $compactLayoutProjects 146 .on( 'focus.aria mouseenter.aria', 'a', function( e ) { 147 148 // Processing 149 150 $( this ) 151 .closest( '.type-wm_projects' ) 152 .addClass( 'focus' ); 153 154 } ) 155 .on( 'blur.aria mouseleave.aria', 'a', function( e ) { 156 157 // Processing 158 159 $( this ) 160 .closest( '.type-wm_projects' ) 161 .removeClass( 'focus' ); 162 163 } ); 164 165 166 167 168 169 /** 170 * 30) Custom header 171 */ 172 173 if ( $introMedia.length ) { 174 $introMedia 175 .parent( '.intro-special' ) 176 .addClass( 'intro-special-has-media' ); 177 } 178 179 $( document ) 180 .on( 'wp-custom-header-video-loaded', function() { 181 182 // Processing 183 184 $introMedia 185 .addClass( 'has-header-video' ); 186 187 } ); 188 189 190 191 192 193 /** 194 * 40) Sticky header 195 */ 196 197 if ( $().scrollWatch && $( 'body' ).hasClass( 'has-sticky-header' ) ) { 198 199 $( document.getElementById( 'masthead' ) ) 200 .scrollWatch( { 201 offset : 50, 202 } ); 203 204 } // /scrollWatch 205 206 207 208 209 210} )( 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.