1/** 2 * spacewaves2.net â Homepage JavaScript 3 * 主页交äºåè½èæ¬ 4 */ 5 6'use strict'; 7 8document.addEventListener('DOMContentLoaded', function() { 9 // æµ®å¨ç®å½ / å±å¼ / å ¨å±ï¼ç±é¦é¡µ index.html å èèæ¬å¤çï¼Space Wavesï¼ 10 11 // è§é¢ææ¾åè½ 12 const videoPlaceholder = document.getElementById('video-placeholder'); 13 const gameplayVideo = document.getElementById('gameplay-video'); 14 15 if (videoPlaceholder && gameplayVideo) { 16 videoPlaceholder.addEventListener('click', function() { 17 gameplayVideo.src = 'https://www.youtube.com/embed/uEHt29gzgtI?autoplay=1&rel=0'; 18 gameplayVideo.classList.remove('hidden'); 19 videoPlaceholder.style.display = 'none'; 20 }); 21 } 22 23 // 书ç¾åè½ 24 const bookmarkBtn = document.getElementById('bookmark-btn'); 25 if (bookmarkBtn) { 26 bookmarkBtn.addEventListener('click', function(e) { 27 e.preventDefault(); 28 if (window.sidebar && window.sidebar.addPanel) { 29 window.sidebar.addPanel(document.title, window.location.href, ''); 30 } else if (window.external && ('AddFavorite' in window.external)) { 31 window.external.AddFavorite(window.location.href, document.title); 32 } else { 33 alert('Press Ctrl+D (Cmd+D on Mac) to bookmark this page!'); 34 } 35 }); 36 } 37 38 // æçº§è¯ååè½ 39 const stars = document.querySelectorAll('.star'); 40 const starsContainer = document.querySelector('.rating-row') || document.querySelector('[aria-label="Rate this game"]') || document.querySelector('[aria-label="rate this game"]'); 41 42 if (stars.length > 0 && starsContainer) { 43 function getCurrentRating() { 44 const avgRatingEl = document.getElementById('avg-rating'); 45 return avgRatingEl ? parseFloat(avgRatingEl.textContent.split('/')[0] || 0) : 0; 46 } 47 48 function resetStarsToInitialState() { 49 const avgRating = getCurrentRating(); 50 stars.forEach(star => { 51 const path = star.querySelector('path'); 52 if (path) { 53 const starValue = parseInt(star.getAttribute('data-star')); 54 if (starValue <= Math.round(avgRating)) { 55 path.setAttribute('fill', '#ef4444'); 56 path.setAttribute('stroke', '#ef4444'); 57 } else { 58 path.setAttribute('fill', 'none'); 59 path.setAttribute('stroke', 'currentColor'); 60 } 61 } 62 }); 63 } 64 65 function highlightStars(count) { 66 stars.forEach((star, index) => { 67 const path = star.querySelector('path'); 68 if (path) { 69 if (index < count) { 70 path.setAttribute('fill', '#ef4444'); 71 path.setAttribute('stroke', '#ef4444'); 72 } else { 73 path.setAttribute('fill', 'none'); 74 path.setAttribute('stroke', 'currentColor'); 75 } 76 } 77 }); 78 } 79 80 // é¼ æ æ¬åææ 81 stars.forEach((star, index) => { 82 star.addEventListener('mouseenter', function() { 83 highlightStars(index + 1); 84 }); 85 }); 86 87 starsContainer.addEventListener('mouseleave', function() { 88 resetStarsToInitialState(); 89 }); 90 91 // åå§åæçº§æ¾ç¤º 92 resetStarsToInitialState(); 93 } 94});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.