维基百科:维基百科工具/导航Popup

Navigation popups 图标
中文维基百科的navigation popups

Navigation popups(译名:弹出式导航)提供一个使用很多维基百科功能的弹出标签,只要将鼠标悬停在内部链接上就能非常方便地使用这个功能。源代码在MediaWiki:Gadget-popups.js

特性 编辑

 
条目中的小图片预览(经典外观的截图,但完全兼容Monobook)
 
点击可以放大预览
  • 鼠标悬停于条目(及用户页)上:
    • 当鼠标悬停在一个条目链接时,可预览条目前一部分的文本
    • 预览条目的第一张图片
    • 预览所指向页面的信息,包括页面大小、链接数、所含图像和分类的数目,以及页面创建至今的时间
    • 如果是重定向页、小作品或是消歧义页则会提示
    • 单击即可进行页面编辑,查看页面历史,查看最近的版本,查看最近的编辑者[1],查看自我最后更改以来的编辑[1],移动页面,查看链入,链出更改,监视或解除监视页面,保护、解除保护或更改保护(限管理员),进入讨论页,编辑讨论页及开启新话题。
  • 鼠标悬停于图像链接时:
    • 预览图像
    • 预览图像注释
    • 预览图像链接
    • 如果图像位于commons上时会有提示
  • 鼠标悬停于用户相关链接时:
    • 单击可访问用户页,用户空间,用户讨论页,编辑用户讨论页,讨论页开启新对话,电邮用户,贡献与贡献树,用户日志,删除用户(限管理员),封禁用户(限管理员),用户贡献统计(X!'s Edit Counter),封禁日志。
  • 鼠标悬停于脚注:
    • 预览脚注内容。
  • 悬停于任何wiki链接:
    • 清除POPUPS缓存[2]
    • 启用/禁用预览[2]
    • 启用/禁用预览POPUPS[2]
  • 在监视列表、页面历史和链出更改中可预览历史版本,并进入任何一个版本。
  • 在编辑时预览wiki链接(使用鼠标选定一个wiki链接)。
  • 在浏览历史时可单击回退破坏。
  • 维基搜索,global Wikipedia searchGoogle搜索。
  • 快捷键(可选)。
  • 自动修复链接以绕过重定向和消歧页(可选)。
  • 应能工作于所有维基媒体站点。

安装 编辑

安装之前,您必须拥有一个中文维基百科的账号,这样您才可以使用弹出式导航菜单的功能。如果您没有账号,那么您需要申请一个然后登录。

在注册以后,请点击右上角“参数设置”,选择“小工具”页签,勾选“导航Popup”的相关项目以激活Popup工具。

也可以直接引用load.php的文件,但不建议使用:

mw.loader.load('//zh.wikipedia.org/w/load.php?modules=ext.gadget.Navigation_popups');
如果您曾经使用其他方法引用导航Popup,这些方法已过时,请卸载曾经加上的相关JavaScript脚本,然后保存并清除浏览器缓存。
下面列出了使用不同面板下您需要修改原有编辑的页面:

可选配置 编辑

改变你的 popups 的外观 编辑

只要修改个人的CSS档,您就可以更改popups的外观(默认根据Mediawiki:Gadget-popups.css),您个人的CSS档如下: User:您的用户名/vector.css.

此为其中一个示例,background-color为背景颜色、font-family为字体种类、color为文字颜色、font-size为文字大小。

.navpopup { 
  background-color: #BFFF00  !important;
  font-family:      arial    !important;
  color:            #008000  !important;
  font-size:        13px;
}
span.popup_contribs > a.popupNavLink {
        display:    block; /* 加寬“貢獻”,使得懸浮更加方便 */
}

选项 编辑

您可以自行设置一些选项。从下面的表格中选择選項以及,每项属性单独一行添加到您的用户自定义JavaScript页面

window.選項 = 值;

举例来说,要打开管理员功能的属性,您需要修改您的JavaScript文件如下:

window.popupStructure = 'menus';
window.popupAdminLinks = true;
配置选项
选项 (Option) 值 (Value)
默认值是粗体
描述
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不为true时默认是simplePopups,当鼠标悬停在popup标题上时,会把链接列表显现在菜单栏中。'menus''shortmenus'的增强版本,提供有更多链接。 最后,'lite'是一个非常简单的版本,仅提供预览,没有导航链接。

注意,设置此变量需使用单引号,例如popupStructure='fancy';

popupActionsMenu true, false When using menus, you can either have the title link in the popup generating a menu (if this is set to false) or a separate "actions" menu (if this is set to true, the default).
popupImages true, false 值设为 false ,则不显示图像。
popupAdminLinks true, false 值设为 true ,则管理员可使用Popup执行封禁,删除页面,保护或解除保护页面。
popupShortcutKeys true, false If this variable is set to true then you can focus some of the links in the popups quickly by pressing keys. When you hover the mouse over a link with a shortcut, the shortcut key appears at the end of the popup hint. For example, in Firefox or Opera, to quickly edit an article in a new tab you can type 'e Control-Enter'. Internet Explorer users beware: shortcut keys don't work and turning this option on will reveal various bugs, so it's not recommended.
popupDragging true, false 值设为true ,则能够按住shift键不放,用鼠标拖曳popups视窗。
popupFixRedirs true, false 值设为true ,则能够以点击"Redirects"链接而自动地修正重定向页面。
popupRedirAutoClick 'wpSave', 'wpPreview', 'wpDiff' The button which is automatically pressed when fixing redirects.
popupFixDabs true, false 值设为true ,则能够以点击Popup上的一个链接自动修正连向消歧义页的错误。
popupNavLinks true, false 值设为true ,则popups会显示导航链接,false则关闭此功能。
popupLastEditLink true, false 值设为true,则popus会显示最近一次编辑链接,false则关闭此功能。
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.
popupPreviews true, false If this is true and you haven't set simplePopups, then a preview of the first part of the article will appear. (Reports of pages for which this is done badly are most welcome). If false, then this is switched off.
popupSummaryData true, false 值设为true,则popups会显示目标页的摘要,false则关闭此功能。
popupLastModified true, false 值设为true,则popups会显示该页面最后一次编辑距今的时间。
popupOnlyArticleLinks true, false 值设为true, 则popups只在连往页面的链接才会启动。否则,许多链接(例如编辑,帮助)均会启动popups。
imagePopupsForImages true, false By default, preview images are loaded even when hoving over visible images. Setting this to false turns that off.
popupMaxWidth 300,整数或者false Popup视窗的最大宽度的像素。若设为false 则Popup视窗将扩展至容纳它所含有的内容。
popupInitialWidth 整数或者false The initial width of the popup in pixels. Setting this to false means the popup will initially be the size needed to accommodate its initial contents.
popupRevertSummary 字符串 恢复时的编辑摘要。 %s 为恢复的版本ID。
popupFixRedirsSummary 字符串 修正重定向时的编辑摘要。 第一个 %s 为置换的重向定页名称,第二个 %s 为置换的目标页面名称。
popupFixDabsSummary 字符串 The edit summary used when disambiguating links. The first %s appearing in this string is replaced with the disambiguation page, and the second %s is replaced with the target page.
预览选项(preview options)
popupHistoryPreviewLimit 25, an integer
popupCategoryMembers true, false
popupPreviewHistory true, false
popupContribsPreviewLimit 25, 一个整数 贡献预览限制
popupPreviewKillTemplates true, false 如果为true,文章中提到的模板只是从预览删除了。否则,他们以原始的维基文本形式出现。
popupPreviewRawTemplates true, false
popupPreviewFirstParOnly true, false
popupMaxPreviewSentences 5, 一个整数
popupMaxPreviewCharacters 600, 一个整数 预览文章的第一段的摘录的长度。
技术选项
popupNavLinkSeparator 字符串,
' ⋅ '
HTML inserted between the navigation links. This defaults to ' • ' in Konqueror and to ' · ' in Microsoft browsers, as they don't appear to like the ⋅ character.
popupAppendRedirNavLinks true, false If true, then a new set of navigation links is generated for the target of redirects; if false, then you're warned about the redirect but no navigation links are generated. This does nothing if popupNavLinks is false.
removeTitles true, false 此标题(popup的默认提示)of links are moved to the main link of the popup if this is true. If this is false then they're not.
实验选项
下列选项还未经过充分测试,并且未归档:popupLiveOptions, popupCookies, popupUnsimplifyLink。想要测试它们(以及其它未归档选项)的最简单互动办法就是做如下设置:popupLiveOptions=true.

可能更多的选项,也欢迎建议更多设置需求。

高级设置 编辑

您能够为文章定义定制的过滤。这些是javascript在页面统计产生后执行的功能,它们的输出将附加(as HTML)为popup视窗的一部分。 (Note that if simplePopups is true or popupSummaryData is false, then nothing will be displayed).

The way to set this up is to write a filter function which accepts a string (the wikitext of the article) as input, and returns a fragment of HTML. Repeat for as many filters as you want, and then create an array extraPopupFilters which contains all of the functions, in the order in which you want them to be run.

For example, let's say you want to be told whenever the wikitext of an article contains a table written using HTML tags rather than wiki markup. One way to do this is to add the following to your user javascript file:

// initialize the array - only do this once
extraPopupFilters=new Array();

// define the function
function popupFilterHtmlTable (wikiText) {
  if (/<table/i.test(wikiText)) return '&lt;table&gt;';
  else return '';
};

// add the function to the array (you can repeat this for lots of functions)
extraPopupFilters.push(popupFilterHtmlTable);

Then when a popup is generated for a page containing an HTML table, you should see <table> in the popup. (It may also appear for other pages, such as this page. Correcting this defect is left as an exercise for the reader).

浏览器问题 编辑

如果哪位能找出这些问题的原因,麻烦请告诉我(英文)。中文版可以和维游联系。

  • 某些人发现使用此脚本时,会使 Safari 的许多功能出现故障。
  • 在某些版本的 Internet Explorer,当 popupFixDabs 的选项为“true”时,消歧义页如 mummification 无法显示所有的它应有的链接。
  • 在 Internet Explorer里,键盘快捷键失效,弹出窗口也无法拖曳。有人发现快捷键丝毫无损
  • 指针移动到贡献上,不显示弹窗。但是可以依次将指针移动到用户乙 > 用户 > 贡献来显示贡献的弹窗。

反馈 编辑

发现任何漏洞、问题,或者有任何建议或改进,请联系en:Wikipedia_talk:Tools/Navigation_popups

中文版因为由维游汉化,所以请直接和维游联系。

参看 编辑

制作人员名单和外部链接 编辑

此工具有赖于许多其他的付出者:

注释 编辑

  1. ^ 1.0 1.1 On selected browsers, including Microsoft Internet Explorer
  2. ^ 2.0 2.1 2.2 On selected browsers, including Mozilla Firefox