MediaWiki:Common.js: Unterschied zwischen den Versionen

Aus BBS Wiki
Keine Bearbeitungszusammenfassung
Keine Bearbeitungszusammenfassung
Zeile 1: Zeile 1:
/* Druck-Kopfzeile für Timeless Skin (stabil, blockbasiert) */
/* 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 insertPrintHeader() {
   function insertPrintLogo() {
     if (document.getElementById('mw-printheader')) return;
    // Logo nur einmal einfügen
     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;


     var header = document.createElement('div');
     var img = document.createElement('img');
     header.id = 'mw-printheader';
     img.id = 'mw-printlogo';
    img.src = logoUrl;
    img.alt = 'Logo';


    var title = document.createElement('div');
     content.insertBefore(img, content.firstChild);
    title.id = 'mw-printtitle';
    title.textContent = document.title.replace(/ - .*$/, '');
 
    var logo = document.createElement('img');
    logo.id = 'mw-printlogo';
    logo.src = logoUrl;
    logo.alt = 'Logo';
 
    header.appendChild(title);
    header.appendChild(logo);
 
     content.insertBefore(header, content.firstChild);
   }
   }


  // Nur beim Drucken einfügen
   window.addEventListener('beforeprint', insertPrintLogo);
   window.addEventListener('beforeprint', insertPrintHeader);
})();
})();

Version vom 1. Oktober 2025, 12:05 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';

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

  window.addEventListener('beforeprint', insertPrintLogo);
})();