User:PerfektesChaos/js/superscriptMagnifier

JavaScript gadget – magnify superscript (and subscript) characters.

Reading measures like m³ and in² for areas, volumes etc. may overstrain people with eyes less sharp as an eagle, or when selected font is using a very dense representation. In general, the meaning might be guessed from the context even when the figures were not recognized.

This tool exchanges the small characters in a wiki page against a variant of the basic font: m3 and in2 rather than m³ and in².

Usage

 * If your project has registered this as a gadget, just activate on your Preferences page.
 * Otherwise include the following lines into your common.js, global.js etc.:

Effects

 * Which pages will be affected?
 * Any page with user written wikitext.
 * This goes also for preview in source code editing, VisualEditor and LivePreview intermediate results.


 * Which pages and modes will be ignored?
 * Special pages, diff pages, history, page info, media view.
 * Some pages may be excluded by system or can be configured via  option. This documentation page shall be excluded to demonstrate the difference.
 * Very large pages may be ignored by  user request.


 * Is the entire page subject to modification?
 * No, content area only.
 * Headline, portal frame with navigation and footers won’t be modified, nor forms and edit fields.


 * What about preformatted text?
 * Regions in,   and   are kept.
 * Currently HTML entities are resolved by the server and not distinguished in the HTML document. If ever, entities would be ignored.


 * Are all superscript and subscript characters magnified?
 * No, by default the most common ANSI digits ¹²³ will be detected for performance reasons.
 * By  this may be extended to all latin characters.
 * With disabling the  limitation greek and asiatic letters  will be covered as well.

User options
The defaults may be adjusted, and additional decoration may be applied.

Configuration by JavaScript
Insert the following lines into common.js etc. (best before mw.loader.load):

CSS
When the  option is active, CSS selectors will be generated together with the elements. That may be used for debugging and further investigations; undesired characters may be detected.
 * .superscriptMagnifier
 * All generated elements.


 * .superscriptMagnifier-ucs
 * Characters beyond ANSI.


 * #superscriptMagnifier-info
 * Box at bottom of page for debugging.


 * .error
 * Characters beyond ANSI, when.

The following lines may be inserted into your common.css, global.css or skin dependant CSS. Any attribute value may be applied.

Codes
/SuMag/ is an independent subsystem applicable to any HTML document out of wiki context.

de:User:PerfektesChaos/js/superscriptMagnifier