Mercurial > hg > soundsoftware-site
comparison public/javascripts/select_list_move.js @ 1517:dffacf8a6908 redmine-2.5
Update to Redmine SVN revision 13367 on 2.5-stable branch
author | Chris Cannam |
---|---|
date | Tue, 09 Sep 2014 09:29:00 +0100 |
parents | 261b3d9a4903 |
children |
comparison
equal
deleted
inserted
replaced
1516:b450a9d58aed | 1517:dffacf8a6908 |
---|---|
49 swapOptions(theSel, index-1, index); | 49 swapOptions(theSel, index-1, index); |
50 theSel.selectedIndex = index-1; | 50 theSel.selectedIndex = index-1; |
51 } | 51 } |
52 } | 52 } |
53 | 53 |
54 function moveOptionTop(theSel) { | |
55 var index = theSel.selectedIndex; | |
56 | |
57 if (index > 0) { | |
58 for (i=index; i>0; i--) { | |
59 swapOptions(theSel, i-1, i); | |
60 } | |
61 theSel.selectedIndex = 0; | |
62 } | |
63 } | |
64 | |
54 function moveOptionDown(theSel) { | 65 function moveOptionDown(theSel) { |
55 var index = theSel.selectedIndex; | 66 var index = theSel.selectedIndex; |
56 if (index < theSel.length - 1) { | 67 if (index < theSel.length - 1) { |
57 swapOptions(theSel, index, index+1); | 68 swapOptions(theSel, index, index+1); |
58 theSel.selectedIndex = index+1; | 69 theSel.selectedIndex = index+1; |
59 } | 70 } |
60 } | 71 } |
61 | 72 |
73 function moveOptionBottom(theSel) { | |
74 var index = theSel.selectedIndex; | |
75 var indexTop = theSel.length - 1; | |
76 if (index < theSel.length - 1) { | |
77 for (i=index; i<indexTop; i++) { | |
78 swapOptions(theSel, i+1, i); | |
79 } | |
80 theSel.selectedIndex = indexTop; | |
81 } | |
82 } | |
83 | |
62 // OK | 84 // OK |
63 function selectAllOptions(id) { | 85 function selectAllOptions(id) { |
64 var select = $('#'+id); | 86 var select = $('#'+id); |
65 select.children('option').attr('selected', true); | 87 select.children('option').attr('selected', true); |
66 } | 88 } |