File tree Expand file tree Collapse file tree 6 files changed +96
-37
lines changed Expand file tree Collapse file tree 6 files changed +96
-37
lines changed Original file line number Diff line number Diff line change @@ -85,6 +85,12 @@ function getDownloadOptions(format) {
85
85
filename : 'linkdump.bb' ,
86
86
type : 'text/plain'
87
87
} ;
88
+ case 'json' :
89
+ return {
90
+ filename : 'linkdump.json' ,
91
+ type : 'application/json' ,
92
+ transformer : JSON . stringify
93
+ } ;
88
94
default :
89
95
return {
90
96
reducer : textReducer ,
@@ -98,7 +104,12 @@ function copy(downloadOptions) {
98
104
browser . storage . local . get ( 'urls' ) . then ( obj => {
99
105
if ( ! obj . urls ) return ;
100
106
101
- const content = obj . urls . reduce ( downloadOptions . reducer , '' ) ;
107
+ let content ;
108
+ if ( downloadOptions . reducer ) {
109
+ content = obj . urls . reduce ( downloadOptions . reducer , '' ) ;
110
+ } else {
111
+ content = downloadOptions . transformer ( obj . urls ) ;
112
+ }
102
113
103
114
browser . runtime . sendMessage ( {
104
115
action : 'copy' ,
@@ -111,7 +122,12 @@ function download(downloadOptions) {
111
122
browser . storage . local . get ( 'urls' ) . then ( obj => {
112
123
if ( ! obj . urls ) return ;
113
124
114
- const content = obj . urls . reduce ( downloadOptions . reducer , '' ) ;
125
+ let content ;
126
+ if ( downloadOptions . reducer ) {
127
+ content = obj . urls . reduce ( downloadOptions . reducer , '' ) ;
128
+ } else {
129
+ content = downloadOptions . transformer ( obj . urls ) ;
130
+ }
115
131
const blob = new Blob ( [ content ] , { type : downloadOptions . type } ) ;
116
132
117
133
browser . downloads
Original file line number Diff line number Diff line change 7
7
8
8
"manifest_version" : 2 ,
9
9
"name" : " LinkDump" ,
10
- "version" : " 1.13.1 " ,
10
+ "version" : " 1.14 " ,
11
11
"description" : " __MSG_extensionDescription__" ,
12
12
"icons" : {
13
13
"48" : " icons/linkdump-48.png"
Original file line number Diff line number Diff line change 41
41
< td > < label class ="switch "> < input type ="checkbox " checked ="checked " data-action ="download " data-format ="phpbb "> < span class ="slider "> </ span > </ label > </ td >
42
42
< td > < label class ="switch "> < input type ="checkbox " checked ="checked " data-action ="copy " data-format ="phpbb "> < span class ="slider "> </ span > </ label > </ td >
43
43
</ tr >
44
+ < tr >
45
+ < th > JSON</ th >
46
+ < td > < label class ="switch "> < input type ="checkbox " checked ="checked " data-action ="download " data-format ="json "> < span class ="slider "> </ span > </ label > </ td >
47
+ < td > < label class ="switch "> < input type ="checkbox " checked ="checked " data-action ="copy " data-format ="json "> < span class ="slider "> </ span > </ label > </ td >
48
+ </ tr >
44
49
< tr >
45
50
< td > < label for ="clearAfter "> Clear dump after</ label > </ td >
46
51
< td > < label class ="switch "> < input type ="checkbox " data-action ="clear " data-format ="download "> < span class ="slider "> </ span > </ label > </ td >
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " linkdump" ,
3
- "version" : " 1.13.1 " ,
3
+ "version" : " 1.14 " ,
4
4
"description" : " Store links and dump them" ,
5
5
"main" : " background.js" ,
6
6
"scripts" : {
26
26
"eslint-config-airbnb-base" : " ^12.1.0" ,
27
27
"eslint-config-prettier" : " ^2.10.0" ,
28
28
"eslint-plugin-compat" : " ^2.7.0" ,
29
- "eslint-plugin-import" : " ^2.17 .2" ,
30
- "prettier" : " ^1.17.0 "
29
+ "eslint-plugin-import" : " ^2.18 .2" ,
30
+ "prettier" : " ^1.18.2 "
31
31
}
32
32
}
Original file line number Diff line number Diff line change 16
16
< li > < a data-action ="download " data-format ="html " href ="# "> HTML</ a > </ li >
17
17
< li > < a data-action ="download " data-format ="dokuwiki " href ="# "> Dokuwiki</ a > </ li >
18
18
< li > < a data-action ="download " data-format ="phpbb " href ="# "> PhpBB</ a > </ li >
19
+ < li > < a data-action ="download " data-format ="json " href ="# "> JSON</ a > </ li >
19
20
</ ul >
20
21
</ li >
21
22
< li >
26
27
< li > < a data-action ="copy " data-format ="html " href ="# "> HTML</ a > </ li >
27
28
< li > < a data-action ="copy " data-format ="dokuwiki " href ="# "> Dokuwiki</ a > </ li >
28
29
< li > < a data-action ="copy " data-format ="phpbb " href ="# "> PhpBB</ a > </ li >
30
+ < li > < a data-action ="copy " data-format ="json " href ="# "> JSON</ a > </ li >
29
31
</ ul >
30
32
</ li >
31
33
< li > < img data-action ="clear " src ="../icons/trash-48.png "/> </ li >
You can’t perform that action at this time.
0 commit comments