-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
135 lines (115 loc) · 4.61 KB
/
index.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
<!DOCTYPE html>
<html>
<head>
<title>pravin sivabalan</title>
<meta charset="utf-8">
<meta name="description" content="pravin sivabalan's personal website">
<meta name="keywords" content="Pravin,Sivabalan,Pravin Sivabalan,Personal,About">
<meta name="msapplication-TileColor" content="#ffffff">
<meta name="msapplication-TileImage" content="/ms-icon-144x144.png">
<meta name="theme-color" content="#ffffff">
<link href="https://fonts.googleapis.com/css?family=Amatic+SC" rel="stylesheet">
<link rel="stylesheet" href="./style.css">
<link rel="icon" type="image/png" sizes="32x32" href="./favicons/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="96x96" href="./favicons/favicon-96x96.png">
<link rel="icon" type="image/png" sizes="16x16" href="./favicons/favicon-16x16.png">
</head>
<body>
<section id="textarea">
<h1 id="name">pravin_sivabalan</h1>
<ul>
<li><b>now:</b> google play store</li>
<li><b>before:</b> software engineer @ salesforce, product @ <span id="handled">handled</span>, cofounder @ <span id="roo">roo</span></li>
<li>
<a class="link" href="https://www.goodreads.com/user/show/54049527-pravin-sivabalan" target="_blank">goodreads</a><span>,</span>
<a class="link" href="https://open.spotify.com/user/psivabalan" target="_blank">spotify</a>
<span class="todo">// TODO(praline): Add more links</span>
</li>
<li><span id="cursor"></span></li>
</ul>
</section>
<script>
function placeCaretAtEnd(el) {
el.focus();
if (typeof window.getSelection != "undefined"
&& typeof document.createRange != "undefined") {
var range = document.createRange();
range.selectNodeContents(el);
range.collapse(false);
var sel = window.getSelection();
sel.removeAllRanges();
sel.addRange(range);
} else if (typeof document.body.createTextRange != "undefined") {
var textRange = document.body.createTextRange();
textRange.moveToElementText(el);
textRange.collapse(false);
textRange.select();
}
}
// const handled = document.getElementById('handled');
// const handledColor = 'rgb(228,128,98)'
// handled.style.color = handledColor;
// const roo = document.getElementById('roo');
// const rooColor = 'rgb(223,93,57)'
// roo.style.color = rooColor;
let isInputMode = false;
const cursor = document.getElementById('cursor');
const links = document.getElementsByClassName('link');
const textarea = document.getElementById('textarea');
const name = document.getElementById('name');
const todos = document.getElementsByClassName('todo');
addEventListener('keydown', (event) => {
// turn on edit mode
if (event.key === 'i' && !isInputMode) {
const blueColor = 'rgb(107,167,227)';
for (let link of links) {
link.style.textDecoration = 'none';
link.style.color = blueColor;
}
for (let todo of todos) {
todo.style.visibility = 'inherit';
todo.style.color = 'rgb(245,191,135)';
}
if (cursor) {
cursor.style.display = 'none';
}
if (name) {
name.style.color = 'rgb(203,111,119)';
name.innerHTML = '/Users/pravin/sivabalan'
}
placeCaretAtEnd(textarea);
textarea.setAttribute('contenteditable', 'true');
textarea.focus();
isInputMode = true;
document.body.style.background = 'black';
document.body.style.color = blueColor;
// prevent the i keypress
event.preventDefault();
}
});
textarea.addEventListener('keydown', (event) => {
if (event.key === 'Escape' && isInputMode) {
textarea.setAttribute('contenteditable', 'false');
document.body.style.background = 'white';
document.body.style.color = 'black';
isInputMode = false;
if (name) {
name.style.color = 'black';
name.innerHTML = 'pravin_sivabalan'
}
if (cursor) {
cursor.style.display = 'flex';
}
for (let link of links) {
link.style.textDecoration = 'underline';
link.style.color = 'blue';
}
for (let todo of todos) {
todo.style.visibility = 'hidden';
}
event.preventDefault();
}
});
</script>
</body>
</html>