Remove MobileFrontend's font changing code from Minerva

Fontchanger code now runs on all skins under the `mobile` target.
All the code will now live in MobileFrontend meaning developers
can operate inside one code base.

Depends-On: I857cfe2d9be9fe49c04c860bc234384c787239b2
Change-Id: I2759455cb6d7ddf13798e94452cb74baf502bafe
This commit is contained in:
jdlrobson 2017-10-27 12:21:44 -04:00 committed by Jdlrobson
parent 5cb46fe9d2
commit d3318a9f85
5 changed files with 3 additions and 39 deletions

View file

@ -137,8 +137,6 @@ class MinervaHooks {
=> $mobileContext->isBetaGroupMember(), => $mobileContext->isBetaGroupMember(),
SkinMinerva::OPTION_CATEGORIES SkinMinerva::OPTION_CATEGORIES
=> $mobileContext->getConfigVariable( 'MinervaShowCategoriesButton' ), => $mobileContext->getConfigVariable( 'MinervaShowCategoriesButton' ),
SkinMinerva::OPTION_FONT_CHANGER
=> $mobileContext->getConfigVariable( 'MinervaEnableFontChanger' ),
SkinMinerva::OPTION_BACK_TO_TOP SkinMinerva::OPTION_BACK_TO_TOP
=> $mobileContext->getConfigVariable( 'MinervaEnableBackToTop' ), => $mobileContext->getConfigVariable( 'MinervaEnableBackToTop' ),
SkinMinerva::OPTION_TOGGLING => true, SkinMinerva::OPTION_TOGGLING => true,

View file

@ -15,7 +15,6 @@ class SkinMinerva extends SkinTemplate implements ICustomizableSkin {
/** Set of keys for available skin options. See $skinOptions. */ /** Set of keys for available skin options. See $skinOptions. */
const OPTION_MOBILE_OPTIONS = 'mobileOptionsLink'; const OPTION_MOBILE_OPTIONS = 'mobileOptionsLink';
const OPTION_CATEGORIES = 'categories'; const OPTION_CATEGORIES = 'categories';
const OPTION_FONT_CHANGER = 'fontChanger';
const OPTION_BACK_TO_TOP = 'backToTop'; const OPTION_BACK_TO_TOP = 'backToTop';
const OPTION_TOGGLING = 'toggling'; const OPTION_TOGGLING = 'toggling';
const OPTIONS_MOBILE_BETA = 'beta'; const OPTIONS_MOBILE_BETA = 'beta';
@ -76,8 +75,6 @@ class SkinMinerva extends SkinTemplate implements ICustomizableSkin {
self::OPTION_MOBILE_OPTIONS => false, self::OPTION_MOBILE_OPTIONS => false,
/** Whether a categories button should appear at the bottom of the skin. */ /** Whether a categories button should appear at the bottom of the skin. */
self::OPTION_CATEGORIES => false, self::OPTION_CATEGORIES => false,
/** Whether an option to change font size appears in Special:MobileOptions */
self::OPTION_FONT_CHANGER => false,
/** Whether a back to top button appears at the bottom of the view page */ /** Whether a back to top button appears at the bottom of the view page */
self::OPTION_BACK_TO_TOP => false, self::OPTION_BACK_TO_TOP => false,
/** Whether sections can be collapsed (requires MobileFrontend and MobileFormatter) */ /** Whether sections can be collapsed (requires MobileFrontend and MobileFormatter) */
@ -1347,10 +1344,6 @@ class SkinMinerva extends SkinTemplate implements ICustomizableSkin {
$modules[] = 'skins.minerva.categories'; $modules[] = 'skins.minerva.categories';
} }
if ( $this->getSkinOption( self::OPTION_FONT_CHANGER ) ) {
$modules[] = 'skins.minerva.fontchanger';
}
if ( $this->getSkinOption( self::OPTION_BACK_TO_TOP ) ) { if ( $this->getSkinOption( self::OPTION_BACK_TO_TOP ) ) {
$modules[] = 'skins.minerva.backtotop'; $modules[] = 'skins.minerva.backtotop';
} }

View file

@ -1,7 +0,0 @@
( function ( M, $ ) {
var userFontSize = mw.storage.get( 'userFontSize' );
if ( userFontSize !== '100' ) {
$( '.content p' ).css( 'font-size', userFontSize + '%' );
}
}( mw.mobileFrontend, jQuery ) );

View file

@ -471,18 +471,6 @@
"resources/skins.minerva.watchstar/init.js" "resources/skins.minerva.watchstar/init.js"
] ]
}, },
"skins.minerva.fontchanger": {
"targets": [
"mobile",
"desktop"
],
"dependencies": [
"mobile.startup"
],
"scripts": [
"resources/skins.minerva.fontchanger/init.js"
]
},
"skins.minerva.tablet.scripts": { "skins.minerva.tablet.scripts": {
"targets": [ "targets": [
"mobile", "mobile",
@ -516,10 +504,6 @@
"base": false, "base": false,
"beta": true "beta": true
}, },
"MinervaEnableFontChanger": {
"base": false,
"beta": true
},
"MinervaEnableBackToTop": { "MinervaEnableBackToTop": {
"base": false, "base": false,
"beta": true "beta": true

View file

@ -162,12 +162,11 @@ class SkinMinervaTest extends MediaWikiTestCase {
* *
* @covers ::getContextSpecificModules * @covers ::getContextSpecificModules
* @dataProvider provideGetContextSpecificModules * @dataProvider provideGetContextSpecificModules
* @param string $fontchangerValue whether font changer feature is enabled
* @param mixed $backToTopValue whether back to top feature is enabled * @param mixed $backToTopValue whether back to top feature is enabled
* @param string $moduleName Module name that is being tested * @param string $moduleName Module name that is being tested
* @param bool $expected Whether the module is expected to be returned by the function being tested * @param bool $expected Whether the module is expected to be returned by the function being tested
*/ */
public function testGetContextSpecificModules( $fontchangerValue, $backToTopValue, public function testGetContextSpecificModules( $backToTopValue,
$moduleName, $expected $moduleName, $expected
) { ) {
$skin = new SkinMinerva(); $skin = new SkinMinerva();
@ -177,7 +176,6 @@ class SkinMinervaTest extends MediaWikiTestCase {
$skin->setContext( $testContext ); $skin->setContext( $testContext );
$skin->setSkinOptions( [ $skin->setSkinOptions( [
'fontChanger' => $fontchangerValue,
'backToTop' => $backToTopValue, 'backToTop' => $backToTopValue,
] ); ] );
@ -190,10 +188,8 @@ class SkinMinervaTest extends MediaWikiTestCase {
public function provideGetContextSpecificModules() { public function provideGetContextSpecificModules() {
return [ return [
[ true, false, 'skins.minerva.fontchanger', true ], [ true, 'skins.minerva.backtotop', true ],
[ false, true, 'skins.minerva.fontchanger', false ], [ false, 'skins.minerva.backtotop', false ],
[ false, true, 'skins.minerva.backtotop', true ],
[ false, false, 'skins.minerva.backtotop', false ],
]; ];
} }