Benutzer:WWWIG/monobook.js: Unterschied zwischen den Versionen
Zur Navigation springen
Zur Suche springen
WWWIG (Diskussion | Beiträge) Keine Bearbeitungszusammenfassung |
WWWIG (Diskussion | Beiträge) Keine Bearbeitungszusammenfassung |
||
| Zeile 1: | Zeile 1: | ||
/* -- */ | /* -- */ | ||
// my_vkdebug = true; | // my_vkdebug = true; | ||
addOnloadHook( function () { | |||
LoadTemCatGenForm(); | |||
}); | |||
var t_wikiurl = wgServer + wgScriptPath + '/api.php'; | |||
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;height:75px;" > ...</p>' + | |||
'<div id="PreviewForm"></div>' + | |||
'<div id="InsertRCForm"></div>' + | |||
'</div></fieldset></form>'; | |||
document.getElementById( 'InsertcheckRCForm' ).innerHTML = out; | |||
} | |||
} | |||
function CheckRC() { | |||
var t_parameters = '?action=query&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 ...'; | |||
} | |||
if(t_http_req.readyState == 4 && t_http_req.status == 200) { | |||
document.getElementById('Status').innerHTML = t_http_req.responseText; | |||
GotRC( eval("(" + t_http_req.responseText + ")"), t_http_req.responseText ); | |||
} | |||
} | |||
t_http_req.send(null); | |||
} | |||
function GotRC( queryData, rawData ) { | |||
document.getElementById( 'InsertRCForm' ).innerHTML = '<hr style="margin-top:1em;"><ul>'; | |||
if ( queryData.query && queryData.query.recentchanges ) { | |||
for ( var t_Change in queryData.query.recentchanges ) { | |||
if ( typeof queryData.query.recentchanges[t_Change].anon != 'undefined' ) { | |||
document.getElementById( 'InsertRCForm' ).innerHTML += '<li>' + queryData.query.recentchanges[t_Change].title + '</li>'; | |||
} else { | |||
document.getElementById( 'InsertRCForm' ).innerHTML += '<li>' + '--' + '</li>'; | |||
} | |||
} | |||
} | |||
document.getElementById( 'InsertRCForm' ).innerHTML += '</ul>'; | |||
} | |||
Version vom 11. September 2010, 09:16 Uhr
/* -- */
// my_vkdebug = true;
addOnloadHook( function () {
LoadTemCatGenForm();
});
var t_wikiurl = wgServer + wgScriptPath + '/api.php';
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;height:75px;" > ...</p>' +
'<div id="PreviewForm"></div>' +
'<div id="InsertRCForm"></div>' +
'</div></fieldset></form>';
document.getElementById( 'InsertcheckRCForm' ).innerHTML = out;
}
}
function CheckRC() {
var t_parameters = '?action=query&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 ...';
}
if(t_http_req.readyState == 4 && t_http_req.status == 200) {
document.getElementById('Status').innerHTML = t_http_req.responseText;
GotRC( eval("(" + t_http_req.responseText + ")"), t_http_req.responseText );
}
}
t_http_req.send(null);
}
function GotRC( queryData, rawData ) {
document.getElementById( 'InsertRCForm' ).innerHTML = '<hr style="margin-top:1em;"><ul>';
if ( queryData.query && queryData.query.recentchanges ) {
for ( var t_Change in queryData.query.recentchanges ) {
if ( typeof queryData.query.recentchanges[t_Change].anon != 'undefined' ) {
document.getElementById( 'InsertRCForm' ).innerHTML += '<li>' + queryData.query.recentchanges[t_Change].title + '</li>';
} else {
document.getElementById( 'InsertRCForm' ).innerHTML += '<li>' + '--' + '</li>';
}
}
}
document.getElementById( 'InsertRCForm' ).innerHTML += '</ul>';
}