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

Content deleted Content added
-1.3
-1.4
Line 1:
/// User:PerfektesChaos/js/lintHint/d.js
// Show LintErrors analysis live
/// 2017-0910-2606 PerfektesChaos@de.wikipedia
// ResourceLoader: compatible;
// dependencies: user, mw.API
Line 17:
( function ( mw, $ ) {
"use strict";
var Version = -1.34,
Signature = "lintHint",
HINT = { doc: "en:User:PerfektesChaos/js/" + Signature,
errors: [ "bogus-image-options",
"deletable-table-tag",
"fostered",
"html5-misnesting",
"ignored-table-attr",
"misnested-tag",
"missing-end-tag",
"missing-start-tag",
"mixed-content",
"multi-colon-escape",
"obsolete-tag",
"pwrap-bug-workaround",
"self-closed-tag",
"stripped-tag",
"tidy-whitespace-bug" ],
idRev: 0,
last: true,
later: false,
launch: false,
launched: false,
lazy: false,
live: false,
ltr: true,
using: [ "mediawiki.api",
"mediawiki.api.messages",
"mediawiki.util" ],
$body: false,
$page: false }false,
$textarea: false },
API = { Api: false,
errors: false,
Line 59 ⟶ 60:
fgc: "000000",
fgcRun: "A0A0A0",
swift: false,
$box: false,
$collapsed: false,
Line 65 ⟶ 67:
$other: false,
$pagename: false,
$swift: false,
$tbody: false,
$table: false,
Line 71 ⟶ 74:
live: false,
$source: false },
GUIDER = { livelast: false,
live: false,
reTrim: false,
using: [ "mediawikijquery.ui.buttontextSelection",
"mediawiki.ui.button",
"mediawiki.ui.input" ],
$pagename: false },
Line 83 ⟶ 88:
 
HINT.texts = {
// 2017-0810-0706 PerfektesChaos@de.wikipedia
"desc": {"en": "Show LintErrors analysis live.",
"de": "Zeige LintErrors-Analyse live."},
Line 95 ⟶ 100:
+ " oder einen Seitennamen in das untere,"
+ " und betätige die jeweilige Schaltfläche."},
"mark": {"en": "select problem in source text",
"de": "Problem im Quelltext selektieren"},
"noPage": {"en": "Wikitext page not found",
"de": "Wikitext-Seite nicht gefunden"},
Line 217 ⟶ 224:
// > HINT.doc
// > Version
// >< PREGOHINT.feed();using
// < HINT.signature
// < HINT.nsn
Line 234 ⟶ 242:
// (features)
// (BOX.feed)
// 2017-0810-1906 PerfektesChaos@de.wikipedia
var listen, live, re, s;
HINT.signature = "ext.gadget." + Signature;
Line 290 ⟶ 298:
HINT.live = true;
}
HINT.using.push( "jquery.textSelection" );
live = true;
break;
Line 302 ⟶ 311:
}
if ( live ) {
// PREGO.app.translationfeed();
fair();
if ( HINT.live ) {
mw.loader.using( HINT.using, BOX.feed );
}
PREGO.feed();
}
HINT.pub = { doc: "[[" + HINT.doc + "]]",
Line 699 ⟶ 708:
// > BOX.$null
// > BOX.$box
// > HINT.$textarea
// > GUIDER.last
// > HINT.errors
// > HINT.nsn
// > APIPREGO.singlesignature
// >< BOX.$table
// >< API.Api
// >< BOX.$pagename
// < BOX.swift
// < BOX.$tbody
// BOX.factory()
// mw.hook()
// BOX.filler()
// mw.Api.loadMessagesIfMissing()
// GUIDER.from()
// (BOX.flag)
// (BOX.filler)
// (API.fault)
// 2017-0810-0406 PerfektesChaos@de.wikipedia
var i, req, $th, $thead, $tr;
BOX.factory( $area );
Line 723 ⟶ 737:
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 734 ⟶ 755:
BOX.$table.append( BOX.$pagename );
}
$tr = $( "<tr>" );
$th = $( "<th>" );
$th.text( "lint" );
$tr.append( $th );
Line 741 ⟶ 762:
$th.text( "+" );
$tr.append( $th );
if ( HINT.$textarea ) {
BOX.$swift = $( "<th>" );
BOX.$swift.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>" );
Line 778 ⟶ 808:
// > HINT.later
// > BOX.bgcErr
// > HINT.$textarea
// > GUIDER.last
// > BOX.swift
// > BOX.$tbody
// > BOX.$table
Line 785 ⟶ 818:
// >< BOX.$other
// mw.message()
// PREGO.app.translation()
// BOX.future()
// (BOX.find)
// (BOX.future)
// 2017-0810-0906 PerfektesChaos@de.wikipedia
var n = 0,
e, i, k, par, s, $e, $e2, $e3, $td, $tr;
Line 847 ⟶ 880:
}
$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 )
.data( "range", e.dsr )
.text( String.fromCharCode( 160, 8595, 160 ) );
if ( typeof BOX.swift === "string" ) {
$td.attr( { title: BOX.swift } );
}
$tr.append( $td );
}
BOX.$tbody.append( $tr );
n++;
Line 873 ⟶ 921:
}
}; // 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.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 1,053 ⟶ 1,137:
// < EDIT.listen
// < HINT.launch
// < HINT.$textarea
// API.feed()
// 2017-0810-0806 PerfektesChaos@de.wikipedia
if ( HINT.live ) {
if ( BOX.$box ) {
Line 1,088 ⟶ 1,173:
EDIT.listen = false;
API.fire( EDIT.$source.val() );
HINT.$textarea = EDIT.$source;
}
} else {
Line 1,102 ⟶ 1,188:
BOX.future = function ( application ) {
// Remark on uncategorized features requested
// Precondition:
// application -- PREGO object
// Uses:
// > HINT.texts.other
Line 1,201 ⟶ 1,289:
// > GUIDER.$input
// > GUIDER.reTrim
// < GUIDER.last
// < API.single
// GUIDER.fired()
// API.feed()
// 2017-0810-0406 PerfektesChaos@de.wikipedia
var s = GUIDER.$input.val();
GUIDER.fired();
GUIDER.last = true;
if ( ! GUIDER.reTrim.test( s ) ) {
API.single = s;
Line 1,256 ⟶ 1,346:
// > GUIDER.$textarea
// > GUIDER.reTrim
// < GUIDER.last
// < API.single
// < HINT.launched
// GUIDER.fired()
// API.fire()
// 2017-0810-0506 PerfektesChaos@de.wikipedia
var s = GUIDER.$textarea.val();
GUIDER.fired();
GUIDER.last = false;
if ( ! GUIDER.reTrim.test( s ) ) {
API.single = false;
Line 1,461 ⟶ 1,553:
// < GUIDER.$formPage
// < GUIDER.$input
// < HINT.$textarea
// face()
// PREGO.foreign()
// mw.loader.using()
// (GUIDER.foreign)
// 2017-0810-1906 PerfektesChaos@de.wikipedia
var $v = $( "head" ),
$e = $v.find( "title" );
Line 1,525 ⟶ 1,618:
.hide();
HINT.$page.prepend( GUIDER.$pagename );
HINT.$textarea = GUIDER.$textarea;
mw.loader.using( HINT.using,
GUIDER.foreign );