This page is a translated version of the page MoreMenu and the translation is 65% complete.

MoreMenu 是一個腳本,用於將“頁面”和“用戶”下拉菜單(如果適用)添加到工具欄。它是 Haza-w Drop-down menus 小工具的繼任者並深受其影響。

分析Jimbo Walse的贡献
最后更新于2023-07-25 (353 days ago)


小工具最多可向菜單欄添加兩個下拉菜單,包含指向常見任務、用戶/頁面日誌、分析工具/統計信息和管理員工具的鏈接。對於除special pages外所有頁面,頁面菜單是可見的。用戶菜單僅在與用戶相關的頁面上可見,包括投稿頁面


2022 Coolest Tool
Award Winner

in the category








If you are a user of the English Wikipedia, browse to your common.js and import the enwiki extension, which adds menu items for RfAs/RfBs and XfDs, where applicable.

mw.loader.using(['mediawiki.util', 'mediawiki.api'], function () {

Similar extensions can be added for any wiki, or may already exist on your wiki. See Customization below for more.


If you use the Vector skin, you prevent the tabs at the top ("Edit", "View history", etc.) from jumping around. For English users, add the following to the top of your global.css:

@import url('');

For non-English, replace the .en in the path to your desired language. See Special:PrefixIndex/MediaWiki:Gadget-MoreMenu-pagestyles for a list of supported languages. If your language is missing, let the maintainers know on the talk page.




  1. 创建MediaWiki:Gadget-MoreMenu-local.js并添加以下内容:
  2. 将以下内容添加到MediaWiki:Gadgets-definition
    * MoreMenu-local[ResourceLoader|dependencies=mediawiki.api,mediawiki.util,user.options]|MoreMenu-local.js
  3. MediaWiki:Gadget-MoreMenu-local为小工具添加描述 ,最好链接到这个页面([[meta:MoreMenu]]
  4. 可选:您可以设置同行小工具,以防菜单在Vector皮肤下页面加载时发生“跳动”。参见同行小工具获取更多信息。
  5. Optional: Extend MoreMenu by adding links that specific to your wiki, for example links to a user's Request for Adminship. Create MediaWiki:Gadget-MoreMenu.extension.js with your extension code, and modify your MediaWiki:Gadgets-definition to use it:
    <span id="Localization"></span>
    == 本地化 ==
    <div lang="en" dir="ltr" class="mw-content-ltr">
    Translations are pulled from <code>MediaWiki:Gadget-MoreMenu.messages.''lang''.js</code>, with [[MediaWiki:Gadget-MoreMenu.messages.en.js]] as the fallback. To add new translations, make a [[:Template:Edit Protected|protected edit request]] on the talk page, listing the key/value pairs of the messages. See [[Special:PrefixIndex/MediaWiki:Gadget-MoreMenu.messages]] for a list of currently supported languages.
    <div lang="en" dir="ltr" class="mw-content-ltr">
    Please submit changes to the English translations as a pull request on the [ GitHub repository].
    <span id="Customization"></span>
    == {{LC zh|C|zh-hans=自定义|zh-hant=自訂}} ==
    <span id="Options"></span>
    === 选项 ===
    * <code>MoreMenu.disableAutoRemoval</code> – <span lang="en" dir="ltr" class="mw-content-ltr">Don't automatically remove the native "More" menu when it's empty.</span>
    * <code>MoreMenu.prefillDeletionReason</code> – <span lang="en" dir="ltr" class="mw-content-ltr">Set to <code>false</code> to disable prefilling the deletion reason when clicking the Delete link.</span>
    <div lang="en" dir="ltr" class="mw-content-ltr">
    These options should be set at the top of your [[Special:MyPage/global.js|global.js]], like the following:
    <syntaxhighlight lang="javascript">
    MoreMenu = {
        disableAutoRemoval: true,

MoreMenu can be extended with custom links and functionality. Links should be added only after the moremenu.ready hook has been fired. See the examples below.


  • MoreMenu.addLink(menu, name, url, insertAfter)將鏈接添加到給定的菜單。
  • MoreMenu.addSubmenuLink(menu, submenu, name, url, insertAfter)將鏈接添加到給定的子菜單。


  • menuThe ID of the top-level menu under which to place the link. Either "user" or "page".
  • submenu — 要在其下放置链接的子菜单的 ID。例如,“分析”或“页面日志”。
  • nameThe title for the link. This can be either a raw string or a message key.
  • urlThe URL for the link. Use mw.util.getUrl() for internal links.
  • insertAfter (optional) — The ID of an existing link after which to place the link. You can use false to force the link to be put at the top, and true to force it to the bottom. Otherwise, if no link with the given ID is found, or this parameter is omitted entirely, the link will be placed into the menu alphabetically.


To add a link to under the "Page" menu, add the following code to your common.js page:

mw.hook('moremenu.ready').add(function (config) {
    // add more MoreMenu.addLink(); instances here...

The config object contains a lot of data. In most cases you want your link to contain the target username ( or the page name ( If these are external links, you may need to use the encoded names, as with config.targetUser.encodedName and See Configuration values for a list of all the available data.


mw.hook('moremenu.ready').add(function (config) {
        mw.util.getUrl('Special:PrefixIndex/Wikipedia:Requests for Adminship/' +
    // add more links here...

Now let's say you wanted to add a "RfXs" submenu, with links to RfAs, request for bureaucratship, etc., and only show these links if those pages exist. See Links to pages matching a pattern for how to do this!


主条目: MoreMenu/Advanced

In addition to MoreMenu.addLink() and MoreMenu.addSubmenuLink(), you can take advantage of the logic MoreMenu provides you in constructing your link based on some parameters, such as the user's permissions, or adding an entirely new submenu of links.

See MoreMenu/Advanced for more information.



When top-level menus are added in the Vector skin, the "Read", "Edit", and "View history" tabs will shift. This means that if you are working very quickly, you might accidentally click in the wrong place before MoreMenu finishes loading. To prevent this, you can use a peer gadget to keep the space available.

First, check Special:PrefixIndex/MediaWiki:Gadget-MoreMenu-pagestyles to see if there is CSS code for your language already that you can copy to your wiki. If there isn't, you'll need to calculate the widths. Once the gadget is enabled, you can run $('.mm-page').outerWidth() and $('.mm-user').outerWidth() to get the widths in pixels.

Once you have the widths, create MediaWiki:Gadget-MoreMenu-local-pagestyles.css with the following (in this case for English, and using em instead of px):

/*** VECTOR ***/

/* User menu */
.client-js .skin-vector.ns-2 #p-views,
.client-js .skin-vector.ns-3 #p-views,
.client-js > #p-views,
.client-js > #p-views,
.client-js > #p-views {
    padding-right: 3.68em;

/* Page menu */
.client-js .skin-vector:not(.ns-special) #p-views .vector-menu-content::after {
    content: '';
    display: inline-block;
    width: 3.85em;


* MoreMenu-local[ResourceLoader|dependencies=mediawiki.api,mediawiki.util,user.options|peers=MoreMenu-local-pagestyles]|MoreMenu-local.js
* MoreMenu-local-pagestyles[hidden]|MoreMenu-local-pagestyles.css