User:PerfektesChaos/js/logidTooltip

JavaScript gadget – show log ID tooltips on pages where log events are listed.

  • By [[Special:Redirect/logid/0123456]] it is possible to link one particular log action, like blocking, moving etc.
  • Problem: Pages where related action is listed do not show the ID.
  • phab:T125293 is tracking this issue since January 2016.

If MediaWiki software will show the ID numbers one day there is still an added value by offering wikitext which can be grabbed by C&P.

Usage

edit

Include the following line into your common.js, global.js etc.:

mw.loader.load( "https://en.wikipedia.org/w/index.php?title=User:PerfektesChaos/js/logidTooltip/r.js&action=raw&ctype=text/javascript" );

Behaviour

edit

On certain pages every logbook action will be equipped in the end with an arrow:  .

The pages in question are:

  • Special:log with all “subpages”
  • recent changes
  • current watch list
  • any deleted page which will show the related deletion logbook

Within such pages:

  • If mouse pointer is hovering over that arrow a browser tooltip will show the logID number.
  • When clicking on that arrow a small popup will show up.
    • The popup shows wikitext like [[Special:Redirect/logid/0123456]] which can be copied.
    • That text is also linked. The page with only that entry can be opened directly, or URL might be copied by browser context menu.
  • A second click on that arrow will close the popup again.
  • First click might take one second or another, depending on libraries which have been loaded already in page. The large OOui system will be requested, and if not yet present some delay maight occur once.

Configuration

edit

Individual desire may be passed to the gadget before loading.

Currently it is possible to exchange the icon:

  • You might want to display a light bulb instead:  
  • Then you need the thumb URL at Commons of that file.
  • Extract the two leading hexcodes, the slash and file name from URL: e5/Toicon-icon-lines-and-angles-think.svg
  • Pass that string to a mw.hook( "logidTooltip-icon" ) request.

The JavaScript code looks as follows:

// send icon request first
mw.hook( "logidTooltip-icon" ).fire( "e5/Toicon-icon-lines-and-angles-think.svg" );

// finally, load gadget
mw.loader.load( "https://en.wikipedia.org/w/index.php?title=User:PerfektesChaos/js/logidTooltip/r.js&action=raw&ctype=text/javascript" );

Internationalization

edit

Not really required for gadget itself now.

Suggestions on foreign languages may be offered, as well as a translation of this page.

Codes

edit
Source code
ResourceLoader
  • ext.gadget.logidTooltip for mw:Extension:Gadgets
  • Dependencies:
    • None required (self-completing)
    • oojs-ui-widgets etc. is loaded when required.
Namespaces Special
Cookies None
mw.hook
  • logidTooltip-icon
    Specify individual icon.
MediaWiki 1.30