-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
265 lines (232 loc) · 8.77 KB
/
index.html
File metadata and controls
265 lines (232 loc) · 8.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
<!DOCTYPE html>
<html>
<meta charset="UTF-8">
<head>
<title>STL Gcode Viewer</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css">
<style>
body {
margin: 0;
overflow: hidden;
background: black;
}
canvas {
width: 100%;
height: 100%;
border: '1px solid blue';
}
.highlighted-line {
background-color: yellow;
/* 背景颜色 */
color: black;
/* 文本颜色 */
font-weight: bold;
/* 文本粗细 */
}
#backIcon {
transform: rotate(180deg);
}
#menu {
display: flex;
flex-wrap: wrap;
justify-content: flex-start;
width: 100vh;
left: 0%;
}
#cordinates {
color: antiquewhite;
display: flex;
/* background:black; */
/* border: 1px solid white; */
height: 30%;
flex-direction: column;
justify-content: space-evenly;
position: absolute;
right: 0;
bottom: 0;
width: 10%;
z-index: 101;
padding: 1%;
text-shadow: gray 0.2em 0.1em 0.2em;
}
#divider {
cursor: col-resize;
}
#codeEditor {
height: 95vh;
}
button {
flex-basis: 14vw;
/*margin: 1vw;*/
overflow: hidden;
font-size: 1.5vh;
padding-top: 0.25vh;
padding-bottom: 0.25vh;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
i {
margin-right: 0.5vw;
}
/*for high light gcode*/
.tag {
color: rgb(105, 219, 77);
/* 浅绿色 */
}
.string {
color: purple;
/* 浅紫色 */
}
.coordinate-name {
color: white;
/* 白色 */
}
.coordinate-value {
color: rgb(236, 146, 146);
/* 浅红色 */
}
.meta {
color: gray;
/* 灰色 */
}
#myDiv {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 90%;
height: auto;
/* background-color: lightgray; */
/* display: block; */
z-index: 100;
display: none;
justify-content: center;
align-items: center;
}
#myDiv img {
max-width: 100%;
height: auto;
width: 25%;
margin: 5px;
}
#imageContainer {
display: flex;
justify-content: center;
align-items: center;
}
@media (orientation: portrait) {
#imageContainer {
flex-direction: column;
}
}
@media (orientation: landscape) {
#imageContainer {
flex-direction: row;
}
}
</style>
<script>
const buttons = [
{ id: 'openText', text: { en: 'Open', cn: '打开' } },
{ id: 'saveText', text: { en: 'Save', cn: '保存' } },
{ id: 'copyText', text: { en: 'Copy Selected Code', cn: '复制选中代码' } },
{ id: 'clearText', text: { en: 'Clear', cn: '清空' } },
{ id: 'regenerateText', text: { en: 'Regenerate', cn: '重新生成' } },
{ id: 'stateShowText', text: { en: 'State Show', cn: '显示状态' } },
{ id: 'stateHideText', text: { en: 'state Hide', cn: '隐藏状态' } },
{ id: 'codeviewerText', text: { en: 'Code Viewer', cn: '代码查看器' } },
{ id: 'fullscreenText', text: { en: 'Fullscreen', cn: '全屏' } },
{ id: 'exitFullscreenText', text: { en: 'Exit Fullscreen', cn: '退出全屏' } },
{ id: 'playText', text: { en: 'Play', cn: '播放' } },
{ id: 'backText', text: { en: 'Back', cn: '后退' } },
{ id: 'donateText', text: { en: '- Support Me!-', cn: '-打赏!-' } }
];
</script>
</head>
<body>
<div id="myDiv" onclick="this.style.display = 'none'">
<a href="https://www.paypal.com/donate/?business=9PUV2MQ58PM8A&no_recurring=1&item_name=Thanks+for+supporting+my+work¤cy_code=AUD"
target="_blank" style = "color:beige; justify-content: center; display: grid; text-shadow: gray 0.1em 0.1em 0.2em;
">Buy me a coffee!</a>
<div id="imageContainer">
<img src="./alipay.jpg" alt="Image 1">
<img src="./paypal.jpg" alt="Image 2">
<img src="./wechat.png" alt="Image 3">
</div>
</div>
<div id="menu">
<button id="open" onclick="bt_open()"><i class="fa fa-folder-open"></i><span id="openText">open</span></button>
<button id="save" onclick="bt_save()"><i class="fa fa-save"></i><span id="saveText">save</span></button>
<button id="copy" onclick="bt_copy()"><i class="fa fa-copy"></i><span id="copyText">Copy Selected
Code</span></button>
<button id="clear" onclick="bt_clear()"><i class="fa fa-trash"></i><span id="clearText">clear</span></button>
<button id="regenerate" onclick="bt_regenerate()"><i class="fa fa-redo"></i><span
id="regenerateText">regenerate</span></button>
<button id="state" onclick="bt_state()"><i class="fa fa-tachometer-alt"></i><span
id="stateShowText">stateShow</span></button>
<button id="codeviewer" onclick="bt_codeviewer()"><i class="fa fa-code"></i><span
id="codeviewerText">codeviewer</span></button>
<button id="fullscreen" onclick="bt_fullscreen()"><i class="fa fa-expand"></i><span
id="fullscreenText">fullscreen</span></button>
<button id="play" onclick="play_pause()"><i class="fa fa-play"></i><span id="playText">play</span></button>
<button id="back" onclick="back_pause()"><i class="fa fa-play" id="backIcon"></i><span
id="backText">back</span></button>
<button id="jumpto" onclick="bt_jump()"><i class="fa fa-hand-o-right" aria-hidden="true" id="jumpIcon"></i><span
id="jumpText">Jump to</span></button>
<button id="cuthere" onclick="bt_cut()"><i class="fa fa-cut" id="cutIcon"></i><span
id="cutText">Cut here</span></button>
<button id="github" onclick="window.open('https://github.com/leoncoolmoon/gCodeViewer/')">
<i class="fab fa-github"></i><span id="githubText">Github</span> </button>
<button id="donate" style="background-color: gold;"
onclick="document.getElementById('myDiv').style.display = 'block'"><i class="
fa fa-heart"></i><span id="donateText">-
Support Me!</span></button>
<!--
<label for="toolDiameter">toolDiameter(mm):</label>
<input type="number" id="toolDiameter" value="2.5" step="0.1" min="0.1" max="1" onchange="toolDiameterChange()">
<label for="toolType">toolType:</label>
<select id="toolType" onchange="toolTypeChange()">
<option value="add">3D printer</option>
<option value="remove" selected>CNC</option>
</select>
<button id="simulate" onclick="bt_simulate()">simulate</button>
-->
</div>
<div>
<div id="3dViewer"></div>
<div id="cordinates" >
<div id="x" style="color: #f7abab;">X: 0</div>
<div id="y" style="color: #abf7ab;">Y: 0</div>
<div id="z" style="color: #ababf7;">Z: 0</div>
<div id="e" style="color: #e2abf7;">E: 0</div>
<div id="a" style="color: #ecf7ab;">A: 0</div>
</div>
<div id="codeViewer">
<div id="codeEditor">
<textarea id='txar'>code will be displaied here</textarea>
</div>
</div>
<div id="divider"></div>
</div>
</body>
<script>
// 检查浏览器语言
const isChinese = navigator.language.startsWith('zh');
// 更新按钮文本
buttons.forEach(button => {
const btn = document.getElementById(button.id);
if (btn) {
btn.textContent = isChinese ? button.text.cn : button.text.en;
}
});
</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/110/three.min.js"></script>
<script src="https://cdn.rawgit.com/mrdoob/three.js/r110/examples/js/loaders/STLLoader.js"></script>
<script src="OrbitControls.js"></script>
<script src="stats.min.js"></script>
<link rel="stylesheet" href="codemirror.css" />
<script src="codemirror.js"></script>
<script src="gcode_mode.js"></script>
<script src="script.js"></script>
</html>