24 lines
931 B
JavaScript
24 lines
931 B
JavaScript
|
function copySecret(secret) {
|
||
|
var tempText = document.createElement('input');
|
||
|
tempText.style = 'position: absolute; left: -1000px; top: -1000px';
|
||
|
tempText.value = secret;
|
||
|
document.body.appendChild(tempText);
|
||
|
tempText.select();
|
||
|
document.execCommand('copy');
|
||
|
document.body.removeChild(tempText);
|
||
|
document.getElementById('secretButton').innerHTML = "- secret copied -";
|
||
|
document.getElementById('linkButton').innerHTML = "copy link";
|
||
|
}
|
||
|
|
||
|
function copyLink(link) {
|
||
|
var tempText = document.createElement('input');
|
||
|
tempText.style = 'position: absolute; left: -1000px; top: -1000px';
|
||
|
tempText.value = window.location.origin + '/pw/' + link;
|
||
|
document.body.appendChild(tempText);
|
||
|
tempText.select();
|
||
|
document.execCommand('copy');
|
||
|
document.body.removeChild(tempText);
|
||
|
document.getElementById('linkButton').innerHTML = "- link copied -";
|
||
|
document.getElementById('secretButton').innerHTML = "copy secret";
|
||
|
}
|