|
39 | 39 | font-size: 14px; |
40 | 40 | ">Thanks for your feedback</div> |
41 | 41 |
|
| 42 | +<div id="feedback-submit-notification" style=" |
| 43 | +display: none; |
| 44 | +margin-top: 10px; |
| 45 | +color: var(--md-typeset-a-color); |
| 46 | +font-weight: 500; |
| 47 | +font-size: 14px; |
| 48 | +">Thank you! The feedback has been submitted.</div> |
| 49 | + |
42 | 50 | <div id="feedback-form" style=" |
43 | 51 | display: none; |
44 | 52 | margin-top: 12px; |
|
52 | 60 | box-sizing: border-box; |
53 | 61 | transition: all 0.2s ease-out; |
54 | 62 | "> |
55 | | - <button id="close-feedback" title="Close" style=" |
56 | | - position: absolute; |
57 | | - top: 8px; |
58 | | - right: 8px; |
59 | | - background: transparent; |
60 | | - border: none; |
61 | | - font-size: 20px; |
62 | | - font-weight: bold; |
63 | | - cursor: pointer; |
64 | | - color: var(--md-default-fg-color--light); |
65 | | - line-height: 1; |
66 | | - ">×</button> |
67 | | - |
68 | | - <div style="margin-bottom: 10px; font-size: 15px;"> |
69 | | - Was this page helpful? |
70 | | - </div> |
| 63 | +<button id="close-feedback" title="Close" style=" |
| 64 | +position: absolute; |
| 65 | +top: -10px; |
| 66 | +right: -10px; |
| 67 | +background: var(--md-default-bg-color); |
| 68 | +border: 0.05rem solid var(--md-default-fg-color--lightest); |
| 69 | +border-radius: 50%; |
| 70 | +width: 24px; |
| 71 | +height: 24px; |
| 72 | +font-size: 18px; |
| 73 | +font-weight: bold; |
| 74 | +cursor: pointer; |
| 75 | +color: var(--md-default-fg-color--light); |
| 76 | +line-height: 1; |
| 77 | +display: flex; |
| 78 | +align-items: center; |
| 79 | +justify-content: center; |
| 80 | +box-shadow: 0 1px 3px rgba(0,0,0,0.2); |
| 81 | +"> |
| 82 | +× |
| 83 | +</button> |
71 | 84 |
|
72 | 85 | <textarea id="feedback-text" rows="3" placeholder="Write your feedback here..." style=" |
73 | 86 | width: 100%; |
|
187 | 200 | const statusDiv = document.getElementById("feedback-status"); |
188 | 201 | const closeButton = document.getElementById("close-feedback"); |
189 | 202 | const notification = document.getElementById("feedback-notification"); |
| 203 | + const submitNotification = document.getElementById("feedback-submit-notification"); |
190 | 204 |
|
191 | 205 | if (!stars.length || !feedbackForm) return; |
192 | 206 |
|
|
237 | 251 | body: formData |
238 | 252 | }).then(() => { |
239 | 253 | statusDiv.style.color = ""; |
240 | | - statusDiv.textContent = "Thanks for your feedback!"; |
| 254 | + statusDiv.textContent = "Thanks for rating this page!"; |
241 | 255 | feedbackTextarea.value = ""; |
242 | 256 | emailInput.value = ""; |
243 | 257 | feedbackForm.style.display = "none"; |
|
248 | 262 | s.classList.remove("active"); |
249 | 263 | s.classList.remove("hovered"); |
250 | 264 | }); |
| 265 | + |
| 266 | + // ✅ Show post-submit thank-you notification |
| 267 | + submitNotification.style.display = "block"; |
| 268 | + clearTimeout(notificationTimeout); |
| 269 | + notificationTimeout = setTimeout(() => { |
| 270 | + submitNotification.style.display = "none"; |
| 271 | + }, 4000); |
251 | 272 | }).catch(() => { |
252 | 273 | statusDiv.style.color = ""; |
253 | 274 | statusDiv.textContent = "Error sending feedback."; |
|
296 | 317 | }); |
297 | 318 |
|
298 | 319 | sendRatingOnly(rating); |
299 | | - showNotification("Thanks for your feedback"); |
| 320 | + showNotification("Thanks for rating this page!"); |
300 | 321 | feedbackForm.style.display = "block"; |
301 | 322 | statusDiv.textContent = ""; |
302 | 323 | }); |
|
0 commit comments