Skip to content

Commit

Permalink
fix: use activeTab
Browse files Browse the repository at this point in the history
  • Loading branch information
makinzm committed Jan 3, 2025
1 parent 68c06d6 commit 63747b0
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion dist/background.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions dist/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
"name": "ClipLex",
"version": "1.0.0",
"description": "Improve your English vocabulary with ClipLex",
"permissions": ["storage"],
"host_permissions": ["<all_urls>"],
"permissions": ["storage", "activeTab", "scripting"],
"options_page": "options/options.html",
"content_scripts": [
{
Expand Down
9 changes: 9 additions & 0 deletions src/background.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
import { LocalDatabase } from "./database";

chrome.action.onClicked.addListener((tab) => {
if (tab.id && tab.url) {
chrome.scripting.executeScript({
target: { tabId: tab.id },
files: ["content_script.js"], // 動的に注入するスクリプト
});
}
});

const db = new LocalDatabase();

console.log("Background script started.");
Expand Down
3 changes: 1 addition & 2 deletions src/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
"name": "ClipLex",
"version": "1.0.0",
"description": "Improve your English vocabulary with ClipLex",
"permissions": ["storage"],
"host_permissions": ["<all_urls>"],
"permissions": ["storage", "activeTab", "scripting"],
"options_page": "options/options.html",
"content_scripts": [
{
Expand Down

0 comments on commit 63747b0

Please sign in to comment.