SUS Link Lengthener
84 | 85 |87 | ➖🟥🟥🟥🟥🟥
88 | 🟥🟥🟥🟦🟦🟦
89 | 🟥🟥🟥🟦🟦🟦
90 | 🟥🟥🟥🟥🟥🟥
91 | 🟥🟥🟥🟥🟥🟥
92 | ➖🟥🟥🟥🟥🟥
93 | ➖🟥🟥➖🟥🟥
96 | ➖🟥🟥➖🟥🟥
99 |
113 | 114 |
115 | 116 |├── assets ├── favicon.ico └── preview.png ├── README.md ├── app.js └── index.html /assets/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lmssieh/SUS-link-lengthener/HEAD/assets/favicon.ico -------------------------------------------------------------------------------- /assets/preview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lmssieh/SUS-link-lengthener/HEAD/assets/preview.png -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ඞ 2 | 3 | a tiny website without a backend that lets you build long, confusing links. With just a few clicks, you can turn a boring old link into a lengthy, confusing masterpiece. Give it a try today and see how your short links can become long and interesting! 4 | 5 | try it at [https://lmssieh.github.io/SUS-link-lengthener/](https://lmssieh.github.io/SUS-link-lengthener/) 6 | 7 |  8 | 9 | 10 | 11 | 12 | inspired by [A(x56) - URL Lengthener](https://aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.com/) 13 | css by [discord.css](https://github.com/lmssieh/discord.css) 14 | -------------------------------------------------------------------------------- /app.js: -------------------------------------------------------------------------------- 1 | const emotes = ["𐐘", "𐑀", "𐐿", "𐐃", "𐐫"]; 2 | const seperator = "ඞ"; 3 | const ee = { 4 | 0: "𐐘𐐘𐐘", 5 | 1: "𐐿𐐫𐐘", 6 | 2: "𐑀𐐿𐐿", 7 | 3: "𐐘𐐫𐐿", 8 | 4: "𐐘𐑀𐐃", 9 | 5: "𐑀𐐫𐐘", 10 | 6: "𐐃𐐃𐑀", 11 | 7: "𐐫𐐃𐐘", 12 | 8: "𐐃𐐃𐐃", 13 | 9: "𐑀𐐘𐐫", 14 | }; 15 | 16 | window.onhashchange = () => window.location.reload(); 17 | 18 | const URL = location.href; 19 | 20 | const codeFormEle = document.querySelector("#formCode"); 21 | const codeInputEle = document.querySelector("#codeLinkInput"); 22 | const codeResult = document.querySelector("#codeResult"); 23 | 24 | codeFormEle.addEventListener("submit", handleCode); 25 | 26 | function handleCode(e) { 27 | e.preventDefault(); 28 | let link = codeInputEle.value; 29 | if (!link.startsWith("https://") && !link.startsWith("http://")) { 30 | link = "https://" + link; 31 | } 32 | codeResult.value = URL + "#go/" + code(link); 33 | } 34 | 35 | if (URL.includes("#go")) { 36 | const SUS_URL = decodeURIComponent(URL.split("go/")[1]); 37 | const finalLink = decode(SUS_URL); 38 | 39 | const redirectUrlEle = document.querySelector("#redirectURL"); 40 | redirectUrlEle.href = finalLink; 41 | redirectUrlEle.textContent = finalLink; 42 | 43 | document.querySelector("#redirectBtn").href = finalLink; 44 | 45 | document.querySelector("#redirect-area").classList.remove("hidden"); 46 | 47 | const redirectWaitTime = 6; 48 | const countdownTimerEle = document.querySelector("#countdownTimer"); 49 | countdownTimerEle.textContent = redirectWaitTime; 50 | setInterval(() => { 51 | if (countdownTimerEle.textContent <= 0) return; 52 | countdownTimerEle.textContent = Number(countdownTimerEle.textContent) - 1; 53 | }, 1000); 54 | setTimeout(() => (window.location.href = finalLink), redirectWaitTime * 1000); 55 | } else { 56 | document.querySelector("#main-page").classList.remove("hidden"); 57 | } 58 | 59 | function code(link) { 60 | let linkCharCode = []; 61 | let result = []; 62 | Array.from(link).forEach((char) => linkCharCode.push(char.charCodeAt())); 63 | 64 | linkCharCode.forEach((c) => { 65 | const charArr = Array.from(c.toString()); 66 | charArr.forEach((c) => result.push(ee[c] + seperator)); 67 | result.push("𐐗"); 68 | }); 69 | return result.join(""); 70 | } 71 | 72 | function decode(code) { 73 | const arr = code.split(seperator); 74 | const keys = Object.keys(arr); 75 | let temp = []; 76 | let result = ""; 77 | arr.forEach((item) => { 78 | let c = item; 79 | if (c.includes("𐐗")) { 80 | const char = String.fromCharCode(temp.join("")); 81 | result += char; 82 | c = c.replace("𐐗", ""); 83 | temp = []; 84 | } 85 | const charCode = keys.find((key) => ee[key] === c); 86 | temp.push(charCode); 87 | }); 88 | return result; 89 | } 90 | 91 | const copyToClipboard = (str) => { 92 | if (navigator && navigator.clipboard && navigator.clipboard.writeText) 93 | return navigator.clipboard.writeText(str); 94 | return Promise.reject("The Clipboard API is not available."); 95 | }; 96 | 97 | let timeout; 98 | const copyTextBtn = document.querySelector("#copyText"); 99 | copyTextBtn.addEventListener("click", () => { 100 | copyToClipboard(codeResult.value); 101 | copyTextBtn.textContent = "copied"; 102 | 103 | if(timeout) clearTimeout(timeout); 104 | 105 | timeout = setTimeout(() => { 106 | copyTextBtn.textContent = "click to copy"; 107 | }, 1000) 108 | }); 109 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 6 | 7 | 8 |113 | 114 |
115 | 116 |134 | Are you sure you want to visit 135 | {{URL}} ? 136 |
137 |141 | Automatically redirecting in 142 | 6 seconds... 143 |
144 |