Chris@909: Event.observe(window,'load',function() { Chris@909: /* Chris@909: If we're viewing a tag or branch, don't display it in the Chris@909: revision box Chris@909: */ Chris@909: var branch_selected = $('branch') && $('rev').getValue() == $('branch').getValue(); Chris@909: var tag_selected = $('tag') && $('rev').getValue() == $('tag').getValue(); Chris@909: if (branch_selected || tag_selected) { Chris@909: $('rev').setValue(''); Chris@909: } Chris@909: Chris@909: /* Chris@909: Copy the branch/tag value into the revision box, then disable Chris@909: the dropdowns before submitting the form Chris@909: */ Chris@909: $$('#branch,#tag').each(function(e) { Chris@909: e.observe('change',function(e) { Chris@909: $('rev').setValue(e.element().getValue()); Chris@909: $$('#branch,#tag').invoke('disable'); Chris@909: e.element().parentNode.submit(); Chris@909: $$('#branch,#tag').invoke('enable'); Chris@909: }); Chris@909: }); Chris@909: Chris@909: /* Chris@909: Disable the branch/tag dropdowns before submitting the revision form Chris@909: */ Chris@909: $('rev').observe('keydown', function(e) { Chris@909: if (e.keyCode == 13) { Chris@909: $$('#branch,#tag').invoke('disable'); Chris@909: e.element().parentNode.submit(); Chris@909: $$('#branch,#tag').invoke('enable'); Chris@909: } Chris@909: }); Chris@909: })