Difference between revisions of "MediaWiki:Common.js"

Jump to navigationJump to search
(testing to see if this works)
 
(No difference)

Latest revision as of 20:56, 15 March 2019

/* Any JavaScript here will be loaded for all users on every page load. */

// *************************************************
// Pagetitle rewrite
//
// Rewrites the page's title, used by Template:Title
// *************************************************
$(function() {
    if ($('#title-meta').length) {
        var newTitle = mw.html.escape($("#title-meta").html());
        // Allow italics
        newTitle = newTitle.replace(/&lt;(\/?i)&gt;/g, '<$1>');
        var edits = $("#user_masthead_since").text();
        $(".firstHeading").html(newTitle);
        $("#user_masthead_head h2").html(newTitle + "<small id='user_masthead_since'>" + edits + "</small>");
    }
});
 
$(function changeTitle(){
    if (!$('span.newPageTitle').html()) {
        return;
    }
    $('h1.page-header__title').html($('span.newPageTitle').html());
});

/* END Pagetitle */