|
1 | | -$(document).ready(function () { |
2 | | - // Dynamic GitHub Release Fetching |
3 | | - const repoOwner = "Deadpool2000"; |
4 | | - const repoName = "WASP"; |
5 | | - const apiUrl = `https://api.github.com/repos/${repoOwner}/${repoName}/releases/latest`; |
6 | | - |
7 | | - function fetchLatestRelease() { |
8 | | - $.getJSON(apiUrl, function (data) { |
9 | | - const version = data.tag_name; |
10 | | - const zipUrl = data.zipball_url; |
11 | | - const assets = data.assets; |
12 | | - |
13 | | - // Platform Asset Groups |
14 | | - const winAssets = []; |
15 | | - const macAssets = []; |
16 | | - const linuxAssets = []; |
17 | | - |
18 | | - assets.forEach(asset => { |
19 | | - const name = asset.name; |
20 | | - const lowerName = name.toLowerCase(); |
21 | | - |
22 | | - // Exclude the deprecated wasp.exe (small letters) |
23 | | - if (name === 'wasp.exe') return; |
24 | | - |
25 | | - if (lowerName.endsWith('.exe') || lowerName.endsWith('.msi')) { |
26 | | - winAssets.push(asset); |
27 | | - } else if (lowerName.endsWith('.dmg') || lowerName.endsWith('.pkg') || (lowerName.endsWith('.zip') && lowerName.includes('macos'))) { |
28 | | - macAssets.push(asset); |
29 | | - } else if (lowerName.endsWith('.appimage') || lowerName.endsWith('.deb') || lowerName.endsWith('.rpm')) { |
30 | | - linuxAssets.push(asset); |
31 | | - } |
32 | | - }); |
33 | | - |
34 | | - // Helper to render buttons |
35 | | - function renderButtons(containerId, metaId, platformAssets, defaultUrl) { |
36 | | - const container = $(`#${containerId}`).empty(); |
37 | | - if (platformAssets.length > 0) { |
38 | | - platformAssets.forEach(a => { |
39 | | - let label = a.name.split('.').pop().toUpperCase(); |
40 | | - // Special handling for long extensions |
41 | | - if (label === 'APPIMAGE') label = 'AppImage'; |
42 | | - container.append(`<a href="${a.browser_download_url}" class="btn btn-terminal btn-download flex-fill text-nowrap">${label}</a>`); |
43 | | - }); |
44 | | - $(`#${metaId}`).text(platformAssets[0].name.split('-')[0] || 'Available Now'); |
45 | | - } else { |
46 | | - container.append(`<a href="${defaultUrl}" class="btn btn-terminal btn-download w-100">View Release</a>`); |
47 | | - } |
48 | | - } |
49 | | - |
50 | | - // --- WINDOWS --- |
51 | | - winAssets.sort((a, b) => (a.name.includes('WASP') ? -1 : 1)); |
52 | | - renderButtons('win-download-container', 'win-meta', winAssets, data.html_url); |
53 | | - |
54 | | - // --- macOS --- |
55 | | - macAssets.sort((a, b) => (a.name.endsWith('.dmg') ? -1 : 1)); |
56 | | - renderButtons('mac-download-container', 'mac-meta', macAssets, data.html_url); |
57 | | - |
58 | | - // --- LINUX --- |
59 | | - linuxAssets.sort((a, b) => (a.name.endsWith('.AppImage') ? -1 : 1)); |
60 | | - renderButtons('linux-download-container', 'linux-meta', linuxAssets, data.html_url); |
61 | | - |
62 | | - // Update Global Version |
63 | | - $('#wasp-brand-text').html(`<i class="fas fa-bug"></i> WASP_${version}`); |
64 | | - $('#latest-version-text').text(`Windows (${version})`); |
65 | | - $('#mac-version-text').text(`macOS (${version})`); |
66 | | - $('#linux-version-text').text(`Linux (${version})`); |
67 | | - $('#download-zip').attr('href', zipUrl); |
68 | | - |
69 | | - console.log(`%c [SYSTEM] Assets synchronized for ${version}`, "color: #00ff41;"); |
70 | | - }).fail(function () { |
71 | | - console.error("Failed to fetch latest release from GitHub API."); |
72 | | - }); |
73 | | - } |
74 | | - |
75 | | - fetchLatestRelease(); |
76 | | - |
77 | | - // Typewriter effect for Hero Title |
78 | | - const heroTitle = "W.A.S.P."; |
79 | | - const heroH1 = $(".glitch"); |
80 | | - let i = 0; |
81 | | - |
82 | | - function typeWriter() { |
83 | | - if (i < heroTitle.length) { |
84 | | - heroH1.text(heroTitle.substring(0, i + 1)); |
85 | | - i++; |
86 | | - setTimeout(typeWriter, 150); |
87 | | - } |
88 | | - } |
89 | | - |
90 | | - // Start typewriter after a small delay |
91 | | - setTimeout(typeWriter, 500); |
92 | | - |
93 | | - // Smooth Scrolling for nav links |
94 | | - $('a.nav-link, a.btn-terminal').on('click', function (event) { |
95 | | - if (this.hash !== "") { |
96 | | - event.preventDefault(); |
97 | | - var hash = this.hash; |
98 | | - $('html, body').animate({ |
99 | | - scrollTop: $(hash).offset().top - 80 |
100 | | - }, 800); |
101 | | - } |
102 | | - }); |
103 | | - |
104 | | - // Random Console Interactions |
105 | | - const messages = [ |
106 | | - "Status: HR is suspicious but has no evidence.", |
107 | | - "Status: Cursor moved 4,203 miles today.", |
108 | | - "Status: Simulated 4 meetings while you were at the gym.", |
109 | | - "Status: Keyboard active. Keystroke: 'ASDFGHJKL'", |
110 | | - "Status: Stealth mode engaged. You are a shadow." |
111 | | - ]; |
112 | | - |
113 | | - setInterval(() => { |
114 | | - const randomMsg = messages[Math.floor(Math.random() * messages.length)]; |
115 | | - const newLine = $('<div class="text-secondary mb-2">> ' + randomMsg + '</div>'); |
116 | | - $('.console-output').append(newLine); |
117 | | - |
118 | | - // Keep only last 6 lines |
119 | | - if ($('.console-output div').length > 6) { |
120 | | - $('.console-output div').first().remove(); |
121 | | - } |
122 | | - }, 5000); |
123 | | - |
124 | | - // Add glitch effect on hover for feature cards |
125 | | - $('.feature-card').hover( |
126 | | - function () { |
127 | | - $(this).css('border-color', '#00ff41'); |
128 | | - }, function () { |
129 | | - $(this).css('border-color', 'rgba(0, 255, 65, 0.1)'); |
130 | | - } |
131 | | - ); |
132 | | - |
133 | | - // Easter Egg: Console Log |
134 | | - console.log("%c WASP INITIALIZED ", "background: #000; color: #00ff41; font-size: 20px; font-weight: bold;"); |
135 | | - console.log("If you're reading this, you're either a developer or HR. If you're HR, move along, nothing to see here."); |
136 | | - |
137 | | -}); |
| 1 | +$(document).ready(function () { |
| 2 | + // Dynamic GitHub Release Fetching |
| 3 | + const repoOwner = "Deadpool2000"; |
| 4 | + const repoName = "WASP"; |
| 5 | + const apiUrl = `https://api.github.com/repos/${repoOwner}/${repoName}/releases/latest`; |
| 6 | + |
| 7 | + function fetchLatestRelease() { |
| 8 | + $.getJSON(apiUrl, function (data) { |
| 9 | + const version = data.tag_name; |
| 10 | + const zipUrl = data.zipball_url; |
| 11 | + const assets = data.assets; |
| 12 | + |
| 13 | + // Platform Asset Groups |
| 14 | + const winAssets = []; |
| 15 | + const macAssets = []; |
| 16 | + const linuxAssets = []; |
| 17 | + |
| 18 | + assets.forEach(asset => { |
| 19 | + const name = asset.name; |
| 20 | + const lowerName = name.toLowerCase(); |
| 21 | + |
| 22 | + // Exclude the deprecated wasp.exe (small letters) |
| 23 | + if (name === 'wasp.exe') return; |
| 24 | + |
| 25 | + if (lowerName.endsWith('.exe') || lowerName.endsWith('.msi')) { |
| 26 | + winAssets.push(asset); |
| 27 | + } else if (lowerName.endsWith('.dmg') || lowerName.endsWith('.pkg') || (lowerName.endsWith('.zip') && lowerName.includes('macos'))) { |
| 28 | + macAssets.push(asset); |
| 29 | + } else if (lowerName.endsWith('.appimage') || lowerName.endsWith('.deb') || lowerName.endsWith('.rpm')) { |
| 30 | + linuxAssets.push(asset); |
| 31 | + } |
| 32 | + }); |
| 33 | + |
| 34 | + // Helper to render buttons |
| 35 | + function renderButtons(containerId, metaId, platformAssets, defaultUrl) { |
| 36 | + const container = $(`#${containerId}`).empty(); |
| 37 | + if (platformAssets.length > 0) { |
| 38 | + platformAssets.forEach(a => { |
| 39 | + let label = a.name.split('.').pop().toUpperCase(); |
| 40 | + // Special handling for long extensions |
| 41 | + if (label === 'APPIMAGE') label = 'AppImage'; |
| 42 | + container.append(`<a href="${a.browser_download_url}" class="btn btn-terminal btn-download flex-fill text-nowrap">${label}</a>`); |
| 43 | + }); |
| 44 | + $(`#${metaId}`).text(platformAssets[0].name.split('-')[0] || 'Available Now'); |
| 45 | + } else { |
| 46 | + container.append(`<a href="${defaultUrl}" class="btn btn-terminal btn-download w-100">View Release</a>`); |
| 47 | + } |
| 48 | + } |
| 49 | + |
| 50 | + // --- WINDOWS --- |
| 51 | + winAssets.sort((a, b) => (a.name.includes('WASP') ? -1 : 1)); |
| 52 | + renderButtons('win-download-container', 'win-meta', winAssets, data.html_url); |
| 53 | + |
| 54 | + // --- macOS --- |
| 55 | + macAssets.sort((a, b) => (a.name.endsWith('.dmg') ? -1 : 1)); |
| 56 | + renderButtons('mac-download-container', 'mac-meta', macAssets, data.html_url); |
| 57 | + |
| 58 | + // --- LINUX --- |
| 59 | + linuxAssets.sort((a, b) => (a.name.endsWith('.AppImage') ? -1 : 1)); |
| 60 | + renderButtons('linux-download-container', 'linux-meta', linuxAssets, data.html_url); |
| 61 | + |
| 62 | + // Update Global Version |
| 63 | + $('#wasp-brand-text').html(`<i class="fas fa-bug"></i> WASP_${version}`); |
| 64 | + $('#latest-version-text').text(`Windows (${version})`); |
| 65 | + $('#mac-version-text').text(`macOS (${version})`); |
| 66 | + $('#linux-version-text').text(`Linux (${version})`); |
| 67 | + $('#download-zip').attr('href', zipUrl); |
| 68 | + |
| 69 | + console.log(`%c [SYSTEM] Assets synchronized for ${version}`, "color: #00ff41;"); |
| 70 | + }).fail(function () { |
| 71 | + console.error("Failed to fetch latest release from GitHub API."); |
| 72 | + }); |
| 73 | + } |
| 74 | + |
| 75 | + fetchLatestRelease(); |
| 76 | + |
| 77 | + // Typewriter effect for Hero Title |
| 78 | + const heroTitle = "W.A.S.P."; |
| 79 | + const heroH1 = $(".glitch"); |
| 80 | + let i = 0; |
| 81 | + |
| 82 | + function typeWriter() { |
| 83 | + if (i < heroTitle.length) { |
| 84 | + heroH1.text(heroTitle.substring(0, i + 1)); |
| 85 | + i++; |
| 86 | + setTimeout(typeWriter, 150); |
| 87 | + } |
| 88 | + } |
| 89 | + |
| 90 | + // Start typewriter after a small delay |
| 91 | + setTimeout(typeWriter, 500); |
| 92 | + |
| 93 | + // Smooth Scrolling for nav links |
| 94 | + $('a.nav-link, a.btn-terminal').on('click', function (event) { |
| 95 | + if (this.hash !== "") { |
| 96 | + event.preventDefault(); |
| 97 | + var hash = this.hash; |
| 98 | + $('html, body').animate({ |
| 99 | + scrollTop: $(hash).offset().top - 80 |
| 100 | + }, 800); |
| 101 | + } |
| 102 | + }); |
| 103 | + |
| 104 | + // Random Console Interactions |
| 105 | + const messages = [ |
| 106 | + "Status: HR is suspicious but has no evidence.", |
| 107 | + "Status: Cursor moved 4,203 miles today.", |
| 108 | + "Status: Simulated 4 meetings while you were at the gym.", |
| 109 | + "Status: Keyboard active. Keystroke: 'ASDFGHJKL'", |
| 110 | + "Status: Stealth mode engaged. You are a shadow." |
| 111 | + ]; |
| 112 | + |
| 113 | + setInterval(() => { |
| 114 | + const randomMsg = messages[Math.floor(Math.random() * messages.length)]; |
| 115 | + const newLine = $('<div class="text-secondary mb-2">> ' + randomMsg + '</div>'); |
| 116 | + $('#hero-console').append(newLine); |
| 117 | + |
| 118 | + // Keep only last 6 lines |
| 119 | + if ($('#hero-console div').length > 6) { |
| 120 | + $('#hero-console div').first().remove(); |
| 121 | + } |
| 122 | + }, 5000); |
| 123 | + |
| 124 | + // Add glitch effect on hover for feature cards |
| 125 | + $('.feature-card').hover( |
| 126 | + function () { |
| 127 | + $(this).css('border-color', '#00ff41'); |
| 128 | + }, function () { |
| 129 | + $(this).css('border-color', 'rgba(0, 255, 65, 0.1)'); |
| 130 | + } |
| 131 | + ); |
| 132 | + |
| 133 | + // Easter Egg: Console Log |
| 134 | + console.log("%c WASP INITIALIZED ", "background: #000; color: #00ff41; font-size: 20px; font-weight: bold;"); |
| 135 | + console.log("If you're reading this, you're either a developer or HR. If you're HR, move along, nothing to see here."); |
| 136 | + |
| 137 | +}); |
0 commit comments