Fix for rebased files
This commit is contained in:
parent
8348fedf9b
commit
68e6be32f0
4 changed files with 0 additions and 168 deletions
47
content.js
47
content.js
|
|
@ -1,47 +0,0 @@
|
||||||
let gainNode = null;
|
|
||||||
let audioCtx = null;
|
|
||||||
let sourceMap = new WeakMap();
|
|
||||||
|
|
||||||
function setVolume(percent) {
|
|
||||||
const factor = percent / 100;
|
|
||||||
document.querySelectorAll('video, audio').forEach(el => {
|
|
||||||
if (!sourceMap.has(el)) {
|
|
||||||
if (!audioCtx) {
|
|
||||||
audioCtx = new AudioContext();
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
const src = audioCtx.createMediaElementSource(el);
|
|
||||||
const gain = audioCtx.createGain();
|
|
||||||
src.connect(gain);
|
|
||||||
gain.connect(audioCtx.destination);
|
|
||||||
sourceMap.set(el, gain);
|
|
||||||
} catch (e) {
|
|
||||||
// Element bereits in einem anderen Context
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
sourceMap.get(el).gain.value = factor;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// Beim Laden: gespeicherten Wert anwenden
|
|
||||||
chrome.storage.local.get('volume', ({ volume }) => {
|
|
||||||
if (volume !== undefined) setVolume(volume);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Auf Nachrichten vom Popup hören
|
|
||||||
chrome.runtime.onMessage.addListener(({ volume }) => {
|
|
||||||
if (volume !== undefined) setVolume(volume);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Neue Media-Elemente automatisch erfassen
|
|
||||||
const observer = new MutationObserver(() => {
|
|
||||||
chrome.storage.local.get('volume', ({ volume }) => {
|
|
||||||
if (volume !== undefined && volume !== 100) {
|
|
||||||
setVolume(volume);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
observer.observe(document.body, {
|
|
||||||
childList: true, subtree: true
|
|
||||||
});
|
|
||||||
|
|
@ -1,20 +1,6 @@
|
||||||
{
|
{
|
||||||
"manifest_version": 3,
|
"manifest_version": 3,
|
||||||
"name": "Volume Booster",
|
"name": "Volume Booster",
|
||||||
"version": "1.0",
|
|
||||||
"description": "Boost audio up to 600%",
|
|
||||||
"permissions": ["activeTab", "storage"],
|
|
||||||
"action": {
|
|
||||||
"default_popup": "popup.html",
|
|
||||||
"default_title": "Volume Booster"
|
|
||||||
},
|
|
||||||
"content_scripts": [
|
|
||||||
{
|
|
||||||
"matches": ["<all_urls>"],
|
|
||||||
"js": ["content.js"]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"author": "Tronax mail@tronax.dev",
|
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"description": "Boost or lower the volume of any browser tab — up to 600%. Mit schönem Interface.",
|
"description": "Boost or lower the volume of any browser tab — up to 600%. Mit schönem Interface.",
|
||||||
"permissions": ["activeTab", "tabs", "storage", "tabCapture", "offscreen"],
|
"permissions": ["activeTab", "tabs", "storage", "tabCapture", "offscreen"],
|
||||||
|
|
|
||||||
66
popup.html
66
popup.html
|
|
@ -1,71 +1,6 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="de">
|
<html lang="de">
|
||||||
<head>
|
<head>
|
||||||
<<<<<<< HEAD
|
|
||||||
<meta charset="UTF-8">
|
|
||||||
<style>
|
|
||||||
* { box-sizing: border-box; margin: 0; padding: 0; }
|
|
||||||
body {
|
|
||||||
width: 240px;
|
|
||||||
font-family: -apple-system, sans-serif;
|
|
||||||
background: #1c1c1e;
|
|
||||||
color: #fff;
|
|
||||||
padding: 16px;
|
|
||||||
}
|
|
||||||
h1 {
|
|
||||||
font-size: 13px;
|
|
||||||
font-weight: 500;
|
|
||||||
margin-bottom: 16px;
|
|
||||||
color: rgba(255,255,255,0.6);
|
|
||||||
letter-spacing: 0.5px;
|
|
||||||
}
|
|
||||||
.value {
|
|
||||||
font-size: 36px;
|
|
||||||
font-weight: 600;
|
|
||||||
line-height: 1;
|
|
||||||
margin-bottom: 16px;
|
|
||||||
}
|
|
||||||
.value span { font-size: 18px; color: rgba(255,255,255,0.5); }
|
|
||||||
input[type=range] {
|
|
||||||
width: 100%;
|
|
||||||
accent-color: #30d158;
|
|
||||||
margin-bottom: 6px;
|
|
||||||
}
|
|
||||||
.marks {
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
font-size: 10px;
|
|
||||||
color: rgba(255,255,255,0.3);
|
|
||||||
margin-bottom: 16px;
|
|
||||||
}
|
|
||||||
button {
|
|
||||||
width: 100%;
|
|
||||||
padding: 8px;
|
|
||||||
background: rgba(255,255,255,0.06);
|
|
||||||
border: none;
|
|
||||||
border-radius: 8px;
|
|
||||||
color: rgba(255,255,255,0.6);
|
|
||||||
font-size: 12px;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
button:hover { background: rgba(255,255,255,0.1); }
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<h1>VOLUME BOOSTER</h1>
|
|
||||||
<div class="value">
|
|
||||||
<span id="display">100</span><span>%</span>
|
|
||||||
</div>
|
|
||||||
<input type="range" id="slider"
|
|
||||||
min="0" max="600" step="1" value="100">
|
|
||||||
<div class="marks">
|
|
||||||
<span>0%</span>
|
|
||||||
<span>200%</span>
|
|
||||||
<span>400%</span>
|
|
||||||
<span>600%</span>
|
|
||||||
</div>
|
|
||||||
<button id="reset">↺ Zurücksetzen</button>
|
|
||||||
=======
|
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<title>Volume Booster</title>
|
<title>Volume Booster</title>
|
||||||
<link rel="stylesheet" href="popup.css" />
|
<link rel="stylesheet" href="popup.css" />
|
||||||
|
|
@ -153,7 +88,6 @@
|
||||||
<p class="note" id="note">Über 100 % wird der Tab-Ton verstärkt.</p>
|
<p class="note" id="note">Über 100 % wird der Tab-Ton verstärkt.</p>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
>>>>>>> 2056a0d (First Commit, Code by Claude 4.7 Opus)
|
|
||||||
<script src="popup.js"></script>
|
<script src="popup.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
||||||
41
popup.js
41
popup.js
|
|
@ -1,43 +1,3 @@
|
||||||
<<<<<<< HEAD
|
|
||||||
const slider = document.getElementById('slider');
|
|
||||||
const display = document.getElementById('display');
|
|
||||||
const reset = document.getElementById('reset');
|
|
||||||
|
|
||||||
// Gespeicherten Wert laden
|
|
||||||
chrome.storage.local.get('volume', ({ volume }) => {
|
|
||||||
const val = volume ?? 100;
|
|
||||||
slider.value = val;
|
|
||||||
display.textContent = val;
|
|
||||||
});
|
|
||||||
|
|
||||||
// Schieberegler bewegen
|
|
||||||
slider.addEventListener('input', () => {
|
|
||||||
const val = parseInt(slider.value);
|
|
||||||
display.textContent = val;
|
|
||||||
chrome.storage.local.set({ volume: val });
|
|
||||||
|
|
||||||
// Aktiven Tab anweisen
|
|
||||||
chrome.tabs.query(
|
|
||||||
{ active: true, currentWindow: true },
|
|
||||||
([tab]) => {
|
|
||||||
chrome.tabs.sendMessage(tab.id, { volume: val });
|
|
||||||
}
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Zurücksetzen auf 100%
|
|
||||||
reset.addEventListener('click', () => {
|
|
||||||
slider.value = 100;
|
|
||||||
display.textContent = 100;
|
|
||||||
chrome.storage.local.set({ volume: 100 });
|
|
||||||
chrome.tabs.query(
|
|
||||||
{ active: true, currentWindow: true },
|
|
||||||
([tab]) => {
|
|
||||||
chrome.tabs.sendMessage(tab.id, { volume: 100 });
|
|
||||||
}
|
|
||||||
);
|
|
||||||
});
|
|
||||||
=======
|
|
||||||
// ============================================================
|
// ============================================================
|
||||||
// Volume Booster — Popup Logic
|
// Volume Booster — Popup Logic
|
||||||
// ============================================================
|
// ============================================================
|
||||||
|
|
@ -181,4 +141,3 @@ document.addEventListener("keydown", (e) => {
|
||||||
});
|
});
|
||||||
|
|
||||||
init();
|
init();
|
||||||
>>>>>>> 2056a0d (First Commit, Code by Claude 4.7 Opus)
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue