Wikipedia:維基百科工具/導航Popup
维基百科,自由的百科全书
popups 提供一个使用很多维基百科功能的弹出标签,你只要把鼠标悬停在内部链接上就能非常方便的使用这个功能。
目录 |
[编辑] 特性
- 只要单击就可以:
- 编辑页面
- 查看用户贡献
- 使用Kate的工具查看用户编辑统计
- 发送电子邮件給用戶
- 查看页面编辑历史
- 监视或停止监视页面
- 查看或编辑讨论页
- 查看链入页面
- 查看链出更改
- 保护或解除保护页面,删除页面或封禁用户(管理员使用)
- 查看日志
- 列出用户页面的子页
- -{zh-cn:搜索;zh-tw:搜尋}-维基百科和进行-{zh-cn:全局;zh-tw:全域}-各语言的维基百科搜索
- 预览条目和其他页面的一部分 (en:User:Pilaf设计)
- 从圖像链接预览图像
- 预览每个页面的第一幅图像 - 这个功能用来看用户页面时更有意思
- 可以显示该页面是重定向页面,短条目还是消歧义页面
- 给出页面的文件大小,链接数量,图片数目,分类数目以及创建时间
- 可以在整个维基媒体计划使用
- 自动修复重定向和消歧义链接(可选项)
- 快捷键 (可选项)
[编辑] 安装
安装之前,您必须拥有一个中文维基百科的-{zh-cn:账号;zh-tw:帳號}-,这样您才可以使用弹出式导航-{zh-cn:菜单;zh-tw:選單}-的功能。如果您没有-{zh-cn:账号;zh-tw:帳號}-,那么您需要申请一个然后登入。
您必须从您的用户页新建(编辑)一个特殊的文档,对大多数人来说,这个相关的文檔是monobook.js(位於User:您的用戶名/monobook.js)。點選左邊的連結就可以編輯這個檔案。
另外,如果您使用的面板不是預設的Monobook,下面列出了不同情况下您需要编辑的页面:
- Classic skin: standard.js
- Cologne Blue: cologneblue.js
- Chick: 'chick.js
- Simple: simple.js
- Nostalgia: nostalgia.js
- MySkin: myskin.js
下一步,点击"编辑本页",复制下面的文本粘贴在您的页面中(不要把下面的用戶名修改成为您的用户名),然后保存页面。
使用英文維基上的最新版本,加上中文介面檔案:
// [[User:Lupin/popups.js]] - please include this line document.write('<script type="text/javascript" src="' + 'http://en.wikipedia.org/w/index.php?title=User:Lupin/popups.js' + '&action=raw&ctype=text/javascript&dontcountme=s"></script>'); document.write('<script type="text/javascript" src="' + 'http://zh.wikipedia.org/w/index.php?title=User:%E7%AC%A8%E7%AC%A8%E7%9A%84%E5%B0%8FB/jstool/strings-zh.js' + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
User:笨笨的小B作過修改的版本:
// [[:en:User:Lupin/popups.js]] - please include this line // [[User:笨笨的小B/jstool/popups.js]] - 請保留此行 document.write('<script type="text/javascript" src="' + 'http://zh.wikipedia.org/w/index.php?title=User:%E7%AC%A8%E7%AC%A8%E7%9A%84%E5%B0%8FB/jstool/popups.js' + '&action=raw&ctype=text/javascript&dontcountme=s"></script>'); document.write('<script type="text/javascript" src="' + 'http://zh.wikipedia.org/w/index.php?title=User:%E7%AC%A8%E7%AC%A8%E7%9A%84%E5%B0%8FB/jstool/strings-zh.js' + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
User:Vipuser所製作的中文界面:
// [[User:Vipuser/popups.js]] - 请保留此行 document.write('<script type="text/javascript" src="' + 'http://zh.wikipedia.org/w/index.php?title=User:vipuser/popups.js' + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
在保存页面之后,请刷新您的浏览器缓存(对于Internet Explorer或Firefox可以使用快捷键Ctrl+F5),然后确定您的浏览器没有禁用javascript脚本。这样,在您把鼠标悬停在一个维基百科的内部链接上片刻之后,就可以看到一个弹出式菜单了。
需要安装脚本在commons或者wiktionary上的时候,重复上面的步骤在其他wiki上就可以了。
需要卸载脚本时,只需在同一页面删除您添加的上面几行文本然后保存并清除浏览器缓存就可以了。
[编辑] 可选配置
[编辑] 改变你的 popups 的外观
只要修改個人的CSS檔,您就可以變更popups的外觀,您個人的CSS檔如下: User:您的用戶名/monobook.css.
Here is an example which gives an orange-flavoured popup with a border and changes the font used. All lines in this example are optional. (The last line in particular makes the popup look a bit silly, but it shows the sort of thing you can do if you feel like it).
table.popupBorderTable { background: #FFBE20 /* orange */ !important } table.popupTable { background: #FFFAEF /* pastel orange */ !important } font.popupFont { font-family: serif !important; color: #440044 !important; font-size: medium !important }
[编辑] 选项
There are some options that you can set. To do so, edit your user javascript file (such as User:USERNAME/monobook.js) and add a line of the form
- 選項 = 值;
where option and value are chosen from the table below. For example, to prevent all downloading and turn on admin links, you need something like this in your javascript file:
// [[User:Lupin/popups.js]] - please include this line document.write('<script type="text/javascript" src="' + 'http://en.wikipedia.org/w/index.php?title=User:Lupin/popups.js' + '&action=raw&ctype=text/javascript&dontcountme=s"></script>'); simplePopups=true; popupAdminLinks=true;
|
||
選項 (Option) | 值* (Value) | 描述 |
---|---|---|
popupDelay | decimal number, 0.5 | The number of seconds before popups appear. |
simplePopups | true, false | If you just want the links or find the amount of bandwidth consumed too great, then set this to true. No data will be downloaded and the popups will just consist of a list of links. |
popupStructure | 'original', 'fancy', 'fancy2', 'menus' | Select the structure of the popups. The 'original' setting, which is the default if simplePopups is true, has all the navigation links in the popup itself; 'fancy' and fancy2 are variants of this. The 'menus' setting, which is the default if simplePopups is not true, puts the navigation links in popup menus which appear when you mouseover the popup title. Note that to set this variable, you need to include the single quotes, e.g. popupStructure='fancy';. In Opera, this defaults to 'original' as the user menu doesn't work for some reason (probably a bug in the script). |
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 | If this is false then images are never displayed. |
popupAdminLinks | true, false | If this variable is set to true then links which administrators can use to block people, delete pages and protect or unprotect pages will appear in the popups. |
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 | If true, you can drag the popups around when you hold the shift key. |
popupFixRedirs | true, false | If this variable is set to true then you can automatically "fix" links to redirect pages by clicking on the "Redirects" link. |
popupRedirAutoClick | 'wpSave', 'wpPreview', 'wpDiff' | The button which is automatically pressed when fixing redirects. |
popupFixDabs | true, false | If this variable is set to true then you can automatically "fix" links to disambiguation pages by clicking one of the links at the very bottom of the popup. |
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 "lastEdit" link. |
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 | If this is true summary data for the target page is displayed. If false, then this is switched off. |
popupLastModified | true, false | If true then the age of the page is displayed in the summary data. This is the amount of time that has elapsed since the article was edited. |
popupOnlyArticleLinks | true, false | If true, then popups are only generated for links in the article. Otherwise, many other links (such as Edit, Help) get popups too. |
imagePopupsForImages | true, false | By default, preview images are loaded even when hoving over visible images. Setting this to false turns that off. |
popupMaxWidth | 300, an integer or false | The maximum width of the popup in pixels. Setting this to false means the popup will expand to accommodate its contents. |
popupInitialWidth | an integer or 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 | a string | The edit summary used when reverting. The first %s appearing in this string is replaced with the revision ID of the page being reverted to. |
popupFixRedirsSummary | a string | The edit summary used when fixing redirects. The first %s appearing in this string is replaced with the redirect page, and the second %s is replaced with the target page. |
popupFixDabsSummary | a string | 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. |
Technical options | ||
popupMaxPreviewSentences | an integer, 4 | The maximum number of sentences to extract from something approximating the first meaningful paragraph of an article for the preview. |
popupMaxPreviewCharacters | an integer, 600 | The maximum number of characters to extract from something approximating the first meaningful paragraph of an article for the preview. |
popupNavLinkSeparator | string, ' ⋅ ' |
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 | The titles (the default popup hints) of links are moved to the main link of the popup if this is true. If this is false then they're not. |
Experimental options | ||
The following options are not thoroughly tested and are not yet documented: popupLiveOptions, popupCookies, popupUnsimplifyLink, popupPreviewKillTemplates, popupPreviewFirstParOnly. One easy way to test them (and other undocumented options) interactively is to set popupLiveOptions=true. |
*粗體為預設值
More options may be added, and requests for more configurability are welcome.
[编辑] 高级自定义
You can define custom filters for articles. These are javascript functions which are run after the page statistics are generated, and their output is appended (as HTML) to that part of the 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 '<table>'; 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).
[编辑] 浏览器问题
If anyone can get to the bottom of these problems, I'd like to hear about it.
- Some people have found that Safari crashes a lot when running this script
- When popupFixDabs is true, disambiguation pages such as mummification don't display all the links that they should in at least some versions of Internet Explorer.
- Keyboard shortcuts and dragging popups don't work in Internet Explorer.
[编辑] 反馈
Bugs, problems, suggestions and enhancements to Lupin, please.
I have set up a page where you can list pages with incorrect previews.
中文版因为由维游汉化,所以请直接和维游联系。
[编辑] 参看
- Wikipedia:Easy navigation – Proposed guideline
- Help:User style – Customize Wikipedia page layout
[编辑] 制作人员名单和外部链接
This tool depends on some other peoples' work:
- overlib by Erik Bosrup
- Live Preview by en:User:Pilaf
- a Javascript MD5 hash function by Paul Johnston and others, available here
- domdrag by Aaron Boodman