Merge "Determine callout directionality based on position as opposed to language"
This commit is contained in:
@@ -157,7 +157,7 @@
|
|||||||
"ext.uls.common": {
|
"ext.uls.common": {
|
||||||
"targets": [ "desktop", "mobile" ],
|
"targets": [ "desktop", "mobile" ],
|
||||||
"scripts": "js/ext.uls.common.js",
|
"scripts": "js/ext.uls.common.js",
|
||||||
"styles": "css/ext.uls.css",
|
"styles": "css/ext.uls.less",
|
||||||
"skinStyles": {
|
"skinStyles": {
|
||||||
"monobook": "css/ext.uls-monobook.css"
|
"monobook": "css/ext.uls-monobook.css"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -16,25 +16,62 @@
|
|||||||
border-bottom-left-radius: 4px;
|
border-bottom-left-radius: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Caret */
|
||||||
.uls-menu.callout .caret-before,
|
.uls-menu.callout .caret-before,
|
||||||
.uls-menu.callout .caret-after {
|
.uls-menu.callout .caret-after {
|
||||||
border-top: 10px solid transparent;
|
border-top: 10px solid transparent;
|
||||||
border-right: 10px solid #c9c9c9;
|
|
||||||
border-bottom: 10px solid transparent;
|
border-bottom: 10px solid transparent;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
left: -11px;
|
|
||||||
/* 17px aligns nicely with the size of the search row in language selection */
|
/* 17px aligns nicely with the size of the search row in language selection */
|
||||||
top: 17px;
|
top: 17px;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
}
|
}
|
||||||
|
|
||||||
.uls-menu.callout .caret-after {
|
.uls-menu.callout .caret-after {
|
||||||
border-right: 10px solid #fcfcfc;
|
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
left: -10px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.uls-menu.callout--languageselection .caret-after {
|
// How do you do switch for flipping in less? These are very redundant.
|
||||||
|
.uls-menu.callout .caret-right {
|
||||||
|
.caret-before,
|
||||||
|
.caret-after {
|
||||||
|
/* @noflip */
|
||||||
|
border-left: 10px solid #c9c9c9;
|
||||||
|
/* @noflip */
|
||||||
|
right: -11px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.caret-after {
|
||||||
|
/* @noflip */
|
||||||
|
border-left: 10px solid #fcfcfc;
|
||||||
|
/* @noflip */
|
||||||
|
right: -10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
.uls-menu.callout--languageselection .caret-right .caret-after {
|
||||||
|
/* @noflip */
|
||||||
|
border-left: 10px solid #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.uls-menu.callout .caret-left {
|
||||||
|
.caret-before,
|
||||||
|
.caret-after {
|
||||||
|
/* @noflip */
|
||||||
|
border-right: 10px solid #c9c9c9;
|
||||||
|
/* @noflip */
|
||||||
|
left: -11px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.caret-after {
|
||||||
|
/* @noflip */
|
||||||
|
border-right: 10px solid #fcfcfc;
|
||||||
|
/* @noflip */
|
||||||
|
left: -10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
.uls-menu.callout--languageselection .caret-left .caret-after {
|
||||||
|
/* @noflip */
|
||||||
border-right: 10px solid #fff;
|
border-right: 10px solid #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -294,7 +294,6 @@
|
|||||||
var $triggers,
|
var $triggers,
|
||||||
$pLang,
|
$pLang,
|
||||||
$ulsTrigger = $( '.uls-trigger' ),
|
$ulsTrigger = $( '.uls-trigger' ),
|
||||||
rtlPage = $( 'body' ).hasClass( 'rtl' ),
|
|
||||||
anonMode = ( mw.user.isAnon() &&
|
anonMode = ( mw.user.isAnon() &&
|
||||||
!mw.config.get( 'wgULSAnonCanChangeLanguage' ) ),
|
!mw.config.get( 'wgULSAnonCanChangeLanguage' ) ),
|
||||||
ulsPosition = mw.config.get( 'wgULSPosition' );
|
ulsPosition = mw.config.get( 'wgULSPosition' );
|
||||||
@@ -337,6 +336,7 @@
|
|||||||
var caretRadius, caretPosition,
|
var caretRadius, caretPosition,
|
||||||
$caretBefore = $( '<span>' ).addClass( 'caret-before' ),
|
$caretBefore = $( '<span>' ).addClass( 'caret-before' ),
|
||||||
$caretAfter = $( '<span>' ).addClass( 'caret-after' ),
|
$caretAfter = $( '<span>' ).addClass( 'caret-after' ),
|
||||||
|
$caretWrapper = $( '<span>' ),
|
||||||
ulsTriggerHeight = this.$element.height(),
|
ulsTriggerHeight = this.$element.height(),
|
||||||
ulsTriggerWidth = this.$element.width(),
|
ulsTriggerWidth = this.$element.width(),
|
||||||
ulsTriggerOffset = this.$element.offset();
|
ulsTriggerOffset = this.$element.offset();
|
||||||
@@ -344,20 +344,24 @@
|
|||||||
// Add the callout caret triangle
|
// Add the callout caret triangle
|
||||||
// pointing to the trigger icon
|
// pointing to the trigger icon
|
||||||
this.$window.addClass( 'callout' );
|
this.$window.addClass( 'callout' );
|
||||||
this.$window.prepend( $caretBefore, $caretAfter );
|
this.$window.prepend( $caretWrapper.prepend( $caretBefore, $caretAfter ) );
|
||||||
|
|
||||||
// Calculate the positioning of the panel
|
// Calculate the positioning of the panel
|
||||||
// according to the position of the trigger icon
|
// according to the position of the trigger icon
|
||||||
|
|
||||||
caretRadius = parseInt( $caretBefore.css( 'border-top-width' ), 10 );
|
caretRadius = parseInt( $caretBefore.css( 'border-top-width' ), 10 );
|
||||||
if ( rtlPage ) {
|
|
||||||
|
if ( ulsTriggerOffset.left > ( this.$window.width() - caretRadius ) / 2 ) {
|
||||||
this.left = ulsTriggerOffset.left - this.$window.width() - caretRadius;
|
this.left = ulsTriggerOffset.left - this.$window.width() - caretRadius;
|
||||||
|
$caretWrapper.addClass( 'caret-right' );
|
||||||
|
caretPosition = $caretBefore.position();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
this.left = ulsTriggerOffset.left + ulsTriggerWidth + caretRadius;
|
this.left = ulsTriggerOffset.left + ulsTriggerWidth + caretRadius;
|
||||||
|
$caretWrapper.addClass( 'caret-left' );
|
||||||
|
caretPosition = $caretAfter.position();
|
||||||
}
|
}
|
||||||
|
|
||||||
caretPosition = $caretBefore.position();
|
|
||||||
|
|
||||||
// The top of the dialog is aligned in relation to
|
// The top of the dialog is aligned in relation to
|
||||||
// the middle of the trigger, so that middle of the
|
// the middle of the trigger, so that middle of the
|
||||||
// caret aligns with it. 2 is for border and margin.
|
// caret aligns with it. 2 is for border and margin.
|
||||||
|
|||||||
Reference in New Issue
Block a user