Created
September 14, 2014 21:31
-
-
Save allanlaal/7ce90614fbb142a04137 to your computer and use it in GitHub Desktop.
Firefox: toggle visibility of toolbars (using KeyConfig)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// install the KeyConfig extension from http://mozilla.dorando.at/keyconfig.xpi and add this code as a new key | |
// First get all toolbars (that are not the tab bar) | |
var tbs = Array.filter(document.querySelectorAll('toolbar'), function (x) { | |
// remove // from the below line to keep showing the tabs toolbar: | |
//return x.id != 'TabsToolbar'; | |
return true; | |
}); | |
// For each toolbar | |
for (var tb of tbs) { | |
// Either un-collapse if we collapsed it. | |
if (tb.getAttribute('my-addon-collapsed')) { | |
tb.removeAttribute('collapsed'); | |
tb.removeAttribute('my-addon-collapsed'); | |
} | |
// Or collapse other-wise, if not already collapsed | |
else if (!tb.getAttribute('collapsed')) { | |
tb.setAttribute('collapsed', 'true'); | |
tb.setAttribute('my-addon-collapsed', 'true'); | |
} | |
} | |
function toggle_navbar() { | |
var nb = document.getElementById('nav-bar'); | |
if (!nb) | |
return; | |
nb.style.visibility = (nb.style.visibility == '') ? 'collapse' : ''; | |
nb.style.overflow = (nb.style.height == '') ? '' : 'hidden'; | |
} | |
toggle_navbar(); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment