Skip to content

Instantly share code, notes, and snippets.

@allanlaal
Created September 14, 2014 21:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save allanlaal/7ce90614fbb142a04137 to your computer and use it in GitHub Desktop.
Save allanlaal/7ce90614fbb142a04137 to your computer and use it in GitHub Desktop.
Firefox: toggle visibility of toolbars (using KeyConfig)
// 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