Spaces:
Running
Running
Commit
·
1a0595a
1
Parent(s):
57481b5
Added toast notification feature in index.html for user feedback on copy actions, including styles and animations for improved user experience.
Browse files- index.html +73 -4
index.html
CHANGED
@@ -283,6 +283,50 @@ sagi test sss
|
|
283 |
color: #6366f1;
|
284 |
}
|
285 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
286 |
</style>
|
287 |
<!-- Google tag (gtag.js) -->
|
288 |
<script
|
@@ -2065,11 +2109,35 @@ sagi test sss
|
|
2065 |
function setupShareButtons() {
|
2066 |
const TOOLBOX_LINK = 'https://bit.ly/a-tools';
|
2067 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2068 |
document.querySelectorAll('.share-btn').forEach((btn) => {
|
2069 |
btn.addEventListener('click', async () => {
|
2070 |
const platform = btn.dataset.platform; // facebook | twitter | whatsapp | copy
|
2071 |
const toolUrl = btn.dataset.url; // קישור ישיר לכלי
|
2072 |
-
const title = btn.dataset.title; // שם הכלי
|
2073 |
|
2074 |
/* === טקסט שיתוף אחד לכל הערוצים === */
|
2075 |
const shareMsg =
|
@@ -2080,9 +2148,10 @@ sagi test sss
|
|
2080 |
if (platform === 'copy') {
|
2081 |
try {
|
2082 |
await navigator.clipboard.writeText(shareMsg);
|
2083 |
-
|
2084 |
-
|
2085 |
-
|
|
|
2086 |
return;
|
2087 |
}
|
2088 |
if (platform === 'youtube') {
|
|
|
283 |
color: #6366f1;
|
284 |
}
|
285 |
|
286 |
+
/* Toast Notification Styles */
|
287 |
+
.toast-container {
|
288 |
+
position: fixed;
|
289 |
+
bottom: 20px;
|
290 |
+
right: 20px;
|
291 |
+
z-index: 9999;
|
292 |
+
}
|
293 |
+
|
294 |
+
.toast {
|
295 |
+
background: rgba(0, 0, 0, 0.8);
|
296 |
+
color: white;
|
297 |
+
padding: 12px 24px;
|
298 |
+
border-radius: 8px;
|
299 |
+
margin-top: 10px;
|
300 |
+
display: flex;
|
301 |
+
align-items: center;
|
302 |
+
gap: 8px;
|
303 |
+
animation: slideIn 0.3s ease-out, fadeOut 0.3s ease-out 2.7s;
|
304 |
+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
|
305 |
+
}
|
306 |
+
|
307 |
+
.toast i {
|
308 |
+
color: #4ade80;
|
309 |
+
}
|
310 |
+
|
311 |
+
@keyframes slideIn {
|
312 |
+
from {
|
313 |
+
transform: translateX(100%);
|
314 |
+
opacity: 0;
|
315 |
+
}
|
316 |
+
to {
|
317 |
+
transform: translateX(0);
|
318 |
+
opacity: 1;
|
319 |
+
}
|
320 |
+
}
|
321 |
+
|
322 |
+
@keyframes fadeOut {
|
323 |
+
from {
|
324 |
+
opacity: 1;
|
325 |
+
}
|
326 |
+
to {
|
327 |
+
opacity: 0;
|
328 |
+
}
|
329 |
+
}
|
330 |
</style>
|
331 |
<!-- Google tag (gtag.js) -->
|
332 |
<script
|
|
|
2109 |
function setupShareButtons() {
|
2110 |
const TOOLBOX_LINK = 'https://bit.ly/a-tools';
|
2111 |
|
2112 |
+
// Create toast container if it doesn't exist
|
2113 |
+
if (!document.querySelector('.toast-container')) {
|
2114 |
+
const toastContainer = document.createElement('div');
|
2115 |
+
toastContainer.className = 'toast-container';
|
2116 |
+
document.body.appendChild(toastContainer);
|
2117 |
+
}
|
2118 |
+
|
2119 |
+
// Function to show toast
|
2120 |
+
function showToast(message) {
|
2121 |
+
const toastContainer = document.querySelector('.toast-container');
|
2122 |
+
const toast = document.createElement('div');
|
2123 |
+
toast.className = 'toast';
|
2124 |
+
toast.innerHTML = `
|
2125 |
+
<i class="fas fa-check-circle"></i>
|
2126 |
+
<span>${message}</span>
|
2127 |
+
`;
|
2128 |
+
toastContainer.appendChild(toast);
|
2129 |
+
|
2130 |
+
// Remove toast after animation
|
2131 |
+
setTimeout(() => {
|
2132 |
+
toast.remove();
|
2133 |
+
}, 3000);
|
2134 |
+
}
|
2135 |
+
|
2136 |
document.querySelectorAll('.share-btn').forEach((btn) => {
|
2137 |
btn.addEventListener('click', async () => {
|
2138 |
const platform = btn.dataset.platform; // facebook | twitter | whatsapp | copy
|
2139 |
const toolUrl = btn.dataset.url; // קישור ישיר לכלי
|
2140 |
+
const title = btn.dataset.title || 'כלי AI'; // שם הכלי עם ברירת מחדל
|
2141 |
|
2142 |
/* === טקסט שיתוף אחד לכל הערוצים === */
|
2143 |
const shareMsg =
|
|
|
2148 |
if (platform === 'copy') {
|
2149 |
try {
|
2150 |
await navigator.clipboard.writeText(shareMsg);
|
2151 |
+
showToast('הטקסט הועתק בהצלחה! 📋');
|
2152 |
+
} catch {
|
2153 |
+
alert('לא הצלחנו להעתיק – נסה ידנית');
|
2154 |
+
}
|
2155 |
return;
|
2156 |
}
|
2157 |
if (platform === 'youtube') {
|