MozillaZine

FF 58 - Auothide last tab

User Help for Mozilla Firefox
morat
 
Posts: 3596
Joined: February 3rd, 2009, 6:29 pm

Post Posted September 4th, 2019, 7:23 am

@ejm_dc

morat wrote:The observer is not working in the userChrome.xml file. I don't know why.

I tested the following code snippet in the browser console in Fx 68 and Fx 69.

Code: Select all
(function () {
  function test() { alert("abracadabra"); }
  var observer = new MutationObserver(test);
  observer.observe(gBrowser.tabContainer, {childList: true});
})();

The alert opens when changing the tab count in Fx 68, but does nothing in Fx 69.

ejm_dc
 
Posts: 70
Joined: December 20th, 2003, 4:12 pm

Post Posted September 4th, 2019, 8:12 am

@morat

Thank you. So, does that mean there is likely nothing that can be done to fix this?

morat
 
Posts: 3596
Joined: February 3rd, 2009, 6:29 pm

Post Posted September 4th, 2019, 8:55 am

@ejm_dc

I don't know a solution offhand, but I didn't research the issue.

ejm_dc
 
Posts: 70
Joined: December 20th, 2003, 4:12 pm

Post Posted September 4th, 2019, 12:13 pm

Thanks, @morat.

Please do let me know if anything comes to mind. I was able to remove the last tab using this simple css:

#tabbrowser-tabs tab:first-of-type:last-of-type { display: none !important; }

But it leaves the large gray bar in tact, so it's less than ideal.

ejm_dc
 
Posts: 70
Joined: December 20th, 2003, 4:12 pm

Post Posted September 5th, 2019, 5:56 am

In case anyone is looking for a solution, I was able to get help here: https://www.reddit.com/r/FirefoxCSS/com ... n_in_ff69/

This works very well with FF69 so far:

https://github.com/MrOtherGuy/firefox-c ... ntrols.css

And, if you want tabs on the bottom, these two work (the last one if you use the menubar):

https://github.com/MrOtherGuy/firefox-c ... bottom.css
https://github.com/MrOtherGuy/firefox-c ... _patch.css

Thanks for all the help here!

morat
 
Posts: 3596
Joined: February 3rd, 2009, 6:29 pm

Post Posted September 7th, 2019, 4:59 am

Try this:

* userChrome.xml

Code: Select all
<?xml version="1.0"?>
<!-- autohide last tab -->
<bindings xmlns="http://www.mozilla.org/xbl">
  <binding id="execute_javascript_code">
    <implementation>
      <constructor><![CDATA[
        (function () {
          if (window.ucjsExecuted) return;
          window.ucjsExecuted = true;
          var navToolbox = document.getElementById("navigator-toolbox");
          var menubar = document.getElementById("toolbar-menubar");
          var tabbar = document.getElementById("TabsToolbar");
          navToolbox.insertBefore(menubar, navToolbox.firstChild);
          function showHideTabbar() {
            tabbar.style.visibility = (gBrowser.visibleTabs.length == 1) ? "collapse" : "";
          }
          showHideTabbar();
          function tabOpened() { showHideTabbar(); }
          function tabMoved() { showHideTabbar(); }
          function tabClosed() { showHideTabbar(); }
          gBrowser.tabContainer.addEventListener("TabOpen", tabOpened, false);
          gBrowser.tabContainer.addEventListener("TabMove", tabMoved, false);
          gBrowser.tabContainer.addEventListener("TabClose", tabClosed, false);
        })();
      ]]></constructor>
    </implementation>
  </binding>
</bindings>

I don't understand the reason for the following line.

Code: Select all
navToolbox.insertBefore(menubar, navToolbox.firstChild);

Maybe it works with a CustomCSSforFX tweak?

Notification when a tab is added or removed
http://developer.mozilla.org/docs/Archi ... or_removed

ejm_dc
 
Posts: 70
Joined: December 20th, 2003, 4:12 pm

Post Posted September 7th, 2019, 8:39 am

Thanks! I'll give it a try. Not sure about the code lines. I took that from this thread. It worked well for a while, at least until FF69.

Thanks again for all your help!

Return to Firefox Support


Who is online

Users browsing this forum: ineuw and 9 guests