Remove disabling of max-len rule and fix violations

Change-Id: I39ec2e572e569a05c11929dd17241653abf954ef
This commit is contained in:
Niklas Laxström
2018-12-15 13:49:51 +01:00
committed by jenkins-bot
parent 4dc988f6b9
commit e93e1bc845
3 changed files with 53 additions and 56 deletions

View File

@@ -6,8 +6,5 @@
"globals": {
"mw": false,
"OO": false
},
"rules": {
"max-len": 0
}
}

View File

@@ -655,19 +655,17 @@
* modules.
*/
apply: function () {
var displaySettings = this;
if ( !displaySettings.dirty ) {
if ( !this.dirty ) {
// No changes to save in this module.
return;
}
displaySettings.$parent.setBusy( true );
this.$parent.setBusy( true );
// Save the preferences
mw.webfonts.preferences.save( function ( result ) {
var newWebfontsEnable, oldWebfontsEnable, webfontsEvent,
newRegistry = mw.webfonts.preferences.registry,
oldRegistry = displaySettings.savedRegistry.registry,
oldRegistry = this.savedRegistry.registry,
newFonts = newRegistry.fonts || {},
oldFonts = oldRegistry.fonts || {};
@@ -684,25 +682,25 @@
mw.hook( webfontsEvent ).fire( 'displaysettings' );
}
if ( newFonts[ displaySettings.uiLanguage ] !== oldFonts[ displaySettings.uiLanguage ] ) {
if ( newFonts[ this.uiLanguage ] !== oldFonts[ this.uiLanguage ] ) {
mw.hook( 'mw.uls.font.change' ).fire(
'interface', displaySettings.uiLanguage, newFonts[ displaySettings.uiLanguage ]
'interface', this.uiLanguage, newFonts[ this.uiLanguage ]
);
}
if ( newFonts[ displaySettings.contentLanguage ] !== oldFonts[ displaySettings.contentLanguage ] ) {
if ( newFonts[ this.contentLanguage ] !== oldFonts[ this.contentLanguage ] ) {
mw.hook( 'mw.uls.font.change' ).fire(
'content', displaySettings.contentLanguage, newFonts[ displaySettings.contentLanguage ]
'content', this.contentLanguage, newFonts[ this.contentLanguage ]
);
}
// closure for not losing the scope
displaySettings.onSave( result );
displaySettings.dirty = false;
this.onSave( result );
this.dirty = false;
// Update the back-up preferences for the case of canceling
displaySettings.savedRegistry = $.extend( true, {}, mw.webfonts.preferences );
displaySettings.$parent.setBusy( false );
} );
this.savedRegistry = $.extend( true, {}, mw.webfonts.preferences );
this.$parent.setBusy( false );
}.bind( this ) );
},
/**

View File

@@ -272,47 +272,49 @@
if ( !languagesettings.shown ) {
mw.hook( 'mw.uls.settings.open' ).fire( eventParams && eventParams.source || 'interlanguage' );
}
} else {
// Initialize the Language settings window
languageSettingsOptions = {
defaultModule: 'display',
onVisible: function () {
var caretRadius,
ulsTriggerHeight = this.$element.height(),
ulsTriggerWidth = this.$element[ 0 ].offsetWidth,
ulsTriggerOffset = this.$element.offset();
this.$window.addClass( 'callout' );
// Same as border width in mixins.less, or near enough
caretRadius = 12;
if ( ulsTriggerOffset.left > $( window ).width() / 2 ) {
this.left = ulsTriggerOffset.left - this.$window.width() - caretRadius;
this.$window.removeClass( 'selector-left' ).addClass( 'selector-right' );
} else {
this.left = ulsTriggerOffset.left + ulsTriggerWidth + caretRadius;
this.$window.removeClass( 'selector-right' ).addClass( 'selector-left' );
}
// The top of the dialog is aligned in relation to
// the middle of the trigger, so that middle of the
// caret aligns with it. 16 is trigger icon height in pixels
this.top = ulsTriggerOffset.top +
( ulsTriggerHeight / 2 ) -
( caretRadius + 16 );
this.position();
}
};
mw.loader.using( mw.uls.languageSettingsModules, function () {
$ulsTrigger.languagesettings( languageSettingsOptions ).click();
} );
e.stopPropagation();
return;
}
// Initialize the Language settings window
languageSettingsOptions = {
defaultModule: 'display',
onVisible: function () {
var caretRadius,
ulsTriggerHeight = this.$element.height(),
ulsTriggerWidth = this.$element[ 0 ].offsetWidth,
ulsTriggerOffset = this.$element.offset();
this.$window.addClass( 'callout' );
// Same as border width in mixins.less, or near enough
caretRadius = 12;
if ( ulsTriggerOffset.left > $( window ).width() / 2 ) {
this.left = ulsTriggerOffset.left - this.$window.width() - caretRadius;
this.$window.removeClass( 'selector-left' ).addClass( 'selector-right' );
} else {
this.left = ulsTriggerOffset.left + ulsTriggerWidth + caretRadius;
this.$window.removeClass( 'selector-right' ).addClass( 'selector-left' );
}
// The top of the dialog is aligned in relation to
// the middle of the trigger, so that middle of the
// caret aligns with it. 16 is trigger icon height in pixels
this.top = ulsTriggerOffset.top +
( ulsTriggerHeight / 2 ) -
( caretRadius + 16 );
this.position();
}
};
mw.loader.using( mw.uls.languageSettingsModules, function () {
$ulsTrigger.languagesettings( languageSettingsOptions ).click();
} );
e.stopPropagation();
};
} else if ( anonMode ) {
clickHandler = function ( e, eventParams ) {