2023年政策修订增补工作正在进行中,欢迎参与!
  • Moegirl.ICU:萌娘百科流亡社群 581077156(QQ),欢迎对萌娘百科运营感到失望的编辑者加入
  • Moegirl.ICU:账号认领正在试运行,有意者请参照账号认领流程

Help:Popups小工具

萌娘百科,万物皆可萌的百科全书!转载请标注来源页面的网页链接,并声明引自萌娘百科。内容不可商用。
跳转到导航 跳转到搜索
Circle-icons-tools-light blue.svg
这个页面“Help:Popups小工具”是萌娘百科的小工具说明文档

Navigation popups 是一個可在将光标悬停在链接上时出现的弹出窗口中轻松访问文章预览的小工具。它不应与一般的頁面預覽混淆,后者是所有用户无需開啟即可拥有的默认的、更以读者为中心的預覽窗口。

该工具引自enwp:MediaWiki:Gadget-popups.js,萌百对该版本进行了修改,以适应萌百环境。

功能

  • 鼠标悬停于条目(或用户页)上:
    • 当鼠标悬停在一个条目链接时,可预览条目前一部分的文本
    • 预览条目的第一张图片
    • 预览所指向页面的信息,包括页面大小、链接数、所含图像和分类的数目,以及页面建立至今的时间
    • 如果是重定向页或者消歧义页则会由額外提示
    • 单击即可进行页面编辑,查看页面历史,查看最近修訂,查看最近的编辑者,查看自我最后更改以来的编辑,移动页面,查看链入,链出更改,监视或解除监视页面,保护、解除保护或更改保护(限管理员),进入讨论页,编辑讨论页及开启新话题。
  • 鼠标悬停于图像链接时:
    • 预览图像
    • 预览图像注释
    • 预览图像链接
  • 鼠标悬停于用户相关链接时:
    • 单击可访问用户页,用户空间,用户讨论页,编辑用户讨论页,讨论页添加新話題,給用戶發送電子郵件,用戶貢獻,用户日志,封禁用户(限管理员),封禁日志等。
  • 鼠标悬停于脚注:
    • 预览脚注内容。
  • 悬停于任何wiki链接:
    • 清除POPUPS缓存
    • 启用/禁用预览或POPUPS
  • 在监视列表、页面历史和链出更改中可预览历史版本,并进入任何一个版本。
  • 在编辑时预览wiki链接
  • 在浏览历史时可单击回退破坏
  • 快捷键(可选)
  • 自动修复链接以绕过重定向和消歧页(可选)

用户配置

Popups的一些功能可以被自定义配置,完整配置表参见enwp:Wikipedia:Tools/Navigation_popups#Configuration (optional)

您可以从下方的表单中选择您需要的选项,以window.【option】 = 【value】;的格式每行一个添加到您的common.js或skin.js里。

部分常用选项及示例:

  • 操作下拉栏

预置shortmenus(默认)、menus、lite、original、nostalgia、fancy、fancy2七个可选项
window.popupStructure = 'shortmenus'; //shortmenus应替换成上述7个中的任一值

  • 管理员选项(若用户为管理员则自动开启)

window.popupAdminLinks = true;

完整功能选项表

Option Values
默认值以粗体标记
简介
标准选项
popupDelay 0.5, 一个十进制的数 停留几秒后导航Popup才显示。
popupHideDelay 0.5, 一个十进制的数 弹出式窗口延迟几秒后隐藏。
simplePopups true, false 如果仅仅想要显示链接,可以把这个选项设为true。这样就不会加载更多数据,poups也仅仅显示链接列表,除非您还将下列选项设为true:: popupUserInfo, popupPreviewDiffs, popupPreviewHistory, popupCategoryMembers, imagePopupsForImages.
popupStructure 'original', 'fancy', 'fancy2', 'menus', 'shortmenus', 'lite', 'nostalgia' 选择popups的结构。simplePopups选择true时默认为'original',有所有导航链接。'fancy'fancy2'nostalgia''original'的变体。其他情形默认是simplePopups,当鼠标悬停在popup标题上时,会把链接列表显现在菜单栏中。'menus''shortmenus'的增强版本,提供有更多链接。'lite'则是一个非常简单的版本,仅提供预览,没有任意导航链接。

注意,设定此变量需使用引号。

