MCPcopy Create free account
hub / github.com/dajie111/nodeseek-userscript / copyText

Function copyText

nodeImage.js:518–536  ·  view source on GitHub ↗
(t, onOk, onErr)

Source from the content-addressed store, hash-verified

516 return false;
517 }
518 function copyText(t, onOk, onErr) {
519 if (navigator.clipboard && navigator.clipboard.writeText) {
520 navigator.clipboard.writeText(t).then(onOk).catch(onErr);
521 } else {
522 try {
523 var ta = document.createElement('textarea');
524 ta.value = t;
525 ta.style.position = 'fixed';
526 ta.style.left = '-9999px';
527 document.body.appendChild(ta);
528 ta.select();
529 document.execCommand('copy');
530 ta.remove();
531 onOk();
532 } catch (e) {
533 onErr();
534 }
535 }
536 }
537 function validateImageFile(file) {
538 if (!file) return '请选择图片文件';
539 if (file.size > MAX_BYTES) return '文件超过 100MB 限制';

Callers 4

stepFunction · 0.85
appendImageDetailCardFunction · 0.85
showLinksFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected