mirror of
https://github.com/9001/copyparty.git
synced 2025-08-18 01:22:13 -06:00
futureproof clipboard function
This commit is contained in:
parent
e40cd2a809
commit
e9be7e712d
|
@ -747,14 +747,26 @@ var widget = (function () {
|
||||||
o.style.cssText = 'position:fixed;top:45%;left:48%;padding:1em;z-index:9';
|
o.style.cssText = 'position:fixed;top:45%;left:48%;padding:1em;z-index:9';
|
||||||
o.value = m;
|
o.value = m;
|
||||||
document.body.appendChild(o);
|
document.body.appendChild(o);
|
||||||
o.focus();
|
|
||||||
o.select();
|
var cln = function () {
|
||||||
document.execCommand("copy");
|
|
||||||
o.value = 'copied to clipboard ';
|
o.value = 'copied to clipboard ';
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
document.body.removeChild(o);
|
document.body.removeChild(o);
|
||||||
}, 500);
|
}, 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);
|
r.set(sread('au_open') == 1);
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
clmod(widget, 'anim', 1);
|
clmod(widget, 'anim', 1);
|
||||||
|
|
Loading…
Reference in a new issue