MediaWiki:CommonSysop.js: Unterschied zwischen den Versionen
Zur Navigation springen
Zur Suche springen
WHiTY (Diskussion | Beiträge) |
WHiTY (Diskussion | Beiträge) |
||
Zeile 7: | Zeile 7: | ||
/* function commonSysop() { | /* function commonSysop() { | ||
− | + | /* if ( document.getElementById( 'InsertCreateForm' ) ) { | |
− | + | /* document.getElementById( 'InsertCreateForm' ).innerHTML = '<form method="get" style="width:100%" name="createform">' + | |
− | + | /* '<fieldset><legend>Vorlagen- und Kategoriegenerator</legend>' + | |
− | + | /* '<label for="Status" style="vertical-align:top">Status:</label>' + | |
− | + | /* '<p id="Status">Vor dem Erzeugen bitte die Namen und Inhalte überprüfen ...</p>' + | |
− | + | /* '<label for="Summary" style="vertical-align:top">Zusammenfassung:</label>' + | |
− | + | /* '<p><input id="Summary" type="text" size="50" value="Mit neuer Vorlage generiert"></p>' + | |
− | + | /* '<p><input type="button" value="Erzeugen" onClick="CreateVKFiles()"> <input type="button" value="Abbrechen" /*onClick="StopCreateVKFiles()"></p></fieldset></form>'; | |
− | + | /* } | |
}*/ | }*/ | ||
/*var t_Files = new Array(); | /*var t_Files = new Array(); | ||
− | var t_max_lang = 10; | + | /*var t_max_lang = 10; |
− | var t_createnext = 0; | + | /*var t_createnext = 0; |
− | var t_wikiurl = commonSysopConf.wgServer + commonSysopConf.wgScriptPath + '/api.php'; | + | /*var t_wikiurl = commonSysopConf.wgServer + commonSysopConf.wgScriptPath + '/api.php'; |
− | var t_stopp = false; | + | /*var t_stopp = false; |
− | function StopCreateVKFiles() { | + | /*function StopCreateVKFiles() { |
− | + | /* t_stopp = true; | |
− | } | + | /*} |
− | function CreateVKFiles() { | + | /*function CreateVKFiles() { |
− | + | /* t_Files.splice( 0, t_Files.length ); | |
t_createnext = 0; | t_createnext = 0; | ||
t_stopp = false; | t_stopp = false; |
Aktuelle Version vom 20. Februar 2022, 09:46 Uhr
/* ------------------------------------------------ */ /* Script zum Erzeugen von Vorlagen und Kategorien */ /* ------------------------------------------------ /* Global Vars */ /* var commonSysopConf = mw.config.get(['wgServer', 'wgScriptPath']); */ /* function commonSysop() { /* if ( document.getElementById( 'InsertCreateForm' ) ) { /* document.getElementById( 'InsertCreateForm' ).innerHTML = '<form method="get" style="width:100%" name="createform">' + /* '<fieldset><legend>Vorlagen- und Kategoriegenerator</legend>' + /* '<label for="Status" style="vertical-align:top">Status:</label>' + /* '<p id="Status">Vor dem Erzeugen bitte die Namen und Inhalte überprüfen ...</p>' + /* '<label for="Summary" style="vertical-align:top">Zusammenfassung:</label>' + /* '<p><input id="Summary" type="text" size="50" value="Mit neuer Vorlage generiert"></p>' + /* '<p><input type="button" value="Erzeugen" onClick="CreateVKFiles()"> <input type="button" value="Abbrechen" /*onClick="StopCreateVKFiles()"></p></fieldset></form>'; /* } }*/ /*var t_Files = new Array(); /*var t_max_lang = 10; /*var t_createnext = 0; /*var t_wikiurl = commonSysopConf.wgServer + commonSysopConf.wgScriptPath + '/api.php'; /*var t_stopp = false; /*function StopCreateVKFiles() { /* t_stopp = true; /*} /*function CreateVKFiles() { /* t_Files.splice( 0, t_Files.length ); t_createnext = 0; t_stopp = false; for ( i = 1; i <= t_max_lang; i++ ) { t_FileV = document.getElementById( 'FileV' + i ); t_InhaltV = document.getElementById( 'InhaltV' + i ); if ( t_FileV && t_InhaltV ) { var t_File = new Array( t_FileV.getElementsByTagName("A")[0].innerHTML, t_InhaltV.innerHTML ); t_Files.push( t_File ); } } for ( i = 1; i <= t_max_lang; i++ ) { t_FileK = document.getElementById( 'FileK' + i ); t_InhaltK = document.getElementById( 'InhaltK' + i ); if ( t_FileK && t_InhaltK ) { var t_File = new Array( t_FileK.getElementsByTagName("A")[0].innerHTML, t_InhaltK.innerHTML ); t_Files.push( t_File ); } } CreateNextVKFile(); } function CreateNextVKFile() { if ( t_createnext < t_Files.length ) { var t_parameters = '?action=query&format=json&prop=info|revisions&intoken=edit&titles=' + encodeURIComponent( t_Files[t_createnext][0] ) + ''; var t_http_req = null; if (window.XMLHttpRequest) {t_http_req = new XMLHttpRequest();} else if (window.ActiveXObject) {t_http_req = new ActiveXObject("Microsoft.XMLHTTP");} t_http_req.open("GET", t_wikiurl + t_parameters, true); t_http_req.onreadystatechange = function() { if(t_http_req.readyState != 4) { document.getElementById('Status').innerHTML = 'Token wird angefordert ...'; } if(t_http_req.readyState == 4 && t_http_req.status == 200) { GotToken( eval("(" + t_http_req.responseText + ")") ); } } t_http_req.send(null); } } function GotToken( queryData ) { if ( queryData ) { if ( queryData.query && queryData.query.pages ) { var t_edittoken = ""; var t_timestamp = ""; var t_some_pages = queryData.query.pages; for ( var t_Page in t_some_pages ) { t_edittoken = encodeURIComponent( t_some_pages[t_Page].edittoken ); if ( t_some_pages[t_Page].revisions ) { var t_some_revisions = t_some_pages[t_Page].revisions; for ( var i = 0; i < t_some_revisions.length; i++ ) { if (t_some_revisions[i].timestamp) { t_timestamp = t_some_revisions[i].timestamp; } } } document.getElementById('Status').innerHTML = t_some_pages[t_Page].starttimestamp; } t_summary = document.getElementById('Summary').getAttribute('value'); t_text = t_Files[t_createnext][1]; t_text = t_text.replace(/</g, "<"); t_text = t_text.replace(/>/g, ">"); t_text = t_text.replace(/&/g, "&"); var t_parameters = '?action=edit&format=json&title=' + encodeURIComponent( t_some_pages[t_Page].title ) + '&summary=' + encodeURIComponent( t_summary ) + '&watch&basetimestamp=' + t_timestamp + '&token=' + t_edittoken + '&bot=1' + '&text=' + encodeURIComponent( t_text ); var t_http_req = null; if (window.XMLHttpRequest) {t_http_req = new XMLHttpRequest();} else if (window.ActiveXObject) {t_http_req = new ActiveXObject("Microsoft.XMLHTTP");} t_http_req.open("POST", t_wikiurl + t_parameters, true); t_http_req.onreadystatechange = function() { if(t_http_req.readyState != 4) { document.getElementById('Status').innerHTML = ''+t_some_pages[t_Page].title+' wird mit '+t_text+' geschrieben ('+t_summary+') ...'; } if(t_http_req.readyState == 4 && t_http_req.status == 200) { WrittenVKFile( eval("(" + t_http_req.responseText + ")") ); } } t_http_req.send(null); } } } function WrittenVKFile( queryData ) { if ( queryData.edit && queryData.edit.result ) { document.getElementById('Status').innerHTML = queryData.edit.result; if ( t_stopp ) { document.getElementById('Status').innerHTML = "Auf Benutzerwunsch abgebrochen ..."; } else { t_createnext++; CreateNextVKFile(); } } }*/ /* ---------------------------------------------------- */ /* Script für Voreinstellungen beim Sperren und Löschen */ /* ---------------------------------------------------- */ function denyAndDelete() { for ( var i = 0; i < document.getElementsByTagName( "A" ).length; i++ ) { if ( href = document.getElementsByTagName("A")[i].getAttribute("href") ) { Benutzer = href.split("Spezial:Sperren/"); if ( Benutzer.length > 1 ) { document.getElementsByTagName("A")[i].setAttribute("href", href + "&wpBlockExpiry=infinite&wpBlockReason=spam"); } } } if ( document.getElementById('ca-delete' ) ) { //if ( href = document.getElementById('ca-delete' ).firstChild.getAttribute("href") ) { // document.getElementById('ca-delete' ).firstChild.setAttribute("href", href + "&wpReason=%0A"); //} } } /* Load it now */ /* $( commonSysop ); */ $( denyAndDelete ); /* ---------------------------------------------------- */