[MediaWiki-commits] [Gerrit] Pass jshint - change (mediawiki...WikiLove)

2014-09-07 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged.

Change subject: Pass jshint
..


Pass jshint

Bug: 61645
Change-Id: I0278575038308f8cee03096a14253b9987bba727
---
A .jshintrc
M resources/ext.wikiLove.core.js
M resources/ext.wikiLove.defaultOptions.js
M resources/ext.wikiLove.init.js
4 files changed, 103 insertions(+), 79 deletions(-)

Approvals:
  Krinkle: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/.jshintrc b/.jshintrc
new file mode 100644
index 000..2a72340
--- /dev/null
+++ b/.jshintrc
@@ -0,0 +1,26 @@
+{
+   /* Common */
+
+   // Enforcing
+   "camelcase": true,
+   "curly": true,
+   "eqeqeq": true,
+   "immed": true,
+   "latedef": true,
+   "newcap": true,
+   "noarg": true,
+   "noempty": true,
+   "nonew": true,
+   "quotmark": "single",
+   "trailing": true,
+   "undef": true,
+   "unused": true,
+   "multistr": true,
+
+   "jquery": true,
+   "browser": true,
+
+   "predef": [
+   "mediaWiki"
+   ]
+}
diff --git a/resources/ext.wikiLove.core.js b/resources/ext.wikiLove.core.js
index 9b45737..23ab54f 100644
--- a/resources/ext.wikiLove.core.js
+++ b/resources/ext.wikiLove.core.js
@@ -1,5 +1,5 @@
-/*global window:false */
-( function( $ ) {
+/*global alert:false */
+( function ( $, mw ) {
 
 varoptions = {}, // options modifiable by the user
$dialog = null, // dialog jQuery object
@@ -19,9 +19,9 @@
 * Opens the dialog and builds it if necessary.
 * @param array recipients Usernames of recipients (without namespace 
prefix)
 */
-   openDialog: function( recipients ) {
+   openDialog: function ( recipients ) {
// If a list of recipients are specified, this will override 
the normal
-   // behavior of WikiLove, which is to post on the Talk page of 
the 
+   // behavior of WikiLove, which is to post on the Talk page of 
the
// current page. It will also disable redirecting the user 
after submitting.
if ( recipients ) {
if ( recipients.length > maxRecipients ) {
@@ -48,8 +48,8 @@
var $button = $( '' );
 
if ( typeof type.icon === 'string' ) {
-   $button.append( '' );
+   $button.append( '' );
} else {
$button.addClass( 'mw-wikilove-no-icon' 
);
}
@@ -176,7 +176,7 @@
}
 
// When the image changes, we want to reset the preview 
and error message.
-   $( '#mw-wikilove-image' ).change( function() {
+   $( '#mw-wikilove-image' ).change( function () {
$( '#mw-wikilove-dialog' ).find( 
'.mw-wikilove-error' ).remove();
$( '#mw-wikilove-preview' ).hide();
} );
@@ -189,7 +189,7 @@
 * Handler for the left menu. Selects a new type and initialises next 
section
 * depending on whether or not to show subtypes.
 */
-   clickType: function( e ) {
+   clickType: function ( e ) {
e.preventDefault();
$.wikiLove.rememberInputData(); // remember previously entered 
data
$( '#mw-wikilove-get-started' ).hide(); // always hide the get 
started section
@@ -240,7 +240,7 @@
/**
 * Handler for changing the subtype.
 */
-   changeSubtype: function() {
+   changeSubtype: function () {
$.wikiLove.rememberInputData(); // remember previously entered 
data
 
// find out which subtype is selected
@@ -273,7 +273,7 @@
/**
 * Remember data the user entered if it is different from the default.
 */
-   rememberInputData: function() {
+   rememberInputData: function () {
if ( rememberData === null) {
rememberData = {
header : '',
@@ -309,7 +309,7 @@
/**
 * Show a preview of the image for a subtype.
 */
-   showImagePreview: function() {
+   showImagePreview: function () {
$( '#mw-wikilove-image-preview' ).show();
$( '#mw-wikilove-image-preview-content' ).html( '' );
$( '#mw-wikilove-image-preview-spinner' ).fadeIn( 200 );
@@ -323,7 +323,7 @@
'iiurlwidth'  : 75,
'iiurlheight' : 68
} )
-   .done( function( data ) {
+   .done( function ( data ) {
if ( !data || !data.query || !data.query.pages 
) {
$( '#mw-w

[MediaWiki-commits] [Gerrit] Pass jshint - change (mediawiki...WikiLove)

2014-09-05 Thread TheDJ (Code Review)
TheDJ has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/158774

Change subject: Pass jshint
..

Pass jshint

Change-Id: I0278575038308f8cee03096a14253b9987bba727
---
A .jshintrc
M resources/ext.wikiLove.core.js
M resources/ext.wikiLove.defaultOptions.js
M resources/ext.wikiLove.init.js
4 files changed, 47 insertions(+), 22 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikiLove 
refs/changes/74/158774/1

diff --git a/.jshintrc b/.jshintrc
new file mode 100644
index 000..eb031c3
--- /dev/null
+++ b/.jshintrc
@@ -0,0 +1,26 @@
+{
+/* Common */
+
+// Enforcing
+"camelcase": true,
+"curly": true,
+"eqeqeq": true,
+"immed": true,
+"latedef": true,
+"newcap": true,
+"noarg": true,
+"noempty": true,
+"nonew": true,
+"quotmark": "single",
+"trailing": true,
+"undef": true,
+"unused": true,
+"multistr": true,
+
+"jquery": true,
+"browser": true,
+
+"predef": [
+   "mediaWiki"
+]
+}
diff --git a/resources/ext.wikiLove.core.js b/resources/ext.wikiLove.core.js
index 9b45737..e00d972 100644
--- a/resources/ext.wikiLove.core.js
+++ b/resources/ext.wikiLove.core.js
@@ -1,5 +1,5 @@
-/*global window:false */
-( function( $ ) {
+/*global window:false, alert:false */
+( function( $, mw ) {
 
 varoptions = {}, // options modifiable by the user
$dialog = null, // dialog jQuery object
@@ -48,8 +48,8 @@
var $button = $( '' );
 
if ( typeof type.icon === 'string' ) {
-   $button.append( '' );
+   $button.append( '' );
} else {
$button.addClass( 'mw-wikilove-no-icon' 
);
}
@@ -392,8 +392,8 @@
// set the new text for the image textbox
$( '#mw-wikilove-image' ).val( currentRememberData.image || 
currentTypeOrSubtype.image || '' );
 
-   if( typeof currentTypeOrSubtype.gallery === 'object'
-   && $.isArray( currentTypeOrSubtype.gallery.imageList )
+   if( typeof currentTypeOrSubtype.gallery === 'object' &&
+   $.isArray( currentTypeOrSubtype.gallery.imageList )
) {
$( '#mw-wikilove-gallery, #mw-wikilove-gallery-label' 
).show();
$.wikiLove.showGallery(); // build gallery from array 
of images
@@ -500,7 +500,7 @@
 */
submitPreview: function() {
var text = $.wikiLove.prepareMsg( currentTypeOrSubtype.text || 
options.types[currentTypeId].text || options.defaultText );
-   $.wikiLove.doPreview( '==' + $( '#mw-wikilove-header' ).val() + 
"==\n" + text );
+   $.wikiLove.doPreview( '==' + $( '#mw-wikilove-header' ).val() + 
'==\n' + text );
},
 
showAddDetailsError: function( errmsg ) {
@@ -547,7 +547,7 @@
 */
normalizeFilename: function( filename ) {
// If a URL is given, extract and decode the filename
-   var index = filename.lastIndexOf( "/" ) + 1;
+   var index = filename.lastIndexOf( '/' ) + 1;
filename = filename.substr( index );
if ( index > 0 ) {
filename = decodeURI( filename );
@@ -639,8 +639,7 @@
'header': $( '#mw-wikilove-header' ).val(),
'text': $.wikiLove.prepareMsg( 
currentTypeOrSubtype.text || options.types[currentTypeId].text || 
options.defaultText ),
'message': $( '#mw-wikilove-message' ).val(),
-   'type': currentTypeId
-   + (currentSubtypeId !== null ? '-' + 
currentSubtypeId : '')
+   'type': currentTypeId + (currentSubtypeId !== null ? 
'-' + currentSubtypeId : '')
};
if ( $( '#mw-wikilove-notify-checkbox:checked' ).val() && 
emailable ) {
submitData.email = $.wikiLove.prepareMsg( 
currentTypeOrSubtype.email );
@@ -691,7 +690,7 @@
if ( redirect ) {
var targetBaseUrl = 
mw.util.getUrl( data.redirect.pageName ),
// 
currentBaseUrl is the current URL minus the hash fragment
-   currentBaseUrl 
= window.location.href.split("#")[0];
+   currentBaseUrl 
= window.location.href.split('#')[0];
 
// Set window location 
to user talk page URL + WikiLove anchor hash.
// Unfortunately, in 
the most common scenario (starting