|
66 | 66 | } |
67 | 67 | `); |
68 | 68 |
|
| 69 | + const createPanel = () => { |
| 70 | + const panel = document.createElement('div'); |
| 71 | + panel.className = 'earthmc-locator'; |
| 72 | + |
| 73 | + const title = document.createElement('h3'); |
| 74 | + title.className = 'locator-title'; |
| 75 | + title.innerHTML = '🗺 坐标定位'; // 使用HTML实体代替表情符号 |
| 76 | + |
| 77 | + const coordGroup = document.createElement('div'); |
| 78 | + coordGroup.className = 'coord-group'; |
| 79 | + |
| 80 | + const inputX = document.createElement('input'); |
| 81 | + inputX.type = 'number'; |
| 82 | + inputX.className = 'coord-input'; |
| 83 | + inputX.id = 'mcX'; |
| 84 | + inputX.placeholder = 'X 坐标'; |
| 85 | + inputX.step = 'any'; |
| 86 | + |
| 87 | + const inputZ = document.createElement('input'); |
| 88 | + inputZ.type = 'number'; |
| 89 | + inputZ.className = 'coord-input'; |
| 90 | + inputZ.id = 'mcZ'; |
| 91 | + inputZ.placeholder = 'Z 坐标'; |
| 92 | + inputZ.step = 'any'; |
| 93 | + |
| 94 | + const button = document.createElement('button'); |
| 95 | + button.className = 'locator-button'; |
| 96 | + button.id = 'mcLocate'; |
| 97 | + button.textContent = '立即定位'; |
| 98 | + |
| 99 | + // 层级组装 |
| 100 | + coordGroup.appendChild(inputX); |
| 101 | + coordGroup.appendChild(inputZ); |
| 102 | + panel.appendChild(title); |
| 103 | + panel.appendChild(coordGroup); |
| 104 | + panel.appendChild(button); |
| 105 | + |
| 106 | + return panel; |
| 107 | + }; |
| 108 | + |
| 109 | + // 插入到页面 |
| 110 | + const panel = createPanel(); |
| 111 | + document.body.appendChild(panel); |
69 | 112 | // 创建定位面板 |
70 | 113 | const panel = document.createElement('div'); |
71 | 114 | panel.className = 'earthmc-locator'; |
|
0 commit comments