mirror of
https://github.com/zombieFox/nightTab.git
synced 2024-11-24 17:14:28 +01:00
[feature] restore demo page
This commit is contained in:
parent
26ef4d7209
commit
c1cce0185c
@ -5,8 +5,6 @@ A neutral new tab page accented with a chosen colour. Customise the layout, styl
|
|||||||
|
|
||||||
[See the demo in action](https://zombiefox.github.io/nightTab/)
|
[See the demo in action](https://zombiefox.github.io/nightTab/)
|
||||||
|
|
||||||
*All bookmarks or preference changes will not persist in demo mode.*
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
### [Chrome Extension](https://chrome.google.com/webstore/detail/nighttab/hdpcadigjkbcpnlcpbcohpafiaefanki)
|
### [Chrome Extension](https://chrome.google.com/webstore/detail/nighttab/hdpcadigjkbcpnlcpbcohpafiaefanki)
|
||||||
|
32
js/data.js
32
js/data.js
@ -15,16 +15,12 @@ var data = (function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
var save = function() {
|
var save = function() {
|
||||||
if ("runtime" in chrome) {
|
var data = {
|
||||||
if ("getManifest" in chrome.runtime) {
|
version: version.get(),
|
||||||
var data = {
|
state: state.get(),
|
||||||
version: version.get(),
|
bookmarks: bookmarks.get()
|
||||||
state: state.get(),
|
|
||||||
bookmarks: bookmarks.get()
|
|
||||||
};
|
|
||||||
set(saveName, JSON.stringify(data));
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
set(saveName, JSON.stringify(data));
|
||||||
};
|
};
|
||||||
|
|
||||||
var wipe = function() {
|
var wipe = function() {
|
||||||
@ -38,17 +34,15 @@ var data = (function() {
|
|||||||
var restore = function() {
|
var restore = function() {
|
||||||
var data = load();
|
var data = load();
|
||||||
if (data) {
|
if (data) {
|
||||||
if ("runtime" in chrome) {
|
if (!("version" in data) || data.version != version.get()) {
|
||||||
if ("getManifest" in chrome.runtime) {
|
console.log("data version " + data.version + " found less than current");
|
||||||
if (!("version" in data) || data.version != version.get()) {
|
data = update.run(data);
|
||||||
console.log("data version " + data.version + " found less than current");
|
set(saveName, JSON.stringify(data));
|
||||||
data = update.run(data);
|
} else {
|
||||||
set(saveName, JSON.stringify(data));
|
console.log("data version " + version.get() + " no need to run update");
|
||||||
} else {
|
|
||||||
console.log("data version " + version.get() + " no need to run update");
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
} else {
|
||||||
|
console.log("no data found to load");
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
16
js/init.js
16
js/init.js
@ -1,19 +1,5 @@
|
|||||||
// log version
|
// log version
|
||||||
var demoMessage = function() {
|
console.log("nightTab version", version.get());
|
||||||
console.log("nightTab running in demo mode");
|
|
||||||
console.log("all bookmarks or preference changes will not persist in demo mode");
|
|
||||||
};
|
|
||||||
|
|
||||||
if ("runtime" in chrome) {
|
|
||||||
if ("getManifest" in chrome.runtime) {
|
|
||||||
console.log("nightTab version", version.get());
|
|
||||||
} else {
|
|
||||||
demoMessage();
|
|
||||||
};
|
|
||||||
} else {
|
|
||||||
demoMessage();
|
|
||||||
};
|
|
||||||
|
|
||||||
data.init();
|
data.init();
|
||||||
state.init();
|
state.init();
|
||||||
bookmarks.init();
|
bookmarks.init();
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
var version = (function() {
|
var version = (function() {
|
||||||
|
|
||||||
|
var current = "3.14.0";
|
||||||
|
|
||||||
var compare = function(a, b) {
|
var compare = function(a, b) {
|
||||||
var pa = a.split(".");
|
var pa = a.split(".");
|
||||||
var pb = b.split(".");
|
var pb = b.split(".");
|
||||||
@ -23,7 +25,8 @@ var version = (function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
var get = function() {
|
var get = function() {
|
||||||
return chrome.runtime.getManifest().version;
|
// return chrome.runtime.getManifest().version;
|
||||||
|
return current;
|
||||||
};
|
};
|
||||||
|
|
||||||
// exposed methods
|
// exposed methods
|
||||||
|
Loading…
Reference in New Issue
Block a user