Extension:Proofread Page/Page viewer

Background
The ProofreadPage extension uses the popular OpenSeadragon (OSD) library to provide a zoomable image viewer in the Page namespace and the Pagelist editor. This provides various useful features:


 * A well-known and robust JS API for script and gadget extensibility
 * Zoom and panning that works on desktop and mobile
 * A well-maintained upstream codebase

OpenSeadragon replaced the previous home-made jQuery implementation in release 1.38.0-wmf.9.

Keyboard naviagation
The default OpenSeadraon keyboard bindings are used:


 * w, up arrow — move viewport up
 * s, down arrow — move viewport down
 * a, left arrow — move viewport left
 * d, right arrow — move viewport right
 * 0 — zoom / move viewport home
 * - _, Shift + W , Shift + up arrow — zoom viewport out
 * =, + , Shift + S , Shift + down arrow — zoom viewport in
 * r — rotate clockwise
 * R — rotate counterclockwise

mw.hook
The following mw.hooks are fired:

mw.proofreadpage
The following objects are presented in the  global object:

mw.proofreadpage.viewer
The OpenSeadragon viewer object. Only valid after.

This can change, e.g. after the viewer is swapped from horizontal to vertical mode.

mw.proofreadpage.$viewportControls
Pending review: 

A jQuery object that holds a  that contains controls for the viewer, which is placed in the WikiEditor toolbar. Scripts can add new controls to this area. Only valid after.

Use by scripts and gadgets
Scripts and gadgets can use the API for anything supported by the OpenSeadragon API via the  object.

Changing the image
The image can be changed by adding an image to the viewer.

For "simple" images (i.e. where you have just an image URL):

You can also directly add an IIIF tiled image source:

Adding buttons to the viewport control toolbar
These can be directly added to the  element:

Tools do not have to go in this toolbar to interact with the OpenSeadragon viewer; they can also go in the sidebar, the normal toolbar (for which the WikiEditor toolbar configuration system can be used) or anywhere else in the DOM.