From 15c37cd2383a25111c3a2eb2aa94117f9d2aabb8 Mon Sep 17 00:00:00 2001 From: Leon Lambert Date: Fri, 27 Dec 2024 14:54:12 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E5=A4=A7=E5=B9=85=E7=B2=BE?= =?UTF-8?q?=E7=AE=80=20bing=20dict=20html?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 1 - public/manifest.json | 2 +- src/background.js | 11 +++++------ 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index 710afc8..f201775 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,6 @@ }, "devDependencies": { "@types/chrome": "^0.0.268", - "@types/dompurify": "^3.0.5", "copy-webpack-plugin": "^12.0.2", "eslint": "^8.57.0", "eslint-config-airbnb-base": "^15.0.0", diff --git a/public/manifest.json b/public/manifest.json index 6c8d3b1..df30dd8 100644 --- a/public/manifest.json +++ b/public/manifest.json @@ -4,7 +4,7 @@ "name": "__MSG_appName__", "description": "__MSG_appDesc__", "default_locale": "zh_CN", - "version": "0.10.0", + "version": "0.10.1", "icons": { "48": "assets/result48.png", "128": "assets/icon_128.png" diff --git a/src/background.js b/src/background.js index 19c964c..b1192b9 100644 --- a/src/background.js +++ b/src/background.js @@ -34,11 +34,10 @@ function initDatabase() { function saveToIndexedDB(q, data) { const transaction = db.transaction(['dictionary'], 'readwrite') const objectStore = transaction.objectStore('dictionary') - console.log('save to db', data) const request = objectStore.add({ q: q.toLowerCase(), data: data }) request.onsuccess = function(event) { - console.log('Data saved to IndexedDB:', q) + console.info(`\x1B[31msaved to DB ==> \x1B[34m${q}`) } request.onerror = function(event) { @@ -142,7 +141,7 @@ function initialize_extension() { getFromIndexedDB(request.q) .then(cachedData => { if (cachedData) { - console.info(`\t==>db cache : ${request.q}`) + console.info(`\tcache: \x1b[43m${request.q}`) sendResponse(cachedData) } else { console.log('fetch bing: ', request.q) @@ -152,10 +151,10 @@ function initialize_extension() { .then(html => { const minimizeHtml = html .replace(/