diff --git a/css/main.css b/css/main.css index 9032d5a..1556810 100644 --- a/css/main.css +++ b/css/main.css @@ -20,6 +20,8 @@ .select-box { cursor: pointer; + user-select: none; + -moz-user-select: none; } .btn-inline { /* fix for MAC/chrome */ diff --git a/js/yaaw.js b/js/yaaw.js index f4996aa..9a56206 100644 --- a/js/yaaw.js +++ b/js/yaaw.js @@ -20,6 +20,8 @@ var YAAW = (function() { var selected_tasks = false; + var selected_range_start = null; + var selected_range_close = null; var on_gid = null; var torrent_file = null, file_type = null; return { @@ -149,8 +151,31 @@ var YAAW = (function() { $("[rel=tooltip]").tooltip({"placement": "bottom"}); - $(".task .select-box").live("click", function() { - YAAW.tasks.toggle($(this).parents(".task")); + $(".task .select-box").live("click", function(e) { + if (!e.shiftKey) { + YAAW.tasks.toggle($(this).parents(".task")); + selected_range_start = $(this).parents(".task").hasClass("selected") ? $(this).parents(".task")[0] : null; + selected_range_close = null; + } else { + YAAW.tasks.select($(this).parents(".task")); + if (!selected_range_start) + selected_range_start = $(this).parents(".task")[0]; + else if (!selected_range_close) + selected_range_close = $(this).parents(".task")[0]; + } + if (selected_range_start && selected_range_close) { + if (selected_range_start == selected_range_close) { + selected_range_close = null; + } else { + var task_in_range = false; + $(".tasks-table .task").each(function (i, n) { + if (n == selected_range_start || n == selected_range_close) task_in_range = !task_in_range; + if (task_in_range) YAAW.tasks.select(n); + }); + selected_range_start = selected_range_close; + selected_range_close = null; + } + } YAAW.tasks.check_select(); });