From 3d66ea49054a5b44e1a89176ffbec5322f71adb5 Mon Sep 17 00:00:00 2001 From: zombieFox Date: Mon, 11 Nov 2019 13:37:20 +0000 Subject: [PATCH] [design] add version name --- src/index.html | 13 ++++++++++--- src/js/data.js | 6 +++--- src/js/init.js | 2 +- src/js/update.js | 6 +++--- src/js/version.js | 10 ++++++++-- 5 files changed, 25 insertions(+), 12 deletions(-) diff --git a/src/index.html b/src/index.html index 73b3d7d5..8bdbf6ae 100644 --- a/src/index.html +++ b/src/index.html @@ -1296,11 +1296,18 @@

nightTab

diff --git a/src/js/data.js b/src/js/data.js index d968c2c0..6dfadabc 100644 --- a/src/js/data.js +++ b/src/js/data.js @@ -53,12 +53,12 @@ var data = (function() { mod.restore = function(data) { if (data) { - if (!("version" in data) || data.version != version.get()) { + if (!("version" in data) || data.version != version.get().number) { console.log("data version " + data.version + " found less than current"); data = update.run(data); mod.set(_saveName, JSON.stringify(data)); } else { - console.log("data version " + version.get() + " no need to run update"); + console.log("data version " + version.get().number + " no need to run update"); mod.set(_saveName, JSON.stringify(data)); }; } else { @@ -233,7 +233,7 @@ var data = (function() { var save = function() { mod.set(_saveName, JSON.stringify({ nighttab: true, - version: version.get(), + version: version.get().number, state: state.get(), bookmarks: bookmarks.get() })); diff --git a/src/js/init.js b/src/js/init.js index ef2fc157..f310705f 100644 --- a/src/js/init.js +++ b/src/js/init.js @@ -1,5 +1,5 @@ // log version -console.log("nightTab version", version.get()); +console.log("nightTab version", version.get().number, "(" + version.get().name + ")"); data.init(); state.init(); bookmarks.init(); diff --git a/src/js/update.js b/src/js/update.js index cf410387..95e5a555 100644 --- a/src/js/update.js +++ b/src/js/update.js @@ -665,9 +665,9 @@ var update = (function() { }; // if no update is needed version bump - if (version.compare(data.version, version.get()) == -1) { - console.log("\t > nothing to update, version bump to", version.get()); - data.version = version.get(); + if (version.compare(data.version, version.get().number) == -1) { + console.log("\t > nothing to update, version bump to", version.get().number); + data.version = version.get().number; }; return data; diff --git a/src/js/version.js b/src/js/version.js index 11d3ba35..e324aeb2 100644 --- a/src/js/version.js +++ b/src/js/version.js @@ -2,6 +2,8 @@ var version = (function() { var current = "4.0.0"; + var name = "Enchanting Aardvark"; + var compare = function(a, b) { var pa = a.split("."); var pb = b.split("."); @@ -26,11 +28,15 @@ var version = (function() { var get = function() { // return chrome.runtime.getManifest().version; - return current; + return { + number: current, + name: name + }; }; var render = function() { - helper.e(".display-version").textContent = get(); + helper.e(".display-version").textContent = get().number; + helper.e(".display-name").textContent = get().name; }; var init = function() {