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

Content deleted Content added
-4.3
-4.4
Line 1:
/// User:PerfektesChaos/js/lintHint/d.js
/// 20202021-0905-2025 PerfektesChaos@de.wikipedia
// Show LintErrors analysis live
// ResourceLoader: compatible;
Line 17:
( function ( mw, $ ) {
"use strict";
var Version = -4.34,
Signature = "lintHint",
HINT = { cmodels: { "wikitext": true,
Line 45:
"wikilink-in-extlink" ],
idRev: 0,
indicators:".mw-indicators",
last: true,
later: false,
Line 59 ⟶ 60:
"user.options" ],
$body: false,
$indicator:false,
$page: false,
$textarea: false },
Line 436 ⟶ 438:
case "edit":
case "submit":
// case "parsermigration-edit":
EDIT.live = true;
HINT.nsn = mw.config.get( "wgNamespaceNumber" );
Line 500 ⟶ 502:
API.scream = textStatus;
break;
} // switch typeof textStatus
}
if ( errorThrown ) {
Line 598 ⟶ 600:
// Initialize API
// Uses:
// >< API.Api
// >< API.site
// 2017-08-01 PerfektesChaos@de.wikipedia
Line 711 ⟶ 714:
// (BOX.flip)
// (BOX.facet)
// 20202021-0901-2001 PerfektesChaos@de.wikipedia
var $a, $e;
if ( HINT.live ) {
Line 737 ⟶ 740:
.css( { "float": ( HINT.ltr ? "left": "right" ) } );
BOX.$box.append( $e )
.attraddClass( {Signature id: Signature+ }"-box" )
.attr( { id: Signature,
role: "alert" } )
.css( { "background-color": "#" + BOX.bgc,
"border-color": "#" + BOX.boc,
Line 744 ⟶ 749:
"color": "#" + BOX.fgc,
"margin-bottom": "1em",
"opacity": "1 !important",
"padding": "0.5em",
"pointer-events": "all" } );
Line 750 ⟶ 755:
$e.click( BOX.flip )
.css( { "color": "#FF0000",
"cursor": "pointer",
"display": "block",
"float": ( HINT.ltr ? "right": "left" ),
Line 835 ⟶ 841:
// mediawiki.api.messages available
// Uses:
// > BOX.$indicator
// > BOX.$collapsed
// > BOX.$null
Line 856 ⟶ 863:
// (BOX.filler)
// (API.fault)
// 20172021-1005-1025 PerfektesChaos@de.wikipedia
var i, req, $th, $thead, $tr;
BOX.factory( $area );
if ( BOXHINT.$collapsedindicator ) {
} else BOX.$collapsed.hide();{
if ( BOX.$collapsed ) {
}
if ( BOX.$null collapsed.hide() {;
BOX.$null.hide();}
if ( BOX.$null ) {
BOX.$null.hide();
}
}
if ( BOX.$box ) {
Line 904 ⟶ 914:
$thead.append( $tr );
BOX.$tbody = $( "<tbody>" );
BOX.$table.addClass( "wikitable" )"
+ Signature + "-table" )
.attr( { id: Signature + "-table" } )
.append( $thead, BOX.$tbody )
Line 1,113 ⟶ 1,124:
// > BOX.$collapsed
// > EDIT.live
// > BOX.$null
// > API.errors
// > API.scream
Line 1,132 ⟶ 1,142:
// GUIDER.from()
// BOX.focus()
// 20172021-0805-0825 PerfektesChaos@de.wikipedia
if ( $area && ! HINT.$page ) {
HINT.$page = $area;
Line 1,156 ⟶ 1,166:
BOX.$null.hide();
} else {
BOX.$null.showattr( { title: "+" } );
.show();
}
} else if ( ! HINT.lazy &&
Line 1,163 ⟶ 1,174:
face();
BOX.$null = $( "<div>" );
BOX.$null.attraddClass( { id: Signature + "-null" } )
.attr( { id: Signature + "-null" } )
.css( { "background-color": "#" + BOX.bgcOk,
"clear": "both",
"color": "#" + BOX.fgc,
"float": ( HINT.ltr ? "right": "left" ),
: "left" ),
"font-size": "smaller",
"padding": "3px" } )
Line 1,175 ⟶ 1,188:
+ Version } );
}
BOX.focus( BOX.$null, true );
}
} else if ( BOX.$null ) {
Line 1,189 ⟶ 1,202:
// $area -- mw-content-text, or nil
// Uses:
// > GUIDER.live
// > Version
// > Signature
// > HINT.ltr
// > GUIDER.live
// > BOX.bgc
// > BOX.fgc
// > Version
// > EDIT.live
// > API.errors
Line 1,205 ⟶ 1,218:
// EDIT.fine()
// (BOX.full)
// 20202021-0905-2025 PerfektesChaos@de.wikipedia
if ( $area && ! HINT.$page ) {
HINT.$page = $area;
Line 1,211 ⟶ 1,224:
face();
BOX.flat( $area, true );
if ( BOX! GUIDER.$collapsedlive ) {
if ( BOX.$collapsed.attr( ) { disabled: false } )
BOX.$collapsed.attr( { disabled: .show();false,
title: Version } )
} else {
BOX.$collapsed = $( "<button>" .show();
} else {
BOX.$collapsed.attr( { id: Signature + "-collapsed" } )
BOX.$collapsed = .click$( BOX.full"<div>" );
BOX.$collapsed.cssaddClass( {Signature /*+ "clear-collapsed": ( HINT.ltr ? "right":)
.attr( { id: Signature + "left-collapsed" ),
role: "button",
*/ title: Version } )
.click( BOX.full "display": "block",)
.css( { /* "floatclear": ( HINT.ltr ? "right":
? "leftright" ),:
"margin-bottom": "3pxleft" ), */
"paddingcursor": "2pxpointer",
"pointer-eventsfloat": "all" } ) ( HINT.ltr
.text( Signature ); ? "right"
: "left" ),
if ( ! GUIDER.live ) {
BOX.$collapsed.attr( { title "padding": Version } ); "2px",
"pointer-events": "all" } )
.text( Signature );
BOX.focus( BOX.$collapsed, true, true );
}
BOX.focus$collapsed.css( { "background-color": "#" + BOX.$collapsed );bgc,
"color": "#" + BOX.fgc,
"opacity": "1 !important" } );
}
BOX.$collapsed.css( { "background-color": "#" + BOX.bgc,
"color": "#" + BOX.fgc,
"opacity": "1" } );
if ( EDIT.live && ! API.errors ) {
EDIT.fine();
Line 1,246 ⟶ 1,262:
 
 
BOX.focus = function ( $apply, another, around ) {
// Insertion in page top region
// Precondition:
// $apply -- jQuery object
// another -- try to add to indicators region
// around -- button style in page
// Uses:
// > HINT.indicators
// > Signature
// > HINT.$page
// >< HINT.$indicator
// >< BOX.$top
// 20202021-0905-1925 PerfektesChaos@de.wikipedia
var learn, =light, (s, ! BOX.$top ),e;
$e;
if ( learn ) {
BOX.$top = $( "<div>" );
BOX.$top.addClass( "noprint" )
.attr( { id: Signature + "-top" } )
.css( { "clear": "both",
"width": "100%" } );
$e = $( "<div>" );
$e.css( { "clear": "both" } );
HINT.$page.before( BOX.$top, $e );
}
$apply.addClass( "noprint" );
BOX.$top.prependif ( $applyanother ); {
if ( HINT.$indicator === false ) {
HINT.$indicator = $( HINT.indicators );
switch ( HINT.$indicator.length ) {
case 0:
HINT.$indicator = null;
break;
case 1:
break;
default:
HINT.$indicator = HINT.$indicator.eq( 0 );
} // switch HINT.$indicator.length
learn = true;
}
if ( HINT.$indicator ) {
$apply.css( { "display": "inline-block",
"line-height": "1.2em",
"margin-left": "3px",
"margin-right": "3px",
"padding": "1px" } );
HINT.$indicator.append( $apply );
light = true;
}
}
if ( ! light ) {
if ( ! BOX.$top ) {
BOX.$top = $( "<div>" );
BOX.$top.addClass( "noprint "
+ Signature + "-top" )
.attr( { id: Signature + "-top" } )
.css( { "clear": "both",
"width": "100%" } );
$e = $( "<div>" );
$e.css( { "clear": "both" } );
HINT.$page.before( BOX.$top, $e );
learn = true;
}
if ( around ) {
s = "#E0E0E0 #E0E0E0 #707070 #707070";
} else {
s = "transparent";
}
$apply.css( { "border-color": s,
"border-style": "solid",
"border-width": "2px",
"margin-bottom": "3px" } );
BOX.$top.prepend( $apply );
}
if ( learn &&
window.document.___location.hash ) {
Line 1,309 ⟶ 1,365:
}
if ( ! API.errors ) {
BOX.$collapsed.attr( { disabled: true } ),
title: "..." } )
.css( { "background-color": "#" + BOX.bgcRun,
"color": "#" + BOX.fgcRun,
"opacity": "1 !important" }
);
}
Line 1,347 ⟶ 1,404:
// < BOX.$other
// PREGO.app.translation()
// 20172021-0801-0801 PerfektesChaos@de.wikipedia
var $e;
if ( application ) {
Line 1,360 ⟶ 1,417:
.html( PREGO.app.translation( HINT.texts.other ) );
BOX.$other = $( "<div>" );
BOX.$other.attraddClass( { id: Signature + "-future" } )
.attr( { id: Signature + "-future" } )
.css( { "clear": "both",
"padding-bottom": "1em",
Line 1,469 ⟶ 1,527:
// < EDIT.listen
// (EDIT.focus)
// 20202021-0905-2025 PerfektesChaos@de.wikipedia
if ( EDIT.$source ) {
EDIT.listen = true;
EDIT.$source.focusin( EDIT.focus );
BOX.$collapsed.cssattr( { "background-color"title: "#+" +} BOX.bgcOk,)
.css( { "opacitybackground-color": "1#" }+ );BOX.bgcOk,
"opacity": "1 !important" } );
}
}; // EDIT.fine()
Line 1,519 ⟶ 1,578:
if ( EDIT.listen ) {
BOX.$collapsed.css( { "background-color": "#" + BOX.bgc,
"opacity": "1 !important" } );
EDIT.listen = false;
}
Line 1,948 ⟶ 2,007:
// (GUIDER.foreign)
// (GUIDER.facet)
// 20202021-0901-2001 PerfektesChaos@de.wikipedia
var $v = $( "head" ),
$e = $v.find( "title" );
Line 2,020 ⟶ 2,079:
HINT.$page.append( GUIDER.$formText, GUIDER.$formPage );
GUIDER.$pagename = $( "<div>" );
GUIDER.$pagename.attraddClass( { id: Signature + "-pagename" } )
.attr( { id: Signature + "-pagename" } )
.css( { "background-color": "#" + BOX.bgcOk,
"float": ( HINT.ltr ? "left"
: "right" ),
"margin-bottom": "1em",
"opacity": "1 !important",
"padding": "4px",
"pointer-events": "all" } )