MediaWiki:Common.js: Unterschied zwischen den Versionen

Aus Watch-Wiki
Zur Navigation springen Zur Suche springen
 
(3 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt)
Zeile 14: Zeile 14:
 
       if (commonConf.wgUserGroups[i] === 'sysop')
 
       if (commonConf.wgUserGroups[i] === 'sysop')
 
         {
 
         {
           importScript('MediaWiki:CommonSysop.js');
+
           /* importScript('MediaWiki:CommonSysop.js'); */
           importStylesheet('MediaWiki:CommonSysop.css');
+
           mw.loader.load( '/index.php?title=MediaWiki:CommonSysop.js&action=raw&ctype=text/javascript' );
 +
          /* importStylesheet('MediaWiki:CommonSysop.css'); */
 +
          mw.loader.load( '/index.php?title=MediaWiki:CommonSysop.css&action=raw&ctype=text/css', 'text/css' );
 
         }
 
         }
 
       }
 
       }
Zeile 24: Zeile 26:
 
/* --------------------- */
 
/* --------------------- */
  
addOnloadHook( function () {
+
$( function () {
 +
/* addOnloadHook( function () {*/
  
 
if ( document.getElementById( 'mw-normal-catlinks' ) && commonConf.wgUserName && commonConf.wgCanonicalNamespace == 'File' &&
 
if ( document.getElementById( 'mw-normal-catlinks' ) && commonConf.wgUserName && commonConf.wgCanonicalNamespace == 'File' &&
Zeile 32: Zeile 35:
 
commonConf.wgUserLanguage == 'it' ||
 
commonConf.wgUserLanguage == 'it' ||
 
commonConf.wgUserLanguage == 'nl' ||
 
commonConf.wgUserLanguage == 'nl' ||
commonConf.wgUserLanguage == 'ru' ) ) {window.alert("here");
+
commonConf.wgUserLanguage == 'ru' ) ) {
 
catsstring = document.getElementById( 'mw-normal-catlinks' ).innerHTML.split( '<ul>' );
 
catsstring = document.getElementById( 'mw-normal-catlinks' ).innerHTML.split( '<ul>' );
 
if ( catsstring.length > 1 ) {
 
if ( catsstring.length > 1 ) {

Aktuelle Version vom 18. Februar 2022, 21:00 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'); */
          mw.loader.load( '/index.php?title=MediaWiki:CommonSysop.js&action=raw&ctype=text/javascript' );
          /* importStylesheet('MediaWiki:CommonSysop.css'); */
          mw.loader.load( '/index.php?title=MediaWiki:CommonSysop.css&action=raw&ctype=text/css', 'text/css' );
         }
      }
  }

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

$( function () {
/* 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;");
}