User:PerfektesChaos/js/lintHint/d.js: Difference between revisions

Content deleted Content added
-1.0
 
-5.8
 
(43 intermediate revisions by the same user not shown)
Line 1:
/// User:PerfektesChaos/js/lintHint/d.js
/// 2024-07-04 PerfektesChaos@de.wikipedia
// Show LintErrors analysis live
// ResourceLoader: compatible;
/// 2017-08-09 PerfektesChaos@de.wikipedia
// dependencies: user,
// ResourceLoader: compatible;
// mediawiki.API, mediawiki.storage, mediawiki.util
// dependencies: user, mw.API
/// Fingerprint: #0#0#
/// License: CC-by-sa/4.0
/// @license GPL [//www.mediawiki.org/w/COPYING] (+GFDL, LGPL, CC-BY-SA)
/// <nowiki>
/* global window: false */
Line 12 ⟶ 13:
laxbreak:true,
nocomma:true, strict:true, undef:true, unused:true */
 
 
 
Line 17 ⟶ 19:
( function ( mw, $ ) {
"use strict";
var Version = -15.08,
Signature = "lintHint",
HINT = { doccmodels: { "en:User:PerfektesChaos/js/wikitext": + Signaturetrue,
errors: [ "bogusproofread-image-optionsindex": true,
"deletableproofread-table-tagpage": true },
doc: "en:User:PerfektesChaos/js/" + "fostered"Signature,
drop: "ignored-table-attr"false,
errors: [ "misnestedbogus-image-tagoptions",
"missingdeletable-endtable-tag",
"missing-start-tagfostered",
"mixedhtml5-contentmisnesting",
"obsoleteignored-tagtable-attr",
"selfinline-closedmedia-tagcaption",
"strippedlarge-tagtables",
"pwrapmisc-bugtidy-workaroundreplacement-issues" ],
idRev: 0 "misnested-tag",
last: true "missing-end-tag",
later: false "missing-start-tag",
launch: false "mixed-content",
launched: false "multi-colon-escape",
lazy: false "multiline-html-table-in-list",
live: false "multiple-unclosed-formatting-tags",
ltr: true "night-mode-unaware-background-color",
using: [ "mediawiki.apiobsolete-tag",
"mediawiki.api.messagespwrap-bug-workaround",
"mediawiki.utilself-closed-tag" ],
$body: false "stripped-tag",
$page: false } "tidy-font-bug",
"tidy-whitespace-bug",
"unclosed-quotes-in-heading",
"wikilink-in-extlink" ],
idRev: 0,
indicators:".mw-indicators",
last: true,
later: false,
launch: false,
launched: false,
layer: null,
lazy: false,
live: false,
ltr: true,
quiet: [ "large-tables",
"night-mode-unaware-background-color"
],
selMain: "[role='main']",
silent: false,
source: false,
spaces: false,
using: [ "mediawiki.api",
"mediawiki.storage",
"mediawiki.util",
"user.options" ],
$body: false,
$content: false,
$main: false,
$textarea: false,
$widget: false },
API = { Api: false,
errors: false,
scream: false,
serviceserver: "transformapi/wikitextrest_v1/to/lint" },
scanner: "transform/wikitext/to/lint",
swift: "page/lint" },
BOX = { bgc: "FFFF00",
bgcErr: "FFE4E1",
Line 56 ⟶ 89:
fgc: "000000",
fgcRun: "A0A0A0",
swift: false,
$box: false,
$collapsed: false,
Line 62 ⟶ 96:
$other: false,
$pagename: false,
$swift: false,
$tbody: false,
$table: false,
$top: false },
EDIT CODMIRROR = { listencm: false false},
EDIT = { layer: live: false,
$sourcelisten: false } false,
GUIDER = { live: false,
reTrimselTextbox: false"div[role='textbox']",
usingselVEsrc: [ "mediawiki.ui.buttonve-init-mw-desktopArticleTarget-",
+ "mediawiki.ui.inputuneditableContent" ],
source: false,
sourceVE: "&veaction=editsource",
$source: false },
GUIDER = { last: false,
live: false,
reTrim: false,
suitable: String.fromCharCode( 0x2714 ),
using: [ "jquery.textSelection",
"mediawiki.ui.button",
"mediawiki.ui.input" ],
$pagename: false },
LINTERINFO = { },
LINTER = { live: false },
PREGO = { app: false,
signaturelive: "preferencesGadgetOptions" }; false,
maxage: 604813,
pars: [ [ "last", "boolean" ],
[ "later", "boolean" ],
[ "launch", "boolean" ],
// [ "layer", "boolean" ],
[ "lazy", "boolean" ],
[ "silent", "string" ],
[ "spaces", "string" ] ],
signature: "preferencesGadgetOptions",
site: "w:en",
store: "User:PerfektesChaos/js/",
sub: "/r.js" },
REPOS = { },
TMPLXPAND = { live: false },
UPDATE = { },
WIKED = { };
 
 
 
HINT.texts = {
// 20172019-0801-0719 PerfektesChaos@de.wikipedia
"desc": {"en": "Show LintErrors analysis live.",
"de": "Zeige LintErrors-Analyse live."},
"it": "Mostra analisi degli errori di Lint"
"___domain": {"en": "en.wikipedia.org",
"de": + "de.wikipedia in diretta.org"},
"howTo___domain": {"en": "Fill balanced wikitext into first input areaen.wikipedia.org",
+"de": " and press adjacent submit buttonde.wikipedia.org"},"
"howTo": +{"en": "Fill or enter pagebalanced namewikitext into secondfirst input field.area",
"de": + "Füge ausgeglichenenand press adjacent submit Wikitextbutton,"
+ " inor enter page name dasinto oberesecond Eingabefeldinput ein,field"
+ " oder(might einenbe Seitennamenfollowed inby dasrevision untere,ID).",
+"de": "Füge und betätige die jeweiligeausgeglichenen Schaltfläche.Wikitext"},
+ " in das obere Eingabefeld ein,"
"noPage": {"en": "Wikitext page not found",
"de": + "Wikitext-Seite nichtoder einen Seitennamen in das gefundenuntere"},
+ " (ggf. gefolgt von einer Versionsnummer),"
"other": {"en": "Future problems detected.",
"de": + "Zukünftige Problemeund betätige die jeweilige detektiertSchaltfläche."},
"it": "Inserisci il wikitesto"
+ " nella prima area di input e premi"
+ " il tasto di invio adiacente,"
+ " oppure scrivi il titolo della pagina"
+ " nel secondo campo"
+ " (potrebbe essere seguito"
+ " dall’ID della revisione)."},
"mark": {"en": "select problem in source text",
"de": "Problem im Quelltext selektieren",
"it": "Seleziona un problema nel testo sorgente"},
"noPage": {"en": "Wikitext page not found",
"de": "Wikitext-Seite nicht gefunden",
"it": "Pagina di wikitesto non trovata"},
"other": {"en": "Future problems detected.",
"de": "Zukünftige Probleme detektiert.",
"it": "Futuri problemi individuati."},
"^suffix": {"en": "&#8211; linter error analysis support",
"de": "&#8211; Unterstützung"
+ " der Analyse von Linter-Fehlern",
"it": "&#8211; Supporto"
+ " per l’analisi degli errori di Lint"},
"^^last": {"en": "Analyze previous revisions, too.",
"de": "Analysiere auch frühere Seitenversionen.",
"it": "Analizza anche le revisioni precedenti."},
/*
"^^later" {"en": "",
"de": "Zeige auch zukünftige Fehlertypen,"
+ " zu denen noch keine"
+ " Linter-Kategorien existieren."},
*/
"^^launch":{"en": "Run analysis automatically in namespaces"
+ " on visit"
+ " rather than manually triggered by button.",
"de": "Löse die Analyse automatisch"
+ " beim Seitenbesuch in den Namensräumen aus,"
+ " statt sie manuell"
+ " über den angebotenen Knopf zu starten.",
"it": "Esegui automaticamente l’analisi"
+ " nei namespace all’accesso, "
+ " piuttosto che avviandola manualmente "
+ " tramite bottone."},
/*
"^^layer": {"en": "Convert all source edit links on"
+ " LintErrors special page"
+ " into ParserMigration tool edit.",
"de": "Wandle auf der LintErrors-Spezialseite"
+ " alle Verlinkungen zur Quelltextbearbeitung"
+ " in das Migrationswerkzeug um.",
"it": "Converti tutti i link di modifica sorgente"
+ " presenti"
+ " sulla pagina speciale Errori di Lint"
+ " nello"
+ " strumento di modifica ParserMigration."},
*/
"^^lazy": {"en": "Suppress small label if no error detected.",
"de": "Unterdrücke das kleine grüne Feld,"
+ " falls bei einer Seitendarstellung"
+ " kein Problem gefunden wurde.",
"it": "Nascondi l’etichetta"
+ " in assenza di errori rilevati."},
"^^spaces":{"en": "Space separated list of namespace numbers,"
+ " for automatized analysis"
+ " or - for none or * for all",
"de": "Namensraum-Nummern für automatische Analyse,"
+ " durch Leerzeichen getrennt,"
+ " oder - für keine oder * für alle",
"it": "Lista di namespace,"
+ " in formato numerico separati da spazi,"
+ " dove effettuare l’analisi."
+ " Usare - per la lista vuota"
+ " e * per indicarli tutti."},
"^^silent":{"en": "Suppress these error types"
+ " (space separated list),"
+ " or - for all shown or * for auto default",
"de": "Unterdrücke diese Fehlertypen"
+ " (Leerzeichen-getrennte Liste),"
+ " oder - für alle zeigen"
+ " oder * für Vorgabe"}
}; // HINT.texts
 
