-
-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathdeckbrowser.js
54 lines (45 loc) · 1.37 KB
/
deckbrowser.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/* Copyright: Ankitects Pty Ltd and contributors
* License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html */
function init() {
$("tr.deck").draggable({
scroll: false,
// can't use "helper: 'clone'" because of a bug in jQuery 1.5
helper: function (event) {
return $(this).clone(false);
},
delay: 200,
opacity: 0.7
});
$("th.count").draggable({
scroll: false,
// can't use "helper: 'clone'" because of a bug in jQuery 1.5
helper: function (event) {
return $(this).clone(false);
},
delay: 200,
opacity: 0.7
});
$("tr.deck").droppable({
drop: handleDropEvent,
hoverClass: 'drag-hover'
});
$("th.count").droppable({
drop: columnDropEvent,
hoverClass: 'drag-hover'
});
$("tr.top-level-drag-row").droppable({
drop: handleDropEvent,
hoverClass: 'drag-hover'
});
}
$(init);
function handleDropEvent(event, ui) {
var draggedDeckId = ui.draggable.attr('id');
var ontoDeckId = $(this).attr('id') || '';
pycmd("drag:" + draggedDeckId + "," + ontoDeckId);
}
function columnDropEvent(event, ui) {
var draggedDeckId = ui.draggable.attr('colpos');
var ontoDeckId = $(this).attr('colpos') || '';
pycmd("dragColumn:" + draggedDeckId + "," + ontoDeckId);
}