Content deleted Content added
-5.5 |
-5.8 |
||
(2 intermediate revisions by the same user not shown) | |||
Line 1:
/// User:PerfektesChaos/js/lintHint/d.js
///
// Show LintErrors analysis live
// ResourceLoader: compatible;
// dependencies: user,
// /// 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 = -5.
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 29 ⟶ 32:
"ignored-table-attr",
"inline-media-caption",
"large-tables",
"misc-tidy-replacement-issues",
"misnested-tag",
Line 37 ⟶ 41:
"multiline-html-table-in-list",
"multiple-unclosed-formatting-tags",
"night-mode-unaware-background-color",
"obsolete-tag",
"pwrap-bug-workaround",
Line 55 ⟶ 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 118 ⟶ 128:
// [ "layer", "boolean" ],
[ "lazy", "boolean" ],
[ "silent", "string" ],
[ "spaces", "string" ] ],
signature: "preferencesGadgetOptions",
Line 217 ⟶ 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 273 ⟶ 291:
// < HINT.later
// < HINT.lazy
// < HINT.drop
// mw.loader.using()
// BOX.flat()
// (API.full)
// (BOX.feed)
//
var i, live, s;
if ( typeof apply === "object"
&& apply ) {
Line 332 ⟶ 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 569 ⟶ 607:
// arrived -- JSON result of ajax lint query
// Uses:
// >
// < API.scream
// < API.errors
// (BOX.fill)
// (BOX.flat)
//
var
API.scream = false;
API.errors = false;
if ( typeof arrived === "object"
&& arrived &&
typeof arrived.length === "number"
&& arrived.length ) {
if ( $.inArray( e.type, HINT.quiet ) < 0 ) {
API.errors.push( e );
}
} // for i
} else {
API.errors = arrived;
}
}
s = ( API.
mw.hook( "wikipage.content" ).add( BOX[
}; // API.fine()
Line 2,340 ⟶ 2,387:
// > HINT.using
// > PREGO.live
// > HINT.drop
// >< HINT.spaces
// >< HINT.live
// >< LINTER.live
// >< HINT.silent
// < HINT.quiet
// mw.hook()
// PREGO.form()
Line 2,347 ⟶ 2,398:
// mw.loader.using()
// (BOX.feed)
//
var i, n, s, v, vals;
if ( typeof applied === "object"
Line 2,356 ⟶ 2,407:
s = v[ 0 ];
if ( typeof applied[ s ] === v[ 1 ] ) {
HINT[ s ]
}
} // for i
Line 2,369 ⟶ 2,420:
}
if ( PREGO.live ) {
if ( ! HINT.drop ) {
HINT.silent = "*";
}
PREGO.form();
} else if ( LINTER.live ) {
Line 2,391 ⟶ 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,428 ⟶ 2,493:
PREGO.
// Namespaces text input field has been
// Uses:
// > PREGO.$spaces
Line 2,470 ⟶ 2,535:
}
PREGO.$spaces.val( s );
}; // PREGO.
PREGO.
// 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,480 ⟶ 2,586:
// Uses:
// < PREGO.$spaces
//
// 2023-05-14 PerfektesChaos@de.wikipedia
PREGO.$spaces = $applying;
PREGO.$spaces.change( PREGO.
}; // PREGO.
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,515 ⟶ 2,636:
// > Signature
// mw.hook()
// (PREGO.
//
// 2023-05-14 PerfektesChaos@de.wikipedia
var support = ".wikipedia.org/wiki/" + HINT.doc.substr( 3 ),
docs = { "en": "//en" + support,
Line 2,526 ⟶ 2,648:
val: ( HINT.spaces ? HINT.spaces
: "" ),
field: PREGO.
{ signature: "launch",
type: "checkbox",
Line 2,538 ⟶ 2,660:
type: "checkbox",
show: HINT.texts[ "^^lazy" ],
val: HINT.lazy },
/*
,
Line 2,544 ⟶ 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,671 ⟶ 2,799:
// 2018-05-20 PerfektesChaos@de.wikipedia
mw.hook( "wikipage.content" ).add( BOX.flip );
}; // TMPLXPAND.
|