⚠️ This site is now a LEGACY SITE. For the new BOSL wiki, please navigate to https://www.boslwiki.com.au

MediaWiki:Common.js

From BoSL Wiki
Jump to navigation Jump to search

Note: After saving, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Internet Explorer: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Go to Menu → Settings (Opera → Preferences on a Mac) and then to Privacy & security → Clear browsing data → Cached images and files.
/* Any JavaScript here will be loaded for all users on every page load. */
// Popup banner - shows once per session
$(document).ready(function() {
    // Check if banner has been shown this session
    if (!sessionStorage.getItem('bannerShown')) {
        // Create and show the banner
        var banner = $('<div>')
            .attr('id', 'session-banner')
            .css({
                'position': 'fixed',
                'top': '50%',
                'left': '50%',
                'transform': 'translate(-50%, -50%)',
                'background': '#fff',
                'border': '2px solid #0645ad',
                'padding': '20px',
                'box-shadow': '0 4px 6px rgba(0,0,0,0.3)',
                'z-index': '10000',
                'max-width': '500px',
                'border-radius': '5px'
            })
            .html('<h3>This site is now a LEGACY SITE. For the new BOSL wiki, please navigate to <a href="https://www.boslwiki.com.au" style="color: #0645ad; text-decoration: underline; font-weight: bold;">https://boslwiki.com.au</a></h3><p>This banner shows once per session.</p><button id="close-banner">Close</button>');       
        // Add overlay
        var overlay = $('<div>')
            .attr('id', 'banner-overlay')
            .css({
                'position': 'fixed',
                'top': '0',
                'left': '0',
                'width': '100%',
                'height': '100%',
                'background': 'rgba(0,0,0,0.5)',
                'z-index': '9999'
            });
        
        $('body').append(overlay).append(banner);
        
        // Close button handler
        $('#close-banner').click(function() {
            $('#session-banner, #banner-overlay').remove();
            sessionStorage.setItem('bannerShown', 'true');
        });
    }
});