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

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +105 -33
app.py CHANGED
@@ -57,6 +57,8 @@ document.addEventListener("DOMContentLoaded", () => {
57
  // Enhanced typing animation for textarea
58
  const txt = document.querySelector("textarea");
59
  if (txt) {
 
 
60
  txt.addEventListener("focus", () => {
61
  txt.style.transition = "all 0.3s ease";
62
  txt.style.transform = "translateY(-2px)";
@@ -77,38 +79,98 @@ document.addEventListener("DOMContentLoaded", () => {
77
  });
78
  }
79
 
80
- // Enhanced button animation
81
- const btn = document.querySelector(".send-btn");
82
- if (btn) {
83
- btn.addEventListener("mouseenter", () => {
84
- btn.style.transform = "scale(1.05) rotate(2deg)";
85
- btn.style.boxShadow = "0 5px 15px rgba(0,0,0,0.3)";
86
- });
87
-
88
- btn.addEventListener("mouseleave", () => {
89
- btn.style.transform = "scale(1) rotate(0)";
90
- btn.style.boxShadow = "0 2px 8px rgba(0,0,0,0.2)";
91
- });
92
-
93
- btn.addEventListener("mousedown", () => {
94
- btn.style.transform = "scale(0.95) rotate(-1deg)";
95
- });
96
-
97
- btn.addEventListener("mouseup", () => {
98
- btn.style.transform = "scale(1.05) rotate(2deg)";
99
- });
100
 
101
- btn.addEventListener("click", () => {
102
- // Ripple effect
103
- const ripple = document.createElement("span");
104
- ripple.classList.add("ripple-effect");
105
- btn.appendChild(ripple);
 
 
 
 
106
 
107
- setTimeout(() => {
108
- ripple.remove();
109
- }, 600);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
110
  });
111
- }
 
 
 
 
 
 
 
112
 
113
  // Add subtle pulse animation to login button
114
  const loginBtn = document.querySelector(".gr-button.gr-login");
@@ -174,15 +236,16 @@ textarea {
174
  color: #fff;
175
  font-size: 16px;
176
  flex: 1;
177
- height: 60px;
178
  box-sizing: border-box;
179
  resize: none;
180
  transition: all 0.3s ease;
181
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
 
182
  }
183
  .send-btn {
184
  border: none;
185
- border-radius: 25px;
186
  background: linear-gradient(145deg, #555, #444);
187
  color: #fff;
188
  width: 60px;
@@ -192,8 +255,7 @@ textarea {
192
  align-items: center;
193
  justify-content: center;
194
  cursor: pointer;
195
- margin-left: 12px;
196
- transition: all 0.3s ease;
197
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
198
  position: relative;
199
  overflow: hidden;
@@ -218,6 +280,7 @@ textarea {
218
  .input-container {
219
  display: flex;
220
  margin-top: 15px;
 
221
  }
222
  .gr-chatbot {
223
  border-radius: 15px;
@@ -250,6 +313,15 @@ textarea {
250
  opacity: 0;
251
  }
252
  }
 
 
 
 
 
 
 
 
 
253
  /* Scrollbar styling */
254
  ::-webkit-scrollbar {
255
  width: 8px;
 
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";
64
  txt.style.transform = "translateY(-2px)";
 
79
  });
80
  }
81
 
82
+ // Move button inside textarea
83
+ setTimeout(() => {
84
+ const btn = document.querySelector(".send-btn");
85
+ const textareaContainer = document.querySelector(".input-container");
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
86
 
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";
99
+ }
100
+ }, 100);
101
+
102
+ // Enhanced button animation
103
+ const addButtonAnimations = () => {
104
+ const btn = document.querySelector(".send-btn");
105
+ if (btn) {
106
+ btn.addEventListener("mouseenter", () => {
107
+ btn.style.transform = "scale(1.05)";
108
+ btn.style.boxShadow = "0 5px 15px rgba(0,0,0,0.3)";
109
+ });
110
+
111
+ btn.addEventListener("mouseleave", () => {
112
+ btn.style.transform = "scale(1)";
113
+ btn.style.boxShadow = "0 2px 8px rgba(0,0,0,0.2)";
114
+ });
115
+
116
+ btn.addEventListener("mousedown", () => {
117
+ btn.style.transform = "scale(0.95)";
118
+ });
119
+
120
+ btn.addEventListener("mouseup", () => {
121
+ btn.style.transform = "scale(1.05)";
122
+ });
123
+
124
+ btn.addEventListener("click", () => {
125
+ // Bounce effect
126
+ btn.style.transition = "transform 0.5s cubic-bezier(0.68, -0.55, 0.27, 1.55)";
127
+ btn.style.transform = "scale(0.9)";
128
+
129
+ setTimeout(() => {
130
+ btn.style.transform = "scale(1)";
131
+ }, 500);
132
+
133
+ // Ripple effect
134
+ const ripple = document.createElement("span");
135
+ ripple.classList.add("ripple-effect");
136
+ btn.appendChild(ripple);
137
+
138
+ setTimeout(() => {
139
+ ripple.remove();
140
+ }, 600);
141
+ });
142
+ }
143
+ };
144
+
145
+ // Add button animations after a short delay
146
+ setTimeout(addButtonAnimations, 200);
147
+
148
+ // Add bounce effect to all buttons
149
+ const addBounceToButtons = () => {
150
+ const allButtons = document.querySelectorAll("button");
151
+ allButtons.forEach(button => {
152
+ // Skip if already has bounce effect
153
+ if (button.hasAttribute("data-bounce-added")) return;
154
+
155
+ button.setAttribute("data-bounce-added", "true");
156
+
157
+ button.addEventListener("click", function() {
158
+ this.style.transition = "transform 0.5s cubic-bezier(0.68, -0.55, 0.27, 1.55)";
159
+ this.style.transform = "scale(0.95)";
160
+
161
+ setTimeout(() => {
162
+ this.style.transform = "scale(1)";
163
+ }, 500);
164
+ });
165
  });
166
+ };
167
+
168
+ // Add bounce to existing buttons
169
+ addBounceToButtons();
170
+
171
+ // Observe for new buttons (like login button)
172
+ const buttonObserver = new MutationObserver(addBounceToButtons);
173
+ buttonObserver.observe(document.body, { childList: true, subtree: true });
174
 
175
  // Add subtle pulse animation to login button
176
  const loginBtn = document.querySelector(".gr-button.gr-login");
 
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;
 
255
  align-items: center;
256
  justify-content: center;
257
  cursor: pointer;
258
+ transition: all 0.3s cubic-bezier(0.68, -0.55, 0.27, 1.55);
 
259
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
260
  position: relative;
261
  overflow: hidden;
 
280
  .input-container {
281
  display: flex;
282
  margin-top: 15px;
283
+ position: relative;
284
  }
285
  .gr-chatbot {
286
  border-radius: 15px;
 
313
  opacity: 0;
314
  }
315
  }
316
+ /* Bounce animation */
317
+ @keyframes bounce {
318
+ 0%, 20%, 50%, 80%, 100% {transform: translateY(0);}
319
+ 40% {transform: translateY(-10px);}
320
+ 60% {transform: translateY(-5px);}
321
+ }
322
+ .bounce {
323
+ animation: bounce 0.8s;
324
+ }
325
  /* Scrollbar styling */
326
  ::-webkit-scrollbar {
327
  width: 8px;