MediaWiki:Common.js: Difference between revisions
Appearance
Created page with "→Any JavaScript here will be loaded for all users on every page load.: →PDF- und Share-Buttons oben rechts neben dem Seitentitel: $(function () { // Nur auf Artikelseiten (Namespace 0) if (mw.config.get('wgNamespaceNumber') !== 0) return; // PDF-Button mit Icon var pdfButton = ` <a class="pdf-download-button" href="javascript:window.print()" style="margin-left:10px;"> 📄 PDF </a> `; // Share-Button mit Icon..." Tag: Recreated |
No edit summary |
||
| Line 1: | Line 1: | ||
/* Any JavaScript here will be loaded for all users on every page load. */ | /* Any JavaScript here will be loaded for all users on every page load. */ | ||
/* PDF- und Share- | /* Dezente PDF- und Share-Links im Wikipedia-Stil */ | ||
$(function () { | $(function () { | ||
| Line 6: | Line 6: | ||
if (mw.config.get('wgNamespaceNumber') !== 0) return; | if (mw.config.get('wgNamespaceNumber') !== 0) return; | ||
// | // Container für die Action-Links (rechts oben) | ||
var | var $actions = $('#p-views ul'); | ||
if ($actions.length) { | |||
// PDF-Link (klein, unauffällig) | |||
$actions.append( | |||
'<li><a href="javascript:window.print()" title="Als PDF drucken">PDF</a></li>' | |||
); | |||
// Share-Link (klein, unauffällig) | |||
$actions.append( | |||
'<li><a href="javascript:navigator.share ? navigator.share({title: document.title, url: location.href}) : prompt(\'Link kopieren:\', location.href)" title="Seite teilen">Teilen</a></li>' | |||
); | |||
} | |||
}); | }); | ||
Revision as of 22:14, 17 January 2026
/* Any JavaScript here will be loaded for all users on every page load. */
/* Dezente PDF- und Share-Links im Wikipedia-Stil */
$(function () {
// Nur auf Artikelseiten (Namespace 0)
if (mw.config.get('wgNamespaceNumber') !== 0) return;
// Container für die Action-Links (rechts oben)
var $actions = $('#p-views ul');
if ($actions.length) {
// PDF-Link (klein, unauffällig)
$actions.append(
'<li><a href="javascript:window.print()" title="Als PDF drucken">PDF</a></li>'
);
// Share-Link (klein, unauffällig)
$actions.append(
'<li><a href="javascript:navigator.share ? navigator.share({title: document.title, url: location.href}) : prompt(\'Link kopieren:\', location.href)" title="Seite teilen">Teilen</a></li>'
);
}
});