Fix screenshot quality option

Change-Id: Ie5b4735fc8cf019daa6e582376489915e2e20bfd
diff --git a/src/js/options.js b/src/js/options.js
index abb2efc..f56bc7a 100644
--- a/src/js/options.js
+++ b/src/js/options.js
@@ -27,27 +27,28 @@
   initScreenCaptureQuality();

 }

 

-function save() {

+function save(callback) {

+  var screenshotQuality = $('lossy').checked ? 'jpeg' : '' ||

+      $('lossless').checked ? 'png' : '';

   chrome.storage.local.set({

-    'screenshootQuality': 

-      $('lossy').checked ? 'jpeg' : '' ||

-      $('lossless').checked ? 'png' : '',

+    screenshotQuality,

+  }, _ => {

+    callback(true);

   });

-

-  return true;

 }

 

 function saveAndClose() {

-  if (save())

+  save(_ => {

     chrome.tabs.getSelected(null, function(tab) {

       chrome.tabs.remove(tab.id);

     });

+  });

 }

 

 function initScreenCaptureQuality() {

   chrome.storage.local.get('screenshotQuality', value => {

-    $('lossy').checked = value == 'jpeg';

-    $('lossless').checked = value == 'png';

+    $('lossy').checked = value['screenshotQuality'] == 'jpeg';

+    $('lossless').checked = value['screenshotQuality'] == 'png';

   });

 }