MediaWiki:Common.js: Unterschied zwischen den Versionen

Aus BBS Wiki
Die Seite wurde neu angelegt: „Print-Logo für Timeless-Skin: (function () { var logoUrl = 'https://wiki.demo.lara-cloud.de/images/flexiskin-images-logo.png'; function insertPrintLogo() { if (document.getElementById('mw-printlogo')) return; var content = document.querySelector('#mw-content') || document.body; if (!content) return; var img = document.createElement('img'); img.id = 'mw-printlogo'; img.src = logoUrl; img.alt = 'Logo'; img.style.m…“
 
Keine Bearbeitungszusammenfassung
Zeile 1: Zeile 1:
/* Print-Logo für Timeless-Skin */
/* Print-Logo nur im Druck einfügen (Timeless Skin) */
(function () {
(function () {
   var logoUrl = 'https://wiki.demo.lara-cloud.de/images/flexiskin-images-logo.png';
   var logoUrl = 'https://wiki.demo.lara-cloud.de/images/flexiskin-images-logo.png';


   function insertPrintLogo() {
   function insertPrintLogo() {
    // Logo nur einmal einfügen
     if (document.getElementById('mw-printlogo')) return;
     if (document.getElementById('mw-printlogo')) return;
     var content = document.querySelector('#mw-content') || document.body;
     var content = document.querySelector('#mw-content') || document.body;
     if (!content) return;
     if (!content) return;
Zeile 13: Zeile 15:
     img.alt = 'Logo';
     img.alt = 'Logo';
     img.style.maxHeight = '80px';
     img.style.maxHeight = '80px';
     img.style.marginBottom = '10px';
     img.style.marginBottom = '15px';


    // Logo ganz oben im Content einfügen
     content.insertBefore(img, content.firstChild);
     content.insertBefore(img, content.firstChild);
   }
   }


   // direkt einfügen und zusätzlich bei "beforeprint"
   // nur beim Druck einfügen
  insertPrintLogo();
   window.addEventListener('beforeprint', insertPrintLogo);
   window.addEventListener('beforeprint', insertPrintLogo);
})();
})();

Version vom 1. Oktober 2025, 11:56 Uhr

/* Print-Logo nur im Druck einfügen (Timeless Skin) */
(function () {
  var logoUrl = 'https://wiki.demo.lara-cloud.de/images/flexiskin-images-logo.png';

  function insertPrintLogo() {
    // Logo nur einmal einfügen
    if (document.getElementById('mw-printlogo')) return;

    var content = document.querySelector('#mw-content') || document.body;
    if (!content) return;

    var img = document.createElement('img');
    img.id = 'mw-printlogo';
    img.src = logoUrl;
    img.alt = 'Logo';
    img.style.maxHeight = '80px';
    img.style.marginBottom = '15px';

    content.insertBefore(img, content.firstChild);
  }

  // nur beim Druck einfügen
  window.addEventListener('beforeprint', insertPrintLogo);
})();