list_ssl.js 985 B

123456789101112131415161718192021222324252627282930
  1. function saveTextToBlob ( file, element ){
  2. 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. {
  9. // Chrome allows the link to be clicked
  10. // without actually adding it to the DOM.
  11. downloadLink.href = window.webkitURL.createObjectURL(textFileAsBlob);
  12. }
  13. else
  14. {
  15. // Firefox requires the link to be added to the DOM
  16. // before it can be clicked.
  17. downloadLink.href = window.URL.createObjectURL(textFileAsBlob);
  18. downloadLink.onclick = destroyClickedElement;
  19. downloadLink.style.display = "none";
  20. document.body.appendChild(downloadLink);
  21. }
  22. downloadLink.click();
  23. return false;
  24. }
  25. function destroyClickedElement(event)
  26. {
  27. document.body.removeChild(event.target);
  28. }