TenPoisk commited on
Commit ·
7328589
1
Parent(s): b6191f7
Rename index.html to URLcut.html
Browse filesFiles changed (2)
- URLcut.htmlAdded+49
- index.htmlDeleted-19
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849<!DOCTYPE html><html><head> <title>CofURL.cut</title> <p></p></head><body> <h1>• CofURLcut</h1> <label for="long-url">• Enter a long link:</label> <p></p> <input type="text" id="long-url" placeholder="https://internet.com"> <p></p> <button id="shorten-button">Shorten</button> <br> <p></p> <label for="short-url">• Short link:</label> <p></p> <input type="text" id="short-url" readonly> <p></p> <script> document.getElementById("shorten-button").addEventListener("click", function() { var longUrl = document.getElementById("long-url").value;
// Выполнение запроса к API Bit.ly для сокращения ссылки fetch("https://api-ssl.bitly.com/v4/shorten", { method: "POST", headers: { "Content-Type": "application/json", "Authorization": "326c6f40970f20b2e71669323f7849575789630b" }, body: JSON.stringify({ long_url: longUrl }) }) .then(response => response.json()) .then(data => { var shortUrl = data.link; document.getElementById("short-url").value = shortUrl; }) .catch(error => { console.error(error); document.getElementById("short-url").value = "Ошибка при сокращении ссылки."; }); }); </script> <p></p> • Link shortener</body></html>12345678910111213141516171819<!DOCTYPE html><html> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width" /> <title>My static Space</title> <link rel="stylesheet" href="style.css" /> </head> <body> <div class="card"> <h1>Welcome to your static Space!</h1> <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p> <p> Also don't forget to check the <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>. </p> </div> </body></html>URLcut.htmlAdded+49
index.htmlDeleted-19