jenkins-bot has submitted this change and it was merged.
Change subject: Hygiene: Indentation fixes
......................................................................
Hygiene: Indentation fixes
* Remove double spaces
* Correct indentation level
** Note on NotificationsOverlay.js I simply remove one tab indent on all
properties
* Predefine variables before initialising them
Change-Id: I935dd7e941c67f5dad4a18de14febc2068ec7b06
---
M javascripts/OverlayManager.js
M javascripts/icons.js
M javascripts/modes.js
M javascripts/moduleLoader.js
M javascripts/modules/editor/EditorOverlay.js
M javascripts/modules/editor/init.js
M javascripts/modules/issues/CleanupOverlay.js
M javascripts/modules/issues/init.js
M javascripts/modules/lastEdited/init.js
M javascripts/modules/notifications/NotificationsOverlay.js
M javascripts/modules/notifications/notifications.js
M javascripts/modules/preferredLanguages/init.js
M javascripts/modules/wikigrok/WikiGrokAbTest.js
M javascripts/user.js
14 files changed, 118 insertions(+), 116 deletions(-)
Approvals:
Bmansurov: Looks good to me, approved
jenkins-bot: Verified
diff --git a/javascripts/OverlayManager.js b/javascripts/OverlayManager.js
index b23ce79..76d326b 100644
--- a/javascripts/OverlayManager.js
+++ b/javascripts/OverlayManager.js
@@ -189,7 +189,7 @@
*
* @method
* @param {Object} overlay The overlay to display
- */
+ */
replaceCurrent: function ( overlay ) {
if ( this.stack.length === 0 ) {
throw new Error( 'Trying to replace
OverlayManager\'s current overlay, but stack is empty' );
diff --git a/javascripts/icons.js b/javascripts/icons.js
index b89f836..1b38104 100644
--- a/javascripts/icons.js
+++ b/javascripts/icons.js
@@ -33,4 +33,4 @@
}
} );
-} ( mw.mobileFrontend, jQuery ) );
+}( mw.mobileFrontend, jQuery ) );
diff --git a/javascripts/modes.js b/javascripts/modes.js
index 1801d8b..1095cdc 100644
--- a/javascripts/modes.js
+++ b/javascripts/modes.js
@@ -43,9 +43,9 @@
assertMode: function ( modes ) {
var mode = this.getMode();
if ( $.inArray( mode, modes ) === -1 ) {
- throw new Error( 'Attempt to run module outside
declared environment mode ' + mode );
+ throw new Error( 'Attempt to run module outside
declared environment mode ' + mode );
}
}
}, mw.mantle );
-} ( jQuery ) );
+}( jQuery ) );
diff --git a/javascripts/moduleLoader.js b/javascripts/moduleLoader.js
index 249c633..2786d82 100644
--- a/javascripts/moduleLoader.js
+++ b/javascripts/moduleLoader.js
@@ -29,4 +29,4 @@
}
}, M );
-} ( mw.mobileFrontend, jQuery ) );
+}( mw.mobileFrontend, jQuery ) );
diff --git a/javascripts/modules/editor/EditorOverlay.js
b/javascripts/modules/editor/EditorOverlay.js
index 8073868..8764813 100644
--- a/javascripts/modules/editor/EditorOverlay.js
+++ b/javascripts/modules/editor/EditorOverlay.js
@@ -117,16 +117,14 @@
mw.util.getUrl( 'Special:UserLogin',
$.extend( params, signupParams ) )
).parse()
).show();
- this.$( '.continue' ).prop( 'disabled', false ).on(
'click', $.proxy( this, '_showEditorafterWarning' )
- );
+ this.$( '.continue' ).prop( 'disabled', false ).on(
'click', $.proxy( this, '_showEditorafterWarning' ) );
this.clearSpinner();
},
_showEditorafterWarning: function () {
this.showSpinner();
this.$anonWarning.hide();
- this.$( '.continue' ).prop( 'disabled', true ).on(
'click', $.proxy( this, '_prepareForSave' )
- );
+ this.$( '.continue' ).prop( 'disabled', true ).on(
'click', $.proxy( this, '_prepareForSave' ) );
this._loadContent();
},
diff --git a/javascripts/modules/editor/init.js
b/javascripts/modules/editor/init.js
index 7485990..2bf63a6 100644
--- a/javascripts/modules/editor/init.js
+++ b/javascripts/modules/editor/init.js
@@ -231,7 +231,7 @@
} else if ( isNewFile ) {
// Is a new file page (enable upload image only) Bug 58311
showSorryToast( 'mobile-frontend-editor-uploadenable' );
- } else {
+ } else {
if ( user.isAnon() ) {
// Set edit button to launch login CTA
if ( mw.config.get( 'wgMFAnonymousEditing' ) ) {
diff --git a/javascripts/modules/issues/CleanupOverlay.js
b/javascripts/modules/issues/CleanupOverlay.js
index 02870a1..bdb1fbc 100644
--- a/javascripts/modules/issues/CleanupOverlay.js
+++ b/javascripts/modules/issues/CleanupOverlay.js
@@ -1,7 +1,8 @@
( function ( M ) {
var Overlay = M.require( 'Overlay' ),
- Icon = M.require( 'Icon' ),
- icon = new Icon( { name: 'cleanup-gray', additionalClassNames:
'issue-notice', hasText: true } ),
+ Icon = M.require( 'Icon' ),
+ icon = new Icon( { name: 'cleanup-gray', additionalClassNames:
'issue-notice', hasText: true } ),
+ CleanupOverlay;
/**
* Overlay for displaying page issues
diff --git a/javascripts/modules/issues/init.js
b/javascripts/modules/issues/init.js
index ee550c4..9a5a08c 100644
--- a/javascripts/modules/issues/init.js
+++ b/javascripts/modules/issues/init.js
@@ -41,7 +41,8 @@
if ( $this.find( selector ).length === 0 ) {
// FIXME: [templates] might be
inconsistent
content = inBeta ? extractMessage(
$this ) :
- $this.find(
'.mbox-text, .ambox-text' ).html();
+ $this.find( '.mbox-text,
.ambox-text' ).html();
+
issue = {
// .ambox- is used e.g. on
eswiki
text: content
diff --git a/javascripts/modules/lastEdited/init.js
b/javascripts/modules/lastEdited/init.js
index 76611d9..7291051 100644
--- a/javascripts/modules/lastEdited/init.js
+++ b/javascripts/modules/lastEdited/init.js
@@ -32,17 +32,19 @@
args = args.concat( [
'mobile-frontend-last-modified-with-user-just-now', gender, username ] );
} else {
args = args.concat( [ keys[ delta.unit ],
gender, username,
- mw.language.convertNumber(
delta.value ) ] );
+ mw.language.convertNumber( delta.value )
+ ] );
}
if ( time.isRecent( delta ) ) {
$lastModified.addClass( 'active' );
}
args = args.concat( [ historyUrl,
- // Abuse PLURAL support to determine if
the user is anonymous or not
- mw.language.convertNumber( username ? 1
: 0 ),
- // I'll abuse of PLURAL support means
we have to pass the relative URL rather than construct it from a wikilink
- username ? mw.util.getUrl(
'Special:UserProfile/' + username ) : '' ] );
+ // Abuse PLURAL support to determine if the
user is anonymous or not
+ mw.language.convertNumber( username ? 1 : 0 ),
+ // I'll abuse of PLURAL support means we have
to pass the relative URL rather than construct it from a wikilink
+ username ? mw.util.getUrl(
'Special:UserProfile/' + username ) : ''
+ ] );
$( '<div>' ).attr( 'id', 'mw-mf-last-modified' )
.attr( 'class', $lastModified.attr( 'class' ) )
diff --git a/javascripts/modules/notifications/NotificationsOverlay.js
b/javascripts/modules/notifications/NotificationsOverlay.js
index 97319f7..c17d57a 100644
--- a/javascripts/modules/notifications/NotificationsOverlay.js
+++ b/javascripts/modules/notifications/NotificationsOverlay.js
@@ -9,104 +9,104 @@
* @extend Overlay
*/
NotificationsOverlay = Overlay.extend( {
- active: false,
- className: 'overlay notifications-overlay
navigation-drawer',
- templatePartials: {
- content: mw.template.get(
'mobile.notifications.overlay', 'content.hogan' ),
- footer: mw.template.get( 'mobile.overlays',
'OverlayFooterLink.hogan' )
- },
- defaults: {
- heading: mw.msg( 'notifications' ),
- link: mw.util.getUrl( 'Special:Notifications' ),
- linkMsg: mw.msg( 'echo-overlay-link' ),
- linkClass: 'notifications-archive-link'
- },
- onError: function () {
- // Fall back to notifications archive page.
- window.location.href = this.$badge.attr( 'href'
);
- },
- markAsRead: function () {
- this.$badge.find( 'span' ).remove();
- },
- initialize: function ( options ) {
- var self = this;
- Overlay.prototype.initialize.apply( this,
options );
- // Anchor tag that corresponds to a
notifications badge
- this.$badge = options.$badge;
- // On error use the url as a fallback
- if ( options.error ) {
- this.onError();
- } else {
- api.get( {
- action: 'query',
- meta: 'notifications',
- notformat: 'flyout',
- notprop: 'index|list|count',
- uselang: 'user'
- } ).done( function ( result ) {
- var notifications;
- if ( result.query &&
result.query.notifications ) {
- notifications = $.map(
result.query.notifications.list, function ( a ) {
- return {
message: a['*'], timestamp: a.timestamp.mw };
- } ).sort( function ( a,
b ) {
- return
a.timestamp < b.timestamp ? 1 : -1;
- } );
- if (
notifications.length ) {
-
options.notifications = notifications;
- } else {
-
options.errorMessage = mw.msg( 'echo-none' );
- }
-
- self.render( options );
- self.$(
'.mw-echo-notification' ).each( function () {
- var
$notification = $( this ),
-
$primaryLink = $notification.find( '.mw-echo-notification-primary-link' );
- // If there is
a primary link, make the entire notification clickable.
- if (
$primaryLink.length ) {
-
$notification.addClass( 'mw-echo-linked-notification' );
-
$notification.on( 'click', function () {
-
window.location.href = $primaryLink.attr( 'href' );
- } );
- }
- // Set up event
logging for each notification
-
mw.echo.setupNotificationLogging( $notification, 'mobile-overlay', true );
- } );
- // Only fire 'mark as
read' API call when unread notification
- // count is not zero.
Question: why does this fire an API call
- // for 'mark all as
read', the overlay may not load all unread
- // notifications
- if (
result.query.notifications.rawcount !== 0 ) {
-
self.markAllAsRead();
- }
+ active: false,
+ className: 'overlay notifications-overlay navigation-drawer',
+ templatePartials: {
+ content: mw.template.get(
'mobile.notifications.overlay', 'content.hogan' ),
+ footer: mw.template.get( 'mobile.overlays',
'OverlayFooterLink.hogan' )
+ },
+ defaults: {
+ heading: mw.msg( 'notifications' ),
+ link: mw.util.getUrl( 'Special:Notifications' ),
+ linkMsg: mw.msg( 'echo-overlay-link' ),
+ linkClass: 'notifications-archive-link'
+ },
+ onError: function () {
+ // Fall back to notifications archive page.
+ window.location.href = this.$badge.attr( 'href' );
+ },
+ markAsRead: function () {
+ this.$badge.find( 'span' ).remove();
+ },
+ initialize: function ( options ) {
+ var self = this;
+ Overlay.prototype.initialize.apply( this, options );
+ // Anchor tag that corresponds to a notifications badge
+ this.$badge = options.$badge;
+ // On error use the url as a fallback
+ if ( options.error ) {
+ this.onError();
+ } else {
+ api.get( {
+ action: 'query',
+ meta: 'notifications',
+ notformat: 'flyout',
+ notprop: 'index|list|count',
+ uselang: 'user'
+ } ).done( function ( result ) {
+ var notifications;
+ if ( result.query &&
result.query.notifications ) {
+ notifications = $.map(
result.query.notifications.list, function ( a ) {
+ return { message:
a['*'], timestamp: a.timestamp.mw };
+ } ).sort( function ( a, b ) {
+ return a.timestamp <
b.timestamp ? 1 : -1;
+ } );
+ if ( notifications.length ) {
+ options.notifications =
notifications;
} else {
- self.onError();
+ options.errorMessage =
mw.msg( 'echo-none' );
}
- } ).fail( function () {
- self.onError();
- } );
- }
- },
- markAllAsRead: function () {
- api.getTokenWithEndpoint( 'edit' ).done(
function ( token ) {
- api.post( {
- action: 'echomarkread',
- all: true,
- token: token
- } );
- } );
- },
- preRender: function ( options ) {
- options.heading = '<strong>' + mw.msg(
'notifications' ) + '</strong>';
- },
- postRender: function ( options ) {
- Overlay.prototype.postRender.apply( this,
options );
- if ( options.notifications ||
options.errorMessage ) {
- this.$( '.loading' ).remove();
- // Reset the badge
- this.markAsRead();
- }
+ self.render( options );
+ self.$( '.mw-echo-notification'
).each( function () {
+ var $notification = $(
this ),
+ $primaryLink =
$notification.find( '.mw-echo-notification-primary-link' );
+ // If there is a
primary link, make the entire notification clickable.
+ if (
$primaryLink.length ) {
+
$notification.addClass( 'mw-echo-linked-notification' );
+
$notification.on( 'click', function () {
+
window.location.href = $primaryLink.attr( 'href' );
+ } );
+ }
+ // Set up event logging
for each notification
+
mw.echo.setupNotificationLogging( $notification, 'mobile-overlay', true );
+ } );
+ // Only fire 'mark as read' API
call when unread notification
+ // count is not zero.
Question: why does this fire an API call
+ // for 'mark all as read', the
overlay may not load all unread
+ // notifications
+ if (
result.query.notifications.rawcount !== 0 ) {
+ self.markAllAsRead();
+ }
+ } else {
+ self.onError();
+ }
+ } ).fail( function () {
+ self.onError();
+ } );
}
+ },
+ markAllAsRead: function () {
+ api.getTokenWithEndpoint( 'edit' ).done( function (
token ) {
+ api.post( {
+ action: 'echomarkread',
+ all: true,
+ token: token
+ } );
+ } );
+ },
+ preRender: function ( options ) {
+ options.heading = '<strong>' + mw.msg( 'notifications'
) + '</strong>';
+ },
+ postRender: function ( options ) {
+ Overlay.prototype.postRender.apply( this, options );
+
+ if ( options.notifications || options.errorMessage ) {
+ this.$( '.loading' ).remove();
+ // Reset the badge
+ this.markAsRead();
+ }
+ }
} );
M.define( 'modules/notifications/NotificationsOverlay',
NotificationsOverlay );
diff --git a/javascripts/modules/notifications/notifications.js
b/javascripts/modules/notifications/notifications.js
index ec53588..48a76a0 100644
--- a/javascripts/modules/notifications/notifications.js
+++ b/javascripts/modules/notifications/notifications.js
@@ -14,7 +14,7 @@
* FIXME: Upstream to mw.mobileFrontend and reuse elsewhere
* @param {string} moduleName: Name of a module to fetch
* @returns {jQuery.Deferred}
- */
+ */
function loadModuleScript( moduleName ) {
var d = $.Deferred(),
$spinner = $( icons.spinner().toHtmlString() );
diff --git a/javascripts/modules/preferredLanguages/init.js
b/javascripts/modules/preferredLanguages/init.js
index e81e0f1..08b30ba 100644
--- a/javascripts/modules/preferredLanguages/init.js
+++ b/javascripts/modules/preferredLanguages/init.js
@@ -1,5 +1,5 @@
// When set orders LanguageOverlay list of languages by most frequently chosen
-( function ( M, $ ) {
+( function ( M, $ ) {
var supported = M.supportsLocalStorage,
settings = M.require( 'settings' ),
langMap = settings.get( 'langMap' ),
diff --git a/javascripts/modules/wikigrok/WikiGrokAbTest.js
b/javascripts/modules/wikigrok/WikiGrokAbTest.js
index 5d3f786..0461149 100644
--- a/javascripts/modules/wikigrok/WikiGrokAbTest.js
+++ b/javascripts/modules/wikigrok/WikiGrokAbTest.js
@@ -58,4 +58,4 @@
M.define( 'WikiGrokAbTest', WikiGrokAbTest );
-} ( mw.mobileFrontend, mw ) );
+}( mw.mobileFrontend, mw ) );
diff --git a/javascripts/user.js b/javascripts/user.js
index aaf403b..a2d2299 100644
--- a/javascripts/user.js
+++ b/javascripts/user.js
@@ -5,7 +5,7 @@
* Utility library for looking up details on the current user
* @class user
* @singleton
- */
+ */
user = {
/* @see mediaWiki.user */
tokens: mw.user.tokens,
--
To view, visit https://gerrit.wikimedia.org/r/174148
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I935dd7e941c67f5dad4a18de14febc2068ec7b06
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Jdlrobson <[email protected]>
Gerrit-Reviewer: Awjrichards <[email protected]>
Gerrit-Reviewer: Bmansurov <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits