Skip to content

Commit dc59045

Browse files
committed
[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".
1 parent e6eed72 commit dc59045

File tree

5 files changed

+7
-20
lines changed

5 files changed

+7
-20
lines changed

‎package-lock.json‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "nightTab",
3-
"version": "4.40.3",
3+
"version": "4.40.4",
44
"description": "A neutral new tab page accented with a chosen colour. Customise the layout, style, background and bookmarks in nightTab.",
55
"main": "index.js",
66
"scripts":{

‎src/js/data.js‎

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,6 @@ var data = (function(){
1212
};
1313

1414
mod.export=function(){
15-
varencode=function(string){
16-
varout=[];
17-
for(vari=0;i<string.length;i++){
18-
out[i]=string.charCodeAt(i);
19-
};
20-
returnnewUint8Array(out);
21-
};
22-
vartempAchor=helper.node("a");
2315
vartimeStamp=helper.getDateTime();
2416
var_timeStampPrefix=function(value){
2517
if(value<10){
@@ -34,15 +26,10 @@ var data = (function(){
3426
timeStamp.month=_timeStampPrefix(timeStamp.month+1);
3527
timeStamp.year=_timeStampPrefix(timeStamp.year);
3628
timeStamp=timeStamp.hours+" "+timeStamp.minutes+" "+timeStamp.seconds+" - "+timeStamp.date+"."+timeStamp.month+"."+timeStamp.year;
37-
varfileName="nightTab backup - "+timeStamp+".json";
38-
varstr=JSON.stringify(load());
39-
vardata=encode(str);
40-
varblob=newBlob([data],{
41-
type: "application/json"
42-
});
43-
varurl=URL.createObjectURL(blob);
29+
varfileName=_saveName+" backup - "+timeStamp+".json";
30+
vardata="data:text/json;charset=utf-8,"+encodeURIComponent(JSON.stringify(load()));
4431
varlink=document.createElement("a");
45-
link.setAttribute("href",url);
32+
link.setAttribute("href",data);
4633
link.setAttribute("download",fileName);
4734
link.addEventListener("click",function(event){
4835
this.remove();

‎src/js/version.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
varversion=(function(){
22

3-
varcurrent="4.40.3";
3+
varcurrent="4.40.4";
44

55
varname="Naughty Goose";
66

‎src/manifest.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "nightTab",
33
"short_name": "nightTab",
44
"description": "A neutral new tab page accented with a chosen colour. Customise the layout, style, background and bookmarks in nightTab.",
5-
"version": "4.40.3",
5+
"version": "4.40.4",
66
"manifest_version": 2,
77
"chrome_url_overrides":{
88
"newtab": "index.html"

0 commit comments

Comments
(0)