I have had an addon written with Chat Gpt which also works well. However, Chat Gpt is now overwhelmed with further and so am I.
The extension is only for me private!
I would like to add a function in my existing addon. Currently, the addon activates a compressor only on Twitch.tv.
manifest.json
{
"manifest_version": 2,
"name": "Compressor",
"description": "A compressor for audio playback on Twitch.tv",
"version": "0.1",
"icons": {
"48": "icon.png"
},
"permissions": ["activeTab"],
"content_scripts": [
{
"matches": ["https://www.twitch.tv/*"],
"js": ["compressor.js"],
"run_at": "document_start"
}
],
"browser_action": {
"default_icon": "icon.png"
}
}
compressor.js
(function () {
window.addEventListener("load", function () {
let audioContext = new (window.AudioContext || window.webkitAudioContext)();
let source = audioContext.createMediaElementSource(
document.querySelector("video")
);
let compressor = audioContext.createDynamicsCompressor();
compressor.threshold.value = -60;
compressor.knee.value = 40;
compressor.ratio.value = 20;
compressor.attack.value = 0;
compressor.release.value = 1;
source.connect(compressor);
compressor.connect(audioContext.destination);
});
})();
I want to extend the addon.
Option 1:
If I am on twitch.tv or a twitch.tv/channel, the extension icon should show a check mark in green as a "badge" (that's the little box where you see numbers for ublock) (so I know, ok it works). And if I am outside of twitch.tv, like YouTube, it should show an X in red.
Here is also a page that explains it a bit, but somehow I can't get this cobbled together.
https://dev.to/paulasantamaria/chrome-extensions-adding-a-badge-644
Option 2:
Namely, I would like to exchange the Twitch icon with my icon.png if the addon is enabled. If that is not possible, it would also be ok if I can add an icon next to the search bar on the right. That would be it.And if you are on other pages, of course there is no icon and the extension icon turns gray as you know it. (I've looked too, only this is animated and it has polygon points and co and I'm not familiar with that).
png: https://abload.de/img/icongtebw.png
Maybe this is easier so maybe they could kindly add it to my code? I hope someone can help me?