aboutsummaryrefslogtreecommitdiff
path: root/cmd/azurda/static/index.html
blob: 949a854b788b21cbca738398145744cc33765b2b (plain)
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
<!DOCTYPE html>
<html>
  <head>
    <title>Azurda</title>
    <link rel="stylesheet" href="/static/css/xess.css" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <script src="/static/js/alpine.js" defer></script>
    <script src="/static/js/md5.min.js" defer></script>
    <script>
      document.addEventListener("alpine:init", () => {
        Alpine.data("azurda", () => ({
          str: "", // The input string
          md5: "", // md5 hash of the string
          url: "/static/img/azurda.png", // image for user
          md5sum() {
            return new Promise((resolve) => {
              this.md5 = md5(this.str);
              this.url = `https://cdn.xeiaso.net/avatar/${this.md5}`;
              resolve(this.md5);
            });
          },
        }));
      });
    </script>
  </head>
  <body id="top">
    <main>
      <h1>Azurda</h1>

      <p>Type in some text and get a randomly generated avatar!</p>

      <div x-data="azurda">
        <input
          @input.debounce.500ms="md5sum().then((hash) => console.log(hash))"
          type="text"
          x-model="str"
        />
        <br />
        <img
          style="margin-top: 2rem"
          x-bind:src="url"
          alt="Azurda"
          width="256px"
        />
      </div>

      <footer>
        <p>
          From <a href="https://within.website">Within</a> with ❤️ -
          <a href="">Source code</a>
        </p>
      </footer>
    </main>
  </body>
</html>