mirror of
https://github.com/9001/copyparty.git
synced 2025-08-17 09:02:15 -06:00
futureproof clipboard function
This commit is contained in:
parent
e40cd2a809
commit
e9be7e712d
|
@ -747,13 +747,25 @@ var widget = (function () {
|
|||
o.style.cssText = 'position:fixed;top:45%;left:48%;padding:1em;z-index:9';
|
||||
o.value = m;
|
||||
document.body.appendChild(o);
|
||||
o.focus();
|
||||
o.select();
|
||||
document.execCommand("copy");
|
||||
o.value = 'copied to clipboard ';
|
||||
setTimeout(function () {
|
||||
document.body.removeChild(o);
|
||||
}, 500);
|
||||
|
||||
var cln = function () {
|
||||
o.value = 'copied to clipboard ';
|
||||
setTimeout(function () {
|
||||
document.body.removeChild(o);
|
||||
}, 500);
|
||||
};
|
||||
var fb = function () {
|
||||
console.log('fb');
|
||||
o.focus();
|
||||
o.select();
|
||||
document.execCommand("copy");
|
||||
cln();
|
||||
};
|
||||
try {
|
||||
// https only
|
||||
navigator.clipboard.writeText(m).then(cln, fb);
|
||||
}
|
||||
catch (ex) { fb(); }
|
||||
};
|
||||
r.set(sread('au_open') == 1);
|
||||
setTimeout(function () {
|
||||
|
|
Loading…
Reference in a new issue