theWitcher commited on
Commit
d50156d
·
1 Parent(s): 422f761

Updated WhatsApp sharing functionality to include current URL and image URL, while commenting out the previous implementation.

Browse files
Files changed (2) hide show
  1. index.html +15 -7
  2. sagi_ai_image.jpg +0 -0
index.html CHANGED
@@ -2032,9 +2032,11 @@ sagi test
2032
  e.stopPropagation();
2033
 
2034
  const platform = btn.dataset.platform;
2035
- const url = btn.dataset.url;
 
2036
  const title = btn.dataset.title;
2037
  const text = `בדקו את הכלי ${title} מארגז הכלים של שגיא בר און`;
 
2038
 
2039
  let shareUrl;
2040
 
@@ -2051,12 +2053,18 @@ sagi test
2051
  )}&text=${encodeURIComponent(text)}`;
2052
  window.open(shareUrl, '_blank', 'width=600,height=400');
2053
  break;
2054
- case 'whatsapp':
2055
- shareUrl = `https://api.whatsapp.com/send?text=${encodeURIComponent(
2056
- text + ' ' + url
2057
- )}`;
2058
- window.open(shareUrl, '_blank');
2059
- break;
 
 
 
 
 
 
2060
  case 'copy':
2061
  navigator.clipboard.writeText(url).then(() => {
2062
  // הודעה זמנית על העתקה מוצלחת
 
2032
  e.stopPropagation();
2033
 
2034
  const platform = btn.dataset.platform;
2035
+ // const url = btn.dataset.url;
2036
+ const url = window.location.href; // Set URL to the current address in the browser
2037
  const title = btn.dataset.title;
2038
  const text = `בדקו את הכלי ${title} מארגז הכלים של שגיא בר און`;
2039
+ const imageUrl = `${window.location.origin}/sagi_ai_toolbox.png`; // נתיב מלא לקובץ התמונה
2040
 
2041
  let shareUrl;
2042
 
 
2053
  )}&text=${encodeURIComponent(text)}`;
2054
  window.open(shareUrl, '_blank', 'width=600,height=400');
2055
  break;
2056
+ case 'whatsapp':
2057
+ const whatsappMessage = `${text}\n${url}\n${imageUrl}`;
2058
+ shareUrl = `https://api.whatsapp.com/send?text=${encodeURIComponent(whatsappMessage)}`;
2059
+ window.open(shareUrl, '_blank');
2060
+ break;
2061
+
2062
+ // case 'whatsapp':
2063
+ // shareUrl = `https://api.whatsapp.com/send?text=${encodeURIComponent(
2064
+ // text + ' ' + url
2065
+ // )}`;
2066
+ // window.open(shareUrl, '_blank');
2067
+ // break;
2068
  case 'copy':
2069
  navigator.clipboard.writeText(url).then(() => {
2070
  // הודעה זמנית על העתקה מוצלחת
sagi_ai_image.jpg ADDED