Skip to content

Commit

Permalink
Added my Discord status to the navbar.
Browse files Browse the repository at this point in the history
  • Loading branch information
tay committed Sep 20, 2024
1 parent 7871b44 commit 5a19c39
Show file tree
Hide file tree
Showing 21 changed files with 74 additions and 8 deletions.
6 changes: 5 additions & 1 deletion layouts/_default/baseof.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/">Tee</a>
<a class="navbar-brand" href="/">
Tee
<img id="dcstat" alt="Status" width="75" style="margin-left: 55px; margin-top: -17px">
<script src="/assets/js/lanyard.js"></script>
</a>
<link rel="home" href="/" />
</div>
<div class="collapse navbar-collapse" id="top-navbar-1">
Expand Down
1 change: 1 addition & 0 deletions layouts/_default/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ <h3 id="date-time">time</h3>
<script src="/assets/js/timezone.js"></script>
<p>Hello and Welcome, My name is Tee.</p>
<p>I prefer to go by Tee, Rhea, or Kara.</p>
<p>My preferred pronouns are She/They</p>
<p style="font-size: 20px;">
<a href="https://nohello.net/en/">NoHello</a> |
<a href="https://dontasktoask.com/">DontAskToAsk</a> |
Expand Down
6 changes: 5 additions & 1 deletion public/about/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/">Tee</a>
<a class="navbar-brand" href="/">
Tee
<img id="dcstat" alt="Status" width="75" style="margin-left: 55px; margin-top: -17px">
<script src="/assets/js/lanyard.js"></script>
</a>
<link rel="home" href="/" />
</div>
<div class="collapse navbar-collapse" id="top-navbar-1">
Expand Down
Binary file added public/assets/imgs/away.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/assets/imgs/dnd.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/assets/imgs/offline.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/assets/imgs/online.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions public/assets/js/lanyard.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
const dcstat = document.getElementById("dcstat");
const apiEndpoint = `https://api.lanyard.rest/v1/users/1050531216589332581`;
fetch(apiEndpoint)
.then(response => response.json())
.then(data => {
const dcStatus = data.data.discord_status;
if (dcStatus === "offline") {
dcstat.src = "/assets/imgs/offline.png";
} else if (dcStatus === "online") {
dcstat.src = "/assets/imgs/online.png";
} else if (dcStatus === "idle") {
dcstat.src = "/assets/imgs/away.png";
} else if (dcStatus === "dnd") {
dcstat.src = "/assets/imgs/dnd.png";
}
})
.catch(error => {
console.error('Error fetching Discord status:', error);
});
7 changes: 5 additions & 2 deletions public/assets/js/timezone.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@ function displayDateTime() {
};

const currentTime = new Date().toLocaleString('en-US', options);
document.getElementById('date-time').innerHTML = `It is ${currentTime} for Tee`;

const now = new Date();
const timeZoneOffset = now.getTimezoneOffset() / -60;
const gmtOffset = timeZoneOffset >= 0 ? `GMT+${timeZoneOffset}` : `GMT${timeZoneOffset}`;
document.getElementById('date-time').innerHTML = `It is ${currentTime} (${gmtOffset}) for Tee`;
}

