MediaWiki:Common.js

From Blank Chronicle
Revision as of 16:54, 19 July 2020 by Aardvark (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)
  • 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. */

/* Implement hamburger menu */
$(document).ready(function () {
    $('#p-namespaces-label').html("<i class='fa fa-bars'></i>").css('display', 'initial');
    $('#p-namespaces').on('click', function() {
        $('#mw-panel').toggle();
    });
});

/* Implement language buttons */

/* Kanji Toggle */
$(document).ready(function () {
    $('.language-button.jp').on('click', function() {
        $('#en-button').removeClass('highlight');
        $(this).addClass('highlight');
        $('.jp-content').show();
        $('.en-content').hide();
    });
});

/* English Toggle */
$(document).ready(function () {
    $('.language-button.en').on('click', function() {
        $('#jp-button').removeClass('highlight');
        $(this).addClass('highlight');
        $('.en-content').show();
        $('.jp-content').hide();
    });
});

/* Implement edition buttons */

/* RE Toggle */
$(document).ready(function () {
    $('.edition-button.re').on('click', function() {
        $('#le-button').removeClass('highlight');
        $('#dx-button').removeClass('highlight');
        $(this).addClass('highlight');
        $('.re-content').show();
        $('.le-content').hide();
        $('.dx-content').hide();
    });
});

/* LE Toggle */
$(document).ready(function () {
    $('.edition-button.le').on('click', function() {
        $('#re-button').removeClass('highlight');
        $('#dx-button').removeClass('highlight');
        $(this).addClass('highlight');
        $('.le-content').show();
        $('.re-content').hide();
        $('.dx-content').hide();
    });
});

/* DX Toggle */
$(document).ready(function () {
    $('.edition-button.dx').on('click', function() {
        $('#re-button').removeClass('highlight');
        $('#le-button').removeClass('highlight');
        $(this).addClass('highlight');
        $('.dx-content').show();
        $('.re-content').hide();
        $('.le-content').hide();
    });
});