mirror of
https://github.com/zombieFox/nightTab.git
synced 2024-11-23 00:23:28 +01:00
[bug] change export to support special characters in JSON file
Switch back to encodeURIComponent when exporting data as JSON. This supports special characters better than "new Blob".
This commit is contained in:
parent
e6eed72463
commit
dc59045cc3
2
package-lock.json
generated
2
package-lock.json
generated
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "nightTab",
|
||||
"version": "4.40.3",
|
||||
"version": "4.40.4",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "nightTab",
|
||||
"version": "4.40.3",
|
||||
"version": "4.40.4",
|
||||
"description": "A neutral new tab page accented with a chosen colour. Customise the layout, style, background and bookmarks in nightTab.",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
|
@ -12,14 +12,6 @@ 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) {
|
||||
if (value < 10) {
|
||||
@ -34,15 +26,10 @@ var data = (function() {
|
||||
timeStamp.month = _timeStampPrefix(timeStamp.month + 1);
|
||||
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 str = JSON.stringify(load());
|
||||
var data = encode(str);
|
||||
var blob = new Blob([data], {
|
||||
type: "application/json"
|
||||
});
|
||||
var url = URL.createObjectURL(blob);
|
||||
var fileName = _saveName + " backup - " + timeStamp + ".json";
|
||||
var data = "data:text/json;charset=utf-8," + encodeURIComponent(JSON.stringify(load()));
|
||||
var link = document.createElement("a");
|
||||
link.setAttribute("href", url);
|
||||
link.setAttribute("href", data);
|
||||
link.setAttribute("download", fileName);
|
||||
link.addEventListener("click", function(event) {
|
||||
this.remove();
|
||||
|
@ -1,6 +1,6 @@
|
||||
var version = (function() {
|
||||
|
||||
var current = "4.40.3";
|
||||
var current = "4.40.4";
|
||||
|
||||
var name = "Naughty Goose";
|
||||
|
||||
|
@ -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": "4.40.3",
|
||||
"version": "4.40.4",
|
||||
"manifest_version": 2,
|
||||
"chrome_url_overrides": {
|
||||
"newtab": "index.html"
|
||||
|
Loading…
Reference in New Issue
Block a user