Spaces:
Running
Running
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>My Website</title> | |
| <link href="https://fonts.googleapis.com/css2?family=Montserrat&display=swap" rel="stylesheet"> | |
| </head> | |
| <body> | |
| <style> | |
| body { | |
| font-family: 'Montserrat', sans-serif; | |
| background-color: #0a0f14; | |
| color: #fff; | |
| } | |
| input, button { | |
| font-family: 'Montserrat', sans-serif; | |
| } | |
| .shareVideo { | |
| width: 500px; | |
| padding: 20px; | |
| background-color: #0d2233; | |
| color: #fff; | |
| border-radius: 12px; | |
| box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); | |
| } | |
| .shareVideoHeader { | |
| font-size: 1.5rem; | |
| font-weight: bold; | |
| margin-bottom: 15px; | |
| } | |
| .shareVideoContent { | |
| display: flex; | |
| flex-direction: column; | |
| gap: 20px; | |
| } | |
| .shareVideoActions { | |
| display: flex; | |
| justify-content: space-between; | |
| align-items: center; | |
| } | |
| .urlSection { | |
| display: flex; | |
| align-items: center; | |
| background-color: #0a1e2b; | |
| padding: 10px; | |
| border-radius: 8px; | |
| } | |
| .urlSection input { | |
| width: 100%; | |
| padding: 8px; | |
| font-size: 1rem; | |
| color: #fff; | |
| background-color: transparent; | |
| border: none; | |
| outline: none; | |
| } | |
| .urlSection input::placeholder { | |
| color: #88a0b3; | |
| } | |
| .urlSection button { | |
| padding: 8px 16px; | |
| margin-left: 10px; | |
| color: #fff; | |
| border: none; | |
| border-radius: 8px; | |
| cursor: pointer; | |
| transition: background-color 0.3s ease; | |
| } | |
| .urlSection button:hover { | |
| background-color: #0073e6; | |
| } | |
| .shareOptions { | |
| display: flex; | |
| gap: 15px; | |
| } | |
| .shareOption { | |
| background-color: #1b2f40; | |
| padding: 10px 15px; | |
| border-radius: 8px; | |
| cursor: pointer; | |
| transition: background-color 0.3s ease; | |
| } | |
| .shareOption:hover { | |
| background-color: #233a4e; | |
| } | |
| .shareOption img { | |
| width: 24px; | |
| height: 24px; | |
| margin-right: 10px; | |
| } | |
| .shareOption span { | |
| font-size: 1rem; | |
| color: #fff; | |
| } | |
| .copyButton { | |
| background-color: rgb(0, 72, 85); | |
| } | |
| </style> | |
| <div class="shareVideo"> | |
| <div class="shareVideoHeader">Share this video!</div> | |
| <div class="shareVideoContent"> | |
| <!-- URL Copy Section --> | |
| <div class="urlSection"> | |
| <input id="urlInput" type="text" readonly /> | |
| <button onclick="copyURL()" class="copyButton">Copy</button> | |
| </div> | |
| </div> | |
| <p id="message" class="message"></p> | |
| </div> | |
| <script> | |
| // Function to get the current page URL and set it as the input value | |
| const getCurrentURL = () => { | |
| const currentURL = window.location.href; | |
| document.getElementById("urlInput").value = currentURL; | |
| }; | |
| // Call the function to set the input value | |
| getCurrentURL(); | |
| // Function to copy the input value to the clipboard | |
| const copyURL = async () => { | |
| try { | |
| await navigator.clipboard.writeText(document.getElementById("urlInput").value); | |
| } catch (error) { | |
| console.log("Error copying URL:", error); | |
| } | |
| const message = document.getElementById('message'); | |
| message.textContent = "URL copied to clipboard!"; | |
| message.className = "message"; | |
| message.classList.remove("fade-out"); // Remove any existing fade-out class | |
| message.classList.remove("fade-in"); // Remove any existing fade-in class | |
| // Add fade-in class if needed | |
| message.classList.add("fade-in"); | |
| message.style.display = 'block'; // show the message | |
| // Add fade-out class to trigger transition | |
| setTimeout(() => { | |
| message.classList.add("fade-out"); | |
| }, 0); // wait 0 milliseconds before adding fade-out class | |
| // Remove the message after 4 seconds | |
| setTimeout(() => { | |
| message.style.display = 'none'; // hide the message | |
| }, 3000); | |
| }; | |
| </script> | |
| <style> </style> | |
| </div> | |
| </body> | |
| </html> | |