Hide account name folder (s) from the folder pane

User Help for Mozilla Thunderbird
delicacy
Posts: 400
Joined: February 3rd, 2013, 4:09 pm

Hide account name folder (s) from the folder pane

Post by delicacy »

Hi, is there a way to hide the account name folder (s) from the folder pane, with a userstyle,userscript,addon,about:config setting ?
those folders are useless space & i can access settings from the tools menu anyways.
User avatar
tanstaafl
Moderator
Posts: 49647
Joined: July 30th, 2003, 5:06 pm

Re: Hide account name folder (s) from the folder pane

Post by tanstaafl »

You might be able to hide them using a css snippet in a userChrome.css file. See the external links section in http://kb.mozillazine.org/UserChrome.css for some add-ons that can help you identify the window elements.

Could you explain why you consider them useless space? If I understood that, I might be able to give you a better answer. If they're POP accounts you could configure them as a global inbox which would completely remove those accounts from the folder pane and use folders in Local Folders for that account instead. If they're IMAP accounts I'm not certain you can access any child folders if you hide the account name.

http://kb.mozillazine.org/Global_Inbox
delicacy
Posts: 400
Joined: February 3rd, 2013, 4:09 pm

Re: Hide account name folder (s) from the folder pane

Post by delicacy »

inbox, sent, trash, drafts, blahblah, because i have enough folders to view a pick if necessary & the account name foler is of no use to me, in unified view, moreover, like i previously explained,
i can access settings from the tools menu, if needed. & there are no other views that corresponds to what i need besides the unified version, that's why i need a userstyle,userscript,addon, or about:config setting.
& i have account names in the thread view as in the inbox & trash submenus, the account name icons are supplementary folders that are needless.

maybe a greasemonkey script.

isServer is what needs to be taken care of .. .
morat
Posts: 6405
Joined: February 3rd, 2009, 6:29 pm

Re: Hide account name folder (s) from the folder pane

Post by morat »

Greasemonkey doesn't work with Thunderbird.
delicacy
Posts: 400
Joined: February 3rd, 2013, 4:09 pm

Re: Hide account name folder (s) from the folder pane

Post by delicacy »

I meant a userchrome.js script..
User avatar
WaltS48
Posts: 5141
Joined: May 7th, 2010, 9:38 am
Location: Pennsylvania, USA

Re: Hide account name folder (s) from the folder pane

Post by WaltS48 »

delicacy wrote:I meant a userchrome.js script..
userChrome.css script?

You appear to know what you want to remove. This may be a guide.

UserChrome-example.css - MozillaZine Knowledge Base
Linux Desktop - AMD Athlon(tm) II X3 455 3.3GHz | 8.0GB RAM | GeForce GT 630
Windows Notebook - AMD A8 7410 2.2GHz | 6.0GB RAM | AMD Radeon R5
delicacy
Posts: 400
Joined: February 3rd, 2013, 4:09 pm

Re: Hide account name folder (s) from the folder pane

Post by delicacy »

i see wls,

but you're partly repeating my expectation,
& you are absolutely right, i know what i want when i don't come here posting requests .. .

+ the reply's indirect, &
that's a wrong guess .. .

ps: i know that javascript can be inserted in that file because another coder of the forum once gave me a code fornew mail window fixed position & size,
& i have no javascript knowledge.
morat
Posts: 6405
Joined: February 3rd, 2009, 6:29 pm

Re: Hide account name folder (s) from the folder pane

Post by morat »

The following tweak hides the twisty image, server image and server cell text.

It isn't possible to remove the server row with css.

Code: Select all

/* Thunderbird 45 userChrome.css */

@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");

treechildren::-moz-tree-twisty {
  list-style-image: none !important;
}

treechildren::-moz-tree-image(folderNameCol, isServer-true) {
  list-style-image: none !important;
}

treechildren::-moz-tree-cell-text(folderNameCol, isServer-true) {
  color: white !important;
  display: none !important;      /* not applicable */
  visibility: hidden !important; /* not applicable */
}

