First Upload
This commit is contained in:
parent
efc6fcbafa
commit
c61677d47f
28 changed files with 3921 additions and 0 deletions
17
extension/offscreen.js
Normal file
17
extension/offscreen.js
Normal 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 = '';
|
||||
});
|
||||
}
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue