Jump to content

User:Ochaochaocha3/MODIFY THE MAIN MENU (MobileFrontend)

From mediawiki.org

A protocol for modifying the main menu of Mobilefrontend. It is cited from Topic:Tiggc18fvd3stmsf.

Protocol for modifying the main menu

[edit]

Edit includes/skins/SkinMinerva.php

[edit]

For anyone interested in an personal change of the menu edit includes/skins/SkinMinerva.php

find

protected function getDiscoveryTools()

find the line

// Nearby link (if supported)

add above this line

$menu->insert( 'Upload' )
	->addComponent(
		$this->msg( 'mobile-frontend-upload-button' )->escaped(),
		SpecialPage::getTitleFor( 'Upload',
			MWNamespace::getCanonicalName( $config->get( 'MFContentNamespace' ) ) )->getLocalUrl() .
				'#/test',
		MobileUI::iconClass( 'mf-upload-invert', 'before' ),
		[
			'id' => 'uploadButton',
			'data-event-name' => 'upload',
		]
	);

$menu->insert( 'ListImages' )
	->addComponent(
		$this->msg( 'mobile-frontend-listimages-button' )->escaped(),
		SpecialPage::getTitleFor( 'ListFiles',
			MWNamespace::getCanonicalName( $config->get( 'MFContentNamespace' ) ) )->getLocalUrl() .
				'#/test',
		MobileUI::iconClass( 'mf-listimages-invert', 'before' ),
		[
			'id' => 'listimagesButton',
			'data-event-name' => 'ListImages',
		]
	);

Edit translation files

[edit]

edit i18n/en.json[1]

find the line

"mobile-frontend-random-button": "Random",

add below

"mobile-frontend-upload-button": "Upload",
"mobile-frontend-listimages-button": "List Images",

Edit extension.json

[edit]

edit extension.json

find the line

"mobile.mainMenu.icons": {

find section

"images": {
	"anonymous": "resources/mobile.mainMenu.icons/anonymous.svg",

add below this line

"upload": "resources/mobile.mainMenu.icons/upload.svg",
"listimages": "resources/mobile.mainMenu.icons/listimages.svg",

Add icons

[edit]

allocate the folder resources/mobile.mainMenu.icons

add in resources/mobile.mainMenu.icons the required 2 new svg files with the desired icon

  • upload.svg
  • listimages.svg

Test

[edit]

i have tested this modification at twh4u.ddns.net

Footnotes

[edit]
  1. For the Japanese menu, edit i18n/ja.json.