From 3b545d23b6ddb0ee843e9f792863615d69ceca5f Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Tue, 3 Jan 2012 14:18:22 -0600 Subject: Add checkbox range selection to stale relations page Signed-off-by: Dan McGee --- sitestatic/archweb.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'sitestatic') diff --git a/sitestatic/archweb.js b/sitestatic/archweb.js index 151d0f8..248be7a 100644 --- a/sitestatic/archweb.js +++ b/sitestatic/archweb.js @@ -123,6 +123,26 @@ if (typeof $.tablesorter !== 'undefined') { }); } +(function($) { + $.fn.enableCheckboxRangeSelection = function() { + var lastCheckbox = null; + var lastElement = null; + + var spec = this; + spec.unbind("click.checkboxrange"); + spec.bind("click.checkboxrange", function(e) { + if (lastCheckbox != null && e.shiftKey) { + spec.slice( + Math.min(spec.index(lastCheckbox), spec.index(e.target)), + Math.max(spec.index(lastCheckbox), spec.index(e.target)) + 1 + ).attr({checked: e.target.checked ? "checked" : ""}); + } + lastCheckbox = e.target; + }); + + }; +})(jQuery); + /* news/add.html */ function enablePreview() { $('#news-preview-button').click(function(event) { -- cgit v1.2.3-24-g4f1b