-
Notifications
You must be signed in to change notification settings - Fork 0
/
notetaking.html
92 lines (87 loc) · 2.53 KB
/
notetaking.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
<head>
<link rel="stylesheet" href="main.css" />
<title>Note-App | JavaScript stuff</title>
<script src="main.js"></script>
</head>
<a id="back" href="index.html">⇦ Back</a>
<body onload="writeCookie()">
<div class="container">
<h1>Notetaking</h1>
<p>
A simple note-taking thing I'm working on with JS. When you reload the
page it should keep what you put in the box when you clicked save. This
works using
<a href="https://www.w3schools.com/jsref/prop_win_localstorage.asp"
>JavaScript localStorage</a
>. Feel free to check out the version that parses HTML
<a href="html_parser.html">here</a>
</p>
<textarea
style="width: 100%; height: 60%; resize: vertical"
id="input"
placeholder="Put stuff here"
></textarea>
<button onclick="checkCookie()" id="button">Save</button
><button id="button" onclick="copy()">Copy</button>
</div>
</body>
<script>
document.addEventListener("keyup", checkCookie);
function copy() {
var copyText = document.getElementById("input");
copyText.select();
copyText.setSelectionRange(0, 99999);
document.execCommand("copy");
}
function checkCookie() {
text = document.getElementById("input").value;
localStorage.setItem("text_cookie", text);
}
function writeCookie() {
cookie = localStorage.getItem("text_cookie");
document.getElementById("input").value = cookie;
}
</script>
<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>