MozillaZine

FF 58 - Auothide last tab

User Help for Mozilla Firefox
aborix
 
Posts: 27
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: 18
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: 27
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: 18
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: 27
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

User avatar
 
Posts: 393
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: 27
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: 18
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: 18
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: 712
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

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

Post Posted February 4th, 2019, 2:34 pm

The code, which has been awesome, seems to be broken with 65. Any ideas?

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

Post Posted February 4th, 2019, 4:00 pm

With FF65, I rely on the original minimize, restore and close buttons and i put the tab bar below the address and search bar. Have only one bar at the top except the tab bar which I can't close anymore when 1 tab showing. One tab always shows.

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

Post Posted February 6th, 2019, 7:29 am

wright76878 wrote:With FF65, I rely on the original minimize, restore and close buttons and i put the tab bar below the address and search bar. Have only one bar at the top except the tab bar which I can't close anymore when 1 tab showing. One tab always shows.


Right, this is the problem with FF65 I was bringing up. I'm guessing it has something to do with how the tab bar is referenced now, but I'm not sure how to find out these references any longer.

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

Post Posted March 5th, 2019, 1:57 pm

Just thought I'd push this to the top. Anyone have any idea how to solve this problem of autohiding the last tab. When the tabs are below the bookmark bar, the code on the first page does a great job hiding the tabs (in Windows) but it leaves a gray bar the height of the tabs visible. Frankly, it's better than having the tabs, but it's still a bit annoying. Any way in javascript to hide this tabbar after all the tabs have been collapsed?

Thanks for any help!

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

Post Posted March 8th, 2019, 12:46 pm

Do you still have the titlebar and the menubar shown?
And how do you get the tabbar below the address bar and the bookmarks bar?

Return to Firefox Support


Who is online

Users browsing this forum: Google [Bot] and 11 guests