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

Content deleted Content added
-4.4
-5.8
 
(12 intermediate revisions by the same user not shown)
Line 1:
/// User:PerfektesChaos/js/lintHint/d.js
/// 20212024-0507-2504 PerfektesChaos@de.wikipedia
// Show LintErrors analysis live
// ResourceLoader: compatible;
// dependencies: user,
// mw mediawiki.API, mediawiki.storage, mediawiki.util
/// Fingerprint: #0#0#
/// License: CC-by-sa/4.0
Line 12 ⟶ 13:
laxbreak:true,
nocomma:true, strict:true, undef:true, unused:true */
 
 
 
Line 17 ⟶ 19:
( function ( mw, $ ) {
"use strict";
var Version = -45.48,
Signature = "lintHint",
HINT = { cmodels: { "wikitext": true,
Line 23 ⟶ 25:
"proofread-page": true },
doc: "en:User:PerfektesChaos/js/" + Signature,
drop: false,
errors: [ "bogus-image-options",
"deletable-table-tag",
Line 28 ⟶ 31:
"html5-misnesting",
"ignored-table-attr",
"inline-media-caption",
"large-tables",
"misc-tidy-replacement-issues",
"misnested-tag",
Line 36 ⟶ 41:
"multiline-html-table-in-list",
"multiple-unclosed-formatting-tags",
"night-mode-unaware-background-color",
"obsolete-tag",
"pwrap-bug-workaround",
Line 54 ⟶ 60:
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",
Line 60 ⟶ 72:
"user.options" ],
$body: false,
$indicatorcontent: false,
$pagemain: false,
$textarea: false },
$widget: false },
API = { Api: false,
errors: false,
Line 88 ⟶ 101:
$top: false },
CODMIRROR = { cm: false },
EDIT = { listenlayer: false,
livelisten: false,
sourcelive: false,
$sourceselTextbox: false }"div[role='textbox']",
GUIDER = { last selVEsrc: false,".ve-init-mw-desktopArticleTarget-"
live: false + "uneditableContent",
reTrimsource: false,
usingsourceVE: [ "jquery.textSelection&veaction=editsource",
$source: false "mediawiki.ui.button"},
GUIDER = { last: "mediawiki.ui.input" ]false,
live: false,
reTrim: false,
suitable: String.fromCharCode( 0x2714 ),
using: [ "jquery.textSelection",
"mediawiki.ui.button",
"mediawiki.ui.input" ],
$pagename: false },
INFO = { },
LINTER = { live: false },
PREGO = { app: false,
Line 108 ⟶ 128:
// [ "layer", "boolean" ],
[ "lazy", "boolean" ],
[ "silent", "string" ],
[ "spaces", "string" ] ],
signature: "preferencesGadgetOptions",
Line 207 ⟶ 228:
+ " 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 239 ⟶ 267:
if ( mw.config.get( "skin" ) !== "minerva" ) { // T49858
if ( action ) {
mw.loader.using( [ "jquery.tablesorter" ],
action );
} else {
Line 263 ⟶ 291:
// < HINT.later
// < HINT.lazy
// < HINT.drop
// mw.loader.using()
// BOX.flat()
// (API.full)
// (BOX.feed)
// 20192023-0105-1914 PerfektesChaos@de.wikipedia
var i, live, s;
if ( typeof apply === "object"
&& apply ) {
Line 322 ⟶ 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 335 ⟶ 383:
// > LINTER.first
// > HINT.cmodels
// > EDIT.sourceVE
// > EDIT.selTextbox
// > HINT.doc
// > Version
// >< HINT.using
// < HINT.signature
// < HINT.selector
// < HINT.nsn
// < PREGO.live
Line 348 ⟶ 399:
// < HINT.launch
// < EDIT.live
// < EDIT.layer
// < EDIT.selector
// < HINT.pub
// mw.loader.getState()
Line 355 ⟶ 408:
// PREGO.fire()
// fair()
// mw.loader.using()
// mw.hook()
// (TMPLXPAND.first)
// (INFO.first)
// (LINTER.first)
// (features)
// 20182022-0802-2407 PerfektesChaos@de.wikipedia
var i, later, listen, live, re, rls, s;
HINT.signature = "ext.gadget." + Signature;
if ( mw.loader.getState( HINT.signature ) !== "ready" ) {
Line 366 ⟶ 421:
rls[ HINT.signature ] = "ready";
mw.loader.state( rls );
HINT.selector = Signature.toLowerCase();
switch ( mw.config.get( "wgAction" ) ) {
case "view":
Line 391 ⟶ 447:
case "ExpandTemplates":
PREGO.fire();
EDIT.live = true;
EDIT.selector = "textarea#output";
fair( TMPLXPAND.first );
break;
case "Info":
$( INFO.first );
break;
case "LintErrors":
Line 429 ⟶ 490:
} 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 450 ⟶ 517:
}
// mw.hook( "CodeMirror.enabled" ).add( CODMIRROR.fire );
break;
case "info":
$( INFO.first );
break;
} // switch wgAction
Line 463 ⟶ 533:
}
if ( live ) {
fairif ( later ); {
PREGO mw.fireloader.using( HINT.using, EDIT.fading );
} else {
fair();
PREGO.fire();
}
}
HINT.pub = { doc: "[[" + HINT.doc + "]]",
Line 533 ⟶ 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 682 ⟶ 765:
// Uses:
// > HINT.ltr
// > BOX.$box
// 2018-09-25 PerfektesChaos@de.wikipedia
if ( $activate ) {
Line 699 ⟶ 782:
// Uses:
// > HINT.live
// > Signature
// > HINT.ltr
// > BOX.bgc
Line 706 ⟶ 788:
// > GUIDER.live
// > PREGO.signature
// > HINT.selector
// > Signature
// > Version
// >< BOX.$box
// < HINTBOX.$pagefirst()
// face()
// BOX.focus()
// BOX.flat()
// BOX.firing()
// (BOX.flip)
// (BOX.facet)
// 2021-0106-0103 PerfektesChaos@de.wikipedia
var $a, $e;
if ( HINT.live ) {
HINTBOX.$page =first( $area );
if ( BOX.$box ) {
if ( BOX.$failure ) {
Line 740 ⟶ 825:
.css( { "float": ( HINT.ltr ? "left": "right" ) } );
BOX.$box.append( $e )
.addClass( SignatureHINT.selector + "-box" )
.attr( { id: SignatureHINT.selector,
role: "alert" } )
.css( { "background-color": "#" + BOX.bgc,
Line 749 ⟶ 834:
"color": "#" + BOX.fgc,
"margin-bottom": "1em",
"opacity": "1 !important",
"padding": "0.5em",
"pointer-events": "all" } );
Line 773 ⟶ 857:
BOX.flat();
}
BOX.firing( Version, false );
}; // BOX.factory()
 
Line 785 ⟶ 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 807 ⟶ 892:
.show();
}
if ( GUIDER.$pagenamefine( false ) {;
GUIDER.$pagename.hide();
}
}; // BOX.fault()
 
Line 820 ⟶ 903:
// > HINT.launched
// > EDIT.live
// < API.errors
// UPDATE.fetch()
// API.full()
// mw.hook()
// (BOX.flip)
// 20182021-0506-2003 PerfektesChaos@de.wikipedia
UPDATE.fetch();
if ( HINT.launch && ! HINT.launched && ! EDIT.live ) {
API.full();
} else {
API.errors = true;
mw.hook( "wikipage.content" ).add( BOX.flip );
}
Line 839 ⟶ 924:
// Precondition:
// $area -- mw-content-text
// mediawiki.api.messages available
// Uses:
// > BOX.$indicator
// > BOX.$collapsed
// > BOXHINT.$nullwidget
// > BOX.$box
// > HINT.$textarea
Line 850 ⟶ 934:
// > HINT.nsn
// > PREGO.signature
// > HINT.selector
// >< BOX.$table
// >< BOX.$tbody
// >< BOX.swift
// >< API.Api
// >< BOX.$pagename
// < BOX.swift
// < BOX.$tbody
// BOX.factory()
// mw.hook()
// BOX.filler()
// mw.Api.loadMessagesIfMissing()
// GUIDER.fromfine()
// (BOX.flag)
// (BOX.filler)
// (API.fault)
// 2021-0506-2503 PerfektesChaos@de.wikipedia
var i, req, $th, $thead, $tr;
BOX.factory( $area );
if ( BOX.$collapsed && ! HINT.$indicatorwidget ) {
} else { BOX.$collapsed.hide();
if ( BOX.$collapsed ) {
BOX.$collapsed.hide();
}
if ( BOX.$null ) {
BOX.$null.hide();
}
}
if ( BOX.$box ) {
Line 915 ⟶ 994:
BOX.$tbody = $( "<tbody>" );
BOX.$table.addClass( "wikitable "
+ SignatureHINT.selector + "-table" )
.attr( { id: SignatureHINT.selector + "-table" } )
.append( $thead, BOX.$tbody )
.css( { "clear": "both" } );,
"overflow": "scroll" } );
if ( HINT.errors.length > 1 || HINT.nsn < 0 ) {
BOX.$table.addClass( "sortable" );
Line 933 ⟶ 1,013:
.fail( API.fault );
}
if GUIDER.fine( BOX.$pagenamefalse ) {;
GUIDER.from( BOX.$pagename );
}
}
}; // BOX.fill()
Line 949 ⟶ 1,027:
// > mw.messages
// > HINT.later
// > HINT.selector
// > Signature
// > BOX.bgcErr
Line 962 ⟶ 1,041:
// mw.message()
// UPDATE.feed()
// mw.hook()
// BOX.future()
// (BOX.find)
// (BOX.future)
// 20202022-0905-1901 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 983 ⟶ 1,063:
if ( s ) {
$tr = $( "<tr>" );
$tr.addClass( SignatureHINT.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 1,023 ⟶ 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 1,043 ⟶ 1,133:
.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" ) {
Line 1,048 ⟶ 1,141:
}
$tr.append( $td );
loc = true;
}
BOX.$tbody.append( $tr );
Line 1,062 ⟶ 1,156:
}
BOX.$table.show();
if ( loc ) {
mw.hook( Signature + ".table-range" ).fire( BOX.$table );
}
} else {
BOX.$table.hide();
Line 1,092 ⟶ 1,189:
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()
 
 
Line 1,120 ⟶ 1,316:
// alive -- leave BOX.$collapsed
// Uses:
// > HINT.live
// > BOX.$box
// > BOX.$collapsed
// > EDIT.live
// > API.errors
Line 1,129 ⟶ 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 );
// 2021-05-25 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 1,156 ⟶ 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.attr( { title: "+" } )
.show();
}
} else if ( ! HINT.lazy &&
HINT.launched &&
HINT.$page ) {
face();
BOX.$null = $( "<div>" );
BOX.$null.addClass( Signature + "-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, true );
}
} else if ( BOX.$null ) {
BOX.$null.hide();
}
}; // BOX.flat()
Line 1,203 ⟶ 1,361:
// Uses:
// > GUIDER.live
// > VersionHINT.selector
// > Signature
// > HINT.ltr
// > 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)
// 2021-0512-2526 PerfektesChaos@de.wikipedia
if BOX.first( $area && ! HINT.$page ) {;
HINT.$page = $area;
}
face();
BOX.flat( $area, true );
if ( ! GUIDER.live ) {
if ( BOX.$collapsed ) {
BOX.$collapsed.attrshow( { disabled: false,);
title: Version } )
.show();
} else {
BOX.$collapsed = $( "<div>" );
BOX.$collapsed.addClass( SignatureHINT.selector + "-collapsed" )
.attr( { id: SignatureHINT.selector + "-collapsed",
role: "button", } )
title: Version } )
.click( BOX.full )
.css( { /* "clear": ( HINT.ltr
? "right":
"left" ), */
"cursorpadding-left": "pointer2px",
"floatpadding-right": ( HINT.ltr"2px",
"padding-top": ? "right2px",
: "left" ),
"padding": "2px",
"pointer-events": "all" } )
.text( Signature );
BOX.focus( BOX.$collapsed, true, true );
}
BOX.firing( Version, true );
BOX.$collapsed.css( { "background-color": "#" + BOX.bgc, } );
}
"color": "#" + BOX.fgc,
if ( TMPLXPAND.live && ! EDIT.$source ) {
"opacity": "1 !important" } );
EDIT.fetch();
}
if ( EDIT.live && ! API.errors && ! TMPLXPAND.live ) {
EDIT.fine();
}
Line 1,263 ⟶ 1,418:
 
