[design] add version name

This commit is contained in:
zombieFox 2019-11-11 13:37:20 +00:00
parent 7cde7b83f4
commit 3d66ea4905
5 changed files with 25 additions and 12 deletions

View File

@ -1296,11 +1296,18 @@
<h1 class="menu-item-header-text">nightTab</h1>
</div>
<div class="menu-item-form">
<p class="p-wrap">Version <strong class="display-version"></strong></p>
<div class="p-wrap">
<p class="mb-1">Version <strong class="display-version"></strong></p>
<p class="display-name small mb-0"></p>
</div>
<hr>
<p class="p-wrap">Project repository on <a href="https://github.com/zombieFox/nightTab" class="a-underline" target="_blank" tabindex="-1">Github.</a></p>
<div class="p-wrap">
<p>Project repository on <a href="https://github.com/zombieFox/nightTab" class="a-underline" target="_blank" tabindex="-1">Github.</a></p>
</div>
<hr>
<p class="p-wrap">For feedback and support, submit an <a href="https://github.com/zombieFox/nightTab/issues" class="a-underline" target="_blank" tabindex="-1">Issues.</a></p>
<div class="p-wrap">
<p>For feedback and support, submit an <a href="https://github.com/zombieFox/nightTab/issues" class="a-underline" target="_blank" tabindex="-1">Issues.</a></p>
</div>
</div>
</div>
</div>

View File

@ -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()
}));

View File

@ -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();

View File

@ -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;

View File

@ -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() {