Changeset 489 in subversion


Ignore:
Timestamp:
Feb 21, 2007 5:11:59 AM (6 years ago)
Author:
robin
Message:

Faster sorting of subscription folder list.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/roundcubemail/program/js/app.js

    r488 r489  
    27382738  this.sort_subscription_list = function() 
    27392739    { 
     2740    var index = new Array(); 
    27402741    var tbody = this.gui_objects.subscriptionlist.tBodies[0]; 
     2742    var swapped = false; 
    27412743    for (var i = 0; i<(tbody.childNodes.length-1); i++) 
    2742       { 
    27432744      if (this.env.subscriptionrows[tbody.childNodes[i].id]!=null) 
    2744         { 
    2745         var swapped = false; 
    2746         for (var j = i+1; j<(tbody.childNodes.length); j++) 
    2747           { 
    2748           if ((this.env.subscriptionrows[tbody.childNodes[j].id]!=null) && 
    2749               (this.env.subscriptionrows[tbody.childNodes[i].id][0]> 
    2750                this.env.subscriptionrows[tbody.childNodes[j].id][0])) 
    2751             { 
    2752             var swap = tbody.replaceChild(tbody.childNodes[i], tbody.childNodes[j]); 
    2753             if (typeof(tbody.childNodes[i]) != 'undefined') 
    2754               tbody.insertBefore(swap, tbody.childNodes[i]) 
    2755             else 
    2756               tbody.appendChild(swap); 
    2757             swapped = true; 
    2758             } 
    2759           } 
    2760         } 
    2761       } 
     2745        index.push(i); 
     2746    for (i = 0; i<(index.length-1); i++) 
     2747      { 
     2748      if (this.env.subscriptionrows[tbody.childNodes[index[i]].id][0]> 
     2749          this.env.subscriptionrows[tbody.childNodes[index[i+1]].id][0]) 
     2750        { 
     2751        var swap = tbody.replaceChild(tbody.childNodes[index[i]], tbody.childNodes[index[i+1]]); 
     2752        if (typeof(tbody.childNodes[index[i]]) != 'undefined') 
     2753          tbody.insertBefore(swap, tbody.childNodes[index[i]]) 
     2754        else 
     2755          tbody.appendChild(swap); 
     2756        swapped = true; 
     2757        } 
     2758      } 
     2759    if (swapped) 
     2760      this.sort_subscription_list(); 
    27622761    }; 
    27632762 
Note: See TracChangeset for help on using the changeset viewer.