diff options
Diffstat (limited to 'js')
-rw-r--r-- | js/util.js | 76 |
1 files changed, 0 insertions, 76 deletions
diff --git a/js/util.js b/js/util.js index 98bafb664..ce7ea4cae 100644 --- a/js/util.js +++ b/js/util.js @@ -135,82 +135,6 @@ function bz_overlayBelow(item, parent) { } /** - * Create wanted options in a select form control. - * - * @param aSelect Select form control to manipulate. - * @param aValue Value attribute of the new option element. - * @param aTextValue Value of a text node appended to the new option - * element. - * @param aOwnerDocument Owner document of the new option element. If not - * specified then "document" will be used. - * @return Created option element. - */ -function bz_createOptionInSelect(aSelect, aValue, aTextValue, aOwnerDocument) -{ - if (!aOwnerDocument) { - aOwnerDocument = document; - } - - var myOption = aOwnerDocument.createElement("option"); - myOption.setAttribute("value", aValue); - - var myTextNode = aOwnerDocument.createTextNode(aTextValue) - myOption.appendChild(myTextNode); - - aSelect.appendChild(myOption); - - return myOption; -} - -/** - * Clears all options from a select form control. - * - * @param aElm Select form control of which options to clear. - * @param aSkipFirst Boolean; true to skip (not clear) first option in the - * select and false to remove all options. - */ -function bz_clearOptions(aElm, aSkipFirst) -{ - var start = 0; - - // Skip the first element? (for 'Choose One' type foo) - if (aSkipFirst) { - start = 1; - } - - var length = aElm.options.length; - - for (var run = start; run < length; run++) { - aElm.removeChild(aElm.options[start]); - } -} - -/** - * Takes an array and moves all the values to an select. - * - * @param aSelect Select form control to populate. Will be cleared - * before array values are created in it. - * @param aArray Array with values to populate select with. - * @param aSkipFirst Boolean; true to skip (not touch) first option in the - * select and false to remove all options. - * @param aUseNameAsValue Boolean; true if name is used as value and false if - * not. - */ -function bz_populateSelectFromArray(aSelect, aArray, aSkipFirst, aUseNameAsValue) -{ - // Clear the field - bz_clearOptions(aSelect, aSkipFirst); - - for (var run = 0; run < aArray.length; run++) { - if (aUseNameAsValue) { - bz_createOptionInSelect(aSelect, aArray[run], aArray[run]); - } else { - bz_createOptionInSelect(aSelect, aArray[run][0], aArray[run][0]); - } - } -} - -/** * Checks if a specified value is in the specified array. * * @param aArray Array to search for the value. |