To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.
root / public / javascripts / repository_navigation.js @ 441:cbce1fd3b1b7
History | View | Annotate | Download (1.02 KB)
| 1 |
Event.observe(window,'load',function() { |
|---|---|
| 2 |
/*
|
| 3 |
If we're viewing a tag or branch, don't display it in the
|
| 4 |
revision box
|
| 5 |
*/
|
| 6 |
var branch_selected = $('branch') && $('rev').getValue() == $('branch').getValue(); |
| 7 |
var tag_selected = $('tag') && $('rev').getValue() == $('tag').getValue(); |
| 8 |
if (branch_selected || tag_selected) {
|
| 9 |
$('rev').setValue(''); |
| 10 |
} |
| 11 |
|
| 12 |
/*
|
| 13 |
Copy the branch/tag value into the revision box, then disable
|
| 14 |
the dropdowns before submitting the form
|
| 15 |
*/
|
| 16 |
$$('#branch,#tag').each(function(e) { |
| 17 |
e.observe('change',function(e) { |
| 18 |
$('rev').setValue(e.element().getValue()); |
| 19 |
$$('#branch,#tag').invoke('disable'); |
| 20 |
e.element().parentNode.submit(); |
| 21 |
$$('#branch,#tag').invoke('enable'); |
| 22 |
}); |
| 23 |
}); |
| 24 |
|
| 25 |
/*
|
| 26 |
Disable the branch/tag dropdowns before submitting the revision form
|
| 27 |
*/
|
| 28 |
$('rev').observe('keydown', function(e) { |
| 29 |
if (e.keyCode == 13) { |
| 30 |
$$('#branch,#tag').invoke('disable'); |
| 31 |
e.element().parentNode.submit(); |
| 32 |
$$('#branch,#tag').invoke('enable'); |
| 33 |
} |
| 34 |
}); |
| 35 |
}) |