Benutzer:Skelabra2509/common.js: Unterschied zwischen den Versionen

Aus PokéWiki
Zur Navigation springen Zur Suche springen
KKeine Bearbeitungszusammenfassung
(Test)
Zeile 1: Zeile 1:
/*
######## Aus der Wikipedia übernommene Code für schnelles Ändern von Kategorien (HotCat) #####################
#                                                                                                            #
#Man kann mit wenigen Klicks Kats hinzufügen, ändern oder entfernen.                                        #
#                                                                                                            #
############################################################################################################## */
window.hotcat_translations_from_commons = true;
window.hotcat_translations_from_commons = true;
//Lädt HotCat aus Commons
mw.loader.load( "//commons.wikimedia.org/w/index.php?title=MediaWiki:Gadget-HotCat.js&action=raw&ctype=text/javascript");
//Lädt das BKL-Helferlein - aber von hier.
mw.loader.load("//www.pokewiki.de/index.php?title=Benutzer:Skelabra2509/BKL-Check.js&action=raw&ctype=text/javascript&maxage=604800&*") ;
mw.loader.load("//www.pokewiki.de/index.php?title=Benutzer:Skelabra2509/BKL-Check.css&action=raw&ctype=text/css",
                "text/css");
//Ersetzt Kurzlinks aus der Suche
var shortlinks = window.setInterval("replaceshortlinks()", 1000);
function replaceshortlinks()
{
  if (Math.floor((document.getElementById("searchInput").value.indexOf(":")+1)/2) == 1) {
    var text = document.getElementById("searchInput").value;
    text = text.replace(/^[B]:/, "Benutzer:");
    text = text.replace(/^[B][D]:/, "Benutzer Diskussion:");
    text = text.replace(/^[D]:/, "Datei:");
    text = text.replace(/^[D][D]:/, "Datei Diskussion:");
    text = text.replace(/^[H]:/, "Hilfe:");
    text = text.replace(/^[H][D]:/, "Hilfe Diskussion:");
    text = text.replace(/^[K]:/, "Kategorie:");
    text = text.replace(/^[K][D]:/, "Kategorie Diskussion:");
    text = text.replace(/^[M][W]:/, "MediaWiki:");
    text = text.replace(/^[M][D]:/, "MediaWiki Diskussion:");
    text = text.replace(/^[P][W]:/, "PokéWiki:");
    text = text.replace(/^[P][D]:/, "PokéWiki Diskussion:");
    text = text.replace(/^[S]:/, "Spezial:");
    text = text.replace(/^[D]:/, "Diskussion:");
    text = text.replace(/^[V]:/, "Vorlage:");
    text = text.replace(/^[V][D]:/, "Vorlage Diskussion:");
    document.getElementById("searchInput").value = text;
  }
}
   
   
////Peronalisierte Bentzerleiste
/*
 
This imports the latest version of HotCat from Commons.
 
HotCat is a gadget to make changes to categories much easier.
//document.getElementById("gl-topbar-left").firstChild.nextSibling.nextSibling.nextSibling.innerHTML = ''
Full documentation can be found at [[commons:Help:Gadget-HotCat]]
*/
mw.loader.load( '//commons.wikimedia.org/w/index.php?title=MediaWiki:Gadget-HotCat.js&action=raw&ctype=text/javascript' );
   
   
document.getElementById("gl-topbar-right").firstChild.nextSibling.nextSibling.nextSibling.innerHTML = '<h5>Meine Werkzeuge</h5><ul><li id="pt-userpage"><a href="/Benutzer:Skelabra2509" title="Deine Benutzerseite">Skelabra2509</a></li><li id="pt-mytalk"><a href="/Benutzer_Diskussion:Skelabra2509" title="Meine Diskussionsseite">Disk</a></li><li id=""><a href="/Benutzer:Skelabra2509/XdW" title="Meine Artikel der Woche">Mein XdW</a></li><li id=""><a href="/PokéWiki:Artikel der Woche/PdW" title="PdW-Projekt">PdW</a></li><li id=""><a href="/Spezial:Letzte Änderungen" title="Letzte Änderungen">RC</a></li><li id="pt-watchlist"><a href="/Spezial:Beobachtungsliste" title="Meine Beobachtungsliste">Beo</a></li><li id=""><a href="/Spezial:Beiträge/Skelabra2509" title="Meine Beiträge">Beiträge</a></li><li id=""><a href="/index.php?title=Spezial:EditCount&target=Skelabra2509" title="Anzahl der Bearbeitungen">Anzahl</a></li><li id="pt-preferences"><a href="/Spezial:Einstellungen" title="Eigene Einstellungen">Einstellungen</a></li><li id="pt-logout"><a href="/index.php?title=Spezial:Abmelden&amp;returnto=Hauptseite" title="Abmelden">Abmelden</a></li></ul>'
// Präfix „Datei:“ für Dateibeschreibungsseiten und Spezial:Hochladen als Vorgabe
$(function () {
  var namespaceNumber = mw.config.get('wgNamespaceNumber');
  if (namespaceNumber === -1 && mw.config.get('wgCanonicalSpecialPageName') == 'Upload') {
    // We're on Special:Upload: pretend we were in the file namespace.
    namespaceNumber = 6;
  }
  // Exclude all other namespaces including talk pages and special pages
  if (namespaceNumber !== 6) return;
  $('body').delegate('.hotcatinput input:text', 'focus', function () {
    var wasSet = $(this).data('hotcatprefixset');
    if (wasSet) return; // Already done, don't re-do it (user might have deleted pre-filled text)
    if (!this.value) {
      // If input field is empty, then pre-fill it
      var namespaceNames = mw.config.get('wgFormattedNamespaces');
      if (namespaceNames && typeof (namespaceNames[namespaceNumber]) == 'string') {
        var suffix = ':';         
        this.value = namespaceNames[namespaceNumber] + suffix;
      }
    }
    $(this).data('hotcatprefixset', true);
  });
});

Version vom 23. März 2015, 20:43 Uhr

window.hotcat_translations_from_commons = true;
 
/*
 This imports the latest version of HotCat from Commons.
 HotCat is a gadget to make changes to categories much easier.
 Full documentation can be found at [[commons:Help:Gadget-HotCat]]
*/
mw.loader.load( '//commons.wikimedia.org/w/index.php?title=MediaWiki:Gadget-HotCat.js&action=raw&ctype=text/javascript' );
 
// Präfix „Datei:“ für Dateibeschreibungsseiten und Spezial:Hochladen als Vorgabe
$(function () {
  var namespaceNumber = mw.config.get('wgNamespaceNumber');
  if (namespaceNumber === -1 && mw.config.get('wgCanonicalSpecialPageName') == 'Upload') {
    // We're on Special:Upload: pretend we were in the file namespace.
    namespaceNumber = 6;
  }
  // Exclude all other namespaces including talk pages and special pages
  if (namespaceNumber !== 6) return;
  $('body').delegate('.hotcatinput input:text', 'focus', function () {
    var wasSet = $(this).data('hotcatprefixset');
    if (wasSet) return; // Already done, don't re-do it (user might have deleted pre-filled text)
    if (!this.value) {
      // If input field is empty, then pre-fill it
      var namespaceNames = mw.config.get('wgFormattedNamespaces');
      if (namespaceNames && typeof (namespaceNames[namespaceNumber]) == 'string') {
        var suffix = ':';          
        this.value = namespaceNames[namespaceNumber] + suffix;
      }
    }
    $(this).data('hotcatprefixset', true);
  });
});