Index: activeselect.css =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/activeselect/activeselect.css,v retrieving revision 1.1 diff -u -r1.1 activeselect.css --- activeselect.css 19 Feb 2006 06:18:16 -0000 1.1 +++ activeselect.css 7 Jan 2007 01:25:48 -0000 @@ -1,8 +1,26 @@ /* $Id: activeselect.css,v 1.1 2006/02/19 06:18:16 jaza Exp $ */ html.js select.form-activeselect { - background: url(throbber.gif) no-repeat; + background: url(throbber.gif) no-repeat 100% 2px; } html.js select.form-activeselect option { background-color: #fff; } + +/* IE hack */ +* html.js div.form-activeselect-throbber { + background: url(throbber.gif) no-repeat 0 0; +} +* html.js div.throbbing { + background: url(throbber.gif) no-repeat 0 -20px; +} + +/* Opera hack */ +@media all and (min-width: 0px) { + html.js div.form-activeselect-throbber { + background: url(throbber.gif) no-repeat 0 0; + } + html.js div.throbbing { + background: url(throbber.gif) no-repeat 0 -20px; + } +} Index: activeselect.js =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/activeselect/activeselect.js,v retrieving revision 1.18 diff -u -r1.18 activeselect.js --- activeselect.js 5 Jan 2007 15:57:53 -0000 1.18 +++ activeselect.js 7 Jan 2007 11:24:30 -0000 @@ -75,24 +75,30 @@ /** * Sets the width and background position of the activeselect element. + * Disable throbber */ Drupal.jsAS.prototype.setSelectWidth = function (width) { if (width != null) { - this.selectWidth = ((width * 10) * 1.5) + 20; + this.selectWidth = width * activeselectResizeFactor + 20; } $(this.input).css({ width: this.selectWidth +'px', backgroundPosition: (this.selectWidth - 35) +'px 2px' }); + + // disable throbber + this.throbber(false); } /** * Sets the width of the specified target element */ Drupal.jsAS.prototype.setTargetWidth = function (target, width) { + minWidth = 40; if (width != null) { - this.targets[target].targetWidth = (width * 10) * 1.2; + this.targets[target].targetWidth = width * activeselectResizeFactor; } + if (this.targets[target].targetWidth < minWidth) this.targets[target].targetWidth = minWidth; $(this.targets[target]).css({ width: this.targets[target].targetWidth +'px' }); @@ -149,7 +155,7 @@ // 'new Option()' used instead of appendChild(), because IE6 refuses to // display option text if the latter method is used (otherwise they seem // to behave the same). - $(this.targets[targetIndex]).append(new Option(text, value, false, selected)); + this.targets[targetIndex].options[this.targets[targetIndex].options.length] = new Option(text, value, false, selected); if (selected && !this.targets[targetIndex].multiple) { this.targets[targetIndex].selectedIndex = this.targets[targetIndex].options.length-1; } @@ -158,7 +164,7 @@ this.targets[targetIndex].selectedIndex = 0; } - if (this.hasClass(this.targets[targetIndex], 'form-activeselect')) { + if ($(this.targets[targetIndex]).attr('class', 'form-activeselect')) { // Since IE does not support the DOM 2 methods for manually firing an // event, we must cater especially to its needs. // Reference: http://www.howtocreate.co.uk/tutorials/javascript/domevents @@ -185,17 +191,16 @@ } /** - * Returns true if an element has a specified class name + * Toggle the throbber status */ -Drupal.jsAS.prototype.hasClass = function (node, className) { - if (node.className == className) { - return true; - } - var reg = new RegExp('(^| )'+ className +'($| )') - if (reg.test(node.className)) { - return true; +Drupal.jsAS.prototype.throbber = function(throbbing) { + var throbber = $('#' + this.input.id + '-throbber'); + if (!throbber) return; + if (throbbing) { + $(throbber).addClass('throbbing'); + } else { + $(throbber).removeClass('throbbing'); } - return false; } /** @@ -225,7 +230,11 @@ width: db.owner.selectWidth +'px', backgroundPosition: (db.owner.selectWidth - 35) +'px -18px' }); - var targetIds = []; + + // enable throbber + db.owner.throbber(true); + + var targetIds = []; for (var target = 0; target < targets.length; target++) { if (targets[target].id) { targetIds.push($(targets[target]).id().substr(5)); @@ -248,14 +257,15 @@ } }, error: function (xmlhttp) { - asdb.owner.setSelectWidth(null); + db.owner.setSelectWidth(null); alert('An HTTP error '+ xmlhttp.status +' occured.\n'+ db.uri); } - }); + }); }, this.delay); } // Global Killswitch if (Drupal.jsEnabled) { $(document).ready(Drupal.activeselectAutoAttach); + if (!activeselectResizeFactor) var activeselectResizeFactor = 9; } Index: activeselect.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/activeselect/activeselect.module,v retrieving revision 1.9 diff -u -r1.9 activeselect.module --- activeselect.module 5 Jan 2007 15:57:53 -0000 1.9 +++ activeselect.module 7 Jan 2007 01:39:16 -0000 @@ -82,10 +82,23 @@ foreach ($targets as $key => $target) { $targets[$key] = 'edit-'. check_plain($target); } - $extra .= ''. "\n"; + $extra .= ''. "\n"; $extra .= ''. "\n"; } _form_set_class($element, $class); - return theme('form_element', $element, ''). $extra; + $prefix = $element['#prefix']; + $suffix = $element['#suffix']; + $throbber = theme('activeselect_throbber', $element['#id']); + + $content = theme('form_element', $element, '