diff --git a/edit.py b/edit.py index 36945c1..33aaa86 100644 --- a/edit.py +++ b/edit.py @@ -3,7 +3,7 @@ import os load_dotenv() -url = "https://api.short.io/links/lnk_2MDV_9dCPkouhKSC" +url = "https://api.short.io/links/lnk_2MDV_9dCPkoujKaJ" import json diff --git a/script-we.js b/script-we.js new file mode 100644 index 0000000..692c97d --- /dev/null +++ b/script-we.js @@ -0,0 +1,79 @@ + +// wait for submit button to be clicked +document.getElementById("myinput").onclick = function () { + // get the link from the input + var link = document.getElementById("linkinput").value; + + let api_url="https://api.short.io/links/lnk_2MDV_9dCPkoujKaJ"; + + + // data to be sent to the API + var data = { + domain: "link.laavesh.ml", + originalURL: link, + allowDuplicates: false, + }; + + + // send the data to the API + fetch(api_url, { + method: "post", + headers: { + accept: "application/json", + "Content-Type": "application/json", + authorization: "sk_oNHGE7VRdKp0DWJc", + }, + body: JSON.stringify(data), + }) + // get the response from the API + .then(function (response) { + return response.json(); + }) + // display the shortened link + .then(function (data) { + if (data.error) { + throw data.error; + } + // get shortened link + let url = String(data.shortURL); + // remove https:// + url =url.replace("https://", ""); + // display shortened link + console.log(url); + document.getElementById("message").innerHTML = url; + }) + // display error if any + .catch(function (error) { + console.log(error); + document.getElementById("message").innerHTML = error; + }); + + // clear the input fields + document.getElementById("linkinput").value = ""; +}; + + +// Copy the link to the clipboard +document.getElementById("copy").onclick = function () { + // Get the text field + var message = document.getElementById("message"); + + // get the link + url = message.innerHTML; + + + // Copy link to clipboard + navigator.clipboard.writeText(url); + + // Alert copied to clipboard + message.innerHTML = "Copied!"; + console.log("Copied!"); + + // Change back to link after 800ms + setTimeout(function () { + message.innerHTML = url; + }, 800); + + + +} \ No newline at end of file diff --git a/script.js b/script.js index 10ea904..14c9d50 100644 --- a/script.js +++ b/script.js @@ -35,8 +35,11 @@ document.getElementById("myinput").onclick = function () { if (data.error) { throw data.error; } + // get shortened link let url = String(data.shortURL); + // remove https:// url =url.replace("https://", ""); + // display shortened link console.log(url); document.getElementById("message").innerHTML = url; }) diff --git a/wetransfer.html b/wetransfer.html new file mode 100644 index 0000000..158d888 --- /dev/null +++ b/wetransfer.html @@ -0,0 +1,52 @@ + + + + + + + Shorten! from aviiciii + + + + + + + +
+
+ + +
+ + +
+ + + + + + + + + Shorten + +
+ +
+ + +
+
+

link.laavesh.ml/we

+
+
+ +
+
+
+ + + + + +