summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--program/js/app.js28
1 files changed, 28 insertions, 0 deletions
diff --git a/program/js/app.js b/program/js/app.js
index 0a1afe8af..34fa68572 100644
--- a/program/js/app.js
+++ b/program/js/app.js
@@ -2585,6 +2585,7 @@ function rcube_webmail()
form.elements['_folder_name'].value = '';
}
+ this.sort_subscription_list();
};
@@ -2733,6 +2734,33 @@ function rcube_webmail()
return new_row;
};
+ // sort subscription folder list
+ this.sort_subscription_list = function()
+ {
+ var tbody = this.gui_objects.subscriptionlist.tBodies[0];
+ for (var i = 0; i<(tbody.childNodes.length-1); i++)
+ {
+ if (this.env.subscriptionrows[tbody.childNodes[i].id]!=null)
+ {
+ 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;
+ }
+ }
+ }
+ }
+ };
+
/*********************************************************/
/********* GUI functionality *********/