Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

11 migrate to manifest v3 #12

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions build/all.js

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion build/webpack.base.conf.js
Original file line number Diff line number Diff line change
@@ -7,7 +7,8 @@ module.exports = {
entry: {
app: './src/main.js',
loader: './src/loader.js',
background: './src/background.js'
background: './src/background.js',
all: './src/all.js'
},
output: {
path: config.build.assetsRoot,
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<script src="https://use.fontawesome.com/releases/v5.14.0/js/all.js" data-auto-replace-svg="nest"></script>
<script src="./static/js/all.js" data-auto-replace-svg="nest"></script>
<meta charset="utf-8">
<title>TermClick</title>
</head>
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "TermClick",
"version": "1.2.5",
"description": "Click on a term to search for its definition, label and synonyms as well as its identifier and type across the approved ontologies of TIB Terminology Service at https://service.tib.eu/ts4tib/index .",
"description": "Click on a term to search for its definition, label, synonyms, identifier and type across the ontologies of TIB Terminology Service",
"author": "giraygi <giraytuncay@gmail.com>; grimbonious <grimbonious@hey.computer>",
"license": "GPL-3.0",
"private": true,
5 changes: 5 additions & 0 deletions src/all.js

Large diffs are not rendered by default.

26 changes: 20 additions & 6 deletions src/background.js
Original file line number Diff line number Diff line change
@@ -20,14 +20,28 @@ chrome.runtime.onStartup.addListener(function() {
});
});

function getCurrentTab(tab){
var currentTab = JSON.stringify(tab);
}

chrome.contextMenus.onClicked.addListener(function(item, tab) {
chrome.tabs.insertCSS({
file: 'static/css/loader.css'
}), chrome.tabs.executeScript({
code: 'var currentTab = ' + JSON.stringify(tab)
chrome.scripting.insertCSS({
target: {
tabId: tab.id
},
files: ['static/css/loader.css']
}), chrome.scripting.executeScript({
target: {
tabId: tab.id
},
func: getCurrentTab,
args: [tab]
}, function() {
chrome.tabs.executeScript({
file: 'static/js/loader.js'
chrome.scripting.executeScript({
target: {
tabId: tab.id
},
files: ['static/js/loader.js']
})
});
});
23 changes: 15 additions & 8 deletions src/manifest.json
Original file line number Diff line number Diff line change
@@ -1,30 +1,37 @@
{
"name": "TermClick",
"description": "Click on a term to search for its definition, label and synonyms as well as its identifier and type across the approved ontologies of TIB Terminology Service at https://service.tib.eu/ts4tib/index .",
"description": "Click on a term to search for its definition, label, synonyms, identifier and type across the ontologies of TIB Terminology Service",
"version": "1.2.5",
"background": {
"scripts": ["static/js/background.js"]
"service_worker": "static/js/background.js",
"type": "module"
},
"manifest_version": 3,
"content_security_policy": {
"extension_pages": "script-src 'self'; object-src 'self'"
},
"manifest_version": 2,
"content_security_policy": "script-src 'self' 'unsafe-eval' https://use.fontawesome.com/releases/v5.14.0/js/all.js; object-src 'self'",
"icons": {
"16": "static/img/tib.png",
"128": "static/img/tib.png"
},
"browser_action": {
"action": {
"default_title": "Termclick",
"default_popup": "index.html"
},
"web_accessible_resources": [
"web_accessible_resources": [{ "resources": [
"index.html",
"static/js/app.js",
"static/js/app.js.map",
"static/js/all.js",
"static/js/all.js.map",
"static/js/vendor.js",
"static/js/vendor.js.map",
"static/css/app.css",
"static/css/app.css.map"
],
"static/css/app.css.map"],
"matches": ["<all_urls>"]
}],
"permissions": [
"scripting",
"contextMenus",
"clipboardWrite",
"activeTab"