diff options
Diffstat (limited to 'install/ui/src/libs')
-rwxr-xr-x | install/ui/src/libs/jquery.ordered-map.js | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/install/ui/src/libs/jquery.ordered-map.js b/install/ui/src/libs/jquery.ordered-map.js index 33737b56..77d17c56 100755 --- a/install/ui/src/libs/jquery.ordered-map.js +++ b/install/ui/src/libs/jquery.ordered-map.js @@ -35,15 +35,25 @@ jQuery.ordered_map = jQuery.fn.ordered_map = function(map) { return that.map[key]; }; - that.put = function(key, value) { + that.put = function(key, value, position) { + + var undefined; var i = that.get_key_index(key); if (i >= 0) { that.values[i] = value; } else { - that.keys.push(key); - that.values.push(value); - that.length = that.keys.length; + if (typeof position !== 'number') { + that.keys.push(key); + that.values.push(value); + that.length = that.keys.length; + } else { + if (position < 0) position = 0; + else if (position > that.length) position = that.length; + that.keys.splice(position, 0, key); + that.values.splice(position, 0, value); + that.length = that.keys.length; + } } that.map[key] = value; |