]>
git.scottworley.com Git - picsort/blob - picsorter.js
abed5075f22ccd8aaaf5261df712edbb1a9f6759
2 if ("picsorter_picinfo" in localStorage
) {
3 picinfo
= JSON
.parse(localStorage
.picsorter_picinfo
);
5 $.each(files
, function(i
, f
) {
10 localStorage
.picsorter_picinfo
= JSON
.stringify(picinfo
);
18 if ("exposure" in picinfo
[files
[input_index
]]) {
19 exposure
= picinfo
[files
[input_index
]].exposure
;
21 picinfo
[files
[input_index
]].exposure
= exposure
;
22 localStorage
.picsorter_picinfo
= JSON
.stringify(picinfo
);
24 $("#pic").attr("src", zoom
+ exposure
+ "/" + files
[input_index
]);
27 function say(message
) {
28 $("#message").text(message
).removeClass("fade");
29 setTimeout(function() { $("#message").addClass("fade"); }, 1);
32 function toggle_zoom() {
41 function move_to_nondeleted(direction
) {
43 input_index
+= direction
;
44 } while (picinfo
[files
[input_index
]].deleted
);
49 function mark_deleted() {
50 picinfo
[files
[input_index
]].deleted
= 1;
51 localStorage
.picsorter_picinfo
= JSON
.stringify(picinfo
);
55 function mark_not_deleted() {
56 delete picinfo
[files
[input_index
]].deleted
;
57 localStorage
.picsorter_picinfo
= JSON
.stringify(picinfo
);
61 function change_exposure(amount
) {
63 picinfo
[files
[input_index
]].exposure
= exposure
;
65 var display_exposure
= (exposure
/ 4) - 3.5;
66 say((display_exposure
>= 0 ? "+" : "") + display_exposure
);
70 move_to_nondeleted(1);
73 Mousetrap
.bind('z', toggle_zoom
);
74 Mousetrap
.bind('Z', function() { $("#pic").toggleClass("fit_view"); });
75 Mousetrap
.bind('n', function() { move_to_nondeleted(1); });
76 Mousetrap
.bind('p', function() { move_to_nondeleted(-1); });
77 Mousetrap
.bind('N', function() { input_index
++; say(input_index
); setpic(); });
78 Mousetrap
.bind('P', function() { input_index
--; say(input_index
); setpic(); });
79 Mousetrap
.bind('b', function() { change_exposure(1); });
80 Mousetrap
.bind('d', function() { change_exposure(-1); });
81 Mousetrap
.bind('x', mark_deleted
);
82 Mousetrap
.bind('X', mark_not_deleted
);