Jump to content

MediaWiki:Common.js

From International Treaty Law Wiki
Revision as of 22:14, 17 January 2026 by DrInternationalLaw (talk | contribs)

Note: After publishing, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5.
/* 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>'
        );
    }
});