Content deleted Content added
-3.0 |
-3.1 |
||
Line 1:
/// User:PerfektesChaos/js/lintHint/d.js
// Show LintErrors analysis live
/// 2018-05-
// ResourceLoader: compatible;
// dependencies: user, mw.API, mediawiki.storage, mediawiki.util
/// Fingerprint: #0#0#
/// @license GPL [//www.mediawiki.org/w/COPYING] (+GFDL, LGPL, CC-BY-SA)
Line 17:
( function ( mw, $ ) {
"use strict";
var Version = -3.
Signature = "lintHint",
HINT = { cmodels: { "wikitext": true,
Line 55:
using: [ "mediawiki.api",
"mediawiki.api.messages",
"mediawiki.storage",
"mediawiki.util" ],
$body: false,
Line 85 ⟶ 86:
EDIT = { listen: false,
live: false,
source: false,
$source: false },
GUIDER = { last: false,
Line 96 ⟶ 98:
PREGO = { app: false,
live: false,
maxage: 604813,
pars: [ [ "last", "boolean" ],
[ "later", "boolean" ],
Line 107 ⟶ 110:
sub: "/r.js" },
REPOS = { },
TEACH = { }
WIKITEXT = { live: false };
Line 223 ⟶ 227:
// Uses:
// >< HINT.using
// mw.config.get()
// mw.loader.using()
// 2017-08-07 PerfektesChaos@de.wikipedia
Line 332 ⟶ 337:
// < HINT.last
// < HINT.live
// < HINT.launch
// < EDIT.live
// < HINT.pub
Line 337 ⟶ 343:
// mw.loader.state()
// mw.config.get()
// GUIDER.first()
// PREGO.fire()
// fair()
// mw.hook()
// (WIKITEXT.first)
// (LINTER.first)
// (features)
// 2018-05-
var i, listen, live, re, s;
HINT.signature = "ext.gadget." + Signature;
Line 362 ⟶ 368:
switch ( s.substr( i + 1 ) ) {
case Signature:
GUIDER.first();
listen = true;
Line 372 ⟶ 377:
} // switch subPage
}
break;
case "ExpandTemplates":
PREGO.fire();
fair( WIKITEXT.first );
break;
case "LintErrors":
Line 407 ⟶ 416:
HINT.live = false;
}
} else if ( s.indexOf( "&lintid=" ) > 0 ) {
HINT.launch = true;
}
}
Line 441 ⟶ 452:
if ( live ) {
fair();
PREGO.fire();
}
Line 789 ⟶ 799:
// > HINT.launched
// > EDIT.live
// TEACH.fetch()
// API.full()
// mw.hook()
// (BOX.flip)
// 2018-05-
TEACH.fetch();
if ( HINT.launch && ! HINT.launched && ! EDIT.live ) {
API.full();
Line 926 ⟶ 938:
// (BOX.find)
// (BOX.future)
// 2018-
var n = 0,
e, i, k, par, s, $e, $e2, $e3, $td, $tr;
Line 998 ⟶ 1,010:
$td = $( "<td>" );
$td.click( BOX.find )
.css( { "background-color": "#FFFFFF" } )
.data( "range", e.dsr )
.data( "sort-value", i )
Line 1,243 ⟶ 1,256:
// > HINT.source
// > HINT.$page
// > WIKITEXT.live
// >< API.errors
// >< API.single
// >< EDIT.live
// >< EDIT.source
// >< EDIT.$source
// < EDIT.listen
Line 1,251 ⟶ 1,266:
// < HINT.$textarea
// API.full()
// 2018-05-
if ( HINT.live ) {
if ( BOX.$box ) {
Line 1,277 ⟶ 1,291:
if ( EDIT.live ) {
if ( ! EDIT.$source ) {
case "
EDIT.$source = HINT.$page.find( EDIT.source );
if ( ! ( EDIT.$source.length || WIKITEXT.live ) ) {
BOX.$collapsed.hide();
EDIT.live = false;
Line 1,293 ⟶ 1,309:
}
}
if ( EDIT.live && EDIT.$source && EDIT.$source.length ) {
EDIT.listen = false;
API.fire( EDIT.$source.val() );
Line 1,661 ⟶ 1,677:
// Uses:
// >< API.Api
// TEACH.fetch()
// mw.Api.loadMessagesIfMissing()
// (GUIDER.form)
// (API.fault)
//
var req = [ "general-form-reset",
"go" ],
Line 1,671 ⟶ 1,688:
API.Api = new mw.Api();
}
TEACH.fetch();
for ( i = 0; i < HINT.errors.length; i++ ) {
req.push( "linter-category-" + HINT.errors[ i ] );
Line 1,948 ⟶ 1,966:
// > PREGO.store
// > PREGO.sub
// > PREGO.maxage
// mw.loader.getState()
// REPOS.fire()
// 2018-05-
var s = "ext.gadget." + PREGO.signature;
if ( mw.loader.getState( s ) !== "ready" ) {
Line 1,959 ⟶ 1,978:
ctype: "text/javascript",
bcache: 1,
maxage:
}
}; // PREGO.feed()
Line 2,023 ⟶ 2,042:
PREGO.fire = function () {
// User options
// Uses:
// > PREGO.signature
Line 2,181 ⟶ 2,200:
// >< TEACH.o
// TEACH.flush()
// 2018-
if ( typeof TEACH.o !== "object" ) {
TEACH.o =
}
if ( typeof TEACH.o.unknown !== "object" ) {
TEACH.o.unknown = [ ];
}
if ( $.inArray( apply, HINT.errors ) < 0 ) {
HINT.errors.push( apply );
TEACH.o.unknown.push( apply );
}
TEACH.flush();
}; // TEACH.feed()
Line 2,193 ⟶ 2,218:
TEACH.fetch = function () {
// Consider memorized categories
// Precondition:
// mediawiki.storage available
// Uses:
// > Signature
Line 2,198 ⟶ 2,225:
// < TEACH.o
// TEACH.flush()
// 2018-
var
i, k, parsed, s, unknown;
if ( typeof storage === "string" ) {
try {
if ( typeof
if ( typeof parsed.translations
TEACH.o = {
}
if ( typeof parsed. typeof
&&
for ( i = 0;
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 );
}
}
} //
if ( unknown.length )
if ( typeof
} else {
TEACH.o = { unknown: unknown };
}
}
if ( unknown.length !== parsed.unknown.length ) {
TEACH.flush();
}
}
}
} catch (e) {
}
if ( typeof TEACH.o !== "object" ) {
TEACH.flush();
}
}
Line 2,248 ⟶ 2,279:
TEACH.flush = function () {
// Update unknown categories memory
// Precondition:
// mediawiki.storage available
// Uses:
// > Signature
// > TEACH.o
// 2018-
var
if ( typeof
if ( storage ) {
mw.storage.set( Signature, storage );
}
}
}; // TEACH.flush()
WIKITEXT.first = function () {
// Initialize ExpandTemplates
// Uses:
// > HINT.using
// < WIKITEXT.live
// < HINT.live
// < EDIT.live
// < EDIT.source
// (WIKITEXT.further)
// 2018-05-20 PerfektesChaos@de.wikipedia
WIKITEXT.live = true;
HINT.live = true;
EDIT.live = true;
EDIT.source = "#output";
mw.loader.using( HINT.using, WIKITEXT.further );
}; // WIKITEXT.first()
WIKITEXT.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 );
}; // WIKITEXT.first()
|