-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
158 lines (137 loc) · 5.93 KB
/
script.js
File metadata and controls
158 lines (137 loc) · 5.93 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
// ============================================
// madOS — Site Scripts
// ============================================
(function () {
'use strict';
// Mobile Menu Toggle
const mobileMenuToggle = document.querySelector('.mobile-menu-toggle');
const navMenu = document.querySelector('.nav-menu');
if (mobileMenuToggle) {
mobileMenuToggle.addEventListener('click', () => {
navMenu.classList.toggle('active');
mobileMenuToggle.classList.toggle('active');
});
}
// Close mobile menu on link click
document.querySelectorAll('.nav-menu a[href^="#"]').forEach(link => {
link.addEventListener('click', () => {
if (navMenu.classList.contains('active')) {
navMenu.classList.remove('active');
mobileMenuToggle.classList.remove('active');
}
});
});
// Note: Smooth scroll with navbar offset is handled by CSS scroll-padding-top
// No JavaScript needed - CSS handles it better
// Navbar scroll effect
const navbar = document.querySelector('.navbar');
window.addEventListener('scroll', () => {
if (window.pageYOffset > 50) {
navbar.classList.add('scrolled');
} else {
navbar.classList.remove('scrolled');
}
}, { passive: true });
// Intersection Observer — reveal animations
const revealElements = document.querySelectorAll(
'.feature-card, .spec-item, .app-group, .step, .preview-frame, .system-monitor, .download-card, .roadmap-pillar, .roadmap-item, .roadmap-matrix'
);
const revealObserver = new IntersectionObserver((entries) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
entry.target.classList.add('visible');
revealObserver.unobserve(entry.target);
}
});
}, {
threshold: 0.1,
rootMargin: '0px 0px -40px 0px'
});
revealElements.forEach((el, i) => {
el.classList.add('reveal');
el.style.transitionDelay = `${Math.min(i % 6, 4) * 0.08}s`;
revealObserver.observe(el);
});
// Copy to clipboard for code blocks
document.querySelectorAll('.step-content code, .installer-command code').forEach(block => {
block.style.cursor = 'pointer';
block.setAttribute('title', 'Click to copy');
block.addEventListener('click', () => {
navigator.clipboard.writeText(block.textContent.trim()).then(() => {
const originalText = block.textContent;
const copyText = 'Copied!';
block.textContent = copyText;
block.style.color = 'var(--neon-cyan, #00fff5)';
setTimeout(() => {
block.textContent = originalText;
block.style.color = '';
}, 1500);
});
});
});
// Bindings Tabs
document.querySelectorAll('.bindings-tab').forEach(tab => {
tab.addEventListener('click', () => {
const target = tab.dataset.tab;
document.querySelectorAll('.bindings-tab').forEach(t => t.classList.remove('active'));
document.querySelectorAll('.bindings-panel').forEach(p => p.classList.remove('active'));
tab.classList.add('active');
const panel = document.getElementById('tab-' + target);
if (panel) panel.classList.add('active');
});
});
// Console branding
console.log('%cmadOS', 'font-size: 24px; font-weight: bold; color: #88c0d0; text-shadow: 0 0 10px #88c0d0;');
console.log('%cNordic Cyberpunk // AI-Orchestrated Arch Linux', 'font-size: 12px; color: #b48ead;');
console.log('%chttps://github.com/madkoding/mad-os', 'font-size: 11px; color: #a3be8c;');
// Konami Easter Egg
let konamiCode = [];
const konamiSequence = ['ArrowUp', 'ArrowUp', 'ArrowDown', 'ArrowDown', 'ArrowLeft', 'ArrowRight', 'ArrowLeft', 'ArrowRight', 'b', 'a'];
document.addEventListener('keydown', (e) => {
konamiCode.push(e.key);
konamiCode = konamiCode.slice(-10);
if (konamiCode.join(',') === konamiSequence.join(',')) {
document.body.style.animation = 'rainbow 2s infinite';
setTimeout(() => {
document.body.style.animation = '';
}, 5000);
}
});
const style = document.createElement('style');
style.textContent = '@keyframes rainbow { 0% { filter: hue-rotate(0deg); } 100% { filter: hue-rotate(360deg); } }';
document.head.appendChild(style);
// ============================================
// Download Links — Load from JSON
// ============================================
async function updateDownloadLinks() {
try {
const response = await fetch('download-info.json');
if (!response.ok) {
const htmlResponse = await fetch('download-info.html');
if (!htmlResponse.ok) return;
const info = await htmlResponse.json();
updateLinks(info);
return;
}
const info = await response.json();
updateLinks(info);
} catch (e) {
console.log('Using default download links');
}
}
function updateLinks(info) {
const betaLink = document.getElementById('beta-download-link');
const betaVersion = document.getElementById('beta-version-text');
if (betaLink && betaVersion && info.beta) {
betaLink.href = info.beta.url;
betaVersion.textContent = 'Download v' + info.beta.version;
}
const stableLink = document.getElementById('stable-download-link');
const stableVersion = document.getElementById('stable-version-text');
if (stableLink && stableVersion && info.stable) {
stableLink.href = info.stable.url;
stableVersion.textContent = 'Download v' + info.stable.version;
}
}
updateDownloadLinks();
})();