diff options
author | Petr Vobornik <pvoborni@redhat.com> | 2013-03-29 15:27:58 +0100 |
---|---|---|
committer | Petr Vobornik <pvoborni@redhat.com> | 2013-05-06 16:22:21 +0200 |
commit | 1b90b3b65ea214a3a09922f6b9c1de304e5257da (patch) | |
tree | 65693ef7db16618eb76c86e4848dd88c4582c172 /install/ui/src/libs | |
parent | 344e15452a64ef9dc43a66a7e0085aef0eb7c175 (diff) | |
download | freeipa-1b90b3b65ea214a3a09922f6b9c1de304e5257da.tar.gz freeipa-1b90b3b65ea214a3a09922f6b9c1de304e5257da.tar.xz freeipa-1b90b3b65ea214a3a09922f6b9c1de304e5257da.zip |
Add phase on exact position
https://fedorahosted.org/freeipa/ticket/3235
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 33737b564..77d17c56a 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; |