Repository navigation
Expand file tree
/
Copy pathindex.js
More file actions
78 lines (66 loc) · 2.6 KB
/
Copy pathindex.js
File metadata and controls
78 lines (66 loc) · 2.6 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
document.addEventListener('DOMContentLoaded', function() {
// عناصر DOM
const hamburger = document.getElementById('hamburger');
const navLinks = document.getElementById('navLinks');
const scrollTopBtn = document.getElementById('scrollTop');
const downloadBtns = document.querySelectorAll('.download-btn');
const notification = document.getElementById('notification');
// تهيئة الصفحة
initPage();
function initPage() {
// أحداث القائمة المنسدلة
hamburger.addEventListener('click', toggleMenu);
// أحداث أزرار التنزيل
downloadBtns.forEach(btn => {
btn.addEventListener('click', function(e) {
e.preventDefault();
const os = this.closest('.download-card').dataset.os;
simulateDownload(os);
});
});
// حدث زر العودة للأعلى
scrollTopBtn.addEventListener('click', scrollToTop);
window.addEventListener('scroll', toggleScrollTopButton);
}
function toggleMenu() {
navLinks.classList.toggle('active');
const isExpanded = navLinks.classList.contains('active');
hamburger.setAttribute('aria-expanded', isExpanded);
}
function simulateDownload(os) {
let message = '';
if (os === 'windows') {
message = 'جاري تحميل تطبيق توبة لنظام Windows...';
} else if (os === 'android') {
message = 'جاري تحميل تطبيق توبة لنظام Android...';
}
showNotification(message, 'success');
// في تطبيق حقيقي، يمكنك توجيه المستخدم لرابط التنزيل الفعلي
setTimeout(() => {
showNotification('عذرًا، هذه مجرد نسخة توضيحية', 'error');
}, 2000);
}
function showNotification(message, type) {
notification.textContent = message;
notification.className = 'notification ' + type;
setTimeout(() => {
notification.classList.add('fade-out');
setTimeout(() => {
notification.className = 'notification';
}, 500);
}, 3000);
}
function scrollToTop() {
window.scrollTo({
top: 0,
behavior: 'smooth'
});
}
function toggleScrollTopButton() {
if (window.pageYOffset > 300) {
scrollTopBtn.classList.add('active');
} else {
scrollTopBtn.classList.remove('active');
}
}
});