summaryrefslogtreecommitdiffstats
path: root/moe.pinapelz.com/scripts/index.js
blob: b59b827f47e5fda71bed7842d529fd6fee3dec5d (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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
function fetchDiscordStatus(userId) {
    const API_URL = `https://api.lanyard.rest/v1/users/${userId}`;

    fetch(API_URL)
      .then(response => response.json())
      .then(data => {
        const discordStatus = data.data.discord_status;

        const statusColors = {
          online: "#43b581",
          idle: "#faa61a",
          dnd: "#f04747",
          offline: "#747f8d",
        };

        const statusText = {
          online: "Online",
          idle: "Idle",
          dnd: "Do Not Disturb",
          offline: "Offline",
        };

        const statusSection = document.getElementById(`discord-status`);
        const statusTextElement = statusSection.querySelector(".status-text");

        statusSection.style.backgroundColor = statusColors[discordStatus];
        statusTextElement.textContent = "Currently: " + statusText[discordStatus];
      })
      .catch(error => console.error("Error fetching Discord status:", error));
  }

document.addEventListener("DOMContentLoaded", () => {
  const quotes = [
    "Give a man a fish, learn him how to eat, give a man- learn a man how to - xQc",
    "Yeah I'm GAY, Good at Yugioh - Rosemi Lovelock",
    "yipee - Erina Makina",
    "Your friend doesn't like Vtubers? Tell your friend to get some taste - Pavolia Reine",
  ];

  function getRandomQuote() {
    const randomIndex = Math.floor(Math.random() * quotes.length);
    return quotes[randomIndex];
  }

  const quoteElement = document.getElementById("quote");
  quoteElement.innerHTML = `<i>${getRandomQuote()}</i>`;
});
function updateClock() {
  const clockElement = document.getElementById('clock');
  const now = new Date();
  const pstTime = new Date(now.toLocaleString("en-US", {timeZone: "America/Los_Angeles"}));
  const hours = String(pstTime.getHours()).padStart(2, '0');
  const minutes = String(pstTime.getMinutes()).padStart(2, '0');
  const seconds = String(pstTime.getSeconds()).padStart(2, '0');
  const day = String(pstTime.getDate()).padStart(2, '0');
  const month = String(pstTime.getMonth() + 1).padStart(2, '0');
  const year = pstTime.getFullYear();
  let message = "good day!";
  if (pstTime.getHours() >= 0 && pstTime.getHours() < 7) {
      message = "(its late for me)";
  } else if (pstTime.getHours() < 12) {
      message = "its morning for me";
  } else if (pstTime.getHours() >= 12 && pstTime.getHours() < 18) {
      message = "its afternoon for me";
  } else if (pstTime.getHours() >= 18) {
      message = "evening rn for me";
  }
  clockElement.innerHTML = `<span>${month}/${day}/${year} ${hours}:${minutes}:${seconds}</span> ` + message;
}

document.addEventListener("DOMContentLoaded", () => {
  const images = document.querySelectorAll(".random-float");
  const positions = [];

  images.forEach((img) => {
    let randomTop, randomLeft;
    let overlap;

    do {
      overlap = false;
      randomTop = Math.random() * 100;
      randomLeft = Math.random() * 100;
      if (randomTop > 30 && randomTop < 70) {
        overlap = true;
      }
      if (randomLeft > 30 && randomLeft < 70) {
        overlap = true;
      }
      positions.forEach(pos => {
        const distance = Math.sqrt(Math.pow(randomTop - pos.top, 2) + Math.pow(randomLeft - pos.left, 2));
        if (distance < 10) {
          overlap = true;
        }
      });
    } while (overlap);

    positions.push({ top: randomTop, left: randomLeft });

    const randomDuration = Math.random() * 10 + 3;

    img.style.top = `${randomTop}%`;
    img.style.left = `${randomLeft}%`;
    img.style.animationDuration = `${randomDuration}s`;
  });
});

setInterval(updateClock, 1000);
updateClock();
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage