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

Content deleted Content added
-4.9
-5.1
Line 1:
/// User:PerfektesChaos/js/lintHint/d.js
/// 20212022-1202-2707 PerfektesChaos@de.wikipedia
// Show LintErrors analysis live
// ResourceLoader: compatible;
Line 17:
( function ( mw, $ ) {
"use strict";
var Version = -45.91,
Signature = "lintHint",
HINT = { cmodels: { "wikitext": true,
Line 108:
"mediawiki.ui.input" ],
$pagename: false },
INFO = { },
LINTER = { live: false },
PREGO = { app: false,
Line 248 ⟶ 249:
if ( mw.config.get( "skin" ) !== "minerva" ) { // T49858
if ( action ) {
mw.loader.using( [ "jquery.tablesorter" ],
action );
} else {
Line 372 ⟶ 373:
// mw.hook()
// (TMPLXPAND.first)
// (INFO.first)
// (LINTER.first)
// (features)
// 20212022-1202-2607 PerfektesChaos@de.wikipedia
var i, later, listen, live, re, rls, s;
HINT.signature = "ext.gadget." + Signature;
Line 410 ⟶ 412:
EDIT.selector = "textarea#output";
fair( TMPLXPAND.first );
break;
case "Info":
$( INFO.first );
break;
case "LintErrors":
Line 474 ⟶ 479:
}
// mw.hook( "CodeMirror.enabled" ).add( CODMIRROR.fire );
break;
case "info":
$( INFO.first );
break;
} // switch wgAction
Line 710 ⟶ 718:
// Uses:
// > HINT.ltr
// > BOX.$box
// 2018-09-25 PerfektesChaos@de.wikipedia
if ( $activate ) {
Line 2,272 ⟶ 2,280:
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()