c1d97fe834
Change-Id: Id35fb62915e8067deaa1eb412ab3cb9d9353b9e8
25 lines
673 B
JavaScript
25 lines
673 B
JavaScript
/* eslint-disable no-jquery/no-global-selector */
|
|
module.exports = function () {
|
|
mw.loader.using( [ 'ext.uls.interface' ] ).then( () => {
|
|
const mobileMediaQuery = window.matchMedia( 'screen and (max-width: 550px)' ),
|
|
$ULSTrigger = $( '#pt-uls' );
|
|
let ULSMoved = false;
|
|
|
|
function moveULS() {
|
|
if ( $ULSTrigger.length ) {
|
|
if ( !ULSMoved && mobileMediaQuery.matches ) {
|
|
$ULSTrigger.insertBefore( $( '#pt-preferences' ) );
|
|
|
|
ULSMoved = true;
|
|
} else if ( ULSMoved && !mobileMediaQuery.matches ) {
|
|
$ULSTrigger.prepend( $( '#p-preferences' ) );
|
|
|
|
ULSMoved = false;
|
|
}
|
|
}
|
|
}
|
|
|
|
$( window ).on( 'resize', moveULS );
|
|
moveULS();
|
|
} );
|
|
};
|