Salt40404 commited on
Commit
a57d75e
·
verified ·
1 Parent(s): 10d9656

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +73 -20
app.py CHANGED
@@ -57,7 +57,22 @@ document.addEventListener("DOMContentLoaded", () => {
57
  // Enhanced typing animation for textarea
58
  const txt = document.querySelector("textarea");
59
  if (txt) {
60
- txt.style.paddingRight = "70px"; // Make space for the button
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
61
 
62
  txt.addEventListener("focus", () => {
63
  txt.style.transition = "all 0.3s ease";
@@ -69,14 +84,6 @@ document.addEventListener("DOMContentLoaded", () => {
69
  txt.style.transform = "translateY(0)";
70
  txt.style.boxShadow = "0 2px 8px rgba(0,0,0,0.1)";
71
  });
72
-
73
- txt.addEventListener("input", () => {
74
- txt.style.backgroundColor = "#222";
75
- setTimeout(() => {
76
- txt.style.transition = "background-color 0.5s ease";
77
- txt.style.backgroundColor = "#1a1a1a";
78
- }, 150);
79
- });
80
  }
81
 
82
  // Move button inside textarea
@@ -87,12 +94,12 @@ document.addEventListener("DOMContentLoaded", () => {
87
  if (btn && textareaContainer) {
88
  // Position button inside textarea
89
  btn.style.position = "absolute";
90
- btn.style.right = "10px";
91
- btn.style.bottom = "10px";
92
  btn.style.zIndex = "10";
93
  btn.style.marginLeft = "0";
94
- btn.style.width = "50px";
95
- btn.style.height = "50px";
96
 
97
  // Add container for positioning
98
  textareaContainer.style.position = "relative";
@@ -183,6 +190,36 @@ document.addEventListener("DOMContentLoaded", () => {
183
  }, 50);
184
  }, 3000);
185
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
186
  });
187
  </script>
188
  """
@@ -231,26 +268,28 @@ textarea {
231
  border: none;
232
  outline: none;
233
  border-radius: 25px;
234
- padding: 16px 20px;
 
235
  background-color: #1a1a1a;
236
  color: #fff;
237
  font-size: 16px;
238
  flex: 1;
239
- height: 70px;
 
240
  box-sizing: border-box;
241
  resize: none;
242
- transition: all 0.3s ease;
243
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
244
  width: 100%;
245
  }
246
  .send-btn {
247
  border: none;
248
- border-radius: 20px;
249
  background: linear-gradient(145deg, #555, #444);
250
  color: #fff;
251
- width: 60px;
252
- height: 60px;
253
- font-size: 20px;
254
  display: flex;
255
  align-items: center;
256
  justify-content: center;
@@ -322,6 +361,20 @@ textarea {
322
  .bounce {
323
  animation: bounce 0.8s;
324
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
325
  /* Scrollbar styling */
326
  ::-webkit-scrollbar {
327
  width: 8px;
 
57
  // Enhanced typing animation for textarea
58
  const txt = document.querySelector("textarea");
59
  if (txt) {
60
+ // Add smooth text appearance
61
+ txt.addEventListener("input", function() {
62
+ // Store current cursor position
63
+ const cursorPosition = this.selectionStart;
64
+
65
+ // Add smooth text effect
66
+ this.style.transition = "all 0.2s ease";
67
+ this.style.backgroundColor = "#222";
68
+
69
+ setTimeout(() => {
70
+ this.style.backgroundColor = "#1a1a1a";
71
+
72
+ // Restore cursor position
73
+ this.setSelectionRange(cursorPosition, cursorPosition);
74
+ }, 200);
75
+ });
76
 
77
  txt.addEventListener("focus", () => {
78
  txt.style.transition = "all 0.3s ease";
 
84
  txt.style.transform = "translateY(0)";
85
  txt.style.boxShadow = "0 2px 8px rgba(0,0,0,0.1)";
86
  });
 
 
 
 
 
 
 
 
87
  }
88
 
89
  // Move button inside textarea
 
94
  if (btn && textareaContainer) {
95
  // Position button inside textarea
96
  btn.style.position = "absolute";
97
+ btn.style.right = "8px";
98
+ btn.style.bottom = "8px";
99
  btn.style.zIndex = "10";
100
  btn.style.marginLeft = "0";
101
+ btn.style.width = "44px";
102
+ btn.style.height = "44px";
103
 
104
  // Add container for positioning
105
  textareaContainer.style.position = "relative";
 
190
  }, 50);
191
  }, 3000);
192
  }
193
+
194
+ // Add smooth text appearance effect
195
+ const addSmoothTextEffect = () => {
196
+ const textareas = document.querySelectorAll("textarea");
197
+ textareas.forEach(textarea => {
198
+ if (textarea.hasAttribute("data-smooth-added")) return;
199
+
200
+ textarea.setAttribute("data-smooth-added", "true");
201
+
202
+ textarea.addEventListener("input", function() {
203
+ // Add smooth transition for text color
204
+ this.style.transition = "color 0.2s ease";
205
+
206
+ // Briefly change color for smooth appearance
207
+ const originalColor = this.style.color;
208
+ this.style.color = "#aaa";
209
+
210
+ setTimeout(() => {
211
+ this.style.color = originalColor || "#fff";
212
+ }, 50);
213
+ });
214
+ });
215
+ };
216
+
217
+ // Add smooth text effect
218
+ addSmoothTextEffect();
219
+
220
+ // Observe for new textareas
221
+ const textareaObserver = new MutationObserver(addSmoothTextEffect);
222
+ textareaObserver.observe(document.body, { childList: true, subtree: true });
223
  });
224
  </script>
225
  """
 
268
  border: none;
269
  outline: none;
270
  border-radius: 25px;
271
+ padding: 14px 20px;
272
+ padding-right: 60px; /* Space for button */
273
  background-color: #1a1a1a;
274
  color: #fff;
275
  font-size: 16px;
276
  flex: 1;
277
+ height: 56px; /* Reduced height */
278
+ min-height: 56px; /* Prevent resizing */
279
  box-sizing: border-box;
280
  resize: none;
281
+ transition: all 0.3s ease, color 0.2s ease;
282
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
283
  width: 100%;
284
  }
285
  .send-btn {
286
  border: none;
287
+ border-radius: 18px;
288
  background: linear-gradient(145deg, #555, #444);
289
  color: #fff;
290
+ width: 44px;
291
+ height: 44px;
292
+ font-size: 18px;
293
  display: flex;
294
  align-items: center;
295
  justify-content: center;
 
361
  .bounce {
362
  animation: bounce 0.8s;
363
  }
364
+ /* Smooth text animation */
365
+ @keyframes textAppear {
366
+ from {
367
+ opacity: 0.5;
368
+ transform: translateY(2px);
369
+ }
370
+ to {
371
+ opacity: 1;
372
+ transform: translateY(0);
373
+ }
374
+ }
375
+ .smooth-text {
376
+ animation: textAppear 0.2s ease;
377
+ }
378
  /* Scrollbar styling */
379
  ::-webkit-scrollbar {
380
  width: 8px;