User:PerfektesChaos/js/paneMarker

JavaScript gadget to emphasize browser windows or tabs currently used for input activities. Your valuable wiki contribution will be lost if you forget to save that, or may have been blocked unnoticed due to edit conflict or filter while you jumped to another task.

Multitasking genius? Ever lost in lots of panes and/or windows? The paneMarker (not painMaker) will help power users to keep survey over dozens of pages. First of all the tab favicon of important page activities should be shown with red background.

If not yet provided by project the page name may be presented in leading position of window title, if desired. Then it could be identified better in taskbar and tab list. Special activities can be marked by symbols. Note that the headline on the page itself is never affected.

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 skin dependant like vector.js:
 * If you are blocking scripts from sites other than your local Wiki you might need to put www.mediawiki.org on the whitelist.
 * The gadget works also with non-WMF sites using MediaWiki 1.18 or higher. You may want to provide your own icon definitions.

Red icon
If your current activity has been rated as vulnerable (like editing or creating a page or section, or uploading) an attempt is made to display an appropriate icon with red background. However, it depends on browser implementation whether this change becomes visible. See Image gallery.
 * Some browsers might refuse icon exchange since current domain could be, but alternative icon comes from   which may be regarded as security leak.
 * If the browser is given a choice between several icon formats the browser will decide on the appropriate image.

Internet Explorer
IE 7, 8 and probably 9 shows some strange behaviour: If an IE until version 9 is detected the automatic favicon exchange is dropped and an "*" is shown for projects with leading page name.
 * Obviously there is just one favicon administrated per domain. If the favicon of one document and the connected tab changes (to red), all tabs of the same domain may switch the same way. This is not what we need.
 * IE is rather reluctant to update the favicon according to modified definition.
 * Even worse: If something unexpected happens to the favicon, IE starts seaching the second level domain and accesses the /favicon.ico which is assigned now. If the expected favicon has been of the third level domain like a black globe of test.wikipedia.org IE shifts to wikipedia.org and shows the "W".

Short title
If not yet common in project the page name may be used as abbreviated window title, if  configured by user. You are not annoyed by leading “Pages that link to” consuming the entire visible width. The document area is not changed.

Changing project icon
All Wikipedia projects use the same W as icon. Developers would be overburdened to design distinctive favicons for nearly 300 sites. If you are frequently logged into another Wikipedia, working simultaneously on pages with nearly the same name, you might equip your common.js there with W is that one is spanish, or W if english or french. See collection for examples ready to go, e.g..

Distinguishing mark
On some project sites the name of the current page is leading the document title, therefore the beginning of the name is visible in tab bar and (for separated windows) also in the taskbar — at least for the current window on tabbed pane.

However you don’t know which action is taken right now with this page, since that is described at the end of the title text. To give you an idea whether it is more than only a view, the following characters might be displayed between tab icon and generic document title:
 * The feature is activated automatically if your site is known to display page name first, then activity.
 * Appearance is subject to full customization.

Namespace shortcut
If you are neither in main (article) space nor on a special page, the configuration is searched for a namespace shortcut. If found, that one will be used in document title. Now you might get an idea which page is covered below a tab — when all you have read before was “Wikipedia talk:…” you might prefer “WT:”.

Customization
You may adapt appearance and behaviour to your specific needs.

Insert the following statement into your standard user script like common.js (best before mw.loader.load, if any): Example: Note: Customization may be ignored if not put into a standard user script, since other scripts are loaded later and paneMarker has no knowledge about, won’t wait for them.

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 code itself is working without human language items.
 * However, you might want specific support for your project (label arrangement, other icons, default behaviour).


 * German