User:PerfektesChaos/js/clickDivertimento

JavaScript gadget to add specific functionality on pages: Open particular links automatically on new browser window or tab.

This affects namely On most browsers a different window can be forced by simultaneous pressing [Ctrl] or [Shift]. If forgotten on page preview the edit change may be lost when returning to edit mode.
 * any page source text currently edited, to avoid loosing of edit work
 * watchlists (both recent and edit list) and “recent changes”, which may be used as persistent navigation overview
 * on individual request:
 * URL search special page
 * user contributions
 * page history
 * what links here

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 or similar:
 * The gadget works also with non-WMF sites using MediaWiki 1.18 or higher.
 * If not working as registered user the gadget can be activated by greasemonkey or browser user script.

Quick interactive costumization
The simple on/off switch options can be set interactively on as soon as the script library has been loaded.

When reloading a page the preferences declared here come into effect. This dynamic assignment overrides the static setting by JavaScript.

These user preferences are not visible to other users.

Even anonymous users may store preferences, but for current browser profile only (utilizing localStorage).

Configuration by JavaScript
Insert the following lines into your common.js (best before mw.loader.load, if present):

Example:

Include more list pages
On individual request apply to: The target window diverting is always applied to the list section of
 * URL search special page
 * user contributions
 * page history
 * recent changes
 * recent watchlist
 * edit watchlist
 * recent changes

All external links shall be opened in new browser window
On any page all links written as URL in source text shall be diverted.
 * Default: open in the same window, if no other reason.

Create entirely new window

 * For all diverted targets (default)
 * – Shared windows for the same tasks
 * – All in the same but different window

Use the same window for similar links
Specified URL patterns shall be collected within the same window. This window gets a specific name and will be reused.

This comes into effect if not requested “entirely new window for all diverted targets”, but some kind of window sharing.

A window name should begin with letter, only ASCII letters and digits, no more than 10 for distictive name.

Other languages
This gadget is prepared for multilingual support.
 * If you like a version in your own language, please forward translations to me:
 * This documentation page.
 * The  mapping on top of source code.
 * Further ISO 639 language codes your translation might support.


 * German

de:User:PerfektesChaos/js/clickDivertimento