Haha, the second half I promised to have done the next day took a week.
Whatever, here it is.
Onward from 0.2,
I knew I had to do something about being able to open an unlimited amount of windows, and the way I set up the new window to close on F11 pressed no matter what module opened or is using that same window chrome.
Keeping focus in Inbox – Shredder and continuously pressing F11 would get this.
And although this was the first problem I knew I needed to solve, it actually ended up being the last and most important, not to mention just in time.
My train of search
led me through one long tunnel, at some parts with zero illumination and seemingly no way out, but eventually the I saw the light at the end. But by then I had already driven into it before I noticed it was there.
Reading about folder and message manipulation in Tb, I figured I needed to get familiar with some interfaces, mainlynsIMsgFolder and nsIMsgDatabase. With this move came a triumph, my first step forward was to deal with the issue of being able to fullscreen with no message in focus.
if (gFolderDisplay.selectedMessage) { // Ensure a msg is selected before FSing
+1
So continuing on the tracks of message interfacing, I tried to accomplish one of the more ambitious goals which was to get next/prev message subjects or whether or not they are junk displayed in the new window chrome, but I couldn’t get this in even testable condition by submission time, so it was dropped from 0.3.
I chose to focus on the more core needs, like getting toggle functionality working, which simply asks for a boolean flag to point out whether or not the window is open. This is the part of the tunnel I was referring to with the all the lights blown out. Several hours of trying lots of different things, but at the end of the day the best I could do was getting toggle on but in a recursive fashion. That is to say, every new window opened would instantialize the flag anew for itself, and to close the new window would require moving one layer back and pressing F11 to toggle off. It was progress, and was still worth all the ass ache, which only made sleep that much sweeter.
The new day started and I wasted no time heading off into #extdev to ask my question on keeping variables between windows. Funny thing about my relationship with IRC; I notice I spend most of my time trying to answer my own questions, and the times I do go to the dev channel to ask a question I’ll usually take which short answer I get and run away with it to go Google it and generally crawl back into reclusive problem-solving. Something to work towards.
Anyway, I got a little push in the right direction, and although the term I searched provided by (icantrememberwho) wasn’t what got the job done, it linked in relevancy with something called window.opener, and my troubles evaporated.
That is 100% scam free toggle, baby.
But it wasn’t good enough.
For I began to wonder if vars left out in my javascript would mean that they become global variables, a curiosity I satisfied with a few mxr searches to try and find some kind of pattern with vars outside of any kind of bracket. It turned out true, any vars left outside brackets are preceded with a g, to indicate they are global. (ex: gFolderWhatever)
Time was running out, so I hit up #seneca for anyone with javascript knowledge wanting to get a little bit of last minute contribution cred. To my great fortune, humph was around and gave me the correct way to use vars in my code’s case. It worked, I lost definition on my vars. What I was missing was using this._, and solving that was one step forward and two steps backwards. I understood js variables inside an object, but it pulled me back a step to recursion again.window.opener wasn’t cooperating with the rest of its classmates [see what I did there ;)] and each window would have its own respective object instantialization.
The light! It has abandoned meh.
For a few hours, I busted my brain trying to correctly sync my variables between windows to the point where I wondered if the mozilla community would forgive me for just sticking with sloppy global variables in an extension, but then it hit me.
var fsner = {
fs: null, // fullscreen window handler
dbView: null, // nsIMsgDBView mail database handler (still to come)
onLoad: function() {
this.initialized = true;
if (window.opener)
this.fs = window.opener.fs; // sync handler between two chrome windows
},
...
if (window.opener)
window.opener.fs = this.fs; // sync handler between windows
This is one of those facepalm discoveries, but no less valuable than the straight forward ones read on a tutorial: seeing as how var fs is contained within var fsner, it would make sense to call window.opener’s fs from within fsner (DUHHHH).
if (window.opener)
this.fs = window.opener.fsner.fs; // sync handler between two chrome windows
},
...
if (window.opener)
window.opener.fsner.fs = this.fs; // sync handler between windows
}
And well… that’s it. A hell of a journey to 0.3 and a product that doesn’t have a high school project feel to it.
Submitting
this baby was just as much of a pain. =)
Looong story short, I had to adjust, rebuild (that whole chrome registry problem I was having hasn’t gone away (3xlonger to do stuff)), and repack near 20 times, not only that, but if you can see that I submitted my extension with only half of the information on it written out. Posted the _actual_ info bit on the extension, and my tester, Joe, pointed out that it still says 0.2 on installation. install.rdf hadn’t been updated.
iouvbaoifjesauoigfhoiasmvieoshaofijeaisouvoaiueon igfsaoepifyeoiasv;fyep;afvyias’[iefasop’euosayhgf98 2
=)
And so here I stand–before all ye gracious souls who spend/waste the time reading along to my epic saga, even though there are no love scenes–confident that this will not be my last post.







