Skip to content

Commit 5e2a18a

Browse files
authored
Update main.user.js
1 parent 18e8e3f commit 5e2a18a

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

main.user.js

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,49 @@
6666
}
6767
`);
6868

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);
69112
// 创建定位面板
70113
const panel = document.createElement('div');
71114
panel.className = 'earthmc-locator';

0 commit comments

Comments
 (0)