forked from chromoxdor/EasyColorCode
-
Notifications
You must be signed in to change notification settings - Fork 0
/
colorcode.html
375 lines (337 loc) · 11.1 KB
/
colorcode.html
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
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/chromoxdor/EasyColorCode/codemirror.min.css">
<script src="https://cdn.jsdelivr.net/gh/chromoxdor/EasyColorCode/codemirror.min.js"></script>
<script src="https://cdn.jsdelivr.net/gh/chromoxdor/EasyColorCode/espeasy.min.js"></script>
<script src="https://cdn.jsdelivr.net/gh/chromoxdor/EasyColorCode/cm-plugins.min.js" id="anyword"></script>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="icon"
href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='44' height='44'%3E%3Crect x='0' y='0' rx='6' ry='6' width='44' height='44' style='fill:%233c3c3b' transform='rotate(0 14 20)'/%3E%3Cg transform='rotate(45 26 23)'%3E%3Crect x='4' y='15' rx='2' ry='2' width='4' height='20' style='fill:%2325a843' /%3E%3Crect x='12' y='7.5' rx='2' ry='2' width='4' height='35' style='fill:%23ffd103'/%3E%3Crect x='20' y='0' rx='2' ry='2' width='4' height='50' style='fill:%23f28d22' /%3E%3Crect x='28' y='7.5' rx='2' ry='2' width='4' height='35' style='fill:%23e9493e'/%3E%3Ccircle cx='41' cy='25' r='5' fill='white' /%3E%3C/g%3E%3C/svg%3E"
type="image/svg+xml">
<title>ESPeasy</title>
<style media="screen">
body {
height: 100vh;
margin: 0;
display: flex;
align-items: center;
justify-content: center;
background-color: #44607a;
font-size: 12pt;
font-family: "Kanit", Verdana, Arial, sans-serif;
}
* {
box-sizing: border-box;
}
.CodeMirror {
border-radius: 0px 0px 10px 10px;
}
div#framie {
height: 100%;
transition: 0.8s;
padding-bottom: 60px;
}
iframe {
width: 100%;
height: 100%;
border: 0px;
transition: 2s;
background-color: white;
box-shadow: 4px 0px 13px -7px #000000;
}
#container {
width: 100%;
max-width: 900px;
background: #f0f0f0;
box-shadow: 0px 0px 15px 5px rgb(0 0 0 / 29%);
overflow: hidden;
border-radius: 10px;
}
h1 {
color: #44607a;
font-size: 30px;
width: 100%;
text-align: center;
text-transform: uppercase;
}
#rules {
width: inherit;
min-height: 400px;
}
#text {
display: block;
width: 100%;
background-color: transparent;
color: #021652;
border: 2px solid #44607a;
border-radius: 2px;
resize: none;
margin-bottom: 35px;
height: 500px;
padding: 10px;
font-size: 20px;
}
.shortcut {
font-size: 20px;
}
.subtext {
font-size: 14px;
}
.sidenav {
height: 71vh;
padding: 4vw 0 3vw 0;
min-width: 0;
width: 0;
transition: 0.8s;
display: flex;
flex-direction: column;
flex-wrap: nowrap;
justify-content: flex-start;
cursor: ns-resize;
overflow: scroll;
-ms-overflow-style: none;
scrollbar-width: none;
overflow-y: scroll;
background-image: linear-gradient(#45607a 0%, #ff000000 5%, #ff000000 95%, #45607a 100%);
}
.sidenav::-webkit-scrollbar {
display: none;
/* for Chrome, Safari, and Opera */
}
#scrolldown {
position: fixed;
padding-left: 3%;
top: 85vh;
transition: 0.2s;
font-size: 30px;
display: flex;
align-items: flex-start;
justify-content: flex-start;
}
#menueList {
transition: 0.2s;
}
.sidenav div {
width: 235px;
text-decoration: none;
color: inherit;
}
.menueItem {
padding: 10px;
}
#opener {
bottom: 0;
z-index: 2;
height: 60px;
width: 100%;
position: fixed;
padding-top: 10px;
}
.open {
background: none;
display: flex;
max-width: 200px;
align-items: center;
margin: auto;
justify-content: space-between;
}
.msym {
position: relative;
height: 35px;
width: 35px;
background-color: #f0f0f0;
border-radius: 50%;
font-family: monospace;
display: flex;
align-items: center;
font-size: 30px;
cursor: pointer;
justify-content: center;
box-shadow: 0px 0px 15px 5px rgb(0 0 0 / 29%);
transition-duration: 0.4s;
-webkit-transition-duration: 0.4s;
/* Safari */
}
.msym:after {
content: "";
display: block;
position: absolute;
border-radius: 50%;
left: 0;
top: 0;
width: 100%;
height: 100%;
opacity: 0;
transition: all 0.5s;
box-shadow: 0 0 10px 20px rgb(255, 255, 255);
}
.msym:active:after {
box-shadow: 0 0 0 0 rgb(255, 255, 255);
position: absolute;
border-radius: 50%;
left: 0;
top: 0;
opacity: 1;
transition: 0s;
}
.msym:active {
top: 1px;
}
#menueList {
color: transparent;
}
@media screen and (max-width: 799px) {
div#framie {
position: absolute;
padding-left: 0px !important;
}
}
@media screen and (max-width: 450px) {
h1 {
font-size: 18px;
white-space: nowrap;
}
body {
align-items: flex-start;
}
}
</style>
</head>
<body>
<div id="mySidenav" class="sidenav">
<div id="menueList">
<div id="scrolldown">▼</div>
<div class="menueItem">
<div class="shortcut">Type "on" then Enter <div class="subtext">Autocomplete the Rules Block (you can also
complete after "do" + Enter)</div>
</div>
</div>
<div class="menueItem">
<div class="shortcut">Type "if" then Enter<div class="subtext">Autocompletes the if statement</div>
</div>
</div>
<div class="menueItem">
<div class="shortcut">Ctrl+Space<div class="subtext">Opens the list of hints</div>
</div>
</div>
<div class="menueItem">
<div class="shortcut">Ctrl+S / Cmd+S<div class="subtext">Save content as textfile</div>
</div>
</div>
<div class="menueItem">
<div class="shortcut">Tab<div class="subtext">If something is selected, indent it by one indent unit. If nothing
is selected, insert space</div>
</div>
</div>
<div class="menueItem">
<div class="shortcut">Shift+Tab<div class="subtext">Dedent the current line or selection by one indent unit
</div>
</div>
</div>
<div class="menueItem">
<div class="shortcut">Ctrl+D / Cmd+D<div class="subtext">Delete line under cursor</div>
</div>
</div>
<div class="menueItem">
<div class="shortcut">Ctrl+F / Cmd+F<div class="subtext">Find</div>
</div>
</div>
<div class="menueItem">
<div class="shortcut">Ctrl+G / Cmd+G<div class="subtext">Find next</div>
</div>
</div>
<div class="menueItem">
<div class="shortcut">Shift+Ctrl+G / Shift+Cmd+G<div class="subtext">Find previous</div>
</div>
</div>
<div class="menueItem">
<div class="shortcut">Shift+Ctrl+F / Cmd+Option+F<div class="subtext">Replace</div>
</div>
</div>
<div class="menueItem">
<div class="shortcut">Shift+Ctrl+R / Shift+Cmd+Option+F<div class="subtext">Replace all</div>
</div>
</div>
<div class="menueItem">
<div class="shortcut">
<div class="subtext">more shortcuts can be found <a class="link"
href="https://defkey.com/codemirror-shortcuts" target="_blank">here</a>
</div>
</div>
</div>
</div>
</div>
<div id="container">
<h1>ESPEasy Code Editor</h1>
<textarea placeholder="Type your text here..." id="rules"></textarea>
</div>
<div id="framie"></div>
<div id="opener">
<div class="open">
<span class="msym" onclick="openNav()">?</span>
<span class="msym" onclick="splitOn(); topF()">i</span>
</div>
</div>
<script>
function openNav() {
if (document.getElementById('mySidenav').offsetWidth === 0) {
document.getElementById("menueList").style.transitionDelay = "0.5s";
document.getElementById("mySidenav").style.minWidth = "280px";
//document.getElementById("scrolldown").style.color = "white";
//document.getElementById("scrolldown").style.transitionDelay = "0.5s";
document.getElementById("menueList").style.color = "white";
} else { closeNav(); }
}
function closeNav() {
document.getElementById("menueList").style.transitionDelay = "0s";
document.getElementById("mySidenav").style.minWidth = "0";
//document.getElementById("scrolldown").style.color = "transparent";
//document.getElementById("scrolldown").style.transitionDelay = "0s";
document.getElementById("menueList").style.color = "transparent";
topF();
}
/*document.addEventListener("mousedown", function (event) {
if (document.getElementById('mySidenav').offsetWidth > 0)
closeNav();
});*/
/*document.addEventListener("touchstart", function (event) {
if (document.getElementById('mySidenav').offsetWidth > 0)
closeNav();
});*/
function splitOn() {
if (document.getElementById('framie').offsetWidth <= 10) { isOpen = 1; iFr(isOpen); document.getElementById('framie').style.width = "100%"; document.getElementById('framie').style.paddingLeft = "10px"; }
else { document.getElementById('framie').style.width = "0"; document.getElementById('framie').innerHTML = ""; isOpen = 0; document.getElementById('framie').style.paddingLeft = "0px"; }
}
function iFr() { if (isOpen === 1) { document.getElementById('framie').innerHTML = '<iframe src="https://espeasy.readthedocs.io/en/latest/Rules/Rules.html"></iframe>'; closeNav(); } }
function topF() { document.getElementById('mySidenav').scrollTo({ top: 0, behavior: 'smooth' }); document.body.scrollTop = 0; document.documentElement.scrollTop = 0; }
function textI() { console.log("text"); rEdit.replaceSelection('On Do \nEndon'); rEdit.execCommand('Up'); rEdit.execCommand('Enter') }
initCM();
CodeMirror.commands.save = function (editor) {
var textToWrite = editor.getValue();
var textFileAsBlob = new Blob([textToWrite], {
type: "text/plain;charset=utf-8"
});
var fileNameToSaveAs = "rules.txt";
var downloadLink = document.createElement("a");
downloadLink.download = fileNameToSaveAs;
downloadLink.innerHTML = "Download File";
if (window.webkitURL != null) {
// Chrome allows the link to be clicked
// without actually adding it to the DOM.
downloadLink.href = window.webkitURL.createObjectURL(textFileAsBlob);
} else {
// Firefox requires the link to be added to the DOM
// before it can be clicked.
downloadLink.href = window.URL.createObjectURL(textFileAsBlob);
downloadLink.onclick = destroyClickedElement;
downloadLink.style.display = "none";
document.body.appendChild(downloadLink);
}
downloadLink.click();
};
</script>
</body>
</html>