From a22e12645202f87830a0a6136b6cdd56f6bf24a3 Mon Sep 17 00:00:00 2001 From: longnghia <41385034+longnghia@users.noreply.github.com> Date: Sat, 7 Sep 2024 23:02:27 +0700 Subject: [PATCH] export JSON data --- public/json16.png | Bin 0 -> 496 bytes public/json32.png | Bin 0 -> 634 bytes src/pages/background/index.ts | 15 +++++++++++++++ 3 files changed, 15 insertions(+) create mode 100644 public/json16.png create mode 100644 public/json32.png diff --git a/public/json16.png b/public/json16.png new file mode 100644 index 0000000000000000000000000000000000000000..67894139def24544cf78f50d567f9cf95c7ae69a GIT binary patch literal 496 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!60wlNoGJgf66p}rHd>I(3)EF2VS{N990fib~ zFff!FFfhDIU|_JC!N4G1FlSew4N!t9$=lt9;eUJonf*W>XMsm#F#`kNVGw3Kp1&dm zD9B#o>Fdh=f|H%!Qewjf>oB0uEKe855RLO|FP!E)lpx^xke}Bn$RWp}T#@%iqwJDS zkp%u*ZLSec+XS0353{p~>rJ`uBF1u(KIa?QOo!Z%U$mNmHB|V|Z`vf9ALmgKv3H#pjoL}DKjmSf-H!6qat{uoGEMZ;1?r*!B_s(3*ES4m_Tz~byxzdllWOCXntSo`9R4s9hC`m~yNwrEYN(E93 zMg~SEx(1fI2Ie7#rdFnAR>o%91_o9J21y%r9;0Z;%}>cptHjh`WCGFPakCW|q6`{v z8%i>BQ;SOya|_V*m|Ma0eBe9J3DhGA(i5DYR#Ki=l*&+EUaps!mtCBkSdglhUz9%k SosASw5re0zpUXO@geCx#PM_8Q literal 0 HcmV?d00001 diff --git a/public/json32.png b/public/json32.png new file mode 100644 index 0000000000000000000000000000000000000000..13d9326df17f0c3b2744a9c0f46054c38cd66045 GIT binary patch literal 634 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE0wix1Z>k4zl0AZa85pY67#JE_7#My5g&JNk zFq9fFFuY1&V6d9Oz#v{QXIG#NP=YDR+ueoXe|!I#{XiaPfk$L90|Vb-5N14{zaj-F z$X?><>&pIulbzpEV_GIR&^SgFPZ!4!kK=ErZ1iJt6mjK$-Q~2Db87S__D4c>hnQZx z@y)sUe!-I4UHKpQH9R_kB7}vtlD4av?MkdPVOBg7oxX8G+wHS^jm_Whn`vHf=wsos zO^p0oDwK_18~NY)bTHiTvYK#<;Z@z>)E3}bd0@SxgNu`w zd#Lpi6&IGDY_%+j9zH|yG-{A_H|RcbqZ5M z+8GzbB_ zwK6rcGB(pTFt9Q(NZP3L7)3*FeoAIqC8h==6Nm| z+{(lNqUVs_qq#smk{~_7`DrEPiAAXl<>lpinR(g8$%zH2dih1^v)|cB0TnTLy85}S Ib4q9e02*WDYXATM literal 0 HcmV?d00001 diff --git a/src/pages/background/index.ts b/src/pages/background/index.ts index c0f30e8..ab11986 100644 --- a/src/pages/background/index.ts +++ b/src/pages/background/index.ts @@ -1,6 +1,7 @@ import { Tab } from '@src/types'; import { setBadge, setBadgeBackground } from '@src/utils/badge'; import { isProd } from '@src/utils/env'; +import { save2Json } from '@src/utils/file'; import { getValue, setValue } from '@src/utils/storage'; import { createTab, @@ -153,6 +154,20 @@ function setupContextMenu() { }, } as chrome.contextMenus.CreateProperties); } + + chrome.contextMenus.create({ + id: 'export_json', + title: 'Export JSON', + contexts: ['browser_action'], + onclick: async () => { + const data = await getValue(); + save2Json(data); + }, + icons: { + 16: '../public/json16.png', + 32: '../public/json32.png', + }, + } as chrome.contextMenus.CreateProperties); } function setupOmnibox() {