Jump to content

User:PerfektesChaos/js/externalLinkProblem

From Wikipedia, the free encyclopedia

JavaScript gadget – display and manage problematic external links in page view or preview.

Problematic external links may be:

  • URL which could not be responded for several weeks or months now. This might have been detected automatically by some bots or tools, but also manually.
  • URL which are inappropriate, e.g. occurring on spam blacklist. If an URL got banned there, this won’t affect any page, nor does it hinder editing and saving this page including undesired URL, as long the list of external links did not change by the edit.
  • URL which should be rewritten as wikilinks to enable whatlinkshere or global usage.

Functionality

[edit]

On any subject page in selected namespaces the existence of problematic external links is indicated to the user.

  • A box is displayed in page head region.
  • External links in question are listed to the users.
  • Hints on causes, remedies or other additional information may be given for each link.
  • On displayed HTML, the problematic links might be marked and equipped with helpful functionality.

Proliferation

[edit]

Currently the background infrastructure is available on German Wikipedia only.

The gadget is developed to be used on any wiki, especially being supported by a wmflabs.org database tool.

Usage

[edit]

Insert these lines into personal common.js:

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

User configuration

[edit]

The initial environment and the behaviour can be equipped by each user individually.

Quick interactive costumization

[edit]

Options can be set interactively on Special:Blankpage as soon as the script has been loaded. On pages where the box appears, a button is offered in the top right corner, which opens Special:Gadgets in a new browser tab or window.

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

Anonymous users can use this mode, too; options will be stored in browser profile rather than on wiki server.

Configuration by JavaScript

[edit]

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

if ( typeof mw.libs.externalLinkProblem !== "object" ) {
   mw.libs.externalLinkProblem   =  { };
}
mw.libs.externalLinkProblem.key1 = value1;   // example
Key Value Bedeutung
list true Show bot activity on watchlist (talk page mode).
Default: false – delete bot activity on watchlist.
later true Show watchlist without FUOC.
Default: false – Bot-Aktivitäten blitzen vermutlich kurz auf.
last true Treat “recent changes” like watchlist.
Default: false – ignore “recent changes”.
low true No investigation of Details.
Default: false – determine details.
lone true No hint on talk page.
Default: false – Show hints on both subject and talk page (talk page repository mode).
lazy true Ignore presence of URL on subject page.
Default: false – check against effective URL (on talk page, in talk page repository mode).
loose true Open completely new window/tab for talk page and other link always.
Default: false – reuse window/tab for links.
levels true Offer segmented URL path.
Default: false – no additional links.
lookup true Link Google search.
Default: false – no additional link.
mode 0 Unfold details.
Default: 0 – start folded.
1 – memorize last state in window/tab.
2 – start always unfolded.
debug true Development.
Default: false – run minimized code.
true – use human readable code.

Origin of information

[edit]

There are two ways how the list of undesired URL could be retrieved:

  1. From a template transclusion on the adjacent talk page.
  2. From a tool searching a database on wmflabs.org (not yet existing).

Sub-modules

[edit]

The code is divided into several modules. Only the head module is to be loaded by user into selected pages. The head module will decide on appropriate further steps and load required sub-modules, scripts, resources when really needed. This keeps the head module as slim and fast as possible if nothing to do.

The following table shows which scripts are loaded under which conditions:

head module wherever regarded as meaningful
talk
  1. If (adherent) subject page or talk page is configured to be supported and
  2. if project has been configured to use a template on talk page as repository.
query
  1. If this is a subject page to be supported and
  2. if project has been configured to ask a wmflabs tool.
gui
  • If evaluation yields any information to be displayed.
prego
category
  1. If project has been configured to use a template on talk page as repository and
  2. in category namespace only.
watchlist
  1. If project has been configured to use a template on talk page as repository and
  2. on Special:Watchlist or Special:Recentchanges only.

Other languages

[edit]

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 lang.texts mapping on top of source code in gui and others.
    • Further ISO 639 language codes your translation might support.

Codes

[edit]
Source code

(head module)

ResourceLoader
Namespaces
Cookies externalLinkProblem
  • (sessionStorage) Memorize toggle state.
  • (localStorage) Anonymous user preferences only.
mw.libs externalLinkProblem
mw.hook externalLinkProblem.ready
MediaWiki
  • 1.26 (mw.storage) options for anonymous users
  • 1.23 for registered users