purr

password generation and secret sharing
Log | Files | Refs | README | LICENSE

copyButtons.js (931B)


      1 function copySecret(secret) {
      2   var tempText = document.createElement('input');
      3   tempText.style = 'position: absolute; left: -1000px; top: -1000px';
      4   tempText.value = secret;
      5   document.body.appendChild(tempText);
      6   tempText.select();
      7   document.execCommand('copy');
      8   document.body.removeChild(tempText);
      9   document.getElementById('secretButton').innerHTML = "- secret copied -";
     10   document.getElementById('linkButton').innerHTML = "copy link";
     11 } 
     12 
     13 function copyLink(link) {
     14   var tempText = document.createElement('input');
     15   tempText.style = 'position: absolute; left: -1000px; top: -1000px';
     16   tempText.value = window.location.origin + '/pw/' + link;
     17   document.body.appendChild(tempText);
     18   tempText.select();
     19   document.execCommand('copy');
     20   document.body.removeChild(tempText);
     21   document.getElementById('linkButton').innerHTML = "- link copied -";
     22   document.getElementById('secretButton').innerHTML = "copy secret";
     23 }