I Need Basic Add-on for Simple Code for Thunderbird

Discuss how to use and promote Web standards with the Mozilla Gecko engine.
Post Reply
User avatar
koolx
Posts: 532
Joined: July 11th, 2014, 7:37 pm

I Need Basic Add-on for Simple Code for Thunderbird

Post by koolx »

Hi guys,

I dont know how to write add-ons for TB. But can someone here provide a default basic add-on that only includes the javascript code below? It doesnt have to be anything fancy. I'd appreciate it. Thanks!

Code: Select all

window.restore();window.setTimeout(window.maximize, 100);
morat
Posts: 6394
Joined: February 3rd, 2009, 6:29 pm

Re: I Need Basic Add-on for Simple Code for Thunderbird

Post by morat »

Do you want a toolbar button to toggle the window state?

Code: Select all

/*Code*/
if (window.windowState == window.STATE_MAXIMIZED) {
  window.restore();
} else {
  window.maximize();
}
Custom Buttons
http://addons.mozilla.org/thunderbird/addon/2707
User avatar
koolx
Posts: 532
Joined: July 11th, 2014, 7:37 pm

Re: I Need Basic Add-on for Simple Code for Thunderbird

Post by koolx »

morat wrote:Do you want a toolbar button to toggle the window state?

Code: Select all

/*Code*/
if (window.windowState == window.STATE_MAXIMIZED) {
  window.restore();
} else {
  window.maximize();
}
Hi morat,

Long time to talk! Hope youre doing well these days. The reason why I'm asking for an add-on is cuz I installed an app called Thunderbird Conversations. Theres a bar at the bottom which shouldnt be there when TB is maximized. I used DOMi to find out the element is but its elusive. It doesnt occur when unmaximized but I need TB maximized. Disabled theme and extensions but the bar still appears.

I used your code with the toggle toolbar app you linked. But it makes TB unmaximized which I dont want.

Another user suggested the code I posted oringally. I dont want to use a toggle button for it. I just want it to execute the code everytime I open TB using the code I first posted with, cuz the only way to remove this bar is to unmax then max TB. How can I make an add-on to TB with the code since I dont know how to make add-ons?
.
morat
Posts: 6394
Joined: February 3rd, 2009, 6:29 pm

Re: I Need Basic Add-on for Simple Code for Thunderbird

Post by morat »

You can use the userChromeJS extension to run code in the 3pane window.

Code: Select all

/* Thunderbird userChrome.js */

(function() {

if (location == "chrome://messenger/content/messenger.xul") {
  setTimeout(function () {
    window.restore();
    setTimeout(function () {
      window.maximize();
    }, 100);
  }, 1000);
}
if (location == "chrome://messenger/content/messageWindow.xul") {}
if (location == "chrome://messenger/content/messengercompose/messengercompose.xul") {}

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

Instructions:

1. install userChromeJS extension
2. close email client
3. create or edit the userChrome.js file in the chrome folder in the profile folder
4. open email client with the -purgecaches command line option

i.e.

thunderbird.exe -purgecaches
ThunderbirdPortable.exe -purgecaches

You have to purge the caches only after creating or editing the userChrome.js file.
User avatar
koolx
Posts: 532
Joined: July 11th, 2014, 7:37 pm

Re: I Need Basic Add-on for Simple Code for Thunderbird

Post by koolx »

Hi morat,

Appreciate your help. I did as you asked except for opening TB with a command line option. I dont know how to do that. But just to let you know, it works without using the command line. But do you mind telling me how to do that just in case?

It works but its still a bit annoying seeing TB open unmaxed then maxed. Is there a way to tweak the code to make the process lightning fast without noticing it upon opeing TB?
morat
Posts: 6394
Joined: February 3rd, 2009, 6:29 pm

Re: I Need Basic Add-on for Simple Code for Thunderbird

Post by morat »

Here is how to open the email client with the -purgecaches command line option.

* open Command Prompt
* type: cd /d C:\Program Files\Thunderbird
* press enter
* type: thunderbird.exe -purgecaches
* press enter
* close Command Prompt

10 Ways to Open the Command Prompt in Windows 10
https://www.howtogeek.com/235101/
tweak the code
Try changing 1000 to 0 in the code. If it doesn't work, then increase the delay to 50 or 250.

setTimeout method
https://www.w3schools.com/jsref/met_win_settimeout.asp
User avatar
koolx
Posts: 532
Joined: July 11th, 2014, 7:37 pm

Re: I Need Basic Add-on for Simple Code for Thunderbird

Post by koolx »

morat wrote:Here is how to open the email client with the -purgecaches command line option.

* open Command Prompt
* type: cd /d C:\Program Files\Thunderbird
* press enter
* type: thunderbird.exe -purgecaches
* press enter
* close Command Prompt

10 Ways to Open the Command Prompt in Windows 10
https://www.howtogeek.com/235101/
tweak the code
Try changing 1000 to 0 in the code. If it doesn't work, then increase the delay to 50 or 250.

setTimeout method
https://www.w3schools.com/jsref/met_win_settimeout.asp

Hi morat,

Thanks man. Looks like tweaking it from 1000 to 0 or 250 doesnt work. The time it takes to max TB is still the same as before. But I see another value of 100 in the code. What is that for exactly?

And should I purge TB after tweaking the code?

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

Re: I Need Basic Add-on for Simple Code for Thunderbird

Post by morat »

The value of 100 is from the original post. It's a delay of a 100 milliseconds.

Yes. You need to purge caches after tweaking the code.

Also,

You can't restore and maximize the window before the window is created. It's not possible.
User avatar
koolx
Posts: 532
Joined: July 11th, 2014, 7:37 pm

Re: I Need Basic Add-on for Simple Code for Thunderbird

Post by koolx »

morat wrote:The value of 100 is from the original post. It's a delay of a 100 milliseconds.

Yes. You need to purge caches after tweaking the code.

Also,

You can't restore and maximize the window before the window is created. It's not possible.
Hi morat,

Loos like its tweaked now. I set both values to 100 and I purged the cache. Looks good now. But what did you mean by, "restore and maximize the window before the window is created. It's not possible." Could you explain this? I'm not following 100%. Thanks.
morat
Posts: 6394
Joined: February 3rd, 2009, 6:29 pm

Re: I Need Basic Add-on for Simple Code for Thunderbird

Post by morat »

koolx wrote:Is there a way to tweak the code to make the process lightning fast without noticing it upon opening TB?
koolx wrote:Could you explain this?
You can't run the code before the window is ready to receive commands.
User avatar
koolx
Posts: 532
Joined: July 11th, 2014, 7:37 pm

Re: I Need Basic Add-on for Simple Code for Thunderbird

Post by koolx »

morat wrote:
koolx wrote:Is there a way to tweak the code to make the process lightning fast without noticing it upon opening TB?
koolx wrote:Could you explain this?
You can't run the code before the window is ready to receive commands.
Thanks morat for all your help!
Post Reply