From 33949c7ff84b14d9567d282791db6496e7eb4b3d Mon Sep 17 00:00:00 2001 From: Ching Chow Date: Thu, 22 Nov 2018 22:49:58 -0500 Subject: [PATCH] Initialize and start extension --- manifest.json | 2 +- scripts.js | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/manifest.json b/manifest.json index 62ac3fb..33b324e 100644 --- a/manifest.json +++ b/manifest.json @@ -2,7 +2,7 @@ "manifest_version": 2, "name": "Lookup Assistant", - "version": "2.1.0", + "version": "2.1.1", "description": "Lookup highlighted text.", "icons": { diff --git a/scripts.js b/scripts.js index 4b02f32..d73cbe0 100644 --- a/scripts.js +++ b/scripts.js @@ -2,7 +2,7 @@ "use strict"; const doc = (id) => document.getElementById(id); - + const storage = { key: "LUA_Settings", get: () => localStorage.getItem(storage.key), @@ -175,6 +175,12 @@ } ]`.replace(/\n {4}/g, "\n"); + // initialize storage and settings on installation + if (storage.get() === null) { + storage.set(defaults); + settings._parse(JSON.parse(defaults)); + } + document.onreadystatechange = () => { if (document.title.includes("Lookup Assistant") && document.readyState !== "loading") { doc("editor").value = storage.get();