Benutzer:TenWhile6/XReport.js
Erscheinungsbild
Hinweis: Leere nach dem Veröffentlichen den Browser-Cache, um die Änderungen sehen zu können.
- Firefox/Safari: Umschalttaste drücken und gleichzeitig Aktualisieren anklicken oder entweder Strg+F5 oder Strg+R (⌘+R auf dem Mac) drücken
- Google Chrome: Umschalttaste+Strg+R (⌘+Umschalttaste+R auf dem Mac) drücken
- Edge: Strg+F5 drücken oder Strg drücken und gleichzeitig Aktualisieren anklicken
//<nowiki>
DB = mw.config.get('wgDBname');
Xv = 'v2.3e';
Xn = 'XReport';
XReport = `${Xn} ${Xv}`;
XLink = '[[:m:Special:MyLanguage/User:TenWhile6/XReport|XReport]]';
XLinkS = `<small>${XLink}</small>`;
XLinkK = `(${XLink} ${Xv})`;
sig = ' --~~~~';
pSummary = 'Reporting: Page [[$1]] '+XLinkK;
uSummary = 'Reporting [[Special:Contributions/$1|$1]] '+XLinkK;
dSummary = 'Requesting deletion ' + XLinkK;
deleteReasons = ['Vandalism', 'Test page', 'No useful content', 'Out of project scope', 'Author\'s request', 'Empty page', 'Wrong language', 'Broken redirect', 'Orphaned talk page', 'Nonsense', 'Spam'];
if (['commonswiki', 'sourceswiki', 'specieswiki', 'wikidatawiki', 'wikifunctionswiki', 'mediawikiwiki'].includes(DB)) {
deleteReasons = ['Vandalism', 'Test page', 'No useful content', 'Out of project scope', 'Author\'s request', 'Empty page', 'Wrong language', 'Not a translation', 'Broken redirect', 'Orphaned talk page', 'Nonsense', 'Spam'];
}
blocation = mw.config.get('wgMFMode') == 'stable' ? 'p-tb' : 'p-cactions';
api = new mw.Api();
today = new Date();
monateFr = {
0: 'janvier',
1: 'février',
2: 'mars',
3: 'avril',
4: 'mai',
5: 'juin',
6: 'juillet',
7: 'août',
8: 'septembre',
9: 'octobre',
10: 'novembre',
11: 'décembre',
};
curPageName = mw.config.get('wgPageName').replace(/_/g, ' ');
RelevantPageName = mw.config.get('wgRelevantPageName') != null ? mw.config.get('wgRelevantPageName').replace(/_/g, ' ') : '';
RelevantUserName = mw.config.get('wgRelevantUserName') != null ? mw.config.get('wgRelevantUserName') : '';
Server = mw.config.get('wgServer').replace(/^(https?)?:?\/\//, '').split('.');
iwPrefix = null;
iwPrefix = Server[1] == 'wikimedia' ? Server[0] : iwPrefix;
iwPrefix = Server[1] == 'mediawiki' ? 'mw' : iwPrefix;
iwPrefix = Server[1] == 'wiktionary' ? 'wikt:' + Server[0] : iwPrefix;
iwPrefix = Server[1] == 'wikiquote' ? 'q:' + Server[0] : iwPrefix;
iwPrefix = Server[1] == 'wikinews' ? 'n:' + Server[0] : iwPrefix;
iwPrefix = Server[1] == 'wikibooks' ? 'b:' + Server[0]: iwPrefix;
iwPrefix = Server[1] == 'wikisource' ? 's:' + Server[0]: iwPrefix;
iwPrefix = Server[1] == 'wikiversity' ? 'v:' + Server[0] : iwPrefix;
iwPrefix = Server[1] == 'wikivoyage' ? 'voy:' + Server[0] : iwPrefix;
iwPrefix = Server[1] == 'wikifunctions' ? 'f:' : iwPrefix;
if (Server[1] == 'wikidata') {
iwPrefix = Server[0] == 'test' ? 'testwikidata' : iwPrefix;
iwPrefix = Server[0] == 'www' ? 'd' : iwPrefix;
} else if (Server[1] == 'wikipedia') {
iwPrefix = ['test', 'test2'].includes(Server[0]) ? Server[0] + 'wiki' : iwPrefix;
iwPrefix = iwPrefix == null ? 'w:' + Server[0] : iwPrefix;
}
function sendError(message) {
mw.notify(message,{'type':'error','title':XReport,autoHide: false});
}
metaapi = mw.config.get('wgDBname') == 'metawiki' ? api : new mw.ForeignApi('https://meta.wikimedia.org/w/api.php');
metaapi.get({
action: 'query',
prop: 'revisions',
titles: 'User:TenWhile6/XReport/languageData.json',
rvlimit: '1',
rvprop: 'content',
rvslots: 'main',
formatversion: '2',
format: 'json'
}).done( function(Ldata) {
LangData = JSON.parse(Ldata.query.pages[0].revisions[0].slots.main.content);
var mwh = '<div style=\'position:absolute; right:1em; top:0.1em\'><p style=\'color:red\'>Made with ❤️ by <a href=\'' + (lang == 'de' ? 'https://de.wikipedia.org/wiki/User:TenWhile6' : 'https://meta.wikimedia.org/wiki/User:TenWhile6') + '\'>TenWhile6</a></p></div><div style=\'position:absolute; left:1em; top:0.5em; font-weight: bold\'><a href=\'' + (lang == 'de' ? 'https://de.wikipedia.org/wiki/Benutzer_Diskussion:TenWhile6/XReport' : 'https://meta.wikimedia.org/wiki/User_talk:TenWhile6/XReport') + '\'>Bug reports / Feedback</a></div>';
var lang = 'en';
if (mw.user.options.get('language') in LangData) {
lang = mw.user.options.get('language');
}
else {
mwh = mwh + '<div style=\'position:absolute; left:1em; bottom:0.5em\'>Your language is not supported? Feel free to <a style=\'font-weight: bold\' href=\'https://meta.wikimedia.org/wiki/User_talk:TenWhile6/XReport#User_interface\'>translate</a> the user interface!</div>';
}
function trnslt(key) {
if (LangData[lang][key]) {
return LangData[lang][key];
}
return LangData.en[key];
}
var WikiData = {
'SRG': {
'page': 'Steward requests/Global',
'section': -1,
'regex': '{{\\s*[Ll]ock[Hh]ide\\s*\\|\\s*(1(\\s*)=|)\\s*$1\\s*}}',
'rtext': '=== Global lock for $1 ===\n{{Status}}\n*{{LockHide|1=$1}}\n$2 '+XLinkS+sig,
'I': {
'page': 'Steward requests/Global',
'section': 1,
'regex': '{{\\s*[Ll]uxotool\\s*\\|\\s*(1(\\s*)=|)\\s*$1\\s*}}',
'rtext': '=== Global block for [[Special:Contributions/$1|$1]] ===\n{{Status}}\n* {{Luxotool|$1}}\n$2 '+XLinkS+sig,
},
'H': {
'page': 'Steward requests/Global',
'section': -1,
'regex': '{{\\s*[Ll]ock[Hh]ide\\s*\\|\\s*(1(\\s*)=|)\\s*$1\\s*}}',
'rtext': '=== Global lock ===\n{{Status}}\n*{{LockHide|1=$1|hidename=1}}\n$2 '+XLinkS+sig,
'summary': 'Reporting user '+XLinkK
},
'reason': ['Cross-wiki abuse', 'Long-term abuse', 'Spam / spambot', 'Lock/ban evasion']
},
'GSR': {
'page': 'Global sysops/Requests',
'regex': '{{\\s*[Ll]ock[Hh]ide\\s*\\|\\s*(1(\\s*)=|)\\s*$1',
'rtext': '* Please block {{LockHide|1=$1|2=$3}} $2 '+XLinkS+sig,
'summary': 'Reporting user '+XLinkK,
'D': {
'page': 'Global sysops/Requests',
//'regex': '\[\[\\s*\\:\\s*(1(\\s*)=|)\\s*$1',
'rtext': '\n* Please delete [[:$3$1]]: $2 '+XLinkS+sig
}
},
// GS-Opted-Out Wikis -- Status: 02.11.2024
/*'alswiki': {
'page': 'Wikipedia:Vandalismusmeldung',
'regex': '==\\s*Benutzer:$1\\s*==',
'regeX': '|{{\\s*[Bb]enutzer\\s*\\|\\s*(1(\\s*)=|)\\s*$1\\s*}}',
'rtext': '== [[Benutzer:$1]] ==\n{{Benutzer|$1}} $2 '+XLinkS+sig,
'P': {
'page': 'Wikipedia:Vandalismusmeldung',
'regex': '==\\s*Seite \\s*$1\\s*==',
'regeX': '|{{\\s*[Aa]rtikel\\s*\\|\\s*(1(\\s*)=|)\\s*$1\\s*}}',
'rtext': '== Seite [[$1]] ==\n{{Artikel|$1}} $2 '+XLinkS+sig
}
},*/
'anwiki': {
'page': 'Wikipedia:Peticions a los almenistradors',
'regex': '==\\s*Report concerning User:$1\\s*==',
'rtext': '== Report concerning User:$1 ==\n* [[Special:Contributions/$1\\|$1]] – $2 '+XLinkS+sig,
},
'arwiki': {
'page': 'ويكيبيديا:إخطار الإداريين/منع/الحالية',
// [!!!] REGEX FEHLT [!!!]
'rtext': "==== منع: $1 ====\n{{وضع طلب|انتظار}}\n:'''{{User|$1}}\nReason: $2 "+XLinkS+sig+"\n'''رد الإداري''':\n<!-- من فضلك اكتب تعليقك فوق هذا السطر -->\n-----\n"
},
'bgwiki': {
'page': 'Уикипедия:Заявки_към_администраторите',
'regex': '==\\s*Блокиране на $1\\s*==',
'rtext': '== Блокиране на $1 ==\n[[Special:Contributions/$1]]\n\n$2 '+XLinkS+sig
},
'bnwiki': {
'page': 'উইকিপিডিয়া:প্রশাসকদের আলোচনাসভা',
'regex': '==\\s*বাধাদানের অনুরোধ: $1\\s*==',
'rtext': '== বাধাদানের অনুরোধ: $1 ==\n* [[বিশেষ:অবদান/$1]]\n\n$2 '+XLinkS+sig
},
/*'bswiki': {
'page': 'Wikipedia:Pitanja za administratore',
'regex': '==\\s*Report concerning User:$1\\s*==',
'rtext': '== Report concerning User:$1 ==\n[[Special:Contributions/$1\\|$1]] – $2 '+XLinkS+sig,
},*/
'cawiki': {
'page': 'Viquipèdia:Observatori del vandalisme',
'regex': '{{\\s*[Uu]ser\\s*\\|\\s*(1(\\s*)=|)\\s*$1\\s*}}',
'rtext': '== Report concerning $1 ==\n{{User|$1}} $2 '+XLinkS+sig,
},
'commonswiki': {
'page': 'Commons:Administrators\' noticeboard/Vandalism',
'regex': '==\\s*$1\\s*==',
'regeX': '|{{\\s*[Vv]andal\\s*\\|\\s*(1(\\s*)=|)\\s*$1\\s*}}',
'rtext': '{{subst:Report vandal|$1|$2 '+XLinkS+sig+'}}'
},
'cswiki': {
'page': 'Wikipedie:Nástěnka správců',
'regex': '==\\s*Žádost o zablokování – $1\\s*==',
'rtext': '{{subst:Wikipedie:Nástěnka správců/Zablokovat | blokovat uživatele = $1 | důvod = $2}}',
'P': {
'page': 'Wikipedie:Nástěnka správců',
// [!!!] REGEX FEHLT [!!!]
'rtext': '\n{{subst:Wikipedie:Nástěnka správců/Zamknout | úroveň = polo | stránka = $1| důvod = $2}}',
}
},
'cswikisource': {
'page': 'Wikizdroje:Nástěnka správců',
'regex': '==\\s*Žádost o zablokování – $1\\s*==',
'rtext': '== Žádost o zablokování – $1 ==\n[[Special:Contributions/$1\\|$1]] – $2 '+XLinkS+sig,
},
'cswiktionary': {
'page': 'Wikislovník:Nástěnka správců',
'regex': '==\\s*Žádost o zablokování – $1\\s*==',
'rtext': '== Žádost o zablokování – $1 ==\n[[Special:Contributions/$1\\|$1]] – $2 '+XLinkS+sig,
},
'cywiki': {
'page': 'Wicipedia:Negesfwrdd gweinyddiaeth',
'regex': '==\\s*Report concerning User:$1\\s*==',
'rtext': '== Report concerning User:$1 ==\n[[Special:Contributions/$1\\|$1]] – $2 '+XLinkS+sig,
},
'dawiki': {
// [CHECK NEEDED] 'page': 'Wikipedia:Anmodning om administratorassistance' [einbindungspflichtige Unterseiten für neue Abschnitte]
},
'dewiki': {
'page': 'Wikipedia:Vandalismusmeldung',
'regex': '==\\s*Benutzer:$1\\s*==',
'regeX': '|{{\\s*[Bb]enutzer\\s*\\|\\s*(1(\\s*)=|)\\s*$1\\s*}}',
'summary': 'Meldung: [[Special:Contributions/$1|$1]] ([[Benutzer:TenWhile6/XReport|XReport]] '+ Xv+')',
'rtext': '== [[Benutzer:$1]] ==\n{{Benutzer|$1}} $2 <small><small>[[Benutzer:TenWhile6/XReport|XReport]]</small></small>'+sig,
'P': {
'page': 'Wikipedia:Vandalismusmeldung',
'regex': '==\\s*Seite \\s*$1\\s*==',
'regeX': '|{{\\s*[Aa]rtikel\\s*\\|\\s*(1(\\s*)=|)\\s*$1\\s*}}',
'summary': 'Meldung: Seite [[$1]] ([[Benutzer:TenWhile6/XReport|XReport]] '+ Xv+')',
'rtext': '== Seite [[$1]] ==\n{{Artikel|$1}} $2 <small>[[Benutzer:TenWhile6/XReport|XReport]]</small>'+sig
},
'reason': ['Unsinnige Bearbeitungen'],
'D': {
'reasons': ['Vandalismus', 'Kein Artikel', 'Spam', 'Zweifelsfreie Irrelevanz', 'Verschieberest', 'Wunsch des Benutzers', 'Keine regelkonformen Diskussionsbeiträge'],
'summary': '+SLA ([[Benutzer:TenWhile6/XReport|XReport]] '+ Xv+')'
}
},
'dewikibooks': {
'page': 'Wikibooks:Vandalensperrung',
'regex': '==\\s*Benutzer:$1\\s*==',
'regeX': '|{{\\s*[Vv]andal\\s*\\|\\s*(1(\\s*)=|)\\s*$1\\s*}}',
'rtext': '== [[Benutzer:$1]] ==\n{{Vandale|$1}} $2 '+XLinkS+sig
},
'dewikisource': {}, // no report page
'dewikivoyage': {}, // no report page
'dewiktionary': {
'page': 'Wiktionary:Vandalismusmeldung',
'regex': '==\\s*Benutzer:$1\\s*==',
'regeX': '|{{\\s*[Vv]andal\\s*\\|\\s*(1(\\s*)=|)\\s*$1\\s*}}',
'rtext': '== [[Benutzer:$1]] ==\n{{Benutzer|$1}} $2 '+XLinkS+sig
},
'elwiki': {
'page': 'Βικιπαίδεια:Σημειωματάριο διαχειριστών',
'regex': '{{\\s*[Uu]ser\\s*\\|\\s*(1(\\s*)=|)\\s*$1\\s*}}',
'rtext': '== Report concerning [[User:$1]] ==\n* {{User|$1}}\n$2 '+XLinkS+sig
},
'enwiki': {
'page': 'Wikipedia:Administrator intervention against vandalism',
'regex': '{{\\s*[Ii][Pp]vandal\\s*\\|\\s*(1(\\s*)=|)\\s*$1\\s*}}',
'regeX': '|{{\\s*[Vv]andal\\s*\\|\\s*(1(\\s*)=|)\\s*$1\\s*}}',
'rtext': '*{{vandal|$1}} – $2 '+XLinkS+sig
},
'enwikiquote': {
'page': 'Wikiquote:Vandalism in progress',
'regex': '==\\s*Report concerning [[Special:Contributions/$1|$1]]\\s*==',
'regeX': '|{{\\s*[Vv]andal\\s*\\|\\s*(1(\\s*)=|)\\s*$1\\s*}}',
'rtext': '== Report concerning [[Special:Contributions/$1|$1]] ==\n\n* {{vandal|$1}}\n$2 '+XLinkS+sig
},
'enwikisource': {
'page': 'Wikisource:Administrators\' noticeboard',
'regex': '==\\s*Report concerning [[Special:Contributions/$1|$1]]\\s*==',
'regeX': '|{{\\s*[Vv]andal\\s*\\|\\s*(1(\\s*)=|)\\s*$1\\s*}}',
'rtext': '== Report concerning [[Special:Contributions/$1|$1]] ==\n\n* {{vandal|$1}}\n$2 '+XLinkS+sig
},
'enwiktionary': {
'page': 'Wiktionary:Vandalism in progress',
'regex': '{{\\s*[Vv]andal\\s*\\|\\s*(1(\\s*)=|)\\s*$1\\s*}}',
'rtext': '* {{vandal|$1}} – $2 '+XLinkS+sig
},
'eowiki': {
'page': 'Vikipedio:Diskutejo/Administrejo',
'regex': '==\\s*Report concerning [[Special:Contributions/$1|$1]]\\s*==',
'regeX': '|{{\\s*[Uu]ser\\s*\\|\\s*(1(\\s*)=|)\\s*$1\\s*}}',
'rtext': '== Report concerning [[Special:Contributions/$1|$1]] ==\n\n* {{user|$1}}\n$2 '+XLinkS+sig
},
'eswiki': {
'page': 'Wikipedia:Vandalismo en curso',
'regex': '==\\s*$1\\s*==',
'rtext': '{{subst:ReportevandalismoIP|1=$1|2=$2 '+XLinkS+'}}'
},
'eswikinews': {
'page': 'Wikinoticias:Tablón de anuncios de los administradores',
'regex': '{{\\s*[Aa]dmin-U\\s*\\|\\s*(1(\\s*)=|)\\s*$1\\s*}}',
'rtext': '== Vandalismo reiterado ==\n;Estado de solicitud\n* {{EstadoTAA|}}\n;Usuarios/Artículos implicados\n* {{Admin-U|$1}}\n\n;Problema\n* $2\n\n;Usuario que solicita\n* '+XLinkS+sig+'\n\n;Respuesta\n(a rellenar por un administrador)',
},
'etwiki': {}, // no report page
'euwiki': {
// [CHECK NEEDED] 'page': 'Wikipedia:Txokoa' [neues MediaWiki-Diskussionssystem]
},
'fawiki': {
// [CHECK NEEDED] 'page': 'ویکیپدیا:تابلوی اعلانات مدیران',
},
'fiwiki': {
'page': 'Wikipedia:Ylläpitäjien ilmoitustaulu',
'regex': 'Käyttäjä:\\s*$1\\s*',
'rtext': '== Estopyyntö $1 ({{subst:LOCALDAY}}.{{subst:LOCALMONTH}}.{{subst:LOCALYEAR}}) ==\n<big>$1</big>\n*\'\'\'Toiminnot:\'\'\' [[Käyttäjä:$1|Käyttäjäsivu]] | [[Keskustelu käyttäjästä:$1|keskustelusivu]] | [[Toiminnot:Muokkaukset/$1|muokkaukset]] | [[Toiminnot:Estä/$1|\'\'\'estä\'\'\']]\n*\'\'\'Lisätiedot:\'\'\' $2 '+XLinkS+sig,
},
'frwiki': {
'page': 'Wikipédia:Vandalisme en cours',
'regex': '{{\\s*[Uu]+\\s*\\|\\s*(1(\\s*)=|)\\s*$1\\s*}}',
'rtext': '== Demande de blocage de $1 ==\n\n* Auteur du vandalisme : {{u+|$1}}\n* Type de dégâts : $2\n\n<!-- Merci de ne pas modifier la ligne ci-dessous -->\n<small>[Via '+XLink+']</small> Message déposé par'+sig
},
'frwikisource': {
'page': 'Wikisource:Requêtes aux administrateurs',
'regex': '{{\\s*[Uu]ser\\s*\\|\\s*(1(\\s*)=|)\\s*$1\\s*}}',
'rtext': '=== Demande de blocage de $1 ===\n{{User|$1}} $2 '+XLinkS+sig,
},
/*'frwikiversity': {
'page': 'Wikiversité:Requêtes aux administrateurs/'+today.getFullYear(),
'regex': '{{\\s*[Uu]ser\\s*\\|\\s*(1(\\s*)=|)\\s*$1\\s*}}',
'rtext': '== Demande de blocage de $1 ==\n{{User|$1}} $2 '+XLinkS+sig,
},*/
'frwiktionary': {
'page': `Wiktionnaire:Demandes aux administrateurs/${monateFr[today.getMonth()]} ${today.getFullYear()}`,
'regex': '{{\\s*[Uu]ser\\s*\\|\\s*(1(\\s*)=|)\\s*$1\\s*}}',
'rtext': '== Demande de blocage de $1 ==\n{{User|$1}} $2 '+XLinkS+sig,
},
/*'glwiki': {
'page': 'Wikipedia:Taboleiro dos administradores/Bloqueos e proteccións',
'regex': '\\s*$1]]\\s*==',
'rtext': '== Informe sobre [[Special:Contributions/$1|$1]] ==\n\nBloquea {{user|$1}}: $2 '+XLinkS+sig
},*/
'hewiki': {
'page': 'ויקיפדיה:בקשות ממפעילים',
'section': 2,
// [!!!] REGEX FEHLT [!!!]
'rtext': '* {{לחסום|$1}} – $2 --~~~~',
},
'hewikisource': {
'page': 'ויקיטקסט:בקשות מבעלי הרשאות',
'section': 2,
// [!!!] REGEX FEHLT [!!!]
'rtext': '* {{לחסום|$1}} – $2 --~~~~',
},
'hrwiki': {
'page': 'Wikipedija:Na pažnju administratorima',
// [!!!] REGEX FEHLT [!!!]
'rtext': "== [[Suradnik:$1]] – vandalizam/spam ==\n{{status prijave|NOVO}}\n* '''Razlog prijave:''' $2\n* '''Podnositelj prijave:''' [[Suradnik:{{subst:REVISIONUSER}}|]] "+XLinkS+"\n* '''Vrijeme:''' {{subst:#timel:j. xg Y. u H:i}}\n\n=== Komentari drugih suradnika ===\n\n=== Komentari administratora ===",
},
'huwiki': {
'page': 'Wikipédia:Adminisztrátorok üzenőfala',
'regex': '==\\s*$1\\s*==',
'regeX': '|{{\\s*[Uu]ser\\s*\\|\\s*(1(\\s*)=|)\\s*$1\\s*}}',
'rtext': '== $1 ==\nSzeretnék neki blokkot: {{user|$1}}. $2 '+XLinkS+sig,
I: {
'page': 'Wikipédia:Adminisztrátorok üzenőfala',
'regex': '==\\s*$1\\s*==',
'regeX': '|{{\\s*[Aa]non\\s*\\|\\s*(1(\\s*)=|)\\s*$1\\s*}}',
'rtext': '== $1 ==\nSzeretnék neki blokkot: {{anon|$1}}. $2 '+XLinkS+sig,
}
},
'idwiki': {
'page': 'Wikipedia:Intervensi pengurus terhadap vandalisme',
'regex': '$1 }}',
'rtext': '== [[User:$1]] ==\n* {{vandal-m|$1}} $2 '+XLinkS+sig
},
'iswiki': {}, // no report page [ASKED SYSOP]
'itwiki': {
'page': 'Wikipedia:Vandalismi in corso',
'regex': '{{\\s*[Vv]andalo\\s*\\|\\s*(1(\\s*)=|)\\s*$1\\s*}}',
'rtext': '{{vandalo|$1}} $2 '+XLinkS+sig
},
'jawiki': {
// [CHECK NEEDED] 'page': 'Wikipedia:管理者伝言板/投稿ブロック' [sections + komplexes datumssystem]
},
'kawiki': {}, // no report page [ASKED SYSOP]
'kowiki': {
'page': '위키백과:사용자 관리 요청/'+today.getFullYear()+'년 제'+Math.ceil((((today - (new Date(today.getFullYear(), 0, 1))) / 86400000) + (new Date(today.getFullYear(), 0, 1)).getDay() + 1) / 7)+'주',
'regex': '{{\\s*사링\\s*\\|\\s*(1(\\s*)=|)\\s*$1\\s*}}',
'rtext': '== $1 ==\n* {{사링|$1}}\n$2 '+XLinkS+sig
},
/*'ltwiki': {
'page': 'Vikipedija:Pranešimai apie pažeidimus',
// [!!!] REGEX FEHLT [!!!]
'rtext': '== [[User:$1]] ==\nReport concerning [[Special:Contributions/$1|$1]]: $2 '+XLinkS+sig,
},*/
'lvwiki': {
'page': 'Vikipēdija:Administratoru ziņojumu dēlis',
'regex': '{{\\s*[Uu]ser\\s*\\|\\s*(1(\\s*)=|)\\s*$1\\s*}}',
'rtext': '== Report concerning $1 ==\n{{User|$1}} $2 '+XLinkS+sig,
},
'mediawikiwiki': { /* it's a GS-wiki, but explicitly opted-out from that in XReport. */
'page': 'Project:Village Pump',
'regex': '==\\s*Report concerning User:$1\\s*==',
'regeX': '|{{\\s*[uU]serLinks\\s*\\|\\s*(1(\\s*)=|)\\s*$1\\s*}}',
'rtext': '== Report concerning User:$1 ==\n{{userLinks|1=$1}} — \'\'\'Reasons:\'\'\' $2 '+XLinkS+sig,
},
'metawiki': {
'page': 'Meta:Requests for help from a sysop or bureaucrat',
'regex': '==\\s*Report concerning User:$1\\s*==',
'regeX': '|{{\\s*[Vv]andal\\s*\\|\\s*(1(\\s*)=|)\\s*$1\\s*}}',
'rtext': '== Report concerning User:$1 ==\n{{vandal|1=$1}} — \'\'\'Reasons:\'\'\' $2 '+XLinkS+sig,
'D': {
'reasons': ['G1: No meaningful content or history', 'G1: Vandalism', 'G1: Test', 'G7: Out of project scope', 'G8: Advertising or other inappropriate promotion', 'T1: Not a translation']
}
},
'mkwiki': {
'page': 'Википедија:Огласна табла за администратори',
'regex': '{{\\s*[Uu]ser\\s*\\|\\s*(1(\\s*)=|)\\s*$1\\s*}}',
'rtext': '== Report concerning $1 ==\n{{User|$1}} $2 '+XLinkS+sig,
},
'mlwiki': {
'page': 'വിക്കിപീഡിയ:കാര്യനിർവാഹകർക്കുള്ള നോട്ടീസ് ബോർഡ്',
'regex': '{{\\s*[Uu]ser\\s*\\|\\s*(1(\\s*)=|)\\s*$1\\s*}}',
'rtext': '== Report concerning $1 ==\n{{User|$1}} $2 '+XLinkS+sig,
},
'mrwiki': {
'page': 'विकिपीडिया:चावडी/प्रचालकांना निवेदन',
'regex': '{{\\s*[Uu]ser\\s*\\|\\s*(1(\\s*)=|)\\s*$1\\s*}}',
'rtext': '== Report concerning $1 ==\n{{User|$1}} $2 '+XLinkS+sig,
},
'mswiki': {
'page': 'Wikipedia:Campur tangan penyelia terhadap vandalisme',
'regex': '{{\\s*[Vv]andal\\s*\\|\\s*(1(\\s*)=|)\\s*$1\\s*}}',
'rtext': '* {{vandal|$1}} $2 '+XLinkS+sig,
},
'nlwiki': {
'page': 'Wikipedia:Verzoekpagina voor moderatoren/RegBlok',
'section': 2,
'regex': '===\\s*$1\\s*===',
'regeX': '|{{\\s*[Ll]g\\s*\\|\\s*(1(\\s*)=|)\\s*$1\\s*}}',
'rtext': '=== $1 ===\n*{{lg|$1}} $2 '+XLinkS+sig,
'I': {
'page': 'Wikipedia:Verzoekpagina voor moderatoren/IPBlok',
'section': 2,
'regex': '{{\\s*[Ll]g\\s*\\|\\s*(1(\\s*)=|)\\s*$1\\s*}}',
'rtext': '*{{lg|$1}} $2 '+XLinkS+sig
},
'P': {
'page': 'Wikipedia:Verzoekpagina voor moderatoren/Beveiligen',
'section': 1,
'regex': '\\s*$1\\s*',
'rtext': '== [[$1]] ==\n$2 '+XLinkS+sig
},
},
'nnwiki': {
'page': 'Wikipedia:Vaktmeistertenester',
'regex': '==\\s*Report concerning User:$1\\s*==',
'rtext': '== Report concerning User:$1 ==\n[[Special:Contributions/$1\|$1]] – $2 '+XLinkS+sig
},
'nowiki': {
'page': 'Wikipedia:Pågående vandalisme',
'section': 2, /* adding at the top of the section - included in source code directly */
'regex': '\\s*/$1\\s*',
'rtext': '* [[Spesial:Bidrag/$1|$1]] – $2 '+XLinkS+sig
},
'plwiki': {
'page': 'Wikipedia:Prośby do administratorów',
'regex': '==\\s*Zgłoszenie w sprawie użytkownika $1\\s*==',
'regeX': '|{{\\s*[Ll]w\\s*\\|\\s*(1(\\s*)=|)\\s*$1\\s*}}',
'rtext': '== Zgłoszenie w sprawie użytkownika $1 ==\n\n* {{lw|$1}}\n\n$2\n\nZgłasza: '+XLinkS+sig
},
'plwikimedia': {}, // wikimedia
'plwikisource': {
'page': 'Wikiźródła:Prośby do administratorów',
'regex': '==\\s*Proszę o blokadę dla $1\\s*==',
'rtext': '== Proszę o blokadę dla $1 ==\n[[Special:Contributions/$1\\|$1]] – $2 '+XLinkS+sig
},
'plwiktionary': {
'page': 'Wikisłownik:Prośby do administratorów',
'regex': '==\\s*Proszę o blokadę dla $1\\s*==',
'rtext': '== Proszę o blokadę dla $1 ==\n[[Special:Contributions/$1\\|$1]] – $2 '+XLinkS+sig
},
'ptwiki': {
'page': 'Wikipédia:Pedidos/Notificações de vandalismo',
'regex': '{{\\s*[Uu]suário3\\s*\\|\\s*(1(\\s*)=|)\\s*$1\\s*}}',
'rtext': '{{subst:bloquear|$1|2=$2}}',
},
'rowiki': {
'page': 'Wikipedia:Reclamații',
'regex': '==\\s*Propunere de blocare a utilizatorului $1\\s*==',
'regeX': '|{{\\s*[Ss]esizare\\s*\\|\\s*(1(\\s*)=|)\\s*$1\\s*}}',
'rtext': '== Propunere de blocare a utilizatorului $1 ==\n{{|$1}} $2 '+XLinkS+sig,
//'P': {
// 'page': 'Wikipedia:Cereri pentru protejarea paginilor',
// 'section': 2,
// 'regex': '=== \\s* $1\\s*===',
// 'rtext': '=== [[$1]] ===\n$2 '+XLinkS+sig
//},
},
'ruwiki': {
'page': 'Википедия:Запросы_к_администраторам/Быстрые',
'regex': 'u/$1[^A-z1-9]',
'rtext': `{{subst:t:preload/ЗКАБ/subst| участник = $1 | пояснение = $2 ${XLinkS}}}`,
P: {
'page': 'Википедия:Запросы_к_администраторам/Быстрые',
// [!!!] REGEX FEHLT [!!!]
'rtext': `{{subst:t:preload/ЗКАБ/subst| страница = $1 | пояснение = $2 ${XLinkS}}}`,
}
},
'sewikimedia': {}, // wikimedia
'simplewiki': {
'page': 'Wikipedia:Vandalism in progress',
'regex': '{{\\s*[Vv]andal\\s*\\|\\s*(1(\\s*)=|)\\s*$1\\s*}}',
'rtext': '*{{Vandal|$1}} – $2 '+XLinkS+sig,
I: {
'page': 'Wikipedia:Vandalism in progress',
'regex': '{{\\s*[Ii][Pp][Vv]andal\\s*\\|\\s*(1(\\s*)=|)\\s*$1\\s*}}',
'rtext': '*{{IPvandal|$1}} – $2 '+XLinkS+sig,
}
},
'skwiki': {
'page': 'Wikipédia:Nástenka správcov',
'regex': '==\\s*Hlásení vandalizmu: $1\\s*==',
'regeX': '|{{\\s*[Rr]edaktor\\s*\\|\\s*(1(\\s*)=|)\\s*$1\\s*}}',
'rtext': '== Hlásení vandalizmu: $1 ==\n{{Redaktor|$1}}\n\n$2 '+XLinkS+sig
},
'slwiki': {
'page': 'Wikipedija:Prošnje za administratorsko pomoč',
'regex': '==\\s*Report concerning User:$1\\s*==',
'regeX': '|{{\\s*[Uu]ser\\s*\\|\\s*(1(\\s*)=|)\\s*$1\\s*}}',
'rtext': '== User:$1 ==\n{{User|$1}} $2 '+XLinkS+sig
},
'sourceswiki': {
'page': 'Wikisource:Vandalism in progress',
'regex': '==\\s*$1\\s*==',
'regeX': '|{{\\s*[Uu]ser\\s*\\|\\s*(1(\\s*)=|)\\s*$1\\s*}}',
'section': '0',
'rtext': '== $1 ==\n* {{User|$1}}\n$2 '+XLinkS+sig
},
'specieswiki': {
'page': 'Wikispecies:Administrators\' Noticeboard',
'regex': '==\\s*Report concerning [[Special:Contributions/$1|$1]]\\s*==',
'regeX': '|{{\\s*[Uu]ser\\s*\\|\\s*(1(\\s*)=|)\\s*$1\\s*}}',
'rtext': '== Report concerning [[Special:Contributions/$1|$1]] ==\n\n* {{user|$1}}\n$2 '+XLinkS+sig
},
'svwiki': {
// [CHECK NEEDED] 'page': 'Wikipedia:Begäran om åtgärder' [sections + komplexes datumssystem]
},
'svwiktionary': {
'page': 'Wiktionary:Bybrunnen',
'regex': '==\\s*Report concerning User:$1\\s*==',
'rtext': '== Report concerning User:$1 ==\n[[Special:Contributions/$1\\|$1]] – $2 '+XLinkS+sig,
},
'tawiki': {
'page': 'விக்கிப்பீடியா:நிருவாகிகளுக்கான அறிவிப்புப்பலகை',
'regex': '{{\\s*[Uu]ser\\s*\\|\\s*(1(\\s*)=|)\\s*$1\\s*}}',
'rtext': '== Report concerning [[User:$1]] ==\n{{User|$1}} – $2 '+XLinkS+sig
},
'test2wiki': {
'page': 'User:TenWhile6/X',
'regex': '==\\s*Report concerning User:$1\\s*==',
'rtext': '== Report concerning User:$1 ==\n* [[Special:Contributions/$1\|$1]] – $2 '+XLinkS+sig,
P: {
'page': 'User:TenWhile6/X',
'regex': '==\\s*Report concerning Page $1\\s*==',
'rtext': '== Report concerning Page $1 ==\n* [[$1]] – $2 '+XLinkS+sig
}
},
'tewiki': {
'page': 'వికీపీడియా:నిర్వాహకుల నోటీసు బోర్డు',
'regex': '==\\s*Report concerning User:$1\\s*==',
'rtext': '== Report concerning User:$1 ==\n[[Special:Contributions/$1\|$1]] – $2 '+XLinkS+sig
},
'thwiki': {
'page': 'วิกิพีเดีย:รายชื่อการก่อกวน',
// [!!!] REGEX FEHLT [!!!]
'rtext': '* {{ก่อกวน|$1}} $2. '+XLinkS+sig,
},
/*'tlwiki': {
'page': 'Usapang Wikipedia:Kapihan',
'regex': '==\\s*Report concerning $1\\s*==',
'regeX': '|{{\\s*[Uu]ser\\s*\\|\\s*(1(\\s*)=|)\\s*$1\\s*}}',
'rtext': '== Report concerning $1 ==\n{{User|$1}} $2 '+XLinkS+sig,
},*/
'trwiki': {
'page': 'Vikipedi:Kullanıcı engelleme talepleri',
'regex': `==\\s*${today.getDate()}-${today.getMonth()+1}-${today.getFullYear()} $1\\s*==`,
'rtext': `== ${today.getDate()}-${today.getMonth()+1}-${today.getFullYear()} $1 ==\n\n{{Vandal|$1}}\n* '''Neden:''' – $2 `+XLinkS+sig,
},
'urwiki': {
'page': 'ویکیپیڈیا:دیوان_خاص',
'regex': '==\\s*User:$1\\s*==',
'rtext': '== [[صارف:$9]] پر پابندئی لگائیں ==\n* {{user|$1}} $2 '+XLinkS+sig,
},
'viwiki': {
'page': 'Wikipedia:Tin nhắn cho bảo quản viên',
'regex': '{{\\s*[Vv]andal\\s*\\|\\s*(1(\\s*)=|)\\s*$1\\s*}}',
'rtext': '== Báo cáo phá hoại ==\n*{{vandal|$1}} – $2 '+XLinkS+sig,
},
'wikidatawiki': {
'page': 'Wikidata:Administrators\' noticeboard',
'regex': '==\\s*Report concerning User:$1\\s*==',
'regeX': '|{{\\s*[Vv]andal\\s*\\|\\s*(1(\\s*)=|)\\s*$1\\s*}}',
'rtext': '{{subst:VandalReport|$1|$2 '+XLinkS+'}}',
P: {
'page': 'Wikidata:Administrators\' noticeboard',
'rtext': '== Protection request for [[$1]] ==\n\nPlease semi-protect [[$1]]. \'\'\'Reason:\'\'\' $2 '+XLinkS+sig,
}
},
'zh_yuewiki': {
// [CHECK NEEDED] 'page': 'Wikipedia:管理員留言板'
},
'zhwiki': {
// [CHECK NEEDED] 'page': 'Wikipedia:当前的破坏'
},
};
function DBdata(modus, status, key) {
DBx = modus == true ? 'SRG' : DB;
DBx = modus == 'GSR' ? 'GSR' : DBx;
if (status == 'I') {
if ('I' in WikiData[DBx]) {
if (WikiData[DBx][status][key]) {
return WikiData[DBx][status][key];
} else {
if (['regex','regeX','section','summary','reasons'].includes(key)) {
return '';
}
else {
sendError(`1. Error: DBdata() at ${DBx} status ${status} key ${key}`);
}
}
}
else {
status = 'U';
}
}
if (status == 'U') {
if (WikiData[DBx][key]) {
return WikiData[DBx][key];
}
else {
if (key == 'reason') {
return ['Vandalism'];
}
else if (['regex','regeX','section','summary','rtext','reasons'].includes(key)) {
return '';
}
else {
sendError(`2. Error: DBdata() at ${DBx} status ${status} in ${key}`);
}
}
}
else if (status == 'P' && WikiData[DBx][status][key]) {
return WikiData[DB][status][key];
}
else if (status == 'P' && ['regex','regeX','section','summary'].includes(key)) {
return '';
}
else if (status == 'H') {
if (WikiData[DBx][status][key]) {
return WikiData[DBx][status][key];
}
else {
if (['regex','regeX','section','summary','rtext','reasons'].includes(key)) {
return '';
}
}
}
else if (status == 'D') {
if (DBx in WikiData) {
if (status in WikiData[DBx]) {
if (WikiData[DBx][status][key]) {
return WikiData[DBx][status][key];
}
}
}
if (['summary','reasons','rtext'].includes(key)) {
return '';
}
}
else {
sendError(`3. Error: DBdata() at ${DBx} status ${status} in ${key}`);
}
}
( function() {
function getUserDialog() {
var style = '.done{margin-bottom: 1em;}' + '.XR-intro-text{font-size: 80%; margin-bottom: 1em;}' + '.XR-errors{color: red; margin: 1em;}';
mw.util.addCSS(style);
function CreateUserDialog(config){
CreateUserDialog.parent.call(this, config);
}
OO.inheritClass(CreateUserDialog, OO.ui.ProcessDialog);
CreateUserDialog.static.name = 'CreateUserDialog';
CreateUserDialog.static.title = XReport;
CreateUserDialog.prototype.initialize = function() {
var self = this;
CreateUserDialog.parent.prototype.initialize.call( this);
var $introText = $( '<div />',{class: 'XR-intro-text'})
.append( $( '<p/>').append(mwh));
var $errorsField = $( '<div />',{class: 'XR-errors'});
var $doneField = $( '<div />',{class: 'done'});
const clearError = function() {
$errorsField.text( '');
self.updateSize();
};
this.curPageID = 'page-1';
var GSR = false;
if (!(DB in WikiData)){
GSR = true;
}
else {
if (!('page' in WikiData[DB])) {
$introText.append( $( '<span>')
.text('This wiki is currently not enabled for local reporting, it will be added soon.'));
}
}
var typeInput = new OO.ui.ButtonSelectWidget({
items: [
new OO.ui.ButtonOptionWidget({data: GSR ? 'GSR' : false, label: GSR ? 'GS/R' : trnslt('local-button'), disabled: GSR ? false : ('page' in WikiData[DB] ? false : true), icon: GSR ? undefined : 'home'}).on('click', function() {hideInput.setDisabled(true);hideInput.setSelected(false);localReasonCheckboxes.toggle(true);globalReasonCheckboxes.toggle(false);self.updateSize();}),
new OO.ui.ButtonOptionWidget({data: true, label: trnslt('global-button')}).on('click', function() {hideInput.setDisabled(false);localReasonCheckboxes.toggle(false);globalReasonCheckboxes.toggle(true);self.updateSize();})
]
});
typeInput.selectItemByLabel(GSR ? 'GS/R' : ('page' in WikiData[DB] ? trnslt('local-button') : trnslt('global-button')));
//var usernameInput = new OO.ui.TextInputWidget({align: 'top', required: true, validate: 'non-empty', value:RelevantUserName});
var usernameInput = new mw.widgets.UserInputWidget({align: 'top', required: true, validate: 'non-empty', value:RelevantUserName});
var hideInput = new OO.ui.CheckboxInputWidget({align: 'top', disabled: GSR ? true : ('page' in WikiData[DB] ? true : false), selected: false});
var hideInputField = new OO.ui.FieldLayout(hideInput,{label: trnslt('hide-username'), align: 'inline'});
var reasonInput = new OO.ui.MultilineTextInputWidget({align: 'top', placeholder: lang == 'de' ? 'Benutzerdefinierte Begründung (optional)' : '', /*required: true,*/ rows: 3, autosize: true});
var localReportReasons = DBdata(GSR ? 'GSR' : false, 'U', 'reason');
var localCheckboxes = [];
var localCheckboxesEach = [];
for (var Lxxx in localReportReasons) {
localCheckboxesEach.push(new OO.ui.CheckboxInputWidget({align: 'top', selected: false}));
}
for (var Lrrr in localCheckboxesEach){
localCheckboxes.push(new OO.ui.FieldLayout(localCheckboxesEach[Lrrr],{label: localReportReasons[Lrrr], align: 'inline'}));
}
localReasonCheckboxes = new OO.ui.FieldLayout(new OO.ui.Widget({content: [new OO.ui.FieldsetLayout({content: localCheckboxes})]}),{label: trnslt('reason')});
var globalReportReasons = DBdata(true, 'U', 'reason');
var globalCheckboxes = [];
var globalCheckboxesEach = [];
for (var Gxxx in globalReportReasons) {
globalCheckboxesEach.push(new OO.ui.CheckboxInputWidget({align: 'top', selected: false}));
}
for (var Grrr in globalCheckboxesEach){
globalCheckboxes.push(new OO.ui.FieldLayout(globalCheckboxesEach[Grrr],{label: globalReportReasons[Grrr], align: 'inline'}));
}
globalReasonCheckboxes = new OO.ui.FieldLayout(new OO.ui.Widget({content: [new OO.ui.FieldsetLayout({content: globalCheckboxes})]}),{label: trnslt('reason')});
var page1Buttons = new OO.ui.HorizontalLayout({
items: [
new OO.ui.ButtonWidget({label: trnslt('close'), align: 'left' , icon:'close'}).on( 'click', function() {
self.close();
clearError();
}),
new OO.ui.ButtonWidget({label: trnslt('button'), flags: ['primary', 'progressive'] ,icon: 'feedback'}).on( 'click', function() {
var username = usernameInput.getValue();
if (!username){
$errorsField.text (trnslt('error-user'));
self.updateSize();
return;
}
var reason = reasonInput.getValue();
var modus = typeInput.findSelectedItem().getData();
var hidden = hideInput.isSelected();
var xapi = modus ? metaapi : (modus == 'GSR' ? metaapi : api);
var statusX = mw.util.isIPAddress(username, true) ? 'I' : (mw.util.isTemporaryUser(username, true) ? 'I' : 'U');
var status = statusX == 'U' ? (hidden ? 'H' : 'U') : statusX;
var regex = DBdata(modus, status, 'regex').replace('$1', username) + DBdata(modus, status, 'regeX').replace('$1', username);
xapi.get({
action: 'query',
prop: 'revisions',
formatversion: 2,
rvprop: 'content',
rvslots: 'main',
rvlimit: 1,
titles: DBdata(modus, status, 'page'),
}).then(function(data){
if (data.error){
sendError(`Error: getUserDialog() at ${DB}, action: api.get`);
return;
}
else if (data.query.pages[0].revisions == undefined){
sendError(`Error: getUserDialog() at ${DB}, action: api.get, error: undefined`);
return;
}
else if (data.query.pages[0].revisions[0].slots.main.content.match(new RegExp(regex,'g')) !== null && regex !== ''){
$errorsField.text(trnslt('error-requested'));
self.updateSize();
return;
}
var finalReason = '';
var rReasons = modus == 'GSR' ? localReportReasons : (modus == true ? globalReportReasons : localReportReasons);
var cEach = modus == 'GSR' ? localCheckboxesEach : (modus == true ? globalCheckboxesEach : localCheckboxesEach);
for (let i = 0;i<(rReasons).length;i++) {
if (cEach[i].isSelected()) {
if (finalReason != '') {
finalReason = finalReason + '. ';
}
finalReason = finalReason + rReasons[i];
}
}
if (reason) {
if (finalReason != '') {
finalReason = finalReason + '. ';
}
finalReason = finalReason + reason;
}
if (finalReason == ''){
$errorsField.text (trnslt('error-reason'));
self.updateSize();
return;
}
else {
clearError();
self.switchTo('page-2');
$doneField.append($( '<span>')
.text(trnslt('process'))
.prop('style', 'position:relative; top:0.35em; color: black; font-weight: bold')
);
self.updateSize();
closeButton.setDisabled(true);
var success = function() {
$doneField.append( $( '<span>')
.text(trnslt('success'))
.prop('style', 'position:relative; left:1.5em; top:0.35em; color: #009000; font-weight: bold'));
closeButton.setDisabled(false);
timeout = function() {
window.location.reload();
self.close();
};
setTimeout(timeout, 5000);
};
finalReason = finalReason.replace( /(.*)--~~~~/g, '$1');
finalReason = finalReason.replace( /(.*)~~~~/g, '$1');
if (finalReason.charAt(0) == ''){
finalReason = finalReason.substr(1);
}
uSummary = DBdata(modus, status, 'summary') !== '' ? DBdata(modus, status, 'summary') : uSummary;
uSummary = uSummary.replace('$1', username).replace('$1', username);
var importrptext = DBdata(modus, status, 'rtext');
var reporttext = (importrptext.charAt(0) == '*' ? '\n' : '\n\n')+importrptext.replace('$1', username).replace('$1', username).replace('$1', username).replace('$1', username).replace('$1', username).replace('$1', username).replace('$2', finalReason).replace('$3', `${iwPrefix}:`).replace('9$', username);
if (DBdata(modus, status, 'section')){
xapi.get({
action: 'parse',
page: DBdata(modus, status, 'page'),
prop: 'sections'
}).done( function(response){
const sections = response.parse.sections.length;
sectionnum = DBdata(modus, status, 'section');
if (sectionnum == -1){
sectionnum = sections - 1;
}
xapi.get({
action: 'parse',
page: DBdata(modus, status, 'page'),
prop: 'wikitext',
section: sectionnum
}).done( function(result) {
var wikitext;
if (DB == 'nowiki') {
wikitext = result.parse.wikitext['*'].replace(`== ${today.getFullYear()} ==`, `== ${today.getFullYear()} ==\n` + reporttext);
}
else {
wikitext = result.parse.wikitext['*'] + reporttext;
}
xapi.postWithEditToken({
action: 'edit',
title: DBdata(modus, status, 'page'),
section: sectionnum,
text: wikitext,
summary: uSummary,
notminor: true,
nocreate: true
}).then(function(data) {
success();
}).catch(function(error) {
//sendError(`Error: getUserDialog() at ${DB}, action: postWithEditToken`);
$doneField.append($( '<span>')
.text('Error: '+error)
.prop('style', 'position:relative; left:1.5em; top:0.35em; color: red; font-weight: bold'));
closeButton.setDisabled(false);
});
});
});
}
else {
xapi.postWithEditToken({
action: 'edit',
title: DBdata(modus, status, 'page'),
summary: uSummary,
appendtext: reporttext,
}).then(function(data){
success();
}).catch(function(error) {
//sendError(`Error: getUserDialog() at ${DB}, action: postWithEditToken`);
$doneField.append($( '<span>')
.text('Error: '+error)
.prop('style', 'position:relative; left:1.5em; top:0.35em; color: red; font-weight: bold'));
closeButton.setDisabled(false);
});
}
}
});
self.updateSize();
})
],
});
var page1Form = new OO.ui.FieldsetLayout({
items: [
new OO.ui.FieldLayout(typeInput,{label: trnslt('type')}),
new OO.ui.FieldLayout(
new OO.ui.Widget({
content: [
new OO.ui.FieldsetLayout({
content: [
usernameInput,
hideInputField,
]
})
]
}),{
label: trnslt('username')
}),
globalReasonCheckboxes,
localReasonCheckboxes,
new OO.ui.FieldLayout(reasonInput,{label: trnslt('c-reason')}),
new OO.ui.FieldLayout(new OO.ui.Widget({content: [page1Buttons]}),{align: 'top'})
]
});
var closeButton = new OO.ui.ButtonWidget({label: trnslt('close'), flags: ['primary','progressive'], icon:'close'}).on( 'click', function() {
window.location.reload();
self.close();
});
var page2Buttons = new OO.ui.HorizontalLayout({
items: [closeButton]
});
var page2Form = new OO.ui.FieldsetLayout({
items: [
new OO.ui.FieldLayout( new OO.ui.Widget({content: [page2Buttons]}),{align: 'top'})
]
});
this.panelLayout = new OO.ui.PanelLayout({padded: true, expanded: false});
this.panelLayout.$element.append(
$introText,
$errorsField,
$doneField,
$('<div />',{id: 'page-1'}).append( page1Form.$element),
$('<div />',{id: 'page-2' , style: 'display:none'}).append( page2Form.$element)
);
this.$body.append( this.panelLayout.$element);
};
CreateUserDialog.prototype.getBodyHeight = function() {
return this.panelLayout.$element.outerHeight( true);
};
CreateUserDialog.prototype.switchTo = function(nextPageID){
$( '#' + this.curPageID).hide();
this.curPageID = nextPageID;
$( '#' + nextPageID).show();
this.updateSize();
};
return new CreateUserDialog({
size: 'medium'
});
}
var dialog, windowManager;
function openUserDialog(){
if (!dialog){
dialog = getUserDialog();
windowManager = new OO.ui.WindowManager();
$('body').append(windowManager.$element);
windowManager.addWindows([dialog]);
if (DB in WikiData) {
if (!('page' in WikiData[DB])) {
localReasonCheckboxes.toggle(false);
globalReasonCheckboxes.toggle(true);
}
else {
localReasonCheckboxes.toggle(true);
globalReasonCheckboxes.toggle(false);
}
}
else {
localReasonCheckboxes.toggle(true);
globalReasonCheckboxes.toggle(false);
}
}
windowManager.openWindow(dialog);
}
var portletLink = mw.util.addPortletLink(
blocation,
'#',
trnslt('title'),
'ca-reportuser',
trnslt('description'),
null,
'#ca-reportuser'
);
$(portletLink).click(function(e) {
e.preventDefault();
openUserDialog();
});
mw.loader.using(['mediawiki.util', 'mediawiki.widgets.UserInputWidget', 'oojs-ui', 'oojs-ui-core', 'oojs-ui-widgets', 'oojs-ui-windows']);
})();
if (DB in WikiData) {
if ('P' in WikiData[DB]) {
( function() {
function getPageDialog() {
var style = '.done{margin-bottom: 1em;}' + '.XR-intro-text{font-size: 80%; margin-bottom: 1em;}' + '.XR-errors{color: red; margin: 1em;}';
mw.util.addCSS(style);
function CreatePageDialog(config){
CreatePageDialog.parent.call(this, config);
}
OO.inheritClass(CreatePageDialog, OO.ui.ProcessDialog);
CreatePageDialog.static.name = 'CreatePageDialog';
CreatePageDialog.static.title = XReport;
CreatePageDialog.prototype.initialize = function() {
var self = this;
CreatePageDialog.parent.prototype.initialize.call( this);
var $introText = $( '<div />',{class: 'XR-intro-text'})
.append( $( '<p/>').append(mwh));
var $errorsField = $( '<div />',{class: 'XR-errors'});
var $doneField = $( '<div />',{class: 'done'});
const clearError = function() {
$errorsField.text( '');
self.updateSize();
};
this.curPageID = 'page-1';
var pagenameInput = new OO.ui.TextInputWidget({align: 'top', required: true, validate: 'non-empty', value:RelevantPageName});
var reasonInput = new OO.ui.MultilineTextInputWidget({align: 'top', required: true, rows: 3, autosize: true});
var page1Buttons = new OO.ui.HorizontalLayout({
items: [
new OO.ui.ButtonWidget({label: trnslt('close'), align: 'left', icon:'close'}).on( 'click', function() {
self.close();
clearError();
}),
new OO.ui.ButtonWidget({label: trnslt('button'), flags: ['primary', 'progressive'] ,icon: 'feedback'}).on( 'click', function() {
var pagename = pagenameInput.getValue();
if (!pagename) {
$errorsField.text (trnslt('error-page'));
self.updateSize();
return;
}
var reason = reasonInput.getValue();
if (!reason) {
$errorsField.text (trnslt('error-reason'));
self.updateSize();
return;
}
var modus = false;
var xapi = modus ? metaapi : api;
var status = 'P';
var Vregex = DBdata(modus, status, 'regex').replace('$1', pagename) + DBdata(modus, status, 'regeX').replace('$1', pagename);
xapi.get({
action: 'query',
prop: 'revisions',
formatversion: 2,
rvprop: 'content',
rvslots: 'main',
rvlimit: 1,
titles: DBdata(modus, status, 'page'),
})
.then(function(data){
if (data.error){
sendError(`Error: getPageDialog() at ${DB}, action: api.get`);
return;
}
else if (data.query.pages[0].revisions == undefined){
sendError(`Error: getPageDialog()) at ${DB}, action: api.get, error: undefined`);
return;
}
if ( data.query.pages[0].revisions[0].slots.main.content.match( new RegExp( Vregex, 'g')) !== null && Vregex !== ''){
$errorsField.text (trnslt('error-requested'));
self.updateSize();
return;
}
else if (pagename.startsWith('Spezial:') || pagename.startsWith('Special:')){
$errorsField.text (trnslt('error-specialpage'));
self.updateSize();
return;
}
else {
clearError();
self.switchTo('page-2');
$doneField.append($( '<span>')
.text(trnslt('process'))
.prop('style', 'position:relative; top:0.35em; color: black; font-weight: bold')
);
self.updateSize();
closeButton.setDisabled(true);
var success = function() {
$doneField.append( $( '<span>')
.text(trnslt('success'))
.prop('style', 'position:relative; left:1.5em; top:0.35em; color: #009000; font-weight: bold'));
closeButton.setDisabled(false);
timeout = function() {
window.location.reload();
self.close();
};
setTimeout(timeout, 5000);
};
reason = reason.replace( /(.*)--~~~~/g, '$1');
reason = reason.replace( /(.*)~~~~/g, '$1');
if (reason.charAt(0) == ''){
reason = reason.substr(1);
}
pagename = pagename.replace(/_/g, ' ');
pSummary = DBdata(modus, status, 'summary') !== '' ? DBdata(modus, status, 'summary').replace('$1', pagename) : pSummary.replace('$1', pagename);
var reporttext = '\n'+DBdata(modus, status, 'rtext').replace('$1', pagename).replace('$1', pagename).replace('$2', reason);
if ('section' in WikiData[DB][status]){
api.get({
action: 'parse',
page: DBdata(modus, status, 'page'),
prop: 'wikitext',
section: DBdata(modus, status, 'section')
}).done( function(result){
var wikitext = result.parse.wikitext['*'] + reporttext;
api.postWithEditToken({
action: 'edit',
title: DBdata(modus, status, 'page'),
section: DBdata(modus, status, 'section'),
text: wikitext,
summary: pSummary,
notminor: true,
nocreate: true
}).then(function() {
success();
}).catch(function(error) {
//sendError(`Error: getPageDialog() at ${DB}, action: postWithEditToken`);
$doneField.append($( '<span>')
.text('Error: '+error)
.prop('style', 'position:relative; left:1.5em; top:0.35em; color: red; font-weight: bold'));
closeButton.setDisabled(false);
});
});
}
else {
api.postWithEditToken({
action: 'edit',
title: DBdata(modus, status, 'page'),
summary: pSummary,
appendtext: reporttext,
}).then(function(data){
success();
}).catch(function(error) {
//sendError(`Error: getPageDialog() at ${DB}, action: postWithEditToken`);
$doneField.append($( '<span>')
.text('Error: '+error)
.prop('style', 'position:relative; left:1.5em; top:0.35em; color: red; font-weight: bold'));
closeButton.setDisabled(false);
});
self.updateSize();
}
}
});
})
]
});
var page1Form = new OO.ui.FieldsetLayout({
items: [
new OO.ui.FieldLayout(
new OO.ui.Widget({
content: [
new OO.ui.FieldsetLayout({
content: [
pagenameInput,
]
})
]
}),{
label: trnslt('pagename')
}),
new OO.ui.FieldLayout(reasonInput,{label: trnslt('reason')}),
new OO.ui.FieldLayout(new OO.ui.Widget({content: [page1Buttons]}),{align: 'top'})
]
});
var closeButton = new OO.ui.ButtonWidget({label: trnslt('close'), flags: ['primary','progressive'], icon:'close'}).on( 'click', function() {
window.location.reload();
self.close();
});
var page2Buttons = new OO.ui.HorizontalLayout({
items: [closeButton]
});
var page2Form = new OO.ui.FieldsetLayout({
items: [
new OO.ui.FieldLayout( new OO.ui.Widget({content: [page2Buttons]}),{align: 'top'})
]
});
this.panelLayout = new OO.ui.PanelLayout({padded: true, expanded: false});
this.panelLayout.$element.append(
$introText,
$errorsField,
$doneField,
$('<div />',{id: 'page-1'}).append( page1Form.$element),
$('<div />',{id: 'page-2' , style: 'display:none'}).append( page2Form.$element)
);
this.$body.append( this.panelLayout.$element);
};
CreatePageDialog.prototype.getBodyHeight = function() {
return this.panelLayout.$element.outerHeight( true);
};
CreatePageDialog.prototype.switchTo = function(nextPageID){
$( '#' + this.curPageID).hide();
this.curPageID = nextPageID;
$( '#' + nextPageID).show();
this.updateSize();
};
return new CreatePageDialog({
size: 'medium'
});
}
var dialog, windowManager;
function openPageDialog(){
if (!dialog){
dialog = getPageDialog();
windowManager = new OO.ui.WindowManager();
$('body').append(windowManager.$element);
windowManager.addWindows([dialog]);
}
windowManager.openWindow(dialog);
}
var portletLink = mw.util.addPortletLink(
blocation,
'#',
trnslt('Ptitle'),
'ca-reportpage',
trnslt('Pdescription'),
null,
'#ca-reportpage'
);
$(portletLink).click(function(e){
e.preventDefault();
openPageDialog();
});
mw.loader.using(['mediawiki.util', 'oojs-ui', 'oojs-ui-core', 'oojs-ui-widgets', 'oojs-ui-windows']);
})();
}
}
if (mw.config.get('wgNamespaceNumber') >= 0 && mw.config.get('wgArticleId') != 0 && !(['ptwiki', 'hrwiki', 'kowiki'].includes(DB))){
( function() {
function getQDDialog(){
var style = '.done{margin-bottom: 1em;}' + '.XR-intro-text{font-size: 80%; margin-bottom: 1em;}' + '.XR-errors{color: red; margin: 1em;}';
mw.util.addCSS(style);
function CreateQDDialog(config){
CreateQDDialog.parent.call(this, config);
}
OO.inheritClass(CreateQDDialog, OO.ui.ProcessDialog);
CreateQDDialog.static.name = 'CreateQDDialog';
CreateQDDialog.static.title = XReport;
CreateQDDialog.prototype.initialize = function() {
var self = this;
CreateQDDialog.parent.prototype.initialize.call( this);
var $introText = $( '<div />',{class: 'XR-intro-text'})
.append( $( '<p/>').append(mwh));
var $errorsField = $( '<div />',{class: 'XR-errors'});
var $doneField = $( '<div />',{class: 'done'});
const clearError = function() {
$errorsField.text( '');
self.updateSize();
};
this.curPageID = 'page-1';
var GSR = false;
var status = 'D';
if (!(DB in WikiData)){
GSR = true;
}
else {
deleteReasons = DBdata('x', status, 'reasons') != '' ? DBdata('x', status, 'reasons') : deleteReasons;
}
var checkboxes = [];
var checkboxesEach = [];
var gsrCheck = new OO.ui.CheckboxInputWidget({align: 'top', selected: false});
var gsrInput = new OO.ui.FieldLayout(new OO.ui.Widget({content: [new OO.ui.FieldsetLayout({content: [new OO.ui.FieldLayout(gsrCheck,{label: trnslt('SDgsr'), align: 'inline'})]})]}));
for (var xxx in deleteReasons) {
checkboxesEach.push(new OO.ui.CheckboxInputWidget({align: 'top', selected: false}));
}
for (var rrr in checkboxesEach){
checkboxes.push(new OO.ui.FieldLayout(checkboxesEach[rrr],{label: deleteReasons[rrr], align: 'inline'}));
}
var QDreasonInput = new OO.ui.MultilineTextInputWidget({align: 'top', placeholder: lang == 'de' ? 'Benutzerdefinierte Begründung (optional)' : '', rows: 1, autosize: true});
var page1Buttons = new OO.ui.HorizontalLayout({
items: [
new OO.ui.ButtonWidget({label: trnslt('close'), align: 'left' , icon:'close'}).on( 'click', function() {
self.close();
clearError();
}),
new OO.ui.ButtonWidget({label: trnslt('SDtitle'), flags: ['primary', 'progressive'] ,icon: 'feedback'}).on( 'click', function() {
var finalReason = '';
for (let i = 0;i<deleteReasons.length;i++) {
if (checkboxesEach[i].isSelected()) {
if (finalReason != '') {
finalReason = finalReason + '. ';
}
finalReason = finalReason + deleteReasons[i];
}
}
var manualReason = QDreasonInput.getValue();
if (manualReason) {
if (finalReason != '') {
finalReason = finalReason + '. ';
}
finalReason = finalReason + manualReason;
}
if (finalReason == ''){
$errorsField.text (trnslt('error-reason'));
self.updateSize();
return;
}
var gsr = gsrCheck.isSelected();
var regex = '{{[Ss][Ll][Aa]|{{[Ll]öschen|{{[Dd]elete';
api.get({
action: 'query',
prop: 'revisions',
formatversion: 2,
rvprop: 'content',
rvslots: 'main',
rvlimit: 1,
titles: curPageName,
}).then(function(data) {
if (data.error) {
sendError(`Error: quickdeletion() at ${DB}, action: api.get`);
return;
}
else if (data.query.pages[0].revisions == undefined){
sendError(`Error: quickdeletion() at ${DB}, action: api.get, error: undefined`);
return;
}
else if (data.query.pages[0].revisions[0].slots.main.content.match(new RegExp(regex,'g')) !== null && regex !== ''){
$errorsField.text(trnslt('error-SDrequested'));
self.updateSize();
return;
}
else{
clearError();
self.switchTo('page-2');
$doneField.append($( '<span>')
.text(trnslt('SDprocess'))
.prop('style', 'position:relative; top:0.35em; color: black; font-weight: bold')
);
self.updateSize();
closeButton.setDisabled(true);
var success = function() {
$doneField.append( $( '<span>')
.text(trnslt('success'))
.prop('style', 'position:relative; left:1.5em; top:0.35em; color: #009000; font-weight: bold'));
closeButton.setDisabled(false);
timeout = function() {
window.location.reload();
self.close();
};
setTimeout(timeout, 5000);
};
finalReason = finalReason.replace( /(.*)--~~~~/g, '$1');
finalReason = finalReason.replace( /(.*)~~~~/g, '$1');
if (finalReason.charAt(0) == ''){
finalReason = finalReason.substr(1);
}
var wikitext = `<noinclude>{{${['mediawikiwiki', 'commonswiki', 'enwikisource'].includes(DB) ? 'speedy' : 'delete'}|${finalReason} <small>${DB == 'dewiki' ? '[[Benutzer:TenWhile6/XReport|XReport]]' + sig : XLink}</small>}}</noinclude>\n`+data.query.pages[0].revisions[0].slots.main.content;
var datasummary = DBdata('x', status, 'summary');
api.postWithEditToken({
action: 'edit',
title: curPageName,
text: wikitext,
summary: datasummary == '' ? dSummary : datasummary,
notminor: true,
nocreate: true
}).then(function(data){
if (GSR && gsr) {
metaapi.postWithEditToken({
action: 'edit',
title: DBdata('GSR', status, 'page'),
summary: dSummary,
appendtext: DBdata('GSR', status, 'rtext').replace('$3', `${iwPrefix}:`).replace('$2', finalReason).replace('$1', curPageName),
}).then(function(data){
success();
}).catch(function(error) {
//sendError(`Error: getQDDialog() at ${DB}, action: postWithEditToken@meta`);
$doneField.append($( '<span>')
.text('Error: '+error)
.prop('style', 'position:relative; left:1.5em; top:0.35em; color: red; font-weight: bold'));
closeButton.setDisabled(false);
});
}
else {
success();
}
}).catch(function(error) {
//sendError(`Error: getQDDialog() at ${DB}, action: postWithEditToken`);
$doneField.append($( '<span>')
.text('Error: '+error)
.prop('style', 'position:relative; left:1.5em; top:0.35em; color: red; font-weight: bold'));
closeButton.setDisabled(false);
});
}
});
self.updateSize();
})
],
});
var page1Form = GSR ? new OO.ui.FieldsetLayout({
items: [
gsrInput,
new OO.ui.FieldLayout(new OO.ui.Widget({content: [new OO.ui.FieldsetLayout({content: checkboxes})]}),{label: trnslt('reason')}),
new OO.ui.FieldLayout(QDreasonInput,{label: trnslt('c-reason')}),
new OO.ui.FieldLayout(new OO.ui.Widget({content: [page1Buttons]}),{align: 'top'})
]
}) : new OO.ui.FieldsetLayout({
items: [
new OO.ui.FieldLayout(new OO.ui.Widget({content: [new OO.ui.FieldsetLayout({content: checkboxes})]}),{label: trnslt('reason')}),
new OO.ui.FieldLayout(QDreasonInput,{label: trnslt('c-reason')}),
new OO.ui.FieldLayout(new OO.ui.Widget({content: [page1Buttons]}),{align: 'top'})
]
});
var closeButton = new OO.ui.ButtonWidget({label: trnslt('close'), flags: ['primary','progressive'], icon:'close'}).on( 'click', function() {
window.location.reload();
self.close();
});
var page2Buttons = new OO.ui.HorizontalLayout({
items: [closeButton]
});
var page2Form = new OO.ui.FieldsetLayout({
items: [
new OO.ui.FieldLayout( new OO.ui.Widget({content: [page2Buttons]}),{align: 'top'})
]
});
this.panelLayout = new OO.ui.PanelLayout({padded: true, expanded: false});
this.panelLayout.$element.append(
$introText,
$errorsField,
$doneField,
$('<div />',{id: 'page-1'}).append( page1Form.$element),
$('<div />',{id: 'page-2' , style: 'display:none'}).append( page2Form.$element)
);
this.$body.append( this.panelLayout.$element);
};
CreateQDDialog.prototype.getBodyHeight = function() {
return this.panelLayout.$element.outerHeight( true);
};
CreateQDDialog.prototype.switchTo = function(nextPageID){
$( '#' + this.curPageID).hide();
this.curPageID = nextPageID;
$( '#' + nextPageID).show();
this.updateSize();
};
return new CreateQDDialog({
size: 'medium'
});
}
var dialog, windowManager;
function openQDDialog(){
if (!dialog){
dialog = getQDDialog();
windowManager = new OO.ui.WindowManager();
$('body').append(windowManager.$element);
windowManager.addWindows([dialog]);
}
windowManager.openWindow(dialog);
}
var portletLink = mw.util.addPortletLink(
blocation,
'#',
trnslt('SDtitle'),
'ca-quickdeletion',
trnslt('SDdescription'),
null,
'#ca-quickdeletion'
);
$(portletLink).click(function(e){
e.preventDefault();
openQDDialog();
});
mw.loader.using(['mediawiki.util', 'oojs-ui', 'oojs-ui-core', 'oojs-ui-widgets', 'oojs-ui-windows']);
})();
}
});
//</nowiki>