]>
git.scottworley.com Git - picsort/blob - picsorter.js
70cd2367e7839d26638bb4a6cf3bf1b4daba57a7
2 if ("picsorter_picinfo" in localStorage
) {
3 picinfo
= JSON
.parse(localStorage
.picsorter_picinfo
);
5 $.each(files
, function(i
, f
) {
10 function save_picinfo() {
11 localStorage
.picsorter_picinfo
= JSON
.stringify(picinfo
);
21 if ("exposure" in picinfo
[files
[input_index
]]) {
22 exposure
= picinfo
[files
[input_index
]].exposure
;
24 picinfo
[files
[input_index
]].exposure
= exposure
;
27 $("#pic").attr("src", zoom
+ exposure
+ "/" + files
[input_index
]);
30 function say(message
) {
31 $("#message").text(message
).removeClass("fade");
32 setTimeout(function() { $("#message").addClass("fade"); }, 1);
35 function toggle_zoom() {
44 function move_to_nondeleted(direction
) {
46 input_index
+= direction
;
47 } while (picinfo
[files
[input_index
]].deleted
);
48 say(input_index
+ " " + (picinfo
[files
[input_index
]].name
|| ""));
52 function mark_deleted() {
53 picinfo
[files
[input_index
]].deleted
= 1;
58 function mark_not_deleted() {
59 delete picinfo
[files
[input_index
]].deleted
;
64 function change_exposure(amount
) {
66 picinfo
[files
[input_index
]].exposure
= exposure
;
69 var display_exposure
= (exposure
/ 4) - 3.5;
70 say((display_exposure
>= 0 ? "+" : "") + display_exposure
);
74 var name_input
= $("#name").hide().get(0);
75 var name
= name_input
.value
;
76 name_input
.value
= "";
77 picinfo
[files
[input_index
]].name
= name
;
83 $("#name").hide().on("keyup", function(e
) { e
.which
== 13 && set_name(); });
84 move_to_nondeleted(1);
87 Mousetrap
.bind('z', toggle_zoom
);
88 Mousetrap
.bind('Z', function() { $("#pic").toggleClass("fit_view"); });
89 Mousetrap
.bind('n', function() { move_to_nondeleted(1); });
90 Mousetrap
.bind('p', function() { move_to_nondeleted(-1); });
91 Mousetrap
.bind('N', function() { input_index
++; say(input_index
); setpic(); });
92 Mousetrap
.bind('P', function() { input_index
--; say(input_index
); setpic(); });
93 Mousetrap
.bind('b', function() { change_exposure(1); });
94 Mousetrap
.bind('d', function() { change_exposure(-1); });
95 Mousetrap
.bind('x', mark_deleted
);
96 Mousetrap
.bind('X', mark_not_deleted
);
97 Mousetrap
.bind('c', function() { $("#name").show().focus(); return false; });