UESPWiki:Javascript/Navpopup

Configuration (optional)
There are dozens of configurable settings that add or remove various powerful features, explained in depth below.

Seven optional structures
There are seven built-in style variations: shortmenus (default), menus, lite, original, nostalgia, fancy, fancy2. 
To change your selection, see the two   bits in the #Options just below. 

 

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 that makes the text a bit bigger.
 

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.

 

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.  =  ;  where     and     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:

 

{| class="wikitable sortable" style="border-spacing: 4px" border="1"
|+ Configuration options
|-
!Option
!Values  
!class="unsortable"|Description
|- class="sortbottom"
|colspan="3" style="text-align: right;"|
|- class="sortbottom"
!colspan="3" style="text-align: center;"|Basic
|-
| 
| , a decimal number
|The number of seconds before popups appear.
|-
| 
| , a decimal number
|The approximate number of seconds between the mouse leaving a popup and its disappearance.
|-
|  
| ,  
|If you just want the links or find the amount of bandwidth consumed too great, then set this to  . No data will be downloaded and the popups will just consist of a list of links unless you set one of the following options to  :   ,  ,  ,  ,  .
|-
| 
| ,  ,  ,  ,  ,  ,  
|Select the structure of the popups – view example screenshots above. The   setting, which is the default if   is   (or if your browser is known not to support menus), has all the navigation links in the popup itself;  ,   and   are variants of this. The   setting, which is the default if   is not  , puts the navigation links in popup menus which appear when you mouseover the links beside the popup title.   is a more extensive version of   with more links. Finally,   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.  .
|-
| 
| ,  
|When using menus, you can either have the title link in the popup generating a menu (if this is set to  ) or a separate "actions" menu (if this is set to  , the default).
|-
| 
| ,  
|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.
|-
| 
| ,  
|If this variable is set to   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 ' '. Pressing escape should hide the popup, too.
|-
| 
| ,  
|When hovering over links to old revisions and diff links, extra links such as "editOld" are generated if this is  . Otherwise, you get the same links as when hovering over an ordinary link.
|-
| 
| ,  
|If  , then popups are only generated for links in the article. Otherwise, many other links (such as Edit, Help) get popups too.
|-
| 
| , an integer or  
|The maximum width of the popup in pixels. Setting this to   means the popup will expand to accommodate its contents.
|-
| 
|an integer or  
|The initial width of the popup in pixels. Setting this to   means the popup will initially be the size needed to accommodate its initial contents.
|-
| 
| ,  
|Whether or not to create popups for the Table of content items. Set   to create popups for table of content.
|-
| 
| ,  
|If this is   then popups are generated for links in previews.
|-
| 
| ,  , ...
|The name of an element by which the popup can be dragged without holding the shift key. If  , then the popup can be dragged using the shift key instead.
|-
| 
| ,  
|If this variable is set to   then only pages that look like stubs or disambiguation pages in the article namespace are treated specially. (Setting this to   can lead to lots of false positives).
|-
| 
| ,  
|If true, then dates in history, diff and user contributions previews are adjusted according to the settings in your user preferences.
|-
| 
|  (default),  ,  ,  ,  
|Lets popups only appear when pushing a modifier key while hovering over the links. This prevents unintentional popups that hide page content.
|- class="sortbottom"
!colspan="3" style="text-align: center;"|Images
|-
| 
| ,  
|If this is   then images are never displayed.
|-
| 
| ,  
|By default, preview images are loaded even when hovering over visible images. Setting this to   turns that off. If   is set to  , then the default value for this option is  .
|-
| 
| ,  ,  
|This controls what happens when you click the image in a preview.   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;   means the image size is toggled on click, and   means that the image links directly to the full size version.
|- class="sortbottom"
!colspan="3" style="text-align: center;"|Redirs, Dabs, Reversion
|-
| 
| ,  
|If this variable is set to   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 the About fixing redirects subpage.
|-
| 
| ,  ,  
|The button which is automatically pressed when fixing redirects. If set to   you do not need to confirm the change.
|-
| 
| ,  
|If this variable is set to   then you can automatically "fix" links to disambiguation pages by clicking one of the links at the very bottom of the popup.
|-
| 
| ,  ,  
|The button which is automatically pressed when fixing (or removing) links to disambiguation pages. If set to   you do not need to confirm the change.
|-
| 
| ,  
|If this variable is set to   then you can automatically remove links to non-existent pages (so-called "red links") by selecting "Remove this link".
|-
| 
| ,  ,  
|The button which is automatically pressed when removing red links. If set to   you do not need to confirm the change.
|-
| 
| ,  ,  
|If this variable is set to   then fixed dab pages will always be watched; if it's  , then they'll always be unwatched. If it's  , then the page will be watched or unwatched according to the settings in your user preferences.
|-
| 
| ,  ,  
|If this variable is set to   then fixed redirect pages will always be watched; if it's  , then they'll always be unwatched. If it's  , then the page will be watched or unwatched according to the settings in your user preferences.
|- class="sortbottom"
!colspan="3" style="text-align: center;"|Navlinks
|-
| 
| ,  
|If this is   then navigation links are displayed. If  , then these are switched off.
|-
| 
| ,  
|Whether the popup should contain a "most recent edit" link.
|-
| 
| ,  
|The edit counter tool to use or a custom url defined by  .
|-
| 
| 
|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).
|- class="sortbottom"
!colspan="3" style="text-align: center;"|Previews, etc.
|-
| 
| ,  
|If this is   and you haven't set  , 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  , then this is switched off.
|-
| 
| ,  
|If this is   summary data for the target page is displayed. If  , then this is switched off.
|-
| 
| ,  
| If set to   show user info when the target page is in a user's or user talk's namespace. If   is set to  , then the default value for this option is  .
|-
| 
| ,  
|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.
|- class="sortbottom"
!colspan="3" style="text-align: center;"|Diffs
|-
| 
| ,  
|If  , the dates of the revisions being compared are shown when previewing diffs.
|- class="sortbottom"
!colspan="3" style="text-align: center;"|Misc.
|-
| 
| ,  ,  ,  
|If this is   then popups are generated for selected wikilinks when editing.
|-
| 
| ,  
|If  , pages linking to an image should appear in the preview. This currently does not work for commons images.
|-
| 
| ,  
|If  , a gender symbol is displayed in popups showing user info.
|- class="sortbottom"
!colspan=3|Edit summaries
|style="text-align: right;"|
|-
| 
| ,  
|If true, you will be given the chance to change the default revert summary with each reversion.
|-
| 
|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.
|-
| 
|a string
|default: 'Revert to revision dated %s by %s, oldid %s using popups'
|-
| 
|a string
|default: 'Revert to the revision prior to revision %s using popups'
|-
| 
|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.
|-
| 
|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.
|-
| 
|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.
|-
| 
|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.
|-
| 
|a string
|The edit summary used when removing red links. The first %s appearing in this string is replaced with the red link name.
|-
| 
|a string
|default: 'Remove link to dab page %s using popups'
|- class="sortbottom"
!colspan=3|Preview options
|style="text-align: right;"|
|-
| 
| , an integer
|Preview at most this many edits from the top of the page's history.
|-
| 
| ,  
|Whether or not to preview members of categories. If   is set to  , then the default value for this option is  .
|-
| 
| ,  
| Show previews for diff links. If   is set to  , then the default value for this option is  .
|-
| 
| ,  
|Whether or not to generate special previews for links to history pages. If   is set to  , then the default value for this option is  .
|-
| 
| , an integer
|Preview at most this many user contributions.
|-
| 
| ,  
|If  , templates referred to in an article are simply deleted from previews; otherwise, they're shown as raw wikitext.
|-
| 
| ,  
|If  , 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.
|-
| 
| ,  
|If  , previews are restricted to the first paragraph of the article.
|-
| 
| , an integer
|The maximum number of sentences to extract from something approximating the beginning of an article for the preview.
|-
| 
| , an integer
|The maximum number of characters to extract from something approximating the beginning of an article for the preview.
|- class="sortbottom"
!colspan=3|Experimental and/or undocumented options
| style="text-align: right;"|
|-
| 
| ,  
| Show an "accept this version as reviewed" link. 
|-
| 
| ,  
| Additional menu to disable or reset popups itself
|-
| 
| ,  
| Shows only the subpage part of a title, for popups outside of mainspace
|-
| 
| ,  
|
|-
| 
| ,  
|
|-
| 
| ,  
|
|-
| 
| ,  
|
|-
| 
| ,  
|
|-
| 
| , an integer
|
|-
| 
| , an integer
|
|-
| 
| ,  
| Mark reverts/edits as minor changes
|-
| 
| ,  
| Determine position of the option to disambiguate the link to point to wiktionary instead.
|-
| 
| ,  
|
|-
| 
| ,  
|
|-
| 
| 
|
|-
| 
| , an integer
| Maximum number of lines to process for the diff
|-
| 
| , an integer
| Number of lines before and after each change to include in the diff
|-
| 
| , an integer
|
|-
| 
| , a string
|
|-
| 
| , an integer
| The maximum amount of history to search through for the changes since my last edit. NOTE: misnomer
|-
| 
|array
|default:  
|-
| 
| , an array
|
|-
| 
|string
|default:   Determines where to link to when showing revision deleted versions in the history
|-
| 
| ,  
| Should links inside the previewed content be opened in a new window.
|-
| 
|string
|default:  
Allow lastContrib or sinceMe links to open in a separate window. NOTE: not functional right now.
|-
| 
|string
|default:  
|-
| 
| , a string
|
|-
| 
|string
|default:  
|-
| 
|string
|default:  
|}

More options may be added, and requests for more configurability 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   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 (/ 

Then when a popup is generated for a page containing an HTML table, you should see &lt;table&gt; 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  ,   and   features in all pages except the special ones, page histories and page previews (where those features are obviously useless) you can add these lines to your user JavaScript file:

 
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.uesp.net.

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.