Jump to content

MediaWiki:Common.js

From Transight Wiki
Revision as of 16:54, 18 June 2025 by Editor (talk | contribs)

Note: After publishing, 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)
  • Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5.
$(document).ready(function() {
    // Create the header HTML
    var headerHTML = `
        <div id="custom-header" style="background-color:#002f6c; color:white; padding:10px 20px; display:flex; align-items:center; justify-content:space-between;">
            <div style="display:flex; align-items:center;">
                <a href="/index.php?title=Main_Page"><img src="/images/YourLogo.png" alt="Logo" style="height: 40px; margin-right: 15px;"></a>
                <span style="font-size: 20px; font-weight: bold;">Transight Telematics Wiki</span>
            </div>
            <div>
                <input type="text" placeholder="Search..." style="padding:5px; border-radius:4px; border:none;" 
                onkeydown="if (event.key === 'Enter') location.href='/index.php?search=' + this.value;">
            </div>
            <div>
                <a href="/index.php?title=Special:UserLogin" style="color: white; margin-left: 20px;">Login</a>
                <a href="/index.php?title=Special:UserLogout" style="color: white; margin-left: 20px;">Logout</a>
                <a href="#" style="color: white; margin-left: 20px;">EN</a>
            </div>
        </div>
    `;

    // Insert header at the top of the content
    $('#content').before(headerHTML);
});