treechildren::-moz-tree-cell-text(folderNameCol, isServer-true, selected) {
  color: -moz-CellHighlight !important;
}

treechildren::-moz-tree-cell-text(folderNameCol, isServer-true, selected, focus) {
  color: Highlight !important;
}
http://kb.mozillazine.org/UserChrome.css

Reference:

http://mxr.mozilla.org/comm-esr45/sourc ... erPane.css
http://mxr.mozilla.org/comm-esr45/sourc ... l/tree.css
delicacy
Posts: 400
Joined: February 3rd, 2013, 4:09 pm

Re: Hide account name folder (s) from the folder pane

Post by delicacy »

Do you know javascript morat ?

if you know how to remove it in userchrome.js, that would be amazing, cause that's just a quick crutch & it can be confusing to view those blue empty selections appear if my mouse hovers on,
moreover, your code deleted the little arrow of inbox & trash folders in unified folders" view ((

i also updated it to "transparent" & not "white"

i'm sick of those weird useless folders & dying to see them go for good & the server too, i guess it's called isServer .. .

moreover, if i didn't click on the last folder properly "outbox", the account page will appear ((
morat
Posts: 6405
Joined: February 3rd, 2009, 6:29 pm

Re: Hide account name folder (s) from the folder pane

Post by morat »

Here is a code snippet to remove the "Local Folders" entry from the folder pane.

You can create a similar code snippet to remove the account name folders.

Code: Select all

var hideLocalFolders = {
  translations: {
    "en-GB": "Local Folders",
    "en-US": "Local Folders",
  },
  hideLocalFolders: function () {
    for (var i = 0; i < gFolderTreeView._modeNames.length; i++) {
      var viewName = gFolderTreeView._modeNames[i];
      var view = gFolderTreeView.getFolderTreeMode(viewName);
      view.hideLocalFolders_oldFunction = view.generateMap;
      view.generateMap = function (ftv) {
        var ftvItems = this.hideLocalFolders_oldFunction.call(view, ftv);
        for (var j = 0; j < ftvItems.length; j++) {
          for (var key in hideLocalFolders.translations) {
            if (ftvItems[j].text == hideLocalFolders.translations[key]) {
              ftvItems.splice(j, 1);
              break;
            }
          }
        }
        return ftvItems;
      };
    }
  },
};
hideLocalFolders.hideLocalFolders();
gFolderTreeView.toggleMode(gFolderTreeView.mode);
var box = document.getElementById("folderTree").boxObject;
box.QueryInterface(Components.interfaces.nsITreeBoxObject);
box.invalidate();
Hide Local Folders
http://addons.mozilla.org/thunderbird/addon/438960
morat
Posts: 6405
Joined: February 3rd, 2009, 6:29 pm

Re: Hide account name folder (s) from the folder pane

Post by morat »

Try this

Code: Select all

/* Thunderbird 45 userChrome.js */

(function() {

if (location == "chrome://messenger/content/messenger.xul") {

  /* Remove account name folders in unified folders mode
     http://forums.mozillazine.org/viewtopic.php?f=39&t=3001721
  */

  setTimeout(function() {
    var hideAccountNameFolders = {
      accountNameFolders: [
        "invalid@gmail.com",
        "Local Folders",
      ],
      hideAccountNameFolders: function() {
        for (var i = 0; i < gFolderTreeView._modeNames.length; i++) {
          var viewName = gFolderTreeView._modeNames[i];
          if (viewName == "smart") {
            var view = gFolderTreeView.getFolderTreeMode(viewName);
            view.hideAccountNameFolders_oldFunction = view.generateMap;
            view.generateMap = function(ftv) {
              var ftvItems = this.hideAccountNameFolders_oldFunction.call(view, ftv);
              for (var j = 0; j < ftvItems.length; j++) {
                for (var k = 0; k < hideAccountNameFolders.accountNameFolders.length; k++) {
                  if (ftvItems[j].text == hideAccountNameFolders.accountNameFolders[k]) {
                    ftvItems.splice(j, 1);
                  }
                }
              }
              return ftvItems;
            };
          }
        }
      },
    };
    hideAccountNameFolders.hideAccountNameFolders();
    gFolderTreeView.toggleMode(gFolderTreeView.mode);
    var box = document.getElementById("folderTree").boxObject;
    box.QueryInterface(Components.interfaces.nsITreeBoxObject);
    box.invalidate();
  }, 1000);

}

})();
http://userchromejs.mozdev.org/
http://userchromejs.mozdev.org/faq.html

