Skip to content

Commit

Permalink
#5 hide pinned tabs in Firefox 51+
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-pl committed Feb 27, 2017
1 parent 336d5c1 commit cc27cba
Showing 1 changed file with 22 additions and 5 deletions.
27 changes: 22 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,34 @@
'use strict';

let { viewFor } = require('sdk/view/core'),
let {viewFor} = require('sdk/view/core'),
windows = require('sdk/windows').browserWindows;

const HIDE_PINNED_TABS_STYLE = '.tabbrowser-tabs[positionpinnedtabs] > .tabbrowser-tab[pinned] ' +
'{ position: relative !important; }';


// listener function
function addListener(lWindow) {
let window = viewFor(lWindow);
let document = window.document;
let toolbox = document.getElementById('navigator-toolbox');

let styleElem = document.createElementNS('http://www.w3.org/1999/xhtml', 'style');
toolbox.insertBefore(styleElem, toolbox.childNodes.item(0));
let styleSheet = styleElem.sheet;

window.addEventListener('fullscreen', () => {
let active = window.fullScreen;

toolbox.style.height = active ? '0px' : 'auto';
toolbox.style.overflow = active ? 'hidden' : 'auto';

window.addEventListener('fullscreen', function () {
let toolbox = window.document.getElementById('navigator-toolbox');
toolbox.style.height = window.fullScreen ? '0px' : 'auto';
toolbox.style.overflow = window.fullScreen ? 'hidden' : 'auto';
// hide pinned tabs, required since Firefox 51
if (active) {
styleSheet.insertRule(HIDE_PINNED_TABS_STYLE, 0);
} else {
styleSheet.deleteRule(0);
}
}, false);
}

Expand Down

0 comments on commit cc27cba

Please sign in to comment.