annotate public/javascripts/repository_navigation.js @ 1452:d6b9fd02bb89 feature_36_js_refactoring

Deprecated develoment branch.
author luisf <luis.figueira@eecs.qmul.ac.uk>
date Fri, 11 Oct 2013 17:01:24 +0100
parents 513646585e45
children 433d4f72a19b
rev   line source
Chris@0 1 Event.observe(window,'load',function() {
Chris@0 2 /*
Chris@0 3 If we're viewing a tag or branch, don't display it in the
Chris@0 4 revision box
Chris@0 5 */
Chris@0 6 var branch_selected = $('branch') && $('rev').getValue() == $('branch').getValue();
Chris@0 7 var tag_selected = $('tag') && $('rev').getValue() == $('tag').getValue();
Chris@0 8 if (branch_selected || tag_selected) {
Chris@0 9 $('rev').setValue('');
Chris@0 10 }
Chris@0 11
Chris@0 12 /*
Chris@0 13 Copy the branch/tag value into the revision box, then disable
Chris@0 14 the dropdowns before submitting the form
Chris@0 15 */
Chris@0 16 $$('#branch,#tag').each(function(e) {
Chris@0 17 e.observe('change',function(e) {
Chris@0 18 $('rev').setValue(e.element().getValue());
Chris@0 19 $$('#branch,#tag').invoke('disable');
Chris@0 20 e.element().parentNode.submit();
Chris@0 21 $$('#branch,#tag').invoke('enable');
Chris@0 22 });
Chris@0 23 });
Chris@0 24
Chris@0 25 /*
Chris@0 26 Disable the branch/tag dropdowns before submitting the revision form
Chris@0 27 */
Chris@0 28 $('rev').observe('keydown', function(e) {
Chris@0 29 if (e.keyCode == 13) {
Chris@0 30 $$('#branch,#tag').invoke('disable');
Chris@0 31 e.element().parentNode.submit();
Chris@0 32 $$('#branch,#tag').invoke('enable');
Chris@0 33 }
Chris@0 34 });
Chris@0 35 })