-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
146 lines (122 loc) · 5.01 KB
/
script.js
File metadata and controls
146 lines (122 loc) · 5.01 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
// ===== MOBILE MENU FUNCTIONALITY =====
function toggleMobileMenu() {
const mobileMenu = document.getElementById('mobileMenu');
mobileMenu.classList.toggle('active');
}
function closeMobileMenu() {
const mobileMenu = document.getElementById('mobileMenu');
mobileMenu.classList.remove('active');
}
// Close mobile menu when clicking outside
document.addEventListener('click', function(event) {
const mobileMenu = document.getElementById('mobileMenu');
const menuBtn = document.querySelector('.mobile-menu-btn');
if (mobileMenu && menuBtn && !mobileMenu.contains(event.target) && !menuBtn.contains(event.target)) {
mobileMenu.classList.remove('active');
}
});
// ===== SMOOTH SCROLLING FOR NAVIGATION =====
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'
});
}
});
});
// ===== SCROLL ANIMATION OBSERVER =====
const observerOptions = {
threshold: 0.1,
rootMargin: '0px 0px -50px 0px'
};
const observer = new IntersectionObserver((entries) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
entry.target.classList.add('visible');
}
});
}, observerOptions);
document.querySelectorAll('.scroll-animate').forEach(el => {
observer.observe(el);
});
// ===== DOWNLOAD FUNCTIONALITY WITH ACTUAL FILE DOWNLOAD =====
function downloadVersion(version, button) {
const overlay = document.getElementById('downloadOverlay');
const progressModal = document.getElementById('downloadProgress');
const percentText = document.getElementById('downloadPercent');
const downloadText = document.querySelector('.download-text');
// File URLs - UPDATE THESE WITH YOUR ACTUAL FILE PATHS
const fileUrls = {
'v1': 'main/TuneX_v1.zip', // Path to your v1.0 file
'v2': 'main/TuneX_v2.zip', // Path to your v2.1 file
'v3': 'main/TunexYT.zip' // Path to your v3.0 file
};
const versionNames = {
'v1': 'Version 1.0',
'v2': 'Version 2.1',
'v3': 'Version 1.0'
};
// Add downloading class to button
button.classList.add('downloading');
const originalText = button.querySelector('.btn-text').textContent;
button.querySelector('.btn-text').textContent = 'Downloading...';
// Show progress modal
overlay.classList.add('active');
progressModal.classList.add('active');
// Simulate download progress
let progress = 0;
const interval = setInterval(() => {
progress += Math.random() * 15;
if (progress > 100) progress = 100;
percentText.textContent = Math.floor(progress) + '%';
if (progress >= 100) {
clearInterval(interval);
// Change text to complete
downloadText.textContent = 'Complete!';
// Hide after 1.5 seconds
setTimeout(() => {
overlay.classList.remove('active');
progressModal.classList.remove('active');
// Reset for next download
setTimeout(() => {
percentText.textContent = '0%';
downloadText.textContent = 'Downloading...';
button.classList.remove('downloading');
button.querySelector('.btn-text').textContent = originalText;
}, 300);
// ACTUAL FILE DOWNLOAD
const downloadUrl = fileUrls[version];
const fileName = downloadUrl.split('/').pop();
// Create temporary link for download
const link = document.createElement('a');
link.href = downloadUrl;
link.download = fileName;
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
// Show success message
alert('TuneX ' + versionNames[version] + ' download complete!\n\nYour download should start automatically.');
}, 1500);
}
}, 200);
}
// ===== INTERACTIVE MOUSE EFFECT =====
document.addEventListener('mousemove', (e) => {
const mouseX = e.clientX / window.innerWidth;
const mouseY = e.clientY / window.innerHeight;
const hero = document.querySelector('.hero');
if (hero) {
hero.style.background = `radial-gradient(circle at ${mouseX * 100}% ${mouseY * 100}%, rgba(76, 201, 240, 0.15) 0%, rgba(10, 10, 20, 0.8) 70%)`;
}
});
// ===== AUTOMATICALLY DISPLAY CURRENT YEAR =====
document.addEventListener('DOMContentLoaded', function() {
const yearElement = document.getElementById('current-year');
if (yearElement) {
yearElement.textContent = new Date().getFullYear();
}
});