|
1 | 1 | # Welcome!
|
2 | 2 |
|
3 |
| -123123123 |
| 3 | +???+ success "🎉 恭喜! 现在你是一位 Linux 用户了!" |
| 4 | + <!-- A minimal structure for the ScreenAdapter defined in browser/screen.js --> |
| 5 | + <div id="screen_container" style="display: flex;"> |
| 6 | + <div style="white-space: pre; font: 14px monospace; line-height: 14px; margin: auto;"></div> |
| 7 | + <canvas style="display: none"></canvas> |
| 8 | + </div> |
| 9 | + |
| 10 | + 这是使用 [copy/v86](https://github.com/copy/v86) 项目运行的 [Linux](https://en.wikipedia.org/wiki/Linux) 6.8.12 内核, 使用 [Web Assembly](https://webassembly.org/) 技术在你的浏览器上运行了一个虚拟机, 并启动了极简的 [Buildroot](https://buildroot.org/) 环境. |
| 11 | + |
| 12 | + 你可以在这里尝试 Linux 常用的命令, 例如 `ls`, `cd`, `cat`, `echo`, `pwd`, `uname`, `date`, `top`, `ps`, `clear`, `exit`. |
| 13 | + |
| 14 | +<script src="/notes/javascripts/v86/libv86.js"></script> |
| 15 | +<script> |
| 16 | +"use strict"; |
| 17 | + |
| 18 | +// Save references to the original event handler methods |
| 19 | +const originalAddEventListener = window.addEventListener; |
| 20 | +const originalRemoveEventListener = window.removeEventListener; |
| 21 | + |
| 22 | +// Array to store keydown listeners |
| 23 | +const keydownListeners = []; |
| 24 | + |
| 25 | +// Override addEventListener to track keydown listeners |
| 26 | +window.addEventListener = function(type, listener, options) { |
| 27 | +originalAddEventListener.call(window, type, listener, options); |
| 28 | +if (type === 'keydown') { |
| 29 | + keydownListeners.push({ listener, options }); |
| 30 | +} |
| 31 | +}; |
| 32 | + |
| 33 | +// Override removeEventListener to update the keydown listeners list |
| 34 | +window.removeEventListener = function(type, listener, options) { |
| 35 | +originalRemoveEventListener.call(window, type, listener, options); |
| 36 | +if (type === 'keydown') { |
| 37 | + const index = keydownListeners.findIndex(entry => |
| 38 | + entry.listener === listener && |
| 39 | + (entry.options === options || |
| 40 | + (typeof entry.options === 'object' && typeof options === 'object' && |
| 41 | + JSON.stringify(entry.options) === JSON.stringify(options)))); |
| 42 | + if (index !== -1) { |
| 43 | + keydownListeners.splice(index, 1); |
| 44 | + } |
| 45 | +} |
| 46 | +}; |
| 47 | + |
| 48 | +window.onload = function() |
| 49 | +{ |
| 50 | + // Remove key listener from material mkdocs |
| 51 | + if (keydownListeners.length > 0) { |
| 52 | + const firstListener = keydownListeners.shift(); |
| 53 | + window.removeEventListener('keydown', firstListener.listener, firstListener.options); |
| 54 | + } |
| 55 | + |
| 56 | + var emulator = new V86({ |
| 57 | + wasm_path: "/notes/javascripts/v86/v86.wasm", |
| 58 | + memory_size: 512 * 1024 * 1024, |
| 59 | + vga_memory_size: 8 * 1024 * 1024, |
| 60 | + screen_container: document.getElementById("screen_container"), |
| 61 | + bios: { |
| 62 | + url: "/notes/javascripts/v86/seabios.bin", |
| 63 | + }, |
| 64 | + vga_bios: { |
| 65 | + url: "/notes/javascripts/v86/vgabios.bin", |
| 66 | + }, |
| 67 | + bzimage: { |
| 68 | + url: "/notes/javascripts/v86/buildroot-bzimage68.bin", |
| 69 | + }, |
| 70 | + autostart: true, |
| 71 | + }); |
| 72 | +}; |
| 73 | +</script> |
0 commit comments