list_ssl.js 876 B

12345678910111213141516171819202122232425
  1. function saveTextToBlob(file, element) {
  2. var text = document.getElementById(element).value;
  3. var textFileAsBlob = new Blob([text], { type: 'text/plain' });
  4. var downloadLink = document.createElement('a');
  5. downloadLink.download = file;
  6. downloadLink.innerHTML = 'Download File';
  7. if (window.webkitURL != null) {
  8. // Chrome allows the link to be clicked
  9. // without actually adding it to the DOM.
  10. downloadLink.href = window.webkitURL.createObjectURL(textFileAsBlob);
  11. } else {
  12. // Firefox requires the link to be added to the DOM
  13. // before it can be clicked.
  14. downloadLink.href = window.URL.createObjectURL(textFileAsBlob);
  15. downloadLink.onclick = destroyClickedElement;
  16. downloadLink.style.display = 'none';
  17. document.body.appendChild(downloadLink);
  18. }
  19. downloadLink.click();
  20. }
  21. function destroyClickedElement(event) {
  22. document.body.removeChild(event.target);
  23. }