BOX.focus = function ( $apply, another, around ) {
// Insertion in page top region or toolbox
// Precondition:
// $apply -- jQuery object
Line 1,270 ⟶ 1,425:
// Uses:
// > HINT.indicators
// > SignatureHINT.selector
// > HINT.$pagemain
// >< HINT.$indicatorwidget
// >< BOX.$top
// 2021-0506-2503 PerfektesChaos@de.wikipedia
var learn, light, s, $e;
$apply.addClass( "noprint" );
if ( another ) {
if ( HINT.$indicatorwidget === false ) {
HINT.$indicatorwidget = $( HINT.indicators );
switch ( HINT.$indicatorwidget.length ) {
case 0:
HINT.$indicatorwidget = null;
break;
case 1:
break;
default:
HINT.$indicatorwidget = HINT.$indicatorwidget.eq( 0 );
} // switch HINT.$indicatorwidget.length
learn = true;
}
if ( HINT.$indicatorwidget ) {
$apply.css( { "display": "inline-block",
"line-height": "1.2em",
Line 1,297 ⟶ 1,452:
"margin-right": "3px",
"padding": "1px" } );
HINT.$indicatorwidget.append( $apply );
light = true;
} else {
$apply.css( { "float": ( HINT.ltr ? "right"
: "left" ) } );
}
}
Line 1,305 ⟶ 1,463:
BOX.$top = $( "<div>" );
BOX.$top.addClass( "noprint "
+ SignatureHINT.selector + "-top" )
.attr( { id: SignatureHINT.selector + "-top" } )
.css( { "clear": "both",
"width": "100%" } );
$e = $( "<div>" );
$e.css( { "clear": "both" } );
HINT.$pagemain.before( BOX.$top, $e );
learn = true;
}
Line 1,338 ⟶ 1,496:
// > HINT.live
// > BOX.$box
// > HINT.$widget
// > BOX.$collapsed
// > BOXHINT.bgcRunselector
// > BOX.fgcRun
// > GUIDER.live
// > Version
// >< API.errors
// >< API.single
// >< EDIT.live
// < HINT.launch
// BOX.$collapsed.hidefiring()
// EDIT.fire()
// API.full()
// 2020-09-20 PerfektesChaos@de (BOX.wikipediafull)
// 2021-06-03 PerfektesChaos@de.wikipedia
var idRev;
if ( HINT.live ) {
Line 1,355 ⟶ 1,515:
if ( EDIT.live ) {
API.errors = false;
} else if ( HINT.$widget ) {
BOX.$collapsed.hidefiring( "?" );
}
if ( API.errors ) {
Line 1,364 ⟶ 1,524:
}
}
if BOX.firing( ! API".errors..", )false, {"progress" );
BOX.$collapsed.attraddClass( {HINT.selector + disabled:"-progress" true,);
title: "..." } )
.css( { "background-color": "#" + BOX.bgcRun,
"color": "#" + BOX.fgcRun,
"opacity": "1 !important" }
);
}
if ( ! GUIDER.live ) {
if ( ! API.single ) {
Line 1,385 ⟶ 1,539:
HINT.launch = true;
API.full( API.single, idRev );
BOX.firing( "?", false, "progress" );
}
} else if ( HINT.$widget ) {
BOX.$collapsed.hidefiring( "?", false, "progress" );
}
}; // BOX.full()
Line 1,399 ⟶ 1,554:
// Uses:
// > HINT.texts.other
// > SignatureHINT.selector
// > BOX.$box
// >< PREGO.app
// < BOX.$other
// PREGO.app.translation()
// 2021-0105-0126 PerfektesChaos@de.wikipedia
var $e;
if ( application ) {
Line 1,417 ⟶ 1,572:
.html( PREGO.app.translation( HINT.texts.other ) );
BOX.$other = $( "<div>" );
BOX.$other.addClass( SignatureHINT.selector + "-future" )
.attr( { id: SignatureHINT.selector + "-future" } )
.css( { "clear": "both",
"padding-bottom": "1em",
Line 1,476 ⟶ 1,631:
}; // 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()
 
 
Line 1,484 ⟶ 1,675:
// Returns textarea contents, if present
// Uses:
// > EDIT.selTextbox
// > HINT.source
// > HINT.$pagemain
// > HINT.$content
// >< EDIT.selector
// >< EDIT.$source
// < EDIT.listen
// < HINT.$textarea
// 20182021-0712-0623 PerfektesChaos@de.wikipedia
var r, $div;
if ( ! EDIT.$source ) {
if ( ! EDIT.selectorlayer ) {
EDIT.selector = EDIT.selTextbox;
} else if ( ! EDIT.selector ) {
switch ( HINT.source ) {
case "wikitext":
Line 1,502 ⟶ 1,697:
}
if ( EDIT.selector ) {
EDIT.$sourceif = HINT.$page.find( EDIT.selectorlayer ); {
if ( ! EDIT.$source.lengthdiv )= {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;
}
Line 1,511 ⟶ 1,715:
}
if ( EDIT.live && EDIT.$source && EDIT.$source.length ) {
HINT.$textareaif =( EDIT.$source;layer ) {
r r = EDIT.$source.valtext();
} else {
HINT.$textarea = EDIT.$source;
r = EDIT.$source.val();
}
}
return r;
Line 1,523 ⟶ 1,731:
// Uses:
// > EDIT.$source
// > BOX.bgcOk
// > BOX.$collapsed
// < EDIT.listen
// BOX.fine()
// (EDIT.focus)
// 2021-0506-2503 PerfektesChaos@de.wikipedia
if ( EDIT.$source ) {
EDIT.listen = true;
EDIT.$source.focusin( EDIT.focus );
BOX.$collapsed.attr( { title: "+" } )
.css( { "background-color": "#" + BOX.bgcOk,
"opacity": "1 !important" } );
}
BOX.fine();
}; // EDIT.fine()
 
Line 1,547 ⟶ 1,752:
// EDIT.fetch()
// API.fire()
// 2021-06-03 BOX.$collapsedPerfektesChaos@de.hide()wikipedia
// 2018-07-06 PerfektesChaos@de.wikipedia
var source;
if ( ! TMPLXPAND.live ) {
Line 1,562 ⟶ 1,766:
EDIT.listen = false;
API.fire( source );
} else {
BOX.$collapsed.hide();
}
}; // EDIT.fire()
Line 1,572 ⟶ 1,774:
// Source area has been touched
// Uses:
// > Version
// > BOX.bgc
// > BOX.$collapsed
// >< EDIT.listen
// 2020-09-20 PerfektesChaos@de BOX.wikipediafiring()
// 2021-06-03 PerfektesChaos@de.wikipedia
if ( EDIT.listen ) {
BOX.firing( Version, true );
BOX.$collapsed.css( { "background-color": "#" + BOX.bgc, } );
"opacity": "1 !important" } );
EDIT.listen = false;
}
Line 1,726 ⟶ 1,930:
// > GUIDER.$input
// > GUIDER.$rev
// > GUIDER.$startPage
// < GUIDER.last
// < API.single
// GUIDER.fired()
// API.full()
// 20182021-0506-0703 PerfektesChaos@de.wikipedia
var s = GUIDER.$input.val().trim();
GUIDER.$input.val( s );
Line 1,739 ⟶ 1,944:
API.full( s, GUIDER.$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,751 ⟶ 2,010:
// > HINT.texts.howTo
// > GUIDER.$desc
// > HINT.$pagecontent
// > HINT.texts.___domain
// > Signature
Line 1,757 ⟶ 2,016:
// < PREGO.app
// PREGO.app.translation()
// 20172021-0806-0103 PerfektesChaos@de.wikipedia
var $e = $( "<div>" );
PREGO.app = application;
Line 1,764 ⟶ 2,023:
"margin-top": "8em" } )
.html( PREGO.app.translation( HINT.texts.howTo ) );
HINT.$pagecontent.append( $e );
$e = $( "<a>" );
$e.attr( { href: "https://"
Line 1,784 ⟶ 2,043:
// > GUIDER.$textarea
// > GUIDER.reTrim
// > GUIDER.$startText
// < GUIDER.last
// < API.single
Line 1,789 ⟶ 2,049:
// GUIDER.fired()
// API.fire()
// 2017-102021-06-03 PerfektesChaos@de.wikipedia
var s = GUIDER.$textarea.val();
GUIDER.fired();
Line 1,798 ⟶ 2,058:
HINT.launched = true;
}
GUIDER.$startText.css( { "cursor": "progress" } );
}; // GUIDER.fire()
 
