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

Content deleted Content added
2.12
2.15
Line 1:
/// User:PerfektesChaos/js/lintHint/r.js
/// 20172018-1202-08 PerfektesChaos@de.wikipedia
/// Fingerprint:#0#31531E0A2BABF1EA#
/// @license GPL [//www.mediawiki.org/w/COPYING](+GFDL,LGPL,CC-BY-SA)
///<nowiki>
(function(mw,$){
"use strict";
var Version=2.15,Signature="lintHint",HINT={cmodels:{"wikitext":true,
var Version=2.12,Signature="lintHint",HINT={doc:"en:User:PerfektesChaos/js/"+Signature,errors:["bogus-image-options","deletable-table-tag","fostered","html5-misnesting","ignored-table-attr","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","obsolete-tag","pwrap-bug-workaround","self-closed-tag","stripped-tag","tidy-font-bug","tidy-whitespace-bug","unclosed-quotes-in-heading"],idRev:0,last:true,later:false,launch:false,launched:false,layer:false,lazy:false,live:false,ltr:true,using:["mediawiki.api","mediawiki.api.messages","mediawiki.util"],$body:false,$page:false,$textarea:false},API={Api:false,errors:false,scream:false,service:"transform/wikitext/to/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},EDIT={listen:false,live:false,$source:false},GUIDER={last:false,live:false,reTrim:false,using:["jquery.textSelection","mediawiki.ui.button","mediawiki.ui.input"],$pagename:false},LINTER={},PREGO={app:false,signature:"preferencesGadgetOptions"};
"proofread-index":true,"proofread-page":true},doc:"en:User:PerfektesChaos/js/"+Signature,errors:["bogus-image-options","deletable-table-tag","fostered","html5-misnesting","ignored-table-attr","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","obsolete-tag","pwrap-bug-workaround","self-closed-tag","stripped-tag","tidy-font-bug","tidy-whitespace-bug","unclosed-quotes-in-heading"],idRev:0,last:true,later:false,launch:false,launched:false,layer:false,lazy:false,live:false,ltr:true,source:false,
var Version=2.12,Signature="lintHint",HINT={doc:"en:User:PerfektesChaos/js/"+Signature,errors:["bogus-image-options","deletable-table-tag","fostered","html5-misnesting","ignored-table-attr","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","obsolete-tag","pwrap-bug-workaround","self-closed-tag","stripped-tag","tidy-font-bug","tidy-whitespace-bug","unclosed-quotes-in-heading"],idRev:0,last:true,later:false,launch:false,launched:false,layer:false,lazy:false,live:false,ltr:true,using:["mediawiki.api","mediawiki.api.messages","mediawiki.util"],$body:false,$page:false,$textarea:false},API={Api:false,errors:false,scream:false,service:"transform/wikitext/to/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},EDIT={listen:false,live:false,$source:false},GUIDER={last:false,live:false,reTrim:false,using:["jquery.textSelection","mediawiki.ui.button","mediawiki.ui.input"],$pagename:false},LINTER={},PREGO={app:false,signature:"preferencesGadgetOptions"},TEACH={};
HINT.texts={
"desc":{"en":"Show LintErrors analysis live.","de":"Zeige LintErrors-Analyse live."},
Line 75 ⟶ 77:
s=mw.config.get("wgTitle");
if(s.indexOf("/"+Signature)>0){
TEACH.fetch();
GUIDER.first();}
listen=true;
Line 82 ⟶ 85:
break;}
break;
case 0102:
case 104:
HINT.live=true;
case 106:
case 108:
case 110:
case 112:
s=mw.config.get("wgPageContentModel");
if(typeof HINT.cmodels[s]==="boolean"){
HINT.livesource=trues;}
default:
HINT.idRev=mw.config.get("wgRevisionId");
Line 106 ⟶ 116:
EDIT.live=true;
HINT.nsn=mw.config.get("wgNamespaceNumber");
if(HINT.nsn===0){
HINT.live=true;}
HINT.using.push("jquery.textSelection");
live=true;
if(HINT.nsn>=100){
s=mw.config.get("wgPageContentModel");
if(s==="proofread-page"){
HINT.source=s;}}
break;}
if(live){
if(!HINT.source){
s=mw.config.get("wgPageContentModel");
HINT.source=mw.config.get("wgPageContentModel");
live=(sHINT.source==="wikitext");}
listen=live;}
if(listen){
if(HINT.nsn===0){
HINT.live=true;}
mw.hook(Signature+".config").add(features);}
if(live){
PREGO.feed();
fair();
TEACH.fetch();
if(HINT.live){
mw.loader.using(HINT.using,BOX.feed);}}
Line 181 ⟶ 197:
if(q&&q.revisions){
q=q.revisions[0];
if(typeof q.contentmodel!=="string"||typeof HINT.cmodels[q.contentmodel]==="wikitextboolean"){
s=q["*"];
if(/\{\{/.test(s)){
Line 346 ⟶ 362:
if(mw.messages.exists(s)){
s=mw.message(s).text();
}else if(HINT.later){
TEACH.feed(e.type);
if(HINT.later){
s=e.type;
}else{
s=false;}}
if(s){
$tr=$("<tr>");
Line 483 ⟶ 501:
};
BOX.full=function(){
var source;
if(HINT.live){
if(BOX.$box){
Line 499 ⟶ 518:
if(EDIT.live){
if(!EDIT.$source){
switch(HINT.source){
EDIT.$source=HINT.$page.find("#wpTextbox1");
case "wikitext":
case "proofread-page":
source="#wpTextbox1";
break;}
if(source){
EDIT.$source=HINT.$page.find("#wpTextbox1"source);
if(!EDIT.$source.length){
BOX.$collapsed.hide();
EDIT.live=false;}
}else{
EDIT.live=false;}}
if(EDIT.live){
Line 702 ⟶ 729:
if(mw.loader.getState(s)!=="ready"){
mw.loader.load("https://en.wikipedia.org/w/index.php?title=User:PerfektesChaos/js/"+PREGO.signature+"/r.js&bcache=1&maxage=604812&action=raw&ctype=text/javascript");}
};
TEACH.feed=function(apply){
if(typeof TEACH.o!=="object"){
TEACH.o=[];}
TEACH.o.push(apply);
TEACH.flush();
};
TEACH.fetch=function(){
var got,i,k,leave,parsed,s,webLs;
if(typeof window.localStorage==="object"){
webLs=window.localStorage;
if(webLs&&typeof webLs.getItem==="function"){
try{
got=webLs.getItem(Signature);
if(got){
parsed=JSON.parse(got);
if(typeof parsed==="object"&&parsed&&typeof parsed.length==="number"&&parsed.length){
TEACH.o=parsed;
for(i=0;i<TEACH.o.length;i++){
s=TEACH.o[i];
if(typeof s==="string"&&s){
k=$.inArray(s,HINT.errors);
if(k<0){
HINT.errors.push(s);
}else{
s=false;}
}else{
s=false;}
if(!s){
TEACH.o.splice(i,1);
leave=true;}}}}
if(typeof TEACH.o!=="object"){
TEACH.o=[];}
if(got&&(leave||!TEACH.o.length)){
TEACH.flush();}
}catch(e){
}}}
};
TEACH.flush=function(){
var webLs;
if(typeof window.localStorage==="object"){
webLs=window.localStorage;
if(webLs&&typeof webLs.removeItem==="function"&&typeof webLs.setItem==="function"){
try{
if(TEACH.o.length){
webLs.setItem(Signature,JSON.stringify(TEACH.o));
}else{
webLs.removeItem(Signature);}
}catch(e){
}}}
};
first();