MozillaZine

FF 58 - Auothide last tab

User Help for Mozilla Firefox
aborix
 
Posts: 24
Joined: October 23rd, 2017, 1:23 pm

Post Posted March 4th, 2018, 2:00 pm

Thanks.

How about this userChrome.xml:

Code: Select all
<?xml version="1.0"?>

<bindings id="generalBindings"
  xmlns="http://www.mozilla.org/xbl"
  xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
  xmlns:xbl="http://www.mozilla.org/xbl">

  <binding id="execute_javascript_code" extends="chrome://global/content/bindings/toolbarbutton.xml#menu">
    <implementation>
      <constructor>
        <![CDATA[

          (function() {
            if (window.ucjsExecuted)
              return;
            ucjsExecuted = true;

            let tabbar = document.getElementById('TabsToolbar');
            let placeholder = tabbar.lastChild.cloneNode(true);
            document.getElementById('nav-bar').appendChild(placeholder);
            function showHideTabbar() {
              if (gBrowser.visibleTabs.length == 1) {
                tabbar.style.visibility = 'collapse';
                placeholder.style.display = '';
              } else {
                tabbar.style.visibility = '';
                placeholder.style.display = 'none;
              };
            };
            showHideTabbar();
            let observer = new MutationObserver(showHideTabbar);
            observer.observe(document.getElementById('tabbrowser-tabs'), {childList: true});

          })();

        ]]>
      </constructor>
    </implementation>
  </binding>
</bindings>

GKnight
 
Posts: 14
Joined: November 7th, 2013, 8:51 am

Post Posted March 5th, 2018, 9:30 pm

This one doesn't remove the single tab. Same as not using it at all.

aborix
 
Posts: 24
Joined: October 23rd, 2017, 1:23 pm

Post Posted March 6th, 2018, 1:18 pm

Try this userChrome.xml:

Code: Select all
<?xml version="1.0"?>

<bindings id="generalBindings"
  xmlns="http://www.mozilla.org/xbl"
  xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
  xmlns:xbl="http://www.mozilla.org/xbl">

  <binding id="execute_javascript_code" extends="chrome://global/content/bindings/toolbarbutton.xml#menu">
    <implementation>
      <constructor>
        <![CDATA[

          (function() {
            if (window.ucjsExecuted)
              return;
            ucjsExecuted = true;

            let titlebar = document.getElementById('titlebar');
            let tabbar = document.getElementById('TabsToolbar');
            let navbar = document.getElementById('nav-bar');
            let controls = document.getElementById('titlebar-buttonbox');

            titlebar.style.marginTop = '-20px';
            controls.setAttribute('ordinal', '2000');

            function showHideTabbar() {
              if (gBrowser.visibleTabs.length == 1) {
                navbar.appendChild(controls);
                tabbar.style.visibility = 'collapse';
              } else {
                tabbar.appendChild(controls);
                tabbar.style.visibility = 'visible';
              };
            };

            showHideTabbar();
            let observer = new MutationObserver(showHideTabbar);
            observer.observe(document.getElementById('tabbrowser-tabs'), {childList: true});

          })();

        ]]>
      </constructor>
    </implementation>
  </binding>
</bindings>

In line 23:

Code: Select all
            titlebar.style.marginTop = '-20px';

a higher or lower value than -20 may better fit for you.

GKnight
 
Posts: 14
Joined: November 7th, 2013, 8:51 am

Post Posted March 10th, 2018, 9:03 am

Looks good for multiple tab window with making the marginTop parameter smaller, but for a single window things get even more weird, as the window control buttons now moved to the Firefox bar (or whatever it's called) and are invisible. Window close button becomes visible if you hover the mouse over it:

Image

aborix
 
Posts: 24
Joined: October 23rd, 2017, 1:23 pm

Post Posted March 12th, 2018, 1:27 pm

When the tab bar ist hidden the navigation bar is the only remaining bar. So the control buttons are there and the only fault is that they are invisible. Or do you want them to be elsewhere?
Last edited by aborix on March 12th, 2018, 6:18 pm, edited 1 time in total.

tomatoshadow2
 
Posts: 258
Joined: May 11th, 2017, 9:52 am

Post Posted March 12th, 2018, 2:24 pm

Just a suggestion, Ublock Origin uses much less memory then Adblock Plus. Superior ad blocker all around.

aborix
 
Posts: 24
Joined: October 23rd, 2017, 1:23 pm

Post Posted March 12th, 2018, 6:23 pm

- deleted -
Last edited by aborix on March 12th, 2018, 10:48 pm, edited 1 time in total.

GKnight
 
Posts: 14
Joined: November 7th, 2013, 8:51 am

Post Posted March 12th, 2018, 6:33 pm

aborix wrote:When the tab bar ist hidden the navigation bar is the only remaining bar. So the control buttons are there and the only fault is that they are invisible. Or do you want them to be elsewhere?


I see your point, but it's really weird to use like that. It was so nice and simple in ver 56 and earlier, with "Hide Tab Bar With One Tab" extension. Maybe some day we'll be able to do it again in Quantum? Thanks for the effort trying to make it work!

I will try it on my Ubuntu box (still on 56 there), I have a feeling the original version will work as there's no title bar at all, at least on Unity. I will post an update.

tomatoshadow2 wrote:Just a suggestion, Ublock Origin uses much less memory then Adblock Plus. Superior ad blocker all around.


I heard about it, but I've been using Adblock Plus since 2005 and I guess it's a matter of habit at this point. That being said, I can't stand the latest version with severely crippled interface. I understand though it's a Quantum issue and not theirs. But it does the job, and performance-wise it seems to work much better on Quantum, especially the Android version.

GKnight
 
Posts: 14
Joined: November 7th, 2013, 8:51 am

Post Posted May 6th, 2018, 10:06 am

@ aborix - tried your original code on Ubuntu - works great! Thanks!

wright76878
 
Posts: 694
Joined: July 9th, 2004, 8:05 am

Post Posted May 6th, 2018, 3:26 pm

With title bar hidden, these 2 add-ons show a close button and a minimize button:

https://addons.mozilla.org/en-US/firefo ... n/?src=api

https://addons.mozilla.org/en-US/firefo ... he-window/
If that helps

Return to Firefox Support


Who is online

Users browsing this forum: No registered users and 10 guests