src / options.json commit fix bugs, update readme (7e21071)
   1function save_options() {
   2  var bgvalue = document.getElementById('bg').value;
   3  var fgvalue = document.getElementById('fg').value;
   4  var hrvalue = document.getElementById('hr').value;
   5  console.log(bgvalue);
   6
   7  chrome.storage.sync.set({
   8    "bgvalue": bgvalue,
   9    "fgvalue": fgvalue,
  10    "hrvalue": hrvalue,
  11  }, function() {
  12    window.close();
  13
  14  });
  15}
  16
  17
  18function restore_options() {
  19  chrome.storage.sync.get({
  20    "bgvalue": "#2e3440",
  21    "fgvalue": "#d8dee9",
  22    "hrvalue": "#434c5e"
  23  },
  24    function(items) {
  25      document.getElementById('bg').value = items["bgvalue"];
  26      document.getElementById('fg').value = items["fgvalue"];
  27      document.getElementById('hr').value = items["hrvalue"];
  28    });
  29  document.getElementById('save').addEventListener('click', save_options);
  30}
  31
  32document.addEventListener('DOMContentLoaded', restore_options);