Skip to content

Commit f0dfcbb

Browse files
committed
security setup
1 parent 7d51f8f commit f0dfcbb

File tree

4 files changed

+7413
-0
lines changed

4 files changed

+7413
-0
lines changed

exercises/81 - Security/index.html

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
4+
<head>
5+
<meta charset="UTF-8">
6+
<meta name="viewport" content="width=device-width,initial-scale=1.0">
7+
<title>Nasty!</title>
8+
<link rel="stylesheet" href="../../base.css">
9+
10+
<style>
11+
body {
12+
display: grid;
13+
grid-template-rows: auto 1fr;
14+
min-height: 100vh;
15+
}
16+
17+
.app {
18+
display: grid;
19+
grid-template-columns: 1fr 1fr;
20+
}
21+
22+
nav {
23+
display: flex;
24+
}
25+
26+
nav>* {
27+
flex: 1;
28+
border: 5px solid black;
29+
margin: 5px;
30+
}
31+
32+
nav a {
33+
color: white;
34+
font-size: 4rem;
35+
flex: 2;
36+
border: 0;
37+
}
38+
39+
textarea {
40+
font-family: 'Courier New', Courier, monospace;
41+
}
42+
43+
.output {
44+
background: #e8f1f7;
45+
padding: 2rem;
46+
font-size: 3rem;
47+
}
48+
</style>
49+
</head>
50+
51+
<body>
52+
53+
<nav>
54+
<a href="/">FarceBook</a>
55+
<button>Send $1,000,000</button>
56+
<button>Send a DM</button>
57+
<button>Unfriend Someone</button>
58+
<button>Post Nasty Message</button>
59+
</nav>
60+
61+
<div class="app">
62+
<textarea name="input">
63+
Hi I am <mark>Wes Bos</mark> and I <em>love</em> to ride bikes.
64+
65+
This is my Bio 👋🏻
66+
67+
Here is a photo I took last week:
68+
69+
<img src="https://source.unsplash.com/200x200" alt="Nice">
70+
71+
<strong>Do you like it?</strong>
72+
73+
</textarea>
74+
<div class="output">
75+
76+
</div>
77+
</div>
78+
79+
<script src="./nasty.js"></script>
80+
</body>
81+
82+
</html>

exercises/81 - Security/nasty.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
const input = document.querySelector('[name="input"]');
2+
const output = document.querySelector('.output');
3+
4+
input.addEventListener('input', () => {
5+
output.innerHTML = input.value.replace(/\n/g, '<br>');
6+
});
7+
8+
// trigger an input even on page load
9+
input.dispatchEvent(new Event('input'));

0 commit comments

Comments
 (0)