维基百科:维基百科工具/导航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