Skip to content

Commit

Permalink
fix(The Mahjong): add support for language routes (PreMiD#8396)
Browse files Browse the repository at this point in the history
  • Loading branch information
itsmeeudrino authored May 24, 2024
1 parent 46a7add commit b2dbfb6
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 3 deletions.
2 changes: 1 addition & 1 deletion websites/T/The Mahjong/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"en": "Amazing free Mahjong that’ll knock your socks off. Play classic and modern Mahjong games in full screen, with lots of layouts and beautiful tiles."
},
"url": "themahjong.com",
"version": "1.0.1",
"version": "1.0.2",
"logo": "https://cdn.rcd.gg/PreMiD/websites/T/The%20Mahjong/assets/logo.png",
"thumbnail": "https://cdn.rcd.gg/PreMiD/websites/T/The%20Mahjong/assets/thumbnail.jpg",
"color": "#577e54",
Expand Down
30 changes: 28 additions & 2 deletions websites/T/The Mahjong/presence.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,39 @@ const enum Assets {
Logo = "https://cdn.rcd.gg/PreMiD/websites/T/The%20Mahjong/assets/logo.png",
}

const SITE_LANGS = [
"ar",
"de",
"es",
"pt",
"da",
"fr",
"ru",
"id",
"it",
"nl",
"pl",
"sv",
"tr",
"vi",
"zh",
"hi",
"ko",
"ja",
];

presence.on("UpdateData", async () => {
const presenceData: PresenceData = {
largeImageKey: Assets.Logo,
startTimestamp: browsingTimestamp,
},
{ pathname, href } = document.location,
pathArr = pathname.split("/");
{ pathname, href } = document.location;
let pathArr = pathname.split("/");

if (SITE_LANGS.find(lang => lang === pathname.split("/")[1])) {
pathArr = ["", ...pathArr.slice(2)];
if (pathArr.length === 1) pathArr = ["", ""];
}

if (pathArr[1] === "" || pathArr[1] === "mahjong") {
if (pathArr[1] === "mahjong" && pathArr[2] === "")
Expand Down

0 comments on commit b2dbfb6

Please sign in to comment.