jenkins-bot has submitted this change and it was merged.
Change subject: build: Enable jscs rule 'requireVarDeclFirst' and make pass
......................................................................
build: Enable jscs rule 'requireVarDeclFirst' and make pass
Change-Id: I12f39bf4a6bd09a7f480a7b2168954c012a1dfaa
---
M .jscsrc
M resources/mw.FlickrChecker.js
M resources/mw.LanguageUpWiz.js
M resources/mw.UploadWizard.js
M resources/mw.UploadWizardDeed.js
M resources/mw.UploadWizardDescription.js
M resources/mw.UploadWizardDetails.js
M resources/mw.UploadWizardLicenseInput.js
M resources/mw.UploadWizardUpload.js
M resources/mw.UploadWizardUploadInterface.js
M resources/transports/mw.FirefoggTransport.js
M resources/transports/mw.FormDataTransport.js
M resources/ui/uw.ui.Details.js
M resources/ui/uw.ui.Thanks.js
M tests/qunit/mw.UploadWizardDetails.test.js
15 files changed, 141 insertions(+), 95 deletions(-)
Approvals:
Bartosz Dziewoński: Looks good to me, approved
jenkins-bot: Verified
diff --git a/.jscsrc b/.jscsrc
index 23243e6..998f0b9 100644
--- a/.jscsrc
+++ b/.jscsrc
@@ -2,7 +2,6 @@
"preset": "wikimedia",
"jsDoc": null,
- "requireVarDeclFirst": null,
"excludeFiles": [ "resources/jquery/**" ]
}
diff --git a/resources/mw.FlickrChecker.js b/resources/mw.FlickrChecker.js
index 47df832..62e03af 100644
--- a/resources/mw.FlickrChecker.js
+++ b/resources/mw.FlickrChecker.js
@@ -65,14 +65,17 @@
* @param upload - the upload object to set the deed for
*/
checkFlickr: function ( flickrInputUrl ) {
+ var photoIdMatches, albumIdMatches,
userCollectionMatches, userPhotostreamMatches, groupPoolMatches,
userGalleryMatches, userFavoritesMatches;
+
this.url = flickrInputUrl;
- var photoIdMatches = this.url.match(
/flickr\.com\/(?:x\/t\/[^\/]+\/)?photos\/[^\/]+\/([0-9]+)/ ),
- albumIdMatches = this.url.match(
/flickr\.com\/photos\/[^\/]+\/sets\/([0-9]+)/ ),
- userCollectionMatches = this.url.match(
/flickr\.com\/(?:x\/t\/[^\/]+\/)?photos\/[^\/]+\/collections\/?([0-9]+)?/ ),
- userPhotostreamMatches = this.url.match(
/flickr\.com\/(?:x\/t\/[^\/]+\/)?photos\/([^\/]+)/ ),
- groupPoolMatches = this.url.match(
/flickr\.com\/groups\/[^\/]+(?:\/pool\/([^\/]+))?/ ),
- userGalleryMatches = this.url.match(
/flickr\.com\/(?:x\/t\/[^\/]+\/)?photos\/[^\/]+\/galleries\/([0-9]+)/ ),
- userFavoritesMatches = this.url.match(
/flickr\.com\/(?:x\/t\/[^\/]+\/)?photos\/([^\/]+)\/favorites/ );
+ photoIdMatches = this.url.match(
/flickr\.com\/(?:x\/t\/[^\/]+\/)?photos\/[^\/]+\/([0-9]+)/ );
+ albumIdMatches = this.url.match(
/flickr\.com\/photos\/[^\/]+\/sets\/([0-9]+)/ );
+ userCollectionMatches = this.url.match(
/flickr\.com\/(?:x\/t\/[^\/]+\/)?photos\/[^\/]+\/collections\/?([0-9]+)?/ );
+ userPhotostreamMatches = this.url.match(
/flickr\.com\/(?:x\/t\/[^\/]+\/)?photos\/([^\/]+)/ );
+ groupPoolMatches = this.url.match(
/flickr\.com\/groups\/[^\/]+(?:\/pool\/([^\/]+))?/ );
+ userGalleryMatches = this.url.match(
/flickr\.com\/(?:x\/t\/[^\/]+\/)?photos\/[^\/]+\/galleries\/([0-9]+)/ );
+ userFavoritesMatches = this.url.match(
/flickr\.com\/(?:x\/t\/[^\/]+\/)?photos\/([^\/]+)\/favorites/ );
+
if ( photoIdMatches === null ) {
// try static urls
photoIdMatches = this.url.match(
/static\.?flickr\.com\/[^\/]+\/([0-9]+)_/ );
diff --git a/resources/mw.LanguageUpWiz.js b/resources/mw.LanguageUpWiz.js
index ddaddc8..25a38f2 100644
--- a/resources/mw.LanguageUpWiz.js
+++ b/resources/mw.LanguageUpWiz.js
@@ -22,7 +22,8 @@
// Helper function to see if a language is in the list.
checkForLang: function ( lang ) {
- for ( var langIndex in mw.LanguageUpWiz.languages ) {
+ var langIndex;
+ for ( langIndex in mw.LanguageUpWiz.languages ) {
if ( mw.LanguageUpWiz.languages[ langIndex
].code === lang ) {
return true;
}
@@ -89,13 +90,15 @@
* @return HTML select element configured as desired
*/
getMenu: function ( name, code ) {
+ var $select;
+
mw.LanguageUpWiz.initialize();
/* If we did not request a specific selected language
code, see if we have a default. */
if ( mw.LanguageUpWiz.defaultCode !== null && code ===
mw.LanguageUpWiz.UNKNOWN ) {
code = mw.LanguageUpWiz.defaultCode;
}
- var $select = mw.LanguageUpWiz.$select
+ $select = mw.LanguageUpWiz.$select
.clone()
.prop( 'name', name );
diff --git a/resources/mw.UploadWizard.js b/resources/mw.UploadWizard.js
index c263b7b..b8d174c 100644
--- a/resources/mw.UploadWizard.js
+++ b/resources/mw.UploadWizard.js
@@ -5,17 +5,19 @@
( function ( mw, uw, $, OO ) {
mw.UploadWizard = function ( config ) {
+ var maxSimPref, wizard;
+
this.uploads = [];
this.api = new mw.Api( { ajax: { timeout: 0 } } );
- // making a sort of global for now, should be done by passing
in config or fragments of config when needed
- // elsewhere
+ // making a sort of global for now, should be done by passing
in config or fragments of config
+ // when needed elsewhere
mw.UploadWizard.config = config;
// Shortcut for local references
this.config = config;
- var maxSimPref = mw.user.options.get( 'upwiz_maxsimultaneous' ),
- wizard = this;
+ maxSimPref = mw.user.options.get( 'upwiz_maxsimultaneous' );
+ wizard = this;
if ( maxSimPref !== 'default' ) {
if ( maxSimPref > 0 ) {
diff --git a/resources/mw.UploadWizardDeed.js b/resources/mw.UploadWizardDeed.js
index ca7b41b..6717d85 100644
--- a/resources/mw.UploadWizardDeed.js
+++ b/resources/mw.UploadWizardDeed.js
@@ -75,11 +75,11 @@
* @param {Object} config The UW config
*/
mw.UploadWizardDeedOwnWork = function ( uploadCount, api, config ) {
- uploadCount = uploadCount ? uploadCount : 1;
-
var licenseInputDiv,
deed = new mw.UploadWizardDeed(),
ownWork = config.licensing.ownWork;
+
+ uploadCount = uploadCount ? uploadCount : 1;
deed.authorInput = $( '<input type="text" />' )
.attr( { name: 'author' } )
@@ -158,13 +158,14 @@
},
setFormFields: function ( $selector ) {
- this.$selector = $selector;
var $customDiv, $formFields, $toggler, rules,
messages, defaultLicense,
defaultLicenseURL, defaultLicenseMsg,
defaultLicenseExplainMsg,
- defaultLicenseLink, $standardDiv,
$crossfader,
- thisDeed = this,
- languageCode = mw.config.get(
'wgUserLanguage' ),
- defaultType =
config.licensing.defaultType;
+ defaultLicenseLink, $standardDiv,
$crossfader, thisDeed, languageCode, defaultType;
+
+ this.$selector = $selector;
+ thisDeed = this;
+ languageCode = mw.config.get( 'wgUserLanguage'
);
+ defaultType = config.licensing.defaultType;
if ( defaultType === 'ownwork' ) {
defaultLicense =
config.licensing.ownWork.defaults[ 0 ];
diff --git a/resources/mw.UploadWizardDescription.js
b/resources/mw.UploadWizardDescription.js
index b0fc05b..6845c41 100644
--- a/resources/mw.UploadWizardDescription.js
+++ b/resources/mw.UploadWizardDescription.js
@@ -6,17 +6,19 @@
* @param required -- boolean -- the first description is required and
should be validated and displayed a bit differently
*/
mw.UploadWizardDescription = function ( languageCode, required,
initialValue ) {
+ var errorLabelDiv, fieldnameDiv;
+
mw.UploadWizardDescription.prototype.count++;
this.id = 'description' +
mw.UploadWizardDescription.prototype.count;
this.isRequired = required;
// XXX for some reason this display:block is not making it into
HTML
- var errorLabelDiv = $(
+ errorLabelDiv = $(
'<div class="mwe-upwiz-details-input-error">' +
'<label generated="true"
class="mwe-validator-error" for="' + this.id + '" />' +
'</div>'
- ),
- fieldnameDiv = $( '<div
class="mwe-upwiz-details-fieldname" />' );
+ );
+ fieldnameDiv = $( '<div class="mwe-upwiz-details-fieldname" />'
);
fieldnameDiv.text( mw.message( 'mwe-upwiz-desc' ).text()
).addHint( 'description' );
diff --git a/resources/mw.UploadWizardDetails.js
b/resources/mw.UploadWizardDetails.js
index 3ce7f55..06ba8b5 100644
--- a/resources/mw.UploadWizardDetails.js
+++ b/resources/mw.UploadWizardDetails.js
@@ -241,9 +241,10 @@
this.fields = [];
$.each( mw.UploadWizard.config.fields, function ( i, field ) {
+ var $fieldInput, fieldInputId;
+
if ( field.wikitext ) {
- var $fieldInput,
- fieldInputId = 'field_' + i + '_' + (
details.upload.index ).toString();
+ fieldInputId = 'field_' + i + '_' + (
details.upload.index ).toString();
if ( !( 'type' in field ) ) {
field.type = 'text';
@@ -633,15 +634,18 @@
// In the simplest case, we can use this
self-explanatory vanilla loop.
function simpleCopy( id, tag ) {
+ var moreInfo,
+ firstId = '#' + id + sourceId,
+ firstValue = $( firstId ).val();
if ( tag === undefined ) {
tag = 'input';
}
- var firstId = '#' + id + sourceId,
- firstValue = $( firstId ).val();
$( tag + '[id^=' + id + ']:not(' + firstId +
')' ).each( function () {
$( this ).val( firstValue );
if ( $( this ).parents(
'.mwe-more-details' ).length === 1 ) {
- var moreInfo = $( this
).parents( '.detailsForm' ).find( '.mwe-upwiz-details-more-options a' );
+ moreInfo = $( this )
+ .parents(
'.detailsForm' )
+ .find(
'.mwe-upwiz-details-more-options a' );
if ( !moreInfo.hasClass(
'mwe-upwiz-toggler-open' ) ) {
moreInfo.click();
}
@@ -1162,6 +1166,10 @@
* (which we should actually be using, such as time and
timezone)
*/
prefillDate: function () {
+ var dateObj, metadata, dateTimeRegex, matches, dateStr,
saneTime,
+ yyyyMmDdRegex =
/^(\d\d\d\d)[:\/\-](\d\d)[:\/\-](\d\d)\D.*/,
+ timeRegex = /\D(\d\d):(\d\d):(\d\d)/;
+
// XXX surely we have this function somewhere already
function pad( n ) {
return ( n < 10 ? '0' : '' ) + String( n );
@@ -1176,10 +1184,6 @@
return str;
}
-
- var dateObj, metadata, dateTimeRegex, matches, dateStr,
saneTime,
- yyyyMmDdRegex =
/^(\d\d\d\d)[:\/\-](\d\d)[:\/\-](\d\d)\D.*/,
- timeRegex = /\D(\d\d):(\d\d):(\d\d)/;
if ( this.upload.imageinfo.metadata ) {
metadata = this.upload.imageinfo.metadata;
@@ -1261,15 +1265,16 @@
* or from the metadata.
*/
prefillDescription: function () {
+ var m, desc, descText;
+
if (
this.descriptions[ 0 ].getDescriptionText() ===
'' &&
this.upload.file !== undefined
) {
- var m = this.upload.imageinfo.metadata,
- desc = this.descriptions[ 0 ],
- descText = this.upload.file.description
||
- ( m && m.imagedescription &&
- m.imagedescription[ 0 ] &&
m.imagedescription[ 0 ].value );
+ m = this.upload.imageinfo.metadata;
+ desc = this.descriptions[ 0 ];
+ descText = this.upload.file.description ||
+ ( m && m.imagedescription &&
m.imagedescription[ 0 ] && m.imagedescription[ 0 ].value );
if ( descText ) {
desc.setText( descText );
@@ -1817,6 +1822,8 @@
* (with mwe-upwiz- prefix for UploadWizard
messages)
*/
makeToggler: function ( $toggleDiv, $moreDiv, msg ) {
+ var $toggleLink, actualMsg;
+
function toggle() {
var isOpen = $toggleLink.hasClass(
'mwe-upwiz-toggler-open' );
if ( isOpen ) {
@@ -1831,8 +1838,6 @@
$toggleLink.addClass(
'mwe-upwiz-toggler-open' );
}
}
-
- var $toggleLink, actualMsg;
if ( typeof msg === 'object' ) {
actualMsg = mw.message.apply( this, msg
).text();
diff --git a/resources/mw.UploadWizardLicenseInput.js
b/resources/mw.UploadWizardLicenseInput.js
index a1e5108..5af7be5 100644
--- a/resources/mw.UploadWizardLicenseInput.js
+++ b/resources/mw.UploadWizardLicenseInput.js
@@ -183,12 +183,18 @@
}
$.each( config.licenses, function ( i, licenseName ) {
+ var $customDiv, license, templates, $input,
$label;
+
if ( mw.UploadWizard.config.licenses[
licenseName ] !== undefined ) {
- var $customDiv,
- license = { name: licenseName,
props: mw.UploadWizard.config.licenses[ licenseName ] },
- templates =
license.props.templates === undefined ? [ license.name ] :
license.props.templates.slice( 0 ),
- $input =
input.createInputElement( templates, config ),
- $label =
input.createInputElementLabel( license, $input );
+ license = {
+ name: licenseName,
+ props:
mw.UploadWizard.config.licenses[ licenseName ]
+ };
+ templates = license.props.templates ===
undefined ?
+ [ license.name ] :
+ license.props.templates.slice(
0 );
+ $input = input.createInputElement(
templates, config );
+ $label = input.createInputElementLabel(
license, $input );
input.inputs.push( $input );
$el.append( $input, $label, $( '<br/>'
) );
@@ -219,6 +225,7 @@
* @return {string} of wikitext
*/
createInputValueFromTemplateConfig: function ( templates,
config ) {
+ var wikiTexts;
if ( config.prependTemplates !== undefined ) {
$.each( config.prependTemplates, function ( i,
template ) {
templates.unshift( template );
@@ -228,7 +235,7 @@
templates.unshift( config.template );
templates = [ templates.join( '|' ) ];
}
- var wikiTexts = $.map( templates, function ( t ) {
return '{{' + t + '}}'; } );
+ wikiTexts = $.map( templates, function ( t ) { return
'{{' + t + '}}'; } );
return wikiTexts.join( '' );
},
@@ -485,13 +492,15 @@
// But also check that associated textareas are
filled for if the input is selected, and that
// they are the appropriate size.
$.each( selectedInputs, function ( i, $input ) {
+ var textAreaName, $errorEl, text;
+
if ( !$input.data( 'textarea' ) ) {
return;
}
- var textAreaName = $input.data(
'textarea' ).attr( 'name' ),
- $errorEl = $( 'label[for=' +
textAreaName + '].mwe-error' ),
- text =
input.getInputTextAreaVal( $input );
+ textAreaName = $input.data( 'textarea'
).attr( 'name' );
+ $errorEl = $( 'label[for=' +
textAreaName + '].mwe-error' );
+ text = input.getInputTextAreaVal(
$input );
if ( text === '' ) {
errors.push( [ $errorEl,
'mwe-upwiz-error-license-wikitext-missing' ] );
@@ -537,10 +546,12 @@
* @param {string} wikitext
*/
showPreview: function ( wikiText ) {
+ var input;
+
this.previewDialog.setLoading( true );
this.windowManager.openWindow( this.previewDialog );
- var input = this;
+ input = this;
function show( html ) {
input.previewDialog.setPreview( html );
diff --git a/resources/mw.UploadWizardUpload.js
b/resources/mw.UploadWizardUpload.js
index e3f43c5..9aafa0b 100644
--- a/resources/mw.UploadWizardUpload.js
+++ b/resources/mw.UploadWizardUpload.js
@@ -174,14 +174,14 @@
* @param result the API result in parsed JSON form
*/
mw.UploadWizardUpload.prototype.setTransported = function ( result ) {
- if ( this.state === 'aborted' ) {
- return;
- }
-
// default error state
var comma, warnCode,
code = 'unknown',
info = 'unknown';
+
+ if ( this.state === 'aborted' ) {
+ return;
+ }
if ( result.error ) {
// If there was an error, we can't really do anything
else, so let's get out while we can.
@@ -590,6 +590,8 @@
* @param {Object} (as returned by jpegmeta)
*/
mw.UploadWizardUpload.prototype.extractMetadataFromJpegMeta = function
( meta ) {
+ var pixelHeightDim, pixelWidthDim, degrees;
+
if ( meta !== undefined && meta !== null && typeof meta ===
'object' ) {
if ( this.imageinfo === undefined ) {
this.imageinfo = {};
@@ -601,10 +603,10 @@
this.imageinfo.metadata.orientation =
meta.tiff.Orientation.value;
}
if ( meta.general ) {
- var pixelHeightDim = 'height',
- pixelWidthDim = 'width',
- // this must be called after
orientation is set above. If no orientation set, defaults to 0
- degrees = this.getOrientationDegrees();
+ pixelHeightDim = 'height';
+ pixelWidthDim = 'width';
+ // this must be called after orientation is set
above. If no orientation set, defaults to 0
+ degrees = this.getOrientationDegrees();
// jpegmeta reports pixelHeight & width
if ( degrees === 90 || degrees === 270 ) {
@@ -728,9 +730,13 @@
* @param {number} optional, height of thumbnail. Will force 'url' to
be added to props
*/
mw.UploadWizardUpload.prototype.getImageInfo = function ( callback,
props, width, height ) {
+ var requestedTitle, params;
+
function ok( data ) {
+ var found;
+
if ( data && data.query && data.query.pages ) {
- var found = false;
+ found = false;
$.each( data.query.pages, function ( pageId,
page ) {
if ( page.title && page.title ===
requestedTitle && page.imageinfo ) {
found = true;
@@ -756,12 +762,12 @@
props = [];
}
- var requestedTitle = this.title.getPrefixedText(),
- params = {
- prop: 'imageinfo',
- titles: requestedTitle,
- iiprop: props.join( '|' )
- };
+ requestedTitle = this.title.getPrefixedText();
+ params = {
+ prop: 'imageinfo',
+ titles: requestedTitle,
+ iiprop: props.join( '|' )
+ };
if ( width !== undefined || height !== undefined ) {
if ( !$.inArray( 'url', props ) ) {
@@ -783,8 +789,9 @@
* @return upload handler object
*/
mw.UploadWizardUpload.prototype.getUploadHandler = function () {
+ var constructor; // must be the name of a function in 'mw'
namespace
+
if ( !this.uploadHandler ) {
- var constructor; // must be the name of a function in
'mw' namespace
if ( mw.UploadWizard.config.enableFirefogg &&
mw.Firefogg.isInstalled() ) {
constructor = 'FirefoggHandler';
} else if ( mw.UploadWizard.config.enableFormData &&
mw.fileApi.isAvailable() && mw.fileApi.isFormDataAvailable() ) {
@@ -831,6 +838,8 @@
// on the image. If it loads publish the event
with the image. If it errors out too many times, give up and publish
// the event with a null.
$.each( thumbnails, function ( i, thumb ) {
+ var timeoutMs, image;
+
if ( thumb.thumberror || ( !(
thumb.thumburl && thumb.thumbwidth && thumb.thumbheight ) ) ) {
mw.log.warn(
'mw.UploadWizardUpload::getThumbnail> Thumbnail error or missing information' );
deferred.resolve( null );
@@ -839,8 +848,8 @@
// try to load this image with
exponential backoff
// if the delay goes past 8 seconds, it
gives up and publishes the event with null
- var timeoutMs = 100,
- image = document.createElement(
'img' );
+ timeoutMs = 100;
+ image = document.createElement( 'img' );
image.width = thumb.thumbwidth;
image.height = thumb.thumbheight;
$( image )
@@ -925,8 +934,9 @@
mw.UploadWizardUpload.prototype.getScalingFromConstraints = function (
image, constraints ) {
var scaling = 1;
$.each( [ 'width', 'height' ], function ( i, dim ) {
+ var s;
if ( constraints[ dim ] && image[ dim ] > constraints[
dim ] ) {
- var s = constraints[ dim ] / image[ dim ];
+ s = constraints[ dim ] / image[ dim ];
if ( s < scaling ) {
scaling = s;
}
@@ -1035,10 +1045,11 @@
* @return {HTMLCanvasElement|HTMLImageElement}
*/
mw.UploadWizardUpload.prototype.getScaledImageElement = function (
image, width, height ) {
+ var constraints;
if ( width === undefined || width === null || width <= 0 ) {
width = mw.UploadWizard.config.thumbnailWidth;
}
- var constraints = {
+ constraints = {
width: parseInt( width, 10 ),
height: ( height === undefined ? null : parseInt(
height, 10 ) )
};
diff --git a/resources/mw.UploadWizardUploadInterface.js
b/resources/mw.UploadWizardUploadInterface.js
index 8208401..e9ba823 100644
--- a/resources/mw.UploadWizardUploadInterface.js
+++ b/resources/mw.UploadWizardUploadInterface.js
@@ -182,11 +182,12 @@
* @param Array args: array of values, in case any need to be fed to
the image.
*/
mw.UploadWizardUploadInterface.prototype.setStatus = function ( msgKey,
args ) {
+ var $s;
if ( args === undefined ) {
args = [];
}
// get the status line for our upload
- var $s = $( this.div ).find( '.mwe-upwiz-file-status' );
+ $s = $( this.div ).find( '.mwe-upwiz-file-status' );
$s.msg( msgKey, args ).show();
};
@@ -253,9 +254,10 @@
* @param {jQuery} [$additionalStatus]
*/
mw.UploadWizardUploadInterface.prototype.showError = function ( code,
info, $additionalStatus ) {
+ var msgKey, args;
+
this.showIndicator( 'error' );
// is this an error that we expect to have a message for?
- var msgKey, args;
if ( code === 'http' && info.textStatus === 'timeout' ) {
code = 'timeout';
@@ -316,6 +318,7 @@
* @return {string}
*/
mw.UploadWizardUploadInterface.prototype.getFilename = function () {
+ var input;
if ( this.providedFile && !this.$fileInputCtrl.get( 0 ).value )
{ // default to the fileinput if it's defined.
if ( this.providedFile.fileName ) {
return this.providedFile.fileName;
@@ -324,7 +327,7 @@
return this.providedFile.name;
}
} else {
- var input = this.$fileInputCtrl.get( 0 );
+ input = this.$fileInputCtrl.get( 0 );
// On IE 11, input.value is incorrect for <input
type=file multiple>, like we're using here;
// the input.files interface is reliable.
(T88223#1595320)
if ( input.files && input.files[ 0 ] && input.files[ 0
].name ) {
diff --git a/resources/transports/mw.FirefoggTransport.js
b/resources/transports/mw.FirefoggTransport.js
index b1f42c9..bc7867b 100644
--- a/resources/transports/mw.FirefoggTransport.js
+++ b/resources/transports/mw.FirefoggTransport.js
@@ -133,6 +133,7 @@
// Get the filename
mw.FirefoggTransport.prototype.getFileName = function () {
+ var ext;
// If file is in a supported format don't change extension
if ( this.isUploadFormat() ) {
return this.fogg.sourceFilename;
@@ -141,7 +142,7 @@
return this.fogg.sourceFilename.split( '.'
).slice( 0, -1 ).join( '.' ) + '.oga';
}
if ( this.isSourceVideo() ) {
- var ext = this.getEncodeExt();
+ ext = this.getEncodeExt();
return this.fogg.sourceFilename.split( '.'
).slice( 0, -1 ).join( '.' ) + '.' + ext;
}
}
@@ -160,11 +161,12 @@
* Get the encode settings from configuration and the current selected
video type
*/
mw.FirefoggTransport.prototype.getEncodeSettings = function () {
+ var encodeSettings;
if ( this.isUploadFormat() ) {
return { passthrough: true };
}
// Get the default encode settings:
- var encodeSettings =
mw.UploadWizard.config.firefoggEncodeSettings;
+ encodeSettings = mw.UploadWizard.config.firefoggEncodeSettings;
// Update the format:
this.fogg.setFormat( ( this.getEncodeExt() === 'webm' ) ?
'webm' : 'ogg' );
diff --git a/resources/transports/mw.FormDataTransport.js
b/resources/transports/mw.FormDataTransport.js
index 90dc24d..c1e56c0 100644
--- a/resources/transports/mw.FormDataTransport.js
+++ b/resources/transports/mw.FormDataTransport.js
@@ -419,8 +419,9 @@
builder += dashdash + boundary + crlf;
},
appendBlob: function ( name, blob, filename ) {
+ var reader;
chunksRemaining++;
- var reader = new FileReader();
+ reader = new FileReader();
reader.onload = function ( e ) {
formData.appendFile( name,
e.target.result,
blob.type, filename );
diff --git a/resources/ui/uw.ui.Details.js b/resources/ui/uw.ui.Details.js
index 2f6b8ff..f141f59 100644
--- a/resources/ui/uw.ui.Details.js
+++ b/resources/ui/uw.ui.Details.js
@@ -148,8 +148,9 @@
// Open "more info" if that part of the form has errors
$errorElements.each( function () {
+ var moreInfo;
if ( $( this ).parents( '.mwe-more-details' ).length
=== 1 ) {
- var moreInfo = $( this ).parents(
'.detailsForm' ).find( '.mwe-upwiz-details-more-options a' );
+ moreInfo = $( this ).parents( '.detailsForm'
).find( '.mwe-upwiz-details-more-options a' );
if ( !moreInfo.hasClass(
'mwe-upwiz-toggler-open' ) ) {
moreInfo.click();
}
diff --git a/resources/ui/uw.ui.Thanks.js b/resources/ui/uw.ui.Thanks.js
index ed3a222..e6b6682 100644
--- a/resources/ui/uw.ui.Thanks.js
+++ b/resources/ui/uw.ui.Thanks.js
@@ -93,30 +93,32 @@
* @param {mw.UploadWizardUpload} upload
*/
uw.ui.Thanks.prototype.addUpload = function ( upload ) {
+ var thumbWikiText, $thanksDiv, $thumbnailWrapDiv,
$thumbnailDiv, $thumbnailCaption, $thumbnailLink;
+
if ( upload === undefined ) {
return;
}
- var thumbWikiText = '[[' + [
+ thumbWikiText = '[[' + [
upload.title.toText(),
'thumb',
upload.details.descriptions[ 0
].getDescriptionText()
- ].join( '|' ) + ']]',
+ ].join( '|' ) + ']]';
- $thanksDiv = $( '<div>' )
- .addClass( 'mwe-upwiz-thanks
ui-helper-clearfix' ),
- $thumbnailWrapDiv = $( '<div>' )
- .addClass( 'mwe-upwiz-thumbnail-side' )
- .appendTo( $thanksDiv ),
- $thumbnailDiv = $( '<div>' )
- .addClass( 'mwe-upwiz-thumbnail' )
- .appendTo( $thumbnailWrapDiv ),
- $thumbnailCaption = $( '<div>' )
- .css( { 'text-align': 'center', 'font-size':
'small' } )
- .appendTo( $thumbnailWrapDiv ),
- $thumbnailLink = $( '<a>' )
- .text( upload.title.getMainText() )
- .appendTo( $thumbnailCaption );
+ $thanksDiv = $( '<div>' )
+ .addClass( 'mwe-upwiz-thanks ui-helper-clearfix' );
+ $thumbnailWrapDiv = $( '<div>' )
+ .addClass( 'mwe-upwiz-thumbnail-side' )
+ .appendTo( $thanksDiv );
+ $thumbnailDiv = $( '<div>' )
+ .addClass( 'mwe-upwiz-thumbnail' )
+ .appendTo( $thumbnailWrapDiv );
+ $thumbnailCaption = $( '<div>' )
+ .css( { 'text-align': 'center', 'font-size': 'small' } )
+ .appendTo( $thumbnailWrapDiv );
+ $thumbnailLink = $( '<a>' )
+ .text( upload.title.getMainText() )
+ .appendTo( $thumbnailCaption );
$( '<div>' )
.addClass( 'mwe-upwiz-data' )
diff --git a/tests/qunit/mw.UploadWizardDetails.test.js
b/tests/qunit/mw.UploadWizardDetails.test.js
index db070d6..1ef8ae5 100644
--- a/tests/qunit/mw.UploadWizardDetails.test.js
+++ b/tests/qunit/mw.UploadWizardDetails.test.js
@@ -1,8 +1,6 @@
( function ( mw, $ ) {
'use strict';
- QUnit.module( 'ext.uploadWizard/mw.UploadWizardDetails.test.js',
QUnit.newMwEnvironment() );
-
var makeTitleInFileNSCases = [ {
filename: 'foo.png',
prefixedText: 'File:Foo.png',
@@ -29,6 +27,8 @@
desc: 'filename starting with file:'
} ];
+ QUnit.module( 'ext.uploadWizard/mw.UploadWizardDetails.test.js',
QUnit.newMwEnvironment() );
+
QUnit.test( 'makeTitleInFileNS()', makeTitleInFileNSCases.length,
function () {
var makeTitleInFileNS =
mw.UploadWizardDetails.makeTitleInFileNS;
--
To view, visit https://gerrit.wikimedia.org/r/247734
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I12f39bf4a6bd09a7f480a7b2168954c012a1dfaa
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/UploadWizard
Gerrit-Branch: master
Gerrit-Owner: Jforrester <[email protected]>
Gerrit-Reviewer: Bartosz Dziewoński <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits