MediaWiki:Common.js: Unterschied zwischen den Versionen

MediaWiki-Schnittstellenseite
KKeine Bearbeitungszusammenfassung
KKeine Bearbeitungszusammenfassung
Zeile 46: Zeile 46:


//Script für die Animation des Mythopedia-Logos nur auf der Startseite
//Script für die Animation des Mythopedia-Logos nur auf der Startseite
jQuery(document).ready(function($) {
jQuery(document).ready(function($) {
     $('<img />',{ src: 'https://wiki.mitraspera.org/images/6/6f/Mythopedia-Logo-animated.gif'});
     if ($("body").hasClass("rootpage-Hauptseite")) {
    $(".category-container-logo-img").hover(
      $('<img />',{ src: 'https://wiki.mitraspera.org/images/6/6f/Mythopedia-Logo-animated.gif'});
            function() {
      $(".category-container-logo-img").hover(
                var image = new Image();
              function() {
                image.src = "https://wiki.mitraspera.org/images/6/6f/Mythopedia-Logo-animated.gif"+"?a="+Math.random();
                  var image = new Image();
                $(this).attr("srcset", "");
                  image.src = "https://wiki.mitraspera.org/images/6/6f/Mythopedia-Logo-animated.gif"+"?a="+Math.random();
                $(this).attr("src", image.src);
                  $(this).attr("srcset", "");
            },
                  $(this).attr("src", image.src);
            function() {
              },
                $(this).attr("src", "https://wiki.mitraspera.org/images/a/a6/Mythopedia-Logo-static.png");
              function() {
            }                         
                  $(this).attr("src", "https://wiki.mitraspera.org/images/a/a6/Mythopedia-Logo-static.png");
        );  
              }                         
          );  
    }  
});
});

Version vom 29. Mai 2021, 16:56 Uhr

/* Das folgende JavaScript wird für alle Benutzer geladen. */
/**
 * Adds CSS classes to the body tag based on the categories this page belongs to
 *
 * @source https://www.mediawiki.org/wiki/Snippets/Style_pages_based_on_categories
 * @revision 2016-01-18
 */

//Script für die Kategorie-Symbole auf den Seiten
(function($, mw) {
  var fn = function() {
    var cats = mw.config.get('wgCategories'), newClasses;
    if (cats) {
      newClasses = $.map(cats, function(el) {
        return 'cat-' + encodeURIComponent(el.replace(/[ .]/g, '_')).replace(/%/g, '_');
      }).join(' ');
      $(document.body).addClass(newClasses);
    }
  };
  if (document.body) {
    fn();
  } else {
    $(fn);
  }
})(jQuery, mw);

//Script für die Symbole des Ampelsystems
jQuery(document).ready(function($) {
    if ($("body").hasClass("cat-Ampel-rot")) { var color = 'rot';}
    else if ($("body").hasClass("cat-Ampel-gelb")) { var color = 'gelb';}
    else if ($("body").hasClass("cat-Ampel-gruen")) { var color = 'gruen';}
    else if ($("body").hasClass("cat-Ampel-blau")) { var color = 'blau';}
    else { var color = 'none';}
    var ampelhtml = "<div class='tright ampel-box'><a href='https://wiki.mitraspera.org/index.php/Ampelsystem' title='Details zum Athyria Ampelsystem'><img src='https://wiki.mitraspera.org/resources/assets/Ampel-" + color + ".png' alt='Ampel " + color + "'></a></div>";

    if (color == 'none') {}
    else {
      if ($( "div.inhalt-box" ).length > 0) {
        $( "div.inhalt-box:first" ).after( ampelhtml );
      }
      else {
        $( ".mw-parser-output section:first" ).prepend( ampelhtml );
      }
    }
});

//Script für die Animation des Mythopedia-Logos nur auf der Startseite
jQuery(document).ready(function($) {
    if ($("body").hasClass("rootpage-Hauptseite")) {
      $('<img />',{ src: 'https://wiki.mitraspera.org/images/6/6f/Mythopedia-Logo-animated.gif'});
      $(".category-container-logo-img").hover(
              function() {
                  var image = new Image();
                  image.src = "https://wiki.mitraspera.org/images/6/6f/Mythopedia-Logo-animated.gif"+"?a="+Math.random();
                  $(this).attr("srcset", "");
                  $(this).attr("src", image.src);
              },
              function() {
                  $(this).attr("src", "https://wiki.mitraspera.org/images/a/a6/Mythopedia-Logo-static.png");
              }                         
          ); 
    } 	  
});