From ca53e721ab7a77253c61807712258c309acaf1d4 Mon Sep 17 00:00:00 2001 From: Isarra Date: Sun, 20 May 2018 10:29:50 +0000 Subject: [PATCH] Mobile - reorganise and clean up p-personal js dropdown * Reorder ULS and Echo links * Rename conditional module load hook to be more generic, and add ULS module * Remove .active bolding from dropdown Change-Id: I7e746e7c5af8ffd7c4ca06742ab1fe6bc94ba531 --- includes/SkinMonoBook.php | 19 +++++++++++++++++-- resources/mobile-echo.js | 3 ++- resources/mobile-uls.js | 22 ++++++++++++++++++++++ resources/screen-common.less | 4 ---- skin.json | 2 +- 5 files changed, 42 insertions(+), 8 deletions(-) create mode 100644 resources/mobile-uls.js diff --git a/includes/SkinMonoBook.php b/includes/SkinMonoBook.php index 506fc9f..52af886 100644 --- a/includes/SkinMonoBook.php +++ b/includes/SkinMonoBook.php @@ -57,6 +57,10 @@ class SkinMonoBook extends SkinTemplate { if ( ExtensionRegistry::getInstance()->isLoaded( 'Echo' ) && $out->getUser()->isLoggedIn() ) { $out->addModules( [ 'skins.monobook.mobile.echohack' ] ); } + if ( ExtensionRegistry::getInstance()->isLoaded( 'UniversalLanguageSelector' ) ) { + $out->addModules( [ 'skins.monobook.mobile.uls' ] ); + } + // TODO: Migrate all of these (get RL support for conditional IE) // Force desktop styles in IE 8-; no support for @media widths $out->addStyle( $this->stylename . '/resources/screen-desktop.css', 'screen', 'lt IE 9' ); @@ -67,11 +71,11 @@ class SkinMonoBook extends SkinTemplate { /** * Handler for ResourceLoaderRegisterModules hook + * Check if extensions are loaded * * @param ResourceLoader $resourceLoader */ - static function registerEchoHack( ResourceLoader $resourceLoader ) { - // Check if echo is loaded, and if so duplicate echo load check for hacks + static function registerMobileExtensionStyles( ResourceLoader $resourceLoader ) { if ( ExtensionRegistry::getInstance()->isLoaded( 'Echo' ) ) { $resourceLoader->register( 'skins.monobook.mobile.echohack', [ 'localBasePath' => __DIR__ . '/..', @@ -86,5 +90,16 @@ class SkinMonoBook extends SkinTemplate { 'messages' => [ 'monobook-notifications-link', 'monobook-notifications-link-none' ] ] ); } + + if ( ExtensionRegistry::getInstance()->isLoaded( 'UniversalLanguageSelector' ) ) { + $resourceLoader->register( 'skins.monobook.mobile.uls', [ + 'localBasePath' => __DIR__ . '/..', + 'remoteSkinPath' => 'MonoBook/resources', + + 'targets' => [ 'desktop', 'mobile' ], + 'scripts' => [ 'resources/mobile-uls.js' ], + 'dependencies' => [ 'ext.uls.interface' ], + ] ); + } } } diff --git a/resources/mobile-echo.js b/resources/mobile-echo.js index e6bdb9b..dbc1961 100644 --- a/resources/mobile-echo.js +++ b/resources/mobile-echo.js @@ -39,8 +39,9 @@ 'pt-notifications', $( '#pt-notifications-notice' ).attr( 'tooltip' ), null, - '#pt-userpage' + '#pt-preferences' ); + $( '#p-personal-toggle' ).append( $( '