Line 107 ⟶ 247:
// >< HINT.$body
// < HINT.ltr
// 2017-08-0119 PerfektesChaos@de.wikipedia
if ( ! HINT.$body ) {
HINT.$body = $( "body" );
HINT.ltr = ( !$( HINT"html" ).$body.hasClassattr( "rtldir" ) !== "rtl" );
}
} // face()
Line 122 ⟶ 262:
// Uses:
// >< HINT.using
// mw.config.get()
// mw.loader.using()
// 2017-08-07 PerfektesChaos@de.wikipedia
if ( mw.config.get( "skin" ) !== "minerva" ) { // T49858
if ( action ) {
mw.loader.using( [ "jquery.tablesorter" ],
action );
} else {
Line 144 ⟶ 285:
// > HINT.last
// > HINT.launched
// > HINT.using
// >< HINT.launch
// >< HINT.layer
// >< HINT.live
// < HINT.later
// < HINT.lazy
// < HINT.drop
// mw.loader.using()
// BOX.flat()
// (API.feedfull)
// (BOX.feed)
// 20172023-0805-0314 PerfektesChaos@de.wikipedia
var i, live, s;
if ( typeof apply === "object"
&& apply ) {
Line 160 ⟶ 304:
typeof apply.rooms.length === "number" ) {
live = false;
if ( HINT.nsn >= 0 ) {
for ( i = 0; i < apply.rooms.length; i++ ) {
if ( apply.rooms[ i ] === HINT.nsn ) {
live = true;
break; // for i
}
} // for i
}
} else if ( typeof apply.rooms === "string"
&& apply.rooms === "*" ) {
live = true( HINT.nsn >= 0 );
} else {
live = false;
Line 178 ⟶ 324:
HINT.launch = apply.launch;
}
/*
if ( typeof apply.layer === "boolean" ) {
HINT.layer = apply.layer;
}
*/
if ( typeof apply.lazy === "boolean" ) {
HINT.lazy = apply.lazy;
Line 194 ⟶ 345:
HINT.live = true;
if ( HINT.launch && ! HINT.launched ) {
mw.loader.using( HINT.using, API.feedfull );
} else {
mw.loader.using( HINT.using, BOX.feed );
Line 200 ⟶ 351:
} else if ( HINT.live && ! live ) {
BOX.flat();
}
if ( typeof apply.quiet === "object"
&& apply.quiet &&
typeof apply.quiet.length === "number" ) {
HINT.drop = [ ];
for ( i = 0; i < apply.quiet.length; i++ ) {
s = apply.quiet[ i ];
if ( typeof s === "string" ) {
s = s.trim();
if ( s ) {
HINT.drop.push( s );
}
}
} // for i
if ( HINT.drop.length > 0 ) {
HINT.silent = HINT.drop.join( " " );
} else {
HINT.silent = "-";
}
}
}
Line 210 ⟶ 380:
// Uses:
// > Signature
// > PREGO.signature
// > LINTER.first
// > HINT.usingcmodels
// > EDIT.sourceVE
// > EDIT.selTextbox
// > HINT.doc
// > Version
// >< HINT.using
// < HINT.signature
// < HINT.selector
// < HINT.nsn
// < PREGO.live
// < LINTER.live
// < HINT.source
// < HINT.idRev
// < HINT.last
// < HINT.live
// < HINT.launch
// < EDIT.live
// < EDIT.layer
// < EDIT.selector
// < HINT.pub
// mw.loader.getState()
Line 225 ⟶ 406:
// mw.config.get()
// GUIDER.first()
// PREGO.fire()
// fair()
// mw.loader.using()
// mw.hook()
// PREGO.feed(TMPLXPAND.first)
// (INFO.first)
// (LINTER.first)
// (features)
// 2022-02-07 (BOXPerfektesChaos@de.feed)wikipedia
var i, later, listen, live, re, rls, s;
// 2017-08-08 PerfektesChaos@de.wikipedia
var live, re, s;
HINT.signature = "ext.gadget." + Signature;
if ( mw.loader.getState( HINT.signature ) !== "ready" ) {
mw.loader.state(rls HINT.signature,= "ready"{ )};
rls[ HINT.signature ] = "ready";
mw.loader.state( rls );
HINT.selector = Signature.toLowerCase();
switch ( mw.config.get( "wgAction" ) ) {
case "view":
Line 245 ⟶ 431:
case "Blankpage":
s = mw.config.get( "wgTitle" );
ifi (= s.indexOf( "/" + Signature ) > 0 ) {;
if ( i > 1 GUIDER.first(); {
switch ( s.substr( i + 1 ) ) {
case Signature:
GUIDER.first();
listen = true;
break;
case PREGO.signature:
PREGO.live = true;
PREGO.fire();
break;
} // switch subPage
}
break;
case "ExpandTemplates":
PREGO.fire();
EDIT.live = true;
EDIT.selector = "textarea#output";
fair( TMPLXPAND.first );
break;
case "Info":
$( INFO.first );
break;
case "LintErrors":
LINTER.live = true;
PREGO.fire();
fair( LINTER.first );
break;
} // switch wgCanonicalSpecialPageName
break;
case 0102:
case HINT.live = true; // fall through104:
case 106:
case 108:
case 110:
case 112:
// might be Wikisource
s = mw.config.get( "wgPageContentModel" );
if ( typeof HINT.cmodels[ s ] === "boolean" ) {
HINT.source = s;
} // fall through
default:
HINT.idRev = mw.config.get( "wgRevisionId" );
Line 272 ⟶ 488:
HINT.live = false;
}
} else if ( s.indexOf( "&lintid=" ) > 0 ) {
HINT.launch = true;
}
if ( s.indexOf( EDIT.sourceVE ) > 0 ) {
later = true;
EDIT.layer = true;
EDIT.live = true;
EDIT.selector = EDIT.selTextbox;
}
}
Line 281 ⟶ 505:
case "edit":
case "submit":
// case "parsermigration-edit":
EDIT.live = true;
HINT.nsn = mw.config.get( "wgNamespaceNumber" );
if HINT.using.push( HINT"jquery.nsn === 0textSelection" ) {;
HINT.live = true;
}
live = true;
if ( HINT.nsn >= 100 ) {
s = mw.config.get( "wgPageContentModel" );
if ( s === "proofread-page" ) {
HINT.source = s;
}
}
// mw.hook( "CodeMirror.enabled" ).add( CODMIRROR.fire );
break;
case "info":
$( INFO.first );
break;
} // switch wgAction
if ( live ) {
sif = mw.config.get( "wgPageContentModel"! HINT.source ); {
live HINT.source = mw.config.get( s === "wikitextwgPageContentModel" );
live = ( HINT.source === "wikitext" );
}
listen = live;
}
if ( livelisten ) {
fair();
mw.hook( Signature + ".config" ).add( features );
}
if ( HINT.live ) {
if mw.loader.using( HINT.using,later BOX.feed) );{
mw.loader.using( HINT.using, EDIT.fading );
} else {
fair();
PREGO.fire();
}
PREGO.feed();
}
HINT.pub = { doc: "[[" + HINT.doc + "]]",
Line 337 ⟶ 576:
API.scream = textStatus;
break;
} // switch typeof textStatus
}
if ( errorThrown ) {
Line 360 ⟶ 599:
mw.hook( "wikipage.content" ).add( BOX.fault );
}; // API.fault()
 
 
 
API.feed = function ( access ) {
// Intermediate retrieval of wikitext
// Precondition:
// access -- string, with title of particular page, or not
// mediawiki.api available
// Uses:
// > HINT.nsn
// >< API.Api
// >< HINT.idRev
// < API.single
// < HINT.launched
// mw.config.get()
// (API.feeder)
// (API.fault)
// 2017-08-03 PerfektesChaos@de.wikipedia
var w = { action: "query",
prop: "revisions" };
if ( typeof access === "string" ) {
API.single = access;
}
if ( HINT.nsn < 0 ) {
w.rvprop = "content|contentmodel";
} else {
w.rvprop = "content";
if ( ! HINT.idRev ) {
HINT.idRev = mw.config.get( "wgRevisionId" );
}
HINT.launched = true;
}
if ( HINT.idRev ) {
w.revids = HINT.idRev;
} else if ( API.single ) {
w.titles = API.single;
} else {
w = false;
}
if ( w ) {
if ( ! API.Api ) {
API.Api = new mw.Api();
}
API.Api.get( w ).done( API.feeder )
.fail( API.fault );
}
}; // API.feed()
 
 
 
API.feeder = function ( arrived ) {
// Intermediate expansion of wikitext
// Precondition:
// arrived -- JSON result of ajax content query
// mediawiki.api available
// Uses:
// > API.single
// > API.Api
// > HINT.idRev
// > PREGO.app
// > HINT.texts.noPage
// API.fire()
// API.fault()
// (API.fed)
// (API.fault)
// 2017-08-05 PerfektesChaos@de.wikipedia
var id, q, s, w;
if ( typeof arrived === "object" &&
typeof arrived.query === "object" &&
typeof arrived.query.pages === "object" ) {
q = arrived.query.pages;
for ( id in q ) {
q = q[ id ];
if ( q && q.revisions ) {
q = q.revisions[ 0 ];
if ( typeof q.contentmodel !== "string"
|| q.contentmodel === "wikitext" ) {
s = q[ "*" ];
if ( /\{\{/.test( s ) ) {
w = { action: "expandtemplates",
prop: "wikitext|volatile",
text: s };
if ( API.single ) {
w.title = API.single;
}
if ( HINT.idRev ) {
w.revid = HINT.idRev;
}
if ( w ) {
API.Api.post( w ).done( API.fed )
.fail( API.fault );
}
} else {
API.fire( s );
}
}
}
break; // for id
} // for id in q
}
if ( ! s ) {
if ( PREGO.app ) {
s = PREGO.app.translation( HINT.texts.noPage );
} else {
s = HINT.texts.noPage.en;
}
if ( API.single ) {
s = s + " * " + API.single;
}
API.fault( null, "Missing", s );
}
}; // API.feeder()
 
 
 
API.fed = function ( arrived ) {
// Postprocess page content after ajax expandtemplates request
// Precondition:
// arrived -- JSON result of ajax expandtemplates query
// Uses:
// API.fire()
// 2017-08-01 PerfektesChaos@de.wikipedia
if ( typeof arrived === "object" &&
typeof arrived.expandtemplates === "object" &&
typeof arrived.expandtemplates.wikitext === "string" ) {
API.fire( arrived.expandtemplates.wikitext );
}
}; // API.fed()
 
 
Line 496 ⟶ 607:
// arrived -- JSON result of ajax lint query
// Uses:
// > < APIHINT.errorsquiet
// < API.scream
// < API.errors
// (BOX.fill)
// (BOX.flat)
// 20172024-0807-0104 PerfektesChaos@de.wikipedia
var starte, i, s;
API.scream = false;
API.errors = false;
if ( typeof arrived === "object"
&& arrived &&
typeof arrived.length === "number"
&& arrived.length ) {
APIif ( HINT.errorsquiet =) arrived;{
start for ( i = "fill"0; i < arrived.length; i++ ) {
} else { e = arrived[ i ];
if ( $.inArray( e.type, HINT.quiet ) < 0 ) {
API.errors = false;
start API.errors = "flat"API.errors || [ ];
API.errors.push( e );
}
} // for i
} else {
API.errors = arrived;
}
}
s = ( API.screamerrors =? "fill" : "flat" false);
mw.hook( "wikipage.content" ).add( BOX[ starts ] );
}; // API.fine()
 
Line 524 ⟶ 644:
// mediawiki.api available
// Uses:
// >< API.site
// > API.server
// > API.scanner
// >< API.query
// API.first()
// (API.fine)
// (API.fault)
// 20172018-0805-0102 PerfektesChaos@de.wikipedia
var local = ( typeof ask === "string" );
/* , f; */
Line 541 ⟶ 664:
dataType: "json" // No "Intelligent Guess"
};
API.site = window.___location.protocol + "//" +
window.___location.hostname + "/";
if ( local ) {
// API.site = API.site + "v3/" + API.servicefirst();
API.site = API.site + "api/rest_v1/" + API.service;
API.query.type = "POST";
API.query.url = API.site + API.server + API.scanner;
// API.site + "v3/" + API.scanner;
}
}
Line 556 ⟶ 677:
.fail( API.fault );
}; // API.fire()
 
 
 
