Undo tooltip: position when shown, not when created
Especially on Special:CX, where page layout changes soon after load (for example scrollbars get added when more content loads), the tooltip would be positioned incorrectly. Now it is more likely to be positioned correctly, and will get re-positioned again if it is shown again after being hidden. Bug: T145483 Change-Id: I527fc62b196e55101950cffcc6ec43926f63aa4a
This commit is contained in:
committed by
Nikerabbit
parent
91e4a564d4
commit
41f9a6f994
@@ -196,7 +196,7 @@
|
|||||||
* It also allows to undo the language selection.
|
* It also allows to undo the language selection.
|
||||||
*/
|
*/
|
||||||
function showUndoTooltip( previousLang, previousAutonym ) {
|
function showUndoTooltip( previousLang, previousAutonym ) {
|
||||||
var $ulsTrigger, ulsPopup, offset,
|
var $ulsTrigger, ulsPopup,
|
||||||
ulsPosition = mw.config.get( 'wgULSPosition' );
|
ulsPosition = mw.config.get( 'wgULSPosition' );
|
||||||
|
|
||||||
$ulsTrigger = ( ulsPosition === 'interlanguage' ) ?
|
$ulsTrigger = ( ulsPosition === 'interlanguage' ) ?
|
||||||
@@ -208,7 +208,14 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function showTipsy( timeout ) {
|
function showTipsy( timeout ) {
|
||||||
var tipsyTimer = 0;
|
var offset, tipsyTimer = 0;
|
||||||
|
|
||||||
|
// Position popup
|
||||||
|
offset = $ulsTrigger.offset();
|
||||||
|
ulsPopup.$element.css( {
|
||||||
|
top: offset.top + 24,
|
||||||
|
left: offset.left + $ulsTrigger.outerWidth() / 2
|
||||||
|
} );
|
||||||
|
|
||||||
ulsPopup.toggle( true );
|
ulsPopup.toggle( true );
|
||||||
ulsPopup.toggleClipping( false );
|
ulsPopup.toggleClipping( false );
|
||||||
@@ -276,12 +283,7 @@
|
|||||||
}() )
|
}() )
|
||||||
} );
|
} );
|
||||||
|
|
||||||
// Position popup
|
ulsPopup.$element.appendTo( 'body' );
|
||||||
offset = $ulsTrigger.offset();
|
|
||||||
ulsPopup.$element.css( {
|
|
||||||
top: offset.top + 24,
|
|
||||||
left: offset.left + $ulsTrigger.outerWidth() / 2
|
|
||||||
} ).appendTo( 'body' );
|
|
||||||
|
|
||||||
// The interlanguage position needs some time to settle down
|
// The interlanguage position needs some time to settle down
|
||||||
window.setTimeout( function () {
|
window.setTimeout( function () {
|
||||||
|
|||||||
Reference in New Issue
Block a user