1// çªå£ç®¡çå¨ - windowManager.js 2 3// æå¼çªå£ 4function openWindow(windowName) { 5 const window = document.getElementById(windowName + '-window'); 6 const taskbarItem = document.getElementById(windowName + '-taskbar'); 7 8 if (window) { 9 window.style.display = 'block'; 10 if (taskbarItem) { 11 taskbarItem.style.display = 'flex'; 12 } 13 focusWindow(windowName); 14 bringToFront(window); 15 16 // åå§åç¹å®çªå£çå 容 17 switch(windowName) { 18 case 'snake': 19 if (typeof initSnakeGame === 'function') initSnakeGame(); 20 break; 21 case 'calculator': 22 if (typeof initCalculator === 'function') initCalculator(); 23 break; 24 case 'album': 25 if (typeof initAlbum === 'function') initAlbum(); 26 break; 27 case 'practice': 28 if (typeof initPractice === 'function') initPractice(); 29 break; 30 case 'minesweeper': 31 if (typeof initMinesweeper === 'function') initMinesweeper(); 32 break; 33 case 'tetris': 34 if (typeof initTetris === 'function') initTetris(); 35 break; 36 case 'piano': 37 if (typeof initPiano === 'function') initPiano(); 38 break; 39 case 'compressor': 40 if (typeof initImageCompressor === 'function') initImageCompressor(); 41 break; 42 case 'ie': 43 if (typeof initIE === 'function') initIE(); 44 break; 45 case 'bookmarks': 46 if (typeof initBookmarks === 'function') initBookmarks(); 47 break; 48 49 case 'design': 50 if (typeof initDesign === 'function') initDesign(); 51 break; 52 case '2048': 53 if (typeof init2048 === 'function') init2048(); 54 break; 55 case 'space-invaders': 56 if (typeof initSpaceInvaders === 'function') initSpaceInvaders(); 57 break; 58 case 'thoughts': 59 if (typeof initThoughtsList === 'function') initThoughtsList(); 60 break; 61 } 62 } 63} 64 65// å ³éçªå£ 66function closeWindow(windowName) { 67 const window = document.getElementById(windowName + '-window'); 68 const taskbarItem = document.getElementById(windowName + '-taskbar'); 69 70 if (window) { 71 window.style.display = 'none'; 72 window.classList.remove('maximized'); 73 if (taskbarItem) { 74 taskbarItem.style.display = 'none'; 75 } 76 } 77} 78 79// æå°åçªå£ 80function minimizeWindow(windowName) { 81 const window = document.getElementById(windowName + '-window'); 82 const taskbarItem = document.getElementById(windowName + '-taskbar'); 83 84 if (window) { 85 window.style.display = 'none'; 86 window.classList.remove('maximized'); 87 if (taskbarItem) { 88 taskbarItem.style.display = 'flex'; 89 } 90 } 91} 92 93// æå¤§åçªå£ 94function maximizeWindow(windowName) { 95 const window = document.getElementById(windowName + '-window'); 96 if (window) { 97 if (window.classList.contains('maximized')) { 98 window.classList.remove('maximized'); 99 } else { 100 window.classList.add('maximized'); 101 } 102 focusWindow(windowName); 103 } 104} 105 106// èç¦çªå£ 107function focusWindow(windowName) { 108 const windows = document.querySelectorAll('.window'); 109 const taskbarItems = document.querySelectorAll('.taskbar-item'); 110 111 // éç½®ææçªå£å任塿 项ç®çç¶æ 112 windows.forEach(win => win.style.zIndex = '100'); 113 taskbarItems.forEach(item => item.classList.remove('active')); 114 115 // 设置å½åçªå£å任塿 项ç®çç¶æ 116 const currentWindow = document.getElementById(windowName + '-window'); 117 const currentTaskbarItem = document.getElementById(windowName + '-taskbar'); 118 119 if (currentWindow) { 120 currentWindow.style.zIndex = '101'; 121 currentWindow.style.display = 'block'; 122 activeWindow = windowName; 123 } 124 125 if (currentTaskbarItem) { 126 currentTaskbarItem.classList.add('active'); 127 currentTaskbarItem.style.display = 'flex'; 128 } 129} 130 131// å°çªå£å¸¦å°åé¢ 132function bringToFront(element) { 133 const windows = document.querySelectorAll('.window'); 134 windows.forEach(win => win.style.zIndex = '100'); 135 element.style.zIndex = '101'; 136} 137 138// BSOD Effect 139let bsodActive = false;
140 141function triggerBSOD() { 142 const bsod = document.getElementById('bsod'); 143 if (bsod && !bsodActive) { 144 bsodActive = true; 145 bsod.style.display = 'flex'; 146 147 // å°è¯å ¨å±ï¼å¯è½è¢«æµè§å¨é»æ¢ï¼ 148 if (document.documentElement.requestFullscreen) { 149 document.documentElement.requestFullscreen().catch(err => {}); 150 } 151 152 // å»¶è¿ 1.5 ç§åæå 许æé®/ç¹å»éå¯ï¼ç»ç¨æ·æ¶é´çèå± 153 setTimeout(() => { 154 const reloadHandler = (e) => { 155 e.preventDefault(); 156 e.stopPropagation(); 157 // éåºå ¨å± 158 if (document.fullscreenElement) { 159 document.exitFullscreen().catch(err => {}); 160 } 161 location.reload(); 162 }; 163 document.addEventListener('keydown', reloadHandler, { once: true }); 164 // ä½¿ç¨ mousedown è䏿¯ clickï¼é¿å å触å BSOD çç¹å»å²çª 165 document.addEventListener('mousedown', reloadHandler, { once: true }); 166 }, 1500); 167 } 168}
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.