Update AB/index.html
Browse files- AB/index.html +218 -208
AB/index.html
CHANGED
|
@@ -3,206 +3,195 @@
|
|
| 3 |
<head>
|
| 4 |
<meta charset="UTF-8">
|
| 5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
-
<title>FastAPI App</title>
|
| 7 |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.13.11/katex.min.css">
|
| 8 |
<link href="https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@100&display=swap" rel="stylesheet">
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
}
|
| 16 |
-
body {
|
| 17 |
-
background-color: #000000;
|
| 18 |
-
margin: 0;
|
| 19 |
-
}
|
| 20 |
-
#cont {
|
| 21 |
-
background-color: #030303;
|
| 22 |
-
padding: 0px;
|
| 23 |
-
border-radius: 12px;
|
| 24 |
-
box-shadow: 8px 8px 16px #050505, -8px -8px 16px #080808;
|
| 25 |
-
display: flex;
|
| 26 |
-
align-items: center;
|
| 27 |
-
border: 2px solid rgb(247, 6, 187);
|
| 28 |
-
}
|
| 29 |
-
#prompt {
|
| 30 |
-
flex-grow: 1;
|
| 31 |
-
padding: 10px;
|
| 32 |
-
margin: 10px;
|
| 33 |
-
background: transparent;
|
| 34 |
-
border: none;
|
| 35 |
-
border-radius: 8px;
|
| 36 |
-
box-shadow: linear-gradient(145deg, rgb(0, 249, 153), #ff002b);
|
| 37 |
-
color: #fff;
|
| 38 |
-
outline: none;
|
| 39 |
-
}
|
| 40 |
-
#cont button {
|
| 41 |
-
padding: 2.5vh 4.6vh;
|
| 42 |
-
margin: 1vh;
|
| 43 |
-
background: linear-gradient(145deg, rgb(0, 149, 249), #ff0095, rgb(255, 0, 43));
|
| 44 |
-
border: none;
|
| 45 |
-
border-radius: 8px;
|
| 46 |
-
color: #fff;
|
| 47 |
-
cursor: pointer;
|
| 48 |
-
}
|
| 49 |
-
#cont button:hover {
|
| 50 |
-
background: linear-gradient(145deg, #00ffab, #4e00f9, rgb(255, 0, 43));
|
| 51 |
-
}
|
| 52 |
-
.container {
|
| 53 |
-
text-align: center;
|
| 54 |
-
}
|
| 55 |
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
margin: 10px;
|
| 65 |
-
background: transparent;
|
| 66 |
-
border: none;
|
| 67 |
-
border-radius: 8px;
|
| 68 |
-
box-shadow: linear-gradient(145deg, rgb(0, 249, 153), #ff002b);
|
| 69 |
-
color: #fff;
|
| 70 |
-
outline: none;
|
| 71 |
}
|
| 72 |
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 81 |
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
border: 2px solid #ffffff; /* Set the border color to white */
|
| 86 |
-
border-radius: 10px;
|
| 87 |
-
overflow: hidden; /* Ensure the image does not overflow the box */
|
| 88 |
-
position: relative; /* Positioning context for absolute positioning of image */
|
| 89 |
}
|
| 90 |
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
border-top: 3px solid #ffffff;
|
| 95 |
-
width: 20px;
|
| 96 |
-
height: 20px;
|
| 97 |
-
animation: spin 2s linear infinite;
|
| 98 |
-
position: absolute;
|
| 99 |
-
top: 50%;
|
| 100 |
-
left: 50%;
|
| 101 |
-
transform: translate(-50%, -50%);
|
| 102 |
}
|
| 103 |
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 107 |
}
|
| 108 |
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
left: 0;
|
| 113 |
-
width: 100%;
|
| 114 |
-
height: 100%;
|
| 115 |
-
object-fit: cover; /* Maintain aspect ratio and cover the entire box */
|
| 116 |
-
}
|
| 117 |
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
background: transparent;
|
| 125 |
-
border: none;
|
| 126 |
-
border-radius: 8px;
|
| 127 |
-
box-shadow: linear-gradient(145deg, rgb(0, 249, 153), #ff002b);
|
| 128 |
-
color: #fff;
|
| 129 |
-
outline: none;
|
| 130 |
-
}
|
| 131 |
-
#image-box {
|
| 132 |
-
border: 2px solid blue;
|
| 133 |
-
width: 330px;
|
| 134 |
-
height: 330px;
|
| 135 |
-
display: flex;
|
| 136 |
-
flex-direction: column;
|
| 137 |
-
overflow-y: scroll;
|
| 138 |
-
margin: auto;
|
| 139 |
-
margin-top: 30px;
|
| 140 |
-
padding-bottom: 7px;
|
| 141 |
-
gap: 14px;
|
| 142 |
-
background: linear-gradient(black, black) padding-box,
|
| 143 |
-
linear-gradient(to right, red, blue) border-box;
|
| 144 |
-
border-radius: 20px;
|
| 145 |
-
border: 2.5px solid transparent;
|
| 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 |
-
|
| 177 |
-
|
| 178 |
-
|
| 179 |
-
|
| 180 |
-
|
| 181 |
-
|
| 182 |
-
|
| 183 |
-
|
| 184 |
-
|
| 185 |
-
|
| 186 |
-
|
| 187 |
-
|
| 188 |
-
|
| 189 |
-
|
| 190 |
-
|
| 191 |
-
|
| 192 |
-
|
| 193 |
-
|
| 194 |
-
|
| 195 |
-
|
| 196 |
-
|
| 197 |
-
|
| 198 |
-
|
| 199 |
-
|
| 200 |
-
|
| 201 |
-
|
| 202 |
-
|
| 203 |
-
|
| 204 |
-
|
| 205 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 206 |
</head>
|
| 207 |
<body>
|
| 208 |
<div class="container">
|
|
@@ -210,56 +199,77 @@
|
|
| 210 |
|
| 211 |
<div id="cont">
|
| 212 |
<div>
|
| 213 |
-
<
|
| 214 |
<input type="text" id="prompt" name="prompt">
|
| 215 |
</div>
|
| 216 |
<br>
|
| 217 |
<div>
|
| 218 |
<button onclick="generatePrompts()">Generate Prompts</button>
|
| 219 |
-
|
| 220 |
</div>
|
| 221 |
</div>
|
| 222 |
<br>
|
| 223 |
-
<div id="
|
| 224 |
-
|
| 225 |
-
|
| 226 |
-
|
| 227 |
-
|
| 228 |
-
<br>
|
| 229 |
-
<div>
|
| 230 |
-
<button onclick="sendInputs()">generate image </button>
|
| 231 |
-
<div id="sendSpinner" class="spinner" style="display: none;"></div>
|
| 232 |
-
</div>
|
| 233 |
-
</div>
|
| 234 |
-
<br>
|
| 235 |
-
|
| 236 |
-
</div>
|
| 237 |
|
| 238 |
<script>
|
| 239 |
-
function showSpinner(
|
| 240 |
-
document.getElementById(
|
| 241 |
}
|
| 242 |
|
| 243 |
-
function hideSpinner(
|
| 244 |
-
document.getElementById(
|
| 245 |
}
|
| 246 |
|
| 247 |
function generatePrompts() {
|
| 248 |
-
|
|
|
|
| 249 |
const prompt = document.getElementById("prompt").value;
|
| 250 |
fetch(`/generate_prompts?prompt_text=${encodeURIComponent(prompt)}`)
|
| 251 |
.then(response => response.text())
|
| 252 |
.then(data => {
|
| 253 |
-
document.getElementById("
|
| 254 |
-
hideSpinner('
|
| 255 |
})
|
| 256 |
.catch(error => {
|
| 257 |
console.error('Error:', error);
|
| 258 |
-
hideSpinner('
|
|
|
|
| 259 |
});
|
| 260 |
}
|
| 261 |
|
|
|
|
|
|
|
|
|
|
| 262 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 263 |
|
| 264 |
|
| 265 |
</script>
|
|
|
|
| 3 |
<head>
|
| 4 |
<meta charset="UTF-8">
|
| 5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
|
| 6 |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.13.11/katex.min.css">
|
| 7 |
<link href="https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@100&display=swap" rel="stylesheet">
|
| 8 |
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
|
| 9 |
+
<style>
|
| 10 |
+
body {
|
| 11 |
+
background-color: #121212;
|
| 12 |
+
color: #FFFFFF;
|
| 13 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
|
| 15 |
+
label[for="prompt"] {
|
| 16 |
+
padding: 10px 20px;
|
| 17 |
+
|
| 18 |
+
color: white;
|
| 19 |
+
border-radius: 5px;
|
| 20 |
+
cursor: pointer;
|
| 21 |
+
display: block;
|
| 22 |
+
margin: 10 auto;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
}
|
| 24 |
|
| 25 |
+
/* Style for the swap button */
|
| 26 |
+
button {
|
| 27 |
+
background-image: linear-gradient(
|
| 28 |
+
45deg,
|
| 29 |
+
hsl(240deg 75% 29%) 0%,
|
| 30 |
+
hsl(254deg 78% 28%) 6%,
|
| 31 |
+
hsl(264deg 82% 27%) 13%,
|
| 32 |
+
hsl(272deg 87% 26%) 19%,
|
| 33 |
+
hsl(278deg 93% 25%) 25%,
|
| 34 |
+
hsl(284deg 98% 24%) 31%,
|
| 35 |
+
hsl(289deg 100% 23%) 37%,
|
| 36 |
+
hsl(294deg 100% 23%) 44%,
|
| 37 |
+
hsl(299deg 100% 22%) 50%,
|
| 38 |
+
hsl(303deg 100% 23%) 56%,
|
| 39 |
+
hsl(307deg 100% 24%) 63%,
|
| 40 |
+
hsl(311deg 100% 25%) 69%,
|
| 41 |
+
hsl(313deg 100% 26%) 75%,
|
| 42 |
+
hsl(316deg 95% 28%) 81%,
|
| 43 |
+
hsl(320deg 88% 30%) 87%,
|
| 44 |
+
hsl(323deg 81% 32%) 94%,
|
| 45 |
+
hsl(326deg 75% 33%) 100%
|
| 46 |
+
);
|
| 47 |
+
border: none;
|
| 48 |
+
color: white;
|
| 49 |
+
padding: 10px 20px;
|
| 50 |
+
text-align: center;
|
| 51 |
+
text-decoration: none;
|
| 52 |
+
display: inline-block;
|
| 53 |
+
font-size: 16px;
|
| 54 |
+
margin-top: 10px;
|
| 55 |
+
cursor: pointer;
|
| 56 |
+
border-radius: 5px;
|
| 57 |
+
display: block;
|
| 58 |
+
margin: 0 auto;
|
| 59 |
+
width: 200px;
|
| 60 |
+
}
|
| 61 |
|
| 62 |
+
/* Hover effect for the button */
|
| 63 |
+
button:hover {
|
| 64 |
+
background-color: #45a049;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 65 |
}
|
| 66 |
|
| 67 |
+
/* Style for file input */
|
| 68 |
+
#image {
|
| 69 |
+
display: none; /* Hide the default file input */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 70 |
}
|
| 71 |
|
| 72 |
+
#prompt-label {
|
| 73 |
+
padding: 10px 20px;
|
| 74 |
+
background-color: #f44336;
|
| 75 |
+
color: white;
|
| 76 |
+
border-radius: 5px;
|
| 77 |
+
cursor: pointer;
|
| 78 |
+
display: inline-block;
|
| 79 |
+
margin: 0 auto;
|
| 80 |
}
|
| 81 |
|
| 82 |
+
#image-label input[type="file"] {
|
| 83 |
+
display: none;
|
| 84 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 85 |
|
| 86 |
+
h1 {
|
| 87 |
+
text-align: center;
|
| 88 |
+
margin-bottom: 20px;
|
| 89 |
+
font-family: 'Barlow Condensed';
|
| 90 |
+
color: pink;
|
| 91 |
+
font-size: 40px; /* Adjust the font size as needed */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 92 |
}
|
| 93 |
|
| 94 |
+
h2 {
|
| 95 |
+
font-size: 24px; /* Adjust size as needed */
|
| 96 |
+
font-family: 'Barlow Condensed';
|
| 97 |
+
color: #FFFFFF; /* Text color */
|
| 98 |
+
margin-top: 20px; /* Top margin */
|
| 99 |
+
margin-bottom: 0px; /* Bottom margin */
|
| 100 |
+
Text-align :center;
|
| 101 |
}
|
| 102 |
+
|
| 103 |
+
|
| 104 |
+
|
| 105 |
+
|
| 106 |
+
#estimatedTime {
|
| 107 |
+
display: none;
|
| 108 |
+
text-align: center; /* Center align the text */
|
| 109 |
+
margin-top: 10px; /* Add margin to separate it from the spinner */
|
| 110 |
+
color: white; /* Set text color */
|
| 111 |
+
}
|
| 112 |
+
|
| 113 |
+
#results {
|
| 114 |
+
border: 2px solid blue;
|
| 115 |
+
width: 265px;
|
| 116 |
+
height: 300px;
|
| 117 |
+
display: flex;
|
| 118 |
+
flex-direction: column;
|
| 119 |
+
overflow-y: scroll;
|
| 120 |
+
margin: auto;
|
| 121 |
+
margin-top: 30px;
|
| 122 |
+
padding-bottom: 7px;
|
| 123 |
+
gap: 14px;
|
| 124 |
+
background: linear-gradient(black , black) padding-box,
|
| 125 |
+
linear-gradient(to right, red, blue) border-box;
|
| 126 |
+
border-radius: 20px;
|
| 127 |
+
border: 2.5px solid transparent;
|
| 128 |
+
}
|
| 129 |
+
#prompt {
|
| 130 |
+
border: 2px solid blue;
|
| 131 |
+
width: 265px;
|
| 132 |
+
height: 50px;
|
| 133 |
+
display: flex;
|
| 134 |
+
flex-direction: column;
|
| 135 |
+
overflow-y: scroll;
|
| 136 |
+
margin: auto;
|
| 137 |
+
margin-top: 30px;
|
| 138 |
+
padding-bottom: 7px;
|
| 139 |
+
gap: 14px;
|
| 140 |
+
background: linear-gradient(black , black) padding-box,
|
| 141 |
+
linear-gradient(to right, red, blue) border-box;
|
| 142 |
+
border-radius: 20px;
|
| 143 |
+
border: 2.5px solid transparent;
|
| 144 |
+
color: white;
|
| 145 |
+
}
|
| 146 |
+
|
| 147 |
+
|
| 148 |
+
|
| 149 |
+
#loadingSpinner {
|
| 150 |
+
border: 3px solid rgba(255, 255, 255, 0.3);
|
| 151 |
+
border-radius: 50%;
|
| 152 |
+
border-top: 3px solid #ffffff;
|
| 153 |
+
width: 20px;
|
| 154 |
+
height: 20px;
|
| 155 |
+
animation: spin 2s linear infinite;
|
| 156 |
+
position: relative;
|
| 157 |
+
top: 50%;
|
| 158 |
+
left: 50%;
|
| 159 |
+
transform: translate(-50%, -50%);
|
| 160 |
+
display: none; /* Initially hide the loading spinner */
|
| 161 |
+
}
|
| 162 |
+
|
| 163 |
+
@keyframes spin {
|
| 164 |
+
0% { transform: rotate(0deg); }
|
| 165 |
+
100% { transform: rotate(360deg); }
|
| 166 |
+
}
|
| 167 |
+
#results {
|
| 168 |
+
position: relative; /* Set position to relative */
|
| 169 |
+
/* Your existing styles */
|
| 170 |
+
}
|
| 171 |
+
|
| 172 |
+
#copyIcon {
|
| 173 |
+
font-size: 24px; /* Adjust the font size as needed */
|
| 174 |
+
position: absolute;
|
| 175 |
+
bottom: 10px; /* Adjust the distance from the bottom */
|
| 176 |
+
left: 10px; /* Adjust the distance from the left */
|
| 177 |
+
cursor: pointer;
|
| 178 |
+
z-index: 1;
|
| 179 |
+
color: rgba(255, 255, 255, 0.7); /* Adjust the opacity value */
|
| 180 |
+
}
|
| 181 |
+
#resultContainer {
|
| 182 |
+
/* Include padding and border in the total height */
|
| 183 |
+
}
|
| 184 |
+
|
| 185 |
+
#resultContainer p {
|
| 186 |
+
font-size: 14px; /* Adjust the font size as needed */
|
| 187 |
+
text-align: center; /* Center text horizontally */
|
| 188 |
+
margin: 5px 0; /* Add margin for spacing between paragraphs */
|
| 189 |
+
line-height: 1.5; /* Adjust line height for better readability */
|
| 190 |
+
}
|
| 191 |
+
|
| 192 |
+
|
| 193 |
+
</style>
|
| 194 |
+
|
| 195 |
</head>
|
| 196 |
<body>
|
| 197 |
<div class="container">
|
|
|
|
| 199 |
|
| 200 |
<div id="cont">
|
| 201 |
<div>
|
| 202 |
+
<h2>Enter text:</h2>
|
| 203 |
<input type="text" id="prompt" name="prompt">
|
| 204 |
</div>
|
| 205 |
<br>
|
| 206 |
<div>
|
| 207 |
<button onclick="generatePrompts()">Generate Prompts</button>
|
| 208 |
+
|
| 209 |
</div>
|
| 210 |
</div>
|
| 211 |
<br>
|
| 212 |
+
<div id="results">
|
| 213 |
+
<div id="estimatedTime" style="display: none;">Estimated time: 90s</div>
|
| 214 |
+
<div id="loadingSpinner" style="display: none;"></div>
|
| 215 |
+
<i class="far fa-copy" id="copyIcon" onclick="copyTextToClipboard()"></i>
|
| 216 |
+
<div id="resultContainer">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 217 |
|
| 218 |
<script>
|
| 219 |
+
function showSpinner(loadingSpinner) {
|
| 220 |
+
document.getElementById(loadingSpinner).style.display = 'block';
|
| 221 |
}
|
| 222 |
|
| 223 |
+
function hideSpinner(loadingSpinner) {
|
| 224 |
+
document.getElementById(loadingSpinner).style.display = 'none';
|
| 225 |
}
|
| 226 |
|
| 227 |
function generatePrompts() {
|
| 228 |
+
|
| 229 |
+
showSpinner('loadingSpinner');
|
| 230 |
const prompt = document.getElementById("prompt").value;
|
| 231 |
fetch(`/generate_prompts?prompt_text=${encodeURIComponent(prompt)}`)
|
| 232 |
.then(response => response.text())
|
| 233 |
.then(data => {
|
| 234 |
+
document.getElementById("resultContainer").value = data.trim();
|
| 235 |
+
hideSpinner('loadingSpinner');
|
| 236 |
})
|
| 237 |
.catch(error => {
|
| 238 |
console.error('Error:', error);
|
| 239 |
+
hideSpinner('loadingSpinner');
|
| 240 |
+
document.getElementById('resultContainer').innerHTML = `<p style="color: white ;">Oops! Something went wrong. Please try again later.</p>`;
|
| 241 |
});
|
| 242 |
}
|
| 243 |
|
| 244 |
+
function copyTextToClipboard() {
|
| 245 |
+
const resultContainer = document.getElementById('resultContainer');
|
| 246 |
+
const textToCopy = resultContainer.innerText;
|
| 247 |
|
| 248 |
+
// Create a temporary textarea element to copy the text
|
| 249 |
+
const textarea = document.createElement('textarea');
|
| 250 |
+
textarea.value = textToCopy;
|
| 251 |
+
document.body.appendChild(textarea);
|
| 252 |
+
|
| 253 |
+
// Select the text inside the textarea
|
| 254 |
+
textarea.select();
|
| 255 |
+
textarea.setSelectionRange(0, 99999); // For mobile devices
|
| 256 |
+
|
| 257 |
+
// Copy the selected text
|
| 258 |
+
document.execCommand('copy');
|
| 259 |
+
|
| 260 |
+
// Remove the temporary textarea
|
| 261 |
+
document.body.removeChild(textarea);
|
| 262 |
+
|
| 263 |
+
// Change the copy icon text to "Copied"
|
| 264 |
+
const copyIcon = document.getElementById('copyIcon');
|
| 265 |
+
copyIcon.textContent = ' # Copied' ;
|
| 266 |
+
copyIcon.style.fontSize = '14px';
|
| 267 |
+
// Revert the copy icon back to "Copy" after 1.5 seconds
|
| 268 |
+
setTimeout(() => {
|
| 269 |
+
copyIcon.textContent = '';
|
| 270 |
+
}, 1500);
|
| 271 |
+
}
|
| 272 |
+
|
| 273 |
|
| 274 |
|
| 275 |
</script>
|