Skip to content

Autonomous OODA-loop pentesting agent. Hermes brain, Kali + Playwright tools over MCP, ATT&CK as the Orient language.

feat(web): integrated audio control bar + fix volume fill

irrazabd03a427de3
diff --git a/docs/page.js b/docs/page.js
index 7998378..31e3944 100644
--- a/docs/page.js
+++ b/docs/page.js
@@ -11,6 +11,7 @@ window.initPostBoot = function (audioEl) {
initToasts();
initVisualizer(audioEl);
initKaraoke(audioEl);
+ initAudioControls(audioEl);
};
/* ═══════════════════════════════════════════════════════════════
@@ -393,3 +394,137 @@ function initKaraoke(audioEl) {
audioEl.addEventListener('seeked', () => { lastIdx = -1; });
}
}
+
+/* ═══════════════════════════════════════════════════════════════
+ AUDIO CONTROLS BAR — play/pause · seek · time · volume
+ Inserted below the karaoke zone in normal document flow.
+ Hides the corner mute button (superseded by inline volume).
+═══════════════════════════════════════════════════════════════ */
+function initAudioControls(audioEl) {
+ if (!audioEl) return;
+
+ // Hide the corner mute button — volume is now in the bar
+ var cornerCtrl = document.getElementById('audio-ctrl');
+ if (cornerCtrl) cornerCtrl.style.display = 'none';
+
+ // ── Build the bar ──────────────────────────────────────────────
+ var bar = document.createElement('div');
+ bar.id = 'audio-bar';
+ bar.setAttribute('role', 'region');
+ bar.setAttribute('aria-label', 'Audio player controls');
+
+ bar.innerHTML =
+ // Play / pause
+ '<button id="ab-play" class="ab-btn" aria-label="Play / pause">' +
+ '<svg id="ab-icon-play" viewBox="0 0 24 24" width="18" height="18" fill="currentColor" aria-hidden="true"><path d="M8 5v14l11-7z"/></svg>' +
+ '<svg id="ab-icon-pause" viewBox="0 0 24 24" width="18" height="18" fill="currentColor" aria-hidden="true" style="display:none"><path d="M6 19h4V5H6v14zm8-14v14h4V5h-4z"/></svg>' +
+ '</button>' +
+ // Time current
+ '<span id="ab-time" class="ab-time">0:00</span>' +
+ // Seek bar
+ '<div class="ab-seek-wrap">' +
+ '<input id="ab-seek" class="ab-range" type="range" min="0" max="100" value="0" step="0.1" aria-label="Seek">' +
+ '</div>' +
+ // Duration
+ '<span id="ab-dur" class="ab-time ab-dur">—:——</span>' +
+ // Volume icon
+ '<button id="ab-mute" class="ab-btn ab-btn--sm" aria-label="Mute / unmute">' +
+ '<svg id="ab-vol-icon" viewBox="0 0 24 24" width="16" height="16" fill="currentColor" aria-hidden="true"><path d="M3 9v6h4l5 5V4L7 9H3zm13.5 3c0-1.77-1.02-3.29-2.5-4.03v8.05c1.48-.73 2.5-2.25 2.5-4.02zM14 3.23v2.06c2.89.86 5 3.54 5 6.71s-2.11 5.85-5 6.71v2.06c4.01-.91 7-4.49 7-8.77s-2.99-7.86-7-8.77z"/></svg>' +
+ '</button>' +
+ // Volume slider
+ '<div class="ab-vol-wrap">' +
+ '<input id="ab-vol" class="ab-range ab-range--vol" type="range" min="0" max="1" value="0.4" step="0.01" aria-label="Volume">' +
+ '</div>';
+
+ // Insert after karaoke zone, or after visualizer
+ var anchor = document.getElementById('karaoke-zone') || document.getElementById('visualizer');
+ if (anchor) anchor.insertAdjacentElement('afterend', bar);
+ else document.body.appendChild(bar);
+
+ // ── Element refs ───────────────────────────────────────────────
+ var playBtn = document.getElementById('ab-play');
+ var iconPlay = document.getElementById('ab-icon-play');
+ var iconPause = document.getElementById('ab-icon-pause');
+ var timeEl = document.getElementById('ab-time');
+ var durEl = document.getElementById('ab-dur');
+ var seekEl = document.getElementById('ab-seek');
+ var muteBtn = document.getElementById('ab-mute');
+ var volEl = document.getElementById('ab-vol');
+ var volIcon = document.getElementById('ab-vol-icon');
+
+ // ── Helpers ───────────────────────────────────────────────────
+ var MUTE_SVG = '<path d="M16.5 12c0-1.77-1.02-3.29-2.5-4.03v2.21l2.45 2.45c.03-.2.05-.41.05-.63zm2.5 0c0 .94-.2 1.82-.54 2.64l1.51 1.51C20.63 14.91 21 13.5 21 12c0-4.28-2.99-7.86-7-8.77v2.06c2.89.86 5 3.54 5 6.71zM4.27 3L3 4.27 7.73 9H3v6h4l5 5v-6.73l4.25 4.25c-.67.52-1.42.93-2.25 1.18v2.06c1.38-.31 2.63-.95 3.69-1.81L19.73 21 21 19.73l-9-9L4.27 3zM12 4L9.91 6.09 12 8.18V4z"/>';
+ var SPK_SVG = '<path d="M3 9v6h4l5 5V4L7 9H3zm13.5 3c0-1.77-1.02-3.29-2.5-4.03v8.05c1.48-.73 2.5-2.25 2.5-4.02zM14 3.23v2.06c2.89.86 5 3.54 5 6.71s-2.11 5.85-5 6.71v2.06c4.01-.91 7-4.49 7-8.77s-2.99-7.86-7-8.77z"/>';
+
+ function fmt(s) {
+ s = Math.max(0, Math.floor(s));
+ return Math.floor(s / 60) + ':' + String(s % 60).padStart(2, '0');
+ }
+
+ function updatePlayIcon() {
+ var paused = audioEl.paused;
+ iconPlay.style.display = paused ? '' : 'none';
+ iconPause.style.display = !paused ? '' : 'none';
+ bar.classList.toggle('ab--playing', !paused);
+ }
+
+ function updateVolIcon() {
+ volIcon.innerHTML = audioEl.muted || audioEl.volume === 0 ? MUTE_SVG : SPK_SVG;
+ }
+
+ // ── Wire events ───────────────────────────────────────────────
+ // Play / pause
+ playBtn.addEventListener('click', function () {
+ if (audioEl.paused) audioEl.play().catch(function(){});
+ else audioEl.pause();
+ });
+
+ // Seek
+ var seeking = false;
+ seekEl.addEventListener('mousedown', function(){ seeking = true; });
+ seekEl.addEventListener('touchstart', function(){ seeking = true; }, { passive: true });
+ seekEl.addEventListener('input', function () {
+ if (audioEl.duration) audioEl.currentTime = (seekEl.value / 100) * audioEl.duration;
+ });
+ seekEl.addEventListener('change', function () { seeking = false; });
+
+ // Volume
+ volEl.addEventListener('input', function () {
+ audioEl.volume = parseFloat(volEl.value);
+ audioEl.muted = audioEl.volume === 0;
+ volEl.style.setProperty('--pct', (parseFloat(volEl.value) * 100) + '%');
+ updateVolIcon();
+ });
+
+ // Mute toggle
+ muteBtn.addEventListener('click', function () {
+ audioEl.muted = !audioEl.muted;
+ if (!audioEl.muted && audioEl.volume === 0) { audioEl.volume = 0.4; volEl.value = '0.4'; }
+ updateVolIcon();
+ });
+
+ // Sync time + seek position
+ audioEl.addEventListener('timeupdate', function () {
+ if (!seeking && audioEl.duration) {
+ seekEl.value = (audioEl.currentTime / audioEl.duration) * 100;
+ // Update CSS progress fill variable
+ seekEl.style.setProperty('--pct', seekEl.value + '%');
+ }
+ timeEl.textContent = fmt(audioEl.currentTime);
+ });
+
+ audioEl.addEventListener('durationchange', function () {
+ durEl.textContent = fmt(audioEl.duration);
+ });
+
+ audioEl.addEventListener('play', updatePlayIcon);
+ audioEl.addEventListener('pause', updatePlayIcon);
+
+ // Init volume
+ audioEl.volume = 0.4;
+ volEl.value = '0.4';
+ volEl.style.setProperty('--pct', '40%');
+ seekEl.style.setProperty('--pct', '0%');
+ updatePlayIcon();
+ updateVolIcon();
+}
diff --git a/docs/styles.css b/docs/styles.css
index 268affa..6102820 100644
--- a/docs/styles.css
+++ b/docs/styles.css
@@ -1300,3 +1300,117 @@ body.has-sysbar .hero::before {
letter-spacing: 0.1em;
text-shadow: 0 0 22px rgba(255,68,68,0.75), 0 0 44px rgba(255,68,68,0.3);
}
+
+/* ── Audio control bar ─────────────────────────────────────────── */
+#audio-bar {
+ width: 100%;
+ background: rgba(8, 0, 0, 0.97);
+ border-bottom: 1px solid var(--panel-edge);
+ display: flex;
+ align-items: center;
+ gap: 0.6rem;
+ padding: 0 1rem;
+ height: 3rem;
+ flex-shrink: 0;
+}
+
+/* ── Buttons ── */
+.ab-btn {
+ background: transparent;
+ border: none;
+ color: var(--muted);
+ cursor: pointer;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ padding: 0.25rem;
+ border-radius: 3px;
+ transition: color 0.15s;
+ flex-shrink: 0;
+}
+.ab-btn:hover { color: var(--accent-soft); }
+.ab-btn--sm { padding: 0.2rem; }
+
+#audio-bar.ab--playing .ab-btn#ab-play { color: var(--accent-soft); }
+
+/* ── Time labels ── */
+.ab-time {
+ font-family: var(--mono);
+ font-size: 0.72rem;
+ color: var(--muted);
+ white-space: nowrap;
+ flex-shrink: 0;
+ min-width: 2.5rem;
+ text-align: center;
+}
+.ab-dur { color: #664444; }
+
+/* ── Range wrapper ── */
+.ab-seek-wrap { flex: 1; min-width: 0; display: flex; align-items: center; }
+.ab-vol-wrap { width: 5rem; display: flex; align-items: center; flex-shrink: 0; }
+
+/* ── Range inputs — cross-browser themed ── */
+.ab-range {
+ -webkit-appearance: none;
+ appearance: none;
+ width: 100%;
+ height: 3px;
+ border-radius: 2px;
+ cursor: pointer;
+ outline: none;
+ background: linear-gradient(
+ to right,
+ var(--accent) 0%,
+ var(--accent) var(--pct, 0%),
+ #2a0000 var(--pct, 0%),
+ #2a0000 100%
+ );
+ --pct: 0%;
+}
+
+/* Webkit thumb */
+.ab-range::-webkit-slider-thumb {
+ -webkit-appearance: none;
+ width: 11px;
+ height: 11px;
+ border-radius: 50%;
+ background: var(--accent-soft);
+ cursor: pointer;
+ transition: background 0.15s, transform 0.15s;
+ box-shadow: 0 0 6px rgba(199, 90, 90, 0.6);
+}
+.ab-range:hover::-webkit-slider-thumb,
+.ab-range:focus::-webkit-slider-thumb {
+ background: #ff6666;
+ transform: scale(1.25);
+}
+
+/* Firefox thumb */
+.ab-range::-moz-range-thumb {
+ width: 11px;
+ height: 11px;
+ border-radius: 50%;
+ border: none;
+ background: var(--accent-soft);
+ cursor: pointer;
+ box-shadow: 0 0 6px rgba(199, 90, 90, 0.6);
+}
+.ab-range::-moz-range-track {
+ height: 3px;
+ border-radius: 2px;
+ background: #2a0000;
+}
+.ab-range::-moz-range-progress {
+ height: 3px;
+ border-radius: 2px;
+ background: var(--accent);
+}
+
+/* Volume range — slightly dimmer thumb */
+.ab-range--vol::-webkit-slider-thumb { width: 9px; height: 9px; }
+.ab-range--vol::-moz-range-thumb { width: 9px; height: 9px; }
+
+@media (max-width: 480px) {
+ .ab-vol-wrap { width: 3.5rem; }
+ .ab-dur { display: none; }
+}