Jump to content

MediaWiki:Common.js: Difference between revisions

From Transight Wiki
No edit summary
No edit summary
Tag: Manual revert
Line 6: Line 6:
$(document).ready(function () {
$(document).ready(function () {
     $("a.external").attr("target", "_blank");
     $("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
        }
    });
});
});

Revision as of 12:14, 6 August 2025

$(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");
});