Jump to content

MediaWiki:Common.js: Difference between revisions

From Gyaanipedia
No edit summary
Tags: Reverted Mobile edit Mobile web edit
Tags: Replaced Manual revert Mobile edit Mobile web edit
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. */
// Add dismiss button to sitenotice
$(function() {
    if ($('#siteNotice').length) {
        var cookieName = 'dismissSiteNotice';
        var cookieValue = $('#siteNotice').attr('data-notice-id') || 'sitenotice';
       
        // Check if already dismissed
        if ($.cookie(cookieName) === cookieValue) {
            $('#siteNotice').hide();
            return;
        }
       
        // Add dismiss button
        var dismissBtn = $('<span class="sitenotice-dismiss">[dismiss]</span>');
        dismissBtn.css({
            'cursor': 'pointer',
            'float': 'right',
            'font-size': '90%',
            'margin-left': '1em'
        });
       
        dismissBtn.click(function() {
            $('#siteNotice').slideUp();
            $.cookie(cookieName, cookieValue, { expires: 30, path: '/' });
        });
       
        $('#siteNotice').prepend(dismissBtn);
    }
});

Revision as of 10:56, 6 December 2025

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