MediaWiki:Common.js

From Arisepedia
Revision as of 17:43, 30 September 2024 by Arisepedia (talk | contribs) (Created page with "→‎Any JavaScript here will be loaded for all users on every page load.: $(document).ready(function() { var currentDomain = window.location.hostname; var currentPath = window.location.pathname; var currentTitle = mw.config.get('wgPageName'); var englishDomain = 'arisepedia.com'; var hindiDomain = 'hi.arisepedia.com'; var switcherHtml = '<div id="language-switcher" style="position: fixed; top: 10px; right: 10px; z-index: 1000;">' +...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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)
  • Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Press Ctrl-F5.
/* Any JavaScript here will be loaded for all users on every page load. */
$(document).ready(function() {
    var currentDomain = window.location.hostname;
    var currentPath = window.location.pathname;
    var currentTitle = mw.config.get('wgPageName');
    
    var englishDomain = 'arisepedia.com';
    var hindiDomain = 'hi.arisepedia.com';
    
    var switcherHtml = '<div id="language-switcher" style="position: fixed; top: 10px; right: 10px; z-index: 1000;">' +
        '<a href="https://' + englishDomain + currentPath + '" style="margin-right: 10px; padding: 5px 10px; background-color: #f8f9fa; border: 1px solid #a2a9b1; border-radius: 3px; color: #202122; text-decoration: none;">English</a>' +
        '<a href="https://' + hindiDomain + currentPath + '" style="padding: 5px 10px; background-color: #f8f9fa; border: 1px solid #a2a9b1; border-radius: 3px; color: #202122; text-decoration: none;">हिन्दी</a>' +
    '</div>';
    
    $('body').append(switcherHtml);
});