Neil's Place

October 15, 2002

11:30 AM Resizable textareas

The following trick lets you add shortcut keys to resize textareas. By pressing Alt and the cursor keys, you can resize a textarea to fit the text you want to add. One might use this in Mozillazine forums or a WebMail system. First, add the following lines to userContent.css in your profile's chrome directory:

textarea {
  -moz-binding: url('resource:///res/builtin/myHTMLBindings.xml#textAreas');
}

Now, create a file res/builtin/myHTMLBindings.html in the Mozilla directory (or another file pointed to by the binding above). Add the following to it:

<xml version="1.0"?>
<bindings id="htmlBindings"
   xmlns="http://www.mozilla.org/xbl"
   xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<binding id="textAreas"
    extends="resource:///res/builtin/platformHTMLBindings.xml#textAreas">
  <handlers>
    <handler event="keypress" keycode="VK_LEFT" modifiers="alt">
      var siz=parseInt(window.getComputedStyle(this,null).
        getPropertyValue("width"));
      if (siz > 36) this.style.width=(siz-8)+"px";
      event.preventDefault();
    </handler>
    <handler event="keypress" keycode="VK_RIGHT" modifiers="alt">
      var siz=parseInt(window.getComputedStyle(this,null).
        getPropertyValue("width"));
      this.style.width=(siz+16)+"px";
      event.preventDefault();
    </handler>
    <handler event="keypress" keycode="VK_UP" modifiers="alt">
      var siz=parseInt(window.getComputedStyle(this,null).
        getPropertyValue("height"));
      if (siz > 36) this.style.height=(siz-8)+"px";
      event.preventDefault();
    </handler>
    <handler event="keypress" keycode="VK_DOWN" modifiers="alt">
      var siz=parseInt(window.getComputedStyle(this,null).
        getPropertyValue("height"));
      this.style.height=(siz+16)+"px";
      event.preventDefault();
    </handler>
  </handlers>
</binding>
</bindings>

You might want to change the keys used. A similar technique can be used for other text fields.

Comments ( 29 )

October 11, 2002

12:00 PM Toolbar grippies

The toolbargrippy element has been removed from Mozilla.

Comments ( 0 )

October 10, 2002

12:49 PM Memory Quiz

Here is a quiz. Which of the following systems is operating more effectively?

  1. A system with 128 MB of memory, running 3 applications using a total of 60 MB of memory.
  2. A system with 64 MB of memory, running the same 3 applications using a total of 60 MB of memory.
  3. A system with 128 MB of memory, running the same 3 applications using a total of 120 MB of memory.

Comments ( 32 )

October 9, 2002

8:22 PM Which browser to use?

There's been a lot of talk lately about various products named after mythical beasts (Phoenix, Thunderbird, Chimera). Right now, I have no compelling reason to use them though. Perhaps when the mail/news client is ready, I will. By then, I won't have any compelling reason not to use it either.

I wonder why the preferences in Phoenix are so strangely organized? Or why they used the Orbit theme icons instead of these?

Comments ( 31 )


7:16 PM New Mozilla CSS properties

Nightly Mozilla builds now include support for the CSS3 properties background-clip and background-origin, although they are prefixed by '-moz-'.

  • -moz-background-clip = border | padding
    Set to whether the background is drawn under the border, or whether it ends at the padding.
  • -moz-background-origin = border | padding | content
    Set to indicate where the upper left corner of the background is positioned. This lets one put a background image just behind the content or have it extend into the padding or border as well.

Comments ( 11 )

October 8, 2002

6:12 PM Some minor tutorial updates

I just fixed some of the XBL examples in the tutorial. And also recently fixed the double-slashes in the resource URLs in the earlier sections.

Comments ( 19 )


4:10 PM Welcome

Hey! It's one of those Weblog thingies.

Comments ( 1 )