Spaces:
Running
Running
File size: 5,060 Bytes
4c11f5a |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 |
<!DOCTYPE html>
<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>
|