MediaWiki:Gadget-CatGenRepairForm.js
Zur Navigation springen
Zur Suche springen
Hinweis: Leere nach dem Speichern 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
- Internet Explorer: Strg+F5 drücken oder Strg drücken und gleichzeitig Aktualisieren anklicken
- Opera: Gehe zu Menü → Einstellungen (Opera → Einstellungen auf dem Mac) und dann auf Datenschutz & Sicherheit → Browserdaten löschen → Gespeicherte Bilder und Dateien.
/* ------------------------------------------------ */
/* Script zum Erstellen von Vorlagen und Kategorien */
/* ------------------------------------------------ */
addOnloadHook( function () {
if ( window.wgUserGroups ) {
for ( var i = 0; i < wgUserGroups.length; i++ ) {
if ( wgUserGroups[i] === 'sysop' || wgUserGroups[i] === 'bot' ) {
InsertNode("javascript:CatGenRepairForm.LoadCatGenRepairForm()", "Ergänzungen", TW_WERKZEUGE, "ul");
break;
}
}
}
});
var CatGenRepairForm = {
t_Sprachen : new Array('it'),
t_Typen : new Array('Uhrenmodelle','Uhrwerke','Archiv','Porträt','Gebäude','Marken und Warenzeichen','Werkzeuge'),
InitLanguageVars : function () {
CatGenRepairForm.t_VorlagenTexte['de'] = 'Kategorie Bildgalerie ';
CatGenRepairForm.t_VorlagenTexte['it'] = 'Categoria galleria fotografica ';
CatGenRepairForm.t_KategorienTexte['de'] = 'Bildgalerie ';
CatGenRepairForm.t_KategorienTexte['it'] = 'Galleria fotografica ';
CatGenRepairForm.t_TypTexte['Uhrenmodelle_de'] = 'Uhrenmodelle ';
CatGenRepairForm.t_TypTexte['Uhrenmodelle_it'] = 'di modelli orologi ';
CatGenRepairForm.t_TypTexte['Uhrwerke_de'] = 'Uhrwerke ';
CatGenRepairForm.t_TypTexte['Uhrwerke_it'] = 'di movimento degli orologi ';
CatGenRepairForm.t_TypTexte['Archiv_de'] = 'Archiv ';
CatGenRepairForm.t_TypTexte['Archiv_it'] = 'di Archivio ';
CatGenRepairForm.t_VorlagenKategorie['de'] = 'Vorlagen';
CatGenRepairForm.t_VorlagenKategorie['it'] = 'Template';
},
StartRepairCreatingVKFiles : function () {
setcursor( 'wait' );
CatGenRepairForm.t_Files.splice( 0, CatGenRepairForm.t_Files.length );
CatGenRepairForm.t_processnext = 0;
CatGenRepairForm.t_stopp = false;
for ( t_HerstellerNr = 1; t_HerstellerNr <= document.getElementById('Limit').value; t_HerstellerNr++ ) {
for ( t_Sprache = 0; t_Sprache < CatGenRepairForm.t_Sprachen.length; t_Sprache++ ) {
t_FileV = document.getElementById( 'FileV' + CatGenRepairForm.t_Sprachen[t_Sprache] + t_HerstellerNr );
t_InhaltV = document.getElementById( 'InhaltV' + CatGenRepairForm.t_Sprachen[t_Sprache] + t_HerstellerNr );
if ( t_FileV && t_InhaltV ) {
var t_File = new Array( t_FileV.getElementsByTagName("A")[0].innerHTML, t_InhaltV.innerHTML, t_FileV.getElementsByTagName("A")[0].className );
if ( t_FileV.getElementsByTagName("A")[0].className == 'new' || document.getElementById('Overwrite').checked ) {
CatGenRepairForm.t_Files.push( t_File );
}
}
}
for ( t_Sprache = 0; t_Sprache < CatGenRepairForm.t_Sprachen.length; t_Sprache++ ) {
t_FileK = document.getElementById( 'FileK' + CatGenRepairForm.t_Sprachen[t_Sprache] + t_HerstellerNr );
t_InhaltK = document.getElementById( 'InhaltK' + CatGenRepairForm.t_Sprachen[t_Sprache] + t_HerstellerNr );
if ( t_FileK && t_InhaltK ) {
var t_File = new Array( t_FileK.getElementsByTagName("A")[0].innerHTML, t_InhaltK.innerHTML, t_FileK.getElementsByTagName("A")[0].className );
if ( t_FileK.getElementsByTagName("A")[0].className == 'new' || document.getElementById('Overwrite').checked ) {
CatGenRepairForm.t_Files.push( t_File );
}
}
}
}
if ( CatGenRepairForm.t_Files.length == 0 ) {
CatGenRepairForm.PreCheckRepairPreviewVFiles();
} else {
CatGenRepairForm.ProcessingRepairVKFile( 'edit' );
}
},
ProcessingRepairVKFile : function ( t_action ) {
if ( CatGenRepairForm.t_processnext < CatGenRepairForm.t_Files.length ) {
var t_parameters = '?action=query&format=json&prop=info|revisions&intoken=' + t_action + '&titles=' +
encodeURIComponent( CatGenRepairForm.t_Files[CatGenRepairForm.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", CatGenRepairForm.t_wikiurl + t_parameters, true);
t_http_req.onreadystatechange = function() {
if(t_http_req.readyState != 4) {
document.getElementById( 'Status' ).innerHTML = 'Token wird angefordert ...<br><small>' +
CatGenRepairForm.t_Files[CatGenRepairForm.t_processnext][0] + '</small>';
}
if(t_http_req.readyState == 4 && t_http_req.status == 200) {
if ( CatGenRepairForm.t_vkdebug ) {
document.getElementById( 'StatusPrev' ).innerHTML += '<hr>ProcessingRepairVKFile<br>' + t_http_req.responseText;
}
CatGenRepairForm.GotToken( eval("(" + t_http_req.responseText + ")"), t_action );
}
}
t_http_req.send(null);
}
},
GotToken : function ( queryData, t_action ) {
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 = t_some_pages[t_Page].starttimestamp;
}
t_text = CatGenRepairForm.t_Files[CatGenRepairForm.t_processnext][1];
t_text = t_text.replace(/</g, "<");
t_text = t_text.replace(/>/g, ">");
t_text = t_text.replace(/&/g, "&");
t_summary = document.getElementById('Summary').getAttribute('value');
t_summarymsg = t_summary;
t_summary = '&summary=' + encodeURIComponent( t_summary );
if ( t_action == 'delete' ) {
t_summary = 'automatisch gelöscht';
t_summarymsg = t_summary;
t_summary = '&reason=' + encodeURIComponent( t_summary );
}
var t_parameters = '?action=' + t_action + '&format=json&title=' + encodeURIComponent( t_some_pages[t_Page].title ) +
t_summary + '&watch&basetimestamp=' + t_timestamp +
'&token=' + t_token + '&bot=1&minor=1' + '&text=' + encodeURIComponent( t_text );
if ( !document.getElementById('Overwrite').checked ) {
t_parameters += '&createonly';
}
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", CatGenRepairForm.t_wikiurl + t_parameters, true);
t_http_req.onreadystatechange = function() {
if( t_http_req.readyState != 4 ) {
if ( t_action == 'edit' ) {
document.getElementById( 'Status' ).innerHTML =
'<small>'+t_some_pages[t_Page].title+'</small><br>wird mit<br><small>' +
CatGenRepairForm.t_Files[CatGenRepairForm.t_processnext][1] +
'</small><br>geschrieben <small>(' + t_summarymsg + ')</small> ...';
} else
if ( t_action == 'delete' ) {
document.getElementById( 'Status' ).innerHTML =
'<small>'+t_some_pages[t_Page].title+'</small><br>wird gelöscht <small>(' + t_summarymsg + ')</small> ...';
} }
if( t_http_req.readyState == 4 && t_http_req.status == 200 ) {
if ( CatGenRepairForm.t_vkdebug ) {
document.getElementById( 'StatusPrev' ).innerHTML +=
'<hr>GotToken<br>' + t_http_req.responseText;
}
CatGenRepairForm.ProcessedRepairVKFile( eval("(" + t_http_req.responseText + ")" ), t_http_req.responseText, t_action );
}
}
t_http_req.send(null);
}
}
},
ProcessedRepairVKFile : function ( queryData, rawData, t_action ) {
if ( queryData.edit && queryData.edit.result ) {
document.getElementById( 'Status' ).innerHTML = queryData.edit.result;
if ( CatGenRepairForm.t_stopp ) {
document.getElementById( 'Status' ).innerHTML = "Auf Benutzerwunsch abgebrochen - eine neue Vorschau wird erstellt ...";
CatGenRepairForm.PreCheckRepairPreviewVFiles();
} else {
CatGenRepairForm.t_processnext++;
if ( CatGenRepairForm.t_processnext < CatGenRepairForm.t_Files.length ) {
CatGenRepairForm.ProcessingRepairVKFile( t_action );
} else {
if ( queryData.edit.result == 'Success' ) {
document.getElementById( 'Status' ).innerHTML = "BEENDET - neue Vorschau wird erstellt ...";
CatGenRepairForm.PreCheckRepairPreviewVFiles();
} else {
document.getElementById( 'Status' ).innerHTML = 'Unbekannter Fehler ' + queryData.edit.result;
}
}
}
} else if ( queryData['delete'] ) {
if ( queryData['delete'].title && queryData['delete'].reason )
document.getElementById( 'Status' ).innerHTML = queryData['delete'].title + '<br>' + queryData['delete'].reason;
if ( CatGenRepairForm.t_stopp ) {
document.getElementById( 'Status' ).innerHTML = "Auf Benutzerwunsch abgebrochen - eine neue Vorschau wird erstellt ...";
CatGenRepairForm.PreCheckRepairPreviewVFiles();
} else {
CatGenRepairForm.t_processnext++;
if ( CatGenRepairForm.t_processnext < CatGenRepairForm.t_Files.length ) {
CatGenRepairForm.ProcessingRepairVKFile( t_action );
} else {
document.getElementById( 'Status' ).innerHTML = "BEENDET - neue Vorschau wird erstellt ...";
CatGenRepairForm.PreCheckRepairPreviewVFiles();
}
}
} else if ( queryData.error && queryData.error.code && queryData.error.info ) {
if ( queryData.error.code == 'articleexists' && !document.getElementById('Overwrite').getAttribute('checked') ) {
if ( CatGenRepairForm.t_stopp ) {
document.getElementById( 'Status' ).innerHTML = "Auf Benutzerwunsch abgebrochen - eine neue Vorschau wird erstellt ...";
CatGenRepairForm.PreCheckRepairPreviewVFiles();
} else {
CatGenRepairForm.t_processnext++;
if ( CatGenRepairForm.t_processnext < CatGenRepairForm.t_Files.length ) {
CatGenRepairForm.ProcessingRepairVKFile( t_action );
} else {
document.getElementById( 'Status' ).innerHTML = "BEENDET - eine neue Vorschau wird erstellt ...";
CatGenRepairForm.PreCheckRepairPreviewVFiles();
}
}
} else {
document.getElementById( 'Status' ).innerHTML = 'Fehler ' + queryData.error.code + ' - ' + queryData.error.info;
}
} else {
document.getElementById( 'Status' ).innerHTML = 'Unbekannter Fehler ' + rawData;
}
},
/* ############################## */
PreCheckRepairPreviewVFiles : function () {
if ( document.getElementById('TypSel').value + '' == '' ) {
t_msg2 = 'Es ist kein Typ gewählt!';
document.getElementById( 'PreviewForm' ).innerHTML = t_msg2;
return;
}
CatGenRepairForm.t_vkdebug = document.getElementById('Debugging').checked;
CatGenRepairForm.InitLanguageVars();
document.getElementById( 'PreviewForm' ).innerHTML = '<hr style="margin-top:1em;">' + '<b>Hole Kategorienliste:</b><p id="PreviewSubForm"></p>';
document.getElementById( 'StatusPrev' ).innerHTML = '';
document.getElementById( 'TemplateForm' ).innerHTML = '';
document.getElementById( 'InsertCreateForm' ).innerHTML = '';
t_FilesToCheckString = CatGenRepairForm.t_VorlagenTexte['de'] + document.getElementById('TypSel').value;
var t_parameters = '?action=query&generator=search&format=json&gsrnamespace=10&gsrlimit='+document.getElementById('Limit').value+'&gsroffset='+document.getElementById('Offset').value+'&gsrsearch=' + 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("POST", CatGenRepairForm.t_wikiurl + t_parameters, true);
t_http_req.onreadystatechange = function() {
if(t_http_req.readyState != 4) {
if ( t_FilesToCheckString != '' ) {
document.getElementById( 'PreviewSubForm' ).style.height = '75px';
document.getElementById( 'PreviewSubForm' ).style.overflow = 'auto';
document.getElementById( 'PreviewSubForm' ).scrollTop = 1000;
document.getElementById( 'PreviewSubForm' ).innerHTML += String(t_FilesToCheckString).replace(/\|/g, "<br>") + '<br>';
t_FilesToCheckString = '';
}
}
if(t_http_req.readyState == 4 && t_http_req.status == 200) {
if ( CatGenRepairForm.t_vkdebug ) {
document.getElementById( 'StatusPrev' ).style.display = 'block';
document.getElementById( 'StatusPrev' ).innerHTML += '<hr>' + t_http_req.responseText;
}
CatGenRepairForm.CheckRepairPreviewVFiles( eval("(" + t_http_req.responseText + ")") );
}
}
t_http_req.send(null);
},
CheckRepairPreviewVFiles : function ( queryData, rawData, t_clear ) {
if ( document.getElementById( 'InsertCreateForm' ) ) {
if ( document.getElementById( 'PreviewForm' ) ) {
document.getElementById( 'PreviewForm' ).innerHTML = '';
}
if ( document.getElementById( 'TemplateForm' ) ) {
document.getElementById( 'TemplateForm' ).innerHTML = '';
}
if ( document.getElementById( 'InsertCreateForm' ) && document.getElementById( 'Status' ) ) {
document.getElementById( 'InsertCreateForm' ).innerHTML = '<b>' + document.getElementById( 'Status' ).innerHTML + '</b>';
}
if ( document.getElementById( 'InsertCreateForm' ) && t_clear == 'c' ) {
document.getElementById( 'InsertCreateForm' ).innerHTML = '';
}
setcursor( 'wait' );
CatGenRepairForm.t_Files.splice( 0, CatGenRepairForm.t_Files.length );
CatGenRepairForm.t_HerstellerListe.splice( 0, CatGenRepairForm.t_HerstellerListe.length );
if ( queryData['query-continue'] && queryData['query-continue'].search.gsroffset ) {
document.getElementById( 'Offset' ).value = queryData['query-continue'].search.gsroffset;
} else {
document.getElementById( 'Offset' ).value = '0';
}
t_pagecount = 0;
if ( queryData.query && queryData.query.pages ) {
for ( var t_Page in queryData.query.pages ) {
if ( queryData.query.pages[t_Page].pageid ) {
t_pagecount++;
t_HerstellerPreviewReplace = "Vorlage:" + CatGenRepairForm.t_VorlagenTexte['de'] + document.getElementById('TypSel').value + " ";
CatGenRepairForm.t_HerstellerPreview = queryData.query.pages[t_Page].title.replace(t_HerstellerPreviewReplace, "");
CatGenRepairForm.t_HerstellerListe.push( CatGenRepairForm.t_HerstellerPreview );
CatGenRepairForm.t_TypPreview = document.getElementById( 'TypSel' ).value;
for ( var t_Page in CatGenRepairForm.t_FilesChecked ) {
if ( CatGenRepairForm.t_FilesChecked[t_Page] == 'class="new" ' ) {
CatGenRepairForm.t_FilesChecked[t_Page] = '';
}
}
t_Typ = document.getElementById('TypSel').value;
for ( t_Sprache = 0; t_Sprache < CatGenRepairForm.t_Sprachen.length; t_Sprache++ ) {
t_Hersteller = CatGenRepairForm.t_HerstellerPreview;
t_Vorlagebezeichner = CatGenRepairForm.t_VorlagenTexte[CatGenRepairForm.t_Sprachen[t_Sprache]] +
CatGenRepairForm.t_TypTexte[t_Typ+'_'+CatGenRepairForm.t_Sprachen[t_Sprache]];
t_Zielbezeichner = trim('Vorlage:' + t_Vorlagebezeichner + t_Hersteller);
CatGenRepairForm.t_Files.push( t_Zielbezeichner);
}
t_Hersteller = CatGenRepairForm.t_HerstellerPreview;
t_Vorlagebezeichner = CatGenRepairForm.t_VorlagenTexte['de'] +
CatGenRepairForm.t_TypTexte[t_Typ+'_'+'de'];
t_Zielbezeichner = trim('Vorlage:' + t_Vorlagebezeichner + t_Hersteller);
CatGenRepairForm.t_Files.push( t_Zielbezeichner);
for ( t_Sprache = 0; t_Sprache < CatGenRepairForm.t_Sprachen.length; t_Sprache++ ) {
t_Hersteller = CatGenRepairForm.t_HerstellerPreview;
t_Kategoriebezeichner = CatGenRepairForm.t_KategorienTexte[CatGenRepairForm.t_Sprachen[t_Sprache]] +
CatGenRepairForm.t_TypTexte[t_Typ+'_'+CatGenRepairForm.t_Sprachen[t_Sprache]];
t_Zielbezeichner = trim('Kategorie:' + t_Kategoriebezeichner + t_Hersteller);
CatGenRepairForm.t_Files.push( t_Zielbezeichner);
}
t_Hersteller = CatGenRepairForm.t_HerstellerPreview;
t_Kategoriebezeichner = CatGenRepairForm.t_KategorienTexte['de'] +
CatGenRepairForm.t_TypTexte[t_Typ+'_'+'de'];
t_Zielbezeichner = trim('Kategorie:' + t_Kategoriebezeichner + t_Hersteller);
CatGenRepairForm.t_Files.push( t_Zielbezeichner);
}
}
}
if (t_pagecount == 0) {
document.getElementById( 'PreviewForm' ).innerHTML = '<hr style="margin-top:1em;">' + '<b>Keine Artikel gefunden</b><p id="PreviewSubForm"></p>';
// return;
}
t_Vorlagebezeichner = 'Bildgalerie '+t_Typ+' XXX Sprachen';
t_Zielbezeichner = trim('Vorlage:' + t_Vorlagebezeichner );
CatGenRepairForm.t_Files.push( t_Zielbezeichner);
for ( t_Sprache = 0; t_Sprache < CatGenRepairForm.t_Sprachen.length; t_Sprache++ ) {
t_Vorlagebezeichner = CatGenRepairForm.t_KategorienTexte[CatGenRepairForm.t_Sprachen[t_Sprache]] +
CatGenRepairForm.t_TypTexte[t_Typ+'_'+CatGenRepairForm.t_Sprachen[t_Sprache]];
t_Zielbezeichner = trim('Vorlage:Kategoriebeschreibung ' + t_Vorlagebezeichner + ' XXX' );
CatGenRepairForm.t_Files.push( t_Zielbezeichner);
}
document.getElementById( 'PreviewForm' ).innerHTML = '<hr style="margin-top:1em;">' + '<b>Vorschau wird erstellt für:</b><p id="PreviewSubForm"></p>';
CatGenRepairForm.ProcessingRepairPreviewFile();
}
},
ProcessingRepairPreviewFile : function ( ) {
var t_FilesToCheckString;
if ( CatGenRepairForm.t_Files.length > 0 ) {
t_FilesToCheckString = CatGenRepairForm.t_Files.splice( 0, 1 );
}
if ( CatGenRepairForm.t_Files.length > 0 ) {
t_FilesToCheckString += '|';
t_FilesToCheckString += CatGenRepairForm.t_Files.splice( 0, 1 );
}
if ( CatGenRepairForm.t_Files.length > 0 ) {
t_FilesToCheckString += '|';
t_FilesToCheckString += CatGenRepairForm.t_Files.splice( 0, 1 );
}
var t_parameters = '?action=query&format=json&prop=info|revisions&rvprop=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("POST", CatGenRepairForm.t_wikiurl + t_parameters, true);
t_http_req.onreadystatechange = function() {
if(t_http_req.readyState != 4) {
if ( t_FilesToCheckString != '' ) {
document.getElementById( 'PreviewSubForm' ).style.height = '75px';
document.getElementById( 'PreviewSubForm' ).style.overflow = 'auto';
document.getElementById( 'PreviewSubForm' ).scrollTop = 1000;
document.getElementById( 'PreviewSubForm' ).innerHTML += String(t_FilesToCheckString).replace(/\|/g, "<br>") + '<br>';
t_FilesToCheckString = '';
}
}
if(t_http_req.readyState == 4 && t_http_req.status == 200) {
if ( CatGenRepairForm.t_vkdebug ) {
document.getElementById( 'StatusPrev' ).style.display = 'block';
document.getElementById( 'StatusPrev' ).innerHTML += '<hr>' + t_http_req.responseText;
}
CatGenRepairForm.ProcessedRepairPreviewFile( eval("(" + t_http_req.responseText + ")") );
}
}
t_http_req.send(null);
},
ProcessedRepairPreviewFile : function ( queryData, 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 ) {
CatGenRepairForm.t_FilesChecked[decodeURIComponent( queryData.query.normalized[t_PageNorm].from )] = 'class="new" ';
}
}
}
CatGenRepairForm.t_FilesChecked[decodeURIComponent(queryData.query.pages[t_Page].title)] = 'class="new" ';
} else {
CatGenRepairForm.t_FilesChecked[decodeURIComponent(queryData.query.pages[t_Page].title)] = '';
if ( queryData.query.pages[t_Page].revisions ) {
CatGenRepairForm.t_FilesContentChecked[decodeURIComponent(queryData.query.pages[t_Page].title)] =
queryData.query.pages[t_Page].revisions[0]['*'];
}
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 ) {
CatGenRepairForm.t_FilesContentChecked[decodeURIComponent( queryData.query.normalized[t_PageNorm].from )] =
queryData.query.pages[t_Page].revisions[0]['*'];
}
}
}
}
}
}
}
if ( CatGenRepairForm.t_Files.length > 0 ) {
CatGenRepairForm.ProcessingRepairPreviewFile();
} else {
CatGenRepairForm.PreviewRepairVKFiles();
}
},
PreviewRepairVKFiles: function () {
if ( document.getElementById( 'PreviewForm' ) ) {
document.getElementById( 'PreviewForm' ).innerHTML = '<hr style="margin-top:1em;">' + CatGenRepairForm.CreateRepairPreview() + '';
}
if ( document.getElementById( 'TemplateForm' ) ) {
document.getElementById( 'TemplateForm' ).innerHTML = '<hr style="margin-top:1em;">' + CatGenRepairForm.CreateRepairTemplatePreview() + '';
}
document.getElementById( 'InsertCreateForm' ).innerHTML =
'<hr style="margin-top:1em; margin-right:.5em;"><div style="margin-top:.5em; margin-right:1em;">' +
'<h3>Erstellen</h3>' +
'<label for="Summary" style="vertical-align:top">Zusammenfassung / Kommentar:</label>' +
'<p><input id="Summary" type="text" size="75" value="Mit neuer Vorlage automatisch erstellt"></p>' +
'<label for="Status" style="vertical-align:top;">Status:</label>' +
'<p id="Status" style="border: 1px solid #aaa; padding:.5em;height:75px;" >Vor dem Erstellen der Vorlagen und Kategorien bitte die Namen und Inhalte überprüfen ...</p>' +
'<p><input type="button" title="Erstellt die Vorlagen und Kategorien gemäß der Vorschau mit den angezeigten Inhalten" ' +
'value="Erstellen" onClick="StartRepairCreatingVKFiles()"> ' +
'<input type="button" value="Abbrechen" title="Die Abarbeitung der Erstellung und des Löschens von Vorlagen und Kategorien wird unterbrochen" ' +
'onClick="StopRepairProcessingVKFiles()">' +
'<input type="button" value="Löschen" style="float:right;" title="Löscht die Vorlagen und Kategorien gemäß der Vorschau" ' +
'onClick="StartRepairDeletingVKFiles()">' +
'</p></div>';
setcursor( 'auto' );
},
CreateRepairTemplatePreview : function () {
var out = '';
t_Typ = document.getElementById('TypSel').value;
out += '<h3>Verwendete Vorlagen (werden <u>nicht</u> automatisch erstellt)</h3>';
t_Vorlagebezeichner = 'Bildgalerie '+t_Typ+' XXX Sprachen';
t_Zielbezeichner = trim('Vorlage:' + t_Vorlagebezeichner );
t_ZielbezeichnerUrl = t_Zielbezeichner;
t_missingText = '';
t_missingText = CatGenRepairForm.t_FilesChecked[t_Zielbezeichner];
out += '<ul><li><span id="Vorlage_Sprachen">' +
'<a href="'+wgScriptPath+'/index.php?title=' + t_ZielbezeichnerUrl + '" '+ t_missingText + 'title="' + t_ZielbezeichnerUrl + '">' +
t_Zielbezeichner + '</a></span></li></ul>';
for ( t_Sprache = 0; t_Sprache < CatGenRepairForm.t_Sprachen.length; t_Sprache++ ) {
t_Vorlagebezeichner = CatGenRepairForm.t_KategorienTexte[CatGenRepairForm.t_Sprachen[t_Sprache]] + CatGenRepairForm.t_TypTexte[t_Typ+'_'+CatGenRepairForm.t_Sprachen[t_Sprache]];
t_Zielbezeichner = trim('Vorlage:Kategoriebeschreibung ' + t_Vorlagebezeichner + 'XXX' );
t_ZielbezeichnerUrl = t_Zielbezeichner;
t_missingText = '';
t_missingText = CatGenRepairForm.t_FilesChecked[t_Zielbezeichner];
out += '<ul><li><span id="Vorlage_' + CatGenRepairForm.t_Sprachen[t_Sprache] + '">' +
'<a href="'+wgScriptPath+'/index.php?title=' + t_ZielbezeichnerUrl + '" '+ t_missingText + 'title="' + t_ZielbezeichnerUrl + '">' +
t_Zielbezeichner + '</a></span></li></ul>';
}
return out;
},
CreateRepairPreview : function () {
var out = '';
var out2 = '';
var t_HerstellerNr = 0;
var t_Sprachenparameter = '';
out = '<h3>Vorschau Kategorievorlagen</h3>';
out2 = '<h3>Vorschau Kategorien</h3>';
t_Typ = document.getElementById('TypSel').value;
while ( CatGenRepairForm.t_HerstellerListe.length > 0 ) {
t_HerstellerPreview = CatGenRepairForm.t_HerstellerListe.splice( 0, 1 );
t_HerstellerNr++;
for ( t_Sprache = 0; t_Sprache < CatGenRepairForm.t_Sprachen.length; t_Sprache++ ) {
t_Hersteller = t_HerstellerPreview;
t_Vorlagebezeichner = CatGenRepairForm.t_VorlagenTexte[CatGenRepairForm.t_Sprachen[t_Sprache]] + CatGenRepairForm.t_TypTexte[t_Typ+'_'+CatGenRepairForm.t_Sprachen[t_Sprache]];
t_Vorlagebezeichner_de = CatGenRepairForm.t_VorlagenTexte['de'] + CatGenRepairForm.t_TypTexte[t_Typ+'_'+'de'];
t_Zielbezeichner = trim('Vorlage:' + t_Vorlagebezeichner + t_Hersteller);
t_Zielbezeichner_de = trim('Vorlage:' + t_Vorlagebezeichner_de + t_Hersteller);
t_ZielbezeichnerUrl = t_Zielbezeichner;
t_Sprachenparameter = String( CatGenRepairForm.t_FilesContentChecked[t_Zielbezeichner_de] ).replace("<includeonly>{{Bildgalerie "+t_Typ+" XXX Sprachen","").replace("}}</includeonly><noinclude>[[Kategorie" + ":" + "Vorlagen|" + t_Hersteller + "]]</noinclude>","");
if ( t_Sprachenparameter == '' || t_Sprachenparameter == 'undefined' || t_Sprachenparameter.indexOf( '|' ) != 0 ) {
continue;
}
t_missingText = '';
t_missingText = CatGenRepairForm.t_FilesChecked[t_Zielbezeichner];
CatGenRepairForm.t_FilesChecked[t_Zielbezeichner] = '';
t_Hersteller = String(t_Hersteller).replace(/&/g, "&");
t_Inhalt = '<includeonly>{{Bildgalerie '+t_Typ+' XXX Sprachen' +
t_Sprachenparameter + '}}</includeonly><noinclude>[[Kategorie' + ':' +
CatGenRepairForm.t_VorlagenKategorie[CatGenRepairForm.t_Sprachen[t_Sprache]] +'|' + t_Hersteller + ']]</noinclude>';
t_identText = '';
if ( (t_Inhalt.replace(/</g, "<").replace(/>/g, ">").replace(/&/g, "&")) == CatGenRepairForm.t_FilesContentChecked[t_Zielbezeichner] ) {
t_identText = ' (<span style="color:green;font-size:180%;" title="Inhalt ist bereits aktuell">✔</span>)';
CatGenRepairForm.t_FilesContentChecked[t_Zielbezeichner] = '';
} else
if ( t_missingText == '' && CatGenRepairForm.t_FilesContentChecked[t_Zielbezeichner] ) {
t_oldContent = encodeURIComponent( CatGenRepairForm.t_FilesContentChecked[t_Zielbezeichner] );
t_oldContent = t_oldContent.replace(/\'/g, '&apos;');
t_identText = ' (<span style="color:red;font-size:180%;" ' +
'onmouseover="tippon('+"'"+t_oldContent+"'"+')" onmouseout="tippoff()">✘</span>)';
}
t_Zielbezeichner = t_Zielbezeichner.replace(/&/g, "&");
t_ZielbezeichnerUrl = encodeURIComponent( t_ZielbezeichnerUrl );
out += '<ul><li><span id="FileV' + CatGenRepairForm.t_Sprachen[t_Sprache] + t_HerstellerNr + '">' +
'<a href="'+wgScriptPath+'/index.php?title=' + t_ZielbezeichnerUrl + '" ' +
t_missingText + 'title="' + t_ZielbezeichnerUrl + '">' +
t_Zielbezeichner + '</a></span>' + t_identText + '</li></ul>';
out += '<dl><dd><span id="InhaltV' + CatGenRepairForm.t_Sprachen[t_Sprache] + t_HerstellerNr + '">' + t_Inhalt + '</span></dd></dl>';
}
for ( t_Sprache = 0; t_Sprache < CatGenRepairForm.t_Sprachen.length; t_Sprache++ ) {
t_Hersteller = t_HerstellerPreview;
t_Buchstabenparameter = '';
t_Kategoriebezeichner = CatGenRepairForm.t_KategorienTexte[CatGenRepairForm.t_Sprachen[t_Sprache]] +
CatGenRepairForm.t_TypTexte[t_Typ+'_'+CatGenRepairForm.t_Sprachen[t_Sprache]];
t_Kategoriebezeichner_de = CatGenRepairForm.t_KategorienTexte['de'] +
CatGenRepairForm.t_TypTexte[t_Typ+'_'+'de'];
t_Zielbezeichner = trim('' + t_Kategoriebezeichner + t_Hersteller);
t_Zielbezeichner_de = trim('' + t_Kategoriebezeichner_de + t_Hersteller);
t_ZielbezeichnerUrl = t_Zielbezeichner;
t_Buchstabenparameter = String( CatGenRepairForm.t_FilesContentChecked['Kategorie:' + t_Zielbezeichner_de] ).replace("{" + "{Kategoriebeschreibung " + t_Kategoriebezeichner_de + "XXX","").replace("}}","");
if ( t_Buchstabenparameter == '' || t_Buchstabenparameter == 'undefined' || t_Buchstabenparameter.indexOf( '|' ) != 0 ) {
continue;
}
t_missingText = '';
t_missingText = CatGenRepairForm.t_FilesChecked['Kategorie:' + t_Zielbezeichner];
CatGenRepairForm.t_FilesChecked['Kategorie:' + t_Zielbezeichner] = '';
t_Inhalt = '{' + '{Kategoriebeschreibung ' + t_Kategoriebezeichner + 'XXX' + t_Buchstabenparameter + '}}';
t_identText = '';
if ( CatGenRepairForm.t_vkdebug ) {
document.getElementById( 'StatusPrev' ).innerHTML += '<hr>' + 'FilesContentChecked<br>' +
encodeURIComponent( CatGenRepairForm.t_FilesContentChecked['Kategorie:' + t_Zielbezeichner] ) + '<br>' +
encodeURIComponent( t_Inhalt.replace(/</g, "<").replace(/>/g, ">").replace(/&/g, "&") );
}
if ( (t_Inhalt.replace(/</g, "<").replace(/>/g, ">").replace(/&/g, "&")) == CatGenRepairForm.t_FilesContentChecked['Kategorie:' + t_Zielbezeichner] ) {
if ( CatGenRepairForm.t_vkdebug ) document.getElementById( 'StatusPrev' ).innerHTML += '<br>' + 'equal';
t_identText = ' (<span style="color:green;font-size:180%;" title="Inhalt ist bereits aktuell">✔</span>)';
CatGenRepairForm.t_FilesContentChecked['Kategorie:' + t_Zielbezeichner] = '';
} else
if ( t_missingText == '' && CatGenRepairForm.t_FilesContentChecked['Kategorie:' + t_Zielbezeichner] ) {
t_oldContent = encodeURIComponent( CatGenRepairForm.t_FilesContentChecked['Kategorie:' + t_Zielbezeichner] );
t_oldContent = t_oldContent.replace(/\'/g, '&apos;');
t_identText = ' (<span style="color:red;font-size:180%;" ' +
'onmouseover="tippon('+"'"+t_oldContent+"'"+')" onmouseout="tippoff()">✘</span>)';
}
t_Zielbezeichner = t_Zielbezeichner.replace(/&/g, "&");
t_ZielbezeichnerUrl = encodeURIComponent( t_ZielbezeichnerUrl );
out2 += '<ul><li><span id="FileK' + CatGenRepairForm.t_Sprachen[t_Sprache] + t_HerstellerNr + '">' +
'<a href="' + wgScriptPath + '/index.php?title=Kategorie:' + t_ZielbezeichnerUrl + '" ' +
t_missingText + 'title="Kategorie:' + t_ZielbezeichnerUrl + '">Kategorie:' +
t_Zielbezeichner + '</a></span>' + t_identText + '</li></ul>';
out2 += '<dl><dd><span id="InhaltK' + CatGenRepairForm.t_Sprachen[t_Sprache] + t_HerstellerNr + '">' + t_Inhalt + '</span></dd></dl>';
}
}
return out+out2;
},
StopRepairProcessingVKFiles : function () {
CatGenRepairForm.t_stopp = true;
},
t_Files : new Array(),
t_HerstellerListe : new Array(),
t_FilesChecked : new Array(),
t_FilesContentChecked : new Array(),
t_processnext : 0,
t_VorlagenTexte : new Array(),
t_KategorienTexte : new Array(),
t_VorlagenKategorie : new Array(),
t_TypTexte : new Array(),
t_vkdebug : false,
t_Content : '',
t_Sic_GenContent : '',
t_Sic_selectedTyp : 0,
t_wikiurl : wgServer + wgScriptPath + '/api.php',
t_stopp : false,
UnloadCatGenRepairForm : function () {
CatGenRepairForm.t_stopp = true;
setcursor( 'auto' );
CatGenRepairForm.t_Sic_GenContent = document.getElementById( 'content' ).innerHTML;
CatGenRepairForm.t_selectedTyp = document.getElementById( 'Typ' ).selectedIndex;
if ( CatGenRepairForm.t_Content != '' ) {
document.getElementById( 'content' ).innerHTML = CatGenRepairForm.t_Content;
CatGenRepairForm.t_Content = '';
}
},
LoadCatGenRepairForm : function ( t_status ) {
// if ( typeof my_vkdebug != "undefined" && my_vkdebug != '' ) CatGenRepairForm.t_vkdebug = my_vkdebug;
if ( document.getElementById( 'content' ) ) {
if ( CatGenRepairForm.t_Content != '' && t_status != 'n' ) {
return;
}
if ( CatGenRepairForm.t_Content == '' ) {
CatGenRepairForm.t_Content = document.getElementById( 'content' ).innerHTML;
}
if ( CatGenRepairForm.t_Sic_GenContent != '' ) {
document.getElementById( 'content' ).innerHTML = CatGenRepairForm.t_Sic_GenContent;
document.getElementById( 'Typ' ).selectedIndex = CatGenRepairForm.t_selectedTyp;
CatGenRepairForm.t_Sic_GenContent = '';
return;
}
out = '<form method="get" style="width:100%" name="CatGenRepairForm">' +
'<fieldset><legend>Vorlagen- und Kategoriegenerator - Ergänzungen</legend>' +
'<div style="margin-top:.5em; margin-left:1em; margin-right:1em;">' +
'<h3>Parameter</h3>' +
'<p><input type="button" value="Vorschau" ' +
'title="Erzeugt eine Vorschau der Vorlagen und Kategorien mit Inhalten" onClick="PreCheckRepairPreviewVFiles()"> ' +
'<input type="button" style="float:right;" value="Schließen" title="Beendet den Vorlagen und Kategorien-Generator" onClick="UnloadCatGenRepairForm()">' +
'<select id="Typ" size="8" type="hidden" ' +
'onchange="this.form.TypSel.value = this.form.Typ.options[this.form.Typ.selectedIndex].value">';
for ( t_Typ = 0; t_Typ < CatGenRepairForm.t_Typen.length; t_Typ++ ) {
out += '<option value="' + CatGenRepairForm.t_Typen[t_Typ] + '">' + CatGenRepairForm.t_Typen[t_Typ] + '</option>';
}
out += '</select><input id="TypSel" name="TypSel" type="hidden" value=""><br>' +
'<table><tr><td><input id="Debugging" type="checkbox"></td><td>Debugging</td></tr>' +
'<tr><td><input id="Limit" type="text" size="5" value="25"></td><td>' +
'<label for="Limit" style="vertical-align:top">Limit</label></td></tr>' +
'<tr><td><input id="Offset" type="text" size="5" value="0"></td><td>' +
'<label for="Offset" style="vertical-align:top">Offset</label></td></tr>' +
'<tr><td><input id="Overwrite" type="checkbox"></td><td>' +
'<label for="Overwrite" style="vertical-align:top">Überschreiben von bestehenden Vorlagen/Kategorien</label></td></tr></table>' +
'<p id="StatusPrev" style="border: 1px solid #aaa; padding:.5em;display:none;">Debuginfo</p></p>' +
'<div id="PreviewForm"></div>' +
'<div id="TemplateForm"></div>' +
'<div id="InsertCreateForm"></div>' +
'</div></fieldset></form><div id="tippinfo"></div>';
document.getElementById( 'content' ).innerHTML = out;
t_tippinfo = document.getElementById('tippinfo');
}
}
};
function PreCheckRepairPreviewVFiles( ) {
CatGenRepairForm.PreCheckRepairPreviewVFiles();
}
function UnloadCatGenRepairForm( ) {
CatGenRepairForm.UnloadCatGenRepairForm();
}
var TW_PERSONAL = "p-personal";
var TW_WERKZEUGE = "p-tb";
var TW_REITER = "column-one";
function InsertNode(p_href, p_text, p_id, p_tag, p_before_id)
{
var new_a = document.createElement('a');
new_a.href = p_href;
new_a.appendChild(document.createTextNode(p_text));
var new_li = document.createElement('li');
new_li.appendChild(new_a);
var tmp_nodes = document.getElementById(p_id).getElementsByTagName(p_tag);
tmp_Node = tmp_nodes[0];
if (p_before_id)
{
tmp_Node.insertBefore(new_li.cloneNode(true), document.getElementById(p_before_id));
}
else
{
tmp_Node.appendChild(new_li.cloneNode(true));
}
}
function StartRepairCreatingVKFiles( ) {
CatGenRepairForm.StartRepairCreatingVKFiles();
}
function StopRepairProcessingVKFiles( ) {
CatGenRepairForm.StopRepairProcessingVKFiles();
}
function StartRepairDeletingVKFiles( ) {
CatGenRepairForm.StartRepairDeletingVKFiles();
}
function setcursor( cursortype ) {
document.getElementById( 'content' ).style.cursor = cursortype;
for ( i = 0; i < document.getElementById( 'content' ).getElementsByTagName( 'input' ).length; i++ ) {
document.getElementById( 'content' ).getElementsByTagName( 'input' )[i].style.cursor = cursortype;
}
}
function trim( t_string ) {
return t_string.replace (/^\s+/, '').replace (/\s+$/, '');
}