annotate .svn/pristine/a3/a3be1d86be827009cae521df133b9bd67e4c3929.svn-base @ 1327:287f201c2802 redmine-2.2-integration

Add italic
author Chris Cannam <chris.cannam@soundsoftware.ac.uk>
date Wed, 19 Jun 2013 20:56:22 +0100
parents 038ba2d95de8
children
rev   line source
Chris@1296 1 var NS4 = (navigator.appName == "Netscape" && parseInt(navigator.appVersion) < 5);
Chris@1296 2
Chris@1296 3 function addOption(theSel, theText, theValue)
Chris@1296 4 {
Chris@1296 5 var newOpt = new Option(theText, theValue);
Chris@1296 6 var selLength = theSel.length;
Chris@1296 7 theSel.options[selLength] = newOpt;
Chris@1296 8 }
Chris@1296 9
Chris@1296 10 function swapOptions(theSel, index1, index2)
Chris@1296 11 {
Chris@1296 12 var text, value;
Chris@1296 13 text = theSel.options[index1].text;
Chris@1296 14 value = theSel.options[index1].value;
Chris@1296 15 theSel.options[index1].text = theSel.options[index2].text;
Chris@1296 16 theSel.options[index1].value = theSel.options[index2].value;
Chris@1296 17 theSel.options[index2].text = text;
Chris@1296 18 theSel.options[index2].value = value;
Chris@1296 19 }
Chris@1296 20
Chris@1296 21 function deleteOption(theSel, theIndex)
Chris@1296 22 {
Chris@1296 23 var selLength = theSel.length;
Chris@1296 24 if(selLength>0)
Chris@1296 25 {
Chris@1296 26 theSel.options[theIndex] = null;
Chris@1296 27 }
Chris@1296 28 }
Chris@1296 29
Chris@1296 30 function moveOptions(theSelFrom, theSelTo)
Chris@1296 31 {
Chris@1296 32
Chris@1296 33 var selLength = theSelFrom.length;
Chris@1296 34 var selectedText = new Array();
Chris@1296 35 var selectedValues = new Array();
Chris@1296 36 var selectedCount = 0;
Chris@1296 37
Chris@1296 38 var i;
Chris@1296 39
Chris@1296 40 for(i=selLength-1; i>=0; i--)
Chris@1296 41 {
Chris@1296 42 if(theSelFrom.options[i].selected)
Chris@1296 43 {
Chris@1296 44 selectedText[selectedCount] = theSelFrom.options[i].text;
Chris@1296 45 selectedValues[selectedCount] = theSelFrom.options[i].value;
Chris@1296 46 deleteOption(theSelFrom, i);
Chris@1296 47 selectedCount++;
Chris@1296 48 }
Chris@1296 49 }
Chris@1296 50
Chris@1296 51 for(i=selectedCount-1; i>=0; i--)
Chris@1296 52 {
Chris@1296 53 addOption(theSelTo, selectedText[i], selectedValues[i]);
Chris@1296 54 }
Chris@1296 55
Chris@1296 56 if(NS4) history.go(0);
Chris@1296 57 }
Chris@1296 58
Chris@1296 59 function moveOptionUp(theSel) {
Chris@1296 60 var index = theSel.selectedIndex;
Chris@1296 61 if (index > 0) {
Chris@1296 62 swapOptions(theSel, index-1, index);
Chris@1296 63 theSel.selectedIndex = index-1;
Chris@1296 64 }
Chris@1296 65 }
Chris@1296 66
Chris@1296 67 function moveOptionDown(theSel) {
Chris@1296 68 var index = theSel.selectedIndex;
Chris@1296 69 if (index < theSel.length - 1) {
Chris@1296 70 swapOptions(theSel, index, index+1);
Chris@1296 71 theSel.selectedIndex = index+1;
Chris@1296 72 }
Chris@1296 73 }
Chris@1296 74
Chris@1296 75 // OK
Chris@1296 76 function selectAllOptions(id)
Chris@1296 77 {
Chris@1296 78 var select = $('#'+id);/*
Chris@1296 79 for (var i=0; i<select.options.length; i++) {
Chris@1296 80 select.options[i].selected = true;
Chris@1296 81 }*/
Chris@1296 82 select.children('option').attr('selected', true);
Chris@1296 83 }