summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrobin <robin@208e9e7b-5314-0410-a742-e7e81cd9613c>2007-02-21 10:11:59 +0000
committerrobin <robin@208e9e7b-5314-0410-a742-e7e81cd9613c>2007-02-21 10:11:59 +0000
commit321f5f39122b950a5557f243318839a429f61e90 (patch)
treee1f237e43ccaab70f62fe995f9abee5389d36cb9
parentad132169739f65b2ed2e97dfb550e6b538e652b1 (diff)
Faster sorting of subscription folder list.
git-svn-id: https://svn.roundcube.net/trunk@489 208e9e7b-5314-0410-a742-e7e81cd9613c
-rw-r--r--roundcubemail/program/js/app.js31
1 files changed, 15 insertions, 16 deletions
diff --git a/roundcubemail/program/js/app.js b/roundcubemail/program/js/app.js
index 34fa68572..376990cb1 100644
--- a/roundcubemail/program/js/app.js
+++ b/roundcubemail/program/js/app.js
@@ -2737,28 +2737,27 @@ function rcube_webmail()
// sort subscription folder list
this.sort_subscription_list = function()
{
+ var index = new Array();
var tbody = this.gui_objects.subscriptionlist.tBodies[0];
+ var swapped = false;
for (var i = 0; i<(tbody.childNodes.length-1); i++)
- {
if (this.env.subscriptionrows[tbody.childNodes[i].id]!=null)
+ index.push(i);
+ for (i = 0; i<(index.length-1); i++)
+ {
+ if (this.env.subscriptionrows[tbody.childNodes[index[i]].id][0]>
+ this.env.subscriptionrows[tbody.childNodes[index[i+1]].id][0])
{
- var swapped = false;
- for (var j = i+1; j<(tbody.childNodes.length); j++)
- {
- if ((this.env.subscriptionrows[tbody.childNodes[j].id]!=null) &&
- (this.env.subscriptionrows[tbody.childNodes[i].id][0]>
- this.env.subscriptionrows[tbody.childNodes[j].id][0]))
- {
- var swap = tbody.replaceChild(tbody.childNodes[i], tbody.childNodes[j]);
- if (typeof(tbody.childNodes[i]) != 'undefined')
- tbody.insertBefore(swap, tbody.childNodes[i])
- else
- tbody.appendChild(swap);
- swapped = true;
- }
- }
+ var swap = tbody.replaceChild(tbody.childNodes[index[i]], tbody.childNodes[index[i+1]]);
+ if (typeof(tbody.childNodes[index[i]]) != 'undefined')
+ tbody.insertBefore(swap, tbody.childNodes[index[i]])
+ else
+ tbody.appendChild(swap);
+ swapped = true;
}
}
+ if (swapped)
+ this.sort_subscription_list();
};