wikishia:Tools/Navigation popups
The developer of popups (Lupin) has not been active on Wikipedia since 2009. |
Warning: You take full responsibility for any action you perform using navigation popups. You must understand Wikipedia policies and use this tool within these policies, or risk being blocked from editing. |
Navigation popups is a script, written in JavaScript (source), that offers easy access to article previews and several Wikipedia functions in popup windows which appear when you hover the cursor over links.
- Quick installation: Enter Special:Preferences and click "Gadgets"; under the "Browsing" section, check the box to enable "پنجرههای ناوبری: پیشنمایش مقاله و عملکردهای ویرایش بهنگام نگه داشتن ماوس روی پیوندها ظاهر میشوند", then click save. Follow the instructions on the page to bypass your browser's cache.
- Other installation method: add
{{subst:navpop}}
to your current skin's .js page. See below for full installation instructions.
If you're having trouble, you may like to peruse some frequently asked questions.
Features
- Mouseover on articles (including user pages):
- Preview the first part of the article text when mousing over a link to an article
- Preview the first image on each article
- Preview selected page information: size, number of links, number of images, number of categories and page age
- Tells you about redirects, stubs and disambiguation pages
- One click access to edit page, page history, most recent edit, edits by most recent contributor,[1] changes since my edit,[1] move page, what links here, related changes, watch or unwatch, protect or unprotect (for administrators), talk page, edit talk page and start new topic in talk page
- Mouseover on image links:
- Preview images
- Preview file descriptions
- Preview file links
- Tells you if the image is on Commons
- Mouseover on user links:
- One-click access to user page, user space, user talk, edit user talk, new section in user talk, e-mail user, contributions and contributions tree, user log, (for administrators) delete user, (for administrators) block user, edit counter (User Analysis Tool), block log
- Mouseover on footnotes:
- Preview contents of footnotes
- Mouseover on any wikilink:
- Preview diffs and access both revisions in watchlist, history and related changes
- Preview selected wikilinks when editing (use the mouse to select one wikilink)
- One-click revert of vandalism from history browser (see image)
- Shortcut keys (optional)
- Automatically fix links to bypass redirects and disambiguation pages (optional)
- Should work on all Wikimedia wikis
Installation
You must have a user account to install and use the Navigation popups feature. If you do not have an account, you will need to create one and log in.
- Automatic installation
- Go to My Preferences / Gadgets. Under "Browsing", check "پنجرههای ناوبری: پیشنمایش مقاله و عملکردهای ویرایش بهنگام نگه داشتن ماوس روی پیوندها ظاهر میشوند", and click Save.
- Manual installation
- Add
{{subst:navpop}}
to your common.js page. This will add the following code to your common skin file:
Alternatively if you wish to add this to a specific skin rather than a file that works for all skins (as above), then
- Add
{{subst:navpop}}
to your current skin's .js page. This will add the following code to your .js file:
// [[Wikipedia:Tools/Navigation popups]]
importScript('MediaWiki:Gadget-popups.js');
importStylesheet('MediaWiki:Gadget-navpop.css');
Note: the link above is to skin.js, which should take you to the correct page if you have JavaScript enabled. For reference, the relevant file you will need to edit is listed below.
- Cologne Blue: cologneblue.js
- Modern: modern.js
- Monobook: monobook.js
- Vector: vector.js
- Installation on remote MediaWiki installations, or via your global.js
Add the following to your user script file:
// [[Wikipedia:Tools/Navigation popups]]
mw.loader.load('https://en.wikipedia.org/w/index.php?title=MediaWiki:Gadget-popups.js&action=raw&ctype=text/javascript');
mw.loader.load('https://en.wikipedia.org/w/index.php?title=MediaWiki:Gadget-navpop.css&action=raw&ctype=text/css', 'text/css');
- Notes
After saving the page, clear your browser's cache (on Internet Explorer Ctrl+F5; on Mozilla Firefox ⇧ Shift+Ctrl+R; on Opera F5). Assuming that you have not disabled JavaScript in your browser, a popup should appear whenever you hover your mouse over an internal link in Wikipedia. If you use more than one web browser, or more than one PC, you may need to clear the caches for each so that the popup appears.
To install the script on the Commons or Wiktionary, repeat this procedure on those wikis.
To uninstall the script, delete the above lines from the same page and clear your browser's cache.
Usage guide
This tool generates "popup hints" when you hover the mouse pointer over active links and images. These popups provide information about the link's target and give quick access to a number of relevant actions.
If you hold the shift key then you can drag the popup around.
Popups depend on the type of link:
- Links to ordinary articles: popup provides a preview of the first paragraph and image of the article; the Actions menu allows to view the History and Talk page of the article, to edit and watch the article etc.
- In the edit box: Highlight a [[wiki link]] to get an article popup.
- Diff links: On history or watchlist pages, hover over diff links like "(cur)" or "(prev)" to get a summary of the difference; the Actions menu allows you to revert or undo the edit.
- User: links: information about the status of the user; User menu gives access to Talk page, recent contributions etc.
- Image links: information from image's description page
- In popups: most of the links in popup windows will open new popups when hovered over.
Configuration (optional)
Changing the appearance of your popups
By editing your user CSS file, you can change the appearance of the popups. Your user CSS file has exactly the same name as the JavaScript file, but with "css" instead of "js" at the end. So you should edit your current skin's .css page.
Here is an example which gives an orange-flavoured popup with a border and changes the font used. This makes the popups look pretty silly, but it shows the sort of thing you can do if you feel like it.
.navpopup {
background-color: #FFBE20 !important;
font-family: serif !important;
color: #404 !important;
font-size: medium !important;
}
Options
There are some options that you can set. To do so, edit your user JavaScript file and add a line of the form
window.option = value;
where option
and value
are chosen from the table below. For example, to turn on extensive menus and turn on admin links, you need to add something like this in your JavaScript file:
window.popupStructure = 'menus';
window.popupAdminLinks = true;
Option | Values Default in
bold |
Description |
---|---|---|
[ | ]||
Basic | ||
popupDelay
|
0.5 , a decimal number
|
The number of seconds before popups appear. |
popupHideDelay
|
0.5 , a decimal number
|
The approximate number of seconds between the mouse leaving a popup and its disappearance. |
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' , 'shortmenus' , 'lite' , 'nostalgia'
|
Select the structure of the popups – view examples here. The 'original' setting, which is the default if simplePopups is true (or if your browser is known not to support menus), has all the navigation links in the popup itself; 'nostalgia' , 'fancy' and fancy2 are variants of this. The 'shortmenus' setting, which is the default if simplePopups is not true , puts the navigation links in popup menus which appear when you mouseover the links beside the popup title. 'menus' is a more extensive version of 'shortmenus' with more links. Finally, 'lite' is a very simple structure, with just the preview and no navigation links at all. Note that to set this variable, you need to include the single quotes, e.g. |
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).
|
popupAdminLinks
|
true , false
|
Links to block people, delete pages and protect or unprotect pages are by default only available to administrators. Use this variable to override the default behavior. |
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 '. Pressing escape should hide the popup, too.
|
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
|
If true , then popups are only generated for links in the article. Otherwise, many other links (such as Edit, Help) get popups too.
|
popupMaxWidth
|
350 , 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.
|
popupTocLinks
|
true , false
|
Whether or not to create popups for the Table of content items. Set true to create popups for table of content.
|
popupSubpopups
|
true , false
|
If this is true then popups are generated for links in previews.
|
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. |
Images | ||
popupImages
|
true , false
|
If this is false then images are never displayed.
|
imagePopupsForImages
|
true , false
|
By default, preview images are loaded even when hovering over visible images. Setting this to false turns that off.
|
popupThumbAction
|
"imagepage" , "sizetoggle" , "linkfull"
|
This controls what happens when you click the image in a preview. "imagepage" takes you to the image page (and will generate a subpopup when you hover over the image), unless the popup is generated for the image page; "sizetoggle" means the image size is toggled on click, and "linkfull" means that the image links directly to the full size version.
|
Redirs, Dabs, Reversion | ||
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. Note: you probably don't want to "fix" such links every time you come across them, and you definitely don't want to go on a hunt for them to "fix" them. See About fixing redirects.
|
popupRedirAutoClick
|
'wpDiff' , 'wpPreview' , 'wpSave'
|
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.
|
popupRedlinkRemoval
|
true , false
|
If this variable is set to true then you can automatically remove links to non-existent pages (so-called "red links") by selecting "Remove this link".
|
popupWatchDisambiggedPages
|
true , false , null
|
If this variable is set to true then fixed dab pages will always be watched; if it's false |
popupWatchRedirredPages
|
true , false , null
|
If this variable is set to true then fixed redirect pages will always be watched; if it's false |
Navlinks | ||
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
|
"soxred" , "interiot" , "custom"
|
The edit counter tool to use, chosen from Kate's tool, Interiot's tool 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). |
Previews, etc. | ||
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. |
Diffs | ||
popupDiffDates
|
true , false
|
If true , the dates of the revisions being compared are shown when previewing diffs.
|
Misc. | ||
popupOnEditSelection
|
true , false , 'cursor' , boxpreview
|
If this is true then popups are generated for selected wikilinks when editing.
|
popupImageLinks
|
true , false
|
If true , pages linking to an image should appear in the preview. This currently does not work for commons images.
|
popupShowGender
|
true , false
|
If true , a gender symbol is displayed in popups showing user info.
|
Edit summaries | [edit] | |
popupRevertSummaryPrompt
|
true , false
|
If true, you will be given the chance to change the default revert summary with each reversion. |
popupRevertSummary
|
a string | The edit summary used when reverting and not using a queried revert summary (see below). The first %s appearing in this string is replaced with the revision ID of the page being reverted to. |
popupExtendedRevertSummary
|
a string | default: 'Revert to revision dated %s by %s, oldid %s using popups' |
popupRevertToPreviousSummary
|
a string | default: 'Revert to the revision prior to revision %s using popups' |
popupQueriedRevertSummary
|
a string | 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. |
popupQueriedRevertToPreviousSummary
|
a string | 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. |
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. |
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. |
popupRedlinkSummary
|
a string | The edit summary used when removing red links. The first %s appearing in this string is replaced with the red link name. |
popupRmDabLinkSummary
|
a string | default: 'Remove link to dab page %s using popups' |
Preview options | [edit] | |
popupHistoryPreviewLimit
|
25 , an integer
|
Preview at most this many edits from the top of the page's history. |
popupCategoryMembers
|
true , false
|
Whether or not to preview members of categories. |
popupPreviewHistory
|
true , false
|
Whether or not to generate special previews for links to history pages. |
popupContribsPreviewLimit
|
25 , an integer
|
Preview at most this many user contributions. |
popupPreviewKillTemplates
|
true , false
|
If true , templates referred to in an article are simply deleted from previews; otherwise, they're shown as raw wikitext.
|
popupPreviewRawTemplates
|
true , false
|
If true , template pages (that is, pages in the Template: namespace) are previewed entirely as raw wikitext; otherwise, an attempt is made to render them in the preview.
|
popupPreviewFirstParOnly
|
true , false
|
If true , previews are restricted to the first paragraph of the article.
|
popupMaxPreviewSentences
|
5 , an integer
|
The maximum number of sentences to extract from something approximating the beginning of an article for the preview. |
popupMaxPreviewCharacters
|
600 , an integer
|
The maximum number of characters to extract from something approximating the beginning of an article for the preview. |
Technical options | [edit] | |
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.
|
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 .
|
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.
|
popupLazyDownloads
|
true , false
|
If true, then downloads are not performed before the popup is shown. If false, then they are started as soon as you mouseover a link. |
popupLazyPreviews
|
true , false
|
If true, then previews are not generated before the popup is shown. If false, then they are generated as soon as the necessary data is available. |
Experimental and/or undocumented options | [edit] | |
popupSetupMenu
|
true , false
|
|
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'
|
|
popupExtraUserMenu
|
''
|
|
popupPreviewCutHeadings
|
true , false
|
|
popupPreviewButton
|
true , false
|
|
popupPreviewButtonEvent
|
'click'
|
|
popupPreviewDiffs
|
true , false
|
|
popupDiffMaxLines
|
100 , an integer
|
|
popupDiffContextLines
|
2 , an integer
|
|
popupDiffContextCharacters
|
40 , an integer
|
|
popupDiffDatePrinter
|
string | default: 'toLocaleString'
|
popupCookies
|
true , false
|
|
popupHistoryLimit
|
50 , an integer
|
|
popupFilters
|
array | default: [popupFilterStubDetect, popupFilterDisambigDetect, popupFilterPageSize, popupFilterCountLinks, popupFilterCountImages, popupFilterCountCategories, popupFilterLastModified]
|
extraPopupFilters
|
array | default: []
|
popupUserInfo
|
true , false
|
|
popupRevDelUrl
|
string | default: '//en.wikipedia.org/wiki/Wikipedia:Revision_deletion'
|
popupTimeOffset
|
null
|
|
popupNewWindows
|
true , false
|
|
popupLinksNewWindow
|
string | default: {'lastContrib': true, 'sinceMe': true}
|
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
|
string | default: 'anchors?'
|
popupStubRegexp
|
string | default: '(sect)?stub[}][}]|This .*-related article is a .*stub'
|
popupImageVarsRegexp
|
string | default: 'image|image_(?:file|skyline|name|flag|seal) |cover|badge|logo'
|
More options may be added, and requests for more configurbility are welcome.
Advanced customization
Adding filters
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
window.extraPopupFilters = [];
// 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.)
Other examples
If you want to enable popupRedlinkRemoval
, popupFixRedirs
and popupFixDabs
features in all pages except the special ones, histories and previews (where those features are obviously useless) you can add these lines to your user JavaScript file:
// Normally features are enabled
var toFix = true;
// In special pages, histories and previews disable them
if ( mw.config.get( 'wgCanonicalNamespace' ) === 'Special' ||
$.inArray( mw.util.getParamValue( 'action' ), [ 'history', 'submit' ] ) !== -1 )
{
toFix = false;
}
//
window.popupRedlinkRemoval = toFix;
window.popupFixRedirs = toFix;
window.popupFixDabs = toFix;
Translations
Please see this page for translations of the script interface and of this page into other languages. You'll also find instructions for creating a translation yourself.
Browser problems
Google Chrome
If the user is using the Virtual Keyboard (by Google) extension, the popups may sometimes appear in the wrong locations, sometime off the screen entirely. Frequently, popups appear in the same location as the first, leading to several overlapping pop-ups since the pop-ups do not disappear even when the mouse no longer hovers over a link. This conflict with popups is present as of Version 0.9.8.8 of the Virtual Keyboard extension.
Internet Explorer
Pages with "–" in their titles will not display correctly in the popups. This bug does not exist in Internet Explorer 9, so upgrading will fix the bug.
Firefox
If a user on Firefox with the Adblock Plus extension installed cannot see the popup, only the normal tooltip, Adblock Plus may be blocking the operation of navigational popups. This can be solved by adding an exception to the filtering rules – go to the Main Page, right-click the icon in the status bar, and check Disable on en.wikipedia.org.
Firefox Addon - Linky may try to open all the extra links - e.g if viewing Special:NewFiles (100 files), and one selects "Open all image links in tabs", it often tries to open 400 odd links. Best to disable popups if you need to use Linky
Safari
The menus do not function correctly in some older releases of Safari. Using a version 3 or higher is supported.
Opera
Using a current version (11.0 or higher) should give correctly functioning popups. Using an earlier version, you may experience problems, such as popups not loading or not disappearing after the mouse is moved away.
This tool should not be affected by any browser popup blocking settings.
Userboxes
Code | Result | |||
---|---|---|---|---|
{{User:The Anonymouse/Userboxes/Navigation popups}} |
|
Usage | ||
{{User:UBX/Navigation popups}} |
|
Usage |
Also, there is a Navigation popups topicon. {{Navigation popups topicon}}.
Feedback
Please see wikishia talk:Tools/Navigation popups.
Footnotes
Credits and external links
This tool was primarily written by Lupin, who is currently no longer active on Wikipedia. It depends on some other people's work:
- User:Pilaf/InstaView (née Live Preview) by Pilaf for article previewing
- a JavaScript MD5 hash function by Paul Johnston and others, available here
- domdrag by Aaron Boodman
- An implementation of a diff algorithm by John Resig
Older versions of the tool used overlib by Erik Bosrup.
Wikipedians who have helped
- Brian0918 – a little code and lots of inspiration
- Eddideigel – translation work
- IceKarma – aborting download code, making much better use of bandwidth
- Mike Dillon – the page age code
- Yurik – with his fantastic MediaWiki BotQuery extension
- Zocky – the menus
- Zyxw – preview enhancements
- TheDJ – conversion from BotQuery to API.
- ....and many more with helpful suggestions, comments and bug reports