From 12acfa4e81f47fff7f359a2bf8308c68c6ac0eaf Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Fri, 15 Nov 2013 05:12:09 +0000 Subject: [PATCH] Fix JSHint errors in 3 files. props atimmer. fixes #25990, #25993, #26008. Built from https://develop.svn.wordpress.org/trunk@26199 git-svn-id: http://core.svn.wordpress.org/trunk@26107 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/js/password-strength-meter.js | 7 ++++--- wp-admin/js/password-strength-meter.min.js | 2 +- wp-admin/js/plugin-install.js | 4 +++- wp-admin/js/set-post-thumbnail.js | 7 +++++-- 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/wp-admin/js/password-strength-meter.js b/wp-admin/js/password-strength-meter.js index 9ddee476bd..a075c269f8 100644 --- a/wp-admin/js/password-strength-meter.js +++ b/wp-admin/js/password-strength-meter.js @@ -1,3 +1,4 @@ +/* global zxcvbn */ window.wp = window.wp || {}; var passwordStrength; @@ -40,7 +41,7 @@ var passwordStrength; for ( i = 0; i < userInputFieldsLength; i++ ) { currentField = $( '#' + userInputFields[ i ] ); - if ( 0 == currentField.length ) { + if ( 0 === currentField.length ) { continue; } @@ -58,7 +59,7 @@ var passwordStrength; // Remove empty values, short words, and duplicates. Short words are likely to cause many false positives. blacklist = $.grep( blacklist, function( value, key ) { - if ( '' == value || 4 > value.length ) { + if ( '' === value || 4 > value.length ) { return false; } @@ -67,7 +68,7 @@ var passwordStrength; return blacklist; } - } + }; // Backwards compatibility. passwordStrength = wp.passwordStrength.meter; diff --git a/wp-admin/js/password-strength-meter.min.js b/wp-admin/js/password-strength-meter.min.js index 49496701da..da7ac001d3 100644 --- a/wp-admin/js/password-strength-meter.min.js +++ b/wp-admin/js/password-strength-meter.min.js @@ -1 +1 @@ -window.wp=window.wp||{};var passwordStrength;!function(a){wp.passwordStrength={meter:function(b,c,d){if(a.isArray(c)||(c=[c.toString()]),b!=d&&d&&d.length>0)return 5;var e=zxcvbn(b,c);return e.score},userInputBlacklist:function(){var b,c,d,e,f=[],g=[],h=["user_login","first_name","last_name","nickname","display_name","email","url","description","weblog_title","admin_email"];for(f.push(document.title),f.push(document.URL),c=h.length,b=0;c>b;b++)e=a("#"+h[b]),0!=e.length&&(f.push(e[0].defaultValue),f.push(e.val()));for(d=f.length,b=0;d>b;b++)f[b]&&(g=g.concat(f[b].replace(/\W/g," ").split(" ")));return g=a.grep(g,function(b,c){return""==b||4>b.length?!1:a.inArray(b,g)===c})}},passwordStrength=wp.passwordStrength.meter}(jQuery); \ No newline at end of file +window.wp=window.wp||{};var passwordStrength;!function(a){wp.passwordStrength={meter:function(b,c,d){if(a.isArray(c)||(c=[c.toString()]),b!=d&&d&&d.length>0)return 5;var e=zxcvbn(b,c);return e.score},userInputBlacklist:function(){var b,c,d,e,f=[],g=[],h=["user_login","first_name","last_name","nickname","display_name","email","url","description","weblog_title","admin_email"];for(f.push(document.title),f.push(document.URL),c=h.length,b=0;c>b;b++)e=a("#"+h[b]),0!==e.length&&(f.push(e[0].defaultValue),f.push(e.val()));for(d=f.length,b=0;d>b;b++)f[b]&&(g=g.concat(f[b].replace(/\W/g," ").split(" ")));return g=a.grep(g,function(b,c){return""===b||4>b.length?!1:a.inArray(b,g)===c})}},passwordStrength=wp.passwordStrength.meter}(jQuery); \ No newline at end of file diff --git a/wp-admin/js/plugin-install.js b/wp-admin/js/plugin-install.js index a8d44673d9..0a3167a2d0 100644 --- a/wp-admin/js/plugin-install.js +++ b/wp-admin/js/plugin-install.js @@ -1,3 +1,5 @@ +/* global plugininstallL10n, tb_click, confirm */ + /* Plugin Browser Thickbox related JS*/ var tb_position; jQuery(document).ready(function($) { @@ -13,7 +15,7 @@ jQuery(document).ready(function($) { tbWindow.css({'margin-left': '-' + parseInt((( W - 50 ) / 2),10) + 'px'}); if ( typeof document.body.style.maxWidth != 'undefined' ) tbWindow.css({'top': 20 + adminbar_height + 'px','margin-top':'0'}); - }; + } return $('a.thickbox').each( function() { var href = $(this).attr('href'); diff --git a/wp-admin/js/set-post-thumbnail.js b/wp-admin/js/set-post-thumbnail.js index e6ac87542c..68abbcc830 100644 --- a/wp-admin/js/set-post-thumbnail.js +++ b/wp-admin/js/set-post-thumbnail.js @@ -1,9 +1,12 @@ -function WPSetAsThumbnail(id, nonce){ +/* global setPostThumbnailL10n, ajaxurl, post_id, alert */ +/* exported WPSetAsThumbnail */ + +function WPSetAsThumbnail( id, nonce ) { var $link = jQuery('a#wp-post-thumbnail-' + id); $link.text( setPostThumbnailL10n.saving ); jQuery.post(ajaxurl, { - action:"set-post-thumbnail", post_id: post_id, thumbnail_id: id, _ajax_nonce: nonce, cookie: encodeURIComponent(document.cookie) + action: 'set-post-thumbnail', post_id: post_id, thumbnail_id: id, _ajax_nonce: nonce, cookie: encodeURIComponent( document.cookie ) }, function(str){ var win = window.dialogArguments || opener || parent || top; $link.text( setPostThumbnailL10n.setThumbnail );