First Upload

This commit is contained in:
friloo 2026-07-01 18:26:57 +02:00 committed by GitHub
parent efc6fcbafa
commit c61677d47f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
28 changed files with 3921 additions and 0 deletions

17
extension/offscreen.js Normal file
View file

@ -0,0 +1,17 @@
'use strict';
chrome.runtime.onMessage.addListener((msg) => {
if (!msg || msg.target !== 'offscreen') return;
if (msg.type === 'CLIP_WRITE') {
const text = msg.text || '';
// Bevorzugt die Clipboard-API; Fallback über execCommand.
Promise.resolve()
.then(() => navigator.clipboard.writeText(text))
.catch(() => {
const ta = document.getElementById('t');
ta.value = text || ' ';
ta.select();
try { document.execCommand('copy'); } catch (e) { /* ignore */ }
ta.value = '';
});
}
});