summaryrefslogtreecommitdiff
path: root/main.handlebars
blob: 759b6e63360b49a4193b7872acf23a2862395935 (plain) (blame)
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
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>spiraling into insanity</title>
    <style>

	div {
	    margin-top: 50px;
	    display: flex;
	    flex-direction: column;
	    align-items: center;
	}
	input {
	    margin-bottom: 10px;
	}
	textarea {
	    margin-bottom: 10px;
	}
	.button {
	    font-size: 20pt;
	}
	@media (prefers-color-scheme: dark) {
	    body {
		background: #292b33;
		color: #f5f5f5
	    }
	    input {
		background: SlateGrey;
		color: white;
		font-size: 15pt;
	    }
	    textarea {
		background: SlateGray;
		color: white;
	    }
	    .button {
		background: #292b33;
		color: #f5f5f5
	    }
	}

    </style>

    <script>
      function formatDate() {
        const now = new Date();
        const options = { month: 'long', day: 'numeric', year: 'numeric' };
        const formattedDate = now.toLocaleString('en-US', options);
        const hours = String(now.getHours()).padStart(2, '0');
        const minutes = String(now.getMinutes()).padStart(2, '0');
        return `${formattedDate}\n${hours}:${minutes}`;
      }

      function updateDate() {
        const dateElement = document.getElementById('date');
        if (dateElement) {
          dateElement.textContent = formatDate();
        }
      }

      window.onload = function() {
        updateDate();
        setInterval(updateDate, 1000);
      };
      async function sendMessage() {
        fetch("/submit", {
          method: "POST",
          body: JSON.stringify({
            tags: document.getElementById('tags').value,
            text: document.getElementById('entry').value
          }),
          headers: {
            "Content-type": "application/json; charset=UTF-8"
          }
        });
      }
    </script>
</head>

<body>
  <div>
    <h1 id="date"></h1>
    <input name="tags" type="text" placeholder="Tags" id="tags" value="" autocomplete="off"/>
    <textarea name="text" id="entry" rows="25" placeholder="Text" cols="48" value="" autocomplete="off"></textarea>
    <input class="button" id="clickMe" type="button" value="Submit" onclick="sendMessage();" />
  </div>
</body>

</html>