@@ -12,6 +12,13 @@ var data = (function(){
1212} ;
1313
1414mod . export = function ( ) {
15+ var encode = function ( string ) {
16+ var out = [ ] ;
17+ for ( var i = 0 ; i < string . length ; i ++ ) {
18+ out [ i ] = string . charCodeAt ( i ) ;
19+ } ;
20+ return new Uint8Array ( out ) ;
21+ } ;
1522var tempAchor = helper . node ( "a" ) ;
1623var timeStamp = helper . getDateTime ( ) ;
1724var _timeStampPrefix = function ( value ) {
@@ -28,12 +35,17 @@ var data = (function(){
2835timeStamp . year = _timeStampPrefix ( timeStamp . year ) ;
2936timeStamp = timeStamp . hours + " " + timeStamp . minutes + " " + timeStamp . seconds + " - " + timeStamp . date + "." + timeStamp . month + "." + timeStamp . year ;
3037var fileName = "nightTab backup - " + timeStamp + ".json" ;
31- var data = "data:text/json;charset=utf-8," + encodeURIComponent ( JSON . stringify ( load ( ) ) ) ;
32- tempAchor . setAttribute ( "href" , data ) ;
33- tempAchor . setAttribute ( "download" , fileName ) ;
34- helper . e ( "html" ) . appendChild ( tempAchor ) ;
35- tempAchor . click ( ) ;
36- tempAchor . remove ( ) ;
38+ var str = JSON . stringify ( load ( ) ) ;
39+ var data = encode ( str ) ;
40+ var blob = new Blob ( [ data ] , {
41+ type : 'application/octet-stream'
42+ } ) ;
43+ var url = URL . createObjectURL ( blob ) ;
44+ var link = document . createElement ( "a" ) ;
45+ link . setAttribute ( "href" , url ) ;
46+ link . setAttribute ( "download" , fileName ) ;
47+ link . click ( ) ;
48+ link . remove ( ) ;
3749} ;
3850
3951mod . restore = function ( data ) {
0 commit comments