-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
386 lines (342 loc) · 10.5 KB
/
script.js
File metadata and controls
386 lines (342 loc) · 10.5 KB
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
// Mobile Navigation Toggle
document.addEventListener('DOMContentLoaded', function () {
const navToggle = document.querySelector('.nav-toggle')
const navMenu = document.querySelector('.nav-menu')
const navLinks = document.querySelectorAll('.nav-link')
// Toggle mobile menu
navToggle.addEventListener('click', function () {
navMenu.classList.toggle('active')
// Animate hamburger menu
const bars = navToggle.querySelectorAll('.bar')
bars.forEach((bar, index) => {
if (navMenu.classList.contains('active')) {
if (index === 0)
bar.style.transform = 'rotate(-45deg) translate(-5px, 6px)'
if (index === 1) bar.style.opacity = '0'
if (index === 2)
bar.style.transform = 'rotate(45deg) translate(-5px, -6px)'
} else {
bar.style.transform = 'none'
bar.style.opacity = '1'
}
})
})
// Close mobile menu when clicking on a link
navLinks.forEach(link => {
link.addEventListener('click', () => {
navMenu.classList.remove('active')
const bars = navToggle.querySelectorAll('.bar')
bars.forEach(bar => {
bar.style.transform = 'none'
bar.style.opacity = '1'
})
})
})
// Close mobile menu when clicking outside
document.addEventListener('click', function (event) {
if (!navToggle.contains(event.target) && !navMenu.contains(event.target)) {
navMenu.classList.remove('active')
const bars = navToggle.querySelectorAll('.bar')
bars.forEach(bar => {
bar.style.transform = 'none'
bar.style.opacity = '1'
})
}
})
})
// Smooth scrolling for anchor links
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
anchor.addEventListener('click', function (e) {
e.preventDefault()
const target = document.querySelector(this.getAttribute('href'))
if (target) {
target.scrollIntoView({
behavior: 'smooth',
block: 'start'
})
}
})
})
// Contact Form Handling
document.getElementById('contactForm').addEventListener('submit', function (e) {
e.preventDefault()
// Get form data
const formData = new FormData(this)
const name = formData.get('name')
const email = formData.get('email')
const subject = formData.get('subject')
const message = formData.get('message')
// Create mailto link
const mailtoLink = `mailto:apps@maadotaa.com?subject=${encodeURIComponent(
subject
)}&body=${encodeURIComponent(
`Name: ${name}\nEmail: ${email}\n\nMessage:\n${message}`
)}`
// Open email client
window.location.href = mailtoLink
// Show success message
showNotification(
'Email client opened! Please send your message to complete the contact process.',
'success'
)
// Reset form
this.reset()
})
// Notification System
function showNotification (message, type = 'info') {
// Remove existing notifications
const existingNotification = document.querySelector('.notification')
if (existingNotification) {
existingNotification.remove()
}
// Create notification element
const notification = document.createElement('div')
notification.className = `notification notification-${type}`
notification.innerHTML = `
<div class="notification-content">
<i class="fas fa-${
type === 'success' ? 'check-circle' : 'info-circle'
}"></i>
<span>${message}</span>
<button class="notification-close" onclick="this.parentElement.parentElement.remove()">
<i class="fas fa-times"></i>
</button>
</div>
`
// Add styles
notification.style.cssText = `
position: fixed;
top: 100px;
right: 20px;
background: ${type === 'success' ? '#10b981' : '#6366f1'};
color: white;
padding: 1rem 1.5rem;
border-radius: 10px;
box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
z-index: 10000;
max-width: 400px;
animation: slideInRight 0.3s ease;
`
// Add to document
document.body.appendChild(notification)
// Auto remove after 5 seconds
setTimeout(() => {
if (notification.parentElement) {
notification.style.animation = 'slideOutRight 0.3s ease'
setTimeout(() => {
if (notification.parentElement) {
notification.remove()
}
}, 300)
}
}, 5000)
}
// Scroll animations
function isElementInViewport (el) {
const rect = el.getBoundingClientRect()
return (
rect.top >= 0 &&
rect.left >= 0 &&
rect.bottom <=
(window.innerHeight || document.documentElement.clientHeight) &&
rect.right <= (window.innerWidth || document.documentElement.clientWidth)
)
}
function handleScrollAnimations () {
const elements = document.querySelectorAll(
'.feature-card, .step, .screenshot-item, .privacy-section'
)
elements.forEach(element => {
if (isElementInViewport(element)) {
element.classList.add('fade-in', 'visible')
}
})
}
// Throttle scroll events
function throttle (func, wait) {
let timeout
return function executedFunction (...args) {
const later = () => {
clearTimeout(timeout)
func(...args)
}
clearTimeout(timeout)
timeout = setTimeout(later, wait)
}
}
// Add scroll event listener
window.addEventListener('scroll', throttle(handleScrollAnimations, 100))
// Initialize animations on page load
document.addEventListener('DOMContentLoaded', function () {
handleScrollAnimations()
})
// Add CSS for animations
const style = document.createElement('style')
style.textContent = `
@keyframes slideInRight {
from {
transform: translateX(100%);
opacity: 0;
}
to {
transform: translateX(0);
opacity: 1;
}
}
@keyframes slideOutRight {
from {
transform: translateX(0);
opacity: 1;
}
to {
transform: translateX(100%);
opacity: 0;
}
}
.notification-content {
display: flex;
align-items: center;
gap: 0.5rem;
}
.notification-close {
background: none;
border: none;
color: white;
cursor: pointer;
padding: 0.25rem;
margin-left: auto;
opacity: 0.8;
transition: opacity 0.3s ease;
}
.notification-close:hover {
opacity: 1;
}
.fade-in {
opacity: 0;
transform: translateY(30px);
transition: opacity 0.6s ease, transform 0.6s ease;
}
.fade-in.visible {
opacity: 1;
transform: translateY(0);
}
`
document.head.appendChild(style)
// Navbar background change on scroll
window.addEventListener('scroll', function () {
const navbar = document.querySelector('.navbar')
if (window.scrollY > 50) {
navbar.style.background = 'rgba(255, 255, 255, 0.98)'
navbar.style.boxShadow = '0 2px 20px rgba(0, 0, 0, 0.1)'
} else {
navbar.style.background = 'rgba(255, 255, 255, 0.95)'
navbar.style.boxShadow = 'none'
}
})
// Screenshot gallery functionality
document.addEventListener('DOMContentLoaded', function () {
const screenshotItems = document.querySelectorAll('.screenshot-item')
screenshotItems.forEach(item => {
item.addEventListener('click', function () {
const img = this.querySelector('img')
const src = img.src
const alt = img.alt
// Create modal
const modal = document.createElement('div')
modal.className = 'screenshot-modal'
modal.innerHTML = `
<div class="modal-content">
<span class="modal-close">×</span>
<img src="${src}" alt="${alt}" class="modal-image">
<div class="modal-caption">${alt}</div>
</div>
`
// Add modal styles
modal.style.cssText = `
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.9);
display: flex;
justify-content: center;
align-items: center;
z-index: 10000;
animation: fadeIn 0.3s ease;
`
const modalContent = modal.querySelector('.modal-content')
modalContent.style.cssText = `
position: relative;
max-width: 90%;
max-height: 90%;
background: white;
border-radius: 10px;
overflow: hidden;
`
const modalImage = modal.querySelector('.modal-image')
modalImage.style.cssText = `
width: 100%;
height: auto;
display: block;
`
const modalClose = modal.querySelector('.modal-close')
modalClose.style.cssText = `
position: absolute;
top: 10px;
right: 15px;
font-size: 2rem;
color: white;
cursor: pointer;
background: rgba(0, 0, 0, 0.5);
width: 40px;
height: 40px;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
z-index: 10001;
`
const modalCaption = modal.querySelector('.modal-caption')
modalCaption.style.cssText = `
padding: 1rem;
text-align: center;
font-weight: 500;
color: #333;
`
// Add to document
document.body.appendChild(modal)
// Close modal functionality
modalClose.addEventListener('click', () => {
modal.style.animation = 'fadeOut 0.3s ease'
setTimeout(() => modal.remove(), 300)
})
modal.addEventListener('click', e => {
if (e.target === modal) {
modal.style.animation = 'fadeOut 0.3s ease'
setTimeout(() => modal.remove(), 300)
}
})
// Escape key to close
document.addEventListener('keydown', function (e) {
if (e.key === 'Escape' && document.body.contains(modal)) {
modal.style.animation = 'fadeOut 0.3s ease'
setTimeout(() => modal.remove(), 300)
}
})
})
})
})
// Add modal animation styles
const modalStyles = document.createElement('style')
modalStyles.textContent = `
@keyframes fadeIn {
from { opacity: 0; }
to { opacity: 1; }
}
@keyframes fadeOut {
from { opacity: 1; }
to { opacity: 0; }
}
`
document.head.appendChild(modalStyles)