MediaWiki:Common.js: Difference between revisions

From Disaster Risk Gateway
No edit summary
Tag: Reverted
Tags: Replaced Manual revert
Line 1: Line 1:
/* Any JavaScript here will be loaded for all users on every page load. */
/* Any JavaScript here will be loaded for all users on every page load. */
$(document).ready(function() {
    // Check if we are NOT on the main page
    if (mw.config.get('wgPageName') !== mw.config.get('wgMainPageTitle').replace(/ /g, '_')) {
        // Create the back button
        var backButton = $('<button id="backButton">Go Back</button>');
       
        // Apply styles
        backButton.css({
            "position": "fixed",
            "bottom": "20px",
            "left": "20px",
            "background-color": "#007bff",
            "color": "white",
            "border": "none",
            "padding": "5px 10px",
            "font-size": "14px",
            "cursor": "pointer",
            "border-radius": "5px",
            "box-shadow": "0px 2px 5px rgba(0,0,0,0.2)"
        });
        // Add click function to go back
        backButton.click(function() {
            history.back();
        });
        // Add the button to the page
        $("body").append(backButton);
    }
});

Revision as of 18:02, 25 March 2025

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