setInterval(displayDateTime, 1000);
window.onload = displayDateTime;
1 change: 1 addition & 0 deletions public/discord/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
<li><a class="btn btn-link-3" href="/discord">Discord</a></li>
<li><a class="btn btn-link-3" href="/pages">Pages</a></li>
<li><a class="btn btn-link-3" href="https://tayrp.substack.com/">Blog</a></li>
<script src="/assets/js/lanyard.js"></script>
</ul>
</div>
</div>
Expand Down
7 changes: 6 additions & 1 deletion public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/">Tee</a>
<a class="navbar-brand" href="/">
Tee
<img id="dcstat" alt="Status" width="75" style="margin-left: 55px; margin-top: -17px">
<script src="/assets/js/lanyard.js"></script>
</a>
<link rel="home" href="/" />
</div>
<div class="collapse navbar-collapse" id="top-navbar-1">
Expand All @@ -51,6 +55,7 @@ <h3 id="date-time">time</h3>
<script src="/assets/js/timezone.js"></script>
<p>Hello and Welcome, My name is Tee.</p>
<p>I prefer to go by Tee, Rhea, or Kara.</p>
<p>My preferred pronouns are She/They</p>
<p style="font-size: 20px;">
<a href="https://nohello.net/en/">NoHello</a> |
<a href="https://dontasktoask.com/">DontAskToAsk</a> |
Expand Down
1 change: 1 addition & 0 deletions public/pages/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
<li><a class="btn btn-link-3" href="/discord">Discord</a></li>
<li><a class="btn btn-link-3" href="/pages">Pages</a></li>
<li><a class="btn btn-link-3" href="https://tayrp.substack.com/">Blog</a></li>
<script src="/assets/js/lanyard.js"></script>
</ul>
</div>
</div>
Expand Down
6 changes: 5 additions & 1 deletion public/projects/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/">Tee</a>
<a class="navbar-brand" href="/">
Tee
<img id="dcstat" alt="Status" width="75" style="margin-left: 55px; margin-top: -17px">
<script src="/assets/js/lanyard.js"></script>
</a>
<link rel="home" href="/" />
</div>
<div class="collapse navbar-collapse" id="top-navbar-1">
Expand Down
1 change: 1 addition & 0 deletions public/readme/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
<li><a class="btn btn-link-3" href="/discord">Discord</a></li>
<li><a class="btn btn-link-3" href="/pages">Pages</a></li>
<li><a class="btn btn-link-3" href="https://tayrp.substack.com/">Blog</a></li>
<script src="/assets/js/lanyard.js"></script>
</ul>
</div>
</div>
Expand Down
1 change: 1 addition & 0 deletions public/salad/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
<li><a class="btn btn-link-3" href="/discord">Discord</a></li>
<li><a class="btn btn-link-3" href="/pages">Pages</a></li>
<li><a class="btn btn-link-3" href="https://tayrp.substack.com/">Blog</a></li>
<script src="/assets/js/lanyard.js"></script>
</ul>
</div>
</div>
Expand Down
Binary file added static/assets/imgs/away.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/assets/imgs/dnd.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/assets/imgs/offline.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/assets/imgs/online.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions static/assets/js/lanyard.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
const dcstat = document.getElementById("dcstat");
const apiEndpoint = `https://api.lanyard.rest/v1/users/1050531216589332581`;
fetch(apiEndpoint)
.then(response => response.json())
.then(data => {
const dcStatus = data.data.discord_status;
if (dcStatus === "offline") {
dcstat.src = "/assets/imgs/offline.png";
} else if (dcStatus === "online") {
dcstat.src = "/assets/imgs/online.png";
} else if (dcStatus === "idle") {
dcstat.src = "/assets/imgs/away.png";
} else if (dcStatus === "dnd") {
dcstat.src = "/assets/imgs/dnd.png";
}
})
.catch(error => {
console.error('Error fetching Discord status:', error);
});
7 changes: 5 additions & 2 deletions static/assets/js/timezone.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@ function displayDateTime() {
};

const currentTime = new Date().toLocaleString('en-US', options);
document.getElementById('date-time').innerHTML = `It is ${currentTime} for Tee`;

const now = new Date();
const timeZoneOffset = now.getTimezoneOffset() / -60;
const gmtOffset = timeZoneOffset >= 0 ? `GMT+${timeZoneOffset}` : `GMT${timeZoneOffset}`;
document.getElementById('date-time').innerHTML = `It is ${currentTime} (${gmtOffset}) for Tee`;
}

setInterval(displayDateTime, 1000);
window.onload = displayDateTime;

0 comments on commit 5a19c39

Please sign in to comment.