1

The message header in Thunderbird's message preview pane takes up extra space and is usually not needed, since much of the same information is presented in the message list. It's possible to hide the header entirely with the following custom userchrome.css:

#msgHeaderView { visibility: collapse; } 

But with that setting, it is impossible to show the header when you actually want to see it.

Shouldn't it be possible to toggle this CSS setting (i.e. visibility collapse/expand) with a JavaScript command, which could then be mapped to a keystroke with the tbkeys extension? I've been trying to figure out how to find this setting in the developer console, but window.document.getElementById('#msgHeaderView') returns null, as do various attempts to find this element via getElementsByClassName or using the id of the parent element.

How should I be using the developer/error console to find and set the CSS property for this element?

2 Answers 2

0

One can leave headers off with that userChrome.css, but choose to view the full file source, including header, in a popup, by pressing CtrlU.

One can also toggle the compact view vs. full header view with three key presses: AltV, AltH, and then either AltA or AltN.

0

Updated with an even better solution. The following tbkeys shortcut definition will toggle header visibility:

"h": "{ let tabmail = window.top.document.getElementById('tabmail'); let doc = tabmail?.currentAboutMessage?.document || document.getElementById('messageBrowser')?.contentDocument; doc.getElementById('msgHeaderView').collapsed = !doc.getElementById('msgHeaderView').collapsed; }" 

This was my previous (inferior) solution, but could still be useful if you actually want a hotkey to swap out a stylesheet: quite a hack, but it works. I set up two css files, hide.css and display.css, hiding and showing the header respectively. Then the following tbkeys shortcut definition toggles between them:

"h": "{ var ss = Cc['@mozilla.org/content/style-sheet-service;1'].getService(Ci.nsIStyleSheetService); var io = Cc['@mozilla.org/network/io-service;1'].getService(Ci.nsIIOService); var ds = Cc['@mozilla.org/file/directory_service;1'].getService(Ci.nsIProperties); var show = 0; var chromepath = ds.get('UChrm', Ci.nsIFile); chromepath.append('userChrome.css'); var hidepath = ds.get('UChrm', Ci.nsIFile); hidepath.append('hide.css'); var displaypath = ds.get('UChrm', Ci.nsIFile); displaypath.append('display.css'); var chromefile = io.newFileURI(chromepath); var hidefile = io.newFileURI(hidepath); var displayfile = io.newFileURI(displaypath); if(ss.sheetRegistered(chromefile, ss.USER_SHEET)){ ss.unregisterSheet(chromefile, ss.USER_SHEET); show = 1; } if(ss.sheetRegistered(hidefile, ss.USER_SHEET)){ ss.unregisterSheet(hidefile, ss.USER_SHEET); show = 1; } if(ss.sheetRegistered(displayfile, ss.USER_SHEET)){ ss.unregisterSheet(displayfile, ss.USER_SHEET); show = 0; } if(show) { ss.loadAndRegisterSheet(displayfile, ss.USER_SHEET); } else { ss.loadAndRegisterSheet(hidefile, ss.USER_SHEET); } }" 

Contents of hide.css as well as userchrome.css (starting view is hidden):

#msgHeaderView { visibility: collapse; } 

Contents of display.css:

#msgHeaderView { visibility: display; } 

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.