Rev | Line | |
---|
[6779] | 1 | (function() |
---|
| 2 | { |
---|
| 3 | |
---|
| 4 | function addApplication() |
---|
| 5 | { |
---|
| 6 | var select_appList = document.getElementById('apps_list'); |
---|
| 7 | for(var i = 0; i < select_appList.options.length ; i++) |
---|
| 8 | if( select_appList.options[i].selected ) |
---|
| 9 | { |
---|
| 10 | var select_appEnabled = document.getElementById('apps_enabled'); |
---|
| 11 | var flag = false; |
---|
| 12 | for(var j = 0; j < select_appEnabled.options.length ; j++ ) |
---|
| 13 | { |
---|
| 14 | if( select_appEnabled.options[j].value === select_appList.options[i].value ) |
---|
| 15 | flag = true; |
---|
| 16 | } |
---|
| 17 | |
---|
| 18 | if ( !flag ) |
---|
| 19 | select_appEnabled.options[select_appEnabled.length] = new Option(select_appList.options[i].text, select_appList.options[i].value, false, true); |
---|
| 20 | } |
---|
| 21 | } |
---|
| 22 | |
---|
| 23 | function removeApplication() |
---|
| 24 | { |
---|
| 25 | var select_appEnabled = document.getElementById('apps_enabled'); |
---|
| 26 | |
---|
| 27 | for(var i = 0 ; i < select_appEnabled.options.length; i++ ) |
---|
| 28 | if( select_appEnabled.options[i].selected ) |
---|
| 29 | { |
---|
| 30 | select_appEnabled.options[i].parentNode.removeChild(select_appEnabled.options[i]); |
---|
| 31 | i--; |
---|
| 32 | } |
---|
| 33 | } |
---|
| 34 | |
---|
| 35 | function Selected() |
---|
| 36 | { |
---|
| 37 | var select_appEnabled = document.getElementById('apps_enabled'); |
---|
| 38 | for(var i = 0 ; i < select_appEnabled.options.length; i++ ) |
---|
| 39 | select_appEnabled.options[i].selected = true; |
---|
| 40 | } |
---|
| 41 | |
---|
| 42 | function AppJabberit(){} |
---|
| 43 | |
---|
| 44 | AppJabberit.prototype.add = addApplication; |
---|
| 45 | AppJabberit.prototype.remove = removeApplication; |
---|
| 46 | AppJabberit.prototype.select_ = Selected; |
---|
| 47 | window.App = new AppJabberit; |
---|
| 48 | |
---|
| 49 | })(); |
---|
Note: See
TracBrowser
for help on using the repository browser.