API.first = function () {
// Initialize API
// Uses:
// >< API.Api
// >< API.site
// 2017-08-01 PerfektesChaos@de.wikipedia
if ( ! API.Api ) {
API.Api = new mw.Api();
}
if ( typeof API.site !== "string" ) {
API.site = window.___location.protocol + "//" +
window.___location.hostname + "/";
}
}; // API.first()
 
 
 
API.full = function ( access, actual ) {
// Analyse wikitext per page name
// Precondition:
// access -- string, with title of particular page, or current
// actual -- number, of revID, or not
// mediawiki.api available
// Uses:
// > API.server
// >< API.single
// >< HINT.idRev
// >< API.page
// >< API.solver
// >< API.reSpace
// < HINT.launched
// API.first()
// (API.fine)
// (API.fault)
// 2020-01-04 PerfektesChaos@de.wikipedia
var idRev = actual,
subject = access /* ,
f */;
HINT.launched = true;
if ( typeof subject === "string" ) {
subject = subject.trim();
} else {
if ( ! API.single ) {
API.single = mw.config.get( "wgPageName" );
}
subject = API.single;
if ( ! HINT.idRev ) {
HINT.idRev = mw.config.get( "wgRevisionId" );
}
idRev = HINT.idRev;
}
if ( typeof API.page !== "object" ) {
API.first();
/*
f = function ( jqXHR ) {
jqXHR.setRequestHeader( "Content-Type",
"application/json" );
}; */
API.page = { /* beforeSend: f, */
dataType: "json" // No "Intelligent Guess"
};
API.solver = API.site + API.server + API.swift + "/";
}
if ( subject.indexOf( " " ) > 0 ) {
if ( typeof API.reSpace !== "object" ) {
API.reSpace = new RegExp( " +", "g" );
}
subject = subject.replace( API.reSpace, "_" );
}
API.page.url = API.solver + encodeURIComponent( subject );
if ( idRev ) {
API.page.url = API.page.url + "/" + idRev;
}
$.ajax( API.page ).done( API.fine )
.fail( API.fault );
}; // API.full()
 
 
 
BOX.facet = function ( $activate ) {
// Button for PREGO options arrived
// Precondition:
// $activate -- jQuery object of PREGO special page button
// Uses:
// > HINT.ltr
// > BOX.$box
// 2018-09-25 PerfektesChaos@de.wikipedia
if ( $activate ) {
$activate.css( { "display": "block",
"float": ( HINT.ltr ? "right": "left" ) } );
BOX.$box.append( $activate );
}
}; // BOX.facet()
 
 
Line 565 ⟶ 782:
// Uses:
// > HINT.live
// > Signature
// > HINT.ltr
// > BOX.bgc
// > BOX.boc
// > BOX.fgc
// > GUIDER.live
// > PREGO.signature
// > HINT.selector
// > Signature
// > Version
// >< BOX.$box
// < HINTBOX.$pagefirst()
// face()
// BOX.focus()
// BOX.flat()
// BOX.firing()
// (BOX.flip)
// 2017-08-08 PerfektesChaos@de (BOX.wikipediafacet)
// 2021-06-03 PerfektesChaos@de.wikipedia
var $a, $e;
if ( HINT.live ) {
HINTBOX.$page =first( $area );
if ( BOX.$box ) {
if ( BOX.$failure ) {
Line 602 ⟶ 825:
.css( { "float": ( HINT.ltr ? "left": "right" ) } );
BOX.$box.append( $e )
.attraddClass( {HINT.selector id:+ Signature }"-box" )
.attr( { id: HINT.selector,
role: "alert" } )
.css( { "background-color": "#" + BOX.bgc,
"border-color": "#" + BOX.boc,
Line 609 ⟶ 834:
"color": "#" + BOX.fgc,
"margin-bottom": "1em",
"padding": "0.5em" } );,
"pointer-events": "all" } );
$e = $( "<button>" );
$e.click( BOX.flip )
.css( { "color": "#FF0000",
"floatcursor": ( HINT.ltr ? "rightpointer": "left" ),
"font-weightdisplay": "bolder" } ) "block",
"float": ( HINT.ltr ? "right": "left" ),
"font-weight": "bolder",
"pointer-events": "all" } )
.css( "margin-" + ( HINT.ltr ? "right": "left" ),
"6px" )
Line 620 ⟶ 849:
BOX.$box.append( $e );
BOX.focus( BOX.$box );
if ( ! GUIDER.live ) {
mw.hook( PREGO.signature + ".$button" ).fire( BOX.facet,
Signature );
}
}
} else {
BOX.flat();
}
BOX.firing( Version, false );
}; // BOX.factory()
 
Line 636 ⟶ 870:
// > BOX.$box
// > BOX.$table
// > GUIDER.$pagename
// >< BOX.$failure
// < API.scream
// BOX.flat()
// BOX.factory()
// 2017-08-04 PerfektesChaos@de GUIDER.wikipediafine()
// 2021-06-03 PerfektesChaos@de.wikipedia
BOX.flat();
BOX.factory( $area );
Line 658 ⟶ 892:
.show();
}
if ( GUIDER.$pagenamefine( false ) {;
GUIDER.$pagename.hide();
}
}; // BOX.fault()
 
Line 670 ⟶ 902:
// > HINT.launch
// > HINT.launched
// API> EDIT.feed()live
// < API.errors
// UPDATE.fetch()
// API.full()
// mw.hook()
// (BOX.flip)
// 20172021-0806-03 PerfektesChaos@de.wikipedia
UPDATE.fetch();
if ( HINT.launch && ! HINT.launched ) {
if ( HINT.launch && ! HINT.launched && ! EDIT.live ) {
API.feed();
API.full();
} else {
API.errors = true;
mw.hook( "wikipage.content" ).add( BOX.flip );
}
Line 687 ⟶ 924:
// Precondition:
// $area -- mw-content-text
// mediawiki.api.messages available
// Uses:
// > BOX.$collapsed
// > BOXHINT.$nullwidget
// > BOX.$box
// > HINT.$textarea
// > GUIDER.last
// > HINT.errors
// > HINT.nsn
// > APIPREGO.singlesignature
// > HINT.selector
// >< BOX.$table
// >< BOX.$tbody
// >< BOX.swift
// >< API.Api
// >< BOX.$pagename
// < BOX.$tbody
// BOX.factory()
// mw.hook()
// BOX.filler()
// mw.Api.loadMessagesIfMissing()
// GUIDER.fromfine()
// (BOX.flag)
// (BOX.filler)
// (API.fault)
// 20172021-0806-0403 PerfektesChaos@de.wikipedia
var i, req, $th, $thead, $tr;
BOX.factory( $area );
if ( BOX.$collapsed && ! HINT.$widget ) {
BOX.$collapsed.hide();
}
if ( BOX.$null ) {
BOX.$null.hide();
}
if ( BOX.$box ) {
if ( BOX.$table ) {
if ( HINT.$textarea ) {
if ( GUIDER.last ) {
BOX.$swift.hide();
} else {
BOX.$swift.show();
}
}
BOX.$tbody.empty();
BOX.filler();
Line 727 ⟶ 974:
BOX.$table.append( BOX.$pagename );
}
$tr = $( "<tr>" );
$th = $( "<th>" );
$th.text( "lint" );
$tr.append( $th );
Line 734 ⟶ 981:
$th.text( "+" );
$tr.append( $th );
if ( HINT.$textarea ) {
BOX.$swift = $( "<th>" );
BOX.$swift.data( "sort-type", "number" )
.text( String.fromCharCode( 8659 ) );
mw.hook( PREGO.signature + ".ready" ).add( BOX.flag );
if ( GUIDER.last ) {
BOX.$swift.hide();
}
$tr.append( BOX.$swift );
}
$thead.append( $tr );
BOX.$tbody = $( "<tbody>" );
BOX.$table.addClass( "wikitable" )"
.attr( { id: Signature + HINT.selector + "-table" } )
.attr( { id: HINT.selector + "-table" } )
.append( $thead, BOX.$tbody )
.css( { "clear": "both" } );,
"overflow": "scroll" } );
if ( HINT.errors.length > 1 || HINT.nsn < 0 ) {
BOX.$table.addClass( "sortable" );
Line 754 ⟶ 1,013:
.fail( API.fault );
}
if GUIDER.fine( BOX.$pagenamefalse ) {;
GUIDER.from( BOX.$pagename );
}
}
}; // BOX.fill()
Line 770 ⟶ 1,027:
// > mw.messages
// > HINT.later
// > HINT.selector
// > Signature
// > BOX.bgcErr
// > HINT.$textarea
// > GUIDER.last
// > BOX.swift
// > BOX.$tbody
// > BOX.$table
Line 778 ⟶ 1,040:
// >< BOX.$other
// mw.message()
// PREGOUPDATE.app.translationfeed()
// mw.hook()
// BOX.future()
// (BOX.find)
// (BOX.future)
// 20172022-0805-0901 PerfektesChaos@de.wikipedia
var n = 0,
e, i, k, loc, par, s, $e, $e2, $e3, $td, $tr;
for ( i = 0; i < API.errors.length; i++ ) {
e = API.errors[ i ];
Line 789 ⟶ 1,053:
if ( mw.messages.exists( s ) ) {
s = mw.message( s ).text();
} else if ( HINT.later ) {
s = e.type;
} else {
sUPDATE.feed( =e.type false);
if ( HINT.later ) {
s = e.type;
} else {
s = false;
}
}
if ( s ) {
$tr = $( "<tr>" );
$tr.addClass( HINT.selector + "-" + e.type );
$td = $( "<td>" );
$td.css(e { "background-color":= $( "#<a>" + BOX.bgcErr } );
$tde.textattr( s{ );href: "/wiki/Special:LintErrors/" + e.type,
target: Signature + "SP",
title: "Special:LintErrors/" + e.type } )
.text( s );
$td.append( $e )
.css( { "background-color": "#" + BOX.bgcErr } );
$tr.append( $td );
$td = $( "<td>" );
Line 804 ⟶ 1,077:
if ( typeof e.params === "object" ) {
par = e.params;
/*
if ( Version < 0 ) {
for ( s in par ) {
Line 814 ⟶ 1,088:
} // for s in par
}
*/
if ( typeof par.name === "string" ) {
$td.text( par.name );
} else if ( typeof par.subtype === "string" ) {
$td.text( par.subtype );
} else if ( typeof par.root === "string" &&
typeof par.child === "string" ) {
Line 831 ⟶ 1,108:
typeof par.items.length === "number" ) {
for ( k = 0; k < par.items.length; k++ ) {
$es = $(par.items[ "<code>"k )];
$e.cssif ( {s.length "margin-right":> "6px",50 ) {
$e = $( "white-space<span>": "nowrap" } );
} else .text( par.items[ k ] );{
$e = $( "<code>" );
$e.css( { "margin-right": "6px",
"white-space": "nowrap" } );
}
$e.text( s );
$td.append( $e );
} // for k
Line 840 ⟶ 1,122:
}
$tr.append( $td );
if ( HINT.$textarea &&
! GUIDER.last &&
typeof e.dsr === "object"
&& e.dsr &&
typeof e.dsr[ 0 ] === "number" &&
typeof e.dsr[ 1 ] === "number" ) {
$td = $( "<td>" );
$td.click( BOX.find )
.css( { "background-color": "#FFFFFF" } )
.data( "range", e.dsr )
.data( "sort-value", i )
.attr( { "data-beg": "" + e.dsr[ 0 ],
"data-end": "" + e.dsr[ 1 ],
"data-type": e.type } )
.text( String.fromCharCode( 160, 8595, 160 ) );
if ( typeof BOX.swift === "string" ) {
$td.attr( { title: BOX.swift } );
}
$tr.append( $td );
loc = true;
}
BOX.$tbody.append( $tr );
n++;
Line 853 ⟶ 1,156:
}
BOX.$table.show();
if ( loc ) {
mw.hook( Signature + ".table-range" ).fire( BOX.$table );
}
} else {
BOX.$table.hide();
Line 866 ⟶ 1,172:
}
}; // BOX.filler()
 
 
 
