MediaWiki:Common.js

From Bemar leit
Revision as of 06:07, 20 October 2026 by Bjarni Bemar (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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.
// Hluti 1: Grípa smellinn dýnamískt
$(document).ready(function() {
    $('body').on('click', 'a', function(e) {
        var href = $(this).attr('href');
        if (href && href.indexOf('printable=yes') !== -1) {
            e.preventDefault();
            var newHref = href.replace('printable=yes', 'action=render');
            window.location.href = newHref;
        }
    });
});

// Hluti 2: Ef notandinn lendir samt á printable síðu, áframsenda strax
if (window.location.href.indexOf('printable=yes') !== -1) {
    window.location.href = window.location.href.replace('printable=yes', 'action=render');
}