-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
91 lines (86 loc) · 2.3 KB
/
Copy pathindex.html
File metadata and controls
91 lines (86 loc) · 2.3 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Hashnotes - Private by design. Simple by nature.</title>
<link rel="icon" href="favicon.png" type="image/png">
<style>
html, body {
height: 100%;
margin: 0;
font-family: system-ui, sans-serif;
background: #f9f9f9;
}
body {
display: flex;
align-items: center;
justify-content: center;
position: relative;
}
textarea {
width: 90%;
max-width: 800px;
height: 70vh;
font-size: 1.25rem;
line-height: 1.6;
padding: 1rem;
box-sizing: border-box;
border: 1px solid #ccc;
border-radius: 10px;
resize: none;
background: white;
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}
.github-link {
position: absolute;
bottom: 1rem;
right: 1rem;
font-size: 0.9rem;
text-decoration: none;
color: #888;
transition: color 0.2s ease;
}
.github-link:hover {
color: #000;
}
</style>
</head>
<body>
<textarea id="noteInput" placeholder="Start typing..."></textarea>
<a class="github-link" href="https://github.com/fm-sys/hashnotes" target="_blank" rel="noopener noreferrer">
View on GitHub
</a>
<script>
const input = document.getElementById('noteInput');
const defaultTitle = "Hashnotes - Private by design. Simple by nature.";
function updateTitle(text) {
const trimmed = text.trim();
document.title = trimmed
? trimmed.length > 40
? trimmed.slice(0, 40) + "…"
: trimmed
: defaultTitle;
}
function loadNoteFromHash() {
const hash = location.hash.slice(1);
if (hash) {
try {
const decoded = decodeURIComponent(hash);
input.value = decoded;
updateTitle(decoded);
} catch {
input.value = '[Invalid text encoding]';
document.title = defaultTitle;
}
}
}
input.addEventListener('input', () => {
const text = input.value;
const encoded = encodeURIComponent(text.trim());
history.replaceState(null, '', '#' + encoded);
updateTitle(text);
});
loadNoteFromHash();
</script>
</body>
</html>