Spaces:
Running
Running
Commit
·
1d35a2a
1
Parent(s):
0b1f7ca
Enhanced share button design and functionality in index.html, introducing responsive styles and a unified layout for sharing options across platforms. Updated sharing logic to ensure valid URLs and improved user experience with consistent messaging.
Browse files- index.html +92 -74
index.html
CHANGED
@@ -145,6 +145,13 @@ sagi test
|
|
145 |
transform: rotate(360deg);
|
146 |
}
|
147 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
148 |
|
149 |
.tech-dots {
|
150 |
position: absolute;
|
@@ -203,6 +210,38 @@ sagi test
|
|
203 |
cursor: pointer;
|
204 |
background-color: #f3f4f6; /* Slightly lighter gray on hover */
|
205 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
206 |
</style>
|
207 |
<!-- Google tag (gtag.js) -->
|
208 |
<script
|
@@ -1889,10 +1928,10 @@ sagi test
|
|
1889 |
});
|
1890 |
// פונקציה להצגת כפתורי שיתוף
|
1891 |
function renderShareButtons(tool) {
|
|
|
|
|
1892 |
const encodedToolName = encodeURIComponent(tool.name);
|
1893 |
-
const encodedDesc = encodeURIComponent(
|
1894 |
-
`בדקו את הכלי ${tool.name} - ${tool.description}`
|
1895 |
-
);
|
1896 |
const encodedUrl = encodeURIComponent(tool.url);
|
1897 |
|
1898 |
// וודא שיש URL תקין לשיתוף
|
@@ -1901,40 +1940,20 @@ sagi test
|
|
1901 |
}
|
1902 |
|
1903 |
return `
|
1904 |
-
|
1905 |
-
|
1906 |
-
|
1907 |
-
|
1908 |
-
|
1909 |
-
|
1910 |
-
|
1911 |
-
<
|
1912 |
-
|
1913 |
-
|
1914 |
-
|
1915 |
-
|
1916 |
-
|
1917 |
-
|
1918 |
-
aria-label="שתף בוואטסאפ">
|
1919 |
-
<i class="fab fa-whatsapp text-sm"></i>
|
1920 |
-
</button>
|
1921 |
-
<button class="share-btn text-blue-500 hover:bg-blue-50 p-1.5 rounded-full transition"
|
1922 |
-
data-platform="twitter"
|
1923 |
-
data-url="${tool.url}"
|
1924 |
-
data-title="${tool.name}"
|
1925 |
-
title="שתף בטוויטר"
|
1926 |
-
aria-label="שתף בטוויטר">
|
1927 |
-
<i class="fab fa-twitter text-sm"></i>
|
1928 |
-
</button>
|
1929 |
-
<button class="share-btn text-gray-700 hover:bg-gray-50 p-1.5 rounded-full transition"
|
1930 |
-
data-platform="copy"
|
1931 |
-
data-url="${tool.url}"
|
1932 |
-
title="העתק קישור"
|
1933 |
-
aria-label="העתק קישור">
|
1934 |
-
<i class="fas fa-link text-sm"></i>
|
1935 |
-
</button>
|
1936 |
-
</div>
|
1937 |
-
`;
|
1938 |
}
|
1939 |
// פונקציה לטיפול בלחיצה על כפתור המועדפים
|
1940 |
function setupFavorites() {
|
@@ -2033,56 +2052,55 @@ sagi test
|
|
2033 |
|
2034 |
// פונקציה לטיפול בכפתורי שיתוף
|
2035 |
function setupShareButtons() {
|
2036 |
-
|
2037 |
-
btn.addEventListener('click', (e) => {
|
2038 |
-
e.preventDefault();
|
2039 |
-
e.stopPropagation();
|
2040 |
|
2041 |
-
|
2042 |
-
|
2043 |
-
const
|
2044 |
-
const
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2045 |
|
2046 |
-
|
|
|
|
|
|
|
2047 |
|
2048 |
switch (platform) {
|
2049 |
-
case 'facebook':
|
2050 |
-
shareUrl = `https://www.facebook.com/sharer/sharer.php?u=${
|
2051 |
-
shareLink
|
2052 |
-
)}"e=${encodeURIComponent(text)}`;
|
2053 |
-
window.open(shareUrl, '_blank', 'width=600,height=400');
|
2054 |
break;
|
2055 |
-
case 'twitter':
|
2056 |
-
shareUrl = `https://twitter.com/intent/tweet?url=${
|
2057 |
-
shareLink
|
2058 |
-
)}&text=${encodeURIComponent(text)}`;
|
2059 |
-
window.open(shareUrl, '_blank', 'width=600,height=400');
|
2060 |
break;
|
2061 |
-
case 'whatsapp':
|
2062 |
-
shareUrl = `https://api.whatsapp.com/send?text=${
|
2063 |
-
text + ' ' + shareLink
|
2064 |
-
)}`;
|
2065 |
-
window.open(shareUrl, '_blank');
|
2066 |
-
break;
|
2067 |
-
case 'copy':
|
2068 |
-
navigator.clipboard.writeText(shareLink).then(() => {
|
2069 |
-
const toast = document.createElement('div');
|
2070 |
-
toast.className =
|
2071 |
-
'fixed top-4 left-1/2 transform -translate-x-1/2 bg-green-500 text-white px-4 py-2 rounded shadow-lg z-50';
|
2072 |
-
toast.textContent = 'הקישור הועתק בהצלחה!';
|
2073 |
-
document.body.appendChild(toast);
|
2074 |
-
|
2075 |
-
setTimeout(() => {
|
2076 |
-
toast.remove();
|
2077 |
-
}, 2000);
|
2078 |
-
});
|
2079 |
break;
|
|
|
|
|
2080 |
}
|
|
|
|
|
2081 |
});
|
2082 |
});
|
2083 |
}
|
2084 |
|
2085 |
|
|
|
2086 |
// פונקציה להוספת כפתור המועדפים לאזור הקטגוריות
|
2087 |
function updateCategoryFilters() {
|
2088 |
const categoryFilterDiv = document.querySelector('.category-filter');
|
|
|
145 |
transform: rotate(360deg);
|
146 |
}
|
147 |
}
|
148 |
+
@media (min-width: 768px) { /* מסכים רחבים */
|
149 |
+
.share-btn {
|
150 |
+
width: 48px;
|
151 |
+
height: 48px;
|
152 |
+
font-size: 24px;
|
153 |
+
}
|
154 |
+
}
|
155 |
|
156 |
.tech-dots {
|
157 |
position: absolute;
|
|
|
210 |
cursor: pointer;
|
211 |
background-color: #f3f4f6; /* Slightly lighter gray on hover */
|
212 |
}
|
213 |
+
/* === עיצוב חדש לכפתורי השיתוף === */
|
214 |
+
.share-buttons {
|
215 |
+
display: flex;
|
216 |
+
justify-content: center; /* כפתורים בשורה אחת במרכז */
|
217 |
+
gap: 24px; /* רווח נדיב בין כפתורים */
|
218 |
+
margin-top: 32px; /* קצת אוויר מלמעלה */
|
219 |
+
}
|
220 |
+
/* === ריבועים גדולים וברורים === */
|
221 |
+
.share-btn{
|
222 |
+
width:40px;height:40px;
|
223 |
+
font-size:22px; /* גודל האייקון */
|
224 |
+
color:#fff; /* צבע האייקון */
|
225 |
+
background:currentColor; /* צבע הרקע = צבע הכפתור */
|
226 |
+
border:none;border-radius:12px;
|
227 |
+
display:flex;align-items:center;justify-content:center;
|
228 |
+
box-shadow:0 4px 12px rgba(0,0,0,.08);
|
229 |
+
transition:transform .2s,filter .2s;
|
230 |
+
}
|
231 |
+
.share-btn:hover{transform:translateY(-4px);filter:brightness(1.12);}
|
232 |
+
.share-btn i{color:#fff;} /* האייקון תמיד לבן */
|
233 |
+
|
234 |
+
/* צבע מותג לכל פלטפורמה */
|
235 |
+
.share-btn.wa{color:#25D366;} /* WhatsApp */
|
236 |
+
.share-btn.fb{color:#1877F2;} /* Facebook */
|
237 |
+
.share-btn.tw{color:#1DA1F2;} /* Twitter/X */
|
238 |
+
.share-btn.cp{color:#64748b;} /* Copy-link / ברירת מחדל */
|
239 |
+
|
240 |
+
.share-btn img {
|
241 |
+
width: 32px;
|
242 |
+
height: 32px;
|
243 |
+
}
|
244 |
+
|
245 |
</style>
|
246 |
<!-- Google tag (gtag.js) -->
|
247 |
<script
|
|
|
1928 |
});
|
1929 |
// פונקציה להצגת כפתורי שיתוף
|
1930 |
function renderShareButtons(tool) {
|
1931 |
+
if (!tool.url || tool.url === '#') return '';
|
1932 |
+
|
1933 |
const encodedToolName = encodeURIComponent(tool.name);
|
1934 |
+
const encodedDesc = encodeURIComponent(`בדקו את הכלי ${tool.name} - ${tool.description}`);
|
|
|
|
|
1935 |
const encodedUrl = encodeURIComponent(tool.url);
|
1936 |
|
1937 |
// וודא שיש URL תקין לשיתוף
|
|
|
1940 |
}
|
1941 |
|
1942 |
return `
|
1943 |
+
<div class="share-buttons mt-4">
|
1944 |
+
<button class="share-btn fb" data-platform="facebook" data-url="${tool.url}" data-title="${tool.name}" aria-label="שיתוף בפייסבוק" title="לחצו כדי לשתף את הכלי">
|
1945 |
+
<i class="fab fa-facebook-f"></i>
|
1946 |
+
</button>
|
1947 |
+
<button class="share-btn wa" data-platform="whatsapp" data-url="${tool.url}" data-title="${tool.name}" aria-label="שיתוף ב-WhatsApp" title="לחצו כדי לשתף את הכלי">
|
1948 |
+
<i class="fab fa-whatsapp"></i>
|
1949 |
+
</button>
|
1950 |
+
<button class="share-btn tw" data-platform="twitter" data-url="${tool.url}" data-title="${tool.name}" aria-label="שיתוף בטוויטר" title="לחצו כדי לשתף את הכלי">
|
1951 |
+
<i class="fab fa-twitter"></i>
|
1952 |
+
</button>
|
1953 |
+
<button class="share-btn cp" data-platform="copy" data-url="${tool.url}" aria-label="העתקת קישור" title="לחצו כדי לשתף את הכלי">
|
1954 |
+
<i class="fas fa-link"></i>
|
1955 |
+
</button>
|
1956 |
+
</div>`;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1957 |
}
|
1958 |
// פונקציה לטיפול בלחיצה על כפתור המועדפים
|
1959 |
function setupFavorites() {
|
|
|
2052 |
|
2053 |
// פונקציה לטיפול בכפתורי שיתוף
|
2054 |
function setupShareButtons() {
|
2055 |
+
const TOOLBOX_LINK = 'https://bit.ly/a-tools';
|
|
|
|
|
|
|
2056 |
|
2057 |
+
document.querySelectorAll('.share-btn').forEach((btn) => {
|
2058 |
+
btn.addEventListener('click', async () => {
|
2059 |
+
const platform = btn.dataset.platform; // facebook | twitter | whatsapp | copy
|
2060 |
+
const toolUrl = btn.dataset.url; // קישור ישיר לכלי
|
2061 |
+
const title = btn.dataset.title; // שם הכלי
|
2062 |
+
|
2063 |
+
/* === טקסט שיתוף אחד לכל הערוצים === */
|
2064 |
+
const shareMsg =
|
2065 |
+
`בדקו את הכלי ${title} בלינק: ${toolUrl}\n\n` +
|
2066 |
+
`מארגז הכלים של שגיא בר-און בכתובת: ${TOOLBOX_LINK}`;
|
2067 |
+
|
2068 |
+
/* ---------- העתקה ללוח ---------- */
|
2069 |
+
if (platform === 'copy') {
|
2070 |
+
try {
|
2071 |
+
await navigator.clipboard.writeText(shareMsg);
|
2072 |
+
btn.setAttribute('data-tooltip', '📋 הועתק!');
|
2073 |
+
setTimeout(() => btn.removeAttribute('data-tooltip'), 1500);
|
2074 |
+
} catch { alert('לא הצלחנו להעתיק – נסה ידנית'); }
|
2075 |
+
return;
|
2076 |
+
}
|
2077 |
|
2078 |
+
/* ---------- קידוד וכתובת שיתוף ---------- */
|
2079 |
+
const encodedMsg = encodeURIComponent(shareMsg);
|
2080 |
+
const encodedUrl = encodeURIComponent(toolUrl); // ל‑Preview
|
2081 |
+
let shareUrl = '';
|
2082 |
|
2083 |
switch (platform) {
|
2084 |
+
case 'facebook': // כרטיס של הכלי, טקסט מלא
|
2085 |
+
shareUrl = `https://www.facebook.com/sharer/sharer.php?u=${encodedUrl}"e=${encodedMsg}`;
|
|
|
|
|
|
|
2086 |
break;
|
2087 |
+
case 'twitter': // כרטיס + טקסט
|
2088 |
+
shareUrl = `https://twitter.com/intent/tweet?url=${encodedUrl}&text=${encodedMsg}`;
|
|
|
|
|
|
|
2089 |
break;
|
2090 |
+
case 'whatsapp': // הכול בטקסט אחד – וואטסאפ מציג שני הלינקים
|
2091 |
+
shareUrl = `https://api.whatsapp.com/send?text=${encodedMsg}`;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2092 |
break;
|
2093 |
+
default:
|
2094 |
+
shareUrl = encodedUrl;
|
2095 |
}
|
2096 |
+
|
2097 |
+
window.open(shareUrl, '_blank', 'noopener,noreferrer,width=600,height=500');
|
2098 |
});
|
2099 |
});
|
2100 |
}
|
2101 |
|
2102 |
|
2103 |
+
|
2104 |
// פונקציה להוספת כפתור המועדפים לאזור הקטגוריות
|
2105 |
function updateCategoryFilters() {
|
2106 |
const categoryFilterDiv = document.querySelector('.category-filter');
|