Revision 1k


Tested with Mozilla 1.7.12, Firefox 1.5, Opera 9, Konq, and IE 6. Not yet tried with Safari. Will work fine in old browsers. Need to test marginals (those with annoyingly sporadic DOM support that claim they work but don’t)

Currently Broken, I am working on a rewrite (to remove a known bug, and reduce cpu usage)

If you'd like to try the script out, visit the previous version at rev1k.

A demo with it working in the Trac Ticket page, and the Query page.

How to use it:

  1. Download componentselect.js
  2. Include the file in the Trac page(s), via a <script type="text/javascript" src="componentselect.js"></script>, or copy&paste the code at the bottom of trac.js
  3. Add #properties select.haikucomponent { float: left; clear: left; } to the css file

Changes

Version 1a
Initial release.
Version 1b
Fixed <select>s that don’t contain an initial “null” selection, so we add the first sub component <select> now too.
Version 1c
D’oh. Fixed change 1b for cases when <select> doesn’t have a choice selected. We now tell the browser to pick the first item.
Version 1d
New Features!
I found a problem while playing with Trac [ my, isn't testing good fun? :) ] In the case that a component has already been selected, we add all the dropdowns for that range of subchoices, so drivers/graphics/nvidia adds three <select>s. However, with playing around with browsers, onchange doesn't fire if you click an item that is already selected. So we need to add '' as an option to default to to allow users to select the top most choice and have an update. (Forgot to mention, it also fixes the flaw with '' entries and adds sorting so we dont get duplicate entries) Feedback via email
Version 1e
New Features!
Query requires a new revision, and here it is. Needs testing.
Sadly it's not as drop-in friendly as the previous, you have to follow an extra step above
Fixed wkornew's suggestion about not having '' entries, and automagically expanding to leafs
Reworked the system to be query-friendly (didnt understand multiple component selectors before)
Writing a clean hook system should be up to the Trac devs, this is just an easy (and acceptable 'hack')
Fixed the same bug repaired in rev1c, grr, Konq
Version 1f
New Features!
Added support for selecting partial components according to a request
Version 1g
Made the script quicker by reducing calls to updateSelection.
Script tidy.
Version 1h
Rewrote code handling '' entries, it should be cleaner too.
Version 1i
New Features!
Added support for query page using static selects aswell as dynamic ones.
Corrected a bug with Trac by unescaping &amp;s
Version 1j
New Features!
query.js no longer needs hacking as we hook into the add_filter select now.
Removed the &amp; hack.