-
Notifications
You must be signed in to change notification settings - Fork 0
/
Editor.html
364 lines (319 loc) · 11.6 KB
/
Editor.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
<!DOCTYPE html>
<html lang="en">
<head>
<!-- ad sense tag-->
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-1733919132650092"
crossorigin="anonymous"></script>
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-FBJL1SB5QM"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag() { dataLayer.push(arguments); }
gtag('js', new Date());
gtag('config', 'G-FBJL1SB5QM');
</script>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description"
content="CodingNation is a comprehensive code tutorial website, providing beginner to advanced coding tutorials, coding exercises, and coding challenges to help you learn to code and build your skills.">
<meta name="keywords"
content="Code Editor, online code editor, html editor, coding quiz,coding, programming, tutorial, learn, HTML, CSS, JavaScript, Python, resources, free, code tutorial, coding exercises, coding challenges, learn to code, coding skills">
<meta name="author" content="coding-nation">
<meta name="description"
content="Coding Nation is a website that provides a wide range of coding resources, tutorials, and articles for programmers of all levels. Join our community and enhance your coding skills.">
<meta name="robots" content="index, follow">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="icon" type="image/png" sizes="32x32" href="../images/favicon.png">
<!-- Latest compiled and minified CSS -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css" rel="stylesheet" />
<!-- Latest compiled JavaScript -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.bundle.min.js"></script>
<link href="https://unpkg.com/boxicons@2.1.4/css/boxicons.min.css" rel="stylesheet" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.3/jquery.min.js"></script>
<link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.7.2/font/bootstrap-icons.css" rel="stylesheet" />
<!-- <link rel="stylesheet" href="./Notes.css" /> -->
<script>
function changeTitle(newTitle) {
document.title = newTitle;
}
</script>
<title>Code Editor | coding-nation</title>
<style>
@import url(https://fonts.googleapis.com/css?family=Poppins:100,100italic,200,200italic,300,300italic,regular,italic,500,500italic,600,600italic,700,700italic,800,800italic,900,900italic);
*,
html,
body {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: "poppins";
}
nav {
max-width: 100vw;
border: 2px solid #7e22ce;
border-radius: 5px;
font-weight: bold;
font-family: "Franklin Gothic Medium", "Arial Narrow", Arial, sans-serif;
}
a {
text-decoration: none;
color: black;
}
.navbar-nav {
animation-name: fadeIn;
animation-duration: 1s;
animation-timing-function: ease-in-out;
}
.navbar-brand {
font-size: 30px;
float: left;
font-family: "Franklin Gothic Medium", "Arial Narrow", Arial, sans-serif;
font-weight: bold;
}
/*navigation fields hover animation*/
nav li a:before {
content: "";
position: absolute;
bottom: 0;
left: 0;
width: 0;
height: 2px;
background: #ffffff;
border-radius: 12px;
transform-origin: right;
transition: all 0.4s ease;
}
nav li a:hover:before {
width: 100%;
}
nav li.center a:before {
left: 50%;
transform: translateX(-50%);
}
nav li.upward a:before {
width: 100%;
bottom: -5px;
opacity: 0;
}
nav li.upward a:hover:before {
bottom: 0px;
opacity: 1;
}
nav li.forward a:before {
width: 100%;
transform: scaleX(0);
transform-origin: right;
transition: transform 0.1s ease;
}
nav li.forward a:hover:before {
transform: scaleX(1);
transform-origin: left;
}
.nav-link {
color: #fff !important;
font-weight: bold;
letter-spacing: 1px;
margin: 0 10px;
}
.nav-link:hover {
color: #ffc107 !important;
transform: translateY(-3px);
}
#editor {
display: flex;
flex-direction: row;
gap: 0.8rem;
min-height: 90vh;
width: 100%;
max-width: 2000px;
caret-color: rgb(255, 0, 0);
margin-right: 15px;
margin-top: 40px;
}
#code {
flex: 1;
overflow-y: auto;
padding: 10px;
font-size: 16px;
line-height: 1.5;
resize: none;
margin-top: 50px;
border-top: 25px solid #3a3b3d;
border-radius: 5px;
}
#preview {
flex: 1;
border: none;
overflow-y: auto;
margin-top: 50px;
margin-right: 6px;
border-top: 25px solid #3a3b3d;
border-radius: 5px;
box-shadow: 0 6px 12px #3a3b3d;
}
@media only screen and (max-width: 768px) {
#editor {
display: flex;
flex-direction: column;
height: 100vh;
overflow-y: scroll;
width: 100%;
max-width: 2000px;
caret-color: rgb(255, 0, 0);
margin-right: 15px;
margin-top: 40px;
}
#code {
flex: 1;
padding: 10px;
font-size: 16px;
line-height: 1.5;
resize: none;
margin-top: 50px;
border-top: 25px solid #3a3b3d;
border-radius: 5px;
}
#preview {
flex: 1;
border: none;
box-shadow: none;
margin-top: -10px;
}
.navbar-brand {
font-size: 25px;
}
}
</style>
</head>
<body>
<div class="container-fluid">
<div class="row">
<!--navigation bar-->
<header class="fixed-navbar">
<nav class="navbar navbar-expand-md navbar-dark bg-dark fixed-top">
<div class="container-fluid">
<a class="navbar-brand" href="../index.html">CodingNation</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav"
aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav ms-auto" id="navbarNavLinks">
<li class="nav-item">
<a class="nav-link" href="../index.html">Home</a>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown"
aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">Courses</a>
<ul class="dropdown-menu">
<li>
<a class="dropdown-item" href="../Python.html">Python</a>
</li>
<li>
<a class="dropdown-item" href="../React.html">React JS</a>
</li>
<li>
<a class="dropdown-item" href="../html.html">HTML</a>
</li>
<li><a class="dropdown-item" href="../css.html">CSS</a></li>
<li>
<a class="dropdown-item" href="../jascri.html">JavaScript</a>
</li>
<li><a class="dropdown-item" href="../cpro.html">C</a></li>
<li>
<a class="dropdown-item" href="../java.html">Java</a>
</li>
<li><a class="dropdown-item" href="../php.html">PHP</a></li>
</ul>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown">Practice</a>
<ul class="dropdown-menu">
<li>
<a class="dropdown-item" href="../HTMLQuiz.html" target="_blank">HTML
Quiz</a>
</li>
<li>
<a class="dropdown-item" href="../CSSQuiz.html" target="_blank">CSS
Quiz</a>
</li>
<li>
<a class="dropdown-item" href="../JSQuiz.html" target="_blank">JavaScript
Quiz</a>
</li>
<li>
<a class="dropdown-item" href="../CQuiz.html" target="_blank">C Quiz</a>
</li>
<li>
<a class="dropdown-item" href="../JAVAQuiz.html" target="_blank">Java
Quiz</a>
</li>
</ul>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" role="button"
data-bs-toggle="dropdown">Exercises</a>
<ul class="dropdown-menu">
<li>
<a class="dropdown-item" href="../HTMLExer.html" target="_blank">HTML Exercise</a>
</li>
<li>
<a class="dropdown-item" href="../CSSExer.html" target="_blank">CSS Exercise</a>
</li>
<li>
<a class="dropdown-item" href="../JsExer.html" target="_blank">JavaScript
Exercise</a>
</li>
<li>
<a class="dropdown-item" href="../CExer.html" target="_blank">C Exercise</a>
</li>
<li>
<a class="dropdown-item" href="../JAVAExer.html" target="_blank">Java Exercise</a>
</li>
</ul>
</li>
<li class="nav-item">
<a class="nav-link" href="../codebot.html" target="_blank">CodeBot</a>
</li>
<li class="nav-item">
<a class="nav-link" href="../Editor.html" target="_blank">Editor</a>
</li>
<li class="nav-item">
<a class="nav-link" href="../About.html">About</a>
</li>
</ul>
</div>
</div>
</nav>
</header>
</div>
<div id="editor" class="col-lg-6 ">
<textarea id="code" autofocus></textarea>
<iframe id="preview"></iframe>
</div>
<script>
// Get the necessary elements
const codeEditor = document.getElementById("editor");
const codeInput = document.getElementById("code");
const previewPane = document.getElementById("preview");
// Update the preview pane on input change
codeInput.addEventListener("input", () => {
previewPane.srcdoc = codeInput.value; // Use srcdoc instead of contentDocument
});
// Set initial code in textarea and preview pane
codeInput.value = `<!DOCTYPE html>
<html>
<head>
<title>Preview</title>
<style>
</style>
</head>
<body>
<h1>Welcome to my preview!</h1>
<p>Enter your HTML code in the editor on the left and see it update here in real-time.</p>
</body>
</html>`;
previewPane.srcdoc = codeInput.value; // Use srcdoc instead of contentDocument
</script>
</body>
</html>