Salt40404 commited on
Commit
c4b9e95
·
verified ·
1 Parent(s): a93861b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +98 -7
app.py CHANGED
@@ -162,8 +162,9 @@ document.addEventListener("DOMContentLoaded", () => {
162
  // Add button animations after a short delay
163
  setTimeout(addButtonAnimations, 200);
164
 
165
- // Add bounce effect to all buttons
166
- const addBounceToButtons = () => {
 
167
  const allButtons = document.querySelectorAll("button");
168
  allButtons.forEach(button => {
169
  // Skip if already has bounce effect
@@ -180,14 +181,93 @@ document.addEventListener("DOMContentLoaded", () => {
180
  }, 500);
181
  });
182
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
183
  };
184
 
185
- // Add bounce to existing buttons
186
- addBounceToButtons();
187
 
188
- // Observe for new buttons (like login button)
189
- const buttonObserver = new MutationObserver(addBounceToButtons);
190
- buttonObserver.observe(document.body, { childList: true, subtree: true });
191
 
192
  // Add subtle pulse animation to login button
193
  const loginBtn = document.querySelector(".gr-button.gr-login");
@@ -219,6 +299,10 @@ body {
219
  background: linear-gradient(145deg, #0f0f0f, #1a1a1a);
220
  box-shadow: 0 10px 30px rgba(0,0,0,0.4);
221
  overflow: hidden;
 
 
 
 
222
  }
223
  .chat-message {
224
  border-radius: 20px;
@@ -229,6 +313,7 @@ body {
229
  opacity: 0;
230
  transition: all 0.3s ease;
231
  box-shadow: 0 4px 10px rgba(0,0,0,0.15);
 
232
  }
233
  .chat-message.user {
234
  background: linear-gradient(145deg, #252525, #1f1f1f);
@@ -252,6 +337,7 @@ body {
252
  margin: 20px 0;
253
  display: flex;
254
  justify-content: center;
 
255
  }
256
  .startup-content {
257
  display: flex;
@@ -261,6 +347,7 @@ body {
261
  border-radius: 20px;
262
  box-shadow: 0 4px 15px rgba(0,0,0,0.2);
263
  max-width: 80%;
 
264
  }
265
  .startup-icon {
266
  font-size: 32px;
@@ -302,6 +389,7 @@ textarea {
302
  transition: all 0.3s ease;
303
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
304
  width: 100%;
 
305
  }
306
  .send-btn {
307
  border: none;
@@ -332,6 +420,7 @@ textarea {
332
  padding: 14px 24px;
333
  transition: all 0.3s ease !important;
334
  border: none !important;
 
335
  }
336
  .gr-button.gr-login:hover {
337
  background: linear-gradient(145deg, #444, #333) !important;
@@ -349,6 +438,8 @@ textarea {
349
  padding: 15px;
350
  box-shadow: inset 0 2px 10px rgba(0,0,0,0.2);
351
  min-height: 400px;
 
 
352
  }
353
  .gr-box {
354
  border-radius: 15px;
 
162
  // Add button animations after a short delay
163
  setTimeout(addButtonAnimations, 200);
164
 
165
+ // Add bounce effect to all buttons and interactive elements
166
+ const addBounceToElements = () => {
167
+ // All buttons
168
  const allButtons = document.querySelectorAll("button");
169
  allButtons.forEach(button => {
170
  // Skip if already has bounce effect
 
181
  }, 500);
182
  });
183
  });
184
+
185
+ // Chat messages
186
+ const chatMessages = document.querySelectorAll(".chat-message");
187
+ chatMessages.forEach(message => {
188
+ if (message.hasAttribute("data-bounce-added")) return;
189
+
190
+ message.setAttribute("data-bounce-added", "true");
191
+
192
+ message.addEventListener("click", function() {
193
+ this.style.transition = "transform 0.5s cubic-bezier(0.68, -0.55, 0.27, 1.55)";
194
+ this.style.transform = "scale(0.98)";
195
+
196
+ setTimeout(() => {
197
+ this.style.transform = "scale(1)";
198
+ }, 500);
199
+ });
200
+ });
201
+
202
+ // Textarea
203
+ const textareas = document.querySelectorAll("textarea");
204
+ textareas.forEach(textarea => {
205
+ if (textarea.hasAttribute("data-bounce-added")) return;
206
+
207
+ textarea.setAttribute("data-bounce-added", "true");
208
+
209
+ textarea.addEventListener("click", function() {
210
+ this.style.transition = "transform 0.3s cubic-bezier(0.68, -0.55, 0.27, 1.55)";
211
+ this.style.transform = "scale(0.99)";
212
+
213
+ setTimeout(() => {
214
+ this.style.transform = "scale(1)";
215
+ }, 300);
216
+ });
217
+ });
218
+
219
+ // Login button
220
+ const loginBtn = document.querySelector(".gr-button.gr-login");
221
+ if (loginBtn && !loginBtn.hasAttribute("data-bounce-added")) {
222
+ loginBtn.setAttribute("data-bounce-added", "true");
223
+
224
+ loginBtn.addEventListener("click", function() {
225
+ this.style.transition = "transform 0.5s cubic-bezier(0.68, -0.55, 0.27, 1.55)";
226
+ this.style.transform = "scale(0.95)";
227
+
228
+ setTimeout(() => {
229
+ this.style.transform = "scale(1)";
230
+ }, 500);
231
+ });
232
+ }
233
+
234
+ // Startup message
235
+ const startupMsg = document.querySelector(".startup-message");
236
+ if (startupMsg && !startupMsg.hasAttribute("data-bounce-added")) {
237
+ startupMsg.setAttribute("data-bounce-added", "true");
238
+
239
+ startupMsg.addEventListener("click", function() {
240
+ this.style.transition = "transform 0.5s cubic-bezier(0.68, -0.55, 0.27, 1.55)";
241
+ this.style.transform = "scale(0.98)";
242
+
243
+ setTimeout(() => {
244
+ this.style.transform = "scale(1)";
245
+ }, 500);
246
+ });
247
+ }
248
+
249
+ // Chatbot container
250
+ const chatbotContainer = document.querySelector(".gr-chatbot");
251
+ if (chatbotContainer && !chatbotContainer.hasAttribute("data-bounce-added")) {
252
+ chatbotContainer.setAttribute("data-bounce-added", "true");
253
+
254
+ chatbotContainer.addEventListener("click", function() {
255
+ this.style.transition = "transform 0.5s cubic-bezier(0.68, -0.55, 0.27, 1.55)";
256
+ this.style.transform = "scale(0.995)";
257
+
258
+ setTimeout(() => {
259
+ this.style.transform = "scale(1)";
260
+ }, 500);
261
+ });
262
+ }
263
  };
264
 
265
+ // Add bounce to existing elements
266
+ addBounceToElements();
267
 
268
+ // Observe for new elements
269
+ const elementObserver = new MutationObserver(addBounceToElements);
270
+ elementObserver.observe(document.body, { childList: true, subtree: true });
271
 
272
  // Add subtle pulse animation to login button
273
  const loginBtn = document.querySelector(".gr-button.gr-login");
 
299
  background: linear-gradient(145deg, #0f0f0f, #1a1a1a);
300
  box-shadow: 0 10px 30px rgba(0,0,0,0.4);
301
  overflow: hidden;
302
+ transition: transform 0.3s ease;
303
+ }
304
+ .gradio-container:active {
305
+ transform: scale(0.995);
306
  }
307
  .chat-message {
308
  border-radius: 20px;
 
313
  opacity: 0;
314
  transition: all 0.3s ease;
315
  box-shadow: 0 4px 10px rgba(0,0,0,0.15);
316
+ cursor: pointer;
317
  }
318
  .chat-message.user {
319
  background: linear-gradient(145deg, #252525, #1f1f1f);
 
337
  margin: 20px 0;
338
  display: flex;
339
  justify-content: center;
340
+ cursor: pointer;
341
  }
342
  .startup-content {
343
  display: flex;
 
347
  border-radius: 20px;
348
  box-shadow: 0 4px 15px rgba(0,0,0,0.2);
349
  max-width: 80%;
350
+ transition: transform 0.3s ease;
351
  }
352
  .startup-icon {
353
  font-size: 32px;
 
389
  transition: all 0.3s ease;
390
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
391
  width: 100%;
392
+ cursor: pointer;
393
  }
394
  .send-btn {
395
  border: none;
 
420
  padding: 14px 24px;
421
  transition: all 0.3s ease !important;
422
  border: none !important;
423
+ cursor: pointer !important;
424
  }
425
  .gr-button.gr-login:hover {
426
  background: linear-gradient(145deg, #444, #333) !important;
 
438
  padding: 15px;
439
  box-shadow: inset 0 2px 10px rgba(0,0,0,0.2);
440
  min-height: 400px;
441
+ cursor: pointer;
442
+ transition: transform 0.3s ease;
443
  }
444
  .gr-box {
445
  border-radius: 15px;