MediaWiki:Common.js: Unterschied zwischen den Versionen

Aus Watch-Wiki
Zur Navigation springen Zur Suche springen
Zeile 3: Zeile 3:
 
/* Load some used variables first */
 
/* Load some used variables first */
 
var commonConf = mw.config.get(['wgUserGroups', 'wgUserName', 'wgCanonicalNamespace', 'wgUserLanguage']);
 
var commonConf = mw.config.get(['wgUserGroups', 'wgUserName', 'wgCanonicalNamespace', 'wgUserLanguage']);
window.alert(commonConf.wgUserGroups);
+
 
window.alert(commonConf.wgUserName);
 
window.alert(commonConf.wgCanonicalNamespace);
 
window.alert(commonConf.wgUserLanguage);
 
 
/* ------------------------ */
 
/* ------------------------ */
 
/* Extra Sysop-Script laden */
 
/* Extra Sysop-Script laden */

Version vom 18. Februar 2022, 16:29 Uhr

/* Das folgende JavaScript wird für alle Benutzer geladen. */

/* Load some used variables first */
var commonConf = mw.config.get(['wgUserGroups', 'wgUserName', 'wgCanonicalNamespace', 'wgUserLanguage']);

/* ------------------------ */
/* Extra Sysop-Script laden */
/* ------------------------ */

if (commonConf.wgUserGroups)
  {
   for (var i = 0; i < commonConf.wgUserGroups.length; i++)
      {
       if (commonConf.wgUserGroups[i] === 'sysop')
         {
          importScript('MediaWiki:CommonSysop.js');
          importStylesheet('MediaWiki:CommonSysop.css');
         }
      }
  }

/* --------------------- */
/* Kategorien ausblenden */
/* --------------------- */

addOnloadHook( function () {

	if ( document.getElementById( 'mw-normal-catlinks' ) && commonConf.wgUserName && commonConf.wgCanonicalNamespace == 'File' &&
	      ( commonConf.wgUserLanguage == 'de' ||
		commonConf.wgUserLanguage == 'en' ||
		commonConf.wgUserLanguage == 'es' ||
		commonConf.wgUserLanguage == 'it' ||
		commonConf.wgUserLanguage == 'nl' ||
		commonConf.wgUserLanguage == 'ru' ) ) {
		catsstring = document.getElementById( 'mw-normal-catlinks' ).innerHTML.split( '<ul>' );
		if ( catsstring.length > 1 ) {
			Trenner = '</li>';
			cats = catsstring[1].split( Trenner );
			catsstring[0] += '<ul>';
			for ( var i = 0; i < cats.length; i++ ) {
				if ( cats[i].indexOf( "Kategorie:Bildgalerie Uhrenmodelle" ) != -1 ||
				     cats[i].indexOf( "Kategorie:Bildgalerie Uhrwerke" ) != -1 ||
				     cats[i].indexOf( "Kategorie:Bildgalerie Archiv" ) != -1 ) {
					if ( commonConf.wgUserLanguage == 'de' ) catsstring[0] += cats[i] + Trenner;
				} else
				if ( cats[i].indexOf( "Kategorie:Picture gallery watch models" ) != -1 ||
				     cats[i].indexOf( "Kategorie:Picture gallery movements" ) != -1 ||
				     cats[i].indexOf( "Kategorie:Picture gallery archive" ) != -1 ) {
					if ( commonConf.wgUserLanguage == 'en' ) catsstring[0] += cats[i] + Trenner;
				} else
				if ( cats[i].indexOf( "Kategorie:Galería de imagenes de modelos de relojes" ) != -1 ||
				     cats[i].indexOf( "Kategorie:Galería de imagenes de mecanismos de relojes" ) != -1 ||
				     cats[i].indexOf( "Kategorie:Galería de imagenes archivo" ) != -1 ) {
					if ( commonConf.wgUserLanguage == 'es' ) catsstring[0] += cats[i] + Trenner;
				} else
				if ( cats[i].indexOf( "Kategorie:Galleria fotografica di modelli orologi" ) != -1 ||
				     cats[i].indexOf( "Kategorie:Galleria fotografica di movimento degli orologi" ) != -1 ||
				     cats[i].indexOf( "Kategorie:Galleria fotografica di Archivio" ) != -1 ) {
					if ( commonConf.wgUserLanguage == 'it' ) catsstring[0] += cats[i] + Trenner;
				} else
				if ( cats[i].indexOf( "Kategorie:Afbeeldingen galerij uurwerkmodellen" ) != -1 ||
				     cats[i].indexOf( "Kategorie:Afbeeldingen galerij uurwerken" ) != -1 ||
				     cats[i].indexOf( "Kategorie:Afbeeldingen galerij archief" ) != -1 ) {
					if ( commonConf.wgUserLanguage == 'nl' ) catsstring[0] += cats[i] + Trenner;
				} else
				if ( cats[i].indexOf( "Kategorie:Фотогалерея Модели часов" ) != -1 ||
				     cats[i].indexOf( "Kategorie:Фотогалерея Часовые механизмы" ) != -1 ||
				     cats[i].indexOf( "Kategorie:Фотогалерея Архив" ) != -1 ) {
					if ( commonConf.wgUserLanguage == 'ru' ) catsstring[0] += cats[i] + Trenner;
				} else {
					catsstring[0] += cats[i] + Trenner;
				}
			}
			document.getElementById( 'mw-normal-catlinks' ).innerHTML = catsstring[0] + '</ul></div>';
		}
	}
});

/* ------------------ */
/* Standardfunktionen */
/* ------------------ */

function GetTimeStamp() {

    var t_now = new Date();
    
    t_GetTimeStamp = ('0000'+t_now.getFullYear()).substr(String(t_now.getFullYear()).length,4)+'-'+('00'+(t_now.getMonth()+1)).substr(String((t_now.getMonth()+1)).length,2)+'-'+('00'+t_now.getDate()).substr(String(t_now.getDate()).length,2)+'T'+
('00'+t_now.getHours()).substr(String(t_now.getHours()).length,2)+':'+('00'+t_now.getMinutes()).substr(String(t_now.getMinutes()).length,2)+':'+('00'+t_now.getSeconds()).substr(String(t_now.getSeconds()).length,2)+'Z';
    
    return t_GetTimeStamp;
}

function TransFormText( t_text ) {
	return t_text.replace(/\&/g, "&amp;").replace(/\</g, "&lt;").replace(/\>/g, "&gt;");
}