feat: improve Clipboard Sniffer extension integration and UI fixes

This commit is contained in:
2026-02-27 03:37:33 +00:00
parent 1d7fd9a5bc
commit 8e8bf47297
14 changed files with 872 additions and 181 deletions

34
extension/popup.js Normal file
View File

@@ -0,0 +1,34 @@
// popup.js
document.addEventListener('DOMContentLoaded', () => {
const soundToggle = document.getElementById('soundToggle');
// Load saved setting
chrome.storage.local.get(['playSound'], (result) => {
soundToggle.checked = result.playSound !== false; // Default to true
});
// Save setting on change
soundToggle.addEventListener('change', () => {
chrome.storage.local.set({ playSound: soundToggle.checked });
// Play test sound if enabled
if (soundToggle.checked) {
const audioContext = new (window.AudioContext || window.webkitAudioContext)();
const oscillator = audioContext.createOscillator();
const gainNode = audioContext.createGain();
oscillator.connect(gainNode);
gainNode.connect(audioContext.destination);
oscillator.type = 'sine';
oscillator.frequency.setValueAtTime(500, audioContext.currentTime);
oscillator.frequency.exponentialRampToValueAtTime(1000, audioContext.currentTime + 0.1);
gainNode.gain.setValueAtTime(0.1, audioContext.currentTime);
gainNode.gain.exponentialRampToValueAtTime(0.01, audioContext.currentTime + 0.1);
oscillator.start();
oscillator.stop(audioContext.currentTime + 0.1);
}
});
});