/** * $Id: selectbox.js 147 2006-12-20 22:53:19Z wingedfox $ * $HeadURL: https://svn.debugger.ru/repos/jslibs/BrowserExtensions/tags/BrowserExtensions.003/dom/selectbox.js $ * * Extends the selectbox interface * * @author Ilya Lebedev * @modified $Date: 2006-12-21 01:53:19 +0300 (Чтв, 21 Дек 2006) $ * @version $Rev: 147 $ * @title Selectbox * @license LGPL 2.1 or later */ // =================================================================== // // Author: Matt Kruse // Author: Ilya Lebedev // http://debugger.ru // // NOTICE: You may use this code for any purpose, commercial or // private, without any further permission from the author. You may // remove this notice from your final code if you wish, however it is // appreciated by the author if at least my web site address is kept. // // You may *NOT* re-distribute this code in any way except through its // use. That means, you can include it in your product, or your web // site, or any other form where the code is actually being used. You // may not put the plain javascript up on your site for download or // include it in your javascript libraries for download. // If you wish to share this code with others, please just point them // to the URL instead. // Please DO NOT link directly to my .js files from your site. Copy // the files to your server and use them there. Thank you. // =================================================================== // HISTORY // ------------------------------------------------------------------ // October 2, 2006: Rewritten in the OOP style and added number of useful features // June 12, 2003: Modified up and down functions to support more than // one selected option /* COMPATIBILITY: These are fairly basic functions - they should work on all browsers that support Javascript. */ /** * Provides control component for the select box * * @class * @param {String} id select box to attach control to * @scope public */ Selectbox = function (id /*: String*/) { var self = this; /** * Selectbox node * * @type HTMLSelectElement * @scope private */ var node; /** * List of all the options in the list * Format of the array elements * { 'value' : option value, * 'text' : option text, * 'defaultSelected' : default selection flag, * 'selected' : selection flag, * 'visible' : visible flag, * 'fixed' : fixes position in the list * } * * @type Array * @scope private */ var options = []; /** * Trackers does keep a track of the options * * @type Object * @scope private */ var trackers = { 'all' : [[]], 'added' : [[]], 'deleted' : [[]] } /** * @constructor */ var __construct = function () /* :void */{ if ((node = document.getElementById(id)) && node.tagName.toLowerCase() != 'select') throw new Error('Node with supplied id="'+id+'" is not the