Guild Wars 2 Wiki:Popups
Popups are provided by the Popups extension, and provide page previews when hovering over any wiki link. They can provide a quick reminder of what a sentence is talking about without having to visit the page and return to it, speeding up the browsing experience of using a wiki.
This page serves to document any quirks of setting up the popups.
Required extensions[edit]
- Extension:Popups — draws the box, requests images and text from the info API.
- Extension:PageImages — API enhancement to allow a likely main image to be extracted.
- Extension:TextExtracts — API enhancement to allow the first few sentences to be extracted.
List of helper templates[edit]
- Template:Wikipopup — a wrapper template applying the CSS class
wikipopup
. - Template:Wikipopup prefix — a plaintext variant to Template:Prefix attributes for Armor, Back item, Trinket and Weapon infoboxes.
- Template:Wikipopup upgrade — a plaintext template to display upgrade and infusion slots for Armor, Back item, Trinket and Weapon infoboxes.
- Template:Wikipopup quotation — quotation source, e.g. " — In-game description".
- Template:Wikipopup extended queries — used to enhance the tooltip for skills and traits.
Extended popups[edit]
Extended popup functionality is supported by the wikipopupExtended
script held within MediaWiki:Common.js, alongside additional CSS within MediaWiki:Common.css. The following enhancements are provided by this script:
- All popups have their page title added as a header.
- Skills and traits have their top-right icon properties (recharge, activation, etc) added as icons, plus all of their skill facts (such as damage, range, etc) added as list elements.
- Skills and traits which have facts split by game mode have a button to change the displayed facts.
Useful notes[edit]
- Images
- The most likely image to be extracted by the extension PageImages is one of the first four images in an article which has a major dimension (either width or height) between 400-600px, and the major dimension is approximately twice the value of the other minor dimension, 200-300px. The extracted page image can be found in the Basic information section in "Page information" (in the right tool bar or by appending
?action=info
to the URL of any page). - Images with a ratio (width/height) of 0.4 to 3.1 are allowed, while images with a ratio of 0.6 to 2.1 are preferred. This means that a first listed image with an allowed but not preferred ratio (e.g. 0.5) might not be weighted over a second listed image with a preferred ratio (e.g. 1).
- The extension Popups, using the extracted page image in the preview, distinguishes between two image types:
- Portraits (height > width) are displayed to the right, and have the maximum width of 203px and the exact height of 250px. As an example, hover the following link: Eir Stegalkin.
- Landscape (width > heigth) are displayed above, and have the exact width of 320px and the maximum height of 200px. Example: Kiriel Rock.
- This means that portrait images with a height less than 250px and landscape images with a width less than 320px are not displayed in the page preview even if they have been extraced by the page images extension.
- Popup information is cached, so if you edit an article the preview of the page will not update immediately, even after updating the wiki cache of both pages and clearing your own cache. You just need to wait (or you can edit the page and add/remove a link - since this is the only time the image is recalculated).
- There is a blacklist page available - each image to avoid using must be separately linked on MediaWiki:Pageimages-blacklist.
- Text
- By default the following element types are excluded:
table
div
script
input
style
ul.gallery
sup.reference
ol.references
- By default the following element classes are excluded:
.mw-editsection
.error
.nomobile
.noprint
.noexcerpt
.sortkey
- This means, for example, that text can be intentionally excluded with the class
noexcerpt
. - The template Template:TOCright seems to inconsistently block the TextExtracts for unknown reasons, while sometimes after purging the page it works fine, soon afterwards it "forgets" the extracted text again. This can be avoided by placing the template below the first paragraph.
- Debugging
- Popups are abandoned/destroyed after the mouse leaves the area over the link. The popup creation event can be stimulated with the "mouseenter" event (as noted here), e.g.
$($0).trigger('mouseenter');
Known issues[edit]
- PoIs without a description give an error. Ex: Denning Forge. Adding any description fixes the error: Example
- If description contains a WP code, it is not displayed at all. Ex: Defeat the rotlings to save the Astral Ward scout
Debatable how much following is an issue, but pages with longer descriptions are just cutoff. Ex with vertical image: Guild Wars 2: Secrets of the Obscure, Ex with horizontal image Eparch
See also[edit]
- Special:Version lists the currently installed versions of Extension:Popups, Extension:TextExtracts and Extension:PageImages.