]> git.scottworley.com Git - picsort/commitdiff
save_picinfo()
authorScott Worley <scottworley@scottworley.com>
Fri, 28 Feb 2014 09:08:19 +0000 (01:08 -0800)
committerScott Worley <scottworley@scottworley.com>
Fri, 28 Feb 2014 09:08:19 +0000 (01:08 -0800)
Name this and call it rather than copy/pasting it around.

Also, fix a bug where change_exposure() should have been saving picinfo
but wasn't.

picsorter.js

index abed5075f22ccd8aaaf5261df712edbb1a9f6759..db313d9d382493e930fdec1c5bdf227adc647193 100644 (file)
@@ -7,7 +7,10 @@ $.each(files, function(i, f) {
     picinfo[f] = {};
   }
 });
     picinfo[f] = {};
   }
 });
-localStorage.picsorter_picinfo = JSON.stringify(picinfo);
+function save_picinfo() {
+  localStorage.picsorter_picinfo = JSON.stringify(picinfo);
+}
+save_picinfo();
 
 var exposure = 20;
 var zoom = "sm/";
 
 var exposure = 20;
 var zoom = "sm/";
@@ -19,7 +22,7 @@ function setpic() {
     exposure = picinfo[files[input_index]].exposure;
   } else {
     picinfo[files[input_index]].exposure = exposure;
     exposure = picinfo[files[input_index]].exposure;
   } else {
     picinfo[files[input_index]].exposure = exposure;
-    localStorage.picsorter_picinfo = JSON.stringify(picinfo);
+    save_picinfo();
   }
   $("#pic").attr("src", zoom + exposure + "/" + files[input_index]);
 }
   }
   $("#pic").attr("src", zoom + exposure + "/" + files[input_index]);
 }
@@ -48,19 +51,20 @@ function move_to_nondeleted(direction) {
 
 function mark_deleted() {
   picinfo[files[input_index]].deleted = 1;
 
 function mark_deleted() {
   picinfo[files[input_index]].deleted = 1;
-  localStorage.picsorter_picinfo = JSON.stringify(picinfo);
+  save_picinfo();
   say("Deleted");
 }
 
 function mark_not_deleted() {
   delete picinfo[files[input_index]].deleted;
   say("Deleted");
 }
 
 function mark_not_deleted() {
   delete picinfo[files[input_index]].deleted;
-  localStorage.picsorter_picinfo = JSON.stringify(picinfo);
+  save_picinfo();
   say("Undeleted");
 }
 
 function change_exposure(amount) {
   exposure += amount;
   picinfo[files[input_index]].exposure = exposure;
   say("Undeleted");
 }
 
 function change_exposure(amount) {
   exposure += amount;
   picinfo[files[input_index]].exposure = exposure;
+  save_picinfo();
   setpic();
   var display_exposure = (exposure / 4) - 3.5;
   say((display_exposure >= 0 ? "+" : "") + display_exposure);
   setpic();
   var display_exposure = (exposure / 4) - 3.5;
   say((display_exposure >= 0 ? "+" : "") + display_exposure);