MediaWiki:Common.js: Difference between revisions

From Blank Chronicle
No edit summary
No edit summary
Line 3: Line 3:
/* Implement hamburger menu */
/* Implement hamburger menu */
$(document).ready(function () {
$(document).ready(function () {
     $('#p-namespaces-label').html("<i class='fa fa-bars'></i>").css('display', 'block');
     $('#p-namespaces-label').html("<i class='fas fa-bars'></i>").css('display', 'block');
     $('#p-navigation').before($("<div class='menu-button'><i class='fa fa-window-close'></i></div>"));
     $('#p-navigation').before($("<div class='menu-button'><i class='fa fa-window-close'></i></div>"));
     $('#p-namespaces').on('click', function() {
     $('#p-namespaces').on('click', function() {

Revision as of 02:27, 27 December 2020

/* 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='fas fa-bars'></i>").css('display', 'block');
    $('#p-navigation').before($("<div class='menu-button'><i class='fa fa-window-close'></i></div>"));
    $('#p-namespaces').on('click', function() {
        $('#mw-panel').toggle();
    });
    $('.menu-button').on('click', function() {
        $('#mw-panel').toggle();
    });
});

/* Implement content toggle buttons */
$(document).ready(function () {
    /* Kanji Toggle */
    $('.language-button.jp').on('click', function() {
        $('#en-button').removeClass('bhighlight');
        $('#ro-button').removeClass('bhighlight');
        $(this).addClass('bhighlight');
        $('.jp-content').show();
        $('.en-content').hide();
        $('.ro-content').hide();
    });
    /* Romaji Toggle */
    $('.language-button.ro').on('click', function() {
        $('#en-button').removeClass('bhighlight');
        $('#jp-button').removeClass('bhighlight');
        $(this).addClass('bhighlight');
        $('.ro-content').show();
        $('.jp-content').hide();
        $('.en-content').hide();
    });
    /* English Toggle */
    $('.language-button.en').on('click', function() {
        $('#ro-button').removeClass('bhighlight');
        $('#jp-button').removeClass('bhighlight');
        $(this).addClass('bhighlight');
        $('.en-content').show();
        $('.jp-content').hide();
        $('.ro-content').hide();
    });
    /* RE Toggle */
    $('.edition-button.re').on('click', function() {
        $('#le-button').removeClass('bhighlight');
        $('#dx-button').removeClass('bhighlight');
        $('#fc-button').removeClass('bhighlight');
        $(this).addClass('bhighlight');
        $('.re-content').show();
        $('.le-content').hide();
        $('.dx-content').hide();
        $('.fc-content').hide();
    });
    /* LE Toggle */
    $('.edition-button.le').on('click', function() {
        $('#re-button').removeClass('bhighlight');
        $('#dx-button').removeClass('bhighlight');
        $(this).addClass('bhighlight');
        $('.le-content').show();
        $('.re-content').hide();
        $('.dx-content').hide();
    });
    /* DX Toggle */
    $('.edition-button.dx').on('click', function() {
        $('#re-button').removeClass('bhighlight');
        $('#le-button').removeClass('bhighlight');
        $(this).addClass('bhighlight');
        $('.dx-content').show();
        $('.re-content').hide();
        $('.le-content').hide();
    });
    /* FC Toggle */
    $('.edition-button.fc').on('click', function() {
        $('#re-button').removeClass('bhighlight');
        $(this).addClass('bhighlight');
        $('.fc-content').show();
        $('.re-content:not(.nav-button)').hide();
    });
});