Merge pull request #260 from bungeshea/fix-js-errors

_s: Fix JSHint errors.
This commit is contained in:
Konstantin Obenland 2013-07-15 18:09:12 -07:00
commit 2c23f460ab
3 changed files with 11 additions and 11 deletions

View File

@ -19,7 +19,7 @@
// Header text color. // Header text color.
wp.customize( 'header_textcolor', function( value ) { wp.customize( 'header_textcolor', function( value ) {
value.bind( function( to ) { value.bind( function( to ) {
if ( 'blank' == to ) { if ( 'blank' === to ) {
$( '.site-title, .site-description' ).css( { $( '.site-title, .site-description' ).css( {
'clip': 'rect(1px, 1px, 1px, 1px)', 'clip': 'rect(1px, 1px, 1px, 1px)',
'position': 'absolute' 'position': 'absolute'
@ -33,4 +33,4 @@
} }
} ); } );
} ); } );
} )( jQuery ); } )( jQuery );

View File

@ -1,14 +1,14 @@
jQuery( document ).ready( function( $ ) { jQuery( document ).ready( function( $ ) {
$( document ).keydown( function( e ) { $( document ).keydown( function( e ) {
var url = false; var url = false;
if ( e.which == 37 ) { // Left arrow key code if ( e.which === 37 ) { // Left arrow key code
url = $( '.previous-image a' ).attr( 'href' ); url = $( '.previous-image a' ).attr( 'href' );
} }
else if ( e.which == 39 ) { // Right arrow key code else if ( e.which === 39 ) { // Right arrow key code
url = $( '.entry-attachment a' ).attr( 'href' ); url = $( '.entry-attachment a' ).attr( 'href' );
} }
if ( url && ( !$( 'textarea, input' ).is( ':focus' ) ) ) { if ( url && ( !$( 'textarea, input' ).is( ':focus' ) ) ) {
window.location = url; window.location = url;
} }
} ); } );
} ); } );

View File

@ -6,29 +6,29 @@
( function() { ( function() {
var container, button, menu; var container, button, menu;
container = document.getElementById( 'site-navigation' ) container = document.getElementById( 'site-navigation' );
if ( ! container ) if ( ! container )
return; return;
button = container.getElementsByTagName( 'h1' )[0]; button = container.getElementsByTagName( 'h1' )[0];
if ( 'undefined' == typeof button ) if ( 'undefined' === typeof button )
return; return;
menu = container.getElementsByTagName( 'ul' )[0]; menu = container.getElementsByTagName( 'ul' )[0];
// Hide menu toggle button if menu is empty and return early. // Hide menu toggle button if menu is empty and return early.
if ( 'undefined' == typeof menu ) { if ( 'undefined' === typeof menu ) {
button.style.display = 'none'; button.style.display = 'none';
return; return;
} }
if ( -1 == menu.className.indexOf( 'nav-menu' ) ) if ( -1 === menu.className.indexOf( 'nav-menu' ) )
menu.className += ' nav-menu'; menu.className += ' nav-menu';
button.onclick = function() { button.onclick = function() {
if ( -1 != container.className.indexOf( 'toggled' ) ) if ( -1 !== container.className.indexOf( 'toggled' ) )
container.className = container.className.replace( ' toggled', '' ); container.className = container.className.replace( ' toggled', '' );
else else
container.className += ' toggled'; container.className += ' toggled';
}; };
} )(); } )();