[feature] restore demo page

This commit is contained in:
zombieFox 2019-06-17 00:08:35 +01:00
parent 3007ae11fe
commit 255ca514da
4 changed files with 30 additions and 21 deletions

View File

@ -1,8 +1,9 @@
# NIGHTTAB
A neutral new tab page accented with a chosen colour. Customise the layout, style, background and bookmarks in nightTab -- a custom start page.
![nightTab Demo](banners/banner-1400-560.png)
[![nightTab Demo](banners/banner-1400-560.png)](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)
@ -40,9 +41,9 @@ A neutral new tab page accented with a chosen colour. Customise the layout, styl
- Responsive design
---
![nightTab Demo](screenshots/demo-001.gif)
![nightTab Demo](screenshots/demo-002.gif)
![nightTab Demo](screenshots/demo-003.gif)
![nightTab Demo](screenshots/demo-004.gif)
![nightTab Demo](screenshots/demo-005.gif)
![nightTab Demo](screenshots/demo-006.gif)
[![nightTab Demo](screenshots/demo-001.gif)](https://zombiefox.github.io/nightTab/)
[![nightTab Demo](screenshots/demo-002.gif)](https://zombiefox.github.io/nightTab/)
[![nightTab Demo](screenshots/demo-003.gif)](https://zombiefox.github.io/nightTab/)
[![nightTab Demo](screenshots/demo-004.gif)](https://zombiefox.github.io/nightTab/)
[![nightTab Demo](screenshots/demo-005.gif)](https://zombiefox.github.io/nightTab/)
[![nightTab Demo](screenshots/demo-006.gif)](https://zombiefox.github.io/nightTab/)

View File

@ -20,7 +20,9 @@ var data = (function() {
state: state.get(),
bookmarks: bookmarks.get()
};
set(saveName, JSON.stringify(data));
if ("runtime" in chrome) {
set(saveName, JSON.stringify(data));
};
// console.log("data saved");
};
@ -32,22 +34,23 @@ var data = (function() {
return JSON.parse(get(saveName));
};
var restore = function(data) {
var restore = function() {
var data = load();
if (data) {
if (!("version" in data) || data.version != version.get()) {
console.log("data version " + data.version + " found less than current");
data = update.run(data);
set(saveName, JSON.stringify(data));
} else {
console.log("data version " + version.get() + " no need to run update");
if ("runtime" in chrome) {
if (!("version" in data) || data.version != version.get()) {
console.log("data version " + data.version + " found less than current");
data = update.run(data);
set(saveName, JSON.stringify(data));
} else {
console.log("data version " + version.get() + " no need to run update");
};
};
} else {
console.log("no data found to load");
};
};
var init = function() {
restore(load());
restore();
};
return {

View File

@ -1,5 +1,10 @@
// log version
console.log("nightTab version", version.get());
if ("runtime" in chrome) {
console.log("nightTab version", version.get());
} else {
console.log("nightTab running in demo mode");
console.log("all bookmarks or preference changes will not persist in demo mode");
};
data.init();
state.init();
bookmarks.init();

View File

@ -18,7 +18,7 @@ var version = (function() {
if (isNaN(na) && !isNaN(nb)) {
return -1;
};
}
};
return 0;
};