-
Notifications
You must be signed in to change notification settings - Fork 0
/
html_parser.html
161 lines (150 loc) · 4.01 KB
/
html_parser.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
<!DOCTYPE html>
<head>
<link rel="stylesheet" href="main.css" />
<title>HTML parser | JavaScript stuff</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="main.js"></script>
</head>
<div class="container">
<a id="back" href="index.html">⇦ Back</a>
<h1>HTML parser</h1>
<p>
This parses html! Simply type your code in the box below and look at the
output! Also, inline styling and inline scripting works too! you can also
import external scripts!!! This is based on the
<a href="notetaking">Note-Taking web-app I made</a>.
</p>
<body onload="writeCookie()">
<form id="form1">
<div>
<textarea
onkeyup="go()"
id="input"
placeholder="Type something in here! Feel free to use HTML tags, they parse!"
></textarea>
<input id="button" type="button" value="Run!" onclick="go()" />
<br />
<p id="output">
Click the run button or start typing to see the output!
</p>
</div>
</form>
<h1>Some stuff to try:</h1>
<div class="code">
<head><br />
<style><br />
/* Feel free to add styling here */<br />
* {<br />
/* '*' means that is styles the whole page. */<br />
color: blue;<br />
/*Text color */<br />
background-color: white;<br />
/* The background color */<br />
}<br />
</style><br />
</head><br />
<br />
<body><br />
<h1>A heading</h1><br />
<p>A paragraph</p><br />
<button id='button'>A button!</button><br />
</body><br />
</div>
<h1>To reset to the defaults (without my styling)</h1>
<div class="code">@import url('defaults.css')</div>
</body>
</div>
<script>
function go() {
var c1 = document.getElementById("input").value;
var d1 = document.getElementById("output");
d1.innerHTML = c1;
}
</script>
<script>
document.addEventListener("keyup", checkCookie);
function checkCookie() {
text = document.getElementById("input").value;
localStorage.setItem("html_cookie", text);
}
function writeCookie() {
cookie = localStorage.getItem("html_cookie");
document.getElementById("input").value = cookie;
}
</script>
<style>
@import url("https://fonts.googleapis.com/css2?family=Anonymous+Pro&display=swap");
.code {
font-family: Anonymous Pro;
width: 100%;
height: 400px;
border: 2px solid var(--color);
border-radius: 10px;
}
* {
scroll-behavior: smooth;
}
button {
padding: 3px;
color: black;
}
#output {
transition: all 0.5s;
border: 2px solid var(--color);
border-radius: 10px;
margin: 0;
width: 100%;
}
textarea {
font-family: "Anonymous Pro";
width: 100%;
height: 150px;
resize: vertical;
}
* {
margin: 0;
}
</style>
<div class="se-pre-con"></div>
<style>
.no-js #loader {
display: none;
}
.js #loader {
display: block;
position: absolute;
left: 100px;
top: 0;
}
.se-pre-con {
position: fixed;
left: 0px;
top: 0px;
width: 100%;
height: 100%;
z-index: 9999;
background: url("load.svg") center no-repeat black;
}
</style>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/modernizr/2.8.3/modernizr.js"></script>
<script>
//paste this code under the head tag or in a separate js file.
// Wait for window load
$(window).load(function () {
// Animate loader off screen
$(".se-pre-con").fadeOut("slow");
});
</script>
</head>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
</head>
<script>
$("h1, h2, h3")
.css("text-align", "center")
.append(
'<hr style="height: 1px; background: linear-gradient(to right, transparent , var(--color), transparent); padding: 0px; border: none;">'
);
</script>