Line 1,847 ⟶ 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,870 ⟶ 2,121:
// Request messages
// Precondition:
// mediawiki.api.messages available
// Uses:
// >< API.Api
Line 1,901 ⟶ 2,152:
// Uses:
// > GUIDER.$formText
// > GUIDER.suitable
// > GUIDER.$formPage
// > HINT.ltr
// > PREGO.signature
// < GUIDER.$startText
// < GUIDER.$okay
// < GUIDER.$startPage
// mw.hook()
// (GUIDER.fire)
Line 1,910 ⟶ 2,165:
// (GUIDER.filled)
// (GUIDER.finish)
// 20182021-0906-2503 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,941 ⟶ 2,205:
.css( { "float": ( HINT.ltr ? "right": "left" ) } );
GUIDER.$formPage.append( $b );
GUIDER.$bstartPage = $( "<span>" );
GUIDER.$bstartPage.addClass( "mw-ui-button mw-ui-progressive" )
.click( GUIDER.find )
.css( { "color": "#FFFFFF" } )
.text( submit );
GUIDER.$formPage.append( GUIDER.$bstartPage );
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,991 ⟶ 2,228:
// > HINT.using
// > PREGO.signature
// > < HINT.$pageselector
// < HINT.$content
// < GUIDER.$doc
// < GUIDER.$desc
Line 2,007 ⟶ 2,245:
// (GUIDER.foreign)
// (GUIDER.facet)
// 2021-0106-0103 PerfektesChaos@de.wikipedia
var $v = $( "head" ),
$e = $v.find( "title" );
Line 2,014 ⟶ 2,252:
$e.text( Signature );
$v.prepend( $e );
HINT.$pagecontent = $area;
HINT.$pagecontent.empty();
face();
$v = HINT.$body.find( "#firstHeading,#section_0" );
Line 2,036 ⟶ 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 2,077 ⟶ 2,316:
.mouseup( GUIDER.figure );
GUIDER.$formPage.append( GUIDER.$rev );
HINT.$pagecontent.append( GUIDER.$formText, GUIDER.$formPage );
GUIDER.$pagename = $( "<div>" );
GUIDER.$pagename.addClass( Signature[ HINT.selector + "-pagename" ),
.attr( { id: Signature HINT.selector + "-pagenamefine" }] )
.attr( { id: HINT.selector + "-pagename" } )
.css( { "background-color": "#" + BOX.bgcOk,
"float": ( HINT.ltr ? "left"
: "right" ),
"margin-bottom": "1em",
"opacity": "1 !important",
"padding": "4px",
"pointer-events": "all" } )
.hide();
HINT.$pagecontent.before( GUIDER.$pagename );
HINT.$textarea = GUIDER.$textarea;
mw.loader.using( HINT.using, GUIDER.foreign );
Line 2,095 ⟶ 2,334:
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()
 
 
Line 2,109 ⟶ 2,387:
// > HINT.using
// > PREGO.live
// > HINT.drop
// >< HINT.spaces
// >< HINT.live
// >< LINTER.live
// >< HINT.silent
// < HINT.quiet
// mw.hook()
// PREGO.form()
Line 2,116 ⟶ 2,398:
// mw.loader.using()
// (BOX.feed)
// 20192023-0105-1914 PerfektesChaos@de.wikipedia
var i, n, s, v, vals;
if ( typeof applied === "object"
Line 2,125 ⟶ 2,407:
s = v[ 0 ];
if ( typeof applied[ s ] === v[ 1 ] ) {
HINT[ s ] = applied[ s ];
}
} // for i
Line 2,138 ⟶ 2,420:
}
if ( PREGO.live ) {
if ( ! HINT.drop ) {
HINT.silent = "*";
}
PREGO.form();
} else if ( LINTER.live ) {
Line 2,160 ⟶ 2,445:
}
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 );
}
Line 2,197 ⟶ 2,493:
 
 
PREGO.fiatfiat1 = function () {
// Namespaces text input field has been generatedused
// Uses:
// > PREGO.$spaces
Line 2,239 ⟶ 2,535:
}
PREGO.$spaces.val( s );
}; // PREGO.fiatfiat1()
 
 
 
