Skip to content

Commit

Permalink
New presence for the Hytale website
Browse files Browse the repository at this point in the history
  • Loading branch information
ImRodry committed Feb 10, 2021
1 parent 4e89c1b commit f37315b
Show file tree
Hide file tree
Showing 4 changed files with 142 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .resources/README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ In this folder you can find resource images which you can use to display the sta
| <img src="pause.png" style="background-color: rgba(0,0,0,25);" height="50px"> | [pause.png](pause.png) |
| <img src="stop.png" style="background-color: rgba(0,0,0,25);" height="50px"> | [stop.png](stop.png) |
| <img src="search.png" style="background-color: rgba(0,0,0,25);" height="50px"> | [search.png](search.png) |
| <img src="question.png" style="background-color: rgba(0,0,0,25);" height="50px"> | [question.png](question.png) |
| <img src="question.png" style="background-color: rgba(0,0,0,25);" height="50px"> | [question.png](question.png) |
| <img src="live.png" style="background-color: rgba(0,0,0,25);" height="50px"> | [live.png](live.png) |
| <img src="reading.png" style="background-color: rgba(0,0,0,25);" height="50px"> | [reading.png](reading.png) |
| <img src="writing.png" style="background-color: rgba(0,0,0,25);" height="50px"> | [writing.png](writing.png) |
Expand Down
25 changes: 25 additions & 0 deletions websites/H/Hytale/dist/metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"$schema": "https://schemas.premid.app/metadata/1.3",
"author": {
"name": "Rodry",
"id": "240875059953139714"
},
"url": "hytale.com",
"description": {
"en": "Embark on a journey of adventure and creativity! Hytale combines the scope of a sandbox with the depth of a roleplaying game, immersing players in a procedurally generated world where teetering towers and deep dungeons promise rich rewards.",
"pt": "Embarca numa jornada de aventura e criatividade! O Hytale combina as possibilidades"
},
"service": "Hytale",
"version": "1.0.0",
"logo": "https://i.imgur.com/ue65nDd.png",
"thumbnail": "https://i.imgur.com/1WjcSTP.png",
"color": "#15243A",
"tags": [
"forum",
"hytale",
"riot",
"games",
"hypixel"
],
"category": "games"
}
110 changes: 110 additions & 0 deletions websites/H/Hytale/presence.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
const presence = new Presence({
clientId: "809083630117978123"
}),
strings = presence.getStrings({
play: "presence.playback.playing",
pause: "presence.playback.paused"
//You can use this to get translated strings in their browser language
}),
browsingStamp = Math.round(Date.now() / 1000);

presence.on("UpdateData", async () => {
const presenceData: PresenceData = {
largeImageKey: "hytale_logo",
startTimestamp: browsingStamp
};

if (document.location.pathname === "/") {
presenceData.details = "Viewing the main page";
} else if (document.location.pathname === "/news") {
presenceData.details = "Browsing Blog Posts";
// details: "Browsing Page Name", //The upper section of the presence text
// state: "Reading section A", //The lower section of the presence text
} else if (document.location.pathname.includes("/news/archive/")) {
presenceData.details = "Browsing Blog Archives";
presenceData.state = `From ${document.querySelector(".subHeading").textContent}`;
} else if (document.location.pathname.includes("/news/")) {
presenceData.details = "Reading Blog Post";
presenceData.state = document.querySelector(".post__heading").textContent;
presenceData.smallImageKey = "reading"
} else if (document.location.pathname === "/media") {
presenceData.details = "Browsing Hytale media";
if (document.location.hash.includes("#screenshots")) {
presenceData.state = "Screenshot";
} else if (document.location.hash.includes("#desktopWallpapers")) {
presenceData.state = "Desktop Wallpaper";
} else if (document.location.hash.includes("#mobileWallpapers")) {
presenceData.state = "Mobile Wallpaper";
} else if (document.location.hash.includes("#conceptArt")) {
presenceData.state = "Concept Art";
} else if (document.location.hash.includes("#videos")) {
presenceData.state = "Video";
} else if (document.location.hash.includes("#clips")) {
presenceData.state = "Clip";
};
} else if (document.location.pathname === "/game") {
presenceData.details = "Learning more about";
presenceData.state = "the game";
} else if (document.location.pathname === "/community") {
presenceData.details = "Viewing the";
presenceData.state = "Community page"
} else if (document.location.pathname === "/jobs") {
presenceData.details = "Viewing Job Openings";
} else if (document.location.pathname.includes("/jobs/")) {
presenceData.details = "Viewing Job";
presenceData.state = document.querySelector(".pageHeading").textContent;
} else if (document.location.pathname === "/signup") {
presenceData.details = "Signing up for the beta";
presenceData.smallImageKey = "writing";
} else if (document.location.pathname === "/about") {
presenceData.details = "Learning more about";
presenceData.state = "Hypixel Studios";
if (document.location.hash === "#contact") {
presenceData.details = "Viewing the";
presenceData.state = "Contact information";
} else if (document.location.hash === "#press") {
presenceData.details = "Viewing the";
presenceData.state = "Press information";
}
} else if (document.location.pathname === "/cookie-policy") {
presenceData.details = "Reading the Cookie Policy";
presenceData.smallImageKey = "reading";
if (document.location.hash === "#what-is-cookie") {
presenceData.state = "What is a Cookie?";
} else if (document.location.hash === "#why-are-cookies-used") {
presenceData.state = "Why are Cookies used?";
} else if (document.location.hash === "#who-places-cookies") {
presenceData.state = "Who places Cookies";
} else if (document.location.hash === "#how-manage-cookies") {
presenceData.state = "How can I manage cookies?";
} else if (document.location.hash === "#do-not-track-signals") {
presenceData.state = "Do-not-track signals";
} else if (document.location.hash === "#policy-updates") {
presenceData.state = "Policy updates";
} else if (document.location.hash === "#contact-us") {
presenceData.state = "Contact us"
}
} else if (document.location.pathname === "/privacy") {
presenceData.details = "Viewing the";
presenceData.state = "Privacy Policy"
} else if (document.location.pathname === "/legal") {
presenceData.details = "Viewing the";
presenceData.state = "Legal Information"
} else if (document.location.pathname === "/corporate-governance") {
presenceData.details = "Reading about";
presenceData.state = "Corporate Governance";
} else if (document.location.pathname === "/supersecretpage") {
presenceData.details = "Viewing a";
presenceData.state = "Super Secret Page"
} else {
presenceData.details = "Viewing an";
presenceData.state = "Unknown page";
}

if (presenceData.details == null) {
presence.setTrayTitle();
presence.setActivity();
} else {
presence.setActivity(presenceData);
}
});
6 changes: 6 additions & 0 deletions websites/H/Hytale/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"extends": "../../../tsconfig.json",
"compilerOptions": {
"outDir": "./dist/"
}
}

0 comments on commit f37315b

Please sign in to comment.