# App/Xtn/Html/Popups

From XOWA: the free, open-source, offline wiki application

XOWA Popups appear when hovering over a link. They will show the first part of the page for the hovered link.

## Purpose

XOWA Popups shows a preview of an article when hovering over a link. It has the following benefits:

- No click: Articles can be retrieved by hovering over a link rather than clicking on it.
- Same view: The preview shows up in the same visual space as the current article, where the current text is still available.

## Usage

- Hover over a link to popup a preview
- Links in popups are also previewable. Note that only 2 popups can be visible at any point in time.
- Hovering over the 2nd popup will display a 3rd popup, but the 1st popup will disappear.
- Each popup has a control panel with the following commands
  - Open popup's page in current tab
  - Open popup's page in new tab and switch focus to the new tab
  - Open popup's page in new tab but stay on current tab
  - Bookmark popup's page
  - Show more text from the popup's page
  - Show all text from the popup's page
  - Go to the Popup option page.

## Background

XOWA Popups is based on MediaWiki's Hovercards and Navigation popups. It does not aim to be an exact reproduction of either, but picks the best features from each.

The javascript was modified from Reference tooltips, which was kindly provided by Schnark.

## Design principles

The following is a list of intentional design differences from MediaWiki's Hovercards and Navigation Popups:

- Popups retrieve as much text as possible, including sections, not just text from the introductory paragraphs. This behavior is necessary because:
  - Wikis like Wiktionary don't have a concept of an introductory paragraph.
  - Many articles have very short introductory sentences, which do not provide much info.
- Popups are word based, not sentence based. There are some defects with MediaWiki's Hovercards which stops at abbreviations. For example, "St." counts as a sentence.
- Popup lengths are customizable, not fixed (unlike MediaWiki Hovercards's 2 sentences)
- Popups show links, lists, advanced formatting, and math equations.

## Future changes

- Redlinks: Popups do not indicate missing links in red. This should be added within the next few releases
- Single image: XOWA will provide a single image preview, just like MediaWiki Hovercards. However, it may be several weeks before this is included.
- Popup window management: Popups are automatically hidden / shown based on mouse movement. A future version may provide the ability to "move", "pin", "close", etc. I may need some help with the javascript to do so. See: /xowa/bin/any/xowa/html/modules/xowa.popups/xowa.popups.js
- Performance: Most articles should preview in less than one second, but some articles may take as long as 5. This performance will be improved whenever HTML dumps are included in XOWA, though this may be several months.

## Technical details

### Words

XOWA Popups has the following rules for words:

- A word is one or more characters terminated by a space, tab, new line, wikitext token, or end of document. For example, "A B C" is three words: 2 terminated by a space, and one by the end of the document. Meanwhile, "A[[B]]C" is three words, as `[[` and `]]` are wikitext tokens.
- Words inside a <table>, <div>, [[File:]], or [[Category:]] are not included.
- Words counts are not exact. Currently, the following rules govern word counts, but may change in the future:
  - A header counts as one word. For example, "== A B C ==" is one word, not three.
  - The entire caption of an external link counts as one word. For example, "[http://a.org b c d]" is one word, not three.

### Parser

XOWA Popups uses a modified version of the XOWA parser. The popup parser has the following attributes:

- Faster incremental parsing: An article is parsed incrementally, in smaller pieces, rather than all at once. This allows for speedier, sub-second article views, which is important for large articles (> 40 KB).
- Textual data only: In keeping with both MediaWiki approaches, only textual data is shown. Tables, boxes (infoboxes, navboxes), and images are removed from the preview.

### XOWA

- Main page
- Screenshots
- Video
- Download XOWA
- Download wikis

### Getting started

- Requirements
- Installation
- Simple Wikipedia
- English Wikipedia
- Other Wikipedias

### Android

- Setup
- Video

### Help

- About
- Contents
- Media
- Feedback

### Blog

- Current

### Links

- Wikimedia dumps
- XOWA @ archive.org
- English Wikipedia

### Donate

- archive.org
- Wikipedia
- XOWA