BOX.find = function ( event ) {
// Marker link has been clicked
// Precondition:
// event -- object, with event
// Uses:
// > HINT.$textarea
// 2017-10-06 PerfektesChaos@de.wikipedia
var $item = $( event.target ),
range = $item.data( "range" );
HINT.$textarea.focus()
.textSelection( "setSelection",
{ start: range[ 0 ],
end: range[ 1 ] } );
}; // BOX.find()
 
 
 
BOX.fine = function () {
// Analysis without errors
// Uses:
// > BOX.$collapsed
// > API.errors
// > HINT.selector
// > BOX.bgcOk
// BOX.firing()
// 2021-06-03 PerfektesChaos@de.wikipedia
if ( BOX.$collapsed && ! API.errors ) {
BOX.firing( "+" );
BOX.$collapsed.addClass( HINT.selector + "-fine" )
.css( { "background-color": "#" + BOX.bgcOk } );
}
}; // BOX.fine()
 
 
 
BOX.firing = function ( about, active, attach ) {
// Manage pivot button
// Precondition:
// about -- tooltip text
// active -- true, if enabled after call
// attach -- cursor style, or not
// Uses:
// > BOX.$collapsed
// > BOX.bgcRun
// > BOX.fgcRun
// > BOX.fgc
// > HINT.selector
// (BOX.full)
// 2021-06-03 PerfektesChaos@de.wikipedia
var signal;
if ( BOX.$collapsed ) {
if ( active ) {
BOX.$collapsed.click( BOX.full )
.css( { "color": "#" + BOX.fgc } );
signal = "pointer";
} else {
BOX.$collapsed.css( { "background-color": "#" + BOX.bgcRun,
"color": "#" + BOX.fgcRun
} )
.off( "click", BOX.full );
signal = "default";
}
BOX.$collapsed.attr( { "aria-disabled": ! active,
"title": about } )
.css( { "cursor": attach || signal } )
.removeClass( [ HINT.selector + "-fine",
HINT.selector + "-progress" ] )
.show();
}
}; // BOX.firing()
 
 
 
BOX.first = function ( $area ) {
// Detect main section of page
// Precondition:
// $area -- mw-content-text, or nil
// Uses:
// > HINT.selMain
// > EDIT.selVEsrc
// >< HINT.$main
// >< EDIT.layer
// < HINT.$content
// < EDIT.live
// 2021-06-03 PerfektesChaos@de.wikipedia
var $main, $top;
if ( $area ) {
HINT.$content = $area;
}
if ( ! HINT.$main ) {
$top = $( HINT.selMain );
switch ( $top.length ) {
case 0:
if ( $area ) {
HINT.$main = HINT.$content;
}
break;
case 1:
$main = $top;
break;
default:
$main = $top.eq( 0 );
} // switch $top.length
if ( $main ) {
HINT.$main = $main.children().eq( 0 );
if ( EDIT.layer &&
! $main.find( EDIT.selVEsrc ).length ) {
EDIT.layer = false;
EDIT.live = false;
}
}
}
}; // BOX.first()
 
 
 
