Changeset 4653 in subversion
- Timestamp:
- Apr 13, 2011 8:37:54 AM (2 years ago)
- File:
-
- 1 edited
-
trunk/roundcubemail/program/js/list.js (modified) (23 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/roundcubemail/program/js/list.js
r4477 r4653 103 103 // make references in internal array and set event handlers 104 104 if (row && String(row.id).match(/rcmrow([a-z0-9\-_=\+\/]+)/i)) { 105 var self = this ;106 varuid = RegExp.$1;105 var self = this, 106 uid = RegExp.$1; 107 107 row.uid = uid; 108 108 this.rows[uid] = {uid:uid, id:row.id, obj:row}; … … 171 171 if (sel) 172 172 this.clear_selection(); 173 174 // reset scroll position (in Opera) 175 if (this.frame) 176 this.frame.scrollTop = 0; 173 177 }, 174 178 … … 213 217 focus: function(e) 214 218 { 215 var id;219 var n, id; 216 220 this.focused = true; 217 221 218 for ( varn in this.selection) {222 for (n in this.selection) { 219 223 id = this.selection[n]; 220 224 if (this.rows[id] && this.rows[id].obj) { … … 237 241 blur: function() 238 242 { 239 var id;243 var n, id; 240 244 this.focused = false; 241 for ( varn in this.selection) {245 for (n in this.selection) { 242 246 id = this.selection[n]; 243 247 if (this.rows[id] && this.rows[id].obj) { … … 431 435 expand: function(row) 432 436 { 433 var depth, new_row; 434 var last_expanded_parent_depth; 437 var r, p, depth, new_row, last_expanded_parent_depth; 435 438 436 439 if (row) { … … 450 453 while (new_row) { 451 454 if (new_row.nodeType == 1) { 452 varr = this.rows[new_row.uid];455 r = this.rows[new_row.uid]; 453 456 if (r) { 454 457 if (row && (!r.depth || r.depth <= depth)) … … 456 459 457 460 if (r.parent_uid) { 458 varp = this.rows[r.parent_uid];461 p = this.rows[r.parent_uid]; 459 462 if (p && p.expanded) { 460 463 if ((row && p == row) || last_expanded_parent_depth >= p.depth - 1) { … … 697 700 select_next: function() 698 701 { 699 var next_row = this.get_next_row(); 700 var prev_row = this.get_prev_row(); 701 var new_row = (next_row) ? next_row : prev_row; 702 var next_row = this.get_next_row(), 703 prev_row = this.get_prev_row(), 704 new_row = (next_row) ? next_row : prev_row; 705 702 706 if (new_row) 703 707 this.select_row(new_row.uid, false, false); … … 711 715 { 712 716 var row = this.get_first_row(); 713 if (row && mod_key) { 714 this.shift_select(row, mod_key); 715 this.triggerEvent('select'); 716 this.scrollto(row); 717 } 718 else if (row) 719 this.select(row); 717 if (row) { 718 if (mod_key) { 719 this.shift_select(row, mod_key); 720 this.triggerEvent('select'); 721 this.scrollto(row); 722 } 723 else { 724 this.select(row); 725 } 726 } 720 727 }, 721 728 … … 727 734 { 728 735 var row = this.get_last_row(); 729 if (row && mod_key) { 730 this.shift_select(row, mod_key); 731 this.triggerEvent('select'); 732 this.scrollto(row); 733 } 734 else if (row) 735 this.select(row); 736 if (row) { 737 if (mod_key) { 738 this.shift_select(row, mod_key); 739 this.triggerEvent('select'); 740 this.scrollto(row); 741 } 742 else { 743 this.select(row); 744 } 745 } 736 746 }, 737 747 … … 745 755 return; 746 756 747 var depth = this.rows[uid].depth; 748 var row = this.rows[uid].obj.nextSibling; 757 var depth = this.rows[uid].depth, 758 row = this.rows[uid].obj.nextSibling; 759 749 760 while (row) { 750 761 if (row.nodeType == 1) { … … 769 780 this.shift_start = id; 770 781 771 var from_rowIndex = this.rows[this.shift_start].obj.rowIndex,782 var n, from_rowIndex = this.rows[this.shift_start].obj.rowIndex, 772 783 to_rowIndex = this.rows[id].obj.rowIndex, 773 784 i = ((from_rowIndex < to_rowIndex)? from_rowIndex : to_rowIndex), … … 775 786 776 787 // iterate through the entire message list 777 for ( varn in this.rows) {788 for (n in this.rows) { 778 789 if (this.rows[n].obj.rowIndex >= i && this.rows[n].obj.rowIndex <= j) { 779 790 if (!this.in_selection(n)) { … … 782 793 } 783 794 else { 784 if (this.in_selection(n) && !control) {795 if (this.in_selection(n) && !control) { 785 796 this.highlight_row(n, true); 786 797 } … … 795 806 in_selection: function(id) 796 807 { 797 for (var n in this.selection)808 for (var n in this.selection) 798 809 if (this.selection[n]==id) 799 810 return true; … … 812 823 813 824 // reset but remember selection first 814 var select_before = this.selection.join(',');825 var n, select_before = this.selection.join(','); 815 826 this.selection = []; 816 827 817 for ( varn in this.rows) {828 for (n in this.rows) { 818 829 if (!filter || this.rows[n][filter] == true) { 819 830 this.last_selected = n; … … 844 855 845 856 // remember old selection 846 var select_before = this.selection.join(',');847 848 for ( varn in this.rows)857 var n, select_before = this.selection.join(','); 858 859 for (n in this.rows) 849 860 this.highlight_row(n, true); 850 861 … … 864 875 clear_selection: function(id) 865 876 { 866 var n um_select = this.selection.length;877 var n, num_select = this.selection.length; 867 878 868 879 // one row 869 880 if (id) { 870 for ( varn in this.selection)881 for (n in this.selection) 871 882 if (this.selection[n] == id) { 872 883 this.selection.splice(n,1); … … 876 887 // all rows 877 888 else { 878 for ( varn in this.selection)889 for (n in this.selection) 879 890 if (this.rows[this.selection[n]]) { 880 891 $(this.rows[this.selection[n]].obj).removeClass('selected').removeClass('unfocused'); … … 928 939 } 929 940 else { // unselect row 930 var p = $.inArray(id, this.selection); 931 var a_pre = this.selection.slice(0, p); 932 var a_post = this.selection.slice(p+1, this.selection.length); 941 var p = $.inArray(id, this.selection), 942 a_pre = this.selection.slice(0, p), 943 a_post = this.selection.slice(p+1, this.selection.length); 944 933 945 this.selection = a_pre.concat(a_post); 934 946 $(this.rows[id].obj).removeClass('selected').removeClass('unfocused'); … … 946 958 return true; 947 959 948 var keyCode = rcube_event.get_keycode(e) ;949 varmod_key = rcube_event.get_modifier(e);960 var keyCode = rcube_event.get_keycode(e), 961 mod_key = rcube_event.get_modifier(e); 950 962 951 963 switch (keyCode) { … … 1372 1384 column_replace: function(from, to) 1373 1385 { 1374 var cells = this.list.tHead.rows[0].cells,1386 var len, cells = this.list.tHead.rows[0].cells, 1375 1387 elem = cells[from], 1376 1388 before = cells[to], … … 1385 1397 1386 1398 // replace list cells 1387 for (r=0 ; r<this.list.tBodies[0].rows.length; r++) {1399 for (r=0, len=this.list.tBodies[0].rows.length; r<len; r++) { 1388 1400 row = this.list.tBodies[0].rows[r]; 1389 1401
Note: See TracChangeset
for help on using the changeset viewer.