popupActionsMenu true, false 默認為存在一个单独的“操作”下拉栏,当禁用时,将在弹窗中使用标题链接生成菜单。
popupAdminLinks true, false 选择true 后,操作下拉栏可使用封禁,删除、保护或解除保护页面。
popupShortcutKeys true, false 如果设置此变量为true,可以使用快捷键快速锁定popups中的链接。将鼠标悬停在popups内的链接上可以查看对应的快捷键。比如,在Firefox或Opera浏览器中,可以通过按下'e Control-Enter'在新选项卡中快速编辑页面。按下Esc也会隐藏popups。
popupHistoricalLinks true, false When hovering over links to old revisions and diff links, extra links such as "editOld" are generated if this is true. Otherwise, you get the same links as when hovering over an ordinary link.
popupOnlyArticleLinks true, false 如果设置此变量为true,则仅会在正文中的内链上弹出popups。否则,许多其他链接(比如“编辑”、“查看历史”)也会弹出。
popupMaxWidth 350, an integer or false popups的最大宽度(像素数),如果设置为false,popups会为了容纳其内容而扩展。
popupInitialWidth an integer or false popup的初始宽度(px)。设为false意味着popup将会根据内容确定需要的初始宽度。
popupTocLinks true, false 是否为目录项弹出popups。设置为true时,目录项也会弹出popups。
popupSubpopups true, false 如果设置此变量为true,popups会在页面预览中的链接上弹出。
popupDragHandle false, 'popupTopLinks', ... The name of an element by which the popup can be dragged without holding the shift key. If false, then the popup can be dragged using the shift key instead.
popupAllDabsStubs true, false If this variable is set to false then only pages that look like stubs or disambiguation pages in the article namespace are treated specially. (Setting this to true can lead to lots of false positives).
popupAdjustDiffDates true, false If true, then dates in history, diff and user contributions previews are adjusted according to the settings in your user preferences.
popupModifier false (default), 'ctrl', 'shift', 'alt', 'meta' Lets popups only appear when pushing a modifier key while hovering over the links. This prevents unintentional popups that hide page content.
图像选项
popupImages true, false 设置为false则不显示图像。
imagePopupsForImages true, false 默认情况下,即使某个图像可见,popups也会在鼠标悬浮时显示该图像的预览。设为false可以关闭它。当simplePopups被设为true时,这个选项默认关闭。
popupThumbAction "imagepage", "sizetoggle", "linkfull" 这个选项控制的是点击预览中的图像时的动作。"imagepage":跳转到图像说明页面(当鼠标悬浮到图像上,则会生成一个子popup),除非你预览的就是图像页面;"sizetoggle":点击图像后会放大/缩小它;"linkfull":直接跳转到图像的完整尺寸版本。
重定向、消歧义、监视选项
popupFixRedirs true, false 设为true,则当你预览重定向链接时,通过一次点击即可自动“修复”它。注意:你可能并不想每次碰到重定向链接就去“修复”它,而且你肯定不会专门逮着这种链接去“修复”。刷编辑量警告。
popupRedirAutoClick 'wpDiff', 'wpPreview', 'wpSave' 当你点击“修复重定向”后,后续的操作。这三个分别是“差异”、“预览”、“保存”。如果设为'wpSave',将不会有任何确认步骤而是直接保存。
popupFixDabs true, false 设为true后,可以在popup底部选择其中的一个链接,来消歧义某个有歧义的链接。
popupDabsAutoClick 'wpDiff', 'wpPreview', 'wpSave' 当你消歧义(或移除)某个链接后,后续的操作。如果设为'wpSave',将不会有任何确认步骤而是直接保存。
popupRedlinkRemoval true, false 设为true后,遇到红链时,你可以通过选择“移除此链接”来移除它。(但是需要注意红链有时是有用的)
popupRedlinkAutoClick 'wpDiff', 'wpPreview', 'wpSave' 点击移除红链后,后续的操作。如果设为'wpSave',将不会有任何确认步骤而是直接保存。
popupWatchDisambiggedPages true, false, null 设为true,则修复歧义链接后会自动监视被修复的页面;设为false,则会自动取消监视;设为null,则行为取决于你的偏好设置。(似乎只在popupDabsAutoClick = 'wpSave'时生效)
popupWatchRedirredPages true, false, null 设为true,则修复重定向链接后会自动监视被修复的页面;设为false,则会自动取消监视;设为null,则行为取决于你的偏好设置
导航选项
popupNavLinks true, false If this is true then navigation links are displayed. If false, then these are switched off.
popupLastEditLink true, false Whether the popup should contain a "most recent edit" link.
popupEditCounterTool "supercount", "custom" The edit counter tool to use or a custom url defined by popupEditCounterUrl.
popupEditCounterUrl "" The url for a custom edit counter. You can use replaceable parameters in this url: $1 will be replaced with the username, and $2 with the database name (for example, enwiki_p).
预览选项
popupPreviews true, false 如果这个选项被设为true并且你没有设置simplePopups,那么将会显示文章第一段的预览;设为false则不显示。
popupSummaryData true, false 设为true可以显示页面的概要;设为false则不显示。
popupUserInfo true, false 设为true,则当目标页面在User、User_talk名字空间时,会显示所属用户的信息。当simplePopups被设为true时,这个选项默认关闭。
popupLastModified true, false 设为true可以在页面概要显示该页面最后一次编辑距今的时间。
差异选项
popupDiffDates true, false 设为true可以在预览差异时显示两个版本的编辑时间。
其他选项
popupOnEditSelection true, false, 'cursor', boxpreview If this is true then popups are generated for selected wikilinks when editing.
popupImageLinks true, false 设为true会在预览中显示链接到一个图像的页面。暂时不适用于共享站的图像。
popupShowGender true, false 设为true可在用户信息中加上性别符号。
编辑摘要选项
popupRevertSummaryPrompt true, false 设为true,每次撤销时可以自定义摘要。
popupRevertSummary 字符串 没有使用queried revert summary(见下)时,摘要为'回退到修订版本%s ——Popups'。string中的第一个%s将会被替换为被恢复的版本ID。
popupExtendedRevertSummary 字符串 默认:'回退到$2在$1时制作的修订版本$3 ——Popups'
popupRevertToPreviousSummary 字符串 默认:'回退到修订版本%s的上一个版本 ——Popups'
popupQueriedRevertSummary 字符串 The edit summary used when reverting and using the query interface to get information about the reversion. A $1, $2, $3 in the string are replaced with the revision ID, the timestamp and the editor corresponding to the revision being reverted to. 默认:'回退到$3在$2时制作的修订版本$1 ——Popups'
popupQueriedRevertToPreviousSummary 字符串 The edit summary used when reverting using diff links such as those found on user contributions pages and using the query interface to get information about the reversion. A $1, $2, $3 in the string are replaced with the revision ID, the timestamp and the editor corresponding to the revision immediately after the revision being reverted to. 默认:'回退到修订版本$1的上一个版本,由$3在$2时制作 ——Popups'
popupFixDabsSummary 字符串 消歧义时使用的编辑摘要。字符串中第一个 %s 为消歧义页面,第二个 %s 为目标页面。默认:'消歧义%s%s ——Popups'
popupFixRedirsSummary 字符串 修复重定向时使用的编辑摘要。字符串中显示的第一个 %s 为重定向,第二个 %s 为目标页面。默认:'忽略从%s%s的重定向 ——Popups'
popupRedlinkSummary 字符串 移除红链时使用的编辑摘要,此字符串中显示的 %s 为红色链接的名称。默认:'取消到空页面%s的链接 ——Popups'
popupRmDabLinkSummary 字符串 默认:'移除到消歧义页%s的链接 ——Popups'
编辑預覽选项
popupHistoryPreviewLimit 25, an integer 版本历史预览的最大显示数量。
popupCategoryMembers true, false 是否预览分类中的成员。当simplePopups被设为true时,这个选项默认关闭。
popupPreviewDiffs true, false 是否显示差异链接的预览。当simplePopups被设为true时,这个选项默认关闭。
popupPreviewHistory true, false 是否对页面历史的链接生成特殊预览。当simplePopups被设为true时,这个选项默认关闭。
popupContribsPreviewLimit 25, an integer 用户贡献预览的最大显示数量。
popupPreviewKillTemplates true, false 设为true,则页面使用的模板将从预览中被删除;否则模板会显示为wikitext源代码。
popupPreviewRawTemplates true, false 设为true,则对模板页面的预览将会显示为源代码;否则将会尝试解析它们。
popupPreviewFirstParOnly true, false 设为true,则预览被限制在条目第一段。
popupMaxPreviewSentences 5, an integer 在预览中最大的句数,从近似条目开头的地方开始计数。
popupMaxPreviewCharacters 600, an integer 在预览中最大的字母数量,从近似条目开头的地方开始计数。
技術选项
removeTitles true, false 设为true,则移除预览主界面的标题部分。
popupAppendRedirNavLinks true, false 设为true,对于重定向链接,会生成一个到重定向目标的链接;设为false,仅会提示这是一个重定向。这个选项在popupNavLinks被设为false时无效。
popupNavLinkSeparator string,
' ⋅ '
插入到导航链接两两之间的HTML代码。默认是' ⋅ '(⋅)。
popupLazyDownloads true, false 设为true时,只有在popup出现时才会加载对应页面内容;设为false时,当鼠标悬浮在链接上时就会加载。
popupLazyPreviews true, false 设为true时,在popup出现之前,预览不会后台生成;设为false时,只要所需要的数据可用,预览就会开始生成。
測試性功能
popupReview true, false 增加一个“标记为已巡查”的链接。
popupSetupMenu true, false 一个附加的菜单,可以用来禁用或者重置pupups本身。
popupSimplifyMainLink true, false 对于主名字空间之外的页面,标题中不显示名字空间前缀。
popupDebugging true, false
popupActiveNavlinks true, false
popupModifierAction 'enable', 'disable'
popupDraggable true, false
popupNeverGetThumbs true, false
popupImageSize 60, an integer
popupImageSizeLarge 200, an integer
popupMinorReverts true, false 标记回退/编辑为小编辑。
popupDabWiktionary 'last', 'first' Determine position of the option to disambiguate the link to point to wiktionary instead.
popupPreviewCutHeadings true, false
popupPreviewButton true, false
popupPreviewButtonEvent 'click'
popupDiffMaxLines 100, an integer 进行差异睡觉对比的最大行数
popupDiffContextLines 2, an integer 每笔更改之前和之后要包含在差异中的行数
popupDiffContextCharacters 40, an integer
popupDiffDatePrinter 'toLocaleString', a string
popupHistoryLimit 50, an integer The maximum amount of history to search through for the changes since my last edit. NOTE: misnomer
popupFilters array default: [popupFilterStubDetect, popupFilterDisambigDetect, popupFilterPageSize, popupFilterCountLinks, popupFilterCountImages, popupFilterCountCategories, popupFilterLastModified]
extraPopupFilters [], an array
popupRevDelUrl string default: '//en.wikipedia.org/wiki/Wikipedia:Revision_deletion' Determines where to link to when showing revision deleted versions in the history
popupNewWindows true, false popups中的链接是否在新标签页/新窗口中打开。
popupLinksNewWindow string default: {'lastContrib': true, 'sinceMe': true}

