Tag Archives: chrome

Scratchpad ported to Thunderbird. Kinda.

Firefox has a sweet suite of developer tools. If you haven’t used them, you’re seriously missing out.

Thunderbird, on the other hand, has very little in the way of developer tools. We used to have ChromeBug, but then that project went by the wayside when the Firebug developers decided to focus more on, well, Firebug.

And ever since, debugging and fiddling around in Thunderbird has been a pain.

So a few folks on the TB team decided to take a crack at porting one of Firefox’s tools to Thunderbird. We chose Scratchpad (or rather, its earlier incarnation, “Workspace”), because being able to execute snippets of script on the fly is super-useful for trying stuff out.

So without further ado, here it is – Workspace for Thunderbird.

Install that, and a new Workspace menuitem appears under Tools. This will open up Workspace. Make sure to switch your Context to Chrome for superpowers.

Overriding Firefox’s Window.Alert – Part 1

Window.alert is a native function built into Firefox – but that doesn’t mean it can’t be overridden.

Check this out:

Open Firebug, and get to the console.  Then, click that little red arrow at the end of the input line so that you get the large box input on the right side of the screen.

Type this into the input box:

var alert_count = 0;
var old_alert = window.alert;
var alert_max = 5;
window.alert = function(alert_text) {
  if (alert_count < alert_max) {
    ++alert_count;
    old_alert(alert_text);
  } else {
    console.log("Reached maximum alerts");
  }
}

Now, hit “Run” at the bottom of that input window.  We’ve just overridden the window.alert function during runtime.

Hit “Clear” at the bottom of the input window, and type in:

for (i = 0; i < 10; ++i) {
  alert(i);
}

Hit “Run”.  Click “OK” for the first 5 alert windows, and watch as the rest of them are spewed out to the console.  Nice.

So, I don’t think this helps me much in creating my plug-in, but it’s interesting to see how window.alert is malliable at run-time.

This seems to be a more relevant discovery – Mozilla’s Chrome lets me create an alert popup with a checkbox using alertCheck.  I think this is exactly what I’m looking for.

I’ll tinker with it over the next few days, and post some code.