Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add range select by 'ctrl' key. #139

Merged
merged 4 commits into from
May 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@

.select-box {
cursor: pointer;
user-select: none;
-moz-user-select: none;
}
.btn-inline {
/* fix for MAC/chrome */
Expand Down
29 changes: 27 additions & 2 deletions js/yaaw.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -129,8 +131,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();
});

Expand Down