PREGO.fieldfiat2 = function ( $applying ) {
// 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:
Line 2,249 ⟶ 2,586:
// Uses:
// < PREGO.$spaces
// 2018-05-02 PerfektesChaos@de (PREGO.wikipediafiat1)
// 2023-05-14 PerfektesChaos@de.wikipedia
PREGO.$spaces = $applying;
PREGO.$spaces.change( PREGO.fiatfiat1 );
}; // PREGO.fieldfield1()
 
 
 
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()
 
 
Line 2,284 ⟶ 2,636:
// > Signature
// mw.hook()
// (PREGO.fiatfield1)
// 2019-01-19 PerfektesChaos@de (PREGO.wikipediafield2)
// 2023-05-14 PerfektesChaos@de.wikipedia
var support = ".wikipedia.org/wiki/" + HINT.doc.substr( 3 ),
docs = { "en": "//en" + support,
Line 2,295 ⟶ 2,648:
val: ( HINT.spaces ? HINT.spaces
: "" ),
field: PREGO.fieldfield1 },
{ signature: "launch",
type: "checkbox",
Line 2,307 ⟶ 2,660:
type: "checkbox",
show: HINT.texts[ "^^lazy" ],
val: HINT.lazy },
/*
,
Line 2,313 ⟶ 2,666:
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,
Line 2,440 ⟶ 2,799:
// 2018-05-20 PerfektesChaos@de.wikipedia
mw.hook( "wikipage.content" ).add( BOX.flip );
}; // TMPLXPAND.firstfurther()
 
 
Line 2,581 ⟶ 2,940:
document.getElementsByTagName('head')[0].appendChild(script);
}; // WIKED.fire()
*/