Content deleted Content added
-1.2 |
-1.5 |
||
(2 intermediate revisions by the same user not shown) | |||
Line 1:
/// User:PerfektesChaos/js/refNames/core/d.js
///
// <ref name="..."> major work
// ResourceLoader: compatible;
Line 19:
( function ( mw, $ ) {
"use strict";
var Version = -1.
Signature = "refNames",
THIS = { lapsus: false,
Line 54:
0x2003, // emsp
0x2009, // thinsp
0x200A, // HAIRsp
0x200B, // ZEROsp
0x200C, // zwnj
0x200D, // zwj
Line 74 ⟶ 76:
},
PARSER = { reQuot: false,
pending: false,
$textarea: false },
Line 469 ⟶ 472:
PARSER.fault = function ( all, at, alert, about ) {
// Communicate error details (browser console)
// Precondition:
// all -- string, with entire story
// at -- number, position in wikitext
// alert -- string, with message
Line 477 ⟶ 481:
// Uses:
// > Signature
//
// 2022-08-25 PerfektesChaos@de.wikipedia
var i, n, s;
if ( typeof window.console === "object" &&
typeof window.console.warn === "function" ) {
i = all.indexOf( "\n", i + 1 );
} while ( i >= 0 && i < at );
s = Signature + " #" + at + " @" + n + " " + alert;
if ( about ) {
s = s + " -- " + about;
}
if ( ! PARSER.reWS ) {
PARSER.reWS = new RegExp( "\\s+" );
}
i = at;
while ( all.charCodeAt( i ) !== 0x3C && i >= 0 ) {
} // while
n = all.indexOf( ">", i + 1 );
if ( n < 0 ) {
n = i + 100;
}
s = s + "\n"
+ all.substring( i, n + 1).replace( PARSER.reWS, " " );
window.console.warn( s );
}
Line 508 ⟶ 532:
// PARSER.focus()
// flat()
// 2022-
var r = { "set": "",
"lock": false,
Line 520 ⟶ 544:
if ( k < 0 || k > after ) {
r.lock = true;
PARSER.fault(
"Unbalanced delimiter",
about + "=" + s );
} else if ( k === i + 1 ) {
r.lock = true;
PARSER.fault(
at,
"Missing identifier",
about + "=" + s + s );
Line 533 ⟶ 559:
}
} else if ( k === 0x2F || k === 0x3E ) { // / >
PARSER.fault( all, at, "Identifier missing", about + "=" );
r.lock = true;
} else {
Line 542 ⟶ 568:
if ( k === i ) {
r.lock = true;
PARSER.fault(
at,
"Missing identifier",
about + "=" );
Line 582 ⟶ 609:
// PARSER.feature()
// PARSER.first()
// 2022-08-
var i = at,
j, lock, r, s, v;
Line 606 ⟶ 633:
}
if ( typeof r[ s ] === "string" ) {
PARSER.fault( all, at, "Duplicated keyword", s );
lock = true;
} else {
Line 616 ⟶ 643:
break;
default:
PARSER.fault( all, at, "Unknown keyword", s );
lock = true;
} // switch
Line 637 ⟶ 664:
} else {
PARSER.lock = true;
PARSER.fault( all, i, "Trailing garbage" );
}
}
Line 1,129 ⟶ 1,156:
} else {
PARSER.lock = true;
PARSER.fault(
i,
"Missing </ref>" );
}
}
Line 1,785 ⟶ 1,814:
// SOURCE.fresh()
// SOURCE.focus()
//
var s = fruit( PARSER.focus( SOURCE.$input.val() ) ),
group, i, lapsus;
Line 1,799 ⟶ 1,828:
SOURCE.fresh();
group = SOURCE.grouped[ SOURCE.pre.group ];
if ( group ) {
for ( i = 0; i < group.length; i++ ) { if ( s === group[ i ].name ) {
lapsus = true;
break; // for i
}
} // for i
if ( ! lapsus ) {
SOURCE.exec = { group: SOURCE.pre.group,▼
seek: SOURCE.start,
shift: s };
SOURCE.$deny.hide();
SOURCE.$doit.show();
}
▲ } // for i
▲ if ( ! lapsus ) {
▲ SOURCE.exec = { group: SOURCE.pre.group,
▲ seek: SOURCE.start,
▲ shift: s };
▲ SOURCE.$deny.hide();
▲ SOURCE.$doit.show();
}
}
|