]>
Commit | Line | Data |
---|---|---|
2d325f41 SW |
1 | if (!("picsorter_deleted" in localStorage)) { |
2 | localStorage.picsorter_deleted = JSON.stringify({}); | |
3 | } | |
d1309d5a | 4 | var picsorter_deleted = JSON.parse(localStorage.picsorter_deleted); |
2d325f41 | 5 | |
ca898dc7 SW |
6 | var exposure = 20; |
7 | var zoom = "sm/"; | |
8 | var input_index = -1; | |
9 | move_to_nondeleted(1); | |
10 | ||
11 | ||
ed9d7c54 | 12 | function setpic() { |
9952a1a7 SW |
13 | $("#pic").attr("src", zoom + exposure + "/" + files[input_index]); |
14 | } | |
15 | ||
16 | function toggle_zoom() { | |
17 | if (zoom) { | |
18 | zoom = ""; | |
19 | } else { | |
20 | zoom = "sm/"; | |
21 | } | |
97c26a9c SW |
22 | } |
23 | ||
2d325f41 | 24 | function move_to_nondeleted(direction) { |
2d325f41 SW |
25 | do { |
26 | input_index += direction; | |
d1309d5a | 27 | } while (files[input_index] in picsorter_deleted); |
2d325f41 SW |
28 | } |
29 | ||
30 | function mark_deleted() { | |
d1309d5a SW |
31 | picsorter_deleted[files[input_index]] = 1; |
32 | localStorage.picsorter_deleted = JSON.stringify(picsorter_deleted); | |
2d325f41 SW |
33 | } |
34 | ||
35 | function mark_not_deleted() { | |
d1309d5a SW |
36 | delete picsorter_deleted[files[input_index]]; |
37 | localStorage.picsorter_deleted = JSON.stringify(picsorter_deleted); | |
2d325f41 SW |
38 | } |
39 | ||
5d9946cb | 40 | $(function() { |
ed9d7c54 | 41 | setpic(); |
e18c13a6 | 42 | }); |
ecb5b4ef | 43 | |
9952a1a7 SW |
44 | Mousetrap.bind('z', function() { toggle_zoom(); setpic(); }); |
45 | Mousetrap.bind('Z', function() { $("#pic").toggleClass("fit_view"); }); | |
2d325f41 SW |
46 | Mousetrap.bind('n', function() { move_to_nondeleted(1); setpic(); }); |
47 | Mousetrap.bind('p', function() { move_to_nondeleted(-1); setpic(); }); | |
48 | Mousetrap.bind('N', function() { input_index ++; setpic(); }); | |
49 | Mousetrap.bind('P', function() { input_index --; setpic(); }); | |
a997ffc4 SW |
50 | Mousetrap.bind('b', function() { exposure ++; setpic(); }); |
51 | Mousetrap.bind('d', function() { exposure --; setpic(); }); | |
2d325f41 SW |
52 | Mousetrap.bind('x', function() { mark_deleted(); }); |
53 | Mousetrap.bind('X', function() { mark_not_deleted(); }); |