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

Content deleted Content added
5.3
5.8
 
(4 intermediate revisions by the same user not shown)
Line 1:
/// User:PerfektesChaos/js/lintHint/r.js
/// 20222024-0407-2604 PerfektesChaos@de.wikipedia
/// Fingerprint:#0#6AFD3BFD11AC22BC#
/// License:CC-by-sa/4.0
///<nowiki>
(function(mw,$){
"use strict";
var Version=5.38,Signature="lintHint",HINT={cmodels:{"wikitext":true,
"proofread-index":true,
"proofread-page":true},doc:"en:User:PerfektesChaos/js/"+Signature,drop:false,errors:["bogus-image-options","deletable-table-tag","fostered","html5-misnesting","ignored-table-attr","inline-media-caption","large-tables","misc-tidy-replacement-issues","misnested-tag","missing-end-tag","missing-start-tag","mixed-content","multi-colon-escape","multiline-html-table-in-list","multiple-unclosed-formatting-tags","night-mode-unaware-background-color","obsolete-tag","pwrap-bug-workaround","self-closed-tag","stripped-tag","tidy-font-bug","tidy-whitespace-bug","unclosed-quotes-in-heading","wikilink-in-extlink"],idRev:0,indicators:".mw-indicators",last:true,later:false,launch:false,launched:false,layer:null,lazy:false,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","mediawiki.util","user.options"],$body:false,$content:false,$main:false,$textarea:false,$widget:false},API={Api:false,errors:false,scream:false,server:"api/rest_v1/",scanner:"transform/wikitext/to/lint",swift:"page/lint"},BOX={bgc:"FFFF00",bgcErr:"FFE4E1",bgcOk:"ADFF2F",bgcRun:"C0C0C0",boc:"808080",fgc:"000000",fgcRun:"A0A0A0",swift:false,$box:false,$collapsed:false,$failure:false,$null:false,$other:false,$pagename:false,$swift:false,$tbody:false,$table:false,$top:false},CODMIRROR={cm:false},EDIT={layer:false,listen:false,live:false,selTextbox:"div[role='textbox']",selVEsrc:".ve-init-mw-desktopArticleTarget-uneditableContent",source:false,sourceVE:"&veaction=editsource",$source:false},GUIDER={last:false,live:false,reTrim:false,suitable:String.fromCharCode(0x2714),using:["jquery.textSelection","mediawiki.ui.button","mediawiki.ui.input"],$pagename:false},INFO={},LINTER={live:false},PREGO={app:false,live:false,maxage:604813,pars:[["last","boolean"],["later","boolean"],["launch","boolean"],["lazy","boolean"],["silent","string"],["spaces","string"]],signature:"preferencesGadgetOptions",site:"w:en",store:"User:PerfektesChaos/js/",sub:"/r.js"},REPOS={},TMPLXPAND={live:false},UPDATE={},WIKED={};
HINT.texts={
"desc":{"en":"Show LintErrors analysis live.",
Line 41 ⟶ 42:
"^^spaces":{"en":"Space separated list of namespace numbers, for automatized analysis or - for none or * for all",
"de":"Namensraum-Nummern für automatische Analyse, durch Leerzeichen getrennt, oder - für keine oder * für alle",
"it":"Lista di namespace, in formato numerico separati da spazi, 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"}
};
function face(){
Line 54 ⟶ 57:
HINT.using.push("jquery.tablesorter");}}}
function features(apply){
var i,live,s;
if(typeof apply==="object"&&apply){
if(typeof apply.rooms==="object"&&apply.rooms&&typeof apply.rooms.length==="number"){
Line 86 ⟶ 89:
mw.loader.using(HINT.using,BOX.feed);}
}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);}}}
if(HINT.drop.length>0){
HINT.silent=HINT.drop.join(" ");
}else{
HINT.silent="-";}}}}
function first(){
var i,later,listen,live,re,rls,s;
Line 221 ⟶ 236:
};
API.fine=function(arrived){
var starte,i,s;
API.scream=false;
API.errors=arrivedfalse;
if(typeof arrived==="object"&&arrived&&typeof arrived.length==="number"&&arrived.length){
if(HINT.quiet){
API.errors=arrived;
for(i=0;i<arrived.length;i++){
start="fill";
e=arrived[i];
if($.inArray(e.type,HINT.quiet)<0){
API.errors=API.errors||[];
API.errors.push(e);}}
}else{
API.errors=falsearrived;}}
starts=(API.errors?"fill":"flat");}
mw.hook("wikipage.content").add(BOX[starts]);
API.scream=false;
mw.hook("wikipage.content").add(BOX[start]);
};
API.fire=function(ask){
Line 473 ⟶ 493:
BOX.$table.show();
if(loc){
mw.hook(PREGO.signatureSignature+".table-range").addfire(BOX.$table);}
}else{
BOX.$table.hide();
Line 986 ⟶ 1,006:
HINT.spaces=HINT.spaces.trim();}
if(PREGO.live){
if(!HINT.drop){
HINT.silent="*";}
PREGO.form();
}else if(LINTER.live){
Line 1,004 ⟶ 1,026:
HINT.live=true;}
if(HINT.live&&HINT.nsn>=0){
switch(HINT.silent){
case false:
case "*":
break;
case "-":
HINT.quiet=false;
break;
default:
HINT.quiet=HINT.silent.split(" ");}
mw.loader.using(HINT.using,BOX.feed);}}
};
Line 1,014 ⟶ 1,045:
REPOS.fire(PREGO.site,PREGO.store+PREGO.signature+PREGO.sub,false,{action:"raw",ctype:"text/javascript",bcache:1,maxage:PREGO.maxage});}
};
PREGO.fiatfiat1=function(){
var s=PREGO.$spaces.val(),i,k,got,rooms;
if(s.indexOf("-")>=0){
Line 1,041 ⟶ 1,072:
PREGO.$spaces.val(s);
};
PREGO.fieldfiat2=function($applying){
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;}}
if(quiet.length>0){
s=quiet.join(" ");
}else{
s="-";}
}else{
s="*";}}
PREGO.$silent.val(s);
};
PREGO.field1=function($applying){
PREGO.$spaces=$applying;
PREGO.$spaces.change(PREGO.fiatfiat1);
};
PREGO.field2=function($applying){
PREGO.$silent=$applying;
PREGO.$silent.change(PREGO.fiat2);
};
PREGO.fire=function(){
Line 1,053 ⟶ 1,113:
"de":"//de"+support},
dialog,opts;
opts=[{signature:"spaces",type:"text",show:HINT.texts["^^spaces"],val:(HINT.spaces?HINT.spaces:""),field:PREGO.fieldfield1},{signature:"launch",type:"checkbox",show:HINT.texts["^^launch"],val:HINT.launch},{signature:"last",type:"checkbox",show:HINT.texts["^^last"],val:HINT.last},{signature:"lazy",type:"checkbox",show:HINT.texts["^^lazy"],val:HINT.lazy},{signature:"silent",type:"text",show:HINT.texts["^^silent"],val:(HINT.silent?HINT.silent:"*"),field:PREGO.field2}];
dialog={script:Signature,support:docs,suffix:HINT.texts["^suffix"],opts:opts};
mw.hook(PREGO.signature+".form").fire(dialog);