Ticket #11697: shift-check-multi-3.diff
File shift-check-multi-3.diff, 2.4 KB (added by , 15 years ago) |
---|
-
django/contrib/admin/media/js/actions.js
4 4 counterContainer = document.getElementsBySelector('span.action_counter'); 5 5 actionCheckboxes = document.getElementsBySelector('tr input.action-select'); 6 6 selectAll = document.getElementById('action-toggle'); 7 lastChecked = null; 7 8 for(var i = 0; i < counterContainer.length; i++) { 8 9 counterContainer[i].style.display = 'inline'; 9 10 } … … 15 16 }); 16 17 } 17 18 for(var i = 0; i < actionCheckboxes.length; i++) { 18 addEvent(actionCheckboxes[i], 'click', function() { 19 addEvent(actionCheckboxes[i], 'click', function(e) { 20 if (!e) { var e = window.event; } 21 var target = e.target ? e.target : e.srcElement; 22 if (lastChecked && lastChecked != target && e.shiftKey == true) { 23 var inrange = false; 24 lastChecked.checked = target.checked; 25 Actions.toggleRow(lastChecked.parentNode.parentNode, target.checked); 26 for (var i = 0; i < actionCheckboxes.length; i++) { 27 if (actionCheckboxes[i] == lastChecked || actionCheckboxes[i] == target) { 28 inrange = (inrange) ? false : true; 29 } 30 if (inrange) { 31 actionCheckboxes[i].checked = target.checked; 32 Actions.toggleRow(actionCheckboxes[i].parentNode.parentNode, target.checked); 33 } 34 } 35 } 36 lastChecked = target; 19 37 Actions.counter(); 20 38 }); 21 39 } … … 28 46 if (target.className == 'action-select') { 29 47 var tr = target.parentNode.parentNode; 30 48 Actions.toggleRow(tr, target.checked); 31 Actions.checked();32 49 } 33 50 }); 34 51 } … … 59 76 for(var i = 0; i < counterSpans.length; i++) { 60 77 counterSpans[i].innerHTML = counter; 61 78 } 79 selectAll.checked = (counter == actionCheckboxes.length); 62 80 } 63 81 }; 64 82