Jump to content

MediaWiki:Common.js

From Transight Wiki
Revision as of 12:13, 6 August 2025 by Editor (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.
$(document).ready(function() {
  $('input#searchInput').attr('placeholder', 'Search for Transight Wiki');
});

// Open all external links in a new tab
$(document).ready(function () {
    $("a.external").attr("target", "_blank");
});

$(document).ready(function () {
    // Attach only to links with hashes that target headings
    $('a[href*="#"]').on('click', function (e) {
        var target = this.hash;

        // If the anchor is valid and exists
        if (target.length > 1 && $(target).length) {
            e.preventDefault();
            $('html, body').animate({
                scrollTop: $(target).offset().top
            }, 600); // Duration in milliseconds
        }
    });
});