Allow lastContrib or sinceMe links to open in a separate window. NOTE: not functional right now.

popupDabRegexp string default: '(\\{\\{\\s*disambig(?!uation needed)|disambig\\s*\\}\\}|disamb\\s*\\}\\}|dab\\s*\\}\\})|\\{\\{\\s*(((geo|hn|road?|school|number)dis)|[234][lc][acw]|(road|ship)index)(\\s*[|][^}]*)?\\s*[}][}]|is a .*disambiguation.*page'
popupAnchorRegexp 'anchors?', a string
popupStubRegexp string default: '(sect)?stub[}][}]|This .*-related article is a .*stub'
popupImageVarsRegexp string default: 'image|image_(?:file|skyline|name|flag|seal) |cover|badge|logo'

更改工具外观

Popups的外观也可以被自定义配置,可通过您的common.css或skin.css修改。

以下为一个案例:

.navpopup { 
	background-color: #FFBE20  !important; /* 更改背景顏色 */
	font-family:      serif    !important; /* 更换字体 */
	color:            #404     !important; /* 更改文字颜色 */
}
span.popup_contribs > a.popupNavLink {
	display:    block; /* 加宽“贡献”栏 */
}
.navpopup { font-size: 0.875em !important; } /* 增加字号 */
.popup_menu { margin-top: 1.1em !important; } /* 增加字号 */