From 9966625f84c478c83df01e1db6ee49de726901a4 Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Tue, 14 Oct 2014 19:47:11 +0000 Subject: [PATCH] Twenty Fifteen: JSHint fixes. * Define global variables set by wp_localize_script(). * Remove currently unused $ variable. * Use dot notation when appropriate. * Update Gruntfile.js to ignore the html5 shiv. see #29799. git-svn-id: https://develop.svn.wordpress.org/trunk@29893 602fd350-edb4-49c9-b593-d223f7449a82 --- Gruntfile.js | 2 +- .../twentyfifteen/js/color-scheme-control.js | 45 ++++++++++--------- .../themes/twentyfifteen/js/functions.js | 1 + 3 files changed, 25 insertions(+), 23 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index dc802e581d..bca4a5577e 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -218,7 +218,7 @@ module.exports = function(grunt) { 'twenty*/**/*.js', '!twenty{eleven,twelve,thirteen}/**', // Third party scripts - '!twentyfourteen/js/html5.js' + '!twenty{fourteen,fifteen}/js/html5.js' ] }, core: { diff --git a/src/wp-content/themes/twentyfifteen/js/color-scheme-control.js b/src/wp-content/themes/twentyfifteen/js/color-scheme-control.js index 62cfb44f3a..f8a59a6b55 100644 --- a/src/wp-content/themes/twentyfifteen/js/color-scheme-control.js +++ b/src/wp-content/themes/twentyfifteen/js/color-scheme-control.js @@ -1,10 +1,11 @@ +/* global colorScheme */ /** * Theme Customizer enhancements for a better user experience. * * Adds listener to Color Scheme control to update other color controls with new values/defaults */ -( function( wp, $ ) { +( function( wp ) { wp.customize.controlConstructor.colorScheme = wp.customize.Control.extend( { ready: function() { var parentSection = this.container.closest( '.control-section' ), @@ -16,34 +17,34 @@ this.setting.bind( 'change', function( value ) { // if Header Text is not hidden, update value if ( 'blank' !== wp.customize( 'header_textcolor' ).get() ) { - wp.customize( 'header_textcolor' ).set( colorScheme[value]['colors'][4] ); - headerTextColor.val( colorScheme[value]['colors'][4] ) - .data( 'data-default-color', colorScheme[value]['colors'][4] ) - .wpColorPicker( 'color', colorScheme[value]['colors'][4] ) - .wpColorPicker( 'defaultColor', colorScheme[value]['colors'][4] ); + wp.customize( 'header_textcolor' ).set( colorScheme[value].colors[4] ); + headerTextColor.val( colorScheme[value].colors[4] ) + .data( 'data-default-color', colorScheme[value].colors[4] ) + .wpColorPicker( 'color', colorScheme[value].colors[4] ) + .wpColorPicker( 'defaultColor', colorScheme[value].colors[4] ); } // update Background Color - wp.customize( 'background_color' ).set( colorScheme[value]['colors'][0] ); - backgroundColor.val( colorScheme[value]['colors'][0] ) - .data( 'data-default-color', colorScheme[value]['colors'][0] ) - .wpColorPicker( 'color', colorScheme[value]['colors'][0] ) - .wpColorPicker( 'defaultColor', colorScheme[value]['colors'][0] ); + wp.customize( 'background_color' ).set( colorScheme[value].colors[0] ); + backgroundColor.val( colorScheme[value].colors[0] ) + .data( 'data-default-color', colorScheme[value].colors[0] ) + .wpColorPicker( 'color', colorScheme[value].colors[0] ) + .wpColorPicker( 'defaultColor', colorScheme[value].colors[0] ); // update Header/Sidebar Background Color - wp.customize( 'header_background_color' ).set( colorScheme[value]['colors'][1] ); - sidebarColor.val( colorScheme[value]['colors'][1] ) - .data( 'data-default-color', colorScheme[value]['colors'][1] ) - .wpColorPicker( 'color', colorScheme[value]['colors'][1] ) - .wpColorPicker( 'defaultColor', colorScheme[value]['colors'][1] ); + wp.customize( 'header_background_color' ).set( colorScheme[value].colors[1] ); + sidebarColor.val( colorScheme[value].colors[1] ) + .data( 'data-default-color', colorScheme[value].colors[1] ) + .wpColorPicker( 'color', colorScheme[value].colors[1] ) + .wpColorPicker( 'defaultColor', colorScheme[value].colors[1] ); // update Sidebar Text Color - wp.customize( 'sidebar_textcolor' ).set( colorScheme[value]['colors'][4] ); - sidebarTextColor.val( colorScheme[value]['colors'][4] ) - .data( 'data-default-color', colorScheme[value]['colors'][4] ) - .wpColorPicker( 'color', colorScheme[value]['colors'][4] ) - .wpColorPicker( 'defaultColor', colorScheme[value]['colors'][4] ); + wp.customize( 'sidebar_textcolor' ).set( colorScheme[value].colors[4] ); + sidebarTextColor.val( colorScheme[value].colors[4] ) + .data( 'data-default-color', colorScheme[value].colors[4] ) + .wpColorPicker( 'color', colorScheme[value].colors[4] ) + .wpColorPicker( 'defaultColor', colorScheme[value].colors[4] ); } ); } } ); -} )( this.wp, jQuery ); \ No newline at end of file +} )( this.wp ); \ No newline at end of file diff --git a/src/wp-content/themes/twentyfifteen/js/functions.js b/src/wp-content/themes/twentyfifteen/js/functions.js index 97333f4a05..6738430f03 100644 --- a/src/wp-content/themes/twentyfifteen/js/functions.js +++ b/src/wp-content/themes/twentyfifteen/js/functions.js @@ -1,3 +1,4 @@ +/* global screenReaderText */ /** * Theme functions file *