BOX.flag = function ( application ) {
// Tooltip on selection ranges requested
// Precondition:
// application -- PREGO object
// Uses:
// > HINT.texts.mark
// > BOX.$swift
// < BOX.swift
// PREGO.app.translation()
// 2017-10-06 PerfektesChaos@de.wikipedia
if ( application ) {
PREGO.app = application;
}
BOX.swift = PREGO.app.translation( HINT.texts.mark );
BOX.$swift.attr( { title: BOX.swift } );
}; // BOX.flag()
 
 
Line 875 ⟶ 1,316:
// alive -- leave BOX.$collapsed
// Uses:
// > HINT.live
// > BOX.$box
// > BOX.$collapsed
// > EDIT.live
// > BOX.$null
// > API.errors
// > API.scream
Line 885 ⟶ 1,323:
// > API.single
// > HINT.launched
// > SignatureHINT.selector
// > BOX.bgcOk
// > BOX.fgc
// > GUIDER.live
// > Version
// > HINT.ltr
// > GUIDERBOX.$pagenamefirst()
// >< HINTBOX.$pagefiring()
// >< BOX.$nullfine()
// BOX.flip()
// faceGUIDER.fine()
// 2021-06-03 GUIDERPerfektesChaos@de.from()wikipedia
// BOX.focusfirst( $area );
// 2017-08-08 PerfektesChaos@de.wikipedia
if ( $area && ! HINT.$page ) {
HINT.$page = $area;
}
if ( BOX.$box ) {
BOX.$box.hide();
}
if ( BOXAPI.$collapsed && ! alive && ! EDIT.liveerrors ) {
BOX.$collapsed.hidefiring( "?" );
} else {
BOX.fine();
}
if ( EDIT.live ) {
Line 912 ⟶ 1,345:
BOX.flip();
}
} else if ( ! API.errors &&
! API.scream &&
HINT.live ) {&&
if ( API.single && GUIDER.$pagenamelive ) {
if GUIDER.fine( BOX.$nulltrue ) {;
BOX.$null.hide();
}
GUIDER.from( GUIDER.$pagename );
} else if ( BOX.$null ) {
if ( HINT.lazy ) {
BOX.$null.hide();
} else {
BOX.$null.show();
}
} else if ( ! HINT.lazy &&
HINT.launched &&
HINT.$page ) {
face();
BOX.$null = $( "<div>" );
BOX.$null.attr( { id: Signature + "-null" } )
.css( { "background-color": "#" + BOX.bgcOk,
"clear": "both",
"color": "#" + BOX.fgc,
"float": ( HINT.ltr ? "right": "left" ),
"font-size": "smaller",
"padding": "3px" } )
.text( Signature );
if ( ! GUIDER.live ) {
BOX.$null.attr( { title: Signature + "@PerfektesChaos "
+ Version } );
}
BOX.focus( BOX.$null );
}
} else if ( BOX.$null ) {
BOX.$null.hide();
}
}; // BOX.flat()
Line 955 ⟶ 1,360:
// $area -- mw-content-text, or nil
// Uses:
// > SignatureGUIDER.live
// > HINT.selector
// > HINT.ltr
// > GUIDER.live
// > BOX.bgc
// > BOX.fgcSignature
// > Version
// > TMPLXPAND.live
// > EDIT.$source
// > EDIT.live
// > API.errors
// > GUIDER.$pagename
// >< HINT.$page
// >< BOX.$collapsed
// BOX.first()
// face()
// BOX.flatfiring()
// BOX.focus()
// EDIT.fetch()
// EDIT.fine()
// (BOX.full)
// 20172021-0812-0826 PerfektesChaos@de.wikipedia
if BOX.first( $area && ! HINT.$page ) {;
HINT.$page = $area;
}
face();
BOX.flat( $area, true );
if ( BOX! GUIDER.$collapsedlive ) {
if ( BOX.$collapsed.attr( ) { disabled: false } )
BOX.$collapsed.show();
} else {
BOX.$collapsed = $( "<buttondiv>" );
BOX.$collapsed.attraddClass( { id: SignatureHINT.selector + "-collapsed" } )
.clickattr( BOX{ id: HINT.fullselector + )"-collapsed",
.css( { "clear": ( HINT.ltr ? "right" role: "leftbutton" } ),
.css( { /* "floatclear": ( HINT.ltr ? "right": "left" ),
"margin-bottom": ? "3pxright",:
"padding": "2pxleft" } ), */
.text( Signature ); "padding-left": "2px",
"padding-right": "2px",
if ( ! GUIDER.live ) {
BOX.$collapsed.attr( { title "padding-top": Version } ); "2px",
"pointer-events": "all" } )
.text( Signature );
BOX.focus( BOX.$collapsed, true, true );
}
BOX.focusfiring( BOX.$collapsedVersion, true );
BOX.$collapsed.css( { "background-color": "#" + BOX.bgc } );
}
if ( TMPLXPAND.live && ! EDIT.$source ) {
EDIT.fetch();
}
if ( EDIT.live && ! API.errors && ! TMPLXPAND.live ) {
BOX.$collapsed.css( { "background-color": "#" + BOX.bgc,
"color": "#" + BOX.fgc } );
if ( EDIT.live && ! API.errors ) {
EDIT.fine();
}
Line 1,006 ⟶ 1,417:
 
 
BOX.focus = function ( $apply, another, around ) {
// Insertion in page top region or toolbox
// Precondition:
// $apply -- jQuery object
// another -- try to add to indicators region
// around -- button style in page
// Uses:
// > SignatureHINT.indicators
// > HINT.$pageselector
// > HINT.$main
// >< HINT.$widget
// >< BOX.$top
// 20172021-0806-0803 PerfektesChaos@de.wikipedia
var learn, light, s, $e;
if $apply.addClass( ! BOX.$top"noprint" ) {;
if BOX.$top = $( "<div>"another ); {
BOXif ( HINT.$top.attr(widget {=== id:false ) Signature + "-top" } ){
HINT.$widget = $( HINT.css( { "clear":indicators "both",);
switch ( HINT.$widget.length ) "width": "100%" } );{
$e = $( "<div>" ); case 0:
$e.css( { "clear": "both" } ) HINT.$widget = null;
HINT.$page.prepend( BOX.$top, $e ) break;
case 1:
break;
default:
HINT.$widget = HINT.$widget.eq( 0 );
} // switch HINT.$widget.length
learn = true;
}
if ( HINT.$widget ) {
$apply.css( { "display": "inline-block",
"line-height": "1.2em",
"margin-left": "3px",
"margin-right": "3px",
"padding": "1px" } );
HINT.$widget.append( $apply );
light = true;
} else {
$apply.css( { "float": ( HINT.ltr ? "right"
: "left" ) } );
}
}
if ( ! light ) {
if ( ! BOX.$top ) {
BOX.$top = $( "<div>" );
BOX.$top.addClass( "noprint "
+ HINT.selector + "-top" )
.attr( { id: HINT.selector + "-top" } )
.css( { "clear": "both",
"width": "100%" } );
$e = $( "<div>" );
$e.css( { "clear": "both" } );
HINT.$main.before( BOX.$top, $e );
learn = true;
}
if ( around ) {
s = "#E0E0E0 #E0E0E0 #707070 #707070";
} else {
s = "transparent";
}
$apply.css( { "border-color": s,
"border-style": "solid",
"border-width": "2px",
"margin-bottom": "3px" } );
BOX.$top.prepend( $apply );
}
if ( learn &&
window.document.___location.hash ) {
window.document.___location = window.document.___location.href;
}
BOX.$top.prepend( $apply );
}; // BOX.focus()
 
Line 1,035 ⟶ 1,496:
// > HINT.live
// > BOX.$box
// > HINT.$widget
// > BOX.$collapsed
// > BOXHINT.bgcRunselector
// > BOX.fgcRun
// > GUIDER.live
// > HINT.$pageVersion
// >< API.errors
// >< API.single
// >< EDIT.live
// >< EDIT.$source
// < EDIT.listen
// < HINT.launch
// APIBOX.feedfiring()
// 2017-08-08 PerfektesChaos@de EDIT.wikipediafire()
// API.full()
// (BOX.full)
// 2021-06-03 PerfektesChaos@de.wikipedia
var idRev;
if ( HINT.live ) {
if ( BOX.$box ) {
if ( EDIT.live ) {
API.errors = false;
} else if ( HINT.$widget ) {
BOX.$collapsed.hidefiring( "?" );
}
if ( API.errors ) {
Line 1,061 ⟶ 1,524:
}
}
if BOX.firing( ! API".errors..", )false, {"progress" );
BOX.$collapsed.attraddClass( { disabled:HINT.selector true+ }"-progress" );
if ( ! GUIDER.live ) {
.css( { "background-color": "#" + BOX.bgcRun,
if ( ! API.single ) {
"color": "#" + BOX.fgcRun }
API.single = mw.config.get( "wgPageName" );
}
if ( ! APIHINT.singleidRev && ! GUIDERHINT.liveidRev > 0 ) {
API.single idRev = mwHINT.config.get( "wgTitle" )idRev;
}
}
if ( EDIT.live ) {
if ( ! EDIT.$source fire() {;
EDIT.$source = HINT.$page.find( "#wpTextbox1" );
if ( ! EDIT.$source.length ) {
BOX.$collapsed.hide();
EDIT.live = false;
}
}
if ( EDIT.live ) {
EDIT.listen = false;
API.fire( EDIT.$source.val() );
}
} else {
HINT.launch = true;
API.feedfull( API.single, idRev );
BOX.firing( "?", false, "progress" );
}
} else if ( HINT.$widget ) {
BOX.$collapsed.hidefiring( "?", false, "progress" );
}
}; // BOX.full()
Line 1,095 ⟶ 1,550:
BOX.future = function ( application ) {
// Remark on uncategorized features requested
// Precondition:
// application -- PREGO object
// Uses:
// > HINT.texts.other
// > SignatureHINT.selector
// > BOX.$box
// >< PREGO.app
// < BOX.$other
// PREGO.app.translation()
// 20172021-0805-0826 PerfektesChaos@de.wikipedia
var $e;
if ( application ) {
Line 1,115 ⟶ 1,572:
.html( PREGO.app.translation( HINT.texts.other ) );
BOX.$other = $( "<div>" );
BOX.$other.attraddClass( { id: SignatureHINT.selector + "-future" } )
.attr( { id: HINT.selector + "-future" } )
.css( { "clear": "both",
"padding-bottom": "1em",
Line 1,123 ⟶ 1,581:
}
}; // BOX.future()
 
 
 
CODMIRROR.fetch = function () {
// Retrieve CodeMirror contents
// Postcondition:
// Returns contents, if present
// Uses:
// > CODMIRROR.cm
// 2018-07-06 PerfektesChaos@de.wikipedia
var r;
if ( CODMIRROR.first() ) {
r = CODMIRROR.cm.doc.getValue();
}
return r;
}; // CODMIRROR.fetch()
 
 
 
CODMIRROR.first = function () {
// Check whether CodeMirror is activated
// Postcondition:
// Returns something, if present
// Uses:
// > window.CodeMirror
// >< CODMIRROR.cm
// mw.user.options.get()
// 2018-07-06 PerfektesChaos@de.wikipedia
var r, uo;
if ( ! CODMIRROR.cm &&
typeof window.CodeMirror === "function" &&
typeof window.CodeMirror.doc === "object" ) {
CODMIRROR.cm = window.CodeMirror;
}
if ( CODMIRROR.cm ) {
uo = mw.user.options.get( "usecodemirror" );
if ( typeof uo === "number"
&& uo > 0 ) {
r = CODMIRROR.cm;
}
}
return r;
}; // CODMIRROR.first()
 
 
 
/*
CODMIRROR.fire = function ( app ) {
}; // CODMIRROR.fire()
*/
 
 
 
EDIT.fading = function () {
// Add link to toolbox portlet
// Precondition:
// mediawiki.util available
// Postcondition:
// Toolbox prepared and execution started
// Uses:
// > Signature
// > EDIT.layer
// > HINT.selector
// < HINT.$widget
// BOX.first()
// mw.util.addPortletLink()
// fair()
// PREGO.fire()
// 2021-11-04 PerfektesChaos@de.wikipedia
var dom;
BOX.first();
if ( EDIT.layer ) {
dom = mw.util.addPortletLink( "p-tb",
"#",
Signature,
HINT.selector + "-portlet",
Version );
HINT.$widget = $( dom );
if ( dom.nodeName.toLowerCase() !== "li" ) {
HINT.$widget = HINT.$widget.parent();
}
HINT.$widget.empty();
}
fair();
PREGO.fire();
}; // EDIT.fading()
 
 
 
EDIT.fetch = function () {
// Retrieve HTML textarea contents
// Postcondition:
// Returns textarea contents, if present
// Uses:
// > EDIT.selTextbox
// > HINT.source
// > HINT.$main
// > HINT.$content
// >< EDIT.selector
// >< EDIT.$source
// < EDIT.listen
// < HINT.$textarea
// 2021-12-23 PerfektesChaos@de.wikipedia
var r, $div;
if ( ! EDIT.$source ) {
if ( EDIT.layer ) {
EDIT.selector = EDIT.selTextbox;
} else if ( ! EDIT.selector ) {
switch ( HINT.source ) {
case "wikitext":
case "proofread-page":
EDIT.selector = "#wpTextbox1";
break;
} // switch HINT.source
}
if ( EDIT.selector ) {
if ( EDIT.layer ) {
$div = HINT.$main;
} else {
$div = HINT.$content;
}
EDIT.$source = $div.find( EDIT.selector );
if ( EDIT.$source.length ) {
if ( EDIT.$source.find( ":hidden" ).length ) {
EDIT.live = false;
}
} else {
EDIT.live = false;
}
} else {
EDIT.live = false;
}
}
if ( EDIT.live && EDIT.$source && EDIT.$source.length ) {
if ( EDIT.layer ) {
r = EDIT.$source.text();
} else {
HINT.$textarea = EDIT.$source;
r = EDIT.$source.val();
}
}
return r;
}; // EDIT.fetch()
 
 
Line 1,130 ⟶ 1,731:
// Uses:
// > EDIT.$source
// > BOX.bgcOk
// > BOX.$collapsed
// < EDIT.listen
// BOX.fine()
// (EDIT.focus)
// 20172021-0806-0803 PerfektesChaos@de.wikipedia
if ( EDIT.$source ) {
EDIT.listen = true;
EDIT.$source.focusin( EDIT.focus );
BOX.$collapsed.css( { "background-color": "#" + BOX.bgcOk } );
}
BOX.fine();
}; // EDIT.fine()
 
 
 
EDIT.fire = function () {
// Anaysis of source text area requested
// Uses:
// > TMPLXPAND.live
// CODMIRROR.fetch()
// WIKED.fetch()
// EDIT.fetch()
// API.fire()
// 2021-06-03 PerfektesChaos@de.wikipedia
var source;
if ( ! TMPLXPAND.live ) {
source = CODMIRROR.fetch();
if ( ! source ) {
WIKED.fetch();
}
}
if ( ! source ) {
source = EDIT.fetch();
}
if ( source ) {
EDIT.listen = false;
API.fire( source );
}
}; // EDIT.fire()
 
 
Line 1,147 ⟶ 1,774:
// Source area has been touched
// Uses:
// > Version
// > BOX.bgc
// > BOX.$collapsed
// >< EDIT.listen
// 2017-08-08 PerfektesChaos@de BOX.wikipediafiring()
// 2021-06-03 PerfektesChaos@de.wikipedia
if ( EDIT.listen ) {
BOX.firing( Version, true );
BOX.$collapsed.css( { "background-color": "#" + BOX.bgc } );
EDIT.listen = false;
Line 1,159 ⟶ 1,789:
 
 
LINTER.fire = function ( $area ) {
// LintErrors page hasprerequisites been loadedcompleted
// PreconditionUses:
// $area < -- mw-content-textLINTER.live
// 2017-08-08 PerfektesChaos@de mw.wikipediahook()
var// $table = $area.find( "LINTER.TablePager" form);
// 2018-05-07 PerfektesChaos@de.wikipedia
if ( $table.length &&
LINTER.live = true;
typeof $table.tablesorter === "function" ) {
mw.hook( "wikipage.content" ).add( LINTER.form );
$table.tablesorter();
}
}; // LINTER.fire()
 
Line 1,178 ⟶ 1,807:
// jquery.tablesorter available
// Uses:
// > LINTER.live
// mw.config.get()
// mw.hookfair()
// (LINTER.fire)
// 20172018-0805-0307 PerfektesChaos@de.wikipedia
if ( mw.config.get( "wgTitle" ).indexOf( "/" ) > 0 ) {
mw.hook( "wikipage.content" ).add(&& ! LINTER.firelive ); {
fair( LINTER.fire );
}
}; // LINTER.first()
 
 
 
LINTER.form = function ( $area ) {
// LintErrors page has been loaded
// Precondition:
// $area -- mw-content-text
// Uses:
// > HINT.layer
// < LINTER.reEdit
// < LINTER.seek
// < LINTER.subst
// (LINTER.further)
// 2019-04-27 PerfektesChaos@de.wikipedia
var $table = $area.find( ".mw-datatable, .TablePager" );
if ( $table.length ) {
if ( typeof $table.tablesorter === "function" ) {
$table.tablesorter();
}
/*
if ( typeof HINT.layer === "boolean" ) {
if ( HINT.layer ) {
LINTER.reEdit = new RegExp( "([?&]action=)" +
"edit" +
"(&.+)?$" );
LINTER.seek = "action=edit";
LINTER.subst = "$1parsermigration-edit$2";
} else {
LINTER.reEdit = new RegExp( "([?&]action=)" +
"parsermigration-edit" +
"(&.+)?$" );
LINTER.seek = "action=parsermigration-edit";
LINTER.subst = "$1edit$2";
}
$table.find( "a" ).each( LINTER.further );
}
*/
}
}; // LINTER.form()
 
 
 
/*
LINTER.further = function ( any, a ) {
// Divert LintErrors page link
// Precondition:
// any -- number of link in table
// a -- DOM object of <a>
// Uses:
// > LINTER.reEdit
// > LINTER.seek
// > LINTER.subst
// 2018-05-02 PerfektesChaos@de.wikipedia
var $a = $( a ),
s = $a.attr( "href" );
if ( s.indexOf( LINTER.seek ) > 0 ) {
$a.attr( "href", s.replace( LINTER.reEdit, LINTER.subst ) );
}
}; // LINTER.further()
*/
 
 
 
GUIDER.facet = function ( $activate ) {
// Button for PREGO options arrived
// Precondition:
// $activate -- jQuery object of PREGO special page button
// Uses:
// > HINT.ltr
// > GUIDER.$desc
// 2018-05-02 PerfektesChaos@de.wikipedia
if ( $activate ) {
$activate.css( { "float": ( HINT.ltr ? "right": "left" ),
"margin-top": "1em" } );
GUIDER.$desc.before( $activate );
}
}; // GUIDER.facet()
 
 
 
GUIDER.figure = function () {
// Revision number input value has been changed
// Uses:
// > GUIDER.$rev
// >< GUIDER.reNaN
// 2018-05-02 PerfektesChaos@de.wikipedia
var s = GUIDER.$rev.val().trim();
if ( ! GUIDER.reNaN ) {
GUIDER.reNaN = new RegExp( "[^0-9]", "g" );
}
s = s.replace( GUIDER.reNaN, "" );
GUIDER.$rev.val( s );
}; // GUIDER.figure()
 
 
 
GUIDER.filled = function () {
// Page name input value has been changed
// Uses:
// > GUIDER.$input
// > GUIDER.$rev
// 2018-05-02 PerfektesChaos@de.wikipedia
var s = GUIDER.$input.val().trim();
GUIDER.$rev.attr( { disabled: ( s ? false : true ) } );
}; // GUIDER.filled()
 
 
Line 1,193 ⟶ 1,929:
// Uses:
// > GUIDER.$input
// > GUIDER.reTrim$rev
// > GUIDER.$startPage
// < GUIDER.last
// < API.single
// GUIDER.fired()
// API.feedfull()
// 20172021-0806-0403 PerfektesChaos@de.wikipedia
var s = GUIDER.$input.val().trim();
GUIDER.$input.val( s );
GUIDER.fired();
if ( ! GUIDER.reTrim.test( s )last )= {true;
if ( s ) {
API.single = s;
API.feedfull( APIs, GUIDER.single$rev.val() );
}
GUIDER.$startPage.css( { "cursor": "progress" } );
}; // GUIDER.find()
 
 
 
GUIDER.fine = function ( action ) {
// Precondition:
// action -- boolean, or Event object
// Pretty result of analysis
// Uses:
// > GUIDER.live
// > GUIDER.$pagename
// > GUIDER.$okay
// > GUIDER.$textarea
// > BOX.bgcOk
// > GUIDER.$input
// > GUIDER.$startText
// > GUIDER.$startPage
// (GUIDER.fine)
// 2021-06-03 PerfektesChaos@de.wikipedia
var lapsus, $e;
if ( GUIDER.live ) {
lapsus = ( action !== true );
if ( ( ! API.single || lapsus )
&& GUIDER.$pagename ) {
GUIDER.$pagename.hide();
}
if ( lapsus ) {
GUIDER.$okay.hide();
GUIDER.$textarea.css( { "background-color": "transparent" } )
.off( "focusin", GUIDER.fine );
GUIDER.$input.off( "focusin", GUIDER.fine );
} else {
if ( API.single ) {
$e = GUIDER.$pagename.children();
if ( ! $e.length ) {
$e = $( "<a>" );
$e.attr( { target: "_blank" } );
GUIDER.$pagename.append( $e );
}
$e.attr( { href: mw.util.getUrl( API.single ) } )
.text( API.single );
GUIDER.$pagename.show();
} else {
GUIDER.$okay.show();
GUIDER.$textarea.css( { "background-color":
"#" + BOX.bgcOk } )
.focusin( GUIDER.fine );
GUIDER.$input.focusin( GUIDER.fine );
}
}
GUIDER.$startText.css( { "cursor": "pointer" } );
GUIDER.$startPage.css( { "cursor": "pointer" } );
}
}; // GUIDER.fine()
 
 
Line 1,216 ⟶ 2,010:
// > HINT.texts.howTo
// > GUIDER.$desc
// > HINT.$pagecontent
// > HINT.texts.___domain
// > Signature
Line 1,222 ⟶ 2,016:
// < PREGO.app
// PREGO.app.translation()
// 20172021-0806-0103 PerfektesChaos@de.wikipedia
var $e = $( "<div>" );
PREGO.app = application;
Line 1,229 ⟶ 2,023:
"margin-top": "8em" } )
.html( PREGO.app.translation( HINT.texts.howTo ) );
HINT.$pagecontent.append( $e );
$e = $( "<a>" );
$e.attr( { href: "https://"
Line 1,249 ⟶ 2,043:
// > GUIDER.$textarea
// > GUIDER.reTrim
// > GUIDER.$startText
// < GUIDER.last
// < API.single
// < HINT.launched
// GUIDER.fired()
// API.fire()
// 20172021-0806-0503 PerfektesChaos@de.wikipedia
var s = GUIDER.$textarea.val();
GUIDER.fired();
GUIDER.last = false;
if ( ! GUIDER.reTrim.test( s ) ) {
API.single = false;
Line 1,261 ⟶ 2,058:
HINT.launched = true;
}
GUIDER.$startText.css( { "cursor": "progress" } );
}; // GUIDER.fire()
 
Line 1,268 ⟶ 2,066:
// Submit button has been clicked
// Uses:
// >< GUIDER.flat()reTrim
// GUIDER.flat()
// 2017-08-04 PerfektesChaos@de.wikipedia
GUIDER.flat();
Line 1,285 ⟶ 2,084:
// < HINT.live
// < GUIDER.live
// PREGO.feedfire()
// fair()
// mw.loader.load()
// mw.hook()
// (GUIDER.furnish)
// 20172018-0805-0802 PerfektesChaos@de.wikipedia
var i;
PREGO.feedfire();
for ( i = 0; i < GUIDER.using.length; i++ ) {
HINT.using.push( GUIDER.using[ i ] );
Line 1,309 ⟶ 2,108:
// Uses:
// > BOX.$box
// > BOXGUIDER.$collapsedfine()
// 2021-06-03 > BOXPerfektesChaos@de.$nullwikipedia
// > GUIDER.$pagename
// 2017-08-05 PerfektesChaos@de.wikipedia
if ( BOX.$box ) {
BOX.$box.hide();
}
if GUIDER.fine( BOX.$collapsedfalse ) {;
BOX.$collapsed.hide();
}
if ( BOX.$null ) {
BOX.$null.hide();
}
if ( GUIDER.$pagename ) {
GUIDER.$pagename.hide();
}
}; // GUIDER.flat()
 
Line 1,332 ⟶ 2,121:
// Request messages
// Precondition:
// mediawiki.api.messages available
// Uses:
// >< API.Api
// UPDATE.fetch()
// mw.Api.loadMessagesIfMissing()
// (GUIDER.form)
// (API.fault)
// 20172018-0805-0420 PerfektesChaos@de.wikipedia
var req = [ "general-form-reset",
"go" ],
Line 1,345 ⟶ 2,135:
API.Api = new mw.Api();
}
UPDATE.fetch();
for ( i = 0; i < HINT.errors.length; i++ ) {
req.push( "linter-category-" + HINT.errors[ i ] );
Line 1,361 ⟶ 2,152:
// Uses:
// > GUIDER.$formText
// > GUIDER.suitable
// > GUIDER.$formPage
// > HINT.ltr
// > PREGO.signature
// < GUIDER.$startText
// < GUIDER.$okay
// < GUIDER.$startPage
// mw.hook()
// (GUIDER.fire)
// (GUIDER.flat)
// (GUIDER.find)
// (GUIDER.filled)
// (GUIDER.finish)
// 20172021-0806-0503 PerfektesChaos@de.wikipedia
var submit = mw.message( "go" ).text(),
$b = $( "<span>" ),
$div = $( "<div>" ),
$x = $( "<span>" );,
$b;
$x.css( { "color": "#FF0000",
"font-weight": "bolder" } )
.text( "X" );
$bGUIDER.addClass$startText = $( "mw-ui-button mw-ui-progressive<span>" );
GUIDER.$startText.addClass( "mw-ui-button mw-ui-progressive" )
.click( GUIDER.fire )
.css( { "color": "#FFFFFF" } .click( GUIDER.fire )
.textcss( submit{ "color": "#FFFFFF" } );
GUIDER.$formText .appendtext( $bsubmit );
GUIDER.$formText.append( GUIDER.$startText );
GUIDER.$okay = $( "<span>" );
GUIDER.$okay.css( { "background-color": "#" + BOX.bgcOk,
"margin-left": "1em",
"margin-right": "1em",
"padding": "0.2em 0.5em" } )
.hide()
.text( GUIDER.suitable );
GUIDER.$formText.append( GUIDER.$okay );
$b = $( "<input>" );
$b.addClass( "mw-ui-button" )
Line 1,386 ⟶ 2,192:
.attr( { type: "reset" } )
.click( GUIDER.flat )
.css( { "display": "block",
"float": ( HINT.ltr ? "right": "left" ) } );
GUIDER.$formText.append( $b );
$bdiv.css( ={ $("clear": "<span>both" } );
GUIDER.$formPage.append( $div );
$b.addClass( "mw-ui-button mw-ui-progressive" )
.click( GUIDER.find )
.css( { "color": "#FFFFFF" },
{ "float": ( HINT.ltr ? "right": "left" ) } )
.text( submit );
$div.append( $b );
$b = $( "<input>" );
$b.addClass( "mw-ui-button" )
Line 1,400 ⟶ 2,202:
.attr( { type: "reset" } )
.click( GUIDER.flat )
.click( GUIDER.filled )
.css( { "float": ( HINT.ltr ? "right": "left" ) } );
GUIDER.$divformPage.append( $b );
GUIDER.css($startPage { "float":= $( HINT.ltr ? "right<span>": "left" ) } );
GUIDER.$formPagestartPage.appendaddClass( $div"mw-ui-button mw-ui-progressive" );
.click( GUIDER.find )
.css( { "color": "#FFFFFF" } )
.text( submit );
GUIDER.$formPage.append( GUIDER.$startPage );
mw.hook( PREGO.signature + ".ready" ).add( GUIDER.finish );
}; // GUIDER.form()
 
 
 
GUIDER.from = function ( $at ) {
// Show or clear page name fields
// Precondition:
// $at -- container
// mediawiki.util available
// Uses:
// > API.single
// mw.util.getUrl()
// 2017-08-04 PerfektesChaos@de.wikipedia
var $e;
if ( API.single ) {
$e = $at.children();
if ( ! $e.length ) {
$e = $( "<a>" );
$e.attr( { target: "_blank" } );
$at.append( $e );
}
$e.attr( { href: mw.util.getUrl( API.single ) } )
.text( API.single );
$at.show();
} else {
$at.hide();
}
}; // GUIDER.from()
 
 
Line 1,447 ⟶ 2,227:
// > BOX.bgcOk
// > HINT.using
// > < HINTPREGO.$pagesignature
// > HINT.selector
// < HINT.$content
// < GUIDER.$doc
// < GUIDER.$desc
Line 1,454 ⟶ 2,236:
// < GUIDER.$formPage
// < GUIDER.$input
// < GUIDER.$rev
// < HINT.$textarea
// face()
// PREGO.foreign()
// mw.loader.using()
// mw.hook()
// (GUIDER.filled)
// (GUIDER.foreign)
// 2017-08-07 PerfektesChaos@de (GUIDER.wikipediafacet)
// 2021-06-03 PerfektesChaos@de.wikipedia
var $v = $( "head" ),
$e = $v.find( "title" );
Line 1,465 ⟶ 2,252:
$e.text( Signature );
$v.prepend( $e );
HINT.$pagecontent = $area;
HINT.$pagecontent.empty();
face();
$v = HINT.$body.find( "#firstHeading,#section_0" ).text( Signature );
if ( ! $v.length ) {
$v = $( "h1" );
}
$v.eq( 0 ).text( Signature );
$v = $( "<div>" );
$v.css( { "clear": "both" } );
Line 1,483 ⟶ 2,274:
.text( String.fromCharCode( 160 ) );
$v.append( $v, GUIDER.$desc );
HINT.$pagecontent.append( $v );
GUIDER.$formText = $( "<form>" );
GUIDER.$textarea = $( "<textarea>" );
GUIDER.$textarea.addClass( "mw-ui-input" )
.attr( { name: "wikitext" } )
.css( { "marginbackground-topcolor": "2emtransparent",
"maxmargin-widthtop": "100%2em",
"max-width": "100%" } );,
"width": "100%" } );
GUIDER.$formText.append( GUIDER.$textarea );
GUIDER.$formPage = $( "<form>" );
Line 1,501 ⟶ 2,293:
size: 50,
type: "text" } )
.css( { "float": ( HINT.ltr ? "left": "right" ),
"width": "auto",
"max-width": "auto" } );
.keyup( GUIDER.filled )
.mouseup( GUIDER.filled );
GUIDER.$formPage.append( GUIDER.$input );
HINTGUIDER.$page.append(rev = GUIDER.$formText,( GUIDER.$formPage"<input>" );
GUIDER.$rev.addClass( "mw-ui-input" )
.attr( { disabled: true,
inputmode: "numeric",
maxlength: 12,
name: "revision",
placeholder: "oldid",
size: 8,
type: "text" } )
.css( { "display": "inline-block",
"margin-left": "1.5em",
"margin-right": "1.5em",
"width": "auto",
"max-width": "auto" } )
.keyup( GUIDER.figure )
.mouseup( GUIDER.figure );
GUIDER.$formPage.append( GUIDER.$rev );
HINT.$content.append( GUIDER.$formText, GUIDER.$formPage );
GUIDER.$pagename = $( "<div>" );
GUIDER.$pagename.attraddClass( {[ id: SignatureHINT.selector + "-pagename" } ),
HINT.css(selector {+ "background-colorfine": ] "#" + BOX.bgcOk,)
.attr( { "float"id: ( HINT.ltrselector ?+ "left-pagename": "right"} ),
.css( { "marginbackground-bottomcolor": "#" + "1em"BOX.bgcOk,
"paddingfloat": "4px" }( )HINT.ltr ? "left"
: "right" ),
"margin-bottom": "1em",
"padding": "4px",
"pointer-events": "all" } )
.hide();
HINT.$pagecontent.prependbefore( GUIDER.$pagename );
mwHINT.loader.using($textarea HINT= GUIDER.using,$textarea;
mw.loader.using( HINT.using, GUIDER.foreign );
mw.hook( PREGO.signature + ".$button" ).fire( GUIDER.facet,
Signature );
}; // GUIDER.furnish()
 
 
 
INFO.fiat = function () {
// Link headline on Special:info or &action=info if not yet linked
// Precondition:
// mediawiki.util available
// Uses:
// > INFO.$h
// mw.config.get()
// mw.util.getUrl()
// 2022-02-07 PerfektesChaos@de.wikipedia
var s = mw.config.get( "wgRelevantPageName" ),
$a = $( "<a>" );
$a.attr( { href: mw.util.getUrl( "Special:LintErrors",
{ pagename: s } ) } )
.text( INFO.$h.text() );
INFO.$h.empty()
.append( $a );
}; // INFO.fiat()
 
 
 
INFO.first = function () {
// Seek linter statistics headline on Special:info or &action=info
// Precondition:
// DOM ready
// Uses:
// < INFO.$h
// mw.loader.using()
// (INFO.fiat)
// 2022-02-07 PerfektesChaos@de.wikipedia
INFO.$h = $( "#mw-pageinfo-linter" );
if ( INFO.$h.length &&
! INFO.$h.find( "a" ).length ) {
mw.loader.using( [ "mediawiki.util" ],
INFO.fiat );
}
}; // INFO.first()
 
 
 
PREGO.features = function ( applied ) {
// User options available
// Precondition:
// applied -- object, may be null, with values
// Uses:
// > PREGO.pars
// > PREGO.signature
// > Signature
// > HINT.nsn
// > HINT.using
// > PREGO.live
// > HINT.drop
// >< HINT.spaces
// >< HINT.live
// >< LINTER.live
// >< HINT.silent
// < HINT.quiet
// mw.hook()
// PREGO.form()
// LINTER.first()
// mw.loader.using()
// (BOX.feed)
// 2023-05-14 PerfektesChaos@de.wikipedia
var i, n, s, v, vals;
if ( typeof applied === "object"
&& applied ) {
n = PREGO.pars.length;
for ( i = 0; i < n; i++ ) {
v = PREGO.pars[ i ];
s = v[ 0 ];
if ( typeof applied[ s ] === v[ 1 ] ) {
HINT[ s ] = applied[ s ];
}
} // for i
if ( typeof applied.layer === "boolean" ) {
delete applied.layer;
mw.hook( PREGO.signature + ".forward" ).fire( Signature,
applied );
}
}
if ( HINT.spaces ) {
HINT.spaces = HINT.spaces.trim();
}
if ( PREGO.live ) {
if ( ! HINT.drop ) {
HINT.silent = "*";
}
PREGO.form();
} else if ( LINTER.live ) {
LINTER.live = false;
LINTER.first();
} else {
if ( HINT.spaces ) {
if ( HINT.spaces === "*" ) {
HINT.live = true;
} else if ( HINT.spaces !== "-" ) {
vals = HINT.spaces.split( " " );
s = HINT.nsn + "";
for ( i = 0; i < vals.length; i++ ) {
if ( s === vals[ i ] ) {
HINT.live = true;
break; // for i
}
} // for i
}
} else if ( HINT.nsn === 0 ) {
HINT.live = true;
}
if ( HINT.live && HINT.nsn >= 0 ) {
switch ( HINT.silent ) {
case false:
case "*":
break;
case "-":
HINT.quiet = false;
break;
default:
HINT.quiet = HINT.silent.split( " " );
} // switch HINT.silent
 
mw.loader.using( HINT.using, BOX.feed );
}
}
}; // PREGO.features()
 
 
Line 1,524 ⟶ 2,467:
// Uses:
// > PREGO.signature
// > PREGO.site
// > PREGO.store
// > PREGO.sub
// > PREGO.maxage
// mw.loader.getState()
// mw.loader.loadstate()
// 2017-08-08 PerfektesChaos@de REPOS.wikipediafire()
// 2018-09-03 PerfektesChaos@de.wikipedia
var s = "ext.gadget." + PREGO.signature;
var sign = "ext.gadget." + PREGO.signature,
if ( mw.loader.getState( s ) !== "ready" ) {
rls;
mw.loader.load( "https://en.wikipedia.org"
if ( ! mw.loader.getState( sign ) ) {
+ "/w/index.php?title="
rls = { + "User:PerfektesChaos/js/"};
rls[ sign ] + PREGO.signature += "/r.jsloading";
mw.loader.state( rls );
+ "&bcache=1&maxage=604812"
REPOS.fire( PREGO.site,
+ "&action=raw"
PREGO.store + PREGO.signature + "&ctype=text/javascript" );PREGO.sub,
false,
{ action: "raw",
ctype: "text/javascript",
bcache: 1,
maxage: PREGO.maxage } );
}
}; // PREGO.feed()
 
 
 
PREGO.fiat1 = function () {
// Namespaces text input field has been used
// Uses:
// > PREGO.$spaces
// >< PREGO.reNum
// >< PREGO.rooms
// >< PREGO.follow
// 2018-05-02 PerfektesChaos@de.wikipedia
var s = PREGO.$spaces.val(),
i, k, got, rooms;
if ( s.indexOf( "-" ) >= 0 ) {
s = "-";
} else if ( s.indexOf( "*" ) >= 0 ) {
s = "*";
} else {
got = s.trim().split( " " );
s = "";
if ( got.length > 0 ) {
if ( typeof PREGO.rooms !== "object" ) {
PREGO.follow = function ( a, b ) {
return ( a < b ? -1 : 1 );
};
PREGO.reNum = new RegExp( "^[0-9]+$" );
PREGO.rooms = mw.config.get( "wgFormattedNamespaces" );
}
rooms = [ ];
for ( i = 0; i < got.length; i++ ) {
if ( PREGO.reNum.test( got[ i ] ) ) {
k = parseInt( got[ i ], 10 );
if ( ( k === 0 || PREGO.rooms[ k ] ) &&
$.inArray( k, rooms ) < 0 ) {
rooms.push( k );
}
}
} // for i
if ( rooms.length > 0 ) {
rooms.sort( PREGO.follow );
s = rooms.join( " " );
}
}
}
PREGO.$spaces.val( s );
}; // PREGO.fiat1()
 
 
 
PREGO.fiat2 = function () {
// Quiet text input field has been used
// Uses:
// > PREGO.$silent
// >< PREGO.reID
// 2023-05-14 PerfektesChaos@de.wikipedia
var s = PREGO.$silent.val(),
got, i, quiet, single;
if ( s.indexOf( "*" ) >= 0 ) {
s = "*";
} else {
got = s.trim().split( " " );
if ( got.length > 0 ) {
quiet = [ ];
if ( typeof PREGO.reID !== "object" ) {
PREGO.reID = new RegExp( "^[a-z][a-z-]*[a-z]$" );
}
for ( i = 0; i < got.length; i++ ) {
single = got[ i ];
if ( PREGO.reID.test( single ) &&
$.inArray( single, quiet ) < 0 ) {
quiet.push( single );
} else if ( single === "-" ) {
quiet = [ ];
break; // for i
}
} // for i
if ( quiet.length > 0 ) {
s = quiet.join( " " );
} else {
s = "-";
}
} else {
s = "*";
}
}
PREGO.$silent.val( s );
}; // PREGO.fiat2()
 
 
 
PREGO.field1 = function ( $applying ) {
// Namespaces text input field has been generated
// Precondition:
// $applying -- jQuery object of text input field
// Uses:
// < PREGO.$spaces
// (PREGO.fiat1)
// 2023-05-14 PerfektesChaos@de.wikipedia
PREGO.$spaces = $applying;
PREGO.$spaces.change( PREGO.fiat1 );
}; // PREGO.field1()
 
 
 
PREGO.field2 = function ( $applying ) {
// Quiet text input field has been generated
// Precondition:
// $applying -- jQuery object of text input field
// Uses:
// < PREGO.$spaces
// (PREGO.fiat2)
// 2023-05-14 PerfektesChaos@de.wikipedia
PREGO.$silent = $applying;
PREGO.$silent.change( PREGO.fiat2 );
}; // PREGO.field2()
 
 
 
PREGO.fire = function () {
// User options request
// Uses:
// > PREGO.signature
// > Signature
// PREGO.feed()
// mw.hook()
// (PREGO.features)
// 2018-05-02 PerfektesChaos@de.wikipedia
PREGO.feed();
mw.hook( PREGO.signature + ".fetch" ).fire( Signature,
PREGO.features );
}; // PREGO.fire()
 
 
 
PREGO.form = function () {
// Equip Special:Gadgets page with entry and form
// Uses:
// > HINT.doc
// > HINT.texts
// > HINT.launch
// > HINT.last
// > HINT.lazy
// > HINT.layer
// > HINT.spaces
// > Signature
// mw.hook()
// (PREGO.field1)
// (PREGO.field2)
// 2023-05-14 PerfektesChaos@de.wikipedia
var support = ".wikipedia.org/wiki/" + HINT.doc.substr( 3 ),
docs = { "en": "//en" + support,
"de": "//de" + support },
dialog, opts;
opts = [ { signature: "spaces",
type: "text",
show: HINT.texts[ "^^spaces" ],
val: ( HINT.spaces ? HINT.spaces
: "" ),
field: PREGO.field1 },
{ signature: "launch",
type: "checkbox",
show: HINT.texts[ "^^launch" ],
val: HINT.launch },
{ signature: "last",
type: "checkbox",
show: HINT.texts[ "^^last" ],
val: HINT.last },
{ signature: "lazy",
type: "checkbox",
show: HINT.texts[ "^^lazy" ],
val: HINT.lazy },
/*
,
{ signature: "layer",
type: "checkbox",
show: HINT.texts[ "^^layer" ],
val: HINT.layer },
*/
{ signature: "silent",
type: "text",
show: HINT.texts[ "^^silent" ],
val: ( HINT.silent ? HINT.silent
: "*" ),
field: PREGO.field2 }
];
dialog = { script: Signature,
support: docs,
suffix: HINT.texts[ "^suffix" ],
opts: opts };
mw.hook( PREGO.signature + ".form" ).fire( dialog );
}; // PREGO.form()
 
 
 
REPOS.fire = function ( at, access, append, alter ) {
// Load from external URL
// Precondition:
// at -- Wikimedia Foundation site code, or not
// access -- string with basic page name
// append -- string with subpage, or not
// alter -- parameter object, or MIME string, or not
// Uses:
// >< REPOS.requests
// REPOS.foundation()
// mw.loader.load()
// 2018-03-21 PerfektesChaos@de.wikipedia
var source, syntax;
if ( typeof REPOS.requests !== "object" ) {
REPOS.requests = { };
}
if ( typeof REPOS.requests[ access ] !== "boolean" ) {
REPOS.requests[ access ] = true;
if ( append ) {
source = access + append;
} else {
source = access;
}
if ( at ) {
source = REPOS.foundation( at, source, alter );
if ( typeof alter === "object"
&& alter &&
typeof alter.ctype === "string" ) {
syntax = alter.ctype;
}
} else {
syntax = alter;
}
mw.loader.load( source, syntax );
}
}; // REPOS.fire()
 
 
 
REPOS.foundation = function ( at, access, alter ) {
// Create URL within Wikimedia Foundation
// Precondition:
// at -- site code, or not
// access -- string with page name
// alter -- parameter object, or not
// Postcondition:
// Returns full URL
// 2018-03-21 PerfektesChaos@de.wikipedia
var s = access,
r = encodeURI( s );
if ( typeof alter === "object"
&& alter ) {
r = "/w/index.php?title=" + r;
if ( access.substr( -3 ) === ".js" ) {
alter.ctype = "text/javascript";
} else if ( access.substr( -4 ) === ".css" ) {
alter.ctype = "text/css";
}
alter.action = "raw";
for ( s in alter ) {
r = r + "&" + s + "=" + encodeURI( alter[ s ] );
} // for s in alter
} else {
r = "/wiki/" + r;
}
if ( typeof at === "string"
&& at ) {
switch ( at ) {
case "meta":
r = "meta.wikimedia.org" + r;
break;
case "mw":
r = "www.mediawiki.org" + r;
break;
case "w:en":
r = "en.wikipedia.org" + r;
break;
default:
r = window.___location.host + r;
} // switch at
r = "https://" + r;
}
return r;
}; // REPOS.foundation()
 
 
 
TMPLXPAND.first = function () {
// Initialize ExpandTemplates
// Uses:
// > HINT.using
// < TMPLXPAND.live
// < HINT.live
// < EDIT.live
// < EDIT.selector
// (TMPLXPAND.further)
// 2018-07-06 PerfektesChaos@de.wikipedia
TMPLXPAND.live = true;
HINT.live = true;
EDIT.live = true;
EDIT.selector = "#output";
mw.loader.using( HINT.using, TMPLXPAND.further );
}; // TMPLXPAND.first()
 
 
 
TMPLXPAND.further = function () {
// Prepare ExpandTemplates
// Precondition:
// Resources available
// Uses:
// mw.hook()
// (BOX.flip)
// 2018-05-20 PerfektesChaos@de.wikipedia
mw.hook( "wikipage.content" ).add( BOX.flip );
}; // TMPLXPAND.further()
 
 
 
UPDATE.feed = function ( apply ) {
// Memorize unknown category
// Uses:
// >< UPDATE.o
// UPDATE.flush()
// 2018-05-20 PerfektesChaos@de.wikipedia
if ( typeof UPDATE.o !== "object" ) {
UPDATE.o = { };
}
if ( typeof UPDATE.o.unknown !== "object" ) {
UPDATE.o.unknown = [ ];
}
if ( $.inArray( apply, HINT.errors ) < 0 ) {
HINT.errors.push( apply );
UPDATE.o.unknown.push( apply );
}
UPDATE.flush();
}; // UPDATE.feed()
 
 
 
UPDATE.fetch = function () {
// Consider memorized categories
// Precondition:
// mediawiki.storage available
// Uses:
// > Signature
// >< HINT.errors
// < UPDATE.o
// UPDATE.flush()
// 2018-05-20 PerfektesChaos@de.wikipedia
var storage = mw.storage.get( Signature ),
i, k, parsed, s, unknown;
if ( typeof storage === "string" ) {
try {
parsed = JSON.parse( storage );
if ( typeof parsed === "object"
&& parsed ) {
if ( typeof parsed.translations === "object"
&& parsed.translations ) {
UPDATE.o = { translations: parsed.translations };
}
if ( typeof parsed.unknown === "object"
&& parsed.unknown &&
typeof parsed.unknown.length === "number"
&& parsed.unknown.length ) {
unknown = [ ];
for ( i = 0; i < parsed.unknown.length; i++ ) {
s = parsed.unknown[ i ];
if ( typeof s === "string" ) {
s = s.trim();
if ( s ) {
k = $.inArray( s, HINT.errors );
if ( k < 0 ) {
HINT.errors.push( s );
unknown.push( s );
}
}
}
} // for i
if ( unknown.length ) {
if ( typeof UPDATE.o === "object" ) {
UPDATE.o.unknown = unknown;
} else {
UPDATE.o = { unknown: unknown };
}
}
if ( unknown.length !== parsed.unknown.length ) {
UPDATE.flush();
}
}
}
} catch (e) {
}
if ( typeof UPDATE.o !== "object" ) {
UPDATE.flush();
}
}
}; // UPDATE.fetch()
 
 
 
UPDATE.flush = function () {
// Update unknown categories memory
// Precondition:
// mediawiki.storage available
// Uses:
// > Signature
// > UPDATE.o
// 2018-05-20 PerfektesChaos@de.wikipedia
var storage;
if ( typeof UPDATE.o === "object" ) {
storage = JSON.stringify( UPDATE.o );
}
if ( storage ) {
mw.storage.set( Signature, storage );
} else {
mw.storage.remove( Signature );
}
}; // UPDATE.flush()
 
 
 
WIKED.fetch = function () {
// Update text area from wikEd contents
// Uses:
// > window.wikEd
// >< WIKED.wikEd
// 2018-07-06 PerfektesChaos@de.wikipedia
if ( ! WIKED.wikEd &&
( typeof window.wikEd === "function" ||
( typeof window.wikEd === "object"
&& window.wikEd ) ) &&
typeof window.wikEd.disabled === "boolean" &&
typeof window.wikEd.highlightSyntax === "boolean" &&
typeof window.wikEd.turnedOn === "boolean" &&
typeof window.wikEd.useWikEd === "boolean" ) {
WIKED.wikEd = window.wikEd;
}
if ( WIKED.wikEd &&
! WIKED.wikEd.disabled &&
WIKED.wikEd.useWikEd &&
WIKED.wikEd.turnedOn &&
WIKED.wikEd.highlightSyntax ) {
WIKED.wikEd.UpdateTextarea();
}
}; // WIKED.fetch()
 
 
 
/*
WIKED.fire = function () {
var script = document.createElement('script');
script.src = '//en.wikipedia.org/w/index.php?title=User:Cacycle/wikEd.js&action=raw&ctype=text/javascript';
script.async = true;
document.getElementsByTagName('head')[0].appendChild(script);
}; // WIKED.fire()
*/