-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathworking.html
More file actions
432 lines (377 loc) · 13.9 KB
/
working.html
File metadata and controls
432 lines (377 loc) · 13.9 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
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
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
<!-- TODO: Selection background colours for #menu -->
<!DOCTYPE html>
<html lang="en">
<head>
<title>Reflex</title>
<style>
#haggis { grid-area: 1 / 1 / 2 / 4; }
#python { grid-area: 3 / 1 / 4 / 4; }
#menu {
grid-area: 2 / 1 / 3 / 4;
grid-template-columns: 10vh 5vh auto 15vh;
grid-template-rows: auto;
#translate svg {
transform: rotate(90deg);
}
}
body {
margin: 0;
}
#main {
display: grid;
grid-template-columns: auto 15vh auto;
grid-template-rows: 60vh 10vh 30vh;
height: 100vh;
width: 100vw;
background: rgb(40, 42, 54);
}
#haggis, #python, #fullscreen, #haggis-editor, #python-editor, #fullscreen-editor {
width: 100%;
height: 100%;
font-size: 2vh;
}
#haggis, #python {
position: relative;
}
.fullscreen {
position: absolute;
bottom: .5vh;
right: .5vh;
width: 4vh;
height: 4vh;
background: transparent;
border: .18vh solid rgb(137, 139, 152);
border-radius: 1vh;
z-index: 5;
transition: .2s;
svg {
width: 100%;
height: 100%;
path {
stroke: rgb(137, 139, 152);
}
}
&:hover {
border: .18vh solid rgb(157, 159, 172);
transform: scale(1.05);
}
&:hover svg path {
stroke: rgb(157, 159, 172);
}
}
#menu {
background: rgb(47, 49, 62);
display: grid;
position: relative;
#translate {
width: 80%;
height: 80%;
margin: auto;
border-radius: 10%;
background: #078f0a;
border: .3vh solid #00ff00;
box-shadow: 0 0 2vw -.5vw #00ff0077;
transition: .3s;
svg {
width: 100%;
height: 100%;
}
}
#translate:hover {
transform: scale(1.04);
background: #179f1a;
}
#selection {
display: flex;
align-items: center;
justify-content: center;
width: 100%;
height: 100%;
.section {
height: 10vh;
width: 10vh;
}
#from-to-icon {
width: 60%;
height: 60%;
margin: 20%;
path {
stroke: rgb(157, 159, 172);
}
}
.language {
img {
width: 80%;
height: 80%;
margin: 12% 9% 8% 11%;
}
svg {
width: 75%;
height: 75%;
margin: 12.5%;
}
}
}
#credits h2 a,
#credits p a,
#contact p a {
position: relative;
transition: .2s;
z-index: 2;
text-decoration: none;
.underline {
width: 110%;
transform: translate(-4%, 0);
height: 1px;
position: absolute;
bottom: 0;
transition: .2s;
z-index: -100;
}
&:hover {
color: rgb(47, 49, 62) !important;
.underline {
height: 100%;
}
}
}
#credits {
margin: auto 0;
padding: 0 1vh;
text-align: center;
font-family: Arial;
h2 {
font-size: 1.5vh;
line-height: 1.6vh;
font-weight: 500;
color: rgb(157, 159, 172);
a {
color: rgb(157, 159, 172);
.underline {
background: rgb(157, 159, 172);
}
}
}
p {
font-size: 1vh;
line-height: 1.1vh;
font-weight: 500;
color: rgb(97, 99, 112);
a {
color: rgb(97, 99, 112);
.underline {
background: rgb(97, 99, 112);
}
}
}
}
#contact {
padding: 1vh 0;
margin: auto 0;
box-sizing: border-box;
p {
margin: 0;
font-family: Arial;
font-size: 1.2vh;
line-height: 1.3vh;
font-weight: 500;
color: rgb(97, 99, 112);
a {
color: rgb(97, 99, 112);
.underline {
background: rgb(97, 99, 112);
}
}
}
}
#version {
position: absolute;
margin: 0;
bottom: 1vh;
left: 50%;
width: max-content;
height: 1.5vh;
line-height: 1.5vh;
font-size: 1.3vh;
font-family: Arial;
color: rgb(97, 99, 112);
transform: translateX(-50%);
}
}
.ace-dracula .ace_ecomment {
color: #ff5555 !important;
font-weight: bold;
}
.ace-dracula .ace_qcomment {
color: #5588ff !important;
font-weight: bold;
}
.ace-dracula .ace_language {
/* color: #bd93f9 !important; */
color: #997aef !important;
}
.ace-dracula .ace_reserved {
background-color: #ff005d;
}
/* .ace-dracula .ace_numeric {
color: #64a7ff !important;
} */
@media only screen and (max-width: 60vh) {
#menu {
#selection .section {
height: 13vw;
width: 13vw;
}
#contact p {
font-size: 2vw;
line-height: 2.05vw;
}
}
}
@media only screen and (min-aspect-ratio: 1/.65) {
#haggis { grid-area: 1 / 1 / 4 / 2; }
#python { grid-area: 1 / 3 / 4 / 4; }
#menu {
grid-area: 1 / 2 / 4 / 3;
grid-template-rows: 15vh 5vh auto 15vh;
grid-template-columns: 100%;
#translate {
width: 75%;
height: 75%;
svg {
transform: rotate(0deg);
}
}
#selection {
flex-direction: column;
#from-to-icon {
transform: rotate(90deg);
}
}
#credits {
h2 {
font-size: 1.8vh;
line-height: 1.9vh;
}
}
#contact {
padding: 0 1.5vh;
margin: -.5vh 0 0 0;
}
#version {
bottom: 1.3vh;
}
}
}
</style>
</head>
<body>
<div id="main">
<div id="haggis">
<div id="haggis-editor">START
RECEIVE name FROM KEYBOARD
SEND "Hello, " & name & "!" TO DISPLAY
END</div>
<button class="fullscreen" onclick="fseditor('haggis')">
<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" stroke="#ffffff"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"> <path d="M4 9V5.6C4 5.03995 4 4.75992 4.10899 4.54601C4.20487 4.35785 4.35785 4.20487 4.54601 4.109C4.75992 4 5.03995 4 5.6 4L9 4M4 15V18.4C4 18.9601 4 19.2401 4.10899 19.454C4.20487 19.6422 4.35785 19.7951 4.54601 19.891C4.75992 20 5.03995 20 5.6 20L9 20M15 4H18.4C18.9601 4 19.2401 4 19.454 4.10899C19.6422 4.20487 19.7951 4.35785 19.891 4.54601C20 4.75992 20 5.03995 20 5.6V9M20 15V18.4C20 18.9601 20 19.2401 19.891 19.454C19.7951 19.6422 19.6422 19.7951 19.454 19.891C19.2401 20 18.9601 20 18.4 20H15" stroke="#ffffff" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path> </g></svg>
</button>
</div>
<div id="menu">
<button id="translate" onclick="transpile()">
<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" stroke="#ffffff"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"> <path d="M4 12H20M20 12L16 8M20 12L16 16" stroke="#ffffff" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path> </g></svg>
</button>
<div id="contact">
<p>For any issues or inquiries, contact me <span><a style="font-weight: 500;" href="https://qwk.pythonanywhere.com/contact?ref=Reflex" target="_blank">here<span class="underline" style="width: 110%; transform: translate(-95%, 0);"></span></a></span></p>
</div>
<div id="selection">
<div class="section">
<div class="language" id="lfrom">
<img src="sqa-icon-pastel.png">
</div>
</div>
<div class="section">
<svg id="from-to-icon" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" stroke="#ffffff"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"> <path d="M4 12H20M20 12L16 8M20 12L16 16" stroke="#ffffff" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path> </g></svg>
</div>
<div class="section">
<div class="language" id="lto">
<svg viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" fill="#000000"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"><defs><linearGradient id="a" x1="-133.268" y1="-202.91" x2="-133.198" y2="-202.84" gradientTransform="translate(25243.061 38519.17) scale(189.38 189.81)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#387eb8"></stop><stop offset="1" stop-color="#366994"></stop></linearGradient><linearGradient id="b" x1="-133.575" y1="-203.203" x2="-133.495" y2="-203.133" gradientTransform="translate(25309.061 38583.42) scale(189.38 189.81)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#ffe052"></stop><stop offset="1" stop-color="#ffc331"></stop></linearGradient></defs><title>file_type_python</title><path d="M15.885,2.1c-7.1,0-6.651,3.07-6.651,3.07V8.36h6.752v1H6.545S2,8.8,2,16.005s4.013,6.912,4.013,6.912H8.33V19.556s-.13-4.013,3.9-4.013h6.762s3.772.06,3.772-3.652V5.8s.572-3.712-6.842-3.712h0ZM12.153,4.237a1.214,1.214,0,1,1-1.183,1.244v-.02a1.214,1.214,0,0,1,1.214-1.214h0Z" style="fill:url(#a)"></path><path d="M16.085,29.91c7.1,0,6.651-3.08,6.651-3.08V23.65H15.985v-1h9.47S30,23.158,30,15.995s-4.013-6.912-4.013-6.912H23.64V12.4s.13,4.013-3.9,4.013H12.975S9.2,16.356,9.2,20.068V26.2s-.572,3.712,6.842,3.712h.04Zm3.732-2.147A1.214,1.214,0,1,1,21,26.519v.03a1.214,1.214,0,0,1-1.214,1.214h.03Z" style="fill:url(#b)"></path></g></svg>
</div>
</div>
</div>
<div id="credits">
<h2>Made by <span><a style="font-weight: 500;" href="https://qwkdev.github.io" target="_blank">qwk<span class="underline" style="width: 110%; transform: translate(-95%, 0);"></span></a></span></h2>
<p>Powered by <span><a style="font-weight: 500;" href="https://pages.github.com/" target="_blank">GitHub Pages<span class="underline" style="width: 105%; transform: translate(-96.5%, 0);"></span></a></span>, <span><a style="font-weight: 500;" href="https://www.pythonanywhere.com/" target="_blank">PythonAnywhere<span class="underline" style="width: 103%; transform: translate(-98%, 0);"></span></a></span>, & <span><a style="font-weight: 500;" href="https://ace.c9.io/" target="_blank">Ace<span class="underline" style="width: 112.5%; transform: translate(-95%, 0);"></span></a></span></p>
</div>
<p id="version">v1.0 Beta</p>
</div>
<div id="python">
<div id="python-editor">name = input()
print("Hello, " + name + "!")</div>
<button class="fullscreen" onclick="fseditor('python')">
<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" stroke="#ffffff"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"> <path d="M4 9V5.6C4 5.03995 4 4.75992 4.10899 4.54601C4.20487 4.35785 4.35785 4.20487 4.54601 4.109C4.75992 4 5.03995 4 5.6 4L9 4M4 15V18.4C4 18.9601 4 19.2401 4.10899 19.454C4.20487 19.6422 4.35785 19.7951 4.54601 19.891C4.75992 20 5.03995 20 5.6 20L9 20M15 4H18.4C18.9601 4 19.2401 4 19.454 4.10899C19.6422 4.20487 19.7951 4.35785 19.891 4.54601C20 4.75992 20 5.03995 20 5.6V9M20 15V18.4C20 18.9601 20 19.2401 19.891 19.454C19.7951 19.6422 19.6422 19.7951 19.454 19.891C19.2401 20 18.9601 20 18.4 20H15" stroke="#ffffff" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path> </g></svg>
</button>
</div>
</div>
<div id="fullscreen" style="display: none; position: absolute; top: 0; left: 0; z-index: 10;">
<div id="fullscreen-editor" style="position: absolute; top: 0; left: 0; z-index: 10;"></div>
<button class="fullscreen" id="fullscreen-close" style="z-index: 15;">
<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" stroke="#ffffff"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"> <path d="M9 4V9H4M15 4V9H20M4 15H9V20M15 20V15H20" stroke="#ffffff" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path> </g></svg>
</button>
</div>
<script src="ace/ace.js" type="text/javascript" charset="utf-8"></script>
<script>
var haggis = ace.edit("haggis-editor");
var python = ace.edit("python-editor");
var fullscreen_editor = ace.edit("fullscreen-editor");
haggis.setTheme("ace/theme/dracula");
python.setTheme("ace/theme/dracula");
fullscreen_editor.setTheme("ace/theme/dracula");
haggis.setShowPrintMargin(false);
python.setShowPrintMargin(false);
fullscreen_editor.setShowPrintMargin(false);
haggis.session.setMode("ace/mode/haggis");
python.session.setMode("ace/mode/python");
function fseditor(id) {
var fs = document.querySelector('#fullscreen');
fullscreen_editor.session.setMode(`ace/mode/${id}`);
if (fs.style.display == 'none') {
fs.style.display = 'block';
fullscreen_editor.setValue(id == 'haggis' ? haggis.getValue() : python.getValue(), -1);
fullscreen_editor.moveCursorToPosition(id == 'haggis' ? haggis.getCursorPosition() : python.getCursorPosition());
document.querySelector('#fullscreen-close').onclick = ( function(value) {
return function() {
fseditor(value);
};
} )(id);
} else {
fs.style.display = 'none';
if (id == 'haggis') {
haggis.setValue(fullscreen_editor.getValue(), -1);
haggis.moveCursorToPosition(fullscreen_editor.getCursorPosition());
} else {
python.setValue(fullscreen_editor.getValue(), -1);
python.moveCursorToPosition(fullscreen_editor.getCursorPosition());
}
}
}
function transpile() {
let code = haggis.getValue();
fetch('https://rlx.pythonanywhere.com/api/transpile/haggis-to-python', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({ code: code })
})
.then(response => response.json())
.then(data => {
python.setValue(data.code, -1);
})
.catch(error => {
console.error('Error:', error);
python.setValue(`#! ERROR:\n#! ${error}`, -1);
});
}
</script>
</body>
</html>