diff --git a/public/index.html b/public/index.html index ad48f22..f33d358 100644 --- a/public/index.html +++ b/public/index.html @@ -127,11 +127,16 @@

Instructions

-
- +
+ + + + +
diff --git a/public/index.js b/public/index.js index 3641685..cb2844e 100644 --- a/public/index.js +++ b/public/index.js @@ -130,6 +130,35 @@ function generateCode() { return true; } +function generateShellScript() { + const codeContainer = document.querySelector(".code"); + const codeValue = codeContainer.innerText; + + var element = document.createElement("a"); + element.setAttribute( + "href", + "data:text/plain;charset=utf-8," + encodeURIComponent(codeValue) + ); + element.setAttribute("download", "script.sh"); + + element.style.display = "none"; + document.body.appendChild(element); + + element.click(); + + document.body.removeChild(element); + + const codeHeader = document.querySelector(".code-header"); + const downloadIcon = codeHeader.querySelector(".download-icon"); + downloadIcon.setAttribute("fill", "#26a641"); + downloadIcon.innerHTML = ``; + + setTimeout(function () { + downloadIcon.setAttribute("fill", "#26a641"); + downloadIcon.innerHTML = ``; + }, 3000); +} + function displayCode() { if (!generateCode()) { return; @@ -175,7 +204,7 @@ function copyCode() { setTimeout(function () { codeIcon.setAttribute("fill", "#26a641"); - codeIcon.innerHTML = ``; + codeIcon.innerHTML = ``; }, 3000); } diff --git a/public/style.css b/public/style.css index c2fd3ad..2f9c542 100644 --- a/public/style.css +++ b/public/style.css @@ -358,13 +358,13 @@ h2 { margin: 10px; } -.code-icon { +.code-icon, .download-icon { padding: 5px; width: 20px; transition: .2s ease; } -.code-icon:hover { +.code-icon:hover, .download-icon:hover { cursor: pointer; border-radius: 5px; background-color: #0d1117;