Skip to content
Snippets Groups Projects
Commit a01d1cc3 authored by Alpi-Laptop's avatar Alpi-Laptop
Browse files

#added manifest

#added files for first test
parent a47985ce
Branches
No related tags found
No related merge requests found
let color = '#3aa757';
chrome.runtime.onInstalled.addListener(() => {
chrome.storage.sync.set({ color });
console.log('Default background color set to %cgreen', `color: ${color}`);
});
\ No newline at end of file
button {
height: 30px;
width: 30px;
outline: none;
margin: 10px;
border: none;
border-radius: 2px;
}
button.current {
box-shadow: 0 0 0 2px white,
0 0 0 4px black;
}
\ No newline at end of file
images/get_started128.png

2.75 KiB

images/get_started16.png

495 B

images/get_started32.png

814 B

images/get_started48.png

1.2 KiB

...@@ -2,5 +2,24 @@ ...@@ -2,5 +2,24 @@
"name": "Getting Started Example", "name": "Getting Started Example",
"description": "Build an Extension!", "description": "Build an Extension!",
"version": "1.0", "version": "1.0",
"manifest_version": 3 "manifest_version": 3,
"background": {
"service_worker": "background.js"
},
"permissions": ["storage", "activeTab", "scripting"],
"action": {
"default_popup": "popup.html",
"default_icon": {
"16": "/images/get_started16.png",
"32": "/images/get_started32.png",
"48": "/images/get_started48.png",
"128": "/images/get_started128.png"
}
},
"icons": {
"16": "/images/get_started16.png",
"32": "/images/get_started32.png",
"48": "/images/get_started48.png",
"128": "/images/get_started128.png"
}
} }
\ No newline at end of file
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" href="button.css">
<title>DigitalME</title>
</head>
<body>
<button id="changeColor"></button>
<script src="popup.js"></script>
</body>
</html>
\ No newline at end of file
popup.js 0 → 100644
// When the button is clicked, inject setPageBackgroundColor into current page
changeColor.addEventListener("click", async () => {
let [tab] = await chrome.tabs.query({ active: true, currentWindow: true });
chrome.scripting.executeScript({
target: { tabId: tab.id },
function: setPageBackgroundColor,
});
});
// The body of this function will be executed as a content script inside the
// current page
function setPageBackgroundColor() {
chrome.storage.sync.get("color", ({ color }) => {
document.body.style.backgroundColor = color;
});
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment