2005-09-07

Experimental select element filter user script

I got the idea for this Greasemonkey user script at work. We use a financial system with a HTML interface. The hour registration page has a fairly large project list. The items in the list are formatted this way: “Project code, client name abbreviation, project name”. I thought it would be a big help if I could select a project just by typing a part of the project name.

The select element filter user script was born. As the title of this post states, it is still experimental. It only converts select elements with more than 20 options, you're free to change that number if you like.

Try this script if you think it is useful to. I suggest not to use it on every page for now. There is still a small usability issue that needs to be addressed, but it works fine on select list of which you know the content. If you have any suggestions, questions or remarks, just let me know. I'll post an improved version later this week.

Update 2005-10-04: improved version is available.

2005-09-05

Root node wild card selector for IE only rules

Justin Rogers wrote a post on IEBlog about improving the CSS 2.1 strict parser for IE 7. IE 7 skips * html selectors in strict mode. I wonder what happens if you use the “comment before doctype” hack to get IE 6 in quirks mode.

<!-- IE6 in quirks -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

I anticipate that IE 7 will render in strict mode using the above hack.

Update: Using this hack will cause IE 7 to render in quirks mode according to John A. Bilicki.

Tags:

2005-09-04

Javascript objects: accessing sibling functions

I was messing around in Javascript to be able to access sibling functions in an object. Let's say you have the following code:

function MyObject(){
  this.click = function(){
    // Here I want to call myFunction
  }

  this.myFunction = function(){
  }

  whatever.addEventListener('click', this.click, false);
}

I used an ugly hack to access myFunction. I passed the object instance's variable name to the object as a parameter and used it to access the function using the eval function. Eew!

There is a far more simple way to do this. Create a variable in your object and assign this to it:

function MyObject(){
  var obj = this;

  this.click = function(){
    obj.myFunction();
  }

  this.myFunction = function(){
  }

  whatever.addEventListener('click', this.click, false);
}

Vacation pictures

For those of you who are interested: I've posted some vacation pictures on my personal (Dutch) blog.

2005-09-02

Blogger keep current time user script now auto checks

The checkbox in the Blogger keep current time user script (original post) for Greasemonkey will now be automatically checked for new and for draft posts.

Screenshot

Note: I've renamed the script. You'll have to uninstall the script called ‘Blogger enhancements’ if you have the old version of the script installed.