mirror of
https://github.com/zombieFox/nightTab.git
synced 2025-02-26 07:01:06 +01:00
[bug] improve data export module
This commit is contained in:
parent
cfa802cfc5
commit
d47b354039
@ -12,6 +12,13 @@ var data = (function() {
|
||||
};
|
||||
|
||||
mod.export = function() {
|
||||
var encode = function(string) {
|
||||
var out = [];
|
||||
for (var i = 0; i < string.length; i++) {
|
||||
out[i] = string.charCodeAt(i);
|
||||
};
|
||||
return new Uint8Array(out);
|
||||
};
|
||||
var tempAchor = helper.node("a");
|
||||
var timeStamp = helper.getDateTime();
|
||||
var _timeStampPrefix = function(value) {
|
||||
@ -28,12 +35,17 @@ var data = (function() {
|
||||
timeStamp.year = _timeStampPrefix(timeStamp.year);
|
||||
timeStamp = timeStamp.hours + " " + timeStamp.minutes + " " + timeStamp.seconds + " - " + timeStamp.date + "." + timeStamp.month + "." + timeStamp.year;
|
||||
var fileName = "nightTab backup - " + timeStamp + ".json";
|
||||
var data = "data:text/json;charset=utf-8," + encodeURIComponent(JSON.stringify(load()));
|
||||
tempAchor.setAttribute("href", data);
|
||||
tempAchor.setAttribute("download", fileName);
|
||||
helper.e("html").appendChild(tempAchor);
|
||||
tempAchor.click();
|
||||
tempAchor.remove();
|
||||
var str = JSON.stringify(load());
|
||||
var data = encode(str);
|
||||
var blob = new Blob([data], {
|
||||
type: 'application/octet-stream'
|
||||
});
|
||||
var url = URL.createObjectURL(blob);
|
||||
var link = document.createElement("a");
|
||||
link.setAttribute("href", url);
|
||||
link.setAttribute("download", fileName);
|
||||
link.click();
|
||||
link.remove();
|
||||
};
|
||||
|
||||
mod.restore = function(data) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
var version = (function() {
|
||||
|
||||
var current = "3.67.2";
|
||||
var current = "3.68.0";
|
||||
|
||||
var compare = function(a, b) {
|
||||
var pa = a.split(".");
|
||||
|
@ -2,7 +2,7 @@
|
||||
"name": "nightTab",
|
||||
"short_name": "nightTab",
|
||||
"description": "A neutral new tab page accented with a chosen colour. Customise the layout, style, background and bookmarks in nightTab.",
|
||||
"version": "3.67.2",
|
||||
"version": "3.68.0",
|
||||
"manifest_version": 2,
|
||||
"chrome_url_overrides": {
|
||||
"newtab": "index.html"
|
||||
|
Loading…
Reference in New Issue
Block a user