Topic on Project:Support desk

[CLOSED] [OLD POST] Hide Left Navigation Area with Keyboard Shortcut

9
Holygamer (talkcontribs)
Hazard-SJ (talkcontribs)

I just checked on a wiki running 1.19.0, and it does not work.

Holygamer (talkcontribs)

Any idea on how to get it working so that when I press F11 or another key that it hides the menu? If not possible is there any other way I can hide the menu when I want to?

Hazard-SJ (talkcontribs)

The script itself is the problem. I'm not really a JS coder, so not much I can do.

Subfader (talkcontribs)
Holygamer (talkcontribs)

Hi, do I just delete everything in the MediaWiki:Common.js file and replace it with the code you gave me? I did that and nothing happens when I press F11, it just goes full screen. I'm not really bothered what key I use as long as it works.

Subfader (talkcontribs)

You don't need to remove the other stuff, just add at the end. For the Vector skin this works:

$('document').ready(function() {
        $("body").keydown(function (e) {
                if (e.keyCode == 114) { //F3 to collapse
                  $("#mw-panel").toggle();
                  $("#bodyContent").css('margin-left', '-200px');
                }
        });
        $("body").keydown(function (e) {
                if (e.keyCode == 115) { //F4 to expand
                  $("#mw-panel").toggle()
                  $("#content").css('margin-left', '');
                }
        });
});

This is not fully working. The tricky part is to move the body content to the very left and to undo all of it again. Fix yourself.

Hazard-SJ (talkcontribs)

The following deals with that:

$('document').ready(function() {
        $("body").keydown(function (e) {
                if (e.keyCode == 114) { //F3 to collapse
                  $("#mw-panel").toggle();
                  $("#bodyContent").css('margin-left', '-200px');
                }
        });
        $("body").keydown(function (e) {
                if (e.keyCode == 115) { //F4 to expand
                  $("#mw-panel").toggle()
                  $("#bodyContent").css('margin-left', '0px');
                }
        });
});

However, the background is the remaining problem. It doesn't move when toggled, causing part of the text to be over the sidebar area without it's appropriate background.

90.212.81.76 (talkcontribs)

Hi please upgrade from Mediawiki 16.; to Mediawiki 19.8 or higher please because Mediawiki 16.5 is now unsupported

Reply to "[CLOSED] [OLD POST] Hide Left Navigation Area with Keyboard Shortcut"