-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript-he.js
98 lines (82 loc) · 4.09 KB
/
script-he.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
console.log('Script loaded successfully!');
// Smooth scroll for internal links
document.querySelectorAll("a[href^='#']").forEach(anchor => {
anchor.addEventListener("click", function(e) {
e.preventDefault();
const targetId = this.getAttribute("href");
document.querySelector(targetId).scrollIntoView({
behavior: "smooth",
block: "start"
});
});
});
document.querySelectorAll('a.language-switcher').forEach(link => {
link.addEventListener('click', function (e) {
e.preventDefault();
const overlay = document.getElementById('transition-overlay');
overlay.classList.add('active');
setTimeout(() => {
window.location.href = this.href;
}, 500); // Match the duration of your CSS transition
});
});
// Contact form submission
document.querySelector('#contact-form').addEventListener('submit', function(event) {
event.preventDefault();
fetch(this.action, {
method: 'POST',
body: new FormData(this),
headers: { 'Accept': 'application/json' }
}).then(response => {
if (response.ok) {
alert('הטופס נשלח בהצלחה! תודה על פנייתכם.');
this.reset();
} else {
alert('אופס! אירעה בעיה בשליחת הטופס.');
}
}).catch(error => console.error('Error:', error));
});
// Toggle mobile menu
const toggleButton = document.querySelector('.toggle-button');
const navMenu = document.querySelector('nav ul');
toggleButton.addEventListener('click', () => {
navMenu.classList.toggle("show");
toggleButton.classList.toggle("active");
});
// FAQ item toggle
document.querySelectorAll('.faq-item h3').forEach(item => {
item.addEventListener('click', () => {
item.parentElement.classList.toggle('active');
});
});
// Function to open an email in Hebrew with notification
function openEmail(packageType) {
const email = "arikmelku3@gmail.com";
const hebrewMessage = `שלום אריק,\n\nאני מעוניין/ת בחבילה ${packageType === 'Basic' ? 'בסיסית' : packageType === 'Standard' ? 'סטנדרטית' : 'פרימיום'} שמוצעת ב-פיומז - עיצובי אתרים. אשמח לקבל פרטים נוספים לגבי החבילה ואת הצעדים הבאים להמשך.\n\nהנה הפרטים שלי:\n\nשם: [השם שלך]\nאימייל: [האימייל שלך]\nטלפון: [מספר הטלפון שלך]\n\nמידע נוסף או דרישות:\n[אנא הוסף/הוסיפי כל פרט נוסף שתרצה/תרצי לשתף]\n\nתודה על העזרה שלך!\n\nבברכה,\n[השם שלך]`;
// Open mailto link with the prefilled Hebrew message
const subject = `התעניינות בחבילת ${packageType === 'Basic' ? 'בסיסית' : packageType === 'Standard' ? 'סטנדרטית' : 'פרימיום'} מ-פיומז - עיצובי אתרים`;
window.location.href = `mailto:${email}?subject=${encodeURIComponent(subject)}&body=${encodeURIComponent(hebrewMessage)}`;
// Show notification
showNotification("מועבר לאימייל שלך, תודה שפנית אלינו!");
}
// Function to show a notification
function showNotification(message) {
const notification = document.getElementById('notification');
notification.textContent = message;
notification.classList.add('show', 'success');
// Hide the notification after 3 seconds
setTimeout(() => {
notification.classList.remove('show', 'success');
}, 3000);
}
// Video conversion with ffmpeg.js
async function convertVideoToGif(videoPath, outputPath) {
const { createFFmpeg, fetchFile } = FFmpeg;
const ffmpeg = createFFmpeg({ log: true });
await ffmpeg.load();
ffmpeg.FS('writeFile', 'input.mp4', await fetchFile(videoPath));
await ffmpeg.run('-i', 'input.mp4', '-vf', 'fps=10,scale=320:180,setsar=1', '-t', '5', 'output.gif');
const data = ffmpeg.FS('readFile', 'output.gif');
const gifUrl = URL.createObjectURL(new Blob([data.buffer], { type: 'image/gif' }));
document.getElementById(outputPath).src = gifUrl;
}