Set the position of display settings to match ULS
Bug: 47822 Change-Id: I7b04a831b2c5d7932564a3cdde94be0e233f7a7b
This commit is contained in:
committed by
Siebrand
parent
e9fc82574c
commit
07465bf20c
@@ -297,6 +297,18 @@
|
|||||||
.data( 'i18n', 'ext-uls-display-settings-ui-language' )
|
.data( 'i18n', 'ext-uls-display-settings-ui-language' )
|
||||||
.i18n();
|
.i18n();
|
||||||
},
|
},
|
||||||
|
onVisible: function () {
|
||||||
|
var $parent = $( '#language-settings-dialog' );
|
||||||
|
|
||||||
|
// Re-position the element according to the window that called it
|
||||||
|
this.top = $parent.css( 'top' );
|
||||||
|
this.left = $parent.css( 'left' );
|
||||||
|
this.$menu.css( this.position() );
|
||||||
|
|
||||||
|
this.$menu.find( '.caret-before, .caret-after' ).css( 'top',
|
||||||
|
this.$menu.find( '.row' ).height()
|
||||||
|
);
|
||||||
|
},
|
||||||
onSelect: function ( langCode ) {
|
onSelect: function ( langCode ) {
|
||||||
displaySettings.enableApplyButton();
|
displaySettings.enableApplyButton();
|
||||||
displaySettings.uiLanguage = langCode;
|
displaySettings.uiLanguage = langCode;
|
||||||
@@ -311,6 +323,15 @@
|
|||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
|
|
||||||
|
// If the ULS is shown in the the sidebar,
|
||||||
|
// add a caret pointing to the icon
|
||||||
|
if ( mw.config.get( 'wgULSPosition' ) === 'interlanguage' ) {
|
||||||
|
$moreLanguagesButton.data( 'uls' ).$menu.prepend(
|
||||||
|
$( '<span>' ).addClass( 'caret-before' ),
|
||||||
|
$( '<span>' ).addClass( 'caret-after' )
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
$moreLanguagesButton.on( 'click', function () {
|
$moreLanguagesButton.on( 'click', function () {
|
||||||
displaySettings.$parent.hide();
|
displaySettings.$parent.hide();
|
||||||
} );
|
} );
|
||||||
|
|||||||
@@ -318,6 +318,18 @@
|
|||||||
.data( 'i18n', 'ext-uls-input-settings-ui-language' )
|
.data( 'i18n', 'ext-uls-input-settings-ui-language' )
|
||||||
.i18n();
|
.i18n();
|
||||||
},
|
},
|
||||||
|
onVisible: function () {
|
||||||
|
var $parent = $( '#language-settings-dialog' );
|
||||||
|
|
||||||
|
// Re-position the element according to the window that called it
|
||||||
|
this.top = $parent.css( 'top' );
|
||||||
|
this.left = $parent.css( 'left' );
|
||||||
|
this.$menu.css( this.position() );
|
||||||
|
|
||||||
|
this.$menu.find( '.caret-before, .caret-after' ).css( 'top',
|
||||||
|
this.$menu.find( '.row' ).height()
|
||||||
|
);
|
||||||
|
},
|
||||||
onSelect: function ( langCode ) {
|
onSelect: function ( langCode ) {
|
||||||
inputSettings.enableApplyButton();
|
inputSettings.enableApplyButton();
|
||||||
inputSettings.imeLanguage = langCode;
|
inputSettings.imeLanguage = langCode;
|
||||||
@@ -329,6 +341,13 @@
|
|||||||
lazyload: false
|
lazyload: false
|
||||||
} );
|
} );
|
||||||
|
|
||||||
|
if ( mw.config.get( 'wgULSPosition' ) === 'interlanguage' ) {
|
||||||
|
$moreLanguagesButton.data( 'uls' ).$menu.prepend(
|
||||||
|
$( '<span>' ).addClass( 'caret-before' ),
|
||||||
|
$( '<span>' ).addClass( 'caret-after' )
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
$moreLanguagesButton.on( 'click', function () {
|
$moreLanguagesButton.on( 'click', function () {
|
||||||
inputSettings.$parent.hide();
|
inputSettings.$parent.hide();
|
||||||
} );
|
} );
|
||||||
|
|||||||
@@ -166,6 +166,7 @@
|
|||||||
var scrollPosition,
|
var scrollPosition,
|
||||||
$currentMenu,
|
$currentMenu,
|
||||||
ulsHeight, ulsTop, ulsBottom,
|
ulsHeight, ulsTop, ulsBottom,
|
||||||
|
correctedPosition,
|
||||||
$languageSettingsTrigger = this.$menu.find( '#display-settings-block' ),
|
$languageSettingsTrigger = this.$menu.find( '#display-settings-block' ),
|
||||||
padding = 10,
|
padding = 10,
|
||||||
$window = $( window ),
|
$window = $( window ),
|
||||||
@@ -180,7 +181,9 @@
|
|||||||
this.left = rtlPage ?
|
this.left = rtlPage ?
|
||||||
ulsTriggerOffset.left - 22 - this.$menu.width() :
|
ulsTriggerOffset.left - 22 - this.$menu.width() :
|
||||||
ulsTriggerOffset.left + 50;
|
ulsTriggerOffset.left + 50;
|
||||||
this.$menu.css( this.position() );
|
|
||||||
|
correctedPosition = this.position();
|
||||||
|
this.$menu.css( correctedPosition );
|
||||||
|
|
||||||
// Show the Display settings panel:
|
// Show the Display settings panel:
|
||||||
// We are using the ULS trigger in the sidebar,
|
// We are using the ULS trigger in the sidebar,
|
||||||
@@ -189,7 +192,7 @@
|
|||||||
$languageSettingsTrigger.click();
|
$languageSettingsTrigger.click();
|
||||||
|
|
||||||
$currentMenu = $( '.uls-menu:visible' );
|
$currentMenu = $( '.uls-menu:visible' );
|
||||||
$currentMenu.css( this.position() );
|
$currentMenu.css( correctedPosition );
|
||||||
ulsHeight = $currentMenu.height();
|
ulsHeight = $currentMenu.height();
|
||||||
ulsTop = $currentMenu.offset().top;
|
ulsTop = $currentMenu.offset().top;
|
||||||
ulsBottom = ulsTop + ulsHeight;
|
ulsBottom = ulsTop + ulsHeight;
|
||||||
@@ -216,7 +219,6 @@
|
|||||||
$currentMenu.find( '.caret-before, .caret-after' ).css( 'top',
|
$currentMenu.find( '.caret-before, .caret-after' ).css( 'top',
|
||||||
$currentMenu.find( '.row' ).height()
|
$currentMenu.find( '.row' ).height()
|
||||||
);
|
);
|
||||||
|
|
||||||
};
|
};
|
||||||
} else if ( anonMode ) {
|
} else if ( anonMode ) {
|
||||||
ulsOptions.onVisible = function () {
|
ulsOptions.onVisible = function () {
|
||||||
|
|||||||
Reference in New Issue
Block a user