MediaWiki:Common.js: Unterschied zwischen den Versionen
Zur Navigation springen
Zur Suche springen
WWWIG (Diskussion | Beiträge) (Um Bildgalerie Archiv erweitert) |
WHiTY (Diskussion | Beiträge) |
||
(13 dazwischenliegende Versionen von 2 Benutzern werden nicht angezeigt) | |||
Zeile 1: | Zeile 1: | ||
/* Das folgende JavaScript wird für alle Benutzer geladen. */ | /* 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 */ | /* Extra Sysop-Script laden */ | ||
− | if ( | + | /* ------------------------ */ |
+ | |||
+ | if (commonConf.wgUserGroups) | ||
{ | { | ||
− | for (var i = 0; i < wgUserGroups.length; i++) | + | for (var i = 0; i < commonConf.wgUserGroups.length; i++) |
{ | { | ||
− | if (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' ); | ||
} | } | ||
} | } | ||
} | } | ||
+ | /* --------------------- */ | ||
/* Kategorien ausblenden */ | /* Kategorien ausblenden */ | ||
− | addOnloadHook( function () { | + | /* --------------------- */ |
+ | |||
+ | $( function () { | ||
+ | /* addOnloadHook( function () {*/ | ||
− | if ( document.getElementById( 'mw-normal-catlinks' ) && wgUserName && wgCanonicalNamespace == 'File' && | + | if ( document.getElementById( 'mw-normal-catlinks' ) && commonConf.wgUserName && commonConf.wgCanonicalNamespace == 'File' && |
− | ( wgUserLanguage == 'de' || | + | ( commonConf.wgUserLanguage == 'de' || |
− | wgUserLanguage == 'en' || | + | commonConf.wgUserLanguage == 'en' || |
− | wgUserLanguage == 'es' || | + | commonConf.wgUserLanguage == 'es' || |
− | wgUserLanguage == 'nl' || | + | commonConf.wgUserLanguage == 'it' || |
− | wgUserLanguage == 'ru' ) ) { | + | commonConf.wgUserLanguage == 'nl' || |
− | catsstring = document.getElementById( 'mw-normal-catlinks' ).innerHTML.split( ' | + | commonConf.wgUserLanguage == 'ru' ) ) { |
+ | catsstring = document.getElementById( 'mw-normal-catlinks' ).innerHTML.split( '<ul>' ); | ||
if ( catsstring.length > 1 ) { | if ( catsstring.length > 1 ) { | ||
− | cats = catsstring[1].split( | + | Trenner = '</li>'; |
− | catsstring[0] += ' | + | cats = catsstring[1].split( Trenner ); |
+ | catsstring[0] += '<ul>'; | ||
for ( var i = 0; i < cats.length; i++ ) { | for ( var i = 0; i < cats.length; i++ ) { | ||
if ( cats[i].indexOf( "Kategorie:Bildgalerie Uhrenmodelle" ) != -1 || | if ( cats[i].indexOf( "Kategorie:Bildgalerie Uhrenmodelle" ) != -1 || | ||
+ | cats[i].indexOf( "Kategorie:Bildgalerie Uhrwerke" ) != -1 || | ||
cats[i].indexOf( "Kategorie:Bildgalerie Archiv" ) != -1 ) { | cats[i].indexOf( "Kategorie:Bildgalerie Archiv" ) != -1 ) { | ||
− | if ( wgUserLanguage == 'de' ) catsstring[0] += cats[i] + | + | if ( commonConf.wgUserLanguage == 'de' ) catsstring[0] += cats[i] + Trenner; |
} else | } else | ||
if ( cats[i].indexOf( "Kategorie:Picture gallery watch models" ) != -1 || | 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 ) { | cats[i].indexOf( "Kategorie:Picture gallery archive" ) != -1 ) { | ||
− | if ( wgUserLanguage == 'en' ) catsstring[0] += cats[i] + | + | if ( commonConf.wgUserLanguage == 'en' ) catsstring[0] += cats[i] + Trenner; |
} else | } else | ||
if ( cats[i].indexOf( "Kategorie:Galería de imagenes de modelos de relojes" ) != -1 || | 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 ) { | cats[i].indexOf( "Kategorie:Galería de imagenes archivo" ) != -1 ) { | ||
− | if ( wgUserLanguage == 'es' ) catsstring[0] += cats[i] + ' | + | 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 | } else | ||
if ( cats[i].indexOf( "Kategorie:Afbeeldingen galerij uurwerkmodellen" ) != -1 || | 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 ) { | cats[i].indexOf( "Kategorie:Afbeeldingen galerij archief" ) != -1 ) { | ||
− | if ( wgUserLanguage == 'nl' ) catsstring[0] += cats[i] + | + | if ( commonConf.wgUserLanguage == 'nl' ) catsstring[0] += cats[i] + Trenner; |
} else | } else | ||
if ( cats[i].indexOf( "Kategorie:Фотогалерея Модели часов" ) != -1 || | if ( cats[i].indexOf( "Kategorie:Фотогалерея Модели часов" ) != -1 || | ||
+ | cats[i].indexOf( "Kategorie:Фотогалерея Часовые механизмы" ) != -1 || | ||
cats[i].indexOf( "Kategorie:Фотогалерея Архив" ) != -1 ) { | cats[i].indexOf( "Kategorie:Фотогалерея Архив" ) != -1 ) { | ||
− | if ( wgUserLanguage == 'ru' ) catsstring[0] += cats[i] + | + | if ( commonConf.wgUserLanguage == 'ru' ) catsstring[0] += cats[i] + Trenner; |
} else { | } else { | ||
− | catsstring[0] += cats[i] + | + | catsstring[0] += cats[i] + Trenner; |
} | } | ||
} | } | ||
− | document.getElementById( 'mw-normal-catlinks' ).innerHTML = catsstring[0] | + | 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, "&").replace(/\</g, "<").replace(/\>/g, ">"); | ||
+ | } |
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, "&").replace(/\</g, "<").replace(/\>/g, ">"); }