This repository was archived by the owner on Aug 13, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathhtml_compiler.html
More file actions
285 lines (225 loc) · 7.79 KB
/
html_compiler.html
File metadata and controls
285 lines (225 loc) · 7.79 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
<head>
<title>Html Compiler | Coder Helper</title>
<link rel="shortcut icon" href="img/icon.png" type="image/x-icon">
<link href='https://fonts.googleapis.com/css?family=Roboto' rel='stylesheet' type='text/css'>
<meta charset="utf-8" />
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<script type="text/javascript" src="https://code.jquery.com/jquery-1.11.3.min.js"></script>
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.css">
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/jquery-ui.min.js"></script>
<style type="text/css">
body {
color: black;
margin: 0;
padding: 0;
font-family: "Calibri Light", "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
font-weight: 300;
color: white;
}
#topbar {
height: 40px;
width: 100%;
background-color: #4775FF;
border-bottom: 1px solid grey;
}
#logo {
padding: 10px;
font-size: 18px;
font-weight: bold;
float: left;
background-color: yellow;
}
#buttonDiv {
float: right;
padding: 5px 10px 0 0;
}
#runButton {
background-color: white;
border-radius: 5px;
font-size: 100%;
font-family: "Calibri Light", "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
font-weight: bold;
position: relative;
top: 2px;
color: black;
}
#toggles {
width: 205px;
height: 27px;
margin: 0 auto;
list-style: none;
border-radius: 5px;
padding: 0;
position: relative;
top: 5px;
}
li {
float: left;
border-right: 1px solid white;
padding: 4px;
background: #3366FF;
border: 1px solid white;
text-decoration: none;
cursor: pointer;
transition: background-color 100ms linear;
}
#toggles li:nth-child(1) {
border-radius: 5px 0 0 5px;
}
#toggles li:nth-child(4) {
border-radius: 0 5px 5px 0;
}
#toggles li:nth-child(2),
li:nth-child(1),
li:nth-child(3) {
border-right: none;
}
.clear {
clear: both;
color: black;
}
.codeContainer {
width: 50%;
float: left;
position: relative;
}
.codeContainer textarea {
width: 100%;
height: 100%;
border: none;
border-right: 1px solid grey;
font-family: monospace;
font-size: 16px;
padding: 5px;
box-sizing: border-box;
}
.codeLabel {
position: absolute;
right: 10px;
bottom: 10px;
font-size: 15px;
background-color: #3366FF;
padding: 5px;
border-radius: 5px;
color: white;
}
#CSSContainer,
#JavascriptContainer {
display: none;
}
iframe {
height: 100%;
position: relative;
left: 10px;
width: 100%;
border: none;
}
.selected {
background-color: white;
transition: background-color 100ms linear;
}
.selected {
color: black;
}
</style>
</head>
<body>
<div id="wrapper">
<div id="topbar">
<div id="logo">
<a href="index.html">Вернуться на Главную (Coder Helper)</a>
</div>
<div id="buttonDiv">
<button id="runButton">Запустить код!</button>
</div>
<ul id="toggles">
<li class="toggle selected">HTML</li>
<li class="toggle">CSS</li>
<li class="toggle">Javascript</li>
<li class="toggle selected">Результат</li>
</ul>
</div>
<div class="clear">
<div class="codeContainer" id="HTMLContainer">
<div class="codeLabel">HTML</div>
<textarea id="htmlCode" placeholder="HTML">
<!--By Azer Sadykhzadeh-->
<div id="test">Добро Пожаловать на HTML/CSS/JS компилятор!</div>
<div>Нажмите на красный мячик, чтобы поменять его цвет на рандомный</div>
<div id="wrapper">
<div id="circle"></div>
</div>
<div id="note"></div>
</textarea>
</div>
<div class="codeContainer" id="CSSContainer">
<div class="codeLabel">CSS</div>
<textarea id="cssCode" placeholder="CSS">
html {
background: radial-gradient(grey, black);
color:white;
font-family: "Calibri Light", "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
padding:50px;
text-align:center;
}
#test {
font-weight:bold;
font-size:20px;
}
#wrapper {
margin:0 auto;
height:201px;
width:201px;
}
#circle {
margin-top:20px;
width:200px;
height:200px;
border-radius:100%;
background-color:red;
}
#note {
margin-top:20px;
}
</textarea>
</div>
<div class="codeContainer" id="JavascriptContainer">
<div class="codeLabel">JavaScript</div>
<textarea id="javascriptCode" placeholder="Javascript">
document.getElementById("circle").onclick=function() {
this.style.backgroundColor="#"+Math.floor(Math.random()*16777215).toString(16);
document.getElementById("note").innerHTML="Это полностью функционизированный компилятор, где ты можешь создавать, редактировать и запускать свой собственный HTML, CSS и JavaScript код.";
}
</textarea>
</div>
<div class="codeContainer" id="ResultContainer">
<div class="codeLabel">Результат</div>
<iframe id="resultFrame">
</iframe>
</div>
</div>
</div>
<script>
var windowHeight = $(window).height();
var topbarHeight = $("#topbar").height();
var codeContainerHeight = windowHeight - topbarHeight;
$(".codeContainer").height(codeContainerHeight + "px");
$(".toggle").click(function() {
$(this).toggleClass("selected");
var activeDiv = $(this).html();
//returns the value of thisli
$("#" + activeDiv + "Container").toggle();
//toggle makes the element disappear or appear
var showingDivs = $(".codeContainer").filter(function() {
return ($(this).css("display") != "none");
}).length;
var width = 100 / showingDivs;
$(".codeContainer").width(width + "%");
});
$("#runButton").click(function() {
$("iframe").contents().find("html").html('<style>' + $("#cssCode").val() + '</style>' + $("#htmlCode").val());
document.getElementById("resultFrame").contentWindow.eval($("#javascriptCode").val());
});
</script>
</body>