Instructions:

1. install userChromeJS extension
2. close mail client
3. edit userChrome.js in the chrome folder
4. open mail client

You may need to purge the caches when you start up Thunderbird. (purge once per edit)

http://developer.mozilla.org/en/Extensi ... _4#Caching

P.S.

Remember to edit the "invalid@gmail.com" string in the accountNameFolders array.
delicacy
Posts: 400
Joined: February 3rd, 2013, 4:09 pm

Re: Hide account name folder (s) from the folder pane

Post by delicacy »

I installed userchromejs 2.0 & your script but it doesn't work..
& your link is pointing to a way to clean firefox cache, & how would i clean tb's cache, if the email client has a cache to clean..
also, why & how would i need to edit an email account that isn't supposed to exist, & what for ?

i'm totally lost ((
morat
Posts: 6405
Joined: February 3rd, 2009, 6:29 pm

Re: Hide account name folder (s) from the folder pane

Post by morat »

Did you read the FAQ on the userChromeJS site?
alta88 wrote:Gecko has a javascript cache, which is not automatically cleared across restarts. To clear the cache when restarting, add a -purgecaches flag to the executable commandline.
i.e.

thunderbird.exe -purgecaches
ThunderbirdPortable.exe -purgecaches

Do you know how to use the command line?

http://kb.mozillazine.org/Command_line_arguments

Here is a example script to test if you know how to clear the javascript cache.

Code: Select all

/* Thunderbird 45 userChrome.js */

(function() {

if (location == "chrome://messenger/content/messenger.xul") {

  /* Open content tab in foreground */

  setTimeout(function() {
    var data = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">';
    data += "<html><head><title>userChromeJS</title>";
    data += '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">';
    data += "</head><body><pre>Test 1</pre></body></html>";
    document.getElementById("tabmail").openTab("contentTab", {
      contentPage: "data:text/html;charset=utf-8;base64," + btoa(data),
      background: false,
    });
  }, 1000);

}

})();
Try replacing the "Test 1" string with "Test 2" in the code and clear the javascript cache.

Why userChrome.js doesn't work every time I restart Thunderbird?
http://forums.mozillazine.org/viewtopic ... &t=2541011
delicacy wrote:i'm totally lost
Honestly, I think userChromeJS tweaks are too difficult for you.
delicacy
Posts: 400
Joined: February 3rd, 2013, 4:09 pm

Re: Hide account name folder (s) from the folder pane

Post by delicacy »

nothing's complicated when you ask me to do something that doesn't require code language's knowledge.
all i needed to do was following your instructions, & nothing works.
i even added:
deleting history,
disabling all other addons

tb 45
userchromeJS 2

& no effectiveness.
morat
Posts: 6405
Joined: February 3rd, 2009, 6:29 pm

Re: Hide account name folder (s) from the folder pane

Post by morat »

Do you see an error in the error console when testing the example script?

Tools > Error Console

Perhaps, something like:
Error: No such tab mode: contentTab
Source File: chrome://messenger/content/tabmail.xml
Try changing the setTimeout delay from 1,000 to 10,000 milliseconds.

Find:

Code: Select all

}, 1000);
Replace with:

Code: Select all

}, 10000);
setTimeout
http://www.w3schools.com/jsref/met_win_settimeout.asp
Locked