Benutzer:WWWIG/monobook.js: Unterschied zwischen den Versionen
Zur Navigation springen
Zur Suche springen
WWWIG (Diskussion | Beiträge) |
WWWIG (Diskussion | Beiträge) |
||
Zeile 35: | Zeile 35: | ||
'donna', | 'donna', | ||
'embedded', | 'embedded', | ||
+ | 'etbz', | ||
'evity', | 'evity', | ||
'Exten', | 'Exten', | ||
Zeile 402: | Zeile 403: | ||
if ( t_text ) { | if ( t_text ) { | ||
for ( t_Word = 0; t_Word < t_blackwordlist.length; t_Word++ ) { | for ( t_Word = 0; t_Word < t_blackwordlist.length; t_Word++ ) { | ||
− | + | t_erg = String( t_text.toUpperCase() ).indexOf( String( t_blackwordlist[t_Word]).toUpperCase() ); | |
− | document.getElementById( 'Status' ).innerHTML += '<br>'+'BadWord ('+t_blackwordlist[t_Word]+') in<br>['+t_text+']'; | + | |
+ | if ( t_erg != -1 ) { | ||
+ | document.getElementById( 'Status' ).innerHTML += '<br>'+'BadWord ('+t_blackwordlist[t_Word]+'/Pos: '+t_erg+') in<br>['+t_text+']'; | ||
return true; | return true; | ||
} | } |
Version vom 12. September 2010, 06:42 Uhr
/* -- */ // my_vkdebug = true; addOnloadHook( function () { LoadTemCatGenForm(); }); var t_wikiurl = wgServer + wgScriptPath + '/api.php'; var t_Files = new Array(); var t_FilestoCheck = new Array(); var t_FilesChecked = new Array(); var t_processnext = 0; var t_restartintervall = 120*1000; t_blackwordlist = new Array( 'Ambien', 'angel', 'animal', ' Ass', '_Ass', 'asses', ' big', 'Black', ' Buy ', 'bodybuilding', 'casino', 'Cialis', 'chart', 'cock', 'comment', 'craig', 'credit', 'discount', 'donna', 'embedded', 'etbz', 'evity', 'Exten', 'fire', 'free', 'generic', 'gift', 'girls', 'gym', 'HGH', 'home', 'insurance', 'Levitra', 'life', 'liquid', 'monster', 'movies', 'muscul', 'number', 'online', 'oxycycl', 'Penis', 'pills', 'porn', 'prednis', 'price', 'Propecia', 'Provestra', 'reverse', 'robaxin', 'self', 'sex', 'Smok', 'sparal', 'teens', 'tits', 'Tramadol', 'treatment', 'total', 'valium', 'vimax', 'volume', 'Xanax', 'xtreme', 'young', 'yourself' ); function LoadTemCatGenForm() { if ( document.getElementById( 'InsertcheckRCForm' ) ) { out = '<form method="get" style="width:100%" name="TemCatGenForm">' + '<fieldset><legend>Recentchanges</legend>' + '<div style="margin-top:.5em; margin-left:1em; margin-right:1em;">' + '<p><input type="button" value="Hole RC" ' + 'title="" onClick="CheckRC()"> ' + '</p>' + '<label for="Status" style="vertical-align:top;">Status:</label>' + '<p id="Status" style="border: 1px solid #aaa; padding:.5em;" > ...</p>' + '<div id="PreviewForm"></div>' + '<div id="InsertRCForm"></div>' + '</div></fieldset></form>'; document.getElementById( 'InsertcheckRCForm' ).innerHTML = out; } } function CheckRC() { window.setTimeout( "CheckRC()", t_restartintervall ); var t_parameters = '?action=query&format=json&list=recentchanges&rclimit=50&rctype=new&rcprop=user|comment|flags|timestamp|title|ids|sizes'; 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 = 'RC-Liste wird angefordert ('+GetTimeStamp()+') ...'; } if(t_http_req.readyState == 4 && t_http_req.status == 200) { document.getElementById( 'Status' ).innerHTML = 'RC-Liste erhalten ('+GetTimeStamp()+') ...'; GotRC( eval("(" + t_http_req.responseText + ")"), t_http_req.responseText ); } } t_http_req.send(null); } function GotRC( queryData, rawData ) { t_Files.splice( 0, t_Files.length ); t_FilestoCheck.splice( 0, t_FilestoCheck.length ); t_processnext = 0; if ( queryData.query && queryData.query.recentchanges ) { for ( t_Change = 0; t_Change < queryData.query.recentchanges.length; t_Change++ ) { if ( typeof queryData.query.recentchanges[t_Change].anon != 'undefined' ) { if ( CheckBadWord( queryData.query.recentchanges[t_Change].comment ) ) { var t_File = new Array( queryData.query.recentchanges[t_Change].title, queryData.query.recentchanges[t_Change].revid, queryData.query.recentchanges[t_Change].user, queryData.query.recentchanges[t_Change].comment ); t_Files.push( t_File ); } else { document.getElementById( 'Status' ).innerHTML += '<br>[' + queryData.query.recentchanges[t_Change].title+']'; var t_File = new Array( queryData.query.recentchanges[t_Change].title, queryData.query.recentchanges[t_Change].revid, queryData.query.recentchanges[t_Change].user, queryData.query.recentchanges[t_Change].comment ); t_FilestoCheck.push( t_File ); } } else { } } } if ( t_Files.length == 0 && t_FilestoCheck.length == 0 ) { document.getElementById( 'Status' ).innerHTML += '<br>' + 'Prüfung durchgeführt ('+GetTimeStamp()+')<hr style="margin-top:1em;">'; } else { if ( t_FilestoCheck.length == 0 ) { document.getElementById( 'InsertRCForm' ).innerHTML = '<hr style="margin-top:1em;">('+GetTimeStamp()+')<ul>'; CheckTitles(); } else { PreCheckTitles(); } } } function PreCheckTitles() { t_FilesToCheckString = ''; for ( t_FiletoCheck = 0; t_FiletoCheck < t_FilestoCheck.length; t_FiletoCheck++ ) { if ( t_FilesToCheckString != '' ) { t_FilesToCheckString += '|'; } t_FilesToCheckString += t_FilestoCheck[t_FiletoCheck][0]; } var t_parameters = '?action=query&format=json&prop=revisions&rvprop=ids|timestamp|user|comment|content&titles=' + encodeURIComponent( t_FilesToCheckString ) + ''; 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", CatGenForm.t_wikiurl + t_parameters, true); t_http_req.onreadystatechange = function() { if(t_http_req.readyState != 4) { document.getElementById( 'Status' ).innerHTML += '<br>' + 'Datei-Inhalt wird angefordert ('+GetTimeStamp()+') ...'; } if(t_http_req.readyState == 4 && t_http_req.status == 200) { document.getElementById( 'Status' ).innerHTML += '<br>' + 'Datei-Inhalt erhalten ('+GetTimeStamp()+') ...'; PreCheckTitlesProcess( eval("(" + t_http_req.responseText + ")"), t_http_req.responseText ); } } t_http_req.send(null); } function PreCheckTitlesProcess( queryData, rawData ) { document.getElementById( 'Status' ).innerHTML += '<br>' + rawData; if ( queryData.query && queryData.query.pages ) { for ( var t_Page in queryData.query.pages ) { if ( queryData.query.pages[t_Page].pageid ) { if ( queryData.query.normalized ) { for ( t_PageNorm= 0; t_PageNorm < queryData.query.normalized.length; t_PageNorm++ ) { if ( queryData.query.normalized[t_PageNorm].to == queryData.query.pages[t_Page].title ) { if ( queryData.query.pages[t_Page].revisions ) { if ( CheckBadWord( queryData.query.pages[t_Page].revisions[0]['*'] ) ) { var t_File = new Array( queryData.query.pages[t_Page].title, queryData.query.pages[t_Page].revisions[0].revid, queryData.query.pages[t_Page].revisions[0].user, queryData.query.pages[t_Page].revisions[0]['*'] ); t_Files.push( t_File ); } } } } } else if ( queryData.query.pages[t_Page].revisions ) { document.getElementById( 'Status' ).innerHTML += '<br>' + 'Prüfe Datei-Inhalt ('+GetTimeStamp()+')<br>' + queryData.query.pages[t_Page].revisions[0]['*']; if ( CheckBadWord( queryData.query.pages[t_Page].revisions[0]['*'] ) ) { var t_File = new Array( queryData.query.pages[t_Page].title, queryData.query.pages[t_Page].revisions[0].revid, queryData.query.pages[t_Page].revisions[0].user, queryData.query.pages[t_Page].revisions[0]['*'] ); t_Files.push( t_File ); } } } } } if ( t_Files.length == 0 ) { document.getElementById( 'Status' ).innerHTML += '<br>' + 'Prüfung durchgeführt ('+GetTimeStamp()+')<hr style="margin-top:1em;">'; } else { document.getElementById( 'InsertRCForm' ).innerHTML = '<hr style="margin-top:1em;">('+GetTimeStamp()+')<ul>'; CheckTitles(); } } function CheckTitles() { if ( t_processnext < t_Files.length ) { document.getElementById( 'InsertRCForm' ).innerHTML += '<li>' + t_Files[t_processnext][0]+'<br>'+t_Files[t_processnext][1]+'<br>'+t_Files[t_processnext][2]+'<br>'+t_Files[t_processnext][3] + '</li>'; var t_parameters = '?action=query&format=json&prop=info|revisions&intoken=delete&titles=' + encodeURIComponent( t_Files[t_processnext][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", CatGenForm.t_wikiurl + t_parameters, true); t_http_req.onreadystatechange = function() { if(t_http_req.readyState != 4) { document.getElementById( 'Status' ).innerHTML += '<br>' + 'Datei-Token wird angefordert ('+GetTimeStamp()+') ...'; } if(t_http_req.readyState == 4 && t_http_req.status == 200) { DeleteTitles( eval("(" + t_http_req.responseText + ")"), t_http_req.responseText ); } } t_http_req.send(null); } } function DeleteTitles ( queryData, rawData ) { if ( queryData ) { if ( queryData.query && queryData.query.pages ) { var t_token = ""; var t_timestamp = ""; var t_some_pages = queryData.query.pages; for ( var t_Page in t_some_pages ) { if ( t_some_pages[t_Page].edittoken ) { t_token = encodeURIComponent( t_some_pages[t_Page].edittoken ); } else if ( t_some_pages[t_Page].deletetoken ) { t_token = encodeURIComponent( t_some_pages[t_Page].deletetoken ); } 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 += '<br>' + t_some_pages[t_Page].starttimestamp; } t_summary = '&reason=' + encodeURIComponent( 'automatisch gelöscht' ); var t_parameters = '?action=delete&format=json&title=' + encodeURIComponent( t_some_pages[t_Page].title ) + t_summary + '&watch&basetimestamp=' + t_timestamp + '&token=' + t_token + '&bot=1'; 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", CatGenForm.t_wikiurl + t_parameters, true); t_http_req.onreadystatechange = function() { if( t_http_req.readyState != 4 ) { document.getElementById( 'Status' ).innerHTML += '<br>' + '<small>'+t_some_pages[t_Page].title+'</small><br>wird gelöscht ('+GetTimeStamp()+') ...'; } if( t_http_req.readyState == 4 && t_http_req.status == 200 ) { DeleteTitlesProcessed( eval("(" + t_http_req.responseText + ")" ), t_http_req.responseText ); } } t_http_req.send(null); } } } function CheckUsers() { if ( t_processnext < t_Files.length ) { var t_parameters = '?action=block&format=json&user=' + encodeURIComponent( t_Files[t_processnext][2] ) + '&gettoken'; 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", CatGenForm.t_wikiurl + t_parameters, true); t_http_req.onreadystatechange = function() { if(t_http_req.readyState != 4) { document.getElementById( 'Status' ).innerHTML += '<br>' + 'Benutzer-Token wird angefordert ('+GetTimeStamp()+') ...'; } if(t_http_req.readyState == 4 && t_http_req.status == 200) { BlockUsers( eval("(" + t_http_req.responseText + ")"), t_http_req.responseText ); } } t_http_req.send(null); } } function BlockUsers ( queryData, rawData ) { document.getElementById( 'Status' ).innerHTML += '<br>' + rawData; if ( queryData ) { if ( queryData.block && queryData.block.blocktoken ) { var t_token = queryData.block.blocktoken; var t_parameters = '?action=block&format=json&user=' + encodeURIComponent( t_Files[t_processnext][2] ) + '&reason=' + encodeURIComponent( 'spam (automatisch gesperrt)' ) + '&token=' + encodeURIComponent( t_token ); 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", CatGenForm.t_wikiurl + t_parameters, true); t_http_req.onreadystatechange = function() { if(t_http_req.readyState != 4) { document.getElementById( 'Status' ).innerHTML += '<br>' + 'Benutzer wird gesperrt ('+GetTimeStamp()+') ...'; } if(t_http_req.readyState == 4 && t_http_req.status == 200) { DeleteTitlesProcessed( eval("(" + t_http_req.responseText + ")"), t_http_req.responseText ); } } t_http_req.send(null); } } } function DeleteTitlesProcessed( queryData, rawData ) { if ( queryData['delete'] ) { if ( queryData['delete'].title && queryData['delete'].reason ) { document.getElementById( 'Status' ).innerHTML += '<br>' + queryData['delete'].title + '<br>' + queryData['delete'].reason; t_processnext++; if ( t_processnext < t_Files.length ) { CheckTitles(); } else { t_processnext = 0; CheckUsers(); } } } else if ( queryData['block'] && queryData['block'].user ) { document.getElementById( 'Status' ).innerHTML += '<br>' + queryData['block'].user + ' wurde gesperrt ('+GetTimeStamp()+') '; t_processnext++; if ( t_processnext < t_Files.length ) { CheckUsers(); } } else { document.getElementById( 'Status' ).innerHTML += '<br>Unbekannter Fehler ' + rawData + '<br>('+GetTimeStamp()+')'; } if ( t_processnext >= t_Files.length ) { document.getElementById( 'InsertRCForm' ).innerHTML += '</ul>'; document.getElementById( 'Status' ).innerHTML += '<br>' + 'Prüfung durchgeführt ('+GetTimeStamp()+')<hr style="margin-top:1em;">'; } } function GetTimeStamp() { var t_now = new Date(); t_GetTimeStamp = ('0000'+t_now.getUTCFullYear()).substr(String(t_now.getUTCFullYear()).length,4)+'-'+('00'+(t_now.getUTCMonth()+1)).substr(String((t_now.getUTCMonth()+1)).length,2)+'-'+('00'+t_now.getUTCDate()).substr(String(t_now.getUTCDate()).length,2)+'T'+ ('00'+t_now.getUTCHours()).substr(String(t_now.getUTCHours()).length,2)+':'+('00'+t_now.getUTCMinutes()).substr(String(t_now.getUTCMinutes()).length,2)+':'+('00'+t_now.getUTCSeconds()).substr(String(t_now.getUTCSeconds()).length,2)+'Z'; return t_GetTimeStamp; } function CheckBadWord( t_text ) { if ( t_text ) { for ( t_Word = 0; t_Word < t_blackwordlist.length; t_Word++ ) { t_erg = String( t_text.toUpperCase() ).indexOf( String( t_blackwordlist[t_Word]).toUpperCase() ); if ( t_erg != -1 ) { document.getElementById( 'Status' ).innerHTML += '<br>'+'BadWord ('+t_blackwordlist[t_Word]+'/Pos: '+t_erg+') in<br>['+t_text+']'; return true; } } return false; } }