Gerrit Patch Uploader has uploaded a new change for review. https://gerrit.wikimedia.org/r/108826
Change subject: Apply coding conventions for JavaScript ...................................................................... Apply coding conventions for JavaScript Change-Id: I62fe370493b269618a0277ea06ed6ad22b97616a --- M resources/mediawiki.action/mediawiki.action.history.js M resources/mediawiki.action/mediawiki.action.view.metadata.js M resources/mediawiki.api/mediawiki.api.category.js M resources/mediawiki.page/mediawiki.page.gallery.js M resources/mediawiki.page/mediawiki.page.image.pagination.js M resources/mediawiki.special/mediawiki.special.javaScriptTest.js M resources/mediawiki.special/mediawiki.special.preferences.js M resources/mediawiki.special/mediawiki.special.search.js M resources/mediawiki.special/mediawiki.special.upload.js M resources/mediawiki/mediawiki.Title.js M resources/mediawiki/mediawiki.Uri.js M resources/mediawiki/mediawiki.debug.js M resources/mediawiki/mediawiki.htmlform.js M resources/mediawiki/mediawiki.jqueryMsg.js M resources/mediawiki/mediawiki.util.js 15 files changed, 104 insertions(+), 104 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/26/108826/1 diff --git a/resources/mediawiki.action/mediawiki.action.history.js b/resources/mediawiki.action/mediawiki.action.history.js index 04f045a..500a47a 100644 --- a/resources/mediawiki.action/mediawiki.action.history.js +++ b/resources/mediawiki.action/mediawiki.action.history.js @@ -21,10 +21,10 @@ $lis .removeClass( 'selected' ) .each( function () { - var $li = $(this), + var $li = $( this ), $inputs = $li.find( 'input[type="radio"]' ), - $oldidRadio = $inputs.filter( '[name="oldid"]' ).eq(0), - $diffRadio = $inputs.filter( '[name="diff"]' ).eq(0); + $oldidRadio = $inputs.filter( '[name="oldid"]' ).eq( 0 ), + $diffRadio = $inputs.filter( '[name="diff"]' ).eq( 0 ); if ( !$oldidRadio.length || !$diffRadio.length ) { return true; @@ -60,7 +60,7 @@ $oldidRadio.css( 'visibility', 'hidden' ); } } - }); + } ); return true; } @@ -77,7 +77,7 @@ // Ideally we'd use e.target instead of $historySubmitter, but e.target points // to the form element for submit actions, so. $historyCompareForm.find( '.historysubmit' ).click( function () { - $historySubmitter = $(this); + $historySubmitter = $( this ); } ); // On submit we clone the form element, remove unneeded fields in the clone @@ -92,7 +92,7 @@ if ( $historySubmitter ) { $copyForm = $historyCompareForm.clone(); $copyRadios = $copyForm.find( '#pagehistory > li' ).find( 'input[name="diff"], input[name="oldid"]' ); - $copyAction = $copyForm.find( '> [name="action"]'); + $copyAction = $copyForm.find( '> [name="action"]' ); // Remove action=historysubmit and ids[..]=.. if ( $historySubmitter.hasClass( 'mw-history-compareselectedversions-button' ) ) { @@ -110,8 +110,8 @@ // Also remove potentially conflicting id attributes that we don't need anyway $copyForm .css( 'display', 'none' ) - .find('[id]') - .removeAttr('id') + .find( '[id]' ) + .removeAttr( 'id' ) .end() .insertAfter( $historyCompareForm ) .submit(); diff --git a/resources/mediawiki.action/mediawiki.action.view.metadata.js b/resources/mediawiki.action/mediawiki.action.view.metadata.js index 9b27e24..d23a937 100644 --- a/resources/mediawiki.action/mediawiki.action.view.metadata.js +++ b/resources/mediawiki.action/mediawiki.action.view.metadata.js @@ -26,7 +26,7 @@ $link = $( '<a>', { text: showText, href: '#' - }).click(function () { + } ).click( function () { if ( $table.hasClass( 'collapsed' ) ) { $( this ).text( hideText ); } else { @@ -34,7 +34,7 @@ } $table.toggleClass( 'expanded collapsed' ); return false; - }); + } ); $col.append( $link ); $row.append( $col ); diff --git a/resources/mediawiki.api/mediawiki.api.category.js b/resources/mediawiki.api/mediawiki.api.category.js index 98a9c54..d61c1c6 100644 --- a/resources/mediawiki.api/mediawiki.api.category.js +++ b/resources/mediawiki.api/mediawiki.api.category.js @@ -34,7 +34,7 @@ } ); } d.resolve( exists ); - }) + } ) .fail( d.reject ); return d.promise( { abort: apiPromise.abort } ); @@ -61,7 +61,7 @@ apiPromise = this.get( { list: 'allpages', apprefix: prefix, - apnamespace: mw.config.get('wgNamespaceIds').category + apnamespace: mw.config.get( 'wgNamespaceIds' ).category } ) .done( function ( data ) { var texts = []; @@ -71,7 +71,7 @@ } ); } d.resolve( texts ); - }) + } ) .fail( d.reject ); return d.promise( { abort: apiPromise.abort } ); diff --git a/resources/mediawiki.page/mediawiki.page.gallery.js b/resources/mediawiki.page/mediawiki.page.gallery.js index 147a869..64efbb9 100644 --- a/resources/mediawiki.page/mediawiki.page.gallery.js +++ b/resources/mediawiki.page/mediawiki.page.gallery.js @@ -29,7 +29,7 @@ // Now on to justification. // We may still get ragged edges if someone resizes their window. Could bind to // that event, otoh do we really want to constantly be resizing galleries? - $( galleries ).each( function() { + $( galleries ).each( function () { var lastTop, $img, imgWidth, @@ -37,9 +37,9 @@ rows = [], $gallery = $( this ); - $gallery.children( 'li' ).each( function() { + $gallery.children( 'li' ).each( function () { // Math.floor to be paranoid if things are off by 0.00000000001 - var top = Math.floor( $(this ).position().top ), + var top = Math.floor( $( this ).position().top ), $this = $( this ); if ( top !== lastTop ) { @@ -74,9 +74,9 @@ captionWidth: $this.children().children( 'div.gallerytextwrapper' ).width(), height: imgHeight }; - }); + } ); - (function () { + ( function () { var maxWidth, combinedAspect, combinedPadding, @@ -200,7 +200,7 @@ $outerDiv.width( newWidth + padding ); $innerDiv.width( newWidth + padding ); $imageDiv.width( newWidth ); - $caption.width( curRow[j].captionWidth + (newWidth - curRow[j].imgWidth ) ); + $caption.width( curRow[j].captionWidth + ( newWidth - curRow[j].imgWidth ) ); } hookInfo = { diff --git a/resources/mediawiki.page/mediawiki.page.image.pagination.js b/resources/mediawiki.page/mediawiki.page.image.pagination.js index 3c93de0..8a4d526 100644 --- a/resources/mediawiki.page/mediawiki.page.image.pagination.js +++ b/resources/mediawiki.page/mediawiki.page.image.pagination.js @@ -3,7 +3,7 @@ * without a page reload. Currently, the only image formats that can be multi-page images are * PDF and DjVu files */ -( function (mw, $) { +( function ( mw, $ ) { // Initialize ajax request variable var xhr; @@ -71,7 +71,7 @@ } ); } - $( document ).ready( function() { + $( document ).ready( function () { // The presence of table.multipageimage signifies that this file is a multi-page image if ( mw.config.get( 'wgNamespaceNumber' ) === 6 && $( 'table.multipageimage' ).length !== 0 ) { ajaxifyPageNavigation(); @@ -86,7 +86,7 @@ if ( state ) { loadPage( state.url, true ); } - }); + } ); } } } ); diff --git a/resources/mediawiki.special/mediawiki.special.javaScriptTest.js b/resources/mediawiki.special/mediawiki.special.javaScriptTest.js index a560ca9..2c7421b 100644 --- a/resources/mediawiki.special/mediawiki.special.javaScriptTest.js +++ b/resources/mediawiki.special/mediawiki.special.javaScriptTest.js @@ -25,7 +25,7 @@ // Bind onchange event handler and append to form $html.append( $( select ).change( function () { - window.location = QUnit.url( { useskin: $(this).val() } ); + window.location = QUnit.url( { useskin: $( this ).val() } ); } ) ); diff --git a/resources/mediawiki.special/mediawiki.special.preferences.js b/resources/mediawiki.special/mediawiki.special.preferences.js index 3302ec6..19a8844 100644 --- a/resources/mediawiki.special/mediawiki.special.preferences.js +++ b/resources/mediawiki.special/mediawiki.special.preferences.js @@ -11,7 +11,7 @@ }; $( '#prefsubmit' ).attr( 'id', 'prefcontrol' ); - $preftoc = $('<ul id="preftoc"></ul>') + $preftoc = $( '<ul id="preftoc"></ul>' ) .attr( 'role', 'tablist' ); $preferences = $( '#preferences' ) .addClass( 'jsprefs' ) @@ -34,7 +34,7 @@ $( '<div>' ).addClass( 'mw-navigation-hint' ) .text( mediaWiki.msg( 'prefs-tabs-navigation-hint' ) ) .attr( 'tabIndex', 0 ) - .on( 'focus blur', function( e ) { + .on( 'focus blur', function ( e ) { if ( e.type === 'blur' || e.type === 'focusout' ) { $( this ).css( 'height', '0' ); } else { @@ -81,7 +81,7 @@ // Populate the prefToc $legends.each( function ( i, legend ) { - var $legend = $(legend), + var $legend = $( legend ), ident, $li, $a; if ( i === 0 ) { $legend.parent().show(); @@ -106,7 +106,7 @@ } ); // Enable keyboard users to use left and right keys to switch tabs - $preftoc.on( 'keydown', function( event ) { + $preftoc.on( 'keydown', function ( event ) { var keyLeft = 37, keyRight = 39, $el; @@ -139,14 +139,14 @@ if ( 'onhashchange' in window && ( document.documentMode === undefined || document.documentMode >= 8 ) ) { - $(window).on( 'hashchange' , function () { + $( window ).on( 'hashchange' , function () { var hash = window.location.hash; if ( hash.match( /^#mw-prefsection-[\w\-]+/ ) ) { switchPrefTab( hash.replace( '#mw-prefsection-', '' ) ); } else if ( hash === '' ) { switchPrefTab( 'personal', 'noHash' ); } - }); + } ); // In older browsers we'll bind a click handler as fallback. // We must not have onhashchange *and* the click handlers, other wise // the click handler calls switchPrefTab() which sets the hash value, @@ -155,7 +155,7 @@ $preftoc.on( 'click', 'li a', function ( e ) { switchPrefTab( $( this ).attr( 'href' ).replace( '#mw-prefsection-', '' ) ); e.preventDefault(); - }); + } ); } /** diff --git a/resources/mediawiki.special/mediawiki.special.search.js b/resources/mediawiki.special/mediawiki.special.search.js index 035252b..b847f7d 100644 --- a/resources/mediawiki.special/mediawiki.special.search.js +++ b/resources/mediawiki.special/mediawiki.special.search.js @@ -11,22 +11,22 @@ } // Create check all/none button - $checkboxes = $('#powersearch input[id^=mw-search-ns]'); - $('#mw-search-togglebox').append( - $('<label>') - .text(mw.msg('powersearch-togglelabel')) + $checkboxes = $( '#powersearch input[id^=mw-search-ns]' ); + $( '#mw-search-togglebox' ).append( + $( '<label>' ) + .text( mw.msg( 'powersearch-togglelabel' ) ) ).append( - $('<input type="button" />') + $( '<input type="button" />' ) .attr( 'id', 'mw-search-toggleall' ) - .prop( 'value', mw.msg('powersearch-toggleall' ) ) + .prop( 'value', mw.msg( 'powersearch-toggleall' ) ) .click( function () { - $checkboxes.prop('checked', true); + $checkboxes.prop( 'checked', true ); } ) ).append( - $('<input type="button" />') + $( '<input type="button" />' ) .attr( 'id', 'mw-search-togglenone' ) - .prop( 'value', mw.msg('powersearch-togglenone' ) ) - .click( function() { + .prop( 'value', mw.msg( 'powersearch-togglenone' ) ) + .click( function () { $checkboxes.prop( 'checked', false ); } ) ); @@ -34,19 +34,19 @@ // Change the header search links to what user entered $headerLinks = $( '.search-types a' ); $( '#searchText, #powerSearchText' ).change( function () { - var searchterm = $(this).val(); + var searchterm = $( this ).val(); $headerLinks.each( function () { - var parts = $(this).attr('href').split( 'search=' ), + var parts = $( this ).attr( 'href' ).split( 'search=' ), lastpart = '', prefix = 'search='; - if ( parts.length > 1 && parts[1].indexOf('&') >= 0 ) { - lastpart = parts[1].substring( parts[1].indexOf('&') ); + if ( parts.length > 1 && parts[1].indexOf( '&' ) >= 0 ) { + lastpart = parts[1].substring( parts[1].indexOf( '&' ) ); } else { prefix = '&search='; } this.href = parts[0] + prefix + encodeURIComponent( searchterm ) + lastpart; - }); - }).trigger( 'change' ); + } ); + } ).trigger( 'change' ); } ); diff --git a/resources/mediawiki.special/mediawiki.special.upload.js b/resources/mediawiki.special/mediawiki.special.upload.js index 3f40c54..4ee3de3 100644 --- a/resources/mediawiki.special/mediawiki.special.upload.js +++ b/resources/mediawiki.special/mediawiki.special.upload.js @@ -57,7 +57,7 @@ thumb.find( '.filename' ).text( file.name ).end() .find( '.fileinfo' ).text( prettySize( file.size ) ).end(); - $canvas = $('<canvas width="' + previewSize + '" height="' + previewSize + '" ></canvas>'); + $canvas = $( '<canvas width="' + previewSize + '" height="' + previewSize + '" ></canvas>' ); ctx = $canvas[0].getContext( '2d' ); $( '#mw-htmlform-source' ).parent().prepend( thumb ); @@ -93,8 +93,8 @@ width = img.width / img.height * previewSize; } // Determine the offset required to center the image - dx = (180 - width) / 2; - dy = (180 - height) / 2; + dx = ( 180 - width ) / 2; + dy = ( 180 - height ) / 2; switch ( rotation ) { // If a rotation is applied, the direction of the axis // changes as well. You can derive the values below by @@ -130,7 +130,7 @@ ctx.clearRect( 0, 0, 180, 180 ); ctx.rotate( rotation / 180 * Math.PI ); ctx.drawImage( img, x, y, width, height ); - thumb.find('.mw-small-spinner').replaceWith($canvas); + thumb.find( '.mw-small-spinner' ).replaceWith( $canvas ); // Image size info = mw.msg( 'widthheight', logicalWidth, logicalHeight ) + @@ -165,7 +165,7 @@ if ( callbackBinary && 'readAsBinaryString' in reader ) { // To fetch JPEG metadata we need a binary string; start there. // todo: - reader.onload = function() { + reader.onload = function () { callbackBinary( reader.result ); // Now run back through the regular code path. @@ -176,7 +176,7 @@ // readAsArrayBuffer replaces readAsBinaryString // However, our JPEG metadata library wants a string. // So, this is going to be an ugly conversion. - reader.onload = function() { + reader.onload = function () { var i, buffer = new Uint8Array( reader.result ), string = ''; @@ -310,7 +310,7 @@ } for ( i = $rows.length; i; i-- ) { - $row = $rows.eq(i - 1); + $row = $rows.eq( i - 1 ); $row .find( 'input[name="wpSourceType"]' ) .change( createHandler( $row ) ); diff --git a/resources/mediawiki/mediawiki.Title.js b/resources/mediawiki/mediawiki.Title.js index 51770fd..32c3f1e 100644 --- a/resources/mediawiki/mediawiki.Title.js +++ b/resources/mediawiki/mediawiki.Title.js @@ -388,9 +388,9 @@ /** * Example to declare existing titles: - * Title.exist.set(['User:John_Doe', ...]); + * Title.exist.set( ['User:John_Doe', ...] ); * Eample to declare titles nonexistent: - * Title.exist.set(['File:Foo_bar.jpg', ...], false); + * Title.exist.set( ['File:Foo_bar.jpg', ...], false ); * * @static * @property exist.set diff --git a/resources/mediawiki/mediawiki.Uri.js b/resources/mediawiki/mediawiki.Uri.js index a1eed48..a750106 100644 --- a/resources/mediawiki/mediawiki.Uri.js +++ b/resources/mediawiki/mediawiki.Uri.js @@ -222,8 +222,8 @@ */ Uri.encode = function ( s ) { return encodeURIComponent( s ) - .replace( /!/g, '%21').replace( /'/g, '%27').replace( /\(/g, '%28') - .replace( /\)/g, '%29').replace( /\*/g, '%2A') + .replace( /!/g, '%21' ).replace( /'/g, '%27' ).replace( /\(/g, '%28' ) + .replace( /\)/g, '%29' ).replace( /\*/g, '%2A' ) .replace( /%20/g, '+' ); }; diff --git a/resources/mediawiki/mediawiki.debug.js b/resources/mediawiki/mediawiki.debug.js index 986917a..04cfbb0 100644 --- a/resources/mediawiki/mediawiki.debug.js +++ b/resources/mediawiki/mediawiki.debug.js @@ -54,7 +54,7 @@ */ switchPane: function ( e ) { var currentPaneId = debug.$container.data( 'currentPane' ), - requestedPaneId = $(this).prop( 'id' ).substr( 9 ), + requestedPaneId = $( this ).prop( 'id' ).substr( 9 ), $currentPane = $( '#mw-debug-pane-' + currentPaneId ), $requestedPane = $( '#mw-debug-pane-' + requestedPaneId ), hovDone = false; @@ -69,8 +69,8 @@ // Skip hash fragment handling. Prevents screen from jumping. e.preventDefault(); - $( this ).addClass( 'current '); - $( '.mw-debug-panelink' ).not( this ).removeClass( 'current '); + $( this ).addClass( 'current ' ); + $( '.mw-debug-panelink' ).not( this ).removeClass( 'current ' ); // Hide the current pane if ( requestedPaneId === currentPaneId ) { @@ -107,10 +107,10 @@ * @return {jQuery} */ function bitDiv( id ) { - return $( '<div>' ).prop({ + return $( '<div>' ).prop( { id: 'mw-debug-' + id, className: 'mw-debug-bit' - }) + } ) .appendTo( $bits ); } @@ -123,10 +123,10 @@ */ function paneLabel( id, text ) { return $( '<a>' ) - .prop({ + .prop( { className: 'mw-debug-panelabel', href: '#mw-debug-pane-' + id - }) + } ) .text( text ); } @@ -142,10 +142,10 @@ if ( count ) { text = text + ' (' + count + ')'; } - return $( '<div>' ).prop({ + return $( '<div>' ).prop( { id: 'mw-debug-' + id, className: 'mw-debug-bit mw-debug-panelink' - }) + } ) .append( paneLabel( id, text ) ) .appendTo( $bits ); } @@ -205,10 +205,10 @@ } $( '<div>' ) - .prop({ + .prop( { className: 'mw-debug-pane', id: 'mw-debug-pane-' + id - }) + } ) .append( panes[id] ) .appendTo( $container ); } diff --git a/resources/mediawiki/mediawiki.htmlform.js b/resources/mediawiki/mediawiki.htmlform.js index de06859..7315677 100644 --- a/resources/mediawiki/mediawiki.htmlform.js +++ b/resources/mediawiki/mediawiki.htmlform.js @@ -11,9 +11,9 @@ */ $.fn.goIn = function ( instantToggle ) { if ( instantToggle === true ) { - return $(this).show(); + return $( this ).show(); } - return $(this).stop( true, true ).fadeIn(); + return $( this ).stop( true, true ).fadeIn(); }; /** @@ -24,9 +24,9 @@ */ $.fn.goOut = function ( instantToggle ) { if ( instantToggle === true ) { - return $(this).hide(); + return $( this ).hide(); } - return $(this).stop( true, true ).fadeOut(); + return $( this ).stop( true, true ).fadeOut(); }; /** @@ -35,8 +35,8 @@ * @param {Function} callback Takes one parameter, which is {true} when the * event is called immediately, and {jQuery.Event} when triggered from an event. */ - $.fn.liveAndTestAtStart = function ( callback ){ - $(this) + $.fn.liveAndTestAtStart = function ( callback ) { + $( this ) .live( 'change', callback ) .each( function () { callback.call( this, true ); @@ -48,14 +48,14 @@ // Animate the SelectOrOther fields, to only show the text field when // 'other' is selected. $( '.mw-htmlform-select-or-other' ).liveAndTestAtStart( function ( instant ) { - var $other = $( '#' + $(this).attr( 'id' ) + '-other' ); + var $other = $( '#' + $( this ).attr( 'id' ) + '-other' ); $other = $other.add( $other.siblings( 'br' ) ); - if ( $(this).val() === 'other' ) { + if ( $( this ).val() === 'other' ) { $other.goIn( instant ); } else { $other.goOut( instant ); } - }); + } ); } ); @@ -72,7 +72,7 @@ 'class': 'htmlform-chzn-select mw-input ' + oldClass } ); $oldContainer.find( 'input' ).each( function () { - var $oldInput = $(this), + var $oldInput = $( this ), checked = $oldInput.prop( 'checked' ), $option = $( '<option>' ); $option.prop( 'value', $oldInput.prop( 'value' ) ); diff --git a/resources/mediawiki/mediawiki.jqueryMsg.js b/resources/mediawiki/mediawiki.jqueryMsg.js index 70b9be9..3322ad9 100644 --- a/resources/mediawiki/mediawiki.jqueryMsg.js +++ b/resources/mediawiki/mediawiki.jqueryMsg.js @@ -147,9 +147,9 @@ /** * N.B. replacements are variadic arguments or an array in second parameter. In other words: - * somefunction(a, b, c, d) + * somefunction( a, b, c, d ) * is equivalent to - * somefunction(a, [b, c, d]) + * somefunction( a, [b, c, d] ) * * @param {string} key Message key. * @param {Array|mixed} replacements Optional variable replacements (variadically or an array). @@ -181,9 +181,9 @@ var failableParserFn = getFailableParserFn( options ); /** * N.B. replacements are variadic arguments or an array in second parameter. In other words: - * somefunction(a, b, c, d) + * somefunction( a, b, c, d ) * is equivalent to - * somefunction(a, [b, c, d]) + * somefunction( a, [b, c, d] ) * * We append to 'this', which in a jQuery plugin context will be the selected elements. * @param {string} key Message key. @@ -395,8 +395,8 @@ // This may be because, to save code, memoization was removed regularLiteral = makeRegexParser( /^[^{}\[\]$<\\]/ ); - regularLiteralWithoutBar = makeRegexParser(/^[^{}\[\]$\\|]/); - regularLiteralWithoutSpace = makeRegexParser(/^[^{}\[\]$\s]/); + regularLiteralWithoutBar = makeRegexParser( /^[^{}\[\]$\\|]/ ); + regularLiteralWithoutSpace = makeRegexParser( /^[^{}\[\]$\s]/ ); regularLiteralWithSquareBrackets = makeRegexParser( /^[^{}$\\]/ ); backslash = makeStringParser( '\\' ); @@ -432,30 +432,30 @@ // Used to define "literals" without spaces, in space-delimited situations function literalWithoutSpace() { var result = nOrMore( 1, escapedOrLiteralWithoutSpace )(); - return result === null ? null : result.join(''); + return result === null ? null : result.join( '' ); } // Used to define "literals" within template parameters. The pipe character is the parameter delimeter, so by default // it is not a literal in the parameter function literalWithoutBar() { var result = nOrMore( 1, escapedOrLiteralWithoutBar )(); - return result === null ? null : result.join(''); + return result === null ? null : result.join( '' ); } // Used for wikilink page names. Like literalWithoutBar, but // without allowing escapes. function unescapedLiteralWithoutBar() { var result = nOrMore( 1, regularLiteralWithoutBar )(); - return result === null ? null : result.join(''); + return result === null ? null : result.join( '' ); } function literal() { var result = nOrMore( 1, escapedOrRegularLiteral )(); - return result === null ? null : result.join(''); + return result === null ? null : result.join( '' ); } function curlyBraceTransformExpressionLiteral() { var result = nOrMore( 1, regularLiteralWithSquareBrackets )(); - return result === null ? null : result.join(''); + return result === null ? null : result.join( '' ); } asciiAlphabetLiteral = makeRegexParser( /[A-Za-z]+/ ); @@ -588,7 +588,7 @@ whitespace, asciiAlphabetLiteral, htmlAttributeEquals, - choice( [ + choice( [ doubleQuotedHtmlAttributeValue, singleQuotedHtmlAttributeValue ] ) @@ -679,7 +679,7 @@ endTagName = parsedCloseTagResult[1]; wrappedAttributes = parsedOpenTagResult[2]; attributes = wrappedAttributes.slice( 1 ); - if ( isAllowedHtml( startTagName, endTagName, attributes) ) { + if ( isAllowedHtml( startTagName, endTagName, attributes ) ) { result = [ 'HTMLELEMENT', startTagName, wrappedAttributes ].concat( parsedHtmlContents ); } else { // HTML is not allowed, so contents will remain how @@ -736,7 +736,7 @@ ] ); return result === null ? null : [ result[0], result[2] ]; } - colon = makeStringParser(':'); + colon = makeStringParser( ':' ); templateContents = choice( [ function () { var res = sequence( [ @@ -758,8 +758,8 @@ return [ res[0] ].concat( res[1] ); } ] ); - openTemplate = makeStringParser('{{'); - closeTemplate = makeStringParser('}}'); + openTemplate = makeStringParser( '{{' ); + closeTemplate = makeStringParser( '}}' ); nonWhitespaceExpression = choice( [ template, wikilink, @@ -1001,7 +1001,7 @@ * Transform parsed structure into external link * If the href is a jQuery object, treat it as "enclosing" the link text. * ... function, treat it as the click handler - * ... string, treat it as a URI + * ... string, treat it as a URI * TODO: throw an error if nodes.length > 2 ? * @param {Array} of two elements, {jQuery|Function|String} and {String} * @return {jQuery} @@ -1035,7 +1035,7 @@ extlinkparam: function ( nodes, replacements ) { var replacement, index = parseInt( nodes[0], 10 ); - if ( index < replacements.length) { + if ( index < replacements.length ) { replacement = replacements[index]; } else { replacement = '$' + ( index + 1 ); @@ -1053,7 +1053,7 @@ plural: function ( nodes ) { var forms, count; count = parseFloat( this.language.convertNumber( nodes[0], true ) ); - forms = nodes.slice(1); + forms = nodes.slice( 1 ); return forms.length ? this.language.convertPlural( count, forms ) : ''; }, @@ -1132,7 +1132,7 @@ // Caching is somewhat problematic, because we do need different message functions for different maps, so // we'd have to cache the parser as a member of this.map, which sounds a bit ugly. // Do not use mw.jqueryMsg unless required - if ( this.format === 'plain' || !/\{\{|[\[<>]/.test(this.map.get( this.key ) ) ) { + if ( this.format === 'plain' || !/\{\{|[\[<>]/.test( this.map.get( this.key ) ) ) { // Fall back to mw.msg's simple parser return oldParser.apply( this ); } diff --git a/resources/mediawiki/mediawiki.util.js b/resources/mediawiki/mediawiki.util.js index 86f06b8..a178e2b 100644 --- a/resources/mediawiki/mediawiki.util.js +++ b/resources/mediawiki/mediawiki.util.js @@ -117,7 +117,7 @@ .text( mw.msg( 'hidetoc' ) ) .click( function ( e ) { e.preventDefault(); - util.toggleToc( $(this) ); + util.toggleToc( $( this ) ); } ); $tocTitle.append( $tocToggleLink @@ -204,11 +204,11 @@ * This function returns the styleSheet object for convience (due to cross-browsers * difference as to where it is located). * - * var sheet = mw.util.addCSS('.foobar { display: none; }'); - * $(foo).click(function () { + * var sheet = mw.util.addCSS( '.foobar { display: none; }' ); + * $( foo ).click( function () { * // Toggle the sheet on and off * sheet.disabled = !sheet.disabled; - * }); + * } ); * * @param {string} text CSS to be appended * @return {CSSStyleSheet} Use .ownerNode to get to the `<style>` element. @@ -508,7 +508,7 @@ // the ABNF: // 1 * ( atext / "." ) "@" ldh-str 1*( "." ldh-str ) // With: - // - atext : defined in RFC 5322 section 3.2.3 + // - atext : defined in RFC 5322 section 3.2.3 // - ldh-str : defined in RFC 1034 section 3.5 // // (see STD 68 / RFC 5234 http://tools.ietf.org/html/std68) @@ -556,7 +556,7 @@ // RegExp is case insensitive 'i' ); - return (null !== mailtxt.match( html5EmailRegexp ) ); + return ( null !== mailtxt.match( html5EmailRegexp ) ); }, /** -- To view, visit https://gerrit.wikimedia.org/r/108826 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I62fe370493b269618a0277ea06ed6ad22b97616a Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Gerrit Patch Uploader <gerritpatchuploa...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits