Actions

MediaWiki

Common.js: Difference between revisions

An Avatar.Global Resource

No edit summary
No edit summary
Line 1: Line 1:
/* Any JavaScript here will be loaded for all users on every page load. */
mw.hook('wikipage.content').add(function($content) {
mw.hook('wikipage.content').add(function($content) {
     var $headline = $content.find("h1, h2").first();
     var $headline = $content.find("h1, h2").first();

Revision as of 13:51, 16 March 2025

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

mw.hook('wikipage.content').add(function($content) {
    var $headline = $content.find("h1, h2").first();
    if ($headline.length) {
        $("<div class='custom-message'>{{HeaderMessage}}</div>").insertBefore($headline);
    }
});