File tree Expand file tree Collapse file tree 6 files changed +47
-0
lines changed
Expand file tree Collapse file tree 6 files changed +47
-0
lines changed Original file line number Diff line number Diff line change 1+ async function quickAdd ( data ) {
2+ const text = data . selectionText ;
3+ const endpoint = 'https://timkovi.ch/rip_quick_add_api' ;
4+
5+ const response = await fetch ( endpoint , {
6+ method : 'POST' ,
7+ headers : {
8+ 'Accept' : 'application/json' ,
9+ 'Content-Type' : 'application/json' ,
10+ } ,
11+ body : JSON . stringify ( { text} )
12+ } ) ;
13+
14+ const url = ( await response . json ( ) ) . url ;
15+ chrome . tabs . create ( { url} ) ;
16+ }
17+
18+ chrome . runtime . onInstalled . addListener ( ( ) => {
19+ chrome . contextMenus . create ( {
20+ id : 'id' ,
21+ title : 'Add to calendar: "%s"' ,
22+ contexts : [ 'selection' ] ,
23+ } ) ;
24+
25+ chrome . contextMenus . onClicked . addListener ( quickAdd ) ;
26+ } ) ;
Original file line number Diff line number Diff line change 1+ {
2+ "name" : " Rip Quick Add" ,
3+ "description" : " Quickly create Google calendar events from natural language." ,
4+ "version" : " 1.0" ,
5+ "manifest_version" : 3 ,
6+ "permissions" : [
7+ " contextMenus"
8+ ],
9+ "host_permissions" : [
10+ " https://timkovi.ch/rip_quick_add_api"
11+ ],
12+ "background" : {
13+ "service_worker" : " background.js"
14+ },
15+ "icons" : {
16+ "16" : " icon_16.png" ,
17+ "32" : " icon_32.png" ,
18+ "48" : " icon_48.png" ,
19+ "128" : " icon_128.png"
20+ }
21+ }
You can’t perform that action at this time.
0 commit comments