From c72e0bf35667e539edcaa9a1c1286043bacc0e26 Mon Sep 17 00:00:00 2001 From: Bas950 Date: Sun, 19 Jan 2025 20:42:32 +0100 Subject: [PATCH] chore: lint G folder --- websites/G/G2A/metadata.json | 46 +- websites/G/G2A/presence.ts | 193 ++- websites/G/G2G/metadata.json | 44 +- websites/G/G2G/presence.ts | 177 +- websites/G/GAIN/metadata.json | 74 +- websites/G/GAIN/presence.ts | 203 +-- websites/G/GAMEE/metadata.json | 50 +- websites/G/GAMEE/presence.ts | 135 +- websites/G/GBAtemp.net/metadata.json | 46 +- websites/G/GBAtemp.net/presence.ts | 177 +- websites/G/GDBrowser/metadata.json | 42 +- websites/G/GDBrowser/presence.ts | 324 ++-- websites/G/GG App/metadata.json | 92 +- websites/G/GG App/presence.ts | 270 ++-- websites/G/GGRadio/metadata.json | 150 +- websites/G/GGRadio/presence.ts | 178 +- websites/G/GMANGA/metadata.json | 100 +- websites/G/GMANGA/presence.ts | 348 ++-- websites/G/GTAForums/metadata.json | 48 +- websites/G/GTAForums/presence.ts | 199 +-- websites/G/GX.games/metadata.json | 84 +- websites/G/GX.games/presence.ts | 191 +-- websites/G/Gaia/metadata.json | 72 +- websites/G/Gaia/presence.ts | 263 +-- websites/G/Game Jolt/metadata.json | 46 +- websites/G/Game Jolt/presence.ts | 221 +-- websites/G/Game8/metadata.json | 52 +- websites/G/Game8/presence.ts | 182 ++- websites/G/GameBanana/metadata.json | 48 +- websites/G/GameBanana/presence.ts | 716 ++++---- websites/G/GameStar/metadata.json | 48 +- websites/G/GameStar/presence.ts | 128 +- websites/G/Garden/metadata.json | 48 +- websites/G/Garden/presence.ts | 261 +-- websites/G/Gartic Phone/metadata.json | 74 +- websites/G/Gartic Phone/presence.ts | 93 +- websites/G/Gartic.com.br/metadata.json | 44 +- websites/G/Gartic.com.br/presence.ts | 47 +- websites/G/Gartic.io/metadata.json | 44 +- websites/G/Gartic.io/presence.ts | 80 +- websites/G/GeForce NOW/metadata.json | 72 +- websites/G/GeForce NOW/presence.ts | 93 +- websites/G/Gemini/metadata.json | 76 +- websites/G/Gemini/presence.ts | 94 +- websites/G/Genie Music/metadata.json | 50 +- websites/G/Genie Music/presence.ts | 644 ++++---- websites/G/Genius/metadata.json | 72 +- websites/G/Genius/presence.ts | 249 +-- websites/G/Genoanime/iframe.ts | 32 +- websites/G/Genoanime/metadata.json | 52 +- websites/G/Genoanime/presence.ts | 273 ++-- websites/G/Genshin Impact Map/metadata.json | 100 +- websites/G/Genshin Impact Map/presence.ts | 450 +++--- websites/G/GeoGuessr/metadata.json | 52 +- websites/G/GeoGuessr/presence.ts | 337 ++-- websites/G/Geode/metadata.json | 80 +- websites/G/Geode/presence.ts | 114 +- websites/G/Geotastic/metadata.json | 46 +- websites/G/Geotastic/presence.ts | 191 +-- websites/G/Gfycat/metadata.json | 46 +- websites/G/Gfycat/presence.ts | 157 +- websites/G/Giggl/metadata.json | 102 +- websites/G/Giggl/presence.ts | 140 +- websites/G/Giphy/metadata.json | 56 +- websites/G/Giphy/presence.ts | 75 +- websites/G/GitHub Codespaces/metadata.json | 82 +- websites/G/GitHub Codespaces/presence.ts | 1436 ++++++++--------- websites/G/GitHub/metadata.json | 132 +- websites/G/GitHub/presence.ts | 708 ++++---- websites/G/GitLab/metadata.json | 68 +- websites/G/GitLab/presence.ts | 390 ++--- websites/G/Gitbook/metadata.json | 46 +- websites/G/Gitbook/presence.ts | 112 +- websites/G/Gitea/metadata.json | 52 +- websites/G/Gitea/presence.ts | 355 ++-- websites/G/Glimesh/metadata.json | 98 +- websites/G/Glimesh/presence.ts | 389 ++--- websites/G/Glitch/metadata.json | 58 +- websites/G/Glitch/presence.ts | 186 ++- websites/G/Glynet/metadata.json | 58 +- websites/G/Glynet/presence.ts | 121 +- websites/G/Gmail/metadata.json | 108 +- websites/G/Gmail/presence.ts | 216 +-- websites/G/GoFundMe/metadata.json | 50 +- websites/G/GoFundMe/presence.ts | 187 ++- websites/G/GoPlay/metadata.json | 76 +- websites/G/GoPlay/presence.ts | 99 +- websites/G/Gogoanime/iframe.ts | 63 +- websites/G/Gogoanime/metadata.json | 76 +- websites/G/Gogoanime/presence.ts | 714 ++++---- websites/G/Goodreads/metadata.json | 40 +- websites/G/Goodreads/presence.ts | 304 ++-- websites/G/Google Calendar/metadata.json | 72 +- websites/G/Google Calendar/presence.ts | 223 +-- websites/G/Google Classroom/metadata.json | 86 +- websites/G/Google Classroom/presence.ts | 200 +-- websites/G/Google Colab/metadata.json | 48 +- websites/G/Google Colab/presence.ts | 187 ++- websites/G/Google Docs/Google Docs.json | 2 +- websites/G/Google Docs/metadata.json | 96 +- websites/G/Google Docs/presence.ts | 155 +- websites/G/Google Domains/metadata.json | 84 +- websites/G/Google Domains/presence.ts | 148 +- websites/G/Google Drive/metadata.json | 82 +- websites/G/Google Drive/presence.ts | 99 +- websites/G/Google Earth/metadata.json | 48 +- websites/G/Google Earth/presence.ts | 324 ++-- websites/G/Google Fonts/metadata.json | 64 +- websites/G/Google Fonts/presence.ts | 189 ++- websites/G/Google Keep/metadata.json | 74 +- websites/G/Google Keep/presence.ts | 171 +- websites/G/Google Maps/metadata.json | 60 +- websites/G/Google Maps/presence.ts | 143 +- websites/G/Google Meet/metadata.json | 128 +- websites/G/Google Meet/presence.ts | 291 ++-- websites/G/Google Messages/metadata.json | 62 +- websites/G/Google Messages/presence.ts | 113 +- websites/G/Google Photos/metadata.json | 68 +- websites/G/Google Photos/presence.ts | 65 +- websites/G/Google Play/metadata.json | 44 +- websites/G/Google Play/presence.ts | 332 ++-- websites/G/Google Podcasts/metadata.json | 52 +- websites/G/Google Podcasts/presence.ts | 125 +- websites/G/Google Translate/metadata.json | 124 +- websites/G/Google Translate/presence.ts | 1080 +++++++------ .../metadata.json | 48 +- .../Google's Coding Competitions/presence.ts | 472 +++--- websites/G/Google/metadata.json | 68 +- websites/G/Google/presence.ts | 179 +- websites/G/Grailed/metadata.json | 44 +- websites/G/Grailed/presence.ts | 460 +++--- .../G/Granblue Fantasy Wiki/metadata.json | 48 +- websites/G/Granblue Fantasy Wiki/presence.ts | 130 +- websites/G/Granblue Fantasy/metadata.json | 128 +- websites/G/Granblue Fantasy/presence.ts | 792 ++++----- websites/G/Guilded.gg/metadata.json | 46 +- websites/G/Guilded.gg/presence.ts | 287 ++-- websites/G/Gunivers/metadata.json | 88 +- websites/G/Gunivers/presence.ts | 302 ++-- websites/G/galaxy/metadata.json | 76 +- websites/G/galaxy/presence.ts | 818 +++++----- websites/G/globoplay/metadata.json | 82 +- websites/G/globoplay/presence.ts | 961 +++++------ 143 files changed, 13133 insertions(+), 12450 deletions(-) diff --git a/websites/G/G2A/metadata.json b/websites/G/G2A/metadata.json index 6eb426e8f223..ed3b99341487 100644 --- a/websites/G/G2A/metadata.json +++ b/websites/G/G2A/metadata.json @@ -1,24 +1,24 @@ { - "$schema": "https://schemas.premid.app/metadata/1.12", - "apiVersion": 1, - "author": { - "name": "Bas950", - "id": "241278257335500811" - }, - "service": "G2A", - "description": { - "en": "Buy & Sell Online: PC Games, Software, Gift Cards and More on G2A.COM", - "nl": "Online kopen en verkopen: pc-games, software, cadeaubonnen en meer op G2A.COM" - }, - "url": "www.g2a.com", - "regExp": "([a-z0-9-]+[.])*g2a[.]com[/]", - "version": "1.2.22", - "logo": "https://cdn.rcd.gg/PreMiD/websites/G/G2A/assets/logo.png", - "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/G2A/assets/thumbnail.png", - "color": "#f05f00", - "category": "games", - "tags": [ - "codes", - "steam" - ] -} \ No newline at end of file + "$schema": "https://schemas.premid.app/metadata/1.12", + "apiVersion": 1, + "author": { + "name": "Bas950", + "id": "241278257335500811" + }, + "service": "G2A", + "description": { + "en": "Buy & Sell Online: PC Games, Software, Gift Cards and More on G2A.COM", + "nl": "Online kopen en verkopen: pc-games, software, cadeaubonnen en meer op G2A.COM" + }, + "url": "www.g2a.com", + "regExp": "([a-z0-9-]+[.])*g2a[.]com[/]", + "version": "1.2.22", + "logo": "https://cdn.rcd.gg/PreMiD/websites/G/G2A/assets/logo.png", + "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/G2A/assets/thumbnail.png", + "color": "#f05f00", + "category": "games", + "tags": [ + "codes", + "steam" + ] +} diff --git a/websites/G/G2A/presence.ts b/websites/G/G2A/presence.ts index f0fae25a1642..a51f0e587480 100644 --- a/websites/G/G2A/presence.ts +++ b/websites/G/G2A/presence.ts @@ -1,106 +1,101 @@ const presence = new Presence({ - clientId: "633805202868273153", - }), - browsingTimestamp = Math.floor(Date.now() / 1000); + clientId: '633805202868273153', +}) +const browsingTimestamp = Math.floor(Date.now() / 1000) -let user: string | HTMLElement | Element, title: string | HTMLElement | Element; +presence.on('UpdateData', async () => { + const presenceData: PresenceData = { + largeImageKey: 'https://cdn.rcd.gg/PreMiD/websites/G/G2A/assets/logo.png', + startTimestamp: browsingTimestamp, + } -presence.on("UpdateData", async () => { - const presenceData: PresenceData = { - largeImageKey: "https://cdn.rcd.gg/PreMiD/websites/G/G2A/assets/logo.png", - startTimestamp: browsingTimestamp, - }; + const title = document.querySelector('head > title') + switch (document.location.hostname) { + case 'www.g2a.com': { + if (document.location.pathname.includes('/wishlist')) { + presenceData.details = 'Viewing their wishlist' + } + else if (document.location.pathname.includes('/cart')) { + presenceData.details = 'Viewing their cart' + } + else if (document.location.pathname.includes('/search')) { + presenceData.details = 'Searching for:' + presenceData.state = title?.textContent?.replace('" - G2A.COM', '').replace('Search results - "', '') + presenceData.smallImageKey = Assets.Search + } + else if (document.location.pathname.includes('/category')) { + presenceData.details = 'Viewing category:' + presenceData.state = title?.textContent?.replace(' - G2A.COM', '') + } + else if ( + document.querySelector( + '#app > div > div.content > div > article > header > div > div > h1 > span', + ) !== null + ) { + presenceData.details = 'Viewing item:' + const title = document.querySelector( + '#app > div > div.content > div > article > header > div > div > h1 > span', + ) + presenceData.state = title?.textContent + } + else if (document.location.pathname.includes('/user')) { + presenceData.details = 'Viewing user:' + const user = document.querySelector( + '#app > div > div.content > div > div > div > section > div.user-info > button > strong', + ) + presenceData.state = (user as HTMLElement).textContent + } + else if (document.location.pathname.includes('/goldmine')) { + presenceData.details = 'Using the goldmine' + } + else if (document.location.pathname.includes('/news/')) { + const title = document.querySelector( + 'body > div.single-article.single-article--feature.default-template > div.review-top > div.review-top__wrapper > div > header > h1', + ) + if (!title) { + presenceData.details = 'Browsing news section' + } + else { + presenceData.details = 'News - Reading:' + presenceData.state = (title as HTMLElement).textContent + presenceData.smallImageKey = Assets.Reading + } + } - switch (document.location.hostname) { - case "www.g2a.com": { - if (document.location.pathname.includes("/wishlist")) - presenceData.details = "Viewing their wishlist"; - else if (document.location.pathname.includes("/cart")) - presenceData.details = "Viewing their cart"; - else if (document.location.pathname.includes("/search")) { - presenceData.details = "Searching for:"; - presenceData.state = (title as HTMLElement).textContent - .replace('" - G2A.COM', "") - .replace('Search results - "', ""); - presenceData.smallImageKey = Assets.Search; - } else if (document.location.pathname.includes("/category")) { - presenceData.details = "Viewing category:"; - title = document.querySelector("head > title"); - presenceData.state = (title as HTMLElement).textContent.replace( - " - G2A.COM", - "" - ); - } else if ( - document.querySelector( - "#app > div > div.content > div > article > header > div > div > h1 > span" - ) !== null - ) { - presenceData.details = "Viewing item:"; - title = document.querySelector( - "#app > div > div.content > div > article > header > div > div > h1 > span" - ); - presenceData.state = (title as HTMLElement).textContent; - } else if (document.location.pathname.includes("/user")) { - presenceData.details = "Viewing user:"; - user = document.querySelector( - "#app > div > div.content > div > div > div > section > div.user-info > button > strong" - ); - presenceData.state = (user as HTMLElement).textContent; - } else if (document.location.pathname.includes("/goldmine")) - presenceData.details = "Using the goldmine"; - else if (document.location.pathname.includes("/news/")) { - title = document.querySelector( - "body > div.single-article.single-article--feature.default-template > div.review-top > div.review-top__wrapper > div > header > h1" - ); - if (!title) presenceData.details = "Browsing news section"; - else { - presenceData.details = "News - Reading:"; - presenceData.state = (title as HTMLElement).textContent; - presenceData.smallImageKey = Assets.Reading; - } - } + break + } + case 'id.g2a.com': { + presenceData.details = 'Viewing their account details' + break + } + case 'dashboard.g2a.com': { + presenceData.details = 'Viewing their dashboard' + break + } + case 'pay.g2a.com': { + presenceData.details = 'Using G2A Pay' + break + } + case 'plus.g2a.com': { + presenceData.details = 'G2A Plus - Viewing:' + presenceData.state = title?.textContent?.replace(' - G2A Plus', '') - break; - } - case "id.g2a.com": { - presenceData.details = "Viewing their account details"; - break; - } - case "dashboard.g2a.com": { - presenceData.details = "Viewing their dashboard"; - break; - } - case "pay.g2a.com": { - presenceData.details = "Using G2A Pay"; - break; - } - case "plus.g2a.com": { - presenceData.details = "G2A Plus - Viewing:"; - title = document.querySelector("head > title"); - presenceData.state = (title as HTMLElement).textContent.replace( - " - G2A Plus", - "" - ); + break + } + case 'loot.g2a.com': { + if (document.location.pathname === '/') { + presenceData.details = 'Browsing G2A Loot' + } + else { + presenceData.details = 'G2A Loot - Viewing:' + presenceData.state = title?.textContent?.replace(' - G2A Loot', '') + } - break; - } - case "loot.g2a.com": { - if (document.location.pathname === "/") - presenceData.details = "Browsing G2A Loot"; - else { - presenceData.details = "G2A Loot - Viewing:"; - title = document.querySelector("head > title"); - presenceData.state = (title as HTMLElement).textContent.replace( - " - G2A Loot", - "" - ); - } + break + } + } - break; - } - // No default - } - - if (presenceData.details) presence.setActivity(presenceData); - else presence.setActivity(); -}); + if (presenceData.details) + presence.setActivity(presenceData) + else presence.setActivity() +}) diff --git a/websites/G/G2G/metadata.json b/websites/G/G2G/metadata.json index 50c27b766847..82a31bcc74d0 100644 --- a/websites/G/G2G/metadata.json +++ b/websites/G/G2G/metadata.json @@ -1,23 +1,23 @@ { - "$schema": "https://schemas.premid.app/metadata/1.12", - "apiVersion": 1, - "author": { - "id": "283757164923715587", - "name": "Mattis." - }, - "service": "G2G", - "description": { - "en": "G2G is a world-leading digital marketplace, founded by serious technopreneurs." - }, - "url": "www.g2g.com", - "version": "1.0.9", - "logo": "https://cdn.rcd.gg/PreMiD/websites/G/G2G/assets/logo.png", - "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/G2G/assets/thumbnail.png", - "color": "#f03827", - "category": "games", - "tags": [ - "marketplace", - "deals", - "games" - ] -} \ No newline at end of file + "$schema": "https://schemas.premid.app/metadata/1.12", + "apiVersion": 1, + "author": { + "id": "283757164923715587", + "name": "Mattis." + }, + "service": "G2G", + "description": { + "en": "G2G is a world-leading digital marketplace, founded by serious technopreneurs." + }, + "url": "www.g2g.com", + "version": "1.0.9", + "logo": "https://cdn.rcd.gg/PreMiD/websites/G/G2G/assets/logo.png", + "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/G2G/assets/thumbnail.png", + "color": "#f03827", + "category": "games", + "tags": [ + "marketplace", + "deals", + "games" + ] +} diff --git a/websites/G/G2G/presence.ts b/websites/G/G2G/presence.ts index 539ecbba5ea0..a1c2e57e252c 100644 --- a/websites/G/G2G/presence.ts +++ b/websites/G/G2G/presence.ts @@ -1,93 +1,92 @@ const presence = new Presence({ - clientId: "1073167802296438875", - }), - browsingTimestamp = Math.floor(Date.now() / 1000); + clientId: '1073167802296438875', +}) +const browsingTimestamp = Math.floor(Date.now() / 1000) -presence.on("UpdateData", async () => { - const presenceData: PresenceData = { - largeImageKey: "https://cdn.rcd.gg/PreMiD/websites/G/G2G/assets/logo.png", - startTimestamp: browsingTimestamp, - }, - { pathname, href, search } = document.location; +presence.on('UpdateData', async () => { + const presenceData: PresenceData = { + largeImageKey: 'https://cdn.rcd.gg/PreMiD/websites/G/G2G/assets/logo.png', + startTimestamp: browsingTimestamp, + } + const { pathname, href, search } = document.location - switch (pathname.split("/")[1]) { - case "search": { - presenceData.details = "Searching something to buy"; - presenceData.state = new URLSearchParams(search).get("q"); - break; - } - case "categories": { - presenceData.details = "Browsing a category"; - presenceData.state = - document.querySelector("title").textContent; - presenceData.buttons = [ - { - label: "View Category", - url: href, - }, - ]; - break; - } - case "offer": { - presenceData.details = "Viewing an offer"; - presenceData.state = - document.querySelector("title").textContent; - presenceData.buttons = [ - { - label: "View Offer", - url: href, - }, - ]; - break; - } - case "seller": { - presenceData.details = "Selling something"; - break; - } - case "chat": { - presenceData.details = "Chatting with a sellet"; - break; - } - case "account": { - presenceData.details = "Viewing their account"; - break; - } - case "trending": { - presenceData.details = "Viewing a trending offer"; - presenceData.state = - document.querySelector("div.text-h4").textContent; - presenceData.buttons = [ - { - label: "View Trending", - url: href, - }, - ]; - break; - } - case "secure": { - presenceData.details = `Buying ${ - document.querySelector("div.col-8.row").textContent - }`; - break; - } - default: { - const elem = pathname.split("/")[1]; - if (elem === "") { - presenceData.details = "Viewing the homepage"; - presenceData.state = "Browsing..."; - } else { - presenceData.details = `Viewing ${elem}'s profile`; - presenceData.buttons = [ - { - label: "View Profile", - url: href, - }, - ]; - } - break; - } - } + switch (pathname.split('/')[1]) { + case 'search': { + presenceData.details = 'Searching something to buy' + presenceData.state = new URLSearchParams(search).get('q') + break + } + case 'categories': { + presenceData.details = 'Browsing a category' + presenceData.state = document.querySelector('title')?.textContent + presenceData.buttons = [ + { + label: 'View Category', + url: href, + }, + ] + break + } + case 'offer': { + presenceData.details = 'Viewing an offer' + presenceData.state = document.querySelector('title')?.textContent + presenceData.buttons = [ + { + label: 'View Offer', + url: href, + }, + ] + break + } + case 'seller': { + presenceData.details = 'Selling something' + break + } + case 'chat': { + presenceData.details = 'Chatting with a sellet' + break + } + case 'account': { + presenceData.details = 'Viewing their account' + break + } + case 'trending': { + presenceData.details = 'Viewing a trending offer' + presenceData.state = document.querySelector('div.text-h4')?.textContent + presenceData.buttons = [ + { + label: 'View Trending', + url: href, + }, + ] + break + } + case 'secure': { + presenceData.details = `Buying ${ + document.querySelector('div.col-8.row')?.textContent + }` + break + } + default: { + const elem = pathname.split('/')[1] + if (elem === '') { + presenceData.details = 'Viewing the homepage' + presenceData.state = 'Browsing...' + } + else { + presenceData.details = `Viewing ${elem}'s profile` + presenceData.buttons = [ + { + label: 'View Profile', + url: href, + }, + ] + } + break + } + } - if (presenceData.details) presence.setActivity(presenceData); - else presence.setActivity(); -}); + if (presenceData.details) + presence.setActivity(presenceData) + else presence.setActivity() +}) diff --git a/websites/G/GAIN/metadata.json b/websites/G/GAIN/metadata.json index 352121880195..22e123440c27 100644 --- a/websites/G/GAIN/metadata.json +++ b/websites/G/GAIN/metadata.json @@ -1,38 +1,38 @@ { - "$schema": "https://schemas.premid.app/metadata/1.12", - "apiVersion": 1, - "author": { - "name": "EGGSY", - "id": "162969778699501569" - }, - "service": "GAİN", - "description": { - "en": "GAİN offers long, short series as well as creative movies, latest news, documentaries and much more!", - "tr": "GAİN ile uzun, kısa diziler, filmler, yaratıcı, güncel içerikler, belgeseller, spor, eğlence programları ve dahası istediğiniz her zaman, her yerde sizinle!" - }, - "url": "gain.tv", - "version": "1.0.17", - "logo": "https://cdn.rcd.gg/PreMiD/websites/G/GAIN/assets/logo.jpg", - "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/GAIN/assets/thumbnail.jpg", - "color": "#f5313f", - "category": "videos", - "tags": [ - "turkish", - "series", - "movie" - ], - "settings": [ - { - "id": "showImages", - "title": "İçerik Resimleri", - "icon": "fas fa-images", - "value": true - }, - { - "id": "showButtons", - "title": "Butonları Göster", - "icon": "fas fa-mouse", - "value": true - } - ] -} \ No newline at end of file + "$schema": "https://schemas.premid.app/metadata/1.12", + "apiVersion": 1, + "author": { + "name": "EGGSY", + "id": "162969778699501569" + }, + "service": "GAİN", + "description": { + "en": "GAİN offers long, short series as well as creative movies, latest news, documentaries and much more!", + "tr": "GAİN ile uzun, kısa diziler, filmler, yaratıcı, güncel içerikler, belgeseller, spor, eğlence programları ve dahası istediğiniz her zaman, her yerde sizinle!" + }, + "url": "gain.tv", + "version": "1.0.17", + "logo": "https://cdn.rcd.gg/PreMiD/websites/G/GAIN/assets/logo.jpg", + "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/GAIN/assets/thumbnail.jpg", + "color": "#f5313f", + "category": "videos", + "tags": [ + "turkish", + "series", + "movie" + ], + "settings": [ + { + "id": "showImages", + "title": "İçerik Resimleri", + "icon": "fas fa-images", + "value": true + }, + { + "id": "showButtons", + "title": "Butonları Göster", + "icon": "fas fa-mouse", + "value": true + } + ] +} diff --git a/websites/G/GAIN/presence.ts b/websites/G/GAIN/presence.ts index 3361269884b8..d6e8a23fe9ff 100644 --- a/websites/G/GAIN/presence.ts +++ b/websites/G/GAIN/presence.ts @@ -1,114 +1,115 @@ const presence = new Presence({ - clientId: "926450473559547944", - }), - presenceStrings = presence.getStrings({ - play: "general.playing", - pause: "general.paused", - }), - presenceSettings = async () => ({ - showImages: await presence.getSetting("showImages"), - showButtons: await presence.getSetting("showButtons"), - }), - presencePages: { [k: string]: string } = { - "/": "Ana Sayfa", - "/guncel": "Güncel İçerikler", - "/haber": "Haber", - "/dizi": "Diziler", - "/film": "Filmler", - "/program": "Programlar", - "/belgesel": "Belgeseller", - "/muzik": "Müzikler", - "/spor": "Spor", - "/listelerim": "Listelerim", - "/profil": "Hesap Bilgilerim", - "/abonelik-secenekleri": "Abonelik Seçenekleri", - "/sikca-sorulan-sorular": "Sıkça Sorulan Sorular", - "/nasil-izlerim": "Nasıl İzlerim?", - "/kupon-kullan": "Kupon Kullan", - "/kurumsal-bilgiler": "Kurumsal Bilgiler", - "/uyelik-kosullari": "Üyelik Koşulları", - "/on-bilgilendirme-formu": "Ön Bilgilendirme Formu", - "/cerez-politikasi": "Çerez Politikası", - "/gizlilik-politikasi": "Gizlilik Politikası", - "/abonelik-sozlesmesi": "Abonelik Sözleşmesi", - }; + clientId: '926450473559547944', +}) +const presenceStrings = presence.getStrings({ + play: 'general.playing', + pause: 'general.paused', +}) +async function presenceSettings() { + return { + showImages: await presence.getSetting('showImages'), + showButtons: await presence.getSetting('showButtons'), + } +} +const presencePages: { [k: string]: string } = { + '/': 'Ana Sayfa', + '/guncel': 'Güncel İçerikler', + '/haber': 'Haber', + '/dizi': 'Diziler', + '/film': 'Filmler', + '/program': 'Programlar', + '/belgesel': 'Belgeseller', + '/muzik': 'Müzikler', + '/spor': 'Spor', + '/listelerim': 'Listelerim', + '/profil': 'Hesap Bilgilerim', + '/abonelik-secenekleri': 'Abonelik Seçenekleri', + '/sikca-sorulan-sorular': 'Sıkça Sorulan Sorular', + '/nasil-izlerim': 'Nasıl İzlerim?', + '/kupon-kullan': 'Kupon Kullan', + '/kurumsal-bilgiler': 'Kurumsal Bilgiler', + '/uyelik-kosullari': 'Üyelik Koşulları', + '/on-bilgilendirme-formu': 'Ön Bilgilendirme Formu', + '/cerez-politikasi': 'Çerez Politikası', + '/gizlilik-politikasi': 'Gizlilik Politikası', + '/abonelik-sozlesmesi': 'Abonelik Sözleşmesi', +} -presence.on("UpdateData", async () => { - const path = document.location.pathname, - presenceData: PresenceData = { - largeImageKey: - "https://cdn.rcd.gg/PreMiD/websites/G/presence/assets/logo.jpg", - startTimestamp: Math.floor(Date.now() / 1000), - }, - settings = await presenceSettings(); +presence.on('UpdateData', async () => { + const path = document.location.pathname + const presenceData: PresenceData = { + largeImageKey: 'https://cdn.rcd.gg/PreMiD/websites/G/presence/assets/logo.jpg', + startTimestamp: Math.floor(Date.now() / 1000), + } + const settings = await presenceSettings() - if (path.startsWith("/v/")) { - const video = document.querySelector("video"); + if (path.startsWith('/v/')) { + const video = document.querySelector('video') - presenceData.details = - document - .querySelector(".container-fluid .video-details h1") - ?.textContent?.split("-")?.[0] || "Bilinmeyen Dizi"; - presenceData.state = document.querySelector( - ".container-fluid .video-details div span.season-and-episode" - )?.textContent; + presenceData.details = document + .querySelector('.container-fluid .video-details h1') + ?.textContent + ?.split('-')?.[0] || 'Bilinmeyen Dizi' + presenceData.state = document.querySelector( + '.container-fluid .video-details div span.season-and-episode', + )?.textContent - if (settings.showImages) { - presenceData.largeImageKey = - document.querySelector( - "#video-detail-hero-video-container .video-detail-hero-video.hero-img picture img" - )?.src || "g-logo"; - } + if (settings.showImages) { + presenceData.largeImageKey = document.querySelector( + '#video-detail-hero-video-container .video-detail-hero-video.hero-img picture img', + )?.src || 'g-logo' + } - if (settings.showButtons) { - presenceData.buttons = [ - { - label: presenceData.state ? "Bölüme Git" : "Filme Git", - url: `https://presence.tv${document.location.pathname}`, - }, - ]; - } + if (settings.showButtons) { + presenceData.buttons = [ + { + label: presenceData.state ? 'Bölüme Git' : 'Filme Git', + url: `https://presence.tv${document.location.pathname}`, + }, + ] + } - if (!isNaN(video?.duration)) { - presenceData.smallImageKey = video?.paused ? Assets.Pause : Assets.Play; - presenceData.smallImageText = video?.paused - ? (await presenceStrings).pause - : (await presenceStrings).play; + if (video && !Number.isNaN(video.duration)) { + presenceData.smallImageKey = video?.paused ? Assets.Pause : Assets.Play + presenceData.smallImageText = video?.paused + ? (await presenceStrings).pause + : (await presenceStrings).play; - [presenceData.startTimestamp, presenceData.endTimestamp] = - presence.getTimestamps( - Math.floor(video?.currentTime), - Math.floor(video?.duration) - ); + [presenceData.startTimestamp, presenceData.endTimestamp] = presence.getTimestamps( + Math.floor(video?.currentTime), + Math.floor(video?.duration), + ) - if (video?.paused) { - delete presenceData.startTimestamp; - delete presenceData.endTimestamp; - } - } + if (video?.paused) { + delete presenceData.startTimestamp + delete presenceData.endTimestamp + } + } - presence.setActivity(presenceData); - } else if (path.startsWith("/t/")) { - presenceData.details = "Bir içeriğe göz atıyor:"; - presenceData.state = - document.querySelector( - ".container-fluid .video-details h1" - )?.textContent || "Bilinmeyen Dizi"; + presence.setActivity(presenceData) + } + else if (path.startsWith('/t/')) { + presenceData.details = 'Bir içeriğe göz atıyor:' + presenceData.state = document.querySelector( + '.container-fluid .video-details h1', + )?.textContent || 'Bilinmeyen Dizi' - if (settings.showImages) { - presenceData.largeImageKey = - document.querySelector( - "#video-detail-hero .video-detail-hero-video.hero-img picture img" - )?.src || "g-logo"; - } + if (settings.showImages) { + presenceData.largeImageKey = document.querySelector( + '#video-detail-hero .video-detail-hero-video.hero-img picture img', + )?.src || 'g-logo' + } - presence.setActivity(presenceData); - } else if (presencePages[path] || presencePages[path.slice(0, -1)]) { - presenceData.state = - presencePages[path] || - presencePages[path.slice(0, -1)] || - "Bilinmeyen Sayfa"; + presence.setActivity(presenceData) + } + else if (presencePages[path] || presencePages[path.slice(0, -1)]) { + presenceData.state = presencePages[path] + || presencePages[path.slice(0, -1)] + || 'Bilinmeyen Sayfa' - presence.setActivity(presenceData); - } else presence.setActivity(); -}); + presence.setActivity(presenceData) + } + else { + presence.setActivity() + } +}) diff --git a/websites/G/GAMEE/metadata.json b/websites/G/GAMEE/metadata.json index 4b80f57a9cf5..2ca68d215c85 100644 --- a/websites/G/GAMEE/metadata.json +++ b/websites/G/GAMEE/metadata.json @@ -1,26 +1,26 @@ { - "$schema": "https://schemas.premid.app/metadata/1.12", - "apiVersion": 1, - "author": { - "name": "rushia", - "id": "398752205043400724" - }, - "service": "GAMEE", - "description": { - "en": "Play games, get tickets and WIN $$$. More tickets, more chances to WIN!" - }, - "url": "www.gamee.com", - "version": "1.0.18", - "logo": "https://cdn.rcd.gg/PreMiD/websites/G/GAMEE/assets/logo.png", - "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/GAMEE/assets/thumbnail.png", - "color": "#afee70", - "category": "games", - "tags": [ - "paid-to-play", - "play-to-win", - "play-to-win-real-money", - "games", - "cash", - "prizes" - ] -} \ No newline at end of file + "$schema": "https://schemas.premid.app/metadata/1.12", + "apiVersion": 1, + "author": { + "name": "rushia", + "id": "398752205043400724" + }, + "service": "GAMEE", + "description": { + "en": "Play games, get tickets and WIN $$$. More tickets, more chances to WIN!" + }, + "url": "www.gamee.com", + "version": "1.0.18", + "logo": "https://cdn.rcd.gg/PreMiD/websites/G/GAMEE/assets/logo.png", + "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/GAMEE/assets/thumbnail.png", + "color": "#afee70", + "category": "games", + "tags": [ + "paid-to-play", + "play-to-win", + "play-to-win-real-money", + "games", + "cash", + "prizes" + ] +} diff --git a/websites/G/GAMEE/presence.ts b/websites/G/GAMEE/presence.ts index 24d260d4cacd..634992d4187e 100644 --- a/websites/G/GAMEE/presence.ts +++ b/websites/G/GAMEE/presence.ts @@ -1,65 +1,80 @@ const presence = new Presence({ - clientId: "865212562130862120", - }), - timer = Math.floor(Date.now() / 1000); + clientId: '865212562130862120', +}) +const timer = Math.floor(Date.now() / 1000) -presence.on("UpdateData", async () => { - const presenceData: PresenceData = { - largeImageKey: - "https://cdn.rcd.gg/PreMiD/websites/G/GAMEE/assets/logo.png", - startTimestamp: timer, - }, - { pathname, href } = document.location, - IDs = pathname.split("/")[2]; +presence.on('UpdateData', async () => { + const presenceData: PresenceData = { + largeImageKey: 'https://cdn.rcd.gg/PreMiD/websites/G/GAMEE/assets/logo.png', + startTimestamp: timer, + } + const { pathname, href } = document.location + const IDs = pathname.split('/')[2] - if (pathname === "/") presenceData.details = "Viewing homepage"; - else if (pathname.includes("/prizes")) - presenceData.details = "Viewing the prizes"; - else if (pathname.includes("/winners")) - presenceData.details = "Viewing the winners"; - else if (pathname.includes("/create-profile")) - presenceData.details = "Creating an account"; - else if (pathname.includes("/login")) presenceData.details = "Logg ing In"; - else if (pathname.includes("/phone-login")) - presenceData.details = "Logging in with a phone number"; - else if (pathname.includes("/reset-password")) - presenceData.details = "Resetting a password"; - else if (pathname === "/contest" || pathname === "/contest/") - presenceData.details = "Viewing Contest Page"; - else if (pathname.includes("/contest-rules")) { - presenceData.details = "Reading the contest rules"; - presenceData.smallImageKey = Assets.Reading; - presenceData.smallImageText = "Reading"; - } else if (pathname.includes("/squad")) - presenceData.details = "Viewing the squad"; - else if (pathname.includes("/terms-of-use")) { - presenceData.details = "Reading the Terms Of Service"; - presenceData.smallImageKey = Assets.Reading; - presenceData.smallImageText = "Reading"; - } else if (pathname.includes("/privacy")) { - presenceData.details = "Reading the Privacy Policy"; - presenceData.smallImageKey = Assets.Reading; - presenceData.smallImageText = "Reading"; - } else if (pathname.includes(`/profile/${IDs}`)) { - const name = document.querySelector( - "#root > div.layout.layout--with-tab-bar.layout__profile-page > div.profile-page__container > div.profile-header > h1" - ); + if (pathname === '/') { + presenceData.details = 'Viewing homepage' + } + else if (pathname.includes('/prizes')) { + presenceData.details = 'Viewing the prizes' + } + else if (pathname.includes('/winners')) { + presenceData.details = 'Viewing the winners' + } + else if (pathname.includes('/create-profile')) { + presenceData.details = 'Creating an account' + } + else if (pathname.includes('/login')) { + presenceData.details = 'Logg ing In' + } + else if (pathname.includes('/phone-login')) { + presenceData.details = 'Logging in with a phone number' + } + else if (pathname.includes('/reset-password')) { + presenceData.details = 'Resetting a password' + } + else if (pathname === '/contest' || pathname === '/contest/') { + presenceData.details = 'Viewing Contest Page' + } + else if (pathname.includes('/contest-rules')) { + presenceData.details = 'Reading the contest rules' + presenceData.smallImageKey = Assets.Reading + presenceData.smallImageText = 'Reading' + } + else if (pathname.includes('/squad')) { + presenceData.details = 'Viewing the squad' + } + else if (pathname.includes('/terms-of-use')) { + presenceData.details = 'Reading the Terms Of Service' + presenceData.smallImageKey = Assets.Reading + presenceData.smallImageText = 'Reading' + } + else if (pathname.includes('/privacy')) { + presenceData.details = 'Reading the Privacy Policy' + presenceData.smallImageKey = Assets.Reading + presenceData.smallImageText = 'Reading' + } + else if (pathname.includes(`/profile/${IDs}`)) { + const name = document.querySelector( + '#root > div.layout.layout--with-tab-bar.layout__profile-page > div.profile-page__container > div.profile-header > h1', + ) - presenceData.details = "Viewing a user's profile:"; - presenceData.state = name.textContent; - presenceData.buttons = [ - { - label: `View ${name.textContent}'s profile`, - url: href, - }, - ]; - } else if (pathname.includes(`/game/${IDs}`)) { - presenceData.details = "Playing a game:"; - presenceData.state = document.querySelector( - "#root > div.game-page > div.game-detail > div.game-bar > div.game-bar__slot.game-bar__slot--left > h3" - ).textContent; - } + presenceData.details = 'Viewing a user\'s profile:' + presenceData.state = name?.textContent + presenceData.buttons = [ + { + label: `View ${name?.textContent}'s profile`, + url: href, + }, + ] + } + else if (pathname.includes(`/game/${IDs}`)) { + presenceData.details = 'Playing a game:' + presenceData.state = document.querySelector( + '#root > div.game-page > div.game-detail > div.game-bar > div.game-bar__slot.game-bar__slot--left > h3', + )?.textContent + } - if (presenceData.details) presence.setActivity(presenceData); - else presence.setActivity(); -}); + if (presenceData.details) + presence.setActivity(presenceData) + else presence.setActivity() +}) diff --git a/websites/G/GBAtemp.net/metadata.json b/websites/G/GBAtemp.net/metadata.json index 10426aefe913..73942a0f58e7 100644 --- a/websites/G/GBAtemp.net/metadata.json +++ b/websites/G/GBAtemp.net/metadata.json @@ -1,24 +1,24 @@ { - "$schema": "https://schemas.premid.app/metadata/1.12", - "apiVersion": 1, - "author": { - "name": "sks316", - "id": "226098403304538122" - }, - "service": "GBAtemp.net", - "description": { - "en": "GBAtemp is a user friendly independent video game community with millions of posts about 3DS and Nintendo DS, Wii and Wii U, Switch and other general consoles including PC gaming.", - "nl": "GBAtemp is een gebruikersvriendelijke onafhankelijke videogame community met miljoenen berichten over 3DS en Nintendo DS, Wii en Wii U, Switch en andere algemene consoles inclusief PC gaming." - }, - "url": "gbatemp.net", - "version": "1.3.22", - "logo": "https://cdn.rcd.gg/PreMiD/websites/G/GBAtemp.net/assets/logo.jpg", - "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/GBAtemp.net/assets/thumbnail.png", - "color": "#7692aa", - "category": "games", - "tags": [ - "games", - "hacking", - "community" - ] -} \ No newline at end of file + "$schema": "https://schemas.premid.app/metadata/1.12", + "apiVersion": 1, + "author": { + "name": "sks316", + "id": "226098403304538122" + }, + "service": "GBAtemp.net", + "description": { + "en": "GBAtemp is a user friendly independent video game community with millions of posts about 3DS and Nintendo DS, Wii and Wii U, Switch and other general consoles including PC gaming.", + "nl": "GBAtemp is een gebruikersvriendelijke onafhankelijke videogame community met miljoenen berichten over 3DS en Nintendo DS, Wii en Wii U, Switch en andere algemene consoles inclusief PC gaming." + }, + "url": "gbatemp.net", + "version": "1.3.22", + "logo": "https://cdn.rcd.gg/PreMiD/websites/G/GBAtemp.net/assets/logo.jpg", + "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/GBAtemp.net/assets/thumbnail.png", + "color": "#7692aa", + "category": "games", + "tags": [ + "games", + "hacking", + "community" + ] +} diff --git a/websites/G/GBAtemp.net/presence.ts b/websites/G/GBAtemp.net/presence.ts index 8fb3928e122f..63314bf0cfb8 100644 --- a/websites/G/GBAtemp.net/presence.ts +++ b/websites/G/GBAtemp.net/presence.ts @@ -1,88 +1,93 @@ const presence = new Presence({ - clientId: "632110854543769601", - }), - browsingTimestamp = Math.floor(Date.now() / 1000); + clientId: '632110854543769601', +}) +const browsingTimestamp = Math.floor(Date.now() / 1000) -let threadName: HTMLElement, - authorName: HTMLElement, - newsAuthor: HTMLElement, - profileName: HTMLElement, - gName: HTMLElement, - pName: HTMLElement, - cName: HTMLElement; - -presence.on("UpdateData", async () => { - const presenceData: PresenceData = { - largeImageKey: - "https://cdn.rcd.gg/PreMiD/websites/G/GBAtemp.net/assets/logo.jpg", - startTimestamp: browsingTimestamp, - }; - if (document.location.pathname.startsWith("/threads")) { - threadName = document.querySelector("a#threadTitle"); - authorName = document.querySelector( - "span.postedBy > span.posted.iconKey > a.username" - ); - newsAuthor = document.querySelector("div.news-author > a.username > b"); - if (!authorName) { - presenceData.details = `Reading a news post by ${newsAuthor.textContent}`; - presenceData.state = threadName.textContent; - } else { - presenceData.details = `Reading a thread by ${authorName.textContent}`; - presenceData.state = threadName.textContent; - } - } else if (document.location.pathname.startsWith("/game")) { - gName = document.querySelector("h1.dynamicTitle"); - if (gName.textContent === "GBAtemp Game Center Home") - presenceData.details = "Browsing..."; - else { - presenceData.details = "Reading about a game"; - presenceData.state = gName.textContent; - } - } else if (document.location.pathname.startsWith("/platform")) { - pName = document.querySelector("h1.dynamicTitle"); - if ( - pName.textContent === "Game Center Platform List" || - cName.textContent === "List of video game companies" || - pName.textContent === "Game Database" - ) - presenceData.details = "Browsing..."; - else { - presenceData.details = "Reading about a platform"; - presenceData.state = pName.textContent; - } - } else if (document.location.pathname.startsWith("/company")) { - cName = document.querySelector("h1.dynamicTitle"); - presenceData.details = "Reading about a company"; - presenceData.state = cName.textContent; - } else if (document.location.pathname.startsWith("/questions")) { - presenceData.details = "Reading a question"; - presenceData.state = document.querySelector("h1.blueHeader").textContent; - } else if (document.location.pathname.startsWith("/members")) { - profileName = document.querySelector( - "div.mainText.secondaryContent > h1.username" - ); - if (!profileName) presenceData.details = "Browsing..."; - else - presenceData.details = `Looking at ${profileName.textContent}'s profile`; - } else if (document.location.pathname.startsWith("/chat")) - presenceData.details = "Chatting in IRC"; - else if (document.location.pathname.startsWith("/shoutbox")) - presenceData.details = "Chatting in the Shoutbox"; - else if (document.location.pathname.startsWith("/search")) - presenceData.details = "Searching..."; - else if (document.location.pathname.startsWith("/review")) { - presenceData.details = `Reading a review by ${ - document.querySelector("h1#review_title > a").textContent - }`; - presenceData.state = document.querySelector( - "span.review_author > a.username" - ).textContent; - } else if (document.location.pathname.startsWith("/entry")) { - presenceData.details = `Reading a blog post by ${ - document.querySelector("span.postedBy > span.posted.iconKey > a.username") - .textContent - }`; - presenceData.state = document.querySelector("a.newsTitle").textContent; - } - presence.setActivity(presenceData); -}); +presence.on('UpdateData', async () => { + const presenceData: PresenceData = { + largeImageKey: 'https://cdn.rcd.gg/PreMiD/websites/G/GBAtemp.net/assets/logo.jpg', + startTimestamp: browsingTimestamp, + } + if (document.location.pathname.startsWith('/threads')) { + const threadName = document.querySelector('a#threadTitle') + const authorName = document.querySelector( + 'span.postedBy > span.posted.iconKey > a.username', + ) + const newsAuthor = document.querySelector('div.news-author > a.username > b') + if (!authorName) { + presenceData.details = `Reading a news post by ${newsAuthor?.textContent}` + presenceData.state = threadName?.textContent + } + else { + presenceData.details = `Reading a thread by ${authorName.textContent}` + presenceData.state = threadName?.textContent + } + } + else if (document.location.pathname.startsWith('/game')) { + const gName = document.querySelector('h1.dynamicTitle') + if (gName?.textContent === 'GBAtemp Game Center Home') { + presenceData.details = 'Browsing...' + } + else { + presenceData.details = 'Reading about a game' + presenceData.state = gName?.textContent + } + } + else if (document.location.pathname.startsWith('/platform')) { + const pName = document.querySelector('h1.dynamicTitle') + if ( + pName?.textContent === 'Game Center Platform List' + || pName?.textContent === 'List of video game companies' + || pName?.textContent === 'Game Database' + ) { + presenceData.details = 'Browsing...' + } + else { + presenceData.details = 'Reading about a platform' + presenceData.state = pName?.textContent + } + } + else if (document.location.pathname.startsWith('/company')) { + const cName = document.querySelector('h1.dynamicTitle') + presenceData.details = 'Reading about a company' + presenceData.state = cName?.textContent + } + else if (document.location.pathname.startsWith('/questions')) { + presenceData.details = 'Reading a question' + presenceData.state = document.querySelector('h1.blueHeader')?.textContent + } + else if (document.location.pathname.startsWith('/members')) { + const profileName = document.querySelector( + 'div.mainText.secondaryContent > h1.username', + ) + if (!profileName) + presenceData.details = 'Browsing...' + else + presenceData.details = `Looking at ${profileName.textContent}'s profile` + } + else if (document.location.pathname.startsWith('/chat')) { + presenceData.details = 'Chatting in IRC' + } + else if (document.location.pathname.startsWith('/shoutbox')) { + presenceData.details = 'Chatting in the Shoutbox' + } + else if (document.location.pathname.startsWith('/search')) { + presenceData.details = 'Searching...' + } + else if (document.location.pathname.startsWith('/review')) { + presenceData.details = `Reading a review by ${ + document.querySelector('h1#review_title > a')?.textContent + }` + presenceData.state = document.querySelector( + 'span.review_author > a.username', + )?.textContent + } + else if (document.location.pathname.startsWith('/entry')) { + presenceData.details = `Reading a blog post by ${ + document.querySelector('span.postedBy > span.posted.iconKey > a.username') + ?.textContent + }` + presenceData.state = document.querySelector('a.newsTitle')?.textContent + } + presence.setActivity(presenceData) +}) diff --git a/websites/G/GDBrowser/metadata.json b/websites/G/GDBrowser/metadata.json index 8c9941cf2ba3..f5721d0c0322 100644 --- a/websites/G/GDBrowser/metadata.json +++ b/websites/G/GDBrowser/metadata.json @@ -1,22 +1,22 @@ { - "$schema": "https://schemas.premid.app/metadata/1.12", - "apiVersion": 1, - "author": { - "name": "Stringy", - "id": "577743466940071949" - }, - "service": "GDBrowser", - "description": { - "en": "Browse all of Geometry Dash's online features, right from this handy little website! Levels, profiles, leaderboards, comments, and more!", - "nl": "Bekijk alle online functies van Geometry Dash, direct vanaf deze handige kleine website! Levels, profielen, klassementen, commentaar, en meer!" - }, - "url": "gdbrowser.com", - "version": "1.3.28", - "logo": "https://cdn.rcd.gg/PreMiD/websites/G/GDBrowser/assets/logo.png", - "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/GDBrowser/assets/thumbnail.png", - "color": "#FFFF00", - "category": "games", - "tags": [ - "games" - ] -} \ No newline at end of file + "$schema": "https://schemas.premid.app/metadata/1.12", + "apiVersion": 1, + "author": { + "name": "Stringy", + "id": "577743466940071949" + }, + "service": "GDBrowser", + "description": { + "en": "Browse all of Geometry Dash's online features, right from this handy little website! Levels, profiles, leaderboards, comments, and more!", + "nl": "Bekijk alle online functies van Geometry Dash, direct vanaf deze handige kleine website! Levels, profielen, klassementen, commentaar, en meer!" + }, + "url": "gdbrowser.com", + "version": "1.3.28", + "logo": "https://cdn.rcd.gg/PreMiD/websites/G/GDBrowser/assets/logo.png", + "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/GDBrowser/assets/thumbnail.png", + "color": "#FFFF00", + "category": "games", + "tags": [ + "games" + ] +} diff --git a/websites/G/GDBrowser/presence.ts b/websites/G/GDBrowser/presence.ts index 9531dd6b7610..fac0c66ff614 100644 --- a/websites/G/GDBrowser/presence.ts +++ b/websites/G/GDBrowser/presence.ts @@ -1,177 +1,175 @@ const presence = new Presence({ - clientId: "635876670146084880", - }), - /* eslint-disable camelcase */ - assets = { - diff_hard: "https://cdn.rcd.gg/PreMiD/websites/G/GDBrowser/assets/0.png", - diff_easy: "https://cdn.rcd.gg/PreMiD/websites/G/GDBrowser/assets/1.png", - diff_normal: "https://cdn.rcd.gg/PreMiD/websites/G/GDBrowser/assets/2.png", - diff_insane: "https://cdn.rcd.gg/PreMiD/websites/G/GDBrowser/assets/3.png", - diff_harder: "https://cdn.rcd.gg/PreMiD/websites/G/GDBrowser/assets/4.png", - diff_demon: "https://cdn.rcd.gg/PreMiD/websites/G/GDBrowser/assets/5.png", - diff_auto: "https://cdn.rcd.gg/PreMiD/websites/G/GDBrowser/assets/6.png", - diff_medium_demon: - "https://cdn.rcd.gg/PreMiD/websites/G/GDBrowser/assets/7.png", - diff_extreme_demon: - "https://cdn.rcd.gg/PreMiD/websites/G/GDBrowser/assets/8.png", - diff_hard_demon: - "https://cdn.rcd.gg/PreMiD/websites/G/GDBrowser/assets/9.png", - diff_easy_demon: - "https://cdn.rcd.gg/PreMiD/websites/G/GDBrowser/assets/10.png", - diff_insane_demon: - "https://cdn.rcd.gg/PreMiD/websites/G/GDBrowser/assets/11.png", - }; -/* eslint-enable camelcase */ + clientId: '635876670146084880', +}) -presence.on("UpdateData", async () => { - const presenceData: PresenceData = { - largeImageKey: - "https://cdn.rcd.gg/PreMiD/websites/G/GDBrowser/assets/logo.png", - }, - q = new URLSearchParams(window.location.search); +const assets = { + diff_hard: 'https://cdn.rcd.gg/PreMiD/websites/G/GDBrowser/assets/0.png', + diff_easy: 'https://cdn.rcd.gg/PreMiD/websites/G/GDBrowser/assets/1.png', + diff_normal: 'https://cdn.rcd.gg/PreMiD/websites/G/GDBrowser/assets/2.png', + diff_insane: 'https://cdn.rcd.gg/PreMiD/websites/G/GDBrowser/assets/3.png', + diff_harder: 'https://cdn.rcd.gg/PreMiD/websites/G/GDBrowser/assets/4.png', + diff_demon: 'https://cdn.rcd.gg/PreMiD/websites/G/GDBrowser/assets/5.png', + diff_auto: 'https://cdn.rcd.gg/PreMiD/websites/G/GDBrowser/assets/6.png', + diff_medium_demon: 'https://cdn.rcd.gg/PreMiD/websites/G/GDBrowser/assets/7.png', + diff_extreme_demon: 'https://cdn.rcd.gg/PreMiD/websites/G/GDBrowser/assets/8.png', + diff_hard_demon: 'https://cdn.rcd.gg/PreMiD/websites/G/GDBrowser/assets/9.png', + diff_easy_demon: 'https://cdn.rcd.gg/PreMiD/websites/G/GDBrowser/assets/10.png', + diff_insane_demon: 'https://cdn.rcd.gg/PreMiD/websites/G/GDBrowser/assets/11.png', +} - if (window.location.href.includes("gdbrowser.com")) { - if ( - (window.location.pathname.toLowerCase() !== "/" && - window.location.pathname.toLowerCase() === "/daily") || - window.location.pathname.toLowerCase() === "/weekly" - ) { - presenceData.state = `🔽 ${ - document.querySelectorAll(".inline.smaller.spaced")[0].textContent - } | 👍 ${document.querySelectorAll(".inline.smaller.spaced")[1]} | 🔵 ${ - document.querySelectorAll(".orbs")[1].textContent - }`; - presenceData.details = `${ - document.querySelectorAll("h1")[0].textContent - } ${document.querySelector("#authorLink").textContent}`; - presenceData.smallImageKey = - assets[ - `diff_${document - .querySelector("#difficultytext") - .textContent.toLowerCase() - .replace("
", "_")}` as keyof typeof assets - ]; - presenceData.smallImageText = `${document - .querySelector("#difficultytext") - .textContent.replace("
", " ")}`; - } +presence.on('UpdateData', async () => { + const presenceData: PresenceData = { + largeImageKey: 'https://cdn.rcd.gg/PreMiD/websites/G/GDBrowser/assets/logo.png', + } + const q = new URLSearchParams(window.location.search) - // Homepage - if (window.location.pathname.toLowerCase() === "/") { - if ( - document.querySelector("#credits").style.display === - "block" - ) { - presenceData.details = "Viewing the credits"; - presenceData.state = "❤"; - } else presenceData.details = "Viewing the homepage"; - } + if (window.location.href.includes('gdbrowser.com')) { + if ( + (window.location.pathname.toLowerCase() !== '/' + && window.location.pathname.toLowerCase() === '/daily') + || window.location.pathname.toLowerCase() === '/weekly' + ) { + presenceData.state = `🔽 ${ + document.querySelectorAll('.inline.smaller.spaced')[0].textContent + } | 👍 ${document.querySelectorAll('.inline.smaller.spaced')[1]} | 🔵 ${ + document.querySelectorAll('.orbs')[1].textContent + }` + presenceData.details = `${ + document.querySelectorAll('h1')[0].textContent + } ${document.querySelector('#authorLink')?.textContent}` + presenceData.smallImageKey = assets[ + `diff_${document + .querySelector('#difficultytext') + ?.textContent + ?.toLowerCase() + ?.replace('
', '_')}` as keyof typeof assets + ] + presenceData.smallImageText = `${document + .querySelector('#difficultytext') + ?.textContent + ?.replace('
', ' ')}` + } - // other stuff - if (window.location.pathname.toLowerCase() === "/iconkit") - presenceData.details = "In the iconkit"; + // Homepage + if (window.location.pathname.toLowerCase() === '/') { + if ( + document.querySelector('#credits')?.style.display + === 'block' + ) { + presenceData.details = 'Viewing the credits' + presenceData.state = '❤' + } + else { + presenceData.details = 'Viewing the homepage' + } + } - if (window.location.pathname.toLowerCase().includes("/search")) { - if (window.location.pathname.toLowerCase() === "/search") - presenceData.details = "Searching for levels"; - else { - presenceData.details = "Searching for levels"; + // other stuff + if (window.location.pathname.toLowerCase() === '/iconkit') + presenceData.details = 'In the iconkit' - if (parseInt(q.get("mappack")) === 1) - presenceData.state = "Viewing a map pack"; + if (window.location.pathname.toLowerCase().includes('/search')) { + if (window.location.pathname.toLowerCase() === '/search') { + presenceData.details = 'Searching for levels' + } + else { + presenceData.details = 'Searching for levels' - switch (q.get("type")) { - case "recent": - presenceData.state = "🕒 Viewing recent levels"; - break; - case "mostdownloaded": - presenceData.state = "🔽 Viewing top downloaded levels"; - break; - case "mostliked": - presenceData.state = "👍 Viewing top liked levels"; - break; - case "trending": - presenceData.state = "📈 Viewing trending levels"; - break; - case "magic": - presenceData.state = "✨ Viewing magic levels"; - break; - case "awarded": - presenceData.state = "⭐ Viewing awarded levels"; - break; - case "featured": - presenceData.state = "⭐ Viewing featured levels"; - break; - case "followed": - presenceData.state = "💙 Viewing followed levels"; - break; - default: - switch (q.get("diff")) { - case "1": - presenceData.state = "😄 Viewing Easy levels"; - break; - case "2": - presenceData.state = "😃 Viewing Normal levels"; - break; - case "3": - presenceData.state = "😅 Viewing Hard levels"; - break; - case "4": - presenceData.state = "😐 Viewing Harder levels"; - break; - case "5": - presenceData.state = "🙁 Viewing Insane levels"; - break; - case "-1": - presenceData.state = "😶 Viewing Unrated levels"; - break; - case "-2": - switch (q.get("demonFilter")) { - case "1": - presenceData.state = "😠 Viewing Easy Demons"; - break; - case "2": - presenceData.state = "😡 Viewing Medium Demons"; - break; - case "3": - presenceData.state = "🤬 Viewing Hard Demons"; - break; - case "4": - presenceData.state = "😈 Viewing Insane Demons"; - break; - case "5": - presenceData.state = "👿 Viewing Extreme Demons"; - break; - } - break; - default: - presenceData.state = `Searching for ${ - document.querySelector("#header").textContent - }`; - break; - } - } - } - } + if (Number.parseInt(q.get('mappack')!) === 1) + presenceData.state = 'Viewing a map pack' - if (window.location.pathname.toLowerCase().includes("/mappacks")) - presenceData.details = "Viewing the Map Packs"; + switch (q.get('type')) { + case 'recent': + presenceData.state = '🕒 Viewing recent levels' + break + case 'mostdownloaded': + presenceData.state = '🔽 Viewing top downloaded levels' + break + case 'mostliked': + presenceData.state = '👍 Viewing top liked levels' + break + case 'trending': + presenceData.state = '📈 Viewing trending levels' + break + case 'magic': + presenceData.state = '✨ Viewing magic levels' + break + case 'awarded': + presenceData.state = '⭐ Viewing awarded levels' + break + case 'featured': + presenceData.state = '⭐ Viewing featured levels' + break + case 'followed': + presenceData.state = '💙 Viewing followed levels' + break + default: + switch (q.get('diff')) { + case '1': + presenceData.state = '😄 Viewing Easy levels' + break + case '2': + presenceData.state = '😃 Viewing Normal levels' + break + case '3': + presenceData.state = '😅 Viewing Hard levels' + break + case '4': + presenceData.state = '😐 Viewing Harder levels' + break + case '5': + presenceData.state = '🙁 Viewing Insane levels' + break + case '-1': + presenceData.state = '😶 Viewing Unrated levels' + break + case '-2': + switch (q.get('demonFilter')) { + case '1': + presenceData.state = '😠 Viewing Easy Demons' + break + case '2': + presenceData.state = '😡 Viewing Medium Demons' + break + case '3': + presenceData.state = '🤬 Viewing Hard Demons' + break + case '4': + presenceData.state = '😈 Viewing Insane Demons' + break + case '5': + presenceData.state = '👿 Viewing Extreme Demons' + break + } + break + default: + presenceData.state = `Searching for ${ + document.querySelector('#header')?.textContent + }` + break + } + } + } + } - if (window.location.pathname.toLowerCase().includes("/gauntlets")) - presenceData.details = "Viewing the Gauntlets"; + if (window.location.pathname.toLowerCase().includes('/mappacks')) + presenceData.details = 'Viewing the Map Packs' - if (window.location.pathname.toLowerCase().includes("/leaderboards")) - presenceData.details = "Viewing the leaderboards"; + if (window.location.pathname.toLowerCase().includes('/gauntlets')) + presenceData.details = 'Viewing the Gauntlets' - if (window.location.pathname.toLowerCase() === "/messages") - presenceData.details = "Checking messages"; + if (window.location.pathname.toLowerCase().includes('/leaderboards')) + presenceData.details = 'Viewing the leaderboards' - if (window.location.pathname.toLowerCase().includes("/profile")) { - presenceData.details = `Looking at ${ - window.location.href.split("/")[4] - }'s profile`; - } + if (window.location.pathname.toLowerCase() === '/messages') + presenceData.details = 'Checking messages' - presence.setActivity(presenceData); - } -}); + if (window.location.pathname.toLowerCase().includes('/profile')) { + presenceData.details = `Looking at ${ + window.location.href.split('/')[4] + }'s profile` + } + + presence.setActivity(presenceData) + } +}) diff --git a/websites/G/GG App/metadata.json b/websites/G/GG App/metadata.json index cf4bc35760fc..57e7a3c5271d 100644 --- a/websites/G/GG App/metadata.json +++ b/websites/G/GG App/metadata.json @@ -1,47 +1,47 @@ { - "$schema": "https://schemas.premid.app/metadata/1.12", - "apiVersion": 1, - "author": { - "name": "Kyrie", - "id": "368399721494216706" - }, - "service": "GG App", - "altnames": [ - "GG|" - ], - "description": { - "en": "Discover new games, keep track of the ones you want to play, and connect with friends.", - "vi_VN": "Khám phá các trò chơi mới, theo dõi những gì bạn muốn chơi, và kết nối với bạn bè." - }, - "url": "ggapp.io", - "version": "1.0.16", - "logo": "https://cdn.rcd.gg/PreMiD/websites/G/GG%20App/assets/logo.png", - "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/GG%20App/assets/thumbnail.png", - "color": "#071224", - "category": "games", - "tags": [ - "games", - "database", - "gg" - ], - "settings": [ - { - "id": "timestamps", - "title": "Show elapsed time", - "icon": "fas fa-stopwatch", - "value": true - }, - { - "id": "cover", - "title": "Show images", - "icon": "fad fa-images", - "value": true - }, - { - "id": "buttons", - "title": "Show buttons", - "icon": "fas fa-compress-arrows-alt", - "value": true - } - ] -} \ No newline at end of file + "$schema": "https://schemas.premid.app/metadata/1.12", + "apiVersion": 1, + "author": { + "name": "Kyrie", + "id": "368399721494216706" + }, + "service": "GG App", + "altnames": [ + "GG|" + ], + "description": { + "en": "Discover new games, keep track of the ones you want to play, and connect with friends.", + "vi_VN": "Khám phá các trò chơi mới, theo dõi những gì bạn muốn chơi, và kết nối với bạn bè." + }, + "url": "ggapp.io", + "version": "1.0.16", + "logo": "https://cdn.rcd.gg/PreMiD/websites/G/GG%20App/assets/logo.png", + "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/GG%20App/assets/thumbnail.png", + "color": "#071224", + "category": "games", + "tags": [ + "games", + "database", + "gg" + ], + "settings": [ + { + "id": "timestamps", + "title": "Show elapsed time", + "icon": "fas fa-stopwatch", + "value": true + }, + { + "id": "cover", + "title": "Show images", + "icon": "fad fa-images", + "value": true + }, + { + "id": "buttons", + "title": "Show buttons", + "icon": "fas fa-compress-arrows-alt", + "value": true + } + ] +} diff --git a/websites/G/GG App/presence.ts b/websites/G/GG App/presence.ts index d1551afeb77e..d1c856e8a333 100644 --- a/websites/G/GG App/presence.ts +++ b/websites/G/GG App/presence.ts @@ -1,133 +1,147 @@ const presence = new Presence({ - clientId: "928868301105426463", - }), - browsingTimestamp = Math.floor(Date.now() / 1000); + clientId: '928868301105426463', +}) +const browsingTimestamp = Math.floor(Date.now() / 1000) const enum Assets { - Logo = "https://cdn.rcd.gg/PreMiD/websites/G/GG%20App/assets/logo.png", + Logo = 'https://cdn.rcd.gg/PreMiD/websites/G/GG%20App/assets/logo.png', } -presence.on("UpdateData", async () => { - const presenceData: PresenceData = { - largeImageKey: Assets.Logo, - startTimestamp: browsingTimestamp, - }, - path = document.location.pathname, - [timestamps, cover, buttons] = await Promise.all([ - presence.getSetting("timestamps"), - presence.getSetting("cover"), - presence.getSetting("buttons"), - ]); - // Apparently "/games" is a user page so .pathname can't be used to detect a game but instead the header - if ( - document.querySelector( - "#root > div > div.css-1dbjc4n > div > div > div > div > div:nth-child(1) > h1" - ) && - path.startsWith("/games") - ) { - presenceData.details = "Viewing Game:"; - presenceData.state = document.querySelector( - "#root > div > div.css-1dbjc4n > div > div > div > div > div:nth-child(1) > h1" - ).textContent; - if (cover) { - presenceData.largeImageKey = document.querySelector( - "#root > div > div.css-1dbjc4n > div > div > div > div.css-1dbjc4n > img" - ).src; - presenceData.smallImageKey = Assets.Logo; - } - presenceData.buttons = [{ label: "View Game", url: document.URL }]; - } else if ( - document.querySelector( - "#root > div > div.css-1dbjc4n > div > div:nth-child(3) > div.w-full > div > div > div:nth-child(2) > h2" - ) || - document.querySelector( - "#root > div > div.css-1dbjc4n > div > div > div > div > div > div > p.text-white.md\\:mt-2 > a" - ) - ) { - const listname = document.querySelector( - "#root > div > div.css-1dbjc4n > div > div.w-full.xl\\:max-w-max.mx-auto.pt-8 > div > div.flex.flex-column.p-3 > div > div.flex.flex-column.md\\:flex-row.items-start.md\\:items-center > p:nth-child(1) > span" - ), - profilePicture = document.querySelector( - "#root > div > div.css-1dbjc4n > div > div:nth-child(3) > div.w-full > div > div > a > img" - ); - presenceData.details = `Viewing ${ - document.querySelector(":is(div > a > h1, p > span + a)").textContent - }'s profile`; - presenceData.buttons = [{ label: "View Profile", url: document.URL }]; - if (listname) { - presenceData.state = listname.textContent; - presenceData.buttons = [{ label: "View List", url: document.URL }]; - } - if (cover && profilePicture) { - presenceData.largeImageKey = document.querySelector( - "#root > div > div.css-1dbjc4n > div > div:nth-child(3) > div.w-full > div > div > a > img" - ).src; - presenceData.smallImageKey = Assets.Logo; - } - } else if (path.includes("/games/")) { - if (path.endsWith("/reviews")) { - presenceData.details = "Reading reviews of:"; - presenceData.state = document - .querySelector( - "#root > div > div.css-1dbjc4n > div > div > div > div.css-1dbjc4n > div.css-901oao" - ) - .textContent.slice(11); - } else if (path.includes("edit")) { - presenceData.details = "Editing Game:"; - presenceData.state = document.querySelector( - "#root > div > div.css-1dbjc4n > div > div > h1 > a" - ).textContent; - presenceData.smallImageKey = Assets.Writing; - } else if (path.endsWith("/lists")) { - presenceData.details = "Browsing lists containing:"; - presenceData.state = document - .querySelector( - "#root > div > div.css-1dbjc4n > div > div > div > h1" - ) - .textContent.slice(17); - } - } else if (path.includes("/reviews/")) { - presenceData.details = `Reading ${ - document.querySelector( - "#root > div > div.css-1dbjc4n > div > div > div > div > div > div:nth-child(1) > div > a > h2" - ).textContent - }'s review`; - presenceData.state = `of ${ - document.querySelector( - "#root > div > div.css-1dbjc4n > div > div > div > div > div > div:nth-child(1) > a > h1" - ).textContent - }`; - if (cover) { - presenceData.largeImageKey = document.querySelector( - "#root > div > div.css-1dbjc4n > div > div > div > div > a > img" - ).src; - presenceData.smallImageKey = Assets.Logo; - } - presenceData.buttons = [{ label: "Read Review", url: document.URL }]; - } else if (path.startsWith("/home")) presenceData.details = "At Home page"; - else if (path.startsWith("/search/")) { - presenceData.details = "Searching for:"; - presenceData.state = document.querySelector( - "#root > div > div.css-1dbjc4n > div > div.w-full.xl\\:max-w-max.mx-auto > div > div:nth-child(1) > p > span.text-2xl.font-bold.pl-2" - ).textContent; - presenceData.smallImageKey = Assets.Search; - } else if (path.endsWith("/lists")) { - presenceData.details = `Viewing ${document.title.match(/(.*) -/)[1]}`; - if (cover) { - presenceData.largeImageKey = document.querySelector( - "#root > div > div.css-1dbjc4n > div > div > div.w-full > div > div > a > img" - ).src; - presenceData.smallImageKey = Assets.Logo; - } - presenceData.buttons = [{ label: "View Lists", url: document.URL }]; - } else if (path.includes("/lists/")) { - presenceData.details = "Viewing List:"; - presenceData.state = document.querySelector( - "#root > div > div.css-1dbjc4n > div > div.flex.flex-col.flex-1.w-full.z-10.px-2.sm\\:px-4 > div > div:nth-child(1) > div.flex.flex-col.flex-grow > div.flex.flex-col > h1" - ).textContent; - presenceData.buttons = [{ label: "View List", url: document.URL }]; - } - if (!buttons) delete presenceData.buttons; - if (!timestamps) delete presenceData.startTimestamp; - presence.setActivity(presenceData); -}); +presence.on('UpdateData', async () => { + const presenceData: PresenceData = { + largeImageKey: Assets.Logo, + startTimestamp: browsingTimestamp, + } + const path = document.location.pathname + const [timestamps, cover, buttons] = await Promise.all([ + presence.getSetting('timestamps'), + presence.getSetting('cover'), + presence.getSetting('buttons'), + ]) + // Apparently "/games" is a user page so .pathname can't be used to detect a game but instead the header + if ( + document.querySelector( + '#root > div > div.css-1dbjc4n > div > div > div > div > div:nth-child(1) > h1', + ) + && path.startsWith('/games') + ) { + presenceData.details = 'Viewing Game:' + presenceData.state = document.querySelector( + '#root > div > div.css-1dbjc4n > div > div > div > div > div:nth-child(1) > h1', + )?.textContent + if (cover) { + presenceData.largeImageKey = document.querySelector( + '#root > div > div.css-1dbjc4n > div > div > div > div.css-1dbjc4n > img', + )?.src + presenceData.smallImageKey = Assets.Logo + } + presenceData.buttons = [{ label: 'View Game', url: document.URL }] + } + else if ( + document.querySelector( + '#root > div > div.css-1dbjc4n > div > div:nth-child(3) > div.w-full > div > div > div:nth-child(2) > h2', + ) + || document.querySelector( + '#root > div > div.css-1dbjc4n > div > div > div > div > div > div > p.text-white.md\\:mt-2 > a', + ) + ) { + const listname = document.querySelector( + '#root > div > div.css-1dbjc4n > div > div.w-full.xl\\:max-w-max.mx-auto.pt-8 > div > div.flex.flex-column.p-3 > div > div.flex.flex-column.md\\:flex-row.items-start.md\\:items-center > p:nth-child(1) > span', + ) + const profilePicture = document.querySelector( + '#root > div > div.css-1dbjc4n > div > div:nth-child(3) > div.w-full > div > div > a > img', + ) + presenceData.details = `Viewing ${ + document.querySelector(':is(div > a > h1, p > span + a)')?.textContent + }'s profile` + presenceData.buttons = [{ label: 'View Profile', url: document.URL }] + if (listname) { + presenceData.state = listname.textContent + presenceData.buttons = [{ label: 'View List', url: document.URL }] + } + if (cover && profilePicture) { + presenceData.largeImageKey = document.querySelector( + '#root > div > div.css-1dbjc4n > div > div:nth-child(3) > div.w-full > div > div > a > img', + )?.src + presenceData.smallImageKey = Assets.Logo + } + } + else if (path.includes('/games/')) { + if (path.endsWith('/reviews')) { + presenceData.details = 'Reading reviews of:' + presenceData.state = document + .querySelector( + '#root > div > div.css-1dbjc4n > div > div > div > div.css-1dbjc4n > div.css-901oao', + ) + ?.textContent + ?.slice(11) + } + else if (path.includes('edit')) { + presenceData.details = 'Editing Game:' + presenceData.state = document.querySelector( + '#root > div > div.css-1dbjc4n > div > div > h1 > a', + )?.textContent + presenceData.smallImageKey = Assets.Writing + } + else if (path.endsWith('/lists')) { + presenceData.details = 'Browsing lists containing:' + presenceData.state = document + .querySelector( + '#root > div > div.css-1dbjc4n > div > div > div > h1', + ) + ?.textContent + ?.slice(17) + } + } + else if (path.includes('/reviews/')) { + presenceData.details = `Reading ${ + document.querySelector( + '#root > div > div.css-1dbjc4n > div > div > div > div > div > div:nth-child(1) > div > a > h2', + )?.textContent + }'s review` + presenceData.state = `of ${ + document.querySelector( + '#root > div > div.css-1dbjc4n > div > div > div > div > div > div:nth-child(1) > a > h1', + )?.textContent + }` + if (cover) { + presenceData.largeImageKey = document.querySelector( + '#root > div > div.css-1dbjc4n > div > div > div > div > a > img', + )?.src + presenceData.smallImageKey = Assets.Logo + } + presenceData.buttons = [{ label: 'Read Review', url: document.URL }] + } + else if (path.startsWith('/home')) { + presenceData.details = 'At Home page' + } + else if (path.startsWith('/search/')) { + presenceData.details = 'Searching for:' + presenceData.state = document.querySelector( + '#root > div > div.css-1dbjc4n > div > div.w-full.xl\\:max-w-max.mx-auto > div > div:nth-child(1) > p > span.text-2xl.font-bold.pl-2', + )?.textContent + presenceData.smallImageKey = Assets.Search + } + else if (path.endsWith('/lists')) { + presenceData.details = `Viewing ${document.title.match(/(.*) -/)?.[1]}` + if (cover) { + presenceData.largeImageKey = document.querySelector( + '#root > div > div.css-1dbjc4n > div > div > div.w-full > div > div > a > img', + )?.src + presenceData.smallImageKey = Assets.Logo + } + presenceData.buttons = [{ label: 'View Lists', url: document.URL }] + } + else if (path.includes('/lists/')) { + presenceData.details = 'Viewing List:' + presenceData.state = document.querySelector( + '#root > div > div.css-1dbjc4n > div > div.flex.flex-col.flex-1.w-full.z-10.px-2.sm\\:px-4 > div > div:nth-child(1) > div.flex.flex-col.flex-grow > div.flex.flex-col > h1', + )?.textContent + presenceData.buttons = [{ label: 'View List', url: document.URL }] + } + if (!buttons) + delete presenceData.buttons + if (!timestamps) + delete presenceData.startTimestamp + presence.setActivity(presenceData) +}) diff --git a/websites/G/GGRadio/metadata.json b/websites/G/GGRadio/metadata.json index b3833ec60983..baf2398c6bf0 100644 --- a/websites/G/GGRadio/metadata.json +++ b/websites/G/GGRadio/metadata.json @@ -1,76 +1,76 @@ { - "$schema": "https://schemas.premid.app/metadata/1.12", - "apiVersion": 1, - "author": { - "name": "Bas950", - "id": "241278257335500811" - }, - "service": "GGRadio", - "description": { - "en": "Welcome to GGRadio, the #1 international eSports gaming radio. Playing 24/7 since 2015, available on all your favourite games and devices.", - "nl": "Welkom bij GGRadio, de #1 internationale eSports gaming radio. 24 uur per dag, 7 dagen per week, beschikbaar op al je favoriete games en apparaten." - }, - "url": "ggradio.net", - "version": "1.0.19", - "logo": "https://cdn.rcd.gg/PreMiD/websites/G/GGRadio/assets/logo.png", - "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/GGRadio/assets/thumbnail.png", - "color": "#ff6101", - "category": "music", - "tags": [ - "radio", - "esport", - "minecraft", - "ets2", - "gg" - ], - "settings": [ - { - "id": "sInfo", - "title": "Show site infomation", - "icon": "fas fa-info", - "value": true - }, - { - "id": "sDJ", - "title": "Show current DJ", - "icon": "fas fa-user", - "value": true - }, - { - "id": "tElapsed", - "title": "Show time elapsed", - "icon": "fas fa-clock", - "value": true - }, - { - "id": "sFormat", - "if": { - "sDJ": true - }, - "title": "Song format", - "icon": "fas fa-paragraph", - "value": "\"%song%\" by %artist%", - "placeholder": "use %song% or %artist%" - }, - { - "id": "sFormatNoDj1", - "if": { - "sDJ": false - }, - "title": "Song format line 1", - "icon": "fas fa-paragraph", - "value": "\"%song%\"", - "placeholder": "use %song% or %artist%" - }, - { - "id": "sFormatNoDj2", - "if": { - "sDJ": false - }, - "title": "Song format line 2", - "icon": "fas fa-paragraph", - "value": "by %artist%", - "placeholder": "use %song% or %artist%" - } - ] -} \ No newline at end of file + "$schema": "https://schemas.premid.app/metadata/1.12", + "apiVersion": 1, + "author": { + "name": "Bas950", + "id": "241278257335500811" + }, + "service": "GGRadio", + "description": { + "en": "Welcome to GGRadio, the #1 international eSports gaming radio. Playing 24/7 since 2015, available on all your favourite games and devices.", + "nl": "Welkom bij GGRadio, de #1 internationale eSports gaming radio. 24 uur per dag, 7 dagen per week, beschikbaar op al je favoriete games en apparaten." + }, + "url": "ggradio.net", + "version": "1.0.19", + "logo": "https://cdn.rcd.gg/PreMiD/websites/G/GGRadio/assets/logo.png", + "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/GGRadio/assets/thumbnail.png", + "color": "#ff6101", + "category": "music", + "tags": [ + "radio", + "esport", + "minecraft", + "ets2", + "gg" + ], + "settings": [ + { + "id": "sInfo", + "title": "Show site infomation", + "icon": "fas fa-info", + "value": true + }, + { + "id": "sDJ", + "title": "Show current DJ", + "icon": "fas fa-user", + "value": true + }, + { + "id": "tElapsed", + "title": "Show time elapsed", + "icon": "fas fa-clock", + "value": true + }, + { + "id": "sFormat", + "if": { + "sDJ": true + }, + "title": "Song format", + "icon": "fas fa-paragraph", + "value": "\"%song%\" by %artist%", + "placeholder": "use %song% or %artist%" + }, + { + "id": "sFormatNoDj1", + "if": { + "sDJ": false + }, + "title": "Song format line 1", + "icon": "fas fa-paragraph", + "value": "\"%song%\"", + "placeholder": "use %song% or %artist%" + }, + { + "id": "sFormatNoDj2", + "if": { + "sDJ": false + }, + "title": "Song format line 2", + "icon": "fas fa-paragraph", + "value": "by %artist%", + "placeholder": "use %song% or %artist%" + } + ] +} diff --git a/websites/G/GGRadio/presence.ts b/websites/G/GGRadio/presence.ts index ca95608bb738..0ee4d202260f 100644 --- a/websites/G/GGRadio/presence.ts +++ b/websites/G/GGRadio/presence.ts @@ -1,92 +1,108 @@ const presence = new Presence({ - clientId: "730052820459454496", - }), - browsingTimestamp = Math.floor(Date.now() / 1000); + clientId: '730052820459454496', +}) +const browsingTimestamp = Math.floor(Date.now() / 1000) -presence.on("UpdateData", async () => { - const presenceData: PresenceData = { - largeImageKey: - "https://cdn.rcd.gg/PreMiD/websites/G/GGRadio/assets/logo.png", - }, - [format1, format2, elapsed, format, info, dj] = await Promise.all([ - presence.getSetting("sFormatNoDj1"), - presence.getSetting("sFormatNoDj2"), - presence.getSetting("tElapsed"), - presence.getSetting("sFormat"), - presence.getSetting("sInfo"), - presence.getSetting("sDj"), - ]); +presence.on('UpdateData', async () => { + const presenceData: PresenceData = { + largeImageKey: 'https://cdn.rcd.gg/PreMiD/websites/G/GGRadio/assets/logo.png', + } + const [format1, format2, elapsed, format, info, dj] = await Promise.all([ + presence.getSetting('sFormatNoDj1'), + presence.getSetting('sFormatNoDj2'), + presence.getSetting('tElapsed'), + presence.getSetting('sFormat'), + presence.getSetting('sInfo'), + presence.getSetting('sDj'), + ]) - if (elapsed) presenceData.startTimestamp = browsingTimestamp; + if (elapsed) + presenceData.startTimestamp = browsingTimestamp - if (document.location.pathname.includes("/player")) { - const title = document.querySelector("#title").textContent, - artist = document.querySelector("#artist").textContent; - let djType = document - .querySelector("#presenter-text") - .textContent.replace("Currently playing: ", ""); + if (document.location.pathname.includes('/player')) { + const title = document.querySelector('#title')?.textContent + const artist = document.querySelector('#artist')?.textContent + let djType = document + .querySelector('#presenter-text') + ?.textContent + ?.replace('Currently playing: ', '') - if (dj) { - presenceData.details = format - .replace("%song%", title) - .replace("%artist%", artist); + if (dj) { + presenceData.details = format + .replace('%song%', title ?? '') + .replace('%artist%', artist ?? '') - if (djType === "") djType = "AutoDJ"; + if (djType === '') + djType = 'AutoDJ' - presenceData.state = - djType === "AutoDJ" - ? "No DJ Currently Playing" - : `Current DJ: ${djType}`; - } else { - presenceData.details = format1 - .replace("%song%", title) - .replace("%artist%", artist); - presenceData.state = format2 - .replace("%song%", title) - .replace("%artist%", artist); - } + presenceData.state = djType === 'AutoDJ' + ? 'No DJ Currently Playing' + : `Current DJ: ${djType}` + } + else { + presenceData.details = format1 + .replace('%song%', title ?? '') + .replace('%artist%', artist ?? '') + presenceData.state = format2 + .replace('%song%', title ?? '') + .replace('%artist%', artist ?? '') + } - presenceData.smallImageKey = - document.querySelector("#play") !== null ? Assets.Pause : Assets.Play; + presenceData.smallImageKey = document.querySelector('#play') !== null ? Assets.Pause : Assets.Play - if (title === "Welcome back!") { - presenceData.details = "Loading player..."; - delete presenceData.state; - delete presenceData.smallImageKey; - } - } else if (info) { - if (document.location.pathname.includes("/downloads")) - presenceData.details = "Viewing the downloads"; - else if (document.location.pathname.includes("/team")) - presenceData.details = "Viewing the team"; - else if (document.location.pathname.includes("/community")) { - const title = document.querySelector( - "#top > div.p-body > div > div.p-body-header > div.p-title > h1" - ).textContent; + if (title === 'Welcome back!') { + presenceData.details = 'Loading player...' + delete presenceData.state + delete presenceData.smallImageKey + } + } + else if (info) { + if (document.location.pathname.includes('/downloads')) { + presenceData.details = 'Viewing the downloads' + } + else if (document.location.pathname.includes('/team')) { + presenceData.details = 'Viewing the team' + } + else if (document.location.pathname.includes('/community')) { + const title = document.querySelector( + '#top > div.p-body > div > div.p-body-header > div.p-title > h1', + )?.textContent - if (title !== "GGRadio") { - presenceData.details = "Forums - Viewing category:"; - presenceData.state = title; - } else presenceData.details = "Forums - Browsing..."; - } else if (document.location.pathname.includes("/threads")) { - presenceData.details = "Forums - Reading thread:"; - presenceData.state = document.querySelector( - "#top > div.p-body > div > div.p-body-header > div.p-title" - ).textContent; - presenceData.smallImageKey = Assets.Reading; - } else if (document.location.pathname.includes("/members")) { - presenceData.details = "Forums - Viewing member:"; - presenceData.state = document.querySelector( - "#top > div.p-body > div > div.p-body-main > div > div > div > div > div > div > div.memberHeader-main > div > h1" - ).textContent; - presenceData.smallImageKey = Assets.Reading; - } else if (document.location.pathname.includes("/account")) { - presenceData.details = "Viewing their account"; - presenceData.smallImageKey = Assets.Reading; - } else if (document.location.pathname === "/") - presenceData.details = "Browsing..."; - } else presenceData.details = "Browsing..."; + if (title !== 'GGRadio') { + presenceData.details = 'Forums - Viewing category:' + presenceData.state = title + } + else { + presenceData.details = 'Forums - Browsing...' + } + } + else if (document.location.pathname.includes('/threads')) { + presenceData.details = 'Forums - Reading thread:' + presenceData.state = document.querySelector( + '#top > div.p-body > div > div.p-body-header > div.p-title', + )?.textContent + presenceData.smallImageKey = Assets.Reading + } + else if (document.location.pathname.includes('/members')) { + presenceData.details = 'Forums - Viewing member:' + presenceData.state = document.querySelector( + '#top > div.p-body > div > div.p-body-main > div > div > div > div > div > div > div.memberHeader-main > div > h1', + )?.textContent + presenceData.smallImageKey = Assets.Reading + } + else if (document.location.pathname.includes('/account')) { + presenceData.details = 'Viewing their account' + presenceData.smallImageKey = Assets.Reading + } + else if (document.location.pathname === '/') { + presenceData.details = 'Browsing...' + } + } + else { + presenceData.details = 'Browsing...' + } - if (presenceData.details) presence.setActivity(presenceData); - else presence.setActivity(); -}); + if (presenceData.details) + presence.setActivity(presenceData) + else presence.setActivity() +}) diff --git a/websites/G/GMANGA/metadata.json b/websites/G/GMANGA/metadata.json index 78069c556ff4..32971df9c619 100644 --- a/websites/G/GMANGA/metadata.json +++ b/websites/G/GMANGA/metadata.json @@ -1,51 +1,51 @@ { - "$schema": "https://schemas.premid.app/metadata/1.12", - "apiVersion": 1, - "author": { - "name": "Ghaith M. AlHallak", - "id": "448318357540962314" - }, - "service": "GMANGA", - "description": { - "en": "GMANGA - An interactive site that aims to provide more options for translating manga chapters to Arabic." - }, - "url": [ - "gmanga.org", - "gmanga.io", - "gmanga.me" - ], - "version": "1.0.20", - "logo": "https://cdn.rcd.gg/PreMiD/websites/G/GMANGA/assets/logo.png", - "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/GMANGA/assets/thumbnail.png", - "color": "#428bca", - "category": "anime", - "tags": [ - "manga", - "manhwa", - "manhua" - ], - "settings": [ - { - "id": "timestamp", - "title": "Show Timestamps", - "icon": "fad fa-stopwatch", - "value": true - }, - { - "id": "buttons", - "title": "Show Buttons", - "icon": "fas fa-compress-arrows-alt", - "value": true - }, - { - "id": "logo", - "title": "Icon", - "icon": "fab fa-discord", - "values": [ - "Light", - "Dark" - ], - "value": 0 - } - ] -} \ No newline at end of file + "$schema": "https://schemas.premid.app/metadata/1.12", + "apiVersion": 1, + "author": { + "name": "Ghaith M. AlHallak", + "id": "448318357540962314" + }, + "service": "GMANGA", + "description": { + "en": "GMANGA - An interactive site that aims to provide more options for translating manga chapters to Arabic." + }, + "url": [ + "gmanga.org", + "gmanga.io", + "gmanga.me" + ], + "version": "1.0.20", + "logo": "https://cdn.rcd.gg/PreMiD/websites/G/GMANGA/assets/logo.png", + "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/GMANGA/assets/thumbnail.png", + "color": "#428bca", + "category": "anime", + "tags": [ + "manga", + "manhwa", + "manhua" + ], + "settings": [ + { + "id": "timestamp", + "title": "Show Timestamps", + "icon": "fad fa-stopwatch", + "value": true + }, + { + "id": "buttons", + "title": "Show Buttons", + "icon": "fas fa-compress-arrows-alt", + "value": true + }, + { + "id": "logo", + "title": "Icon", + "icon": "fab fa-discord", + "values": [ + "Light", + "Dark" + ], + "value": 0 + } + ] +} diff --git a/websites/G/GMANGA/presence.ts b/websites/G/GMANGA/presence.ts index 71b6a5fbca4d..3e8a3c563fbe 100644 --- a/websites/G/GMANGA/presence.ts +++ b/websites/G/GMANGA/presence.ts @@ -1,187 +1,191 @@ type Functionlize = { - [P in keyof T]: () => T[P]; -}; + [P in keyof T]: () => T[P]; +} -interface Route extends Functionlize> { - path: RegExp; - playback?(): boolean; - run?(): PresenceData; +interface Route extends Functionlize> { + path: RegExp + playback?: () => boolean + run?: () => PresenceData } enum Settings { - TIMESTAMP = "timestamp", - BUTTONS = "buttons", - LOGO = "logo", + TIMESTAMP = 'timestamp', + BUTTONS = 'buttons', + LOGO = 'logo', } const enum Assets { - Discovery = "https://cdn.rcd.gg/PreMiD/websites/G/GMANGA/assets/0.png", - Library = "https://cdn.rcd.gg/PreMiD/websites/G/GMANGA/assets/1.png", - Team = "https://cdn.rcd.gg/PreMiD/websites/G/GMANGA/assets/2.png", - Manga = "https://cdn.rcd.gg/PreMiD/websites/G/GMANGA/assets/3.png", - News = "https://cdn.rcd.gg/PreMiD/websites/G/GMANGA/assets/4.png", - Paintings = "https://cdn.rcd.gg/PreMiD/websites/G/GMANGA/assets/5.png", - DarkLogo = "https://cdn.rcd.gg/PreMiD/websites/G/GMANGA/assets/6.png", - LightLogo = "https://cdn.rcd.gg/PreMiD/websites/G/GMANGA/assets/7.png", + Discovery = 'https://cdn.rcd.gg/PreMiD/websites/G/GMANGA/assets/0.png', + Library = 'https://cdn.rcd.gg/PreMiD/websites/G/GMANGA/assets/1.png', + Team = 'https://cdn.rcd.gg/PreMiD/websites/G/GMANGA/assets/2.png', + Manga = 'https://cdn.rcd.gg/PreMiD/websites/G/GMANGA/assets/3.png', + News = 'https://cdn.rcd.gg/PreMiD/websites/G/GMANGA/assets/4.png', + Paintings = 'https://cdn.rcd.gg/PreMiD/websites/G/GMANGA/assets/5.png', + DarkLogo = 'https://cdn.rcd.gg/PreMiD/websites/G/GMANGA/assets/6.png', + LightLogo = 'https://cdn.rcd.gg/PreMiD/websites/G/GMANGA/assets/7.png', } const presence = new Presence({ - clientId: "862700890414776370", - }), - AVERAGE_READING_TIME = 12000, - searchInput = document.querySelector("#quickSearch"), - startTimestamp: number = Math.floor(Date.now() / 1000), - router = ({ path, data }: { path: string; data: PresenceData }): Route => { - const routes: Route[] = [ - { path: /^\/$/, details: () => "On Homepage" }, - { - path: /^\/(mangas|mangas\/featured|mangas\/latest|)$/, - smallImageKey: () => Assets.Discovery, - smallImageText: () => "Browsing", - details: () => "Browsing for Manga", - buttons: () => [{ label: "Browse", url: location.href }], - }, - { - path: /^\/mangas\/\d+\/(.*)+\/[0-9.]+\/(.*)$/, - run: () => { - const endTimestamp = - document.querySelectorAll('[id^="page_"]').length * - AVERAGE_READING_TIME + - Date.now(); - - data.endTimestamp = endTimestamp / 1000; - - if (Date.now() > endTimestamp) delete data.endTimestamp; - - return data; - }, - playback: () => !!data.endTimestamp, - smallImageKey: () => Assets.Reading, - smallImageText: () => "Reading", - state: () => document.querySelector(".white-link").textContent, - details: () => - `Chapter: ${ - document.querySelector(".reader-dropdown .text").textContent - }`, - buttons: () => [ - { label: "Read Chapter", url: location.href }, - { - label: "Manga Page", - url: `https://${location.hostname}${document - .querySelector(".white-link") - .getAttribute("href")}`, - }, - ], - }, - { - path: /^\/mangas\/\d+\/(.*)+$/, - details: () => "Viewing a manga", - state: () => document.querySelector("h1.header").textContent, - smallImageKey: () => Assets.Manga, - smallImageText: () => "Viewing", - buttons: () => [ - { label: "View Manga", url: location.href }, - { - label: "Last Chapter", - url: `https://${location.hostname}${document - .querySelector("a.primary.button") - ?.getAttribute("href")}`, - }, - ], - }, - { - path: /^\/news+/, - smallImageKey: () => Assets.News, - smallImageText: () => "Reading", - details: () => "Reading News", - state: () => document.querySelector("h1.header")?.textContent, - buttons: () => [{ label: "Read News", url: location.href }], - }, - { - path: /\/colorings$/, - smallImageKey: () => Assets.Paintings, - smallImageText: () => "Viewing", - details: () => "Viewing Paintings", - state: () => - document - .querySelector("h1.header") - .textContent.replace("تلوينات ", ""), - buttons: () => [{ label: "View Paintings", url: location.href }], - }, - { - path: /^\/teams/, - smallImageKey: () => Assets.Team, - smallImageText: () => "Viewing", - details: () => "Viewing a Team", - state: () => document.querySelector("h2.header").textContent, - buttons: () => [{ label: "View Team", url: location.href }], - }, - { - path: /^\/members/, - smallImageKey: () => Assets.Library, - smallImageText: () => "Viewing", - details: () => "Viewing a User", - state: () => document.querySelector("h2.header").textContent, - buttons: () => [{ label: "View User", url: location.href }], - }, - ]; - - return routes.find(route => route.path.test(path)); - }; - -let searchData: Partial = {}; - -if (searchInput) { - searchInput.addEventListener("input", function () { - if (!this.value) { - searchData = {}; - return; - } - - searchData.smallImageKey = Assets.Search; - searchData.smallImageText = "Searching"; - searchData.state = `Searching: ${this.textContent}`; - }); + clientId: '862700890414776370', +}) +const AVERAGE_READING_TIME = 12000 +const searchInput = document.querySelector('#quickSearch') +const startTimestamp: number = Math.floor(Date.now() / 1000) +function router({ path, data }: { path: string, data: PresenceData }): Route { + const routes: Route[] = [ + { path: /^\/$/, details: () => 'On Homepage' }, + { + path: /^\/(mangas|mangas\/featured|mangas\/latest)$/, + smallImageKey: () => Assets.Discovery, + smallImageText: () => 'Browsing', + details: () => 'Browsing for Manga', + buttons: () => [{ label: 'Browse', url: location.href }], + }, + { + path: /^\/mangas\/\d+\/(.*)\/[0-9.]+\/(.*)$/, + run: () => { + const endTimestamp = document.querySelectorAll('[id^="page_"]').length + * AVERAGE_READING_TIME + + Date.now() + + data.endTimestamp = endTimestamp / 1000 + + if (Date.now() > endTimestamp) + delete data.endTimestamp + + return data + }, + playback: () => !!data.endTimestamp, + smallImageKey: () => Assets.Reading, + smallImageText: () => 'Reading', + state: () => document.querySelector('.white-link')?.textContent ?? undefined, + details: () => + `Chapter: ${ + document.querySelector('.reader-dropdown .text')?.textContent + }`, + buttons: () => [ + { label: 'Read Chapter', url: location.href }, + { + label: 'Manga Page', + url: `https://${location.hostname}${document + .querySelector('.white-link') + ?.getAttribute('href')}`, + }, + ], + }, + { + path: /^\/mangas\/\d+\/(.*)$/, + details: () => 'Viewing a manga', + state: () => document.querySelector('h1.header')?.textContent ?? undefined, + smallImageKey: () => Assets.Manga, + smallImageText: () => 'Viewing', + buttons: () => [ + { label: 'View Manga', url: location.href }, + { + label: 'Last Chapter', + url: `https://${location.hostname}${document + .querySelector('a.primary.button') + ?.getAttribute('href')}`, + }, + ], + }, + { + path: /^\/news+/, + smallImageKey: () => Assets.News, + smallImageText: () => 'Reading', + details: () => 'Reading News', + state: () => document.querySelector('h1.header')?.textContent ?? undefined, + buttons: () => [{ label: 'Read News', url: location.href }], + }, + { + path: /\/colorings$/, + smallImageKey: () => Assets.Paintings, + smallImageText: () => 'Viewing', + details: () => 'Viewing Paintings', + state: () => + document + .querySelector('h1.header') + ?.textContent + ?.replace('تلوينات ', ''), + buttons: () => [{ label: 'View Paintings', url: location.href }], + }, + { + path: /^\/teams/, + smallImageKey: () => Assets.Team, + smallImageText: () => 'Viewing', + details: () => 'Viewing a Team', + state: () => document.querySelector('h2.header')?.textContent ?? undefined, + buttons: () => [{ label: 'View Team', url: location.href }], + }, + { + path: /^\/members/, + smallImageKey: () => Assets.Library, + smallImageText: () => 'Viewing', + details: () => 'Viewing a User', + state: () => document.querySelector('h2.header')?.textContent ?? undefined, + buttons: () => [{ label: 'View User', url: location.href }], + }, + ] + + return routes.find(route => route.path.test(path))! } -presence.on("UpdateData", async () => { - const showTimestamp = await presence.getSetting(Settings.TIMESTAMP), - showButtons = await presence.getSetting(Settings.BUTTONS), - logo = await presence.getSetting(Settings.LOGO); - let presenceData: PresenceData = { - largeImageKey: - [Assets.LightLogo, Assets.DarkLogo][logo] || Assets.LightLogo, - }; - - if (showTimestamp) presenceData.startTimestamp = startTimestamp; - - const route = router({ - data: presenceData, - path: location.href.replace(`https://${location.hostname}`, ""), - }); - - if (!route) return presence.setActivity(presenceData); +let searchData: Partial = {} - if (route.run) presenceData = route.run(); - if (route.details) presenceData.details = route.details(); - if (route.buttons && showButtons) presenceData.buttons = route.buttons(); - if (route.largeImageKey) presenceData.largeImageKey = route.largeImageKey(); - - if (route.endTimestamp && showTimestamp) - presenceData.endTimestamp = route.endTimestamp(); - - if (searchData.state || route.state) - presenceData.state = searchData.state || route.state(); - - if (searchData.smallImageKey || route.smallImageKey) { - presenceData.smallImageKey = - searchData.smallImageKey || route.smallImageKey(); - } - - if (searchData.smallImageText || route.smallImageText) { - presenceData.smallImageText = - searchData.smallImageText || route.smallImageText(); - } +if (searchInput) { + searchInput.addEventListener('input', () => { + if (!searchInput.value) { + searchData = {} + return + } + + searchData.smallImageKey = Assets.Search + searchData.smallImageText = 'Searching' + searchData.state = `Searching: ${searchInput.textContent}` + }) +} - presence.setActivity(presenceData, route.playback ? route.playback() : false); -}); +presence.on('UpdateData', async () => { + const showTimestamp = await presence.getSetting(Settings.TIMESTAMP) + const showButtons = await presence.getSetting(Settings.BUTTONS) + const logo = await presence.getSetting(Settings.LOGO) + let presenceData: PresenceData = { + largeImageKey: [Assets.LightLogo, Assets.DarkLogo][logo] || Assets.LightLogo, + } + + if (showTimestamp) + presenceData.startTimestamp = startTimestamp + + const route = router({ + data: presenceData, + path: location.href.replace(`https://${location.hostname}`, ''), + }) + + if (!route) + return presence.setActivity(presenceData) + + if (route.run) + presenceData = route.run() + if (route.details) + presenceData.details = route.details() + if (route.buttons && showButtons) + presenceData.buttons = route.buttons() as [ButtonData, (ButtonData | undefined)?] + if (route.largeImageKey) + presenceData.largeImageKey = route.largeImageKey() + + if (route.endTimestamp && showTimestamp) + presenceData.endTimestamp = route.endTimestamp() + + if (searchData.state || route.state) + presenceData.state = searchData.state || route.state?.() + + if (searchData.smallImageKey || route.smallImageKey) { + presenceData.smallImageKey = searchData.smallImageKey || route.smallImageKey?.() + } + + if (searchData.smallImageText || route.smallImageText) { + presenceData.smallImageText = searchData.smallImageText || route.smallImageText?.() + } + + presence.setActivity(presenceData, route.playback ? route.playback() : false) +}) diff --git a/websites/G/GTAForums/metadata.json b/websites/G/GTAForums/metadata.json index e99395aadd57..51656b5d4aa7 100644 --- a/websites/G/GTAForums/metadata.json +++ b/websites/G/GTAForums/metadata.json @@ -1,25 +1,25 @@ { - "$schema": "https://schemas.premid.app/metadata/1.12", - "apiVersion": 1, - "author": { - "name": "Pequeno", - "id": "323577179814494209" - }, - "service": "GTAForums", - "description": { - "en": "GTAForums is the largest and ever-growing fan forum dedicated to the Grand Theft Auto series and Rockstar Games.", - "nl": "GTAForums is het grootste en steeds groter wordende fanforum gewijd aan de Grand Theft Auto-serie en Rockstar Games." - }, - "url": "gtaforums.com", - "version": "1.0.22", - "logo": "https://cdn.rcd.gg/PreMiD/websites/G/GTAForums/assets/logo.png", - "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/GTAForums/assets/thumbnail.png", - "color": "#244052", - "category": "games", - "tags": [ - "mods", - "gta", - "gaming", - "rockstar" - ] -} \ No newline at end of file + "$schema": "https://schemas.premid.app/metadata/1.12", + "apiVersion": 1, + "author": { + "name": "Pequeno", + "id": "323577179814494209" + }, + "service": "GTAForums", + "description": { + "en": "GTAForums is the largest and ever-growing fan forum dedicated to the Grand Theft Auto series and Rockstar Games.", + "nl": "GTAForums is het grootste en steeds groter wordende fanforum gewijd aan de Grand Theft Auto-serie en Rockstar Games." + }, + "url": "gtaforums.com", + "version": "1.0.22", + "logo": "https://cdn.rcd.gg/PreMiD/websites/G/GTAForums/assets/logo.png", + "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/GTAForums/assets/thumbnail.png", + "color": "#244052", + "category": "games", + "tags": [ + "mods", + "gta", + "gaming", + "rockstar" + ] +} diff --git a/websites/G/GTAForums/presence.ts b/websites/G/GTAForums/presence.ts index 0cf0168a3d61..1d906416b47e 100644 --- a/websites/G/GTAForums/presence.ts +++ b/websites/G/GTAForums/presence.ts @@ -1,101 +1,106 @@ const presence = new Presence({ - clientId: "713726722671116330", - }), - browsingTimestamp = Math.floor(Date.now() / 1000); + clientId: '713726722671116330', +}) +const browsingTimestamp = Math.floor(Date.now() / 1000) -presence.on("UpdateData", async () => { - const presenceData: PresenceData = { - largeImageKey: - "https://cdn.rcd.gg/PreMiD/websites/G/GTAForums/assets/logo.png", - startTimestamp: browsingTimestamp, - }; +presence.on('UpdateData', async () => { + const presenceData: PresenceData = { + largeImageKey: 'https://cdn.rcd.gg/PreMiD/websites/G/GTAForums/assets/logo.png', + startTimestamp: browsingTimestamp, + } - if (document.location.pathname === "/") - presenceData.details = "Browsing the home page..."; - else if (document.location.pathname.startsWith("/settings")) { - delete presenceData.details; - presenceData.details = "In settings..."; - presenceData.state = "Overview"; - switch (document.location.pathname) { - case "/settings/email/": - presenceData.state = "Email Address"; - break; - case "/settings/password/": - presenceData.state = "Password"; - break; - case "/settings/account-security/": - presenceData.state = "Account Security"; - break; - case "/settings/devices/": - presenceData.state = "Recently Used Devices"; - break; - case "/settings/username/": - presenceData.state = "Username"; - break; - } - } else if (document.location.pathname.startsWith("/profile/")) { - delete presenceData.details; - presenceData.details = "Browsing a profile..."; - presenceData.state = document.querySelectorAll( - ".ipsType_reset.ipsPageHead_barText" - )[0].textContent; - } else if (document.location.pathname.startsWith("/forum/")) { - delete presenceData.details; - presenceData.details = "Browsing a category..."; - presenceData.state = - document.querySelectorAll(".ipsType_pageTitle")[0].textContent; - if (document.location.href.match("/?do=add")) { - delete presenceData.details; - delete presenceData.state; - presenceData.details = "Starting a new topic..."; - } - } else if (document.location.pathname.startsWith("/topic/")) { - delete presenceData.details; - presenceData.details = "Browsing a topic..."; - presenceData.state = document.querySelectorAll( - ".ipsType_break.ipsContained" - )[0].textContent; - } else if (document.location.pathname.startsWith("/search/")) { - delete presenceData.details; - presenceData.details = "Searching..."; - presenceData.smallImageKey = Assets.Search; - presenceData.state = `Looking${ - document - .querySelectorAll(".ipsType_reset.ipsType_large")[0] - .textContent.split("results")[1] - }`; - } else { - delete presenceData.details; - switch (document.location.pathname) { - case "/followed/": - presenceData.details = "Managing Followed Content."; - break; - case "/notifications/": - presenceData.details = "Viewing your notifications..."; - break; - case "/messenger/": - presenceData.details = "Viewing your inbox..."; - break; - case "/ignore/": - presenceData.details = "Managing your ignored users."; - break; - case "/privacy/": - presenceData.details = "Reading privace policy..."; - break; - case "/register/": - presenceData.details = "Just registering..."; - break; - case "/login/": - presenceData.details = "Just logging..."; - break; - case "/discover/unread/": - presenceData.details = "Viewing Unread Content..."; - break; - case "/discover/": - presenceData.details = "Viewing All Activity..."; - break; - } - } + if (document.location.pathname === '/') { + presenceData.details = 'Browsing the home page...' + } + else if (document.location.pathname.startsWith('/settings')) { + delete presenceData.details + presenceData.details = 'In settings...' + presenceData.state = 'Overview' + switch (document.location.pathname) { + case '/settings/email/': + presenceData.state = 'Email Address' + break + case '/settings/password/': + presenceData.state = 'Password' + break + case '/settings/account-security/': + presenceData.state = 'Account Security' + break + case '/settings/devices/': + presenceData.state = 'Recently Used Devices' + break + case '/settings/username/': + presenceData.state = 'Username' + break + } + } + else if (document.location.pathname.startsWith('/profile/')) { + delete presenceData.details + presenceData.details = 'Browsing a profile...' + presenceData.state = document.querySelectorAll( + '.ipsType_reset.ipsPageHead_barText', + )[0].textContent + } + else if (document.location.pathname.startsWith('/forum/')) { + delete presenceData.details + presenceData.details = 'Browsing a category...' + presenceData.state = document.querySelectorAll('.ipsType_pageTitle')[0].textContent + if (document.location.href.match('/?do=add')) { + delete presenceData.details + delete presenceData.state + presenceData.details = 'Starting a new topic...' + } + } + else if (document.location.pathname.startsWith('/topic/')) { + delete presenceData.details + presenceData.details = 'Browsing a topic...' + presenceData.state = document.querySelectorAll( + '.ipsType_break.ipsContained', + )[0].textContent + } + else if (document.location.pathname.startsWith('/search/')) { + delete presenceData.details + presenceData.details = 'Searching...' + presenceData.smallImageKey = Assets.Search + presenceData.state = `Looking${ + document + .querySelectorAll('.ipsType_reset.ipsType_large')[0] + ?.textContent + ?.split('results')[1] + }` + } + else { + delete presenceData.details + switch (document.location.pathname) { + case '/followed/': + presenceData.details = 'Managing Followed Content.' + break + case '/notifications/': + presenceData.details = 'Viewing your notifications...' + break + case '/messenger/': + presenceData.details = 'Viewing your inbox...' + break + case '/ignore/': + presenceData.details = 'Managing your ignored users.' + break + case '/privacy/': + presenceData.details = 'Reading privace policy...' + break + case '/register/': + presenceData.details = 'Just registering...' + break + case '/login/': + presenceData.details = 'Just logging...' + break + case '/discover/unread/': + presenceData.details = 'Viewing Unread Content...' + break + case '/discover/': + presenceData.details = 'Viewing All Activity...' + break + } + } - presence.setActivity(presenceData); -}); + presence.setActivity(presenceData) +}) diff --git a/websites/G/GX.games/metadata.json b/websites/G/GX.games/metadata.json index f2cd24ef9754..e7d7bc12302f 100644 --- a/websites/G/GX.games/metadata.json +++ b/websites/G/GX.games/metadata.json @@ -1,43 +1,43 @@ { - "$schema": "https://schemas.premid.app/metadata/1.12", - "apiVersion": 1, - "author": { - "id": "205984221859151873", - "name": "joerkig" - }, - "service": "GX.games", - "description": { - "en": "Discover new games, compete for weekly prizes and share your experience with friends" - }, - "url": "gx.games", - "version": "1.0.4", - "logo": "https://cdn.rcd.gg/PreMiD/websites/G/GX.games/assets/logo.png", - "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/GX.games/assets/thumbnail.png", - "color": "#FA1E4E", - "category": "games", - "tags": [ - "fun", - "webgames", - "opera" - ], - "settings": [ - { - "id": "time", - "title": "Show Timestamps", - "icon": "fad fa-stopwatch", - "value": true - }, - { - "id": "buttons", - "title": "Show Buttons", - "icon": "fas fa-compress-arrows-alt", - "value": true - }, - { - "id": "cover", - "title": "Show Cover", - "icon": "fad fa-images", - "value": true - } - ] -} \ No newline at end of file + "$schema": "https://schemas.premid.app/metadata/1.12", + "apiVersion": 1, + "author": { + "id": "205984221859151873", + "name": "joerkig" + }, + "service": "GX.games", + "description": { + "en": "Discover new games, compete for weekly prizes and share your experience with friends" + }, + "url": "gx.games", + "version": "1.0.4", + "logo": "https://cdn.rcd.gg/PreMiD/websites/G/GX.games/assets/logo.png", + "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/GX.games/assets/thumbnail.png", + "color": "#FA1E4E", + "category": "games", + "tags": [ + "fun", + "webgames", + "opera" + ], + "settings": [ + { + "id": "time", + "title": "Show Timestamps", + "icon": "fad fa-stopwatch", + "value": true + }, + { + "id": "buttons", + "title": "Show Buttons", + "icon": "fas fa-compress-arrows-alt", + "value": true + }, + { + "id": "cover", + "title": "Show Cover", + "icon": "fad fa-images", + "value": true + } + ] +} diff --git a/websites/G/GX.games/presence.ts b/websites/G/GX.games/presence.ts index f18a352ff7e4..ab40e9c4b044 100644 --- a/websites/G/GX.games/presence.ts +++ b/websites/G/GX.games/presence.ts @@ -1,103 +1,104 @@ const presence = new Presence({ - clientId: "873897838260678666", - }), - browsingTimestamp = Math.floor(Date.now() / 1000); + clientId: '873897838260678666', +}) +const browsingTimestamp = Math.floor(Date.now() / 1000) const enum Assets { - Logo = "https://cdn.rcd.gg/PreMiD/websites/G/GX.games/assets/logo.png", + Logo = 'https://cdn.rcd.gg/PreMiD/websites/G/GX.games/assets/logo.png', } -presence.on("UpdateData", async () => { - const [buttons, cover, time] = await Promise.all([ - presence.getSetting("buttons"), - presence.getSetting("cover"), - presence.getSetting("time"), - ]), - presenceData: PresenceData = { - largeImageKey: Assets.Logo, - startTimestamp: browsingTimestamp, - }, - { pathname, href } = document.location; +presence.on('UpdateData', async () => { + const [buttons, cover, time] = await Promise.all([ + presence.getSetting('buttons'), + presence.getSetting('cover'), + presence.getSetting('time'), + ]) + const presenceData: PresenceData = { + largeImageKey: Assets.Logo, + startTimestamp: browsingTimestamp, + } + const { pathname, href } = document.location - switch ( - document.querySelector("footer button")?.textContent === "English" - ? pathname.split("/")[1] - : pathname.split("/")[2] - ) { - case "": { - presenceData.details = "Browsing games"; - break; - } - case "discover": { - presenceData.details = "Searching games"; - break; - } - case "tags": { - presenceData.details = "Browsing tag"; - presenceData.state = document.querySelector("main > div").textContent; - break; - } - case "feed": { - presenceData.details = "Browsing feed"; - presenceData.state = document.querySelector("main > div").textContent; - break; - } - case "games": { - const tags = document.querySelectorAll("[href*='tagAlias'] > span"); - presenceData.details = document.querySelector("h3"); - presenceData.state = `${tags[0].textContent}, ${tags[1].textContent}, ${tags[2].textContent}`; - presenceData.buttons = [{ label: "View Game", url: href }]; - if (cover) { - presenceData.largeImageKey = document.querySelector( - "meta[property='og:image']" - ).content; - } - break; - } - case "challenges": { - presenceData.details = document.querySelector("h3"); - presenceData.state = `Challenge: ${ - document.querySelector("main h6").textContent - }`; - presenceData.buttons = [{ label: "View Game", url: href }]; - if (cover) { - presenceData.largeImageKey = document.querySelector( - "meta[property='og:image']" - ).content; - } - break; - } - case "library": { - presenceData.details = "Viewing library"; - presenceData.state = document - .querySelector("h1") - .textContent.split(" - ")[1]; - break; - } - case "studios": { - presenceData.details = "Viewing studio"; - presenceData.state = `${ - document.querySelector("main [href='/'] ").parentElement.lastChild - .textContent - }`; - presenceData.buttons = [{ label: "View Page", url: href }]; - break; - } - case "profile": { - presenceData.details = "Viewing their profile"; - break; - } - case "messages": { - presenceData.details = "Viewing messages"; - break; - } - } + switch ( + document.querySelector('footer button')?.textContent === 'English' + ? pathname.split('/')[1] + : pathname.split('/')[2] + ) { + case '': { + presenceData.details = 'Browsing games' + break + } + case 'discover': { + presenceData.details = 'Searching games' + break + } + case 'tags': { + presenceData.details = 'Browsing tag' + presenceData.state = document.querySelector('main > div')?.textContent + break + } + case 'feed': { + presenceData.details = 'Browsing feed' + presenceData.state = document.querySelector('main > div')?.textContent + break + } + case 'games': { + const tags = document.querySelectorAll('[href*=\'tagAlias\'] > span') + presenceData.details = document.querySelector('h3') + presenceData.state = `${tags[0].textContent}, ${tags[1].textContent}, ${tags[2].textContent}` + presenceData.buttons = [{ label: 'View Game', url: href }] + if (cover) { + presenceData.largeImageKey = document.querySelector( + 'meta[property=\'og:image\']', + )?.content + } + break + } + case 'challenges': { + presenceData.details = document.querySelector('h3') + presenceData.state = `Challenge: ${ + document.querySelector('main h6')?.textContent + }` + presenceData.buttons = [{ label: 'View Game', url: href }] + if (cover) { + presenceData.largeImageKey = document.querySelector( + 'meta[property=\'og:image\']', + )?.content + } + break + } + case 'library': { + presenceData.details = 'Viewing library' + presenceData.state = document + .querySelector('h1') + ?.textContent + ?.split(' - ')[1] + break + } + case 'studios': { + presenceData.details = 'Viewing studio' + presenceData.state = `${ + document.querySelector('main [href=\'/\'] ')?.parentElement?.lastChild?.textContent + }` + presenceData.buttons = [{ label: 'View Page', url: href }] + break + } + case 'profile': { + presenceData.details = 'Viewing their profile' + break + } + case 'messages': { + presenceData.details = 'Viewing messages' + break + } + } - if (!buttons) delete presenceData.buttons; - if (!time) { - delete presenceData.startTimestamp; - delete presenceData.endTimestamp; - } + if (!buttons) + delete presenceData.buttons + if (!time) { + delete presenceData.startTimestamp + delete presenceData.endTimestamp + } - presence.setActivity(presenceData); -}); + presence.setActivity(presenceData) +}) diff --git a/websites/G/Gaia/metadata.json b/websites/G/Gaia/metadata.json index f9cdef250761..c06705d75c01 100644 --- a/websites/G/Gaia/metadata.json +++ b/websites/G/Gaia/metadata.json @@ -1,37 +1,37 @@ { - "$schema": "https://schemas.premid.app/metadata/1.12", - "apiVersion": 1, - "author": { - "name": "Slowlfie", - "id": "374905512661221377" - }, - "service": "Gaia", - "description": { - "en": "Gaia offers the largest online resource of consciousness-expanding videos—over 8,000 informative and enlightening films, original shows, yoga and meditation" - }, - "url": "www.gaia.com", - "version": "1.0.16", - "logo": "https://cdn.rcd.gg/PreMiD/websites/G/Gaia/assets/logo.png", - "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/Gaia/assets/thumbnail.png", - "color": "#ffffff", - "category": "videos", - "tags": [ - "films", - "yoga", - "meditation" - ], - "settings": [ - { - "id": "buttons", - "title": "Show Buttons", - "icon": "fas fa-compress-arrows-alt", - "value": true - }, - { - "id": "cover", - "title": "Show Cover", - "icon": "fad fa-images", - "value": true - } - ] -} \ No newline at end of file + "$schema": "https://schemas.premid.app/metadata/1.12", + "apiVersion": 1, + "author": { + "name": "Slowlfie", + "id": "374905512661221377" + }, + "service": "Gaia", + "description": { + "en": "Gaia offers the largest online resource of consciousness-expanding videos—over 8,000 informative and enlightening films, original shows, yoga and meditation" + }, + "url": "www.gaia.com", + "version": "1.0.16", + "logo": "https://cdn.rcd.gg/PreMiD/websites/G/Gaia/assets/logo.png", + "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/Gaia/assets/thumbnail.png", + "color": "#ffffff", + "category": "videos", + "tags": [ + "films", + "yoga", + "meditation" + ], + "settings": [ + { + "id": "buttons", + "title": "Show Buttons", + "icon": "fas fa-compress-arrows-alt", + "value": true + }, + { + "id": "cover", + "title": "Show Cover", + "icon": "fad fa-images", + "value": true + } + ] +} diff --git a/websites/G/Gaia/presence.ts b/websites/G/Gaia/presence.ts index 7b8bd8ee92a6..f549ac8d34a5 100644 --- a/websites/G/Gaia/presence.ts +++ b/websites/G/Gaia/presence.ts @@ -1,131 +1,142 @@ const presence = new Presence({ - clientId: "928134371205083166", - }), - browsingTimestamp = Date.now() / 1000, - shortenedURLs: Record = {}; + clientId: '928134371205083166', +}) +const browsingTimestamp = Date.now() / 1000 +const shortenedURLs: Record = {} async function getShortURL(url: string) { - if (!url || url.length < 256) return url; - if (shortenedURLs[url]) return shortenedURLs[url]; - try { - const pdURL = await ( - await fetch(`https://pd.premid.app/create/${url}`) - ).text(); - shortenedURLs[url] = pdURL; - return pdURL; - } catch (err) { - presence.error(err); - return url; - } + if (!url || url.length < 256) + return url + if (shortenedURLs[url]) + return shortenedURLs[url] + try { + const pdURL = await ( + await fetch(`https://pd.premid.app/create/${url}`) + ).text() + shortenedURLs[url] = pdURL + return pdURL + } + catch (err) { + presence.error(err as string) + return url + } } -presence.on("UpdateData", async () => { - let presenceData: PresenceData = { - largeImageKey: "https://cdn.rcd.gg/PreMiD/websites/G/Gaia/assets/logo.png", - smallImageKey: Assets.Search, - startTimestamp: browsingTimestamp, - }; - - const [buttons, cover] = await Promise.all([ - presence.getSetting("buttons"), - presence.getSetting("cover"), - ]), - pages: Record< - string, - PresenceData | (() => PresenceData | Promise) - > = { - "/(video|series)/": async () => { - const video = document.querySelector("video"), - data = presenceData; - - if (video) { - const title = [ - document.querySelector(".heading.video-player-meta__series-title") - ?.textContent, - document.querySelector(".heading.video-player-meta__title") - ?.textContent, - document - .querySelector(".text-season-episode") - ?.textContent?.toUpperCase(), - ], - coverUrl = document - .querySelector(".vjs-poster") - ?.style?.backgroundImage?.match(/url\("(.*)"\)/)?.[1]; - - delete data.startTimestamp; - - data.details = title.find(Boolean); - data.state = title[0] ? `${title[2]} ${title[1]}` : "Film"; - - data.smallImageKey = video.paused ? Assets.Pause : Assets.Play; - data.smallImageText = video.paused ? "Paused" : "Playing"; - - if (cover && coverUrl) - data.largeImageKey = await getShortURL(coverUrl); - - if (!video.paused) { - [data.startTimestamp, data.endTimestamp] = - presence.getTimestampsfromMedia(video); - } - - data.buttons = [ - { - label: title[0] ? "Watch Series" : "Watch Film", - url: document.URL, - }, - ]; - - return data; - } else { - const title = [ - ( - document.querySelector(".jumbotron-episode__meta > h1") ?? - document.querySelector(".heading.detail-series__title") - )?.textContent, - document.querySelector(".jumbotron-video__meta> h1")?.textContent, - ]; - - data.details = title[0] ? "Viewing series:" : "Viewing film:"; - data.state = title.find(Boolean); - - data.buttons = [ - { - label: title[0] ? "View Series" : "View Film", - url: document.URL, - }, - ]; - - return data; - } - }, - "/(yoga|style|seeking-truth|topic|alternative-healing|transformation)/": - () => ({ - details: "Browsing:", - state: document.querySelector(".heading.jumbotron-subcategory__title") - .textContent, - }), - "/films-docs/": { - details: "Browsing:", - state: "Docs & Films", - }, - "/recently-added": { - details: "Viewing what's new on Gaia", - }, - }; - - for (const [path, data] of Object.entries(pages)) { - if (location.pathname.match(path)) { - if (typeof data === "function") { - const output = await data(); - - if (output.largeImageKey) presenceData = output; - else presenceData = { ...presenceData, ...output }; - } else presenceData = { ...presenceData, ...data }; - } - } - - if (!buttons) delete presenceData.buttons; - - if (presenceData.details) presence.setActivity(presenceData); - else presence.setActivity(); -}); +presence.on('UpdateData', async () => { + let presenceData: PresenceData = { + largeImageKey: 'https://cdn.rcd.gg/PreMiD/websites/G/Gaia/assets/logo.png', + smallImageKey: Assets.Search, + startTimestamp: browsingTimestamp, + } + + const [buttons, cover] = await Promise.all([ + presence.getSetting('buttons'), + presence.getSetting('cover'), + ]) + const pages: Record< + string, + PresenceData | (() => PresenceData | Promise) + > = { + '/(video|series)/': async () => { + const video = document.querySelector('video') + const data = presenceData + + if (video) { + const title = [ + document.querySelector('.heading.video-player-meta__series-title') + ?.textContent, + document.querySelector('.heading.video-player-meta__title') + ?.textContent, + document + .querySelector('.text-season-episode') + ?.textContent + ?.toUpperCase(), + ] + const coverUrl = document + .querySelector('.vjs-poster') + ?.style + ?.backgroundImage + ?.match(/url\("(.*)"\)/)?.[1] + + delete data.startTimestamp + + data.details = title.find(Boolean) + data.state = title[0] ? `${title[2]} ${title[1]}` : 'Film' + + data.smallImageKey = video.paused ? Assets.Pause : Assets.Play + data.smallImageText = video.paused ? 'Paused' : 'Playing' + + if (cover && coverUrl) + data.largeImageKey = await getShortURL(coverUrl) + + if (!video.paused) { + [data.startTimestamp, data.endTimestamp] = presence.getTimestampsfromMedia(video) + } + + data.buttons = [ + { + label: title[0] ? 'Watch Series' : 'Watch Film', + url: document.URL, + }, + ] + + return data + } + else { + const title = [ + ( + document.querySelector('.jumbotron-episode__meta > h1') + ?? document.querySelector('.heading.detail-series__title') + )?.textContent, + document.querySelector('.jumbotron-video__meta> h1')?.textContent, + ] + + data.details = title[0] ? 'Viewing series:' : 'Viewing film:' + data.state = title.find(Boolean) + + data.buttons = [ + { + label: title[0] ? 'View Series' : 'View Film', + url: document.URL, + }, + ] + + return data + } + }, + '/(yoga|style|seeking-truth|topic|alternative-healing|transformation)/': () => ({ + details: 'Browsing:', + state: document.querySelector('.heading.jumbotron-subcategory__title') + ?.textContent, + }), + '/films-docs/': { + details: 'Browsing:', + state: 'Docs & Films', + }, + '/recently-added': { + details: 'Viewing what\'s new on Gaia', + }, + } + + for (const [path, data] of Object.entries(pages)) { + if (location.pathname.match(path)) { + if (typeof data === 'function') { + const output = await data() + + if (output.largeImageKey) + presenceData = output + else presenceData = { ...presenceData, ...output } as PresenceData + } + else { + presenceData = { ...presenceData, ...data } as PresenceData + } + } + } + + if (!buttons) + delete presenceData.buttons + + if (presenceData.details) + presence.setActivity(presenceData) + else presence.setActivity() +}) diff --git a/websites/G/Game Jolt/metadata.json b/websites/G/Game Jolt/metadata.json index 1b1584971bd4..5604d3ddcc1d 100644 --- a/websites/G/Game Jolt/metadata.json +++ b/websites/G/Game Jolt/metadata.json @@ -1,24 +1,24 @@ { - "$schema": "https://schemas.premid.app/metadata/1.12", - "apiVersion": 1, - "author": { - "name": "EGGSY", - "id": "162969778699501569" - }, - "service": "Game Jolt", - "description": { - "en": "Game Jolt is a hosting service for freeware and commercial video games with social functions.", - "tr": "Game Jolt, bağımsız yapımcıların oyunlarını ücretli veya ücretsiz bir şekilde insanlara tanıtabildiği platformdur.", - "nl": "Game Jolt is een hostingdienst voor freeware en commerciële videospelletjes met sociale functies." - }, - "url": "gamejolt.com", - "version": "1.2.25", - "logo": "https://cdn.rcd.gg/PreMiD/websites/G/Game%20Jolt/assets/logo.png", - "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/Game%20Jolt/assets/thumbnail.png", - "color": "#191919", - "category": "games", - "tags": [ - "gamejolt", - "games" - ] -} \ No newline at end of file + "$schema": "https://schemas.premid.app/metadata/1.12", + "apiVersion": 1, + "author": { + "name": "EGGSY", + "id": "162969778699501569" + }, + "service": "Game Jolt", + "description": { + "en": "Game Jolt is a hosting service for freeware and commercial video games with social functions.", + "tr": "Game Jolt, bağımsız yapımcıların oyunlarını ücretli veya ücretsiz bir şekilde insanlara tanıtabildiği platformdur.", + "nl": "Game Jolt is een hostingdienst voor freeware en commerciële videospelletjes met sociale functies." + }, + "url": "gamejolt.com", + "version": "1.2.25", + "logo": "https://cdn.rcd.gg/PreMiD/websites/G/Game%20Jolt/assets/logo.png", + "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/Game%20Jolt/assets/thumbnail.png", + "color": "#191919", + "category": "games", + "tags": [ + "gamejolt", + "games" + ] +} diff --git a/websites/G/Game Jolt/presence.ts b/websites/G/Game Jolt/presence.ts index 51a0ed2cc252..e6534faf7b07 100644 --- a/websites/G/Game Jolt/presence.ts +++ b/websites/G/Game Jolt/presence.ts @@ -1,113 +1,120 @@ const presence = new Presence({ - clientId: "633419305836347393", - }), - pages: { [k: string]: string } = { - "/games": "Games", - "/login": "Login", - "/join": "Register", - "/terms": "Terms of Use", - "/privacy": "Privacy Policy", - "/cookies": "Cookie Policy", - "/welcome": "Just Registered!", - "/discover": "Explore", - "/client": "Client", - "/forums": "Forums", - "/notifications": "Notifications", - "/library": "Game Library", - "/dashboard/profile/edit": "Edit Profile", - "/settings": "Settings", - "/dashboard/games/add": "Add a Game", - "/firesides": "Searching for a Fireside", - "/dashboard/fireside/add": "Staring a Fireside", - }, - creatingNow = [ - "Gathering Wood", - "Lighting the Fire", - "Getting the Flint & Steel", - "Searching how to start a campfire", - "Creating", - ][Math.floor(Math.random() * (4 - 0 + 1)) + 0]; + clientId: '633419305836347393', +}) +const pages: { [k: string]: string } = { + '/games': 'Games', + '/login': 'Login', + '/join': 'Register', + '/terms': 'Terms of Use', + '/privacy': 'Privacy Policy', + '/cookies': 'Cookie Policy', + '/welcome': 'Just Registered!', + '/discover': 'Explore', + '/client': 'Client', + '/forums': 'Forums', + '/notifications': 'Notifications', + '/library': 'Game Library', + '/dashboard/profile/edit': 'Edit Profile', + '/settings': 'Settings', + '/dashboard/games/add': 'Add a Game', + '/firesides': 'Searching for a Fireside', + '/dashboard/fireside/add': 'Staring a Fireside', +} +const creatingNow = [ + 'Gathering Wood', + 'Lighting the Fire', + 'Getting the Flint & Steel', + 'Searching how to start a campfire', + 'Creating', +][Math.floor(Math.random() * (4 - 0 + 1)) + 0] -presence.on("UpdateData", async () => { - const page = document.location.pathname, - gameName = document.querySelector( - "#content > div > div > div > div > header > section > div.container > div.row > div > div > h1 > a" - ) as HTMLElement, - author = document.querySelector( - "#content > div > div > div > div > header > section > div.container > div.row > div > div > div > a > small" - ) as HTMLElement, - profile = document.querySelector( - "#content > div > div > header > section > div > div.row > div > div > h1 > small" - ) as HTMLElement, - presenceData: PresenceData = { - largeImageKey: - "https://cdn.rcd.gg/PreMiD/websites/G/Game%20Jolt/assets/logo.png", - startTimestamp: Math.floor(Date.now() / 1000), - }; +presence.on('UpdateData', async () => { + const page = document.location.pathname + const gameName = document.querySelector( + '#content > div > div > div > div > header > section > div.container > div.row > div > div > h1 > a', + ) as HTMLElement + const author = document.querySelector( + '#content > div > div > div > div > header > section > div.container > div.row > div > div > div > a > small', + ) as HTMLElement + const profile = document.querySelector( + '#content > div > div > header > section > div > div.row > div > div > h1 > small', + ) as HTMLElement + const presenceData: PresenceData = { + largeImageKey: 'https://cdn.rcd.gg/PreMiD/websites/G/Game%20Jolt/assets/logo.png', + startTimestamp: Math.floor(Date.now() / 1000), + } - if (page.includes("/games/tag-")) { - const tagName = page.replace("/games/tag-", ""); + if (page.includes('/games/tag-')) { + const tagName = page.replace('/games/tag-', '') - presenceData.details = "Browsing games by tag:"; - presenceData.state = tagName[0].toUpperCase() + tagName.slice(1); - } else if (page.includes("/dashboard/fireside/add")) { - presenceData.details = pages[page]; - presenceData.state = creatingNow; - } else if (page.startsWith("/firesides") || page.startsWith("/fireside")) { - if (page.slice("/firesides".length) !== "") { - const firesideOwner = document - .querySelector("#content > div > div > div > div > h2 > small > a") - .getAttribute("href") - .slice(1); - presenceData.details = `Sitting By ${firesideOwner.slice(1)}'s Fireside`; - presenceData.state = `Fireside name: ${document - .querySelector("#content > div > div > div > div > h2") - .textContent.replace(/(\t|\n)/gm, "") - .replace(firesideOwner, "") - .slice(13)}`; - presenceData.buttons = [ - { - label: "Join Them!", - url: `https://gamejolt.com${page}`, - }, - ]; - } else { - presenceData.details = pages[page]; - presenceData.state = "Searching"; - } - } else if ( - page.includes("/games/") && - gameName && - gameName.textContent !== "" - ) { - presenceData.details = `Viewing a game${ - author && author.textContent !== "" ? ` by ${author.textContent}` : "" - }:`; - presenceData.state = gameName.textContent.trim(); - } else if (pages[page] || pages[page.slice(0, -1)]) { - presenceData.details = "Viewing a page:"; - presenceData.state = pages[page] || pages[page.slice(0, -1)]; - } else if (page.includes("/search")) { - const fixedSearchName = document.title - .replace(" - Game Jolt", "") - .replace("Search results for ", ""); + presenceData.details = 'Browsing games by tag:' + presenceData.state = tagName[0].toUpperCase() + tagName.slice(1) + } + else if (page.includes('/dashboard/fireside/add')) { + presenceData.details = pages[page] + presenceData.state = creatingNow + } + else if (page.startsWith('/firesides') || page.startsWith('/fireside')) { + if (page.slice('/firesides'.length) !== '') { + const firesideOwner = document + .querySelector('#content > div > div > div > div > h2 > small > a') + ?.getAttribute('href') + ?.slice(1) + presenceData.details = `Sitting By ${firesideOwner?.slice(1)}'s Fireside` + presenceData.state = `Fireside name: ${document + .querySelector('#content > div > div > div > div > h2') + ?.textContent + ?.replace(/(\t|\n)/g, '') + ?.replace(firesideOwner ?? '', '') + ?.slice(13)}` + presenceData.buttons = [ + { + label: 'Join Them!', + url: `https://gamejolt.com${page}`, + }, + ] + } + else { + presenceData.details = pages[page] + presenceData.state = 'Searching' + } + } + else if ( + page.includes('/games/') + && gameName + && gameName.textContent !== '' + ) { + presenceData.details = `Viewing a game${ + author && author.textContent !== '' ? ` by ${author.textContent}` : '' + }:` + presenceData.state = gameName.textContent?.trim() + } + else if (pages[page] || pages[page.slice(0, -1)]) { + presenceData.details = 'Viewing a page:' + presenceData.state = pages[page] || pages[page.slice(0, -1)] + } + else if (page.includes('/search')) { + const fixedSearchName = document.title + .replace(' - Game Jolt', '') + .replace('Search results for ', '') - presenceData.details = `Searching for${ - page.includes("/search/users") - ? " a user" - : `${page.includes("/search/games") ? " a game" : ""}` - }:`; - presenceData.state = - fixedSearchName[0].toUpperCase() + fixedSearchName.slice(1); - presenceData.smallImageKey = Assets.Search; - } else if (profile && profile.textContent !== "") { - presenceData.details = "Viewing a user:"; - presenceData.state = profile.textContent; - } else { - presenceData.details = "Viewing a page:"; - presenceData.state = "Home"; - } + presenceData.details = `Searching for${ + page.includes('/search/users') + ? ' a user' + : `${page.includes('/search/games') ? ' a game' : ''}` + }:` + presenceData.state = fixedSearchName[0].toUpperCase() + fixedSearchName.slice(1) + presenceData.smallImageKey = Assets.Search + } + else if (profile && profile.textContent !== '') { + presenceData.details = 'Viewing a user:' + presenceData.state = profile.textContent + } + else { + presenceData.details = 'Viewing a page:' + presenceData.state = 'Home' + } - if (presenceData.details && presenceData.state) - presence.setActivity(presenceData); -}); + if (presenceData.details && presenceData.state) + presence.setActivity(presenceData) +}) diff --git a/websites/G/Game8/metadata.json b/websites/G/Game8/metadata.json index debcad275ff0..bf2b6fca7a74 100644 --- a/websites/G/Game8/metadata.json +++ b/websites/G/Game8/metadata.json @@ -1,27 +1,27 @@ { - "$schema": "https://schemas.premid.app/metadata/1.12", - "apiVersion": 1, - "author": { - "id": "193714715631812608", - "name": "nihongojouzu" - }, - "service": "Game8", - "description": { - "en": "The Top Gaming and App Walkthroughs Straight from Japan! Game8 delivers the latest in gaming news, walkthrough information, and other useful tools so that you can get the most out of your gaming experience! Our pages for popular apps and new games are being updated every minute!" - }, - "url": "game8.co", - "version": "1.0.3", - "logo": "https://cdn.rcd.gg/PreMiD/websites/G/Game8/assets/logo.png", - "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/Game8/assets/thumbnail.webp", - "color": "#ffffff", - "category": "games", - "tags": [ - "japan", - "anime", - "tutorial", - "news", - "tierlist", - "strategy", - "news" - ] -} \ No newline at end of file + "$schema": "https://schemas.premid.app/metadata/1.12", + "apiVersion": 1, + "author": { + "id": "193714715631812608", + "name": "nihongojouzu" + }, + "service": "Game8", + "description": { + "en": "The Top Gaming and App Walkthroughs Straight from Japan! Game8 delivers the latest in gaming news, walkthrough information, and other useful tools so that you can get the most out of your gaming experience! Our pages for popular apps and new games are being updated every minute!" + }, + "url": "game8.co", + "version": "1.0.3", + "logo": "https://cdn.rcd.gg/PreMiD/websites/G/Game8/assets/logo.png", + "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/Game8/assets/thumbnail.webp", + "color": "#ffffff", + "category": "games", + "tags": [ + "japan", + "anime", + "tutorial", + "news", + "tierlist", + "strategy", + "news" + ] +} diff --git a/websites/G/Game8/presence.ts b/websites/G/Game8/presence.ts index cb0aabbf121c..ae1d83e5a21e 100644 --- a/websites/G/Game8/presence.ts +++ b/websites/G/Game8/presence.ts @@ -1,91 +1,105 @@ const presence = new Presence({ - clientId: "1031628776209141892", - }), - browsingTimestamp = Math.floor(Date.now() / 1000); + clientId: '1031628776209141892', +}) +const browsingTimestamp = Math.floor(Date.now() / 1000) const enum Assets { - Logo = "https://cdn.rcd.gg/PreMiD/websites/G/Game8/assets/logo.png", + Logo = 'https://cdn.rcd.gg/PreMiD/websites/G/Game8/assets/logo.png', } -presence.on("UpdateData", async () => { - const presenceData: PresenceData = { - largeImageKey: Assets.Logo, - startTimestamp: browsingTimestamp, - }, - { pathname, href, search } = document.location, - searchParams = new URLSearchParams(search), - pathList = pathname.split("/").filter(Boolean); +presence.on('UpdateData', async () => { + const presenceData: PresenceData = { + largeImageKey: Assets.Logo, + startTimestamp: browsingTimestamp, + } + const { pathname, href, search } = document.location + const searchParams = new URLSearchParams(search) + const pathList = pathname.split('/').filter(Boolean) - switch (pathList[0] ?? "/") { - case "/": { - presenceData.details = "Browsing home page"; - break; - } - case "articles": { - if (pathList[1]) { - if (pathList[2]) { - if (pathList[1] === "author") { - presenceData.details = "Browsing articles by an author"; - presenceData.state = document.querySelector( - ".p-authorListItem__lead" - ); - presenceData.smallImageKey = - document.querySelector( - ".p-authorListItem__img" - ); - } else { - presenceData.details = "Reading an article"; - presenceData.state = document.querySelector("h1"); - presenceData.buttons = [{ label: "Read Article", url: href }]; - } - } else if (pathList[1] === "author") - presenceData.details = "Browsing authors"; - else { - presenceData.details = "Browsing articles by category"; - presenceData.state = document.querySelector("h1"); - } - } else presenceData.details = "Browsing articles"; - break; - } - case "archives": { - if (pathList[1] === "search") { - presenceData.details = "Searching for articles"; - presenceData.state = searchParams.get("query"); - } else presenceData.details = "Browsing game walkthroughs"; - break; - } - case "games": { - if (pathList[1]) { - const gameTitle = document - .querySelector(".p-gameHeader__game_title") - .textContent.replace(/Walkthrough & Guides Wiki$/, ""); - presenceData.smallImageKey = document.querySelector( - ".p-gameHeader__game_logo img" - ); - presenceData.smallImageText = gameTitle; - if (pathList[2] === "archives") { - const breadcrumbs = [ - ...document.querySelector(".l-breadcrumb__list").children, - ].slice(2, -1); - presenceData.details = "Reading a game walkthrough"; - presenceData.state = breadcrumbs.length - ? `${breadcrumbs.map(a => a.textContent).join("/")}: ${ - document.querySelector("h1").textContent - }` - : document.querySelector("h1"); - presenceData.buttons = [{ label: "Read Walkthrough", url: href }]; - } else if (pathList[2] === "search") { - presenceData.details = "Searching for articles"; - presenceData.state = searchParams.get("q"); - } else { - presenceData.details = "Viewing a game"; - presenceData.state = gameTitle; - presenceData.buttons = [{ label: "View Game", url: href }]; - } - } else presenceData.details = "Browsing games"; - break; - } - } + switch (pathList[0] ?? '/') { + case '/': { + presenceData.details = 'Browsing home page' + break + } + case 'articles': { + if (pathList[1]) { + if (pathList[2]) { + if (pathList[1] === 'author') { + presenceData.details = 'Browsing articles by an author' + presenceData.state = document.querySelector( + '.p-authorListItem__lead', + ) + presenceData.smallImageKey = document.querySelector( + '.p-authorListItem__img', + ) + } + else { + presenceData.details = 'Reading an article' + presenceData.state = document.querySelector('h1') + presenceData.buttons = [{ label: 'Read Article', url: href }] + } + } + else if (pathList[1] === 'author') { + presenceData.details = 'Browsing authors' + } + else { + presenceData.details = 'Browsing articles by category' + presenceData.state = document.querySelector('h1') + } + } + else { + presenceData.details = 'Browsing articles' + } + break + } + case 'archives': { + if (pathList[1] === 'search') { + presenceData.details = 'Searching for articles' + presenceData.state = searchParams.get('query') + } + else { + presenceData.details = 'Browsing game walkthroughs' + } + break + } + case 'games': { + if (pathList[1]) { + const gameTitle = document + .querySelector('.p-gameHeader__game_title') + ?.textContent + ?.replace(/Walkthrough & Guides Wiki$/, '') + presenceData.smallImageKey = document.querySelector( + '.p-gameHeader__game_logo img', + ) + presenceData.smallImageText = gameTitle + if (pathList[2] === 'archives') { + const breadcrumbs = [ + ...document.querySelector('.l-breadcrumb__list')?.children ?? [], + ].slice(2, -1) + presenceData.details = 'Reading a game walkthrough' + presenceData.state = breadcrumbs.length + ? `${breadcrumbs.map(a => a.textContent).join('/')}: ${ + document.querySelector('h1')?.textContent + }` + : document.querySelector('h1') + presenceData.buttons = [{ label: 'Read Walkthrough', url: href }] + } + else if (pathList[2] === 'search') { + presenceData.details = 'Searching for articles' + presenceData.state = searchParams.get('q') + } + else { + presenceData.details = 'Viewing a game' + presenceData.state = gameTitle + presenceData.buttons = [{ label: 'View Game', url: href }] + } + } + else { + presenceData.details = 'Browsing games' + } + break + } + } - presence.setActivity(presenceData); -}); + presence.setActivity(presenceData) +}) diff --git a/websites/G/GameBanana/metadata.json b/websites/G/GameBanana/metadata.json index 075305a8f112..0cd8586a3c82 100644 --- a/websites/G/GameBanana/metadata.json +++ b/websites/G/GameBanana/metadata.json @@ -1,25 +1,25 @@ { - "$schema": "https://schemas.premid.app/metadata/1.12", - "apiVersion": 1, - "author": { - "name": "MegAmi", - "id": "806614226717638677" - }, - "service": "GameBanana", - "description": { - "en": "GameBanana is a community of PC and console gamers who love to discuss, download, and share user-created game content." - }, - "url": "gamebanana.com", - "version": "1.0.12", - "logo": "https://cdn.rcd.gg/PreMiD/websites/G/GameBanana/assets/logo.png", - "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/GameBanana/assets/thumbnail.png", - "color": "#1c272e", - "category": "games", - "tags": [ - "modding", - "gaming", - "chat", - "social", - "gb" - ] -} \ No newline at end of file + "$schema": "https://schemas.premid.app/metadata/1.12", + "apiVersion": 1, + "author": { + "name": "MegAmi", + "id": "806614226717638677" + }, + "service": "GameBanana", + "description": { + "en": "GameBanana is a community of PC and console gamers who love to discuss, download, and share user-created game content." + }, + "url": "gamebanana.com", + "version": "1.0.12", + "logo": "https://cdn.rcd.gg/PreMiD/websites/G/GameBanana/assets/logo.png", + "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/GameBanana/assets/thumbnail.png", + "color": "#1c272e", + "category": "games", + "tags": [ + "modding", + "gaming", + "chat", + "social", + "gb" + ] +} diff --git a/websites/G/GameBanana/presence.ts b/websites/G/GameBanana/presence.ts index 679a08026e6f..ae048cff25a9 100644 --- a/websites/G/GameBanana/presence.ts +++ b/websites/G/GameBanana/presence.ts @@ -1,350 +1,374 @@ -const presence = new Presence({ clientId: "958520351158050887" }), - browsingTimestamp = Math.floor(Date.now() / 1000); +const presence = new Presence({ clientId: '958520351158050887' }) +const browsingTimestamp = Math.floor(Date.now() / 1000) -presence.on("UpdateData", async () => { - const presenceData: PresenceData = { - largeImageKey: - "https://cdn.rcd.gg/PreMiD/websites/G/GameBanana/assets/logo.png", - startTimestamp: browsingTimestamp, - }, - sections = [ - "mods", - "scripts", - "sounds", - "sprays", - "tools", - "contests", - "jams", - "concepts", - "projects", - "requests", - "tuts", - "wips", - "articles", - "blogs", - "events", - "news", - "polls", - "questions", - "threads", - "wares", - "apps", - "bugs", - "clubs", - "games", - "ideas", - "models", - "positions", - "reviews", - "studios", - "statusupdates", - "wikis", - "updates", - "posts", - "support", - "stamps", - "flags", - "permits", - "generators", - "initiatives", - ], - nogamesections = [ - "App", - "Bug", - "Club", - "Generator", - "Idea", - "Initiative", - "Model", - "Review", - "StatusUpdate", - "Support", - "Studio", - "Wiki", - ]; +presence.on('UpdateData', async () => { + const presenceData: PresenceData = { + largeImageKey: 'https://cdn.rcd.gg/PreMiD/websites/G/GameBanana/assets/logo.png', + startTimestamp: browsingTimestamp, + } + const sections = [ + 'mods', + 'scripts', + 'sounds', + 'sprays', + 'tools', + 'contests', + 'jams', + 'concepts', + 'projects', + 'requests', + 'tuts', + 'wips', + 'articles', + 'blogs', + 'events', + 'news', + 'polls', + 'questions', + 'threads', + 'wares', + 'apps', + 'bugs', + 'clubs', + 'games', + 'ideas', + 'models', + 'positions', + 'reviews', + 'studios', + 'statusupdates', + 'wikis', + 'updates', + 'posts', + 'support', + 'stamps', + 'flags', + 'permits', + 'generators', + 'initiatives', + ] + const nogamesections = [ + 'App', + 'Bug', + 'Club', + 'Generator', + 'Idea', + 'Initiative', + 'Model', + 'Review', + 'StatusUpdate', + 'Support', + 'Studio', + 'Wiki', + ] - if (document.location.hostname === "gamebanana.com") { - const header = document.querySelector("#PageTitle"); + if (document.location.hostname === 'gamebanana.com') { + const header = document.querySelector('#PageTitle') - if (!header) presenceData.details = "Viewing the Homepage"; - else if (header.textContent.includes("Tango Down!")) - presenceData.details = "Tango Down!"; - else if (document.location.pathname === "/discussions") - presenceData.details = "Browsing discussions"; - else if (header.textContent.includes(" : Discussions")) { - presenceData.details = "Viewing discussions for:"; - presenceData.state = header.textContent.split(" : ")[0]; - } else if (document.location.pathname.startsWith("/pms")) { - if (document.location.pathname.includes("/add")) - presenceData.details = "Sending a PM"; - else if (document.location.pathname.includes("/pms/")) - presenceData.details = "Reading a PM"; - else presenceData.details = "Checking PMs"; - } else if (document.location.pathname.startsWith("/games")) { - if (document.location.pathname === "/games") - presenceData.details = "Browsing games"; - else if (document.location.pathname === "/games/add") - presenceData.details = "Adding a game"; - else if (header.textContent.includes(" : ")) { - presenceData.details = `Viewing - ${ - header.textContent - .toLowerCase() - .replace("about", "the about page") - .split(" : ")[0] - } for:`; - presenceData.state = document.querySelector( - 'meta[property="gb:game_name"]' - ).content; - } else { - presenceData.details = "Browsing a game:"; - presenceData.state = document.querySelector( - 'meta[property="gb:game_name"]' - ).content; - } - } else if (document.location.pathname.includes("/add")) { - if ( - document.querySelector('meta[property="og:url"]') - .content === "/add" - ) - presenceData.details = "Adding a submission"; - else { - presenceData.details = `Adding a - ${document - .querySelector( - 'meta[property="gb:model_name"]' - ) - .content.toLowerCase() - .replace("statusupdate", "status update") - .replace("wip", "WiP")} for:`; - if ( - document.querySelector( - 'meta[property="gb:game_name"]' - ).content - ) { - presenceData.state = document.querySelector( - 'meta[property="gb:game_name"]' - ).content; - } else presenceData.details = presenceData.details.replace(" for:", ""); - } - } else if ( - sections.includes(document.location.pathname.slice(1).split("/")[0]) - ) { - if (document.location.pathname.includes("/games/")) { - presenceData.details = `Browsing ${document - .querySelector('meta[property="gb:plural_title"]') - .content.toLowerCase() - .replace("wip", "WiP")} for:`; - presenceData.state = document.querySelector( - 'meta[property="gb:game_name"]' - ).content; - } else if (document.location.pathname.includes("/cats")) { - if ( - nogamesections.includes( - document.querySelector( - 'meta[property="gb:model_name"]' - ).content - ) - ) { - presenceData.details = `Browsing a ${document - .querySelector('meta[property="gb:plural_title"]') - .content.toLowerCase()} category:`; - } else { - presenceData.details = `Browsing a ${document - .querySelector('meta[property="gb:plural_title"]') - .content.toLowerCase()} category for ${ - document.querySelector( - 'meta[property="gb:game_abbreviation"]' - ).content - }:`; - } - presenceData.state = header.textContent.split("- ")[0]; - } else if ( - header.textContent.includes("- A") && - document.location.pathname !== "/bugs" && - document.location.pathname !== "/statusupdates" - ) { - if (document.location.pathname.includes("/messenger")) - presenceData.details = "Sending a PM"; - else if (header.textContent.includes(" : ")) { - presenceData.state = header.textContent - .split("- A")[0] - .split(" : ")[1]; - if (document.location.pathname.includes("/edit")) { - presenceData.details = `Editing a - ${document - .querySelector( - 'meta[property="gb:model_name"]' - ) - .content.toLowerCase() - .replace("statusupdate", "status update") - .replace("wip", "WiP")}:`; - if ( - document - .querySelector( - "#Status > div:nth-child(3) > div:nth-child(1) > ul:nth-child(1) > li:nth-child(2)" - ) - .className.includes("Selected") - ) - presenceData.state = "(Private)"; - } else if (document.location.pathname.includes("/trash")) { - presenceData.details = `Trashing a - ${document - .querySelector( - 'meta[property="gb:model_name"]' - ) - .content.toLowerCase() - .replace("statusupdate", "status update") - .replace("wip", "WiP")}:`; - } else { - presenceData.details = `Viewing ${header.textContent - .split(" : ")[0] - .toLowerCase() - .replace("license", "the license") - .replace("withhold", "the withhold page") - .replace("team", "the team")} for a - ${document - .querySelector( - 'meta[property="gb:model_name"]' - ) - .content.toLowerCase() - .replace("statusupdate", "status update") - .replace("wip", "WiP")}:`; - } - } else { - if ( - nogamesections.includes( - document.querySelector( - 'meta[property="gb:model_name"]' - ).content - ) - ) { - presenceData.details = `Viewing a - ${document - .querySelector( - 'meta[property="gb:model_name"]' - ) - .content.toLowerCase() - .replace("statusupdate", "status update")}:`; - } else { - presenceData.details = `Viewing a - ${document - .querySelector( - 'meta[property="gb:model_name"]' - ) - .content.toLowerCase() - .replace("wip", "WiP")} for - ${ - document.querySelector( - 'meta[property="gb:game_abbreviation"]' - ).content - }:`; - } - presenceData.state = header.textContent.split("- A")[0]; - } - if (document.querySelector("#PrivateAccessNoticeModule")) - presenceData.state = "(Private)"; - } else { - presenceData.details = `Browsing - ${document - .querySelector('meta[property="gb:plural_title"]') - .content.toLowerCase() - .replace("statusupdate", "status update") - .replace("wip", "WiP")}`; - } - } else if (document.location.pathname.includes("/search")) - presenceData.details = "Searching for something..."; - else if (document.location.pathname.includes("/members")) { - if ( - document.location.pathname === "/members" || - document.location.pathname === "/members/index" || - document.location.pathname.startsWith("/members?") - ) - presenceData.details = "Browsing members"; - else if (document.location.pathname.startsWith("/members/public")) { - if (document.location.pathname.includes("/online")) - presenceData.details = "Browsing online members"; - else if (document.location.pathname.includes("/portfolio")) - presenceData.details = "Browsing member portfolios"; - else if (document.location.pathname.includes("/honorary")) - presenceData.details = "Browsing honorary members"; - else if (document.location.pathname.includes("/logs/points")) - presenceData.details = "Viewing the points log"; - else if (document.location.pathname.includes("/logs/unlocks")) - presenceData.details = "Viewing the unlocks log"; - else if (document.location.pathname.includes("/logs/awards")) - presenceData.details = "Viewing the awards log"; - else if (document.location.pathname.includes("/leaderboards/ranks")) - presenceData.details = "Viewing the leaderboard ranks"; - else if ( - document.location.pathname.includes("/leaderboards/subscribers") - ) - presenceData.details = "Viewing the subscribers leaderboard"; - else if ( - document.location.pathname.includes("/leaderboards/exemplifications") - ) - presenceData.details = "Viewing the exemplifications leaderboard"; - else if (document.location.pathname.includes("/leaderboards/thanked")) - presenceData.details = "Viewing the thanked leaderboard"; - else if (document.location.pathname.includes("/leaderboards/thankers")) - presenceData.details = "Viewing the thankers leaderboard"; - else if (document.location.pathname.includes("/leaderboards/donors")) - presenceData.details = "Viewing the donors leaderboard"; - else if (document.location.pathname.includes("/leaderboards/donees")) - presenceData.details = "Viewing the donees leaderboard"; - else if ( - document.location.pathname.includes("/leaderboards/submitters") - ) - presenceData.details = "Viewing the submitters leaderboard"; - } else if (document.location.pathname.includes("/settings")) { - presenceData.details = `Changing - ${ - header.textContent - .toLowerCase() - .replace("change password", "password") - .replace("settings", "") - .split(" : ")[0] - } settings`; - } else if (document.location.pathname.includes("/reminders")) - presenceData.details = "Viewing reminders"; - else if (header.textContent.includes(" : ")) { - presenceData.details = `Viewing ${ - header.textContent.toLowerCase().split(" : ")[0] - } of:`; - if (document.location.pathname.includes("/submissions")) { - if ( - sections.includes( - document.location.pathname.split("submissions/")[1].split("/")[0] - ) - ) { - presenceData.details = presenceData.details - .replace("of", "by") - .replace("bugs", "bug reports") - .replace("support by", "support tickets for") - .replace("wip", "WiP") - .replace("games", "games added"); - } else if (document.location.pathname.includes("cats/")) - presenceData.details = presenceData.details.replace("of", "by"); - } - presenceData.state = header.textContent.split(" : ")[1]; - } else { - presenceData.details = "Viewing profile of:"; - presenceData.state = header.textContent; - } - } - } + if (!header) { + presenceData.details = 'Viewing the Homepage' + } + else if (header.textContent?.includes('Tango Down!')) { + presenceData.details = 'Tango Down!' + } + else if (document.location.pathname === '/discussions') { + presenceData.details = 'Browsing discussions' + } + else if (header.textContent?.includes(' : Discussions')) { + presenceData.details = 'Viewing discussions for:' + presenceData.state = header.textContent.split(' : ')[0] + } + else if (document.location.pathname.startsWith('/pms')) { + if (document.location.pathname.includes('/add')) + presenceData.details = 'Sending a PM' + else if (document.location.pathname.includes('/pms/')) + presenceData.details = 'Reading a PM' + else presenceData.details = 'Checking PMs' + } + else if (document.location.pathname.startsWith('/games')) { + if (document.location.pathname === '/games') { + presenceData.details = 'Browsing games' + } + else if (document.location.pathname === '/games/add') { + presenceData.details = 'Adding a game' + } + else if (header.textContent?.includes(' : ')) { + presenceData.details = `Viewing ${ + header.textContent + .toLowerCase() + .replace('about', 'the about page') + .split(' : ')[0] + } for:` + presenceData.state = document.querySelector( + 'meta[property="gb:game_name"]', + )?.content + } + else { + presenceData.details = 'Browsing a game:' + presenceData.state = document.querySelector( + 'meta[property="gb:game_name"]', + )?.content + } + } + else if (document.location.pathname.includes('/add')) { + if ( + document.querySelector('meta[property="og:url"]') + ?.content === '/add' + ) { + presenceData.details = 'Adding a submission' + } + else { + presenceData.details = `Adding a ${document + .querySelector( + 'meta[property="gb:model_name"]', + ) + ?.content + .toLowerCase() + .replace('statusupdate', 'status update') + .replace('wip', 'WiP')} for:` + if ( + document.querySelector( + 'meta[property="gb:game_name"]', + )?.content + ) { + presenceData.state = document.querySelector( + 'meta[property="gb:game_name"]', + )?.content + } + else { + presenceData.details = presenceData.details.replace(' for:', '') + } + } + } + else if ( + sections.includes(document.location.pathname.slice(1).split('/')[0]) + ) { + if (document.location.pathname.includes('/games/')) { + presenceData.details = `Browsing ${document + .querySelector('meta[property="gb:plural_title"]') + ?.content + .toLowerCase() + .replace('wip', 'WiP')} for:` + presenceData.state = document.querySelector( + 'meta[property="gb:game_name"]', + )?.content + } + else if (document.location.pathname.includes('/cats')) { + if ( + nogamesections.includes( + document.querySelector( + 'meta[property="gb:model_name"]', + )?.content ?? '', + ) + ) { + presenceData.details = `Browsing a ${document + .querySelector('meta[property="gb:plural_title"]') + ?.content + .toLowerCase()} category:` + } + else { + presenceData.details = `Browsing a ${document + .querySelector('meta[property="gb:plural_title"]') + ?.content + .toLowerCase()} category for ${ + document.querySelector( + 'meta[property="gb:game_abbreviation"]', + )?.content + }:` + } + presenceData.state = header.textContent?.split('- ')[0] + } + else if ( + header.textContent?.includes('- A') + && document.location.pathname !== '/bugs' + && document.location.pathname !== '/statusupdates' + ) { + if (document.location.pathname.includes('/messenger')) { + presenceData.details = 'Sending a PM' + } + else if (header.textContent.includes(' : ')) { + presenceData.state = header.textContent + .split('- A')[0] + .split(' : ')[1] + if (document.location.pathname.includes('/edit')) { + presenceData.details = `Editing a ${document + .querySelector( + 'meta[property="gb:model_name"]', + ) + ?.content + .toLowerCase() + .replace('statusupdate', 'status update') + .replace('wip', 'WiP')}:` + if ( + document + .querySelector( + '#Status > div:nth-child(3) > div:nth-child(1) > ul:nth-child(1) > li:nth-child(2)', + ) + ?.className + .includes('Selected') + ) { + presenceData.state = '(Private)' + } + } + else if (document.location.pathname.includes('/trash')) { + presenceData.details = `Trashing a ${document + .querySelector( + 'meta[property="gb:model_name"]', + ) + ?.content + .toLowerCase() + .replace('statusupdate', 'status update') + .replace('wip', 'WiP')}:` + } + else { + presenceData.details = `Viewing ${header.textContent + .split(' : ')[0] + .toLowerCase() + .replace('license', 'the license') + .replace('withhold', 'the withhold page') + .replace('team', 'the team')} for a ${document + .querySelector( + 'meta[property="gb:model_name"]', + ) + ?.content + .toLowerCase() + .replace('statusupdate', 'status update') + .replace('wip', 'WiP')}:` + } + } + else { + if ( + nogamesections.includes( + document.querySelector( + 'meta[property="gb:model_name"]', + )?.content ?? '', + ) + ) { + presenceData.details = `Viewing a ${document + .querySelector( + 'meta[property="gb:model_name"]', + ) + ?.content + .toLowerCase() + .replace('statusupdate', 'status update')}:` + } + else { + presenceData.details = `Viewing a ${document + .querySelector( + 'meta[property="gb:model_name"]', + ) + ?.content + .toLowerCase() + .replace('wip', 'WiP')} for ${ + document.querySelector( + 'meta[property="gb:game_abbreviation"]', + )?.content + }:` + } + presenceData.state = header.textContent.split('- A')[0] + } + if (document.querySelector('#PrivateAccessNoticeModule')) + presenceData.state = '(Private)' + } + else { + presenceData.details = `Browsing ${document + .querySelector('meta[property="gb:plural_title"]') + ?.content + .toLowerCase() + .replace('statusupdate', 'status update') + .replace('wip', 'WiP')}` + } + } + else if (document.location.pathname.includes('/search')) { + presenceData.details = 'Searching for something...' + } + else if (document.location.pathname.includes('/members')) { + if ( + document.location.pathname === '/members' + || document.location.pathname === '/members/index' + || document.location.pathname.startsWith('/members?') + ) { + presenceData.details = 'Browsing members' + } + else if (document.location.pathname.startsWith('/members/public')) { + if (document.location.pathname.includes('/online')) + presenceData.details = 'Browsing online members' + else if (document.location.pathname.includes('/portfolio')) + presenceData.details = 'Browsing member portfolios' + else if (document.location.pathname.includes('/honorary')) + presenceData.details = 'Browsing honorary members' + else if (document.location.pathname.includes('/logs/points')) + presenceData.details = 'Viewing the points log' + else if (document.location.pathname.includes('/logs/unlocks')) + presenceData.details = 'Viewing the unlocks log' + else if (document.location.pathname.includes('/logs/awards')) + presenceData.details = 'Viewing the awards log' + else if (document.location.pathname.includes('/leaderboards/ranks')) + presenceData.details = 'Viewing the leaderboard ranks' + else if ( + document.location.pathname.includes('/leaderboards/subscribers') + ) + presenceData.details = 'Viewing the subscribers leaderboard' + else if ( + document.location.pathname.includes('/leaderboards/exemplifications') + ) + presenceData.details = 'Viewing the exemplifications leaderboard' + else if (document.location.pathname.includes('/leaderboards/thanked')) + presenceData.details = 'Viewing the thanked leaderboard' + else if (document.location.pathname.includes('/leaderboards/thankers')) + presenceData.details = 'Viewing the thankers leaderboard' + else if (document.location.pathname.includes('/leaderboards/donors')) + presenceData.details = 'Viewing the donors leaderboard' + else if (document.location.pathname.includes('/leaderboards/donees')) + presenceData.details = 'Viewing the donees leaderboard' + else if ( + document.location.pathname.includes('/leaderboards/submitters') + ) + presenceData.details = 'Viewing the submitters leaderboard' + } + else if (document.location.pathname.includes('/settings')) { + presenceData.details = `Changing ${ + header.textContent + ?.toLowerCase() + .replace('change password', 'password') + .replace('settings', '') + .split(' : ')[0] + } settings` + } + else if (document.location.pathname.includes('/reminders')) { + presenceData.details = 'Viewing reminders' + } + else if (header.textContent?.includes(' : ')) { + presenceData.details = `Viewing ${ + header.textContent.toLowerCase().split(' : ')[0] + } of:` + if (document.location.pathname.includes('/submissions')) { + if ( + sections.includes( + document.location.pathname.split('submissions/')[1].split('/')[0], + ) + ) { + presenceData.details = presenceData.details + .replace('of', 'by') + .replace('bugs', 'bug reports') + .replace('support by', 'support tickets for') + .replace('wip', 'WiP') + .replace('games', 'games added') + } + else if (document.location.pathname.includes('cats/')) { + presenceData.details = presenceData.details.replace('of', 'by') + } + } + presenceData.state = header.textContent.split(' : ')[1] + } + else { + presenceData.details = 'Viewing profile of:' + presenceData.state = header.textContent + } + } + } - if (presenceData.details) { - presenceData.details = (presenceData.details as string) - .replaceAll("\n", "") - .replaceAll(" ", ""); - } - if (presenceData.state) { - presenceData.state = (presenceData.state as string) - .replaceAll("\n", "") - .replaceAll(" ", ""); - } - - if (presenceData.details) presence.setActivity(presenceData); - else presence.setActivity(); -}); + if (presenceData.details) + presence.setActivity(presenceData) + else presence.setActivity() +}) diff --git a/websites/G/GameStar/metadata.json b/websites/G/GameStar/metadata.json index 64fa2fe83735..d74862c23b1e 100644 --- a/websites/G/GameStar/metadata.json +++ b/websites/G/GameStar/metadata.json @@ -1,25 +1,25 @@ { - "$schema": "https://schemas.premid.app/metadata/1.12", - "apiVersion": 1, - "author": { - "name": "Bas950", - "id": "241278257335500811" - }, - "service": "GameStar", - "description": { - "en": "GameStar.de provides you with tests, previews, videos, reports and news about PC games and hardware. We deliver game journalism that you can trust.", - "nl": "GameStar.de biedt u tests, previews, video's, rapporten en nieuws over pc-games en hardware. Wij leveren gamejournalistiek die u kunt vertrouwen.", - "de": "GameStar.de versorgt euch mit Tests, Previews, Videos, Reportagen und News zu PC-Spielen und Hardware. Wir liefern Spielejournalismus, dem ihr vertrauen könnt." - }, - "url": "www.gamestar.de", - "regExp": "([a-z0-9-]+[.])*gamestar[.]de[/]", - "version": "1.2.22", - "logo": "https://cdn.rcd.gg/PreMiD/websites/G/GameStar/assets/logo.png", - "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/GameStar/assets/thumbnail.png", - "color": "#162781", - "category": "other", - "tags": [ - "articles", - "german" - ] -} \ No newline at end of file + "$schema": "https://schemas.premid.app/metadata/1.12", + "apiVersion": 1, + "author": { + "name": "Bas950", + "id": "241278257335500811" + }, + "service": "GameStar", + "description": { + "en": "GameStar.de provides you with tests, previews, videos, reports and news about PC games and hardware. We deliver game journalism that you can trust.", + "nl": "GameStar.de biedt u tests, previews, video's, rapporten en nieuws over pc-games en hardware. Wij leveren gamejournalistiek die u kunt vertrouwen.", + "de": "GameStar.de versorgt euch mit Tests, Previews, Videos, Reportagen und News zu PC-Spielen und Hardware. Wir liefern Spielejournalismus, dem ihr vertrauen könnt." + }, + "url": "www.gamestar.de", + "regExp": "([a-z0-9-]+[.])*gamestar[.]de[/]", + "version": "1.2.22", + "logo": "https://cdn.rcd.gg/PreMiD/websites/G/GameStar/assets/logo.png", + "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/GameStar/assets/thumbnail.png", + "color": "#162781", + "category": "other", + "tags": [ + "articles", + "german" + ] +} diff --git a/websites/G/GameStar/presence.ts b/websites/G/GameStar/presence.ts index 466d95140279..e83ded5ecb6d 100644 --- a/websites/G/GameStar/presence.ts +++ b/websites/G/GameStar/presence.ts @@ -1,69 +1,71 @@ const presence = new Presence({ - clientId: "640969147911503910", - }), - strings = presence.getStrings({ - play: "general.playing", - pause: "general.paused", - }), - browsingTimestamp = Math.floor(Date.now() / 1000); + clientId: '640969147911503910', +}) +const strings = presence.getStrings({ + play: 'general.playing', + pause: 'general.paused', +}) +const browsingTimestamp = Math.floor(Date.now() / 1000) -let user: HTMLElement; +presence.on('UpdateData', async () => { + const presenceData: PresenceData = { + largeImageKey: 'https://cdn.rcd.gg/PreMiD/websites/G/GameStar/assets/logo.png', + } -presence.on("UpdateData", async () => { - const presenceData: PresenceData = { - largeImageKey: - "https://cdn.rcd.gg/PreMiD/websites/G/GameStar/assets/logo.png", - }; + if (document.location.hostname === 'www.gamestar.de') { + if (document.location.pathname === '/') { + presenceData.startTimestamp = browsingTimestamp + presenceData.details = 'Betrachtet die Startseite' + } + else if (document.location.pathname.includes('/artikel/')) { + presenceData.startTimestamp = browsingTimestamp + const user = document.querySelector( + '#content > div:nth-child(3) > div > div > div.col-xs-12.div-article-title > div:nth-child(6) > div:nth-child(1) > h1', + ) + presenceData.details = 'Liest Artikel:' + presenceData.state = user?.textContent + presenceData.smallImageKey = Assets.Reading + } + else if (document.location.pathname.includes('/videos/')) { + const video = document.querySelector( + '#playerID > div.jw-wrapper.jw-reset > div.jw-media.jw-reset > video', + ) + const title = document.querySelector( + '#content > div:nth-child(3) > div > div > div > div:nth-child(3) > div > h1', + )?.textContent + if (video && !Number.isNaN(video.duration)) { + presenceData.smallImageKey = video.paused ? Assets.Pause : Assets.Play + presenceData.smallImageText = video.paused + ? (await strings).pause + : (await strings).play; + [presenceData.startTimestamp, presenceData.endTimestamp] = presence.getTimestamps( + Math.floor(video.currentTime), + Math.floor(video.duration), + ); - if (document.location.hostname === "www.gamestar.de") { - if (document.location.pathname === "/") { - presenceData.startTimestamp = browsingTimestamp; - presenceData.details = "Betrachtet die Startseite"; - } else if (document.location.pathname.includes("/artikel/")) { - presenceData.startTimestamp = browsingTimestamp; - user = document.querySelector( - "#content > div:nth-child(3) > div > div > div.col-xs-12.div-article-title > div:nth-child(6) > div:nth-child(1) > h1" - ); - presenceData.details = "Liest Artikel:"; - presenceData.state = user.textContent; - presenceData.smallImageKey = Assets.Reading; - } else if (document.location.pathname.includes("/videos/")) { - const video: HTMLVideoElement = document.querySelector( - "#playerID > div.jw-wrapper.jw-reset > div.jw-media.jw-reset > video" - ), - title = document.querySelector( - "#content > div:nth-child(3) > div > div > div > div:nth-child(3) > div > h1" - ).textContent; - if (!isNaN(video.duration)) { - presenceData.smallImageKey = video.paused ? Assets.Pause : Assets.Play; - presenceData.smallImageText = video.paused - ? (await strings).pause - : (await strings).play; - [presenceData.startTimestamp, presenceData.endTimestamp] = - presence.getTimestamps( - Math.floor(video.currentTime), - Math.floor(video.duration) - ); + [presenceData.details] = title?.split('-') ?? [] + presenceData.state = title?.replace(`${title.split('-')[0]}- `, '') - [presenceData.details] = title.split("-"); - presenceData.state = title.replace(`${title.split("-")[0]}- `, ""); + if (video.paused) { + delete presenceData.startTimestamp + delete presenceData.endTimestamp + } + } + else if (video && Number.isNaN(video.duration)) { + presenceData.startTimestamp = browsingTimestamp + presenceData.details = 'Betrachtet:' + presenceData.state = title + } + } + } - if (video.paused) { - delete presenceData.startTimestamp; - delete presenceData.endTimestamp; - } - } else if (isNaN(video.duration)) { - presenceData.startTimestamp = browsingTimestamp; - presenceData.details = "Betrachtet:"; - presenceData.state = title; - } - } - } - - if (!presenceData.details) { - presenceData.startTimestamp = browsingTimestamp; - presenceData.details = "Betrachtet Seite:"; - presenceData.state = document.querySelector("head > title").textContent; - presence.setActivity(presenceData); - } else presence.setActivity(presenceData); -}); + if (!presenceData.details) { + presenceData.startTimestamp = browsingTimestamp + presenceData.details = 'Betrachtet Seite:' + presenceData.state = document.querySelector('head > title')?.textContent + presence.setActivity(presenceData) + } + else { + presence.setActivity(presenceData) + } +}) diff --git a/websites/G/Garden/metadata.json b/websites/G/Garden/metadata.json index e96443a7fd07..edb00fea9310 100644 --- a/websites/G/Garden/metadata.json +++ b/websites/G/Garden/metadata.json @@ -1,25 +1,25 @@ { - "$schema": "https://schemas.premid.app/metadata/1.12", - "apiVersion": 1, - "author": { - "name": "Uhevela", - "id": "616969786718683167" - }, - "service": "Garden", - "description": { - "en": "A French Minecraft server cultivated by dedicated players.", - "nl": "Een Franse Minecraft server gecultiveerd door toegewijde spelers." - }, - "url": "gardenmc.fr", - "version": "1.1.21", - "logo": "https://cdn.rcd.gg/PreMiD/websites/G/Garden/assets/logo.png", - "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/Garden/assets/thumbnail.png", - "color": "#0f7e49", - "category": "games", - "tags": [ - "garden", - "minecraft", - "survival", - "french" - ] -} \ No newline at end of file + "$schema": "https://schemas.premid.app/metadata/1.12", + "apiVersion": 1, + "author": { + "name": "Uhevela", + "id": "616969786718683167" + }, + "service": "Garden", + "description": { + "en": "A French Minecraft server cultivated by dedicated players.", + "nl": "Een Franse Minecraft server gecultiveerd door toegewijde spelers." + }, + "url": "gardenmc.fr", + "version": "1.1.21", + "logo": "https://cdn.rcd.gg/PreMiD/websites/G/Garden/assets/logo.png", + "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/Garden/assets/thumbnail.png", + "color": "#0f7e49", + "category": "games", + "tags": [ + "garden", + "minecraft", + "survival", + "french" + ] +} diff --git a/websites/G/Garden/presence.ts b/websites/G/Garden/presence.ts index f4b76a2df0c3..4536c92ec752 100644 --- a/websites/G/Garden/presence.ts +++ b/websites/G/Garden/presence.ts @@ -1,138 +1,151 @@ const presence = new Presence({ - clientId: "714194261679276094", - }), - browsingTimestamp = Math.floor(Date.now() / 1000); + clientId: '714194261679276094', +}) +const browsingTimestamp = Math.floor(Date.now() / 1000) -presence.on("UpdateData", async () => { - const presenceData: PresenceData = { - largeImageKey: - "https://cdn.rcd.gg/PreMiD/websites/G/Garden/assets/logo.png", - startTimestamp: browsingTimestamp, - }; - if (document.location.pathname === "/") - presenceData.details = "play.gardenmc.fr"; - else if (document.location.pathname === "/p/rules") { - presenceData.details = "Lit les règles"; - presenceData.state = "Règles"; - } else if (document.location.pathname.includes("/blog")) { - presenceData.details = "Lit les news"; - presenceData.state = "Blog"; - } else if (document.location.pathname.includes("/user")) { - presenceData.details = "Consulte un profil"; - presenceData.state = "Profil"; - } else if (document.location.pathname.includes("/topic/add/")) - presenceData.details = "Écrit un nouveau topic"; - else { - switch (document.location.pathname) { - case "/vote": { - presenceData.details = "En train de Voter"; - presenceData.state = "Vote"; +presence.on('UpdateData', async () => { + const presenceData: PresenceData = { + largeImageKey: 'https://cdn.rcd.gg/PreMiD/websites/G/Garden/assets/logo.png', + startTimestamp: browsingTimestamp, + } + if (document.location.pathname === '/') { + presenceData.details = 'play.gardenmc.fr' + } + else if (document.location.pathname === '/p/rules') { + presenceData.details = 'Lit les règles' + presenceData.state = 'Règles' + } + else if (document.location.pathname.includes('/blog')) { + presenceData.details = 'Lit les news' + presenceData.state = 'Blog' + } + else if (document.location.pathname.includes('/user')) { + presenceData.details = 'Consulte un profil' + presenceData.state = 'Profil' + } + else if (document.location.pathname.includes('/topic/add/')) { + presenceData.details = 'Écrit un nouveau topic' + } + else { + switch (document.location.pathname) { + case '/vote': { + presenceData.details = 'En train de Voter' + presenceData.state = 'Vote' - break; - } - case "/message": { - presenceData.details = "Consulte ses messages"; - presenceData.state = "MP"; + break + } + case '/message': { + presenceData.details = 'Consulte ses messages' + presenceData.state = 'MP' - break; - } - case "/support": { - presenceData.details = "Consulte le support"; - presenceData.state = "Support"; + break + } + case '/support': { + presenceData.details = 'Consulte le support' + presenceData.state = 'Support' - break; - } - case "/support/create": { - presenceData.details = "Écrit un ticket au support"; - presenceData.state = "Support"; + break + } + case '/support/create': { + presenceData.details = 'Écrit un ticket au support' + presenceData.state = 'Support' - break; - } - case "/message/new": { - presenceData.details = "Écrit un message privé"; - presenceData.state = "MP"; + break + } + case '/message/new': { + presenceData.details = 'Écrit un message privé' + presenceData.state = 'MP' - break; - } - case "/list": { - presenceData.details = "Consulte la liste des membres"; - presenceData.state = "List"; + break + } + case '/list': { + presenceData.details = 'Consulte la liste des membres' + presenceData.state = 'List' - break; - } - case "/stats": { - presenceData.details = "Consultes les stats du site"; - presenceData.state = "Statistiques"; + break + } + case '/stats': { + presenceData.details = 'Consultes les stats du site' + presenceData.state = 'Statistiques' - break; - } - case "/profile": { - presenceData.details = "Consulte son profil"; - presenceData.state = "Profil"; + break + } + case '/profile': { + presenceData.details = 'Consulte son profil' + presenceData.state = 'Profil' - break; - } - case "/shop": { - presenceData.details = "Consulte la boutique"; - presenceData.state = "Shop"; + break + } + case '/shop': { + presenceData.details = 'Consulte la boutique' + presenceData.state = 'Shop' - break; - } - case "/faq": { - presenceData.state = "F.A.Q"; - presenceData.details = "Consulte la F.A.Q"; + break + } + case '/faq': { + presenceData.state = 'F.A.Q' + presenceData.details = 'Consulte la F.A.Q' - break; - } - case "/forum": { - presenceData.details = "Consulte le forum"; - presenceData.state = "Forum"; + break + } + case '/forum': { + presenceData.details = 'Consulte le forum' + presenceData.state = 'Forum' - break; - } - case "/forum/Informations.4/": { - presenceData.details = "Consulte les infos"; - presenceData.state = "Informations"; + break + } + case '/forum/Informations.4/': { + presenceData.details = 'Consulte les infos' + presenceData.state = 'Informations' - break; - } - default: - if (document.location.pathname.includes("/forum/Candidatures.5/")) { - presenceData.details = "Parcourt les candidatures"; - presenceData.state = "Candidatures"; - } else if (document.location.pathname.includes("/topic/Candi")) { - presenceData.details = "Lit une candidature"; - presenceData.state = "Candidatures"; - } else if (document.location.pathname.includes("/topic/candi")) { - presenceData.details = "Lit une candidature"; - presenceData.state = "Candidatures"; - } else if (document.location.pathname.includes("/topic")) { - presenceData.details = "Lit un topic"; - presenceData.state = "Topic"; - } else if (document.location.pathname.includes("/forum/Boite")) { - presenceData.state = "Boite à idées"; - presenceData.details = "Consulte la boite à idée"; - } else if (document.location.pathname.includes("/forum/Bugs.7/")) { - presenceData.details = "Consulte la section Bug"; - presenceData.state = "Bugs"; - } else if ( - document.location.pathname.includes( - "/forum/Demande-de-Debannissement-.15/" - ) - ) { - presenceData.state = "Demande deban"; - presenceData.details = "Consulte la section unban"; - } else if (document.location.pathname.includes("/forum/Aide.10/")) { - presenceData.state = "Aides"; - presenceData.details = "Consulte la section aide"; - } else if (document.location.pathname.includes("/forum/Cr")) { - presenceData.state = "Créations"; - presenceData.details = "Consulte les projets"; - } else if (document.location.pathname === "/forum/Taverne.12/") { - presenceData.state = "Taverne"; - presenceData.details = "Boit un verre"; - } - } - } - presence.setActivity(presenceData); -}); + break + } + default: + if (document.location.pathname.includes('/forum/Candidatures.5/')) { + presenceData.details = 'Parcourt les candidatures' + presenceData.state = 'Candidatures' + } + else if (document.location.pathname.includes('/topic/Candi')) { + presenceData.details = 'Lit une candidature' + presenceData.state = 'Candidatures' + } + else if (document.location.pathname.includes('/topic/candi')) { + presenceData.details = 'Lit une candidature' + presenceData.state = 'Candidatures' + } + else if (document.location.pathname.includes('/topic')) { + presenceData.details = 'Lit un topic' + presenceData.state = 'Topic' + } + else if (document.location.pathname.includes('/forum/Boite')) { + presenceData.state = 'Boite à idées' + presenceData.details = 'Consulte la boite à idée' + } + else if (document.location.pathname.includes('/forum/Bugs.7/')) { + presenceData.details = 'Consulte la section Bug' + presenceData.state = 'Bugs' + } + else if ( + document.location.pathname.includes( + '/forum/Demande-de-Debannissement-.15/', + ) + ) { + presenceData.state = 'Demande deban' + presenceData.details = 'Consulte la section unban' + } + else if (document.location.pathname.includes('/forum/Aide.10/')) { + presenceData.state = 'Aides' + presenceData.details = 'Consulte la section aide' + } + else if (document.location.pathname.includes('/forum/Cr')) { + presenceData.state = 'Créations' + presenceData.details = 'Consulte les projets' + } + else if (document.location.pathname === '/forum/Taverne.12/') { + presenceData.state = 'Taverne' + presenceData.details = 'Boit un verre' + } + } + } + presence.setActivity(presenceData) +}) diff --git a/websites/G/Gartic Phone/metadata.json b/websites/G/Gartic Phone/metadata.json index c3e23106b913..20baef97600f 100644 --- a/websites/G/Gartic Phone/metadata.json +++ b/websites/G/Gartic Phone/metadata.json @@ -1,38 +1,38 @@ { - "$schema": "https://schemas.premid.app/metadata/1.12", - "apiVersion": 1, - "author": { - "name": "Nevylish", - "id": "343847696483745794" - }, - "service": "Gartic Phone", - "description": { - "en": "The Telephone Game", - "nl": "Het telefoonspel" - }, - "url": "garticphone.com", - "version": "1.0.20", - "logo": "https://cdn.rcd.gg/PreMiD/websites/G/Gartic%20Phone/assets/logo.png", - "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/Gartic%20Phone/assets/thumbnail.png", - "color": "#7424D9", - "category": "games", - "tags": [ - "game", - "gartic", - "phone" - ], - "settings": [ - { - "id": "privacyDraw", - "title": "Hide drawing details", - "icon": "fad fa-user-secret", - "value": false - }, - { - "id": "privacyAlbum", - "title": "Hide album usernames", - "icon": "fad fa-user-secret", - "value": false - } - ] -} \ No newline at end of file + "$schema": "https://schemas.premid.app/metadata/1.12", + "apiVersion": 1, + "author": { + "name": "Nevylish", + "id": "343847696483745794" + }, + "service": "Gartic Phone", + "description": { + "en": "The Telephone Game", + "nl": "Het telefoonspel" + }, + "url": "garticphone.com", + "version": "1.0.20", + "logo": "https://cdn.rcd.gg/PreMiD/websites/G/Gartic%20Phone/assets/logo.png", + "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/Gartic%20Phone/assets/thumbnail.png", + "color": "#7424D9", + "category": "games", + "tags": [ + "game", + "gartic", + "phone" + ], + "settings": [ + { + "id": "privacyDraw", + "title": "Hide drawing details", + "icon": "fad fa-user-secret", + "value": false + }, + { + "id": "privacyAlbum", + "title": "Hide album usernames", + "icon": "fad fa-user-secret", + "value": false + } + ] +} diff --git a/websites/G/Gartic Phone/presence.ts b/websites/G/Gartic Phone/presence.ts index 99cec32c13e2..7b52c4d67a61 100644 --- a/websites/G/Gartic Phone/presence.ts +++ b/websites/G/Gartic Phone/presence.ts @@ -1,45 +1,54 @@ const presence = new Presence({ - clientId: "803366782722244638", - }), - browsingTimestamp = Math.floor(Date.now() / 1000); + clientId: '803366782722244638', +}) +const browsingTimestamp = Math.floor(Date.now() / 1000) -presence.on("UpdateData", async () => { - const presenceData: PresenceData = { - largeImageKey: - "https://cdn.rcd.gg/PreMiD/websites/G/Gartic%20Phone/assets/logo.png", - startTimestamp: browsingTimestamp, - }, - privacyDraw = await presence.getSetting("privacyDraw"), - privacyAlbum = await presence.getSetting("privacyAlbum"); +presence.on('UpdateData', async () => { + const presenceData: PresenceData = { + largeImageKey: 'https://cdn.rcd.gg/PreMiD/websites/G/Gartic%20Phone/assets/logo.png', + startTimestamp: browsingTimestamp, + } + const privacyDraw = await presence.getSetting('privacyDraw') + const privacyAlbum = await presence.getSetting('privacyAlbum') - if (window.location.hostname.includes("garticphone")) { - if (window.location.pathname.endsWith("lobby")) - presenceData.details = "Awaiting the launch of the game..."; - else if (window.location.pathname.endsWith("start")) - presenceData.details = "Start a story"; - else if (window.location.pathname.endsWith("draw")) { - if (privacyDraw) presenceData.details = "Drawing..."; - else { - presenceData.details = "Drawing:"; - presenceData.state = `${ - document.querySelector(".jsx-1934821697 h3").textContent - }`; - } - } else if (window.location.pathname.endsWith("write")) - presenceData.details = "Writing..."; - else if (window.location.pathname.endsWith("book")) { - if (privacyAlbum) presenceData.details = "Look at the album"; - else { - presenceData.details = "Look at the album of:"; - presenceData.state = `${ - document.querySelector(".jsx-1186471753 span").textContent - }`; - } - } else { - presenceData.details = "Browsing the home page"; - delete presenceData.endTimestamp; - } - } - if (presenceData.details) presence.setActivity(presenceData); - else presence.setActivity(); -}); + if (window.location.hostname.includes('garticphone')) { + if (window.location.pathname.endsWith('lobby')) { + presenceData.details = 'Awaiting the launch of the game...' + } + else if (window.location.pathname.endsWith('start')) { + presenceData.details = 'Start a story' + } + else if (window.location.pathname.endsWith('draw')) { + if (privacyDraw) { + presenceData.details = 'Drawing...' + } + else { + presenceData.details = 'Drawing:' + presenceData.state = `${ + document.querySelector('.jsx-1934821697 h3')?.textContent + }` + } + } + else if (window.location.pathname.endsWith('write')) { + presenceData.details = 'Writing...' + } + else if (window.location.pathname.endsWith('book')) { + if (privacyAlbum) { + presenceData.details = 'Look at the album' + } + else { + presenceData.details = 'Look at the album of:' + presenceData.state = `${ + document.querySelector('.jsx-1186471753 span')?.textContent + }` + } + } + else { + presenceData.details = 'Browsing the home page' + delete presenceData.endTimestamp + } + } + if (presenceData.details) + presence.setActivity(presenceData) + else presence.setActivity() +}) diff --git a/websites/G/Gartic.com.br/metadata.json b/websites/G/Gartic.com.br/metadata.json index 8765788bd70c..806d0162a9ca 100644 --- a/websites/G/Gartic.com.br/metadata.json +++ b/websites/G/Gartic.com.br/metadata.json @@ -1,23 +1,23 @@ { - "$schema": "https://schemas.premid.app/metadata/1.12", - "apiVersion": 1, - "author": { - "name": "Striker", - "id": "215509157837537280" - }, - "service": "Gartic.com.br", - "description": { - "en": "Play Gartic.com.br online and for free without needing to download anything!", - "nl": "Speel Gartic.com.br online en gratis zonder iets te hoeven downloaden!" - }, - "url": "gartic.com.br", - "version": "1.3.26", - "logo": "https://cdn.rcd.gg/PreMiD/websites/G/Gartic.com.br/assets/logo.png", - "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/Gartic.com.br/assets/thumbnail.png", - "color": "#FBD981", - "category": "games", - "tags": [ - "gartic-com-br", - "games" - ] -} \ No newline at end of file + "$schema": "https://schemas.premid.app/metadata/1.12", + "apiVersion": 1, + "author": { + "name": "Striker", + "id": "215509157837537280" + }, + "service": "Gartic.com.br", + "description": { + "en": "Play Gartic.com.br online and for free without needing to download anything!", + "nl": "Speel Gartic.com.br online en gratis zonder iets te hoeven downloaden!" + }, + "url": "gartic.com.br", + "version": "1.3.26", + "logo": "https://cdn.rcd.gg/PreMiD/websites/G/Gartic.com.br/assets/logo.png", + "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/Gartic.com.br/assets/thumbnail.png", + "color": "#FBD981", + "category": "games", + "tags": [ + "gartic-com-br", + "games" + ] +} diff --git a/websites/G/Gartic.com.br/presence.ts b/websites/G/Gartic.com.br/presence.ts index f4823025a833..7925c62c2710 100644 --- a/websites/G/Gartic.com.br/presence.ts +++ b/websites/G/Gartic.com.br/presence.ts @@ -1,25 +1,28 @@ const presence = new Presence({ - clientId: "808757125747966032", - }), - browsingTimestamp = Math.floor(Date.now() / 1000); + clientId: '808757125747966032', +}) +const browsingTimestamp = Math.floor(Date.now() / 1000) -presence.on("UpdateData", async () => { - const presenceData: PresenceData = { - largeImageKey: - "https://cdn.rcd.gg/PreMiD/websites/G/Gartic.com.br/assets/logo.png", - startTimestamp: browsingTimestamp, - }; - if (document.location.pathname.split("/")[1].match(/^\d/)) { - presenceData.details = `${ - document.querySelector("div.user.proprio .dados span").textContent - } - ${document - .querySelector("div.user.proprio .dados pre") - .textContent.split("pontos")[0] - .trim()} points`; - presenceData.state = `Lobby: ${ - document.querySelector("title").textContent.split("-")[0] - }`; - } else presenceData.details = "Not in-game"; +presence.on('UpdateData', async () => { + const presenceData: PresenceData = { + largeImageKey: 'https://cdn.rcd.gg/PreMiD/websites/G/Gartic.com.br/assets/logo.png', + startTimestamp: browsingTimestamp, + } + if (document.location.pathname.split('/')[1].match(/^\d/)) { + presenceData.details = `${ + document.querySelector('div.user.proprio .dados span')?.textContent + } - ${document + .querySelector('div.user.proprio .dados pre') + ?.textContent + ?.split('pontos')[0] + ?.trim()} points` + presenceData.state = `Lobby: ${ + document.querySelector('title')?.textContent?.split('-')[0] + }` + } + else { + presenceData.details = 'Not in-game' + } - presence.setActivity(presenceData); -}); + presence.setActivity(presenceData) +}) diff --git a/websites/G/Gartic.io/metadata.json b/websites/G/Gartic.io/metadata.json index 9c37643bf137..f58384ff3b81 100644 --- a/websites/G/Gartic.io/metadata.json +++ b/websites/G/Gartic.io/metadata.json @@ -1,23 +1,23 @@ { - "$schema": "https://schemas.premid.app/metadata/1.12", - "apiVersion": 1, - "author": { - "name": "Striker", - "id": "215509157837537280" - }, - "service": "Gartic.io", - "description": { - "en": "Play Gartic.io online and for free. Draw and guess the words as fastest as you can! Join on worldwide rooms or create your own.", - "nl": "Speel Gartic.io online en gratis. Teken en raad de woorden zo snel als je kunt! Doe mee aan wereldwijde rooms of maak je eigen." - }, - "url": "gartic.io", - "version": "1.3.25", - "logo": "https://cdn.rcd.gg/PreMiD/websites/G/Gartic.io/assets/logo.png", - "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/Gartic.io/assets/thumbnail.png", - "color": "#FBD981", - "category": "games", - "tags": [ - "gartic-io", - "games" - ] -} \ No newline at end of file + "$schema": "https://schemas.premid.app/metadata/1.12", + "apiVersion": 1, + "author": { + "name": "Striker", + "id": "215509157837537280" + }, + "service": "Gartic.io", + "description": { + "en": "Play Gartic.io online and for free. Draw and guess the words as fastest as you can! Join on worldwide rooms or create your own.", + "nl": "Speel Gartic.io online en gratis. Teken en raad de woorden zo snel als je kunt! Doe mee aan wereldwijde rooms of maak je eigen." + }, + "url": "gartic.io", + "version": "1.3.25", + "logo": "https://cdn.rcd.gg/PreMiD/websites/G/Gartic.io/assets/logo.png", + "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/Gartic.io/assets/thumbnail.png", + "color": "#FBD981", + "category": "games", + "tags": [ + "gartic-io", + "games" + ] +} diff --git a/websites/G/Gartic.io/presence.ts b/websites/G/Gartic.io/presence.ts index 8a35bb447984..86f6a6f05f15 100644 --- a/websites/G/Gartic.io/presence.ts +++ b/websites/G/Gartic.io/presence.ts @@ -1,39 +1,47 @@ const presence = new Presence({ - clientId: "808668919635247104", - }), - browsingTimestamp = Math.floor(Date.now() / 1000); + clientId: '808668919635247104', +}) +const browsingTimestamp = Math.floor(Date.now() / 1000) -presence.on("UpdateData", async () => { - const presenceData: PresenceData = { - largeImageKey: - "https://cdn.rcd.gg/PreMiD/websites/G/Gartic.io/assets/logo.png", - startTimestamp: browsingTimestamp, - }, - path = document.location.pathname; - if (path === "/") presenceData.details = "Viewing the Homepage"; - else if (path === "/rooms") presenceData.details = "Viewing Rooms"; - else if ( - document.location.pathname.split("/")[1].match(/^\d/) || - path === "/room" - ) { - if (document.querySelector(".infosUsers")) { - presenceData.details = "Setting up Info to Join"; - presenceData.state = `Players: ${ - document.querySelector(".infosRoom li:last-child span strong") - .textContent - }`; - } else { - presenceData.details = `${ - document.querySelector(".you .nick").textContent - } - ${document - .querySelector(".you .points") - .textContent.split("pts")[0] - .trim()} points`; - presenceData.state = `Lobby: ${ - document.querySelector("title").textContent.split("-")[0] - }`; - } - } else presenceData.details = "Somewhere on-site"; +presence.on('UpdateData', async () => { + const presenceData: PresenceData = { + largeImageKey: 'https://cdn.rcd.gg/PreMiD/websites/G/Gartic.io/assets/logo.png', + startTimestamp: browsingTimestamp, + } + const path = document.location.pathname + if (path === '/') { + presenceData.details = 'Viewing the Homepage' + } + else if (path === '/rooms') { + presenceData.details = 'Viewing Rooms' + } + else if ( + document.location.pathname.split('/')[1].match(/^\d/) + || path === '/room' + ) { + if (document.querySelector('.infosUsers')) { + presenceData.details = 'Setting up Info to Join' + presenceData.state = `Players: ${ + document.querySelector('.infosRoom li:last-child span strong') + ?.textContent + }` + } + else { + presenceData.details = `${ + document.querySelector('.you .nick')?.textContent + } - ${document + .querySelector('.you .points') + ?.textContent + ?.split('pts')[0] + ?.trim()} points` + presenceData.state = `Lobby: ${ + document.querySelector('title')?.textContent?.split('-')[0] + }` + } + } + else { + presenceData.details = 'Somewhere on-site' + } - presence.setActivity(presenceData); -}); + presence.setActivity(presenceData) +}) diff --git a/websites/G/GeForce NOW/metadata.json b/websites/G/GeForce NOW/metadata.json index c3afe5b5303f..6fbd1c7f6dd8 100644 --- a/websites/G/GeForce NOW/metadata.json +++ b/websites/G/GeForce NOW/metadata.json @@ -1,37 +1,37 @@ { - "$schema": "https://schemas.premid.app/metadata/1.12", - "apiVersion": 1, - "author": { - "name": "AsyncSenpai", - "id": "93973697643155456" - }, - "service": "GeForce NOW", - "description": { - "en": "GeForce Now is the brand used by Nvidia for its cloud gaming service.", - "vi_VN": "GeForce Now là thương hiệu của Nvidia cho dịch vụ game trên đám mây của họ." - }, - "url": "play.geforcenow.com", - "version": "1.0.22", - "logo": "https://cdn.rcd.gg/PreMiD/websites/G/GeForce%20NOW/assets/logo.png", - "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/GeForce%20NOW/assets/thumbnail.png", - "color": "#76B918", - "category": "games", - "tags": [ - "gaming", - "streaming" - ], - "settings": [ - { - "id": "privacy", - "title": "Privacy Mode", - "icon": "fad fa-user-secret", - "value": false - }, - { - "id": "timestamp", - "title": "Show Timestamps", - "icon": "fad fa-stopwatch", - "value": true - } - ] -} \ No newline at end of file + "$schema": "https://schemas.premid.app/metadata/1.12", + "apiVersion": 1, + "author": { + "name": "AsyncSenpai", + "id": "93973697643155456" + }, + "service": "GeForce NOW", + "description": { + "en": "GeForce Now is the brand used by Nvidia for its cloud gaming service.", + "vi_VN": "GeForce Now là thương hiệu của Nvidia cho dịch vụ game trên đám mây của họ." + }, + "url": "play.geforcenow.com", + "version": "1.0.22", + "logo": "https://cdn.rcd.gg/PreMiD/websites/G/GeForce%20NOW/assets/logo.png", + "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/GeForce%20NOW/assets/thumbnail.png", + "color": "#76B918", + "category": "games", + "tags": [ + "gaming", + "streaming" + ], + "settings": [ + { + "id": "privacy", + "title": "Privacy Mode", + "icon": "fad fa-user-secret", + "value": false + }, + { + "id": "timestamp", + "title": "Show Timestamps", + "icon": "fad fa-stopwatch", + "value": true + } + ] +} diff --git a/websites/G/GeForce NOW/presence.ts b/websites/G/GeForce NOW/presence.ts index 7ca73e7072da..0a69458783e9 100644 --- a/websites/G/GeForce NOW/presence.ts +++ b/websites/G/GeForce NOW/presence.ts @@ -1,50 +1,57 @@ const presence = new Presence({ - clientId: "864631234339930132", - }), - browsingTimestamp = Math.floor(Date.now() / 1000); + clientId: '864631234339930132', +}) +const browsingTimestamp = Math.floor(Date.now() / 1000) -let username: HTMLElement; +let username: HTMLElement | null -presence.on("UpdateData", async () => { - const privacy: boolean = await presence.getSetting("privacy"), - showTimestamp: boolean = await presence.getSetting("timestamp"), - presenceData: PresenceData = { - largeImageKey: - "https://cdn.rcd.gg/PreMiD/websites/G/GeForce%20NOW/assets/logo.png", - smallImageKey: - "https://cdn.rcd.gg/PreMiD/websites/G/GeForce%20NOW/assets/0.png", - startTimestamp: browsingTimestamp, - }; +presence.on('UpdateData', async () => { + const privacy: boolean = await presence.getSetting('privacy') + const showTimestamp: boolean = await presence.getSetting('timestamp') + const presenceData: PresenceData = { + largeImageKey: 'https://cdn.rcd.gg/PreMiD/websites/G/GeForce%20NOW/assets/logo.png', + smallImageKey: 'https://cdn.rcd.gg/PreMiD/websites/G/GeForce%20NOW/assets/0.png', + startTimestamp: browsingTimestamp, + } - if (!showTimestamp) delete presenceData.startTimestamp; + if (!showTimestamp) + delete presenceData.startTimestamp - if (document.location.pathname === "/mall/") { - username = document.querySelector(".username"); - presenceData.details = "Browsing GeForce NOW"; - } else if ( - document.location.pathname === "/games" && - !document.querySelector("gfn-evidence-panel-tile") - ) { - presenceData.details = `Playing ${document.title.replace( - " on GeForce NOW", - "" - )}`; - } else if (document.location.pathname === "/games") { - presenceData.details = `Viewing ${ - ( - document.querySelector( - "gfn-evidence-panel-tile .evidence-panel-title span" - ) as HTMLElement - ).textContent - }`; - } else presenceData.details = "Unknown Page"; + if (document.location.pathname === '/mall/') { + username = document.querySelector('.username') + presenceData.details = 'Browsing GeForce NOW' + } + else if ( + document.location.pathname === '/games' + && !document.querySelector('gfn-evidence-panel-tile') + ) { + presenceData.details = `Playing ${document.title.replace( + ' on GeForce NOW', + '', + )}` + } + else if (document.location.pathname === '/games') { + presenceData.details = `Viewing ${ + ( + document.querySelector( + 'gfn-evidence-panel-tile .evidence-panel-title span', + ) as HTMLElement + ).textContent + }` + } + else { + presenceData.details = 'Unknown Page' + } - if (username && !privacy) presenceData.smallImageText = username.textContent; - else { - delete presenceData.smallImageText; - delete presenceData.smallImageKey; - } + if (username && !privacy) { + presenceData.smallImageText = username.textContent + } + else { + delete presenceData.smallImageText + delete presenceData.smallImageKey + } - if (presenceData.details) presence.setActivity(presenceData); - else presence.setActivity(); -}); + if (presenceData.details) + presence.setActivity(presenceData) + else presence.setActivity() +}) diff --git a/websites/G/Gemini/metadata.json b/websites/G/Gemini/metadata.json index 3eaf514e85f0..834e2797d175 100644 --- a/websites/G/Gemini/metadata.json +++ b/websites/G/Gemini/metadata.json @@ -1,39 +1,39 @@ { - "$schema": "https://schemas.premid.app/metadata/1.12", - "apiVersion": 1, - "author": { - "id": "1145729748803272815", - "name": "mallusrgreat" - }, - "contributors": [ - { - "name": "Kaktuswerk", - "id": "1167417152664522764" - } - ], - "service": "Gemini", - "description": { - "en": "Gemini gives you direct access to Google AI. Get help with writing, planning, learning, and more." - }, - "url": "gemini.google.com", - "version": "1.1.2", - "logo": "https://cdn.rcd.gg/PreMiD/websites/G/Gemini/assets/logo.png", - "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/Gemini/assets/thumbnail.png", - "color": "#5286d2", - "category": "other", - "tags": [ - "ai", - "gemini", - "llm", - "chatbot", - "model" - ], - "settings": [ - { - "id": "showTitle", - "title": "Show chat title", - "icon": "fa-solid fa-message-quote", - "value": true - } - ] -} \ No newline at end of file + "$schema": "https://schemas.premid.app/metadata/1.12", + "apiVersion": 1, + "author": { + "id": "1145729748803272815", + "name": "mallusrgreat" + }, + "contributors": [ + { + "name": "Kaktuswerk", + "id": "1167417152664522764" + } + ], + "service": "Gemini", + "description": { + "en": "Gemini gives you direct access to Google AI. Get help with writing, planning, learning, and more." + }, + "url": "gemini.google.com", + "version": "1.1.2", + "logo": "https://cdn.rcd.gg/PreMiD/websites/G/Gemini/assets/logo.png", + "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/Gemini/assets/thumbnail.png", + "color": "#5286d2", + "category": "other", + "tags": [ + "ai", + "gemini", + "llm", + "chatbot", + "model" + ], + "settings": [ + { + "id": "showTitle", + "title": "Show chat title", + "icon": "fa-solid fa-message-quote", + "value": true + } + ] +} diff --git a/websites/G/Gemini/presence.ts b/websites/G/Gemini/presence.ts index 80c42eb7698b..6a2c71d2d649 100644 --- a/websites/G/Gemini/presence.ts +++ b/websites/G/Gemini/presence.ts @@ -1,53 +1,55 @@ const presence = new Presence({ - clientId: "1209550314987061258", - }), - browsingTimestamp = Math.floor(Date.now() / 1000); + clientId: '1209550314987061258', +}) +const browsingTimestamp = Math.floor(Date.now() / 1000) const enum Assets { - Logo = "https://cdn.rcd.gg/PreMiD/websites/G/Gemini/assets/logo.png", + Logo = 'https://cdn.rcd.gg/PreMiD/websites/G/Gemini/assets/logo.png', } -presence.on("UpdateData", async () => { - const presenceData: PresenceData = { - largeImageKey: Assets.Logo, - startTimestamp: browsingTimestamp, - details: "Browsing website", - }, - { pathname } = document.location, - showTitle = await presence.getSetting("showTitle"); - switch (true) { - case pathname.startsWith("/app"): - // Check the selected conversation - if (showTitle) { - presenceData.details = - document.querySelector( - "div.conversation.selected>div.conversation-title" - ).textContent ?? "Thinking of a new Prompt..."; +presence.on('UpdateData', async () => { + const presenceData: PresenceData = { + largeImageKey: Assets.Logo, + startTimestamp: browsingTimestamp, + details: 'Browsing website', + } + const { pathname } = document.location + const showTitle = await presence.getSetting('showTitle') + switch (true) { + case pathname.startsWith('/app'): + // Check the selected conversation + if (showTitle) { + presenceData.details = document.querySelector( + 'div.conversation.selected>div.conversation-title', + )?.textContent ?? 'Thinking of a new Prompt...' - // Show word count - const elem = document.querySelectorAll( - "p.query-text-line,div.response-optimization.markdown" - ); - presenceData.state = `Asked ${ - elem[0].textContent.split(" ").length - } words | answered with ${ - elem[1].textContent.split(" ").length - } words.`; - } else presenceData.details = "Asking questions"; - break; - case pathname.startsWith("/extensions"): - presenceData.details = "Managing extensions"; - break; - case pathname.startsWith("/updates"): - presenceData.details = "Reading updates"; - break; - case pathname.startsWith("/faq"): - presenceData.details = "Reading FAQ"; - break; - case pathname.startsWith("/advanced"): - presenceData.details = "Reading about Gemini Advanced"; - break; - } + // Show word count + const elem = document.querySelectorAll( + 'p.query-text-line,div.response-optimization.markdown', + ) + presenceData.state = `Asked ${ + elem[0].textContent?.split(' ').length + } words | answered with ${ + elem[1].textContent?.split(' ').length + } words.` + } + else { + presenceData.details = 'Asking questions' + } + break + case pathname.startsWith('/extensions'): + presenceData.details = 'Managing extensions' + break + case pathname.startsWith('/updates'): + presenceData.details = 'Reading updates' + break + case pathname.startsWith('/faq'): + presenceData.details = 'Reading FAQ' + break + case pathname.startsWith('/advanced'): + presenceData.details = 'Reading about Gemini Advanced' + break + } - presence.setActivity(presenceData); -}); + presence.setActivity(presenceData) +}) diff --git a/websites/G/Genie Music/metadata.json b/websites/G/Genie Music/metadata.json index 32a1336b5f60..9827c9769771 100644 --- a/websites/G/Genie Music/metadata.json +++ b/websites/G/Genie Music/metadata.json @@ -1,26 +1,26 @@ { - "$schema": "https://schemas.premid.app/metadata/1.12", - "apiVersion": 1, - "author": { - "name": "건유1019", - "id": "340373909339635725" - }, - "service": "Genie Music", - "altnames": [ - "지니뮤직" - ], - "description": { - "ko_KR": "국내 최다 음원 보유, FLAC 고음질, 지니차트, 최신음악, 앨범, 뮤직비디오, 오늘의 선곡, TV속음악, 시대별음악, 지니라이프 등 제공.", - "en": "Korea's largest music source, FLAC high-quality, genie chart, latest music, album, music video, today's selection, music in TV, music by age, genie life, etc. are provided." - }, - "url": "www.genie.co.kr", - "version": "1.0.22", - "logo": "https://cdn.rcd.gg/PreMiD/websites/G/Genie%20Music/assets/logo.png", - "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/Genie%20Music/assets/thumbnail.png", - "color": "#0096FF", - "category": "music", - "tags": [ - "korean", - "audio" - ] -} \ No newline at end of file + "$schema": "https://schemas.premid.app/metadata/1.12", + "apiVersion": 1, + "author": { + "name": "건유1019", + "id": "340373909339635725" + }, + "service": "Genie Music", + "altnames": [ + "지니뮤직" + ], + "description": { + "ko_KR": "국내 최다 음원 보유, FLAC 고음질, 지니차트, 최신음악, 앨범, 뮤직비디오, 오늘의 선곡, TV속음악, 시대별음악, 지니라이프 등 제공.", + "en": "Korea's largest music source, FLAC high-quality, genie chart, latest music, album, music video, today's selection, music in TV, music by age, genie life, etc. are provided." + }, + "url": "www.genie.co.kr", + "version": "1.0.22", + "logo": "https://cdn.rcd.gg/PreMiD/websites/G/Genie%20Music/assets/logo.png", + "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/Genie%20Music/assets/thumbnail.png", + "color": "#0096FF", + "category": "music", + "tags": [ + "korean", + "audio" + ] +} diff --git a/websites/G/Genie Music/presence.ts b/websites/G/Genie Music/presence.ts index 6c28b83892a1..bf9539ae97b3 100644 --- a/websites/G/Genie Music/presence.ts +++ b/websites/G/Genie Music/presence.ts @@ -1,329 +1,345 @@ const presence = new Presence({ - clientId: "857504938443407360", -}); + clientId: '857504938443407360', +}) function getQuery() { - return JSON.parse( - `{"${decodeURI(decodeURIComponent(location.search.substring(1))) - .replaceAll('"', '\\"') - .replaceAll("&", '","') - .replaceAll("=", '":"')}"}` - ); + return JSON.parse( + `{"${decodeURI(decodeURIComponent(location.search.substring(1))) + .replaceAll('"', '\\"') + .replaceAll('&', '","') + .replaceAll('=', '":"')}"}`, + ) } function getGenre(code: string) { - const firstCode = code.substr(0, 1), - endCode = code.substr(1); - if (firstCode === "E") return "EDM"; - else if (firstCode === "L" && endCode === "0107") return "트롯"; - else if (endCode.startsWith("01")) return "가요"; - else if (endCode.startsWith("02") && endCode !== "0207" && endCode !== "0208") - return "POP"; - else if (endCode.startsWith("03")) return "OST"; - else if (endCode.startsWith("04")) return "JPOP"; - else if (endCode.startsWith("05")) return "JAZZ"; - else if (endCode.startsWith("06")) return "클래식"; - else if (endCode.startsWith("08")) return "CCM"; - else return "그 외 장르"; + const firstCode = code.substr(0, 1) + const endCode = code.substr(1) + if (firstCode === 'E') + return 'EDM' + else if (firstCode === 'L' && endCode === '0107') + return '트롯' + else if (endCode.startsWith('01')) + return '가요' + else if (endCode.startsWith('02') && endCode !== '0207' && endCode !== '0208') + return 'POP' + else if (endCode.startsWith('03')) + return 'OST' + else if (endCode.startsWith('04')) + return 'JPOP' + else if (endCode.startsWith('05')) + return 'JAZZ' + else if (endCode.startsWith('06')) + return '클래식' + else if (endCode.startsWith('08')) + return 'CCM' + else return '그 외 장르' } const enum Assets { - Logo = "https://cdn.rcd.gg/PreMiD/websites/G/Genie%20Music/assets/logo.png", - TV = "https://cdn.rcd.gg/PreMiD/websites/G/Genie%20Music/assets/0.png", - Mnet = "https://cdn.rcd.gg/PreMiD/websites/G/Genie%20Music/assets/1.png", - Chart = "https://cdn.rcd.gg/PreMiD/websites/G/Genie%20Music/assets/2.png", - Music = "https://cdn.rcd.gg/PreMiD/websites/G/Genie%20Music/assets/3.png", - Playlist = "https://cdn.rcd.gg/PreMiD/websites/G/Genie%20Music/assets/4.png", - Profile = "https://cdn.rcd.gg/PreMiD/websites/G/Genie%20Music/assets/5.png", + Logo = 'https://cdn.rcd.gg/PreMiD/websites/G/Genie%20Music/assets/logo.png', + TV = 'https://cdn.rcd.gg/PreMiD/websites/G/Genie%20Music/assets/0.png', + Mnet = 'https://cdn.rcd.gg/PreMiD/websites/G/Genie%20Music/assets/1.png', + Chart = 'https://cdn.rcd.gg/PreMiD/websites/G/Genie%20Music/assets/2.png', + Music = 'https://cdn.rcd.gg/PreMiD/websites/G/Genie%20Music/assets/3.png', + Playlist = 'https://cdn.rcd.gg/PreMiD/websites/G/Genie%20Music/assets/4.png', + Profile = 'https://cdn.rcd.gg/PreMiD/websites/G/Genie%20Music/assets/5.png', } -presence.on("UpdateData", async () => { - const presenceData: PresenceData = { - largeImageKey: Assets.Logo, - }, - { location } = document; - // If player - switch (location.pathname) { - case "/player/fPlayer": { - const playBar = document.querySelector("div.fp-ui"), - playButton = playBar.querySelector("a.fp-playbtn").textContent; - [presenceData.startTimestamp, presenceData.endTimestamp] = - presence.getTimestamps( - presence.timestampFromFormat( - playBar.querySelector("span.fp-elapsed").textContent - ), - presence.timestampFromFormat( - playBar.querySelector("span.fp-duration").textContent - ) - ); - presenceData.details = `${ - document.querySelector("strong#SongTitleArea").textContent - } - ${ - document - .querySelector("div.track-info") - .querySelector("span#ArtistNameArea").textContent - }`; - if (playButton === "재생") { - presenceData.smallImageKey = Assets.Pause; - presenceData.smallImageText = "일시 정지"; - } else if (playButton === "일시정지") { - presenceData.smallImageKey = Assets.Play; - presenceData.smallImageText = "재생"; - } +presence.on('UpdateData', async () => { + const presenceData: PresenceData = { + largeImageKey: Assets.Logo, + } + const { location } = document + // If player + switch (location.pathname) { + case '/player/fPlayer': { + const playBar = document.querySelector('div.fp-ui')! + const playButton = playBar.querySelector('a.fp-playbtn')?.textContent; + [presenceData.startTimestamp, presenceData.endTimestamp] = presence.getTimestamps( + presence.timestampFromFormat( + playBar.querySelector('span.fp-elapsed')!.textContent!, + ), + presence.timestampFromFormat( + playBar.querySelector('span.fp-duration')!.textContent!, + ), + ) + presenceData.details = `${ + document.querySelector('strong#SongTitleArea')?.textContent + } - ${ + document + .querySelector('div.track-info') + ?.querySelector('span#ArtistNameArea') + ?.textContent + }` + if (playButton === '재생') { + presenceData.smallImageKey = Assets.Pause + presenceData.smallImageText = '일시 정지' + } + else if (playButton === '일시정지') { + presenceData.smallImageKey = Assets.Play + presenceData.smallImageText = '재생' + } - break; - } - case "/detail/mediaInfo": { - const video: HTMLVideoElement = document - .querySelector("div.fp-player") - .querySelector("video.fp-engine"); + break + } + case '/detail/mediaInfo': { + const video = document + .querySelector('div.fp-player')! + .querySelector('video.fp-engine')!; - [presenceData.startTimestamp, presenceData.endTimestamp] = - presence.getTimestamps(video.currentTime, video.duration); - presenceData.details = `${ - document.querySelector("h2.videoTitle").textContent - }`; - if (video.paused) { - presenceData.smallImageKey = Assets.Pause; - presenceData.smallImageText = "일시 정지"; - } else if (video.ended) { - presenceData.smallImageKey = Assets.Stop; - presenceData.smallImageText = "정지"; - } else { - presenceData.smallImageKey = Assets.Play; - presenceData.smallImageText = "재생"; - } + [presenceData.startTimestamp, presenceData.endTimestamp] = presence.getTimestamps(video.currentTime, video.duration) + presenceData.details = `${ + document.querySelector('h2.videoTitle')?.textContent + }` + if (video.paused) { + presenceData.smallImageKey = Assets.Pause + presenceData.smallImageText = '일시 정지' + } + else if (video.ended) { + presenceData.smallImageKey = Assets.Stop + presenceData.smallImageText = '정지' + } + else { + presenceData.smallImageKey = Assets.Play + presenceData.smallImageText = '재생' + } - break; - } - case "/": { - presenceData.details = "메인"; - break; - } - default: - if (location.pathname.indexOf("/search") === 0) { - presenceData.smallImageKey = Assets.Search; - presenceData.details = "검색"; - presenceData.state = getQuery().query; - switch (location.pathname) { - case "/search/searchMain": { - presenceData.details += "(통합검색)"; - break; - } - case "/search/searchArtist": { - presenceData.details += "(아티스트)"; - break; - } - case "/search/searchSong": { - presenceData.details += "(곡)"; - break; - } - case "/search/searchAlbum": { - presenceData.details += "(앨범)"; - break; - } - case "/search/searchPlaylist": { - presenceData.details += "(플레이리스트)"; - break; - } - case "/search/searchMv": { - presenceData.details += "(동영상)"; - break; - } - case "/search/searchMagazine": { - presenceData.details += "(매거진)"; - break; - } - case "/search/searchLyrics": - { - presenceData.details += "(가사)"; - // No default - } - break; - } - } else if (location.pathname.startsWith("/chart")) { - presenceData.smallImageKey = Assets.Chart; - presenceData.details = "지니차트"; - switch (location.pathname) { - case "/chart/top200": { - presenceData.details += "(TOP 200)"; - break; - } - case "/chart/genre": { - presenceData.details += "(장르별 차트)"; - break; - } - case "/chart/musicHistory": { - presenceData.details += "(시대별 차트)"; - break; - } - case "/chart/musicVideo": - { - presenceData.details += "(뮤직 비디오)"; - // No default - } - break; - } - } else if (location.pathname.startsWith("/newest")) { - presenceData.smallImageKey = Assets.Music; - presenceData.details = "최신음악"; - if (location.pathname === "/newest/song") - presenceData.details += "(곡)"; - else if (location.pathname === "/newest/album") - presenceData.details += "(앨범)"; - } else if (location.pathname.startsWith("/genre")) { - presenceData.smallImageKey = Assets.Music; - presenceData.details = "장르음악"; - presenceData.details += `(${getGenre( - location.pathname.replace("/genre/", "") - )})`; - } else if (location.pathname.startsWith("/genietv")) { - presenceData.smallImageKey = Assets.TV; - presenceData.details = "지니TV"; - switch (location.pathname) { - case "/genietv/broadcast": { - presenceData.details += "(Mnet 방송)"; - presenceData.smallImageKey = Assets.Mnet; + break + } + case '/': { + presenceData.details = '메인' + break + } + default: + if (location.pathname.indexOf('/search') === 0) { + presenceData.smallImageKey = Assets.Search + presenceData.details = '검색' + presenceData.state = getQuery().query + switch (location.pathname) { + case '/search/searchMain': { + presenceData.details += '(통합검색)' + break + } + case '/search/searchArtist': { + presenceData.details += '(아티스트)' + break + } + case '/search/searchSong': { + presenceData.details += '(곡)' + break + } + case '/search/searchAlbum': { + presenceData.details += '(앨범)' + break + } + case '/search/searchPlaylist': { + presenceData.details += '(플레이리스트)' + break + } + case '/search/searchMv': { + presenceData.details += '(동영상)' + break + } + case '/search/searchMagazine': { + presenceData.details += '(매거진)' + break + } + case '/search/searchLyrics': { + presenceData.details += '(가사)' + break + } + } + } + else if (location.pathname.startsWith('/chart')) { + presenceData.smallImageKey = Assets.Chart + presenceData.details = '지니차트' + switch (location.pathname) { + case '/chart/top200': { + presenceData.details += '(TOP 200)' + break + } + case '/chart/genre': { + presenceData.details += '(장르별 차트)' + break + } + case '/chart/musicHistory': { + presenceData.details += '(시대별 차트)' + break + } + case '/chart/musicVideo': { + presenceData.details += '(뮤직 비디오)' + break + } + } + } + else if (location.pathname.startsWith('/newest')) { + presenceData.smallImageKey = Assets.Music + presenceData.details = '최신음악' + if (location.pathname === '/newest/song') + presenceData.details += '(곡)' + else if (location.pathname === '/newest/album') + presenceData.details += '(앨범)' + } + else if (location.pathname.startsWith('/genre')) { + presenceData.smallImageKey = Assets.Music + presenceData.details = '장르음악' + presenceData.details += `(${getGenre( + location.pathname.replace('/genre/', ''), + )})` + } + else if (location.pathname.startsWith('/genietv')) { + presenceData.smallImageKey = Assets.TV + presenceData.details = '지니TV' + switch (location.pathname) { + case '/genietv/broadcast': { + presenceData.details += '(Mnet 방송)' + presenceData.smallImageKey = Assets.Mnet - break; - } - case "/genietv/newMV": { - presenceData.details += "(뮤직비디오)"; - break; - } - case "/genietv/musicianSpecial": { - presenceData.details += "(뮤지션)"; - break; - } - default: - if (location.pathname.startsWith("/genietv/noveltyMovie")) - presenceData.details += "(이색영상)"; - } - } else if (location.pathname.startsWith("/playlist")) { - presenceData.smallImageKey = Assets.Playlist; - presenceData.details = "추천"; - switch (location.pathname) { - case "/playlist/popular": { - presenceData.details += "(인기)"; - break; - } - case "/playlist/tags": { - presenceData.details += "(태그)"; - break; - } - case "/playlist/history": - { - presenceData.details += "(히스토리)"; - // No default - } - break; - } - } else if (location.pathname.startsWith("/magazine")) { - presenceData.smallImageKey = Assets.Playlist; - presenceData.details = "매거진"; - } else if (location.pathname.startsWith("/edm")) { - presenceData.smallImageKey = Assets.Music; - presenceData.details = "EDM"; - if (location.pathname === "/edm/album") - presenceData.details += "(최신)"; - else if (location.pathname === "/edm/chart") - presenceData.details += "(차트)"; - } else if (location.pathname.startsWith("/buy")) - presenceData.details = "이용권 구매"; - else if (location.pathname.startsWith("/event")) - presenceData.details = "이벤트"; - else if (location.pathname.startsWith("/guide")) - presenceData.details = "이용 안내"; - else if (location.pathname.startsWith("/member/product")) - presenceData.details = "이용권 내역"; - else if (location.pathname.startsWith("/support/service")) { - presenceData.details = "고객센터"; - switch (location.pathname) { - case "/support/service/helpList": { - presenceData.details += "(도움말)"; - break; - } - case "/support/service/notice": { - presenceData.details += "(공지사항)"; - break; - } - case "/support/service/pds": { - presenceData.details += "(자료실)"; - break; - } - case "/support/service/errorRegist": { - presenceData.details += "(음원 관련 문의)"; - break; - } - case "/support/service/contact": { - presenceData.details += "(서비스 문의)"; - break; - } - case "/support/service/myContactList": - { - presenceData.details += "(문의 내역)"; - // No default - } - break; - } - } else if (location.pathname.startsWith("/myMusic")) { - presenceData.smallImageKey = Assets.Profile; - presenceData.details = "마이 뮤직"; - if (location.pathname.startsWith("/myMusic/profile")) - presenceData.details += "(프로필)"; - else if ( - location.pathname.startsWith("/myMusic/purchase") || - location.pathname === "/myMusic/oneClickDownload" - ) - presenceData.details += "(보관함)"; - else if ( - location.pathname.startsWith("/myMusic/gift") || - location.pathname === "/myMusic/coupleList" - ) - presenceData.details += "(선물함)"; - else if (location.pathname === "/myMusic/shareList") - presenceData.details += "(음악 나누기)"; - else if (location.pathname.startsWith("/myMusic/like")) - presenceData.details += "(좋아요)"; - else { - switch (location.pathname) { - case "/myMusic/myStreamVideoList": { - presenceData.details += "(최근 감상 영상)"; - break; - } - case "/myMusic/myMusicPlayList": { - presenceData.details += "(플레이리스트)"; - break; - } - case "/myMusic/syncPlaylist": { - presenceData.details += "(동기화 재생목록)"; - break; - } - case "/myMusic/myPlaylist": { - const { category } = getQuery(); - switch (category) { - case "A": { - presenceData.details += "(많이 들은 아티스트)"; - break; - } - case "M": { - presenceData.details += "(많이 들은 곡)"; - break; - } - case "R": - { - presenceData.details += "(최근 감상 곡)"; - // No default - } - break; - } - - break; - } - // No default - } - } - } - } - presence.setActivity(presenceData); -}); + break + } + case '/genietv/newMV': { + presenceData.details += '(뮤직비디오)' + break + } + case '/genietv/musicianSpecial': { + presenceData.details += '(뮤지션)' + break + } + default: + if (location.pathname.startsWith('/genietv/noveltyMovie')) + presenceData.details += '(이색영상)' + } + } + else if (location.pathname.startsWith('/playlist')) { + presenceData.smallImageKey = Assets.Playlist + presenceData.details = '추천' + switch (location.pathname) { + case '/playlist/popular': { + presenceData.details += '(인기)' + break + } + case '/playlist/tags': { + presenceData.details += '(태그)' + break + } + case '/playlist/history': { + presenceData.details += '(히스토리)' + break + } + } + } + else if (location.pathname.startsWith('/magazine')) { + presenceData.smallImageKey = Assets.Playlist + presenceData.details = '매거진' + } + else if (location.pathname.startsWith('/edm')) { + presenceData.smallImageKey = Assets.Music + presenceData.details = 'EDM' + if (location.pathname === '/edm/album') + presenceData.details += '(최신)' + else if (location.pathname === '/edm/chart') + presenceData.details += '(차트)' + } + else if (location.pathname.startsWith('/buy')) { + presenceData.details = '이용권 구매' + } + else if (location.pathname.startsWith('/event')) { + presenceData.details = '이벤트' + } + else if (location.pathname.startsWith('/guide')) { + presenceData.details = '이용 안내' + } + else if (location.pathname.startsWith('/member/product')) { + presenceData.details = '이용권 내역' + } + else if (location.pathname.startsWith('/support/service')) { + presenceData.details = '고객센터' + switch (location.pathname) { + case '/support/service/helpList': { + presenceData.details += '(도움말)' + break + } + case '/support/service/notice': { + presenceData.details += '(공지사항)' + break + } + case '/support/service/pds': { + presenceData.details += '(자료실)' + break + } + case '/support/service/errorRegist': { + presenceData.details += '(음원 관련 문의)' + break + } + case '/support/service/contact': { + presenceData.details += '(서비스 문의)' + break + } + case '/support/service/myContactList': { + presenceData.details += '(문의 내역)' + break + } + } + } + else if (location.pathname.startsWith('/myMusic')) { + presenceData.smallImageKey = Assets.Profile + presenceData.details = '마이 뮤직' + if (location.pathname.startsWith('/myMusic/profile')) { + presenceData.details += '(프로필)' + } + else if ( + location.pathname.startsWith('/myMusic/purchase') + || location.pathname === '/myMusic/oneClickDownload' + ) { + presenceData.details += '(보관함)' + } + else if ( + location.pathname.startsWith('/myMusic/gift') + || location.pathname === '/myMusic/coupleList' + ) { + presenceData.details += '(선물함)' + } + else if (location.pathname === '/myMusic/shareList') { + presenceData.details += '(음악 나누기)' + } + else if (location.pathname.startsWith('/myMusic/like')) { + presenceData.details += '(좋아요)' + } + else { + switch (location.pathname) { + case '/myMusic/myStreamVideoList': { + presenceData.details += '(최근 감상 영상)' + break + } + case '/myMusic/myMusicPlayList': { + presenceData.details += '(플레이리스트)' + break + } + case '/myMusic/syncPlaylist': { + presenceData.details += '(동기화 재생목록)' + break + } + case '/myMusic/myPlaylist': { + const { category } = getQuery() + switch (category) { + case 'A': { + presenceData.details += '(많이 들은 아티스트)' + break + } + case 'M': { + presenceData.details += '(많이 들은 곡)' + break + } + case 'R': { + presenceData.details += '(최근 감상 곡)' + break + } + } + break + } + } + } + } + } + presence.setActivity(presenceData) +}) diff --git a/websites/G/Genius/metadata.json b/websites/G/Genius/metadata.json index 1cbbf01f5064..2318745f32c4 100644 --- a/websites/G/Genius/metadata.json +++ b/websites/G/Genius/metadata.json @@ -1,37 +1,37 @@ { - "$schema": "https://schemas.premid.app/metadata/1.12", - "apiVersion": 1, - "author": { - "name": "Bas950", - "id": "241278257335500811" - }, - "service": "Genius", - "description": { - "en": "Genius is the world’s biggest collection of song lyrics and musical knowledge.", - "nl": "Genius is 's werelds grootste verzameling van songteksten en muzikale kennis.", - "vi_VN": "Genius là bộ sưu tập lời bài hát và kiến thức âm nhạc lớn nhất thế giới." - }, - "url": "genius.com", - "version": "2.0.29", - "logo": "https://cdn.rcd.gg/PreMiD/websites/G/Genius/assets/logo.png", - "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/Genius/assets/thumbnail.png", - "color": "#FFFF64", - "category": "music", - "tags": [ - "genius", - "lyrics", - "music" - ], - "settings": [ - { - "id": "lang", - "multiLanguage": true - }, - { - "id": "buttons", - "title": "Show Buttons", - "icon": "fas fa-compress-arrows-alt", - "value": true - } - ] -} \ No newline at end of file + "$schema": "https://schemas.premid.app/metadata/1.12", + "apiVersion": 1, + "author": { + "name": "Bas950", + "id": "241278257335500811" + }, + "service": "Genius", + "description": { + "en": "Genius is the world’s biggest collection of song lyrics and musical knowledge.", + "nl": "Genius is 's werelds grootste verzameling van songteksten en muzikale kennis.", + "vi_VN": "Genius là bộ sưu tập lời bài hát và kiến thức âm nhạc lớn nhất thế giới." + }, + "url": "genius.com", + "version": "2.0.29", + "logo": "https://cdn.rcd.gg/PreMiD/websites/G/Genius/assets/logo.png", + "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/Genius/assets/thumbnail.png", + "color": "#FFFF64", + "category": "music", + "tags": [ + "genius", + "lyrics", + "music" + ], + "settings": [ + { + "id": "lang", + "multiLanguage": true + }, + { + "id": "buttons", + "title": "Show Buttons", + "icon": "fas fa-compress-arrows-alt", + "value": true + } + ] +} diff --git a/websites/G/Genius/presence.ts b/websites/G/Genius/presence.ts index f323b8794f1c..d6401243e4c6 100644 --- a/websites/G/Genius/presence.ts +++ b/websites/G/Genius/presence.ts @@ -1,132 +1,145 @@ const presence = new Presence({ - clientId: "809133308604055622", - }), - browsingTimestamp = Math.floor(Date.now() / 1000); + clientId: '809133308604055622', +}) +const browsingTimestamp = Math.floor(Date.now() / 1000) async function getStrings() { - return presence.getStrings( - { - play: "general.playing", - pause: "general.paused", - watch: "general.watching", - search: "general.searchFor", - searching: "general.search", - profile: "general.viewProfile", - article: "general.readingArticle", - reading: "general.reading", - lyrics: "genius.lyrics", - viewLyrics: "genius.viewLyrics", - home: "genius.viewHome", - viewAlbum: "genius.viewAlbum", - buttonAlbum: "general.buttonViewAlbum", - }, - await presence.getSetting("lang").catch(() => "en") - ); + return presence.getStrings( + { + play: 'general.playing', + pause: 'general.paused', + watch: 'general.watching', + search: 'general.searchFor', + searching: 'general.search', + profile: 'general.viewProfile', + article: 'general.readingArticle', + reading: 'general.reading', + lyrics: 'genius.lyrics', + viewLyrics: 'genius.viewLyrics', + home: 'genius.viewHome', + viewAlbum: 'genius.viewAlbum', + buttonAlbum: 'general.buttonViewAlbum', + }, + await presence.getSetting('lang').catch(() => 'en'), + ) } -let strings: Awaited>, - oldLang: string = null; +let strings: Awaited> +let oldLang: string | null = null -presence.on("UpdateData", async () => { - const newLang = await presence.getSetting("lang").catch(() => "en"), - buttons = await presence.getSetting("buttons"); +presence.on('UpdateData', async () => { + const newLang = await presence.getSetting('lang').catch(() => 'en') + const buttons = await presence.getSetting('buttons') - if (oldLang !== newLang || !strings) { - oldLang = newLang; - strings = await getStrings(); - } + if (oldLang !== newLang || !strings) { + oldLang = newLang + strings = await getStrings() + } - const presenceData: PresenceData = { - largeImageKey: - "https://cdn.rcd.gg/PreMiD/websites/G/Genius/assets/logo.png", - startTimestamp: browsingTimestamp, - }, - path = document.location.pathname; + const presenceData: PresenceData = { + largeImageKey: 'https://cdn.rcd.gg/PreMiD/websites/G/Genius/assets/logo.png', + startTimestamp: browsingTimestamp, + } + const path = document.location.pathname - if (path === "/") presenceData.details = strings.home; - else if (path.startsWith("/a/")) { - let article = document.querySelector("h1.article_title").textContent; - if (article.length > 128) article = `${article.substring(0, 125)}...`; + if (path === '/') { + presenceData.details = strings.home + } + else if (path.startsWith('/a/')) { + let article = document.querySelector('h1.article_title')?.textContent + if (article && article.length > 128) + article = `${article.substring(0, 125)}...` - presenceData.details = strings.article; - presenceData.state = article; - presenceData.smallImageKey = Assets.Reading; - presenceData.smallImageText = strings.reading; - } else if (path.startsWith("/artists/")) { - presenceData.details = strings.profile; - [presenceData.state] = document - .querySelector("h1.profile_identity-name_iq_and_role_icon") - .textContent.split("<"); - } else if (path.startsWith("/albums/")) { - presenceData.details = strings.viewAlbum; - presenceData.state = document.querySelector( - "h1.header_with_cover_art-primary_info-title" - ).textContent; - if (buttons) { - presenceData.buttons = [ - { - label: strings.buttonAlbum, - url: document.URL, - }, - ]; - } - } else if ( - document.querySelector("div[class*='SongPageGrid']") !== null || - document.querySelector(".song_body-lyrics") !== null - ) { - const artist = await presence.getPageVariable("_sf_async_config.authors"); - presenceData.details = strings.lyrics; - presenceData.state = `${artist["_sf_async_config.authors"]} - ${ - document - .querySelector('h1[class*="SongHeader-desktop"]') - ?.textContent.trim() || - document - .querySelector('h1[class*="SongHeader-mobile"]') - ?.textContent.trim() - }`; - if (buttons) { - presenceData.buttons = [ - { - label: strings.viewLyrics, - url: document.URL, - }, - ]; - } - } else if ( - document.querySelector(".profile_identity-name_iq_and_role_icon") !== null - ) { - presenceData.details = strings.profile; - [presenceData.state] = document - .querySelector("h1.profile_identity-name_iq_and_role_icon") - .textContent.split("<"); - } else if (path.startsWith("/videos/")) { - const video: HTMLVideoElement = document.querySelector("video.vjs-tech"); - let title = document.querySelector("h1.article_title").textContent; - if (title.length > 128) title = `${title.substring(0, 125)}...`; + presenceData.details = strings.article + presenceData.state = article + presenceData.smallImageKey = Assets.Reading + presenceData.smallImageText = strings.reading + } + else if (path.startsWith('/artists/')) { + presenceData.details = strings.profile; + [presenceData.state] = document + .querySelector('h1.profile_identity-name_iq_and_role_icon') + ?.textContent + ?.split('<') ?? [] + } + else if (path.startsWith('/albums/')) { + presenceData.details = strings.viewAlbum + presenceData.state = document.querySelector( + 'h1.header_with_cover_art-primary_info-title', + )?.textContent + if (buttons) { + presenceData.buttons = [ + { + label: strings.buttonAlbum, + url: document.URL, + }, + ] + } + } + else if ( + document.querySelector('div[class*=\'SongPageGrid\']') !== null + || document.querySelector('.song_body-lyrics') !== null + ) { + const artist = await presence.getPageVariable('_sf_async_config.authors') + presenceData.details = strings.lyrics + presenceData.state = `${artist['_sf_async_config.authors']} - ${ + document + .querySelector('h1[class*="SongHeader-desktop"]') + ?.textContent + ?.trim() + || document + .querySelector('h1[class*="SongHeader-mobile"]') + ?.textContent + ?.trim() + }` + if (buttons) { + presenceData.buttons = [ + { + label: strings.viewLyrics, + url: document.URL, + }, + ] + } + } + else if ( + document.querySelector('.profile_identity-name_iq_and_role_icon') !== null + ) { + presenceData.details = strings.profile; + [presenceData.state] = document + .querySelector('h1.profile_identity-name_iq_and_role_icon') + ?.textContent + ?.split('<') ?? [] + } + else if (path.startsWith('/videos/')) { + const video = document.querySelector('video.vjs-tech') + let title = document.querySelector('h1.article_title')?.textContent + if (title && title.length > 128) + title = `${title.substring(0, 125)}...` - presenceData.details = strings.watch; - presenceData.state = title; - if (video && !isNaN(video.duration)) { - [presenceData.startTimestamp, presenceData.endTimestamp] = - presence.getTimestampsfromMedia(video); + presenceData.details = strings.watch + presenceData.state = title + if (video && !Number.isNaN(video.duration)) { + [presenceData.startTimestamp, presenceData.endTimestamp] = presence.getTimestampsfromMedia(video) - presenceData.smallImageKey = video.paused ? Assets.Pause : Assets.Play; - presenceData.smallImageText = video.paused ? strings.pause : strings.play; + presenceData.smallImageKey = video.paused ? Assets.Pause : Assets.Play + presenceData.smallImageText = video.paused ? strings.pause : strings.play - if (video.paused) { - delete presenceData.startTimestamp; - delete presenceData.endTimestamp; - } - } - } else if (path.startsWith("/search")) { - presenceData.details = strings.search; - presenceData.state = document.querySelector( - "h2.search_results_page-header" - ).textContent; - presenceData.smallImageKey = Assets.Search; - presenceData.smallImageText = strings.searching; - } + if (video.paused) { + delete presenceData.startTimestamp + delete presenceData.endTimestamp + } + } + } + else if (path.startsWith('/search')) { + presenceData.details = strings.search + presenceData.state = document.querySelector( + 'h2.search_results_page-header', + )?.textContent + presenceData.smallImageKey = Assets.Search + presenceData.smallImageText = strings.searching + } - if (presenceData.details) presence.setActivity(presenceData); - else presence.setActivity(); -}); + if (presenceData.details) + presence.setActivity(presenceData) + else presence.setActivity() +}) diff --git a/websites/G/Genoanime/iframe.ts b/websites/G/Genoanime/iframe.ts index 3cde1c5c298e..4852a423b4c8 100644 --- a/websites/G/Genoanime/iframe.ts +++ b/websites/G/Genoanime/iframe.ts @@ -1,17 +1,17 @@ -const iframe = new iFrame(); +const iframe = new iFrame() -iframe.on("UpdateData", async () => { - if (document.querySelector("video")) { - const video = document.querySelector("video"); - if (video && !isNaN(video.duration)) { - iframe.send({ - iFrameVideo: { - iFrameVideo: true, - currTime: video.currentTime, - duration: video.duration, - paused: video.paused, - }, - }); - } - } -}); +iframe.on('UpdateData', async () => { + if (document.querySelector('video')) { + const video = document.querySelector('video') + if (video && !Number.isNaN(video.duration)) { + iframe.send({ + iFrameVideo: { + iFrameVideo: true, + currTime: video.currentTime, + duration: video.duration, + paused: video.paused, + }, + }) + } + } +}) diff --git a/websites/G/Genoanime/metadata.json b/websites/G/Genoanime/metadata.json index 530bc32eb631..007f64c72a4f 100644 --- a/websites/G/Genoanime/metadata.json +++ b/websites/G/Genoanime/metadata.json @@ -1,27 +1,27 @@ { - "$schema": "https://schemas.premid.app/metadata/1.12", - "apiVersion": 1, - "author": { - "name": "DayAndNight", - "id": "424072110647017482" - }, - "service": "Genoanime", - "description": { - "en": "Enjoy the our website, view any anime episodes and movies", - "nl": "Geniet van onze website, bekijk alle anime afleveringen en films" - }, - "url": "genoanime.com", - "version": "1.0.26", - "logo": "https://cdn.rcd.gg/PreMiD/websites/G/Genoanime/assets/logo.png", - "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/Genoanime/assets/thumbnail.png", - "color": "#42b5f7", - "category": "anime", - "tags": [ - "anime", - "entertainment", - "amv", - "videos" - ], - "iframe": true, - "iFrameRegExp": ".*" -} \ No newline at end of file + "$schema": "https://schemas.premid.app/metadata/1.12", + "apiVersion": 1, + "author": { + "name": "DayAndNight", + "id": "424072110647017482" + }, + "service": "Genoanime", + "description": { + "en": "Enjoy the our website, view any anime episodes and movies", + "nl": "Geniet van onze website, bekijk alle anime afleveringen en films" + }, + "url": "genoanime.com", + "version": "1.0.26", + "logo": "https://cdn.rcd.gg/PreMiD/websites/G/Genoanime/assets/logo.png", + "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/Genoanime/assets/thumbnail.png", + "color": "#42b5f7", + "category": "anime", + "tags": [ + "anime", + "entertainment", + "amv", + "videos" + ], + "iframe": true, + "iFrameRegExp": ".*" +} diff --git a/websites/G/Genoanime/presence.ts b/websites/G/Genoanime/presence.ts index efa42fd370e1..dbdbc3396113 100644 --- a/websites/G/Genoanime/presence.ts +++ b/websites/G/Genoanime/presence.ts @@ -1,139 +1,146 @@ const presence = new Presence({ - clientId: "810203651317432351", - }), - strings = presence.getStrings({ - play: "general.playing", - pause: "general.paused", - }), - browsingTimestamp = Math.floor(Date.now() / 1000); + clientId: '810203651317432351', +}) +const strings = presence.getStrings({ + play: 'general.playing', + pause: 'general.paused', +}) +const browsingTimestamp = Math.floor(Date.now() / 1000) -let video: HTMLVideoElement, - currentTime: number, - duration: number, - paused: boolean, - iFrameVideo: boolean, - playback: boolean, - animeBreadcumb: string; +let currentTime: number, + duration: number, + paused: boolean, + iFrameVideo: boolean, + playback: boolean, + animeBreadcumb: string | undefined presence.on( - "iFrameData", - (data: { - iFrameVideo: { - duration: number; - iFrameVideo: boolean; - currTime: number; - paused: boolean; - }; - }) => { - playback = data.iFrameVideo.duration !== null ? true : false; - if (playback) { - ({ iFrameVideo, duration, paused } = data.iFrameVideo); - currentTime = data.iFrameVideo.currTime; - } - } -); + 'iFrameData', + (inc: unknown) => { + const data = inc as { + iFrameVideo: { + duration: number + iFrameVideo: boolean + currTime: number + paused: boolean + } + } + playback = data.iFrameVideo.duration !== null + if (playback) { + ({ iFrameVideo, duration, paused } = data.iFrameVideo) + currentTime = data.iFrameVideo.currTime + } + }, +) -presence.on("UpdateData", async () => { - const presenceData: PresenceData = { - largeImageKey: - "https://cdn.rcd.gg/PreMiD/websites/G/Genoanime/assets/logo.png", - startTimestamp: browsingTimestamp, - }; //title of the page - if (document.location.pathname === "/") - presenceData.details = "Exploring Genoanime"; - else if (document.location.pathname.includes("/browse")) { - presenceData.details = "Exploring Genoanime library"; - presenceData.buttons = [ - { - label: "View Library", - url: document.location.href, - }, - ]; - } else if (document.location.pathname.includes("/details")) { - presenceData.details = "Checking Synopsis"; - presenceData.state = document.querySelector( - ".anime__details__title h3" - ).textContent; - animeBreadcumb = document.querySelector( - "#container > section > div > div.anime__details__content > div > div.col-lg-9 > div > div.anime__details__btn > a.watch-btn" - ).href; - presenceData.buttons = [ - { - label: "Watch It", - url: animeBreadcumb, - }, - { - label: "Check Synopsis", - url: document.location.href, - }, - ]; - } else if (document.location.pathname.includes("/watch")) { - presenceData.details = document.title.slice(0, -13); - presenceData.state = `Episode ${ - document.location.href.split("episode=")[1] - }`; - animeBreadcumb = document.querySelector( - "#anime_details_breadcrumbs" - ).href; - presenceData.buttons = [ - { - label: "Watch Episode", - url: document.location.href, - }, - { - label: "Check Synopsis", - url: animeBreadcumb, - }, - ]; - if (iFrameVideo) { - [presenceData.startTimestamp, presenceData.endTimestamp] = - presence.getTimestamps(Math.floor(currentTime), Math.floor(duration)); - } else { - video = document.querySelector("div > div.plyr__video-wrapper > video"); - if (video) { - ({ currentTime, duration, paused } = video), - ([presenceData.startTimestamp, presenceData.endTimestamp] = - presence.getTimestamps( - Math.floor(currentTime), - Math.floor(duration) - )); - } - } +presence.on('UpdateData', async () => { + const presenceData: PresenceData = { + largeImageKey: 'https://cdn.rcd.gg/PreMiD/websites/G/Genoanime/assets/logo.png', + startTimestamp: browsingTimestamp, + } // title of the page + if (document.location.pathname === '/') { + presenceData.details = 'Exploring Genoanime' + } + else if (document.location.pathname.includes('/browse')) { + presenceData.details = 'Exploring Genoanime library' + presenceData.buttons = [ + { + label: 'View Library', + url: document.location.href, + }, + ] + } + else if (document.location.pathname.includes('/details')) { + presenceData.details = 'Checking Synopsis' + presenceData.state = document.querySelector( + '.anime__details__title h3', + )?.textContent + animeBreadcumb = document.querySelector( + '#container > section > div > div.anime__details__content > div > div.col-lg-9 > div > div.anime__details__btn > a.watch-btn', + )?.href + presenceData.buttons = [ + { + label: 'Watch It', + url: animeBreadcumb ?? '', + }, + { + label: 'Check Synopsis', + url: document.location.href, + }, + ] + } + else if (document.location.pathname.includes('/watch')) { + presenceData.details = document.title.slice(0, -13) + presenceData.state = `Episode ${ + document.location.href.split('episode=')[1] + }` + animeBreadcumb = document.querySelector( + '#anime_details_breadcrumbs', + )?.href + presenceData.buttons = [ + { + label: 'Watch Episode', + url: document.location.href, + }, + { + label: 'Check Synopsis', + url: animeBreadcumb ?? '', + }, + ] + if (iFrameVideo) { + [presenceData.startTimestamp, presenceData.endTimestamp] = presence.getTimestamps(Math.floor(currentTime), Math.floor(duration)) + } + else { + const video = document.querySelector('div > div.plyr__video-wrapper > video') + if (video) { + ({ currentTime, duration, paused } = video); + [presenceData.startTimestamp, presenceData.endTimestamp] = presence.getTimestamps( + Math.floor(currentTime), + Math.floor(duration), + ) + } + } - if (!isNaN(duration)) { - presenceData.smallImageKey = paused ? Assets.Pause : Assets.Play; - presenceData.smallImageText = paused - ? (await strings).pause - : (await strings).play; - if (paused) delete presenceData.endTimestamp; - } - } else if (document.location.pathname.includes("/search")) { - presenceData.details = "Searching For..."; - presenceData.state = ( - document.querySelector("#search-anime") as HTMLInputElement - ).value; - } else if (document.location.pathname.includes("/amv")) { - presenceData.details = "Watching AMV videos"; - presenceData.buttons = [ - { - label: "Watch Video", - url: document.location.href, - }, - ]; - } else if (document.location.pathname.includes("/favorite")) - presenceData.details = "Browsing Favourites"; - else if (document.location.pathname.includes("/schedule")) { - presenceData.details = "Checking Schedule"; - presenceData.state = document.querySelector( - "#container > section > div > div:nth-child(1) > div > h3" - ).textContent; - presenceData.buttons = [ - { - label: "View Schedule", - url: document.location.href, - }, - ]; - } - if (presenceData.details) presence.setActivity(presenceData); - else presence.setActivity(); -}); + if (!Number.isNaN(duration)) { + presenceData.smallImageKey = paused ? Assets.Pause : Assets.Play + presenceData.smallImageText = paused + ? (await strings).pause + : (await strings).play + if (paused) + delete presenceData.endTimestamp + } + } + else if (document.location.pathname.includes('/search')) { + presenceData.details = 'Searching For...' + presenceData.state = ( + document.querySelector('#search-anime') as HTMLInputElement + ).value + } + else if (document.location.pathname.includes('/amv')) { + presenceData.details = 'Watching AMV videos' + presenceData.buttons = [ + { + label: 'Watch Video', + url: document.location.href, + }, + ] + } + else if (document.location.pathname.includes('/favorite')) { + presenceData.details = 'Browsing Favourites' + } + else if (document.location.pathname.includes('/schedule')) { + presenceData.details = 'Checking Schedule' + presenceData.state = document.querySelector( + '#container > section > div > div:nth-child(1) > div > h3', + )?.textContent + presenceData.buttons = [ + { + label: 'View Schedule', + url: document.location.href, + }, + ] + } + if (presenceData.details) + presence.setActivity(presenceData) + else presence.setActivity() +}) diff --git a/websites/G/Genshin Impact Map/metadata.json b/websites/G/Genshin Impact Map/metadata.json index 4a6c6fc6a039..e63596419714 100644 --- a/websites/G/Genshin Impact Map/metadata.json +++ b/websites/G/Genshin Impact Map/metadata.json @@ -1,51 +1,51 @@ { - "$schema": "https://schemas.premid.app/metadata/1.12", - "apiVersion": 1, - "author": { - "name": "Faelayis", - "id": "328731868096888833" - }, - "service": "Genshin Impact Map", - "description": { - "en": "Genshin Impact Interactive Map of all locations locations descriptions guides and more." - }, - "url": [ - "act.hoyolab.com", - "webstatic-sea.mihoyo.com", - "webstatic-sea.hoyolab.com", - "genshin-impact-map.appsample.com", - "mapgenie.io" - ], - "version": "1.3.12", - "logo": "https://cdn.rcd.gg/PreMiD/websites/G/Genshin%20Impact%20Map/assets/logo.png", - "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/Genshin%20Impact%20Map/assets/thumbnail.png", - "color": "#b6c48c", - "category": "games", - "tags": [ - "genshin-impact", - "map" - ], - "settings": [ - { - "id": "timestamps", - "title": "Show Timestamps", - "icon": "fad fa-stopwatch", - "value": true - }, - { - "id": "showPreview", - "title": "Show Preview", - "icon": "fad fa-globe", - "value": true - }, - { - "id": "randomPreview", - "if": { - "showPreview": true - }, - "title": "Random Preview", - "icon": "fad fa-random", - "value": true - } - ] -} \ No newline at end of file + "$schema": "https://schemas.premid.app/metadata/1.12", + "apiVersion": 1, + "author": { + "name": "Faelayis", + "id": "328731868096888833" + }, + "service": "Genshin Impact Map", + "description": { + "en": "Genshin Impact Interactive Map of all locations locations descriptions guides and more." + }, + "url": [ + "act.hoyolab.com", + "webstatic-sea.mihoyo.com", + "webstatic-sea.hoyolab.com", + "genshin-impact-map.appsample.com", + "mapgenie.io" + ], + "version": "1.3.12", + "logo": "https://cdn.rcd.gg/PreMiD/websites/G/Genshin%20Impact%20Map/assets/logo.png", + "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/Genshin%20Impact%20Map/assets/thumbnail.png", + "color": "#b6c48c", + "category": "games", + "tags": [ + "genshin-impact", + "map" + ], + "settings": [ + { + "id": "timestamps", + "title": "Show Timestamps", + "icon": "fad fa-stopwatch", + "value": true + }, + { + "id": "showPreview", + "title": "Show Preview", + "icon": "fad fa-globe", + "value": true + }, + { + "id": "randomPreview", + "if": { + "showPreview": true + }, + "title": "Random Preview", + "icon": "fad fa-random", + "value": true + } + ] +} diff --git a/websites/G/Genshin Impact Map/presence.ts b/websites/G/Genshin Impact Map/presence.ts index dedf04304488..0bf3217e5078 100644 --- a/websites/G/Genshin Impact Map/presence.ts +++ b/websites/G/Genshin Impact Map/presence.ts @@ -1,243 +1,247 @@ const presence = new Presence({ - clientId: "973729201104511007", - }), - browsingTimestamp = Math.floor(Date.now() / 1000); + clientId: '973729201104511007', +}) +const browsingTimestamp = Math.floor(Date.now() / 1000) const enum Assets { - EmblemMondstadt = "https://cdn.rcd.gg/PreMiD/websites/G/Genshin%20Impact%20Map/assets/1.png", - EmblemLiyue = "https://cdn.rcd.gg/PreMiD/websites/G/Genshin%20Impact%20Map/assets/2.png", - EmblemInazuma = "https://cdn.rcd.gg/PreMiD/websites/G/Genshin%20Impact%20Map/assets/3.png", - EmblemUnknown = "https://cdn.rcd.gg/PreMiD/websites/G/Genshin%20Impact%20Map/assets/4.png", - EnkanomiyaMap = "https://cdn.rcd.gg/PreMiD/websites/G/Genshin%20Impact%20Map/assets/5.png", - TeyvatMap = "https://cdn.rcd.gg/PreMiD/websites/G/Genshin%20Impact%20Map/assets/6.png", - TheChasmUndergroundMinesMap = "https://cdn.rcd.gg/PreMiD/websites/G/Genshin%20Impact%20Map/assets/7.png", - EmblemEnkanomiya = "https://cdn.rcd.gg/PreMiD/websites/G/Genshin%20Impact%20Map/assets/8.png", - EmblemThechasm = "https://cdn.rcd.gg/PreMiD/websites/G/Genshin%20Impact%20Map/assets/9.png", - PreviewMondstadt = "https://cdn.rcd.gg/PreMiD/websites/G/Genshin%20Impact%20Map/assets/10.png", - PreviewLiyue = "https://cdn.rcd.gg/PreMiD/websites/G/Genshin%20Impact%20Map/assets/11.png", - PreviewTenshukaku = "https://cdn.rcd.gg/PreMiD/websites/G/Genshin%20Impact%20Map/assets/12.png", - PreviewTheChasmUndergroundMines = "https://cdn.rcd.gg/PreMiD/websites/G/Genshin%20Impact%20Map/assets/13.png", - PreviewGoldenAppleArchipelago28 = "https://cdn.rcd.gg/PreMiD/websites/G/Genshin%20Impact%20Map/assets/14.png", - GoldenAppleArchipelagoMap28 = "https://cdn.rcd.gg/PreMiD/websites/G/Genshin%20Impact%20Map/assets/15.png", - PreviewEnkanomiya = "https://cdn.rcd.gg/PreMiD/websites/G/Genshin%20Impact%20Map/assets/16.png", - EmblemIsles = "https://cdn.rcd.gg/PreMiD/websites/G/Genshin%20Impact%20Map/assets/17.png", - EmblemSumeru = "https://cdn.rcd.gg/PreMiD/websites/G/Genshin%20Impact%20Map/assets/18.png", - PreviewSumeru = "https://cdn.rcd.gg/PreMiD/websites/G/Genshin%20Impact%20Map/assets/19.png", - PreviewSumeru2 = "https://cdn.rcd.gg/PreMiD/websites/G/Genshin%20Impact%20Map/assets/0.png", - Logo = "https://cdn.rcd.gg/PreMiD/websites/G/Genshin%20Impact%20Map/assets/logo.png", + EmblemMondstadt = 'https://cdn.rcd.gg/PreMiD/websites/G/Genshin%20Impact%20Map/assets/1.png', + EmblemLiyue = 'https://cdn.rcd.gg/PreMiD/websites/G/Genshin%20Impact%20Map/assets/2.png', + EmblemInazuma = 'https://cdn.rcd.gg/PreMiD/websites/G/Genshin%20Impact%20Map/assets/3.png', + EmblemUnknown = 'https://cdn.rcd.gg/PreMiD/websites/G/Genshin%20Impact%20Map/assets/4.png', + EnkanomiyaMap = 'https://cdn.rcd.gg/PreMiD/websites/G/Genshin%20Impact%20Map/assets/5.png', + TeyvatMap = 'https://cdn.rcd.gg/PreMiD/websites/G/Genshin%20Impact%20Map/assets/6.png', + TheChasmUndergroundMinesMap = 'https://cdn.rcd.gg/PreMiD/websites/G/Genshin%20Impact%20Map/assets/7.png', + EmblemEnkanomiya = 'https://cdn.rcd.gg/PreMiD/websites/G/Genshin%20Impact%20Map/assets/8.png', + EmblemThechasm = 'https://cdn.rcd.gg/PreMiD/websites/G/Genshin%20Impact%20Map/assets/9.png', + PreviewMondstadt = 'https://cdn.rcd.gg/PreMiD/websites/G/Genshin%20Impact%20Map/assets/10.png', + PreviewLiyue = 'https://cdn.rcd.gg/PreMiD/websites/G/Genshin%20Impact%20Map/assets/11.png', + PreviewTenshukaku = 'https://cdn.rcd.gg/PreMiD/websites/G/Genshin%20Impact%20Map/assets/12.png', + PreviewTheChasmUndergroundMines = 'https://cdn.rcd.gg/PreMiD/websites/G/Genshin%20Impact%20Map/assets/13.png', + PreviewGoldenAppleArchipelago28 = 'https://cdn.rcd.gg/PreMiD/websites/G/Genshin%20Impact%20Map/assets/14.png', + GoldenAppleArchipelagoMap28 = 'https://cdn.rcd.gg/PreMiD/websites/G/Genshin%20Impact%20Map/assets/15.png', + PreviewEnkanomiya = 'https://cdn.rcd.gg/PreMiD/websites/G/Genshin%20Impact%20Map/assets/16.png', + EmblemIsles = 'https://cdn.rcd.gg/PreMiD/websites/G/Genshin%20Impact%20Map/assets/17.png', + EmblemSumeru = 'https://cdn.rcd.gg/PreMiD/websites/G/Genshin%20Impact%20Map/assets/18.png', + PreviewSumeru = 'https://cdn.rcd.gg/PreMiD/websites/G/Genshin%20Impact%20Map/assets/19.png', + PreviewSumeru2 = 'https://cdn.rcd.gg/PreMiD/websites/G/Genshin%20Impact%20Map/assets/0.png', + Logo = 'https://cdn.rcd.gg/PreMiD/websites/G/Genshin%20Impact%20Map/assets/logo.png', } interface Maps extends Image { - id: number; - map: string; - key?: string[]; - city?: boolean; - starting?: number; - ending?: number; + id: number + map: string + key?: string[] + city?: boolean + starting?: number + ending?: number } interface City extends Image { - position: number; - map: string; + position: number + map: string } interface Image { - image: { - small: string; - default: string; - preview?: string | string[]; - }; + image: { + small: string + default: string + preview?: string | string[] + } } const map: Maps[] = [ - { - id: 2, - map: "Teyvat", - city: true, - image: { - small: Assets.EmblemUnknown, - default: Assets.TeyvatMap, - preview: Assets.TeyvatMap, - }, - }, - { - id: 7, - map: "Enkanomiya", - image: { - small: Assets.EmblemEnkanomiya, - default: Assets.EnkanomiyaMap, - preview: Assets.PreviewEnkanomiya, - }, - }, - { - id: 9, - map: "The Chasm: Underground Mines", - key: ["chasm", "the-chasm-underground"], - image: { - small: Assets.EmblemThechasm, - default: Assets.TheChasmUndergroundMinesMap, - preview: Assets.PreviewTheChasmUndergroundMines, - }, - }, - { - // Event map 2.8 - // https://www.hoyolab.com/article/5958494/ - id: 12, - map: "Golden Apple Archipelago", - key: ["isles", "golden-apple-archipelago-2-8"], - image: { - small: Assets.EmblemIsles, - default: Assets.GoldenAppleArchipelagoMap28, - preview: Assets.PreviewGoldenAppleArchipelago28, - }, - starting: 1657854000, // Fri, 15 Jul 2022 03:00 GMT - ending: 1661295600, // Wed, 24 Aug 2022 23:00 GMT - }, - { - id: 0, - map: "Unknown", - image: { - small: Assets.EmblemUnknown, - default: Assets.EmblemUnknown, - }, - }, - ], - city: City[] = [ - { - position: 1200, - map: "Mondstadt", - image: { - small: Assets.EmblemMondstadt, - default: Assets.PreviewMondstadt, - preview: Assets.PreviewMondstadt, - }, - }, - { - position: 2500, - map: "Liyue", - image: { - small: Assets.EmblemLiyue, - default: Assets.PreviewLiyue, - preview: Assets.PreviewLiyue, - }, - }, - { - position: 5000, - map: "Sumeru", - image: { - small: Assets.EmblemSumeru, - default: Assets.PreviewSumeru, - preview: [Assets.PreviewSumeru, Assets.PreviewSumeru2], - }, - }, - { - position: 9000, - map: "Inazuma", - image: { - small: Assets.EmblemInazuma, - default: Assets.PreviewTenshukaku, - preview: Assets.PreviewTenshukaku, - }, - }, - ]; + { + id: 2, + map: 'Teyvat', + city: true, + image: { + small: Assets.EmblemUnknown, + default: Assets.TeyvatMap, + preview: Assets.TeyvatMap, + }, + }, + { + id: 7, + map: 'Enkanomiya', + image: { + small: Assets.EmblemEnkanomiya, + default: Assets.EnkanomiyaMap, + preview: Assets.PreviewEnkanomiya, + }, + }, + { + id: 9, + map: 'The Chasm: Underground Mines', + key: ['chasm', 'the-chasm-underground'], + image: { + small: Assets.EmblemThechasm, + default: Assets.TheChasmUndergroundMinesMap, + preview: Assets.PreviewTheChasmUndergroundMines, + }, + }, + { + // Event map 2.8 + // https://www.hoyolab.com/article/5958494/ + id: 12, + map: 'Golden Apple Archipelago', + key: ['isles', 'golden-apple-archipelago-2-8'], + image: { + small: Assets.EmblemIsles, + default: Assets.GoldenAppleArchipelagoMap28, + preview: Assets.PreviewGoldenAppleArchipelago28, + }, + starting: 1657854000, // Fri, 15 Jul 2022 03:00 GMT + ending: 1661295600, // Wed, 24 Aug 2022 23:00 GMT + }, + { + id: 0, + map: 'Unknown', + image: { + small: Assets.EmblemUnknown, + default: Assets.EmblemUnknown, + }, + }, +] +const city: City[] = [ + { + position: 1200, + map: 'Mondstadt', + image: { + small: Assets.EmblemMondstadt, + default: Assets.PreviewMondstadt, + preview: Assets.PreviewMondstadt, + }, + }, + { + position: 2500, + map: 'Liyue', + image: { + small: Assets.EmblemLiyue, + default: Assets.PreviewLiyue, + preview: Assets.PreviewLiyue, + }, + }, + { + position: 5000, + map: 'Sumeru', + image: { + small: Assets.EmblemSumeru, + default: Assets.PreviewSumeru, + preview: [Assets.PreviewSumeru, Assets.PreviewSumeru2], + }, + }, + { + position: 9000, + map: 'Inazuma', + image: { + small: Assets.EmblemInazuma, + default: Assets.PreviewTenshukaku, + preview: Assets.PreviewTenshukaku, + }, + }, +] -let oldMap: string, - current: Maps, - currentCity: City, - getPosition: number, - randomNumber: number; +let oldMap: string +let current: Maps +let currentCity: City | null = null +let getPosition: number +let randomNumber: number -presence.on("UpdateData", async () => { - const [timestamps, showPreview, randomPreview] = await Promise.all([ - presence.getSetting("timestamps"), - presence.getSetting("showPreview"), - presence.getSetting("randomPreview"), - ]), - presenceData: PresenceData = { - details: "Genshin Impact Map", - largeImageKey: Assets.Logo, - smallImageKey: Assets.Search, - startTimestamp: browsingTimestamp, - }, - { hash, host, hostname, pathname, search } = document.location, - searchParams = new URLSearchParams(search); +presence.on('UpdateData', async () => { + const [timestamps, showPreview, randomPreview] = await Promise.all([ + presence.getSetting('timestamps'), + presence.getSetting('showPreview'), + presence.getSetting('randomPreview'), + ]) + const presenceData: PresenceData = { + details: 'Genshin Impact Map', + largeImageKey: Assets.Logo, + smallImageKey: Assets.Search, + startTimestamp: browsingTimestamp, + } + const { hash, host, hostname, pathname, search } = document.location + const searchParams = new URLSearchParams(search) - if (hostname === "mapgenie.io" && !pathname.includes("genshin-impact")) - return; - switch (hostname) { - case "genshin-impact-map.appsample.com": - current = map.find( - i => - i.key?.includes(searchParams.get("map")?.toLowerCase()) ?? - i.map - .toLowerCase() - .includes(searchParams.get("map")?.toLowerCase() || "teyvat") - ); - break; - case "mapgenie.io": - current = map.find( - i => - i.key?.includes(pathname?.split("/maps/")[1]?.toLowerCase()) ?? - i.map - .toLowerCase() - .includes(pathname?.split("/maps/")[1]?.toLowerCase() || "teyvat") - ); - break; - default: // Official Site - if (pathname.includes("signin-sea")) return; - current = map.find( - i => i.id === (parseInt(hash?.split("/map/")[1]?.split("?")[0]) || 2) - ); - getPosition = parseInt(new URLSearchParams(hash).get("center")); - if (current?.city) - currentCity = city.find(i => i.position >= getPosition); - else currentCity = null; - break; - } - if (!current) return; - if (oldMap !== (currentCity?.map ?? current.map)) { - oldMap = currentCity?.map ?? current.map; - randomNumber = Math.random(); - } - if ( - current.starting && - current.ending && - !( - current.starting < Date.now() / 1000 && current.ending > Date.now() / 1000 - ) - ) - current = map[0]; - else if ( - (current.starting || current.ending) && - !( - current.starting < Date.now() / 1000 || current.ending > Date.now() / 1000 - ) - ) - current = map[0]; - presenceData.details = current.map; - presenceData.state = current.city && currentCity ? currentCity.map : null; - presenceData.largeImageKey = getImage( - showPreview ? "preview" : "default", - randomPreview - ); - presenceData.smallImageKey = - current.city && currentCity ? currentCity.image.small : current.image.small; - presenceData.smallImageText = host.replace(".com", ""); - if (!timestamps) { - delete presenceData.startTimestamp; - delete presenceData.endTimestamp; - } - if (presenceData.details) presence.setActivity(presenceData); - else presence.setActivity(); -}); + if (hostname === 'mapgenie.io' && !pathname.includes('genshin-impact')) + return + switch (hostname) { + case 'genshin-impact-map.appsample.com': + current = map.find( + i => + i.key?.includes(searchParams.get('map')?.toLowerCase() ?? '') + ?? i.map + .toLowerCase() + .includes(searchParams.get('map')?.toLowerCase() || 'teyvat'), + )! + break + case 'mapgenie.io': + current = map.find( + i => + i.key?.includes(pathname?.split('/maps/')[1]?.toLowerCase()) + ?? i.map + .toLowerCase() + .includes(pathname?.split('/maps/')[1]?.toLowerCase() || 'teyvat'), + )! + break + default: // Official Site + if (pathname.includes('signin-sea')) + return + current = map.find( + i => i.id === (Number.parseInt(hash?.split('/map/')[1]?.split('?')[0]) || 2), + )! + getPosition = Number.parseInt(new URLSearchParams(hash).get('center') ?? '') + if (current?.city) + currentCity = city.find(i => i.position >= getPosition)! + else currentCity = null + break + } + if (!current) + return + if (oldMap !== (currentCity?.map ?? current.map)) { + oldMap = currentCity?.map ?? current.map + randomNumber = Math.random() + } + if ( + current.starting + && current.ending + && !( + current.starting < Date.now() / 1000 && current.ending > Date.now() / 1000 + ) + ) { + current = map[0] + } + else if ( + (current.starting && current.ending) + && !( + current.starting < Date.now() / 1000 || current.ending > Date.now() / 1000 + ) + ) { + current = map[0] + } + presenceData.details = current.map + presenceData.state = current.city && currentCity ? currentCity.map : null + presenceData.largeImageKey = getImage( + showPreview ? 'preview' : 'default', + randomPreview, + ) + presenceData.smallImageKey = current.city && currentCity ? currentCity.image.small : current.image.small + presenceData.smallImageText = host.replace('.com', '') + if (!timestamps) { + delete presenceData.startTimestamp + delete presenceData.endTimestamp + } + if (presenceData.details) + presence.setActivity(presenceData) + else presence.setActivity() +}) -function getImage(type: "default" | "preview", random?: boolean) { - const currentImage = currentCity?.image ?? current.image; - return ( - Array.isArray(currentImage[type]) && type === "preview" - ? currentImage[type][ - random ? Math.floor(randomNumber * currentImage[type].length) : 0 - ] - : currentImage[type] || current.image.default - ) as string; +function getImage(type: 'default' | 'preview', random?: boolean) { + const currentImage = currentCity?.image ?? current.image + return ( + Array.isArray(currentImage[type]) && type === 'preview' + ? currentImage[type][ + random ? Math.floor(randomNumber * currentImage[type].length) : 0 + ] + : currentImage[type] || current.image.default + ) as string } diff --git a/websites/G/GeoGuessr/metadata.json b/websites/G/GeoGuessr/metadata.json index 060b552fe147..751bee974cc4 100644 --- a/websites/G/GeoGuessr/metadata.json +++ b/websites/G/GeoGuessr/metadata.json @@ -1,27 +1,27 @@ { - "$schema": "https://schemas.premid.app/metadata/1.12", - "apiVersion": 1, - "author": { - "name": "Hans5958", - "id": "279855717203050496" - }, - "service": "GeoGuessr", - "description": { - "en": "GeoGuessr is a web-based geographic discovery game designed by Anton Wallén, a Swedish IT consultant, released on 9 May 2013.", - "nl": "GeoGuessr is een webgebaseerd geografisch ontdekkingsspel ontworpen door Anton Wallén, een Zweedse IT-consultant, uitgebracht op 9 mei 2013." - }, - "url": [ - "www.geoguessr.com", - "geoguessr.com" - ], - "version": "1.2.27", - "logo": "https://cdn.rcd.gg/PreMiD/websites/G/GeoGuessr/assets/logo.png", - "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/GeoGuessr/assets/thumbnail.png", - "color": "#CC2F2F", - "category": "games", - "tags": [ - "geography", - "maps", - "guessing" - ] -} \ No newline at end of file + "$schema": "https://schemas.premid.app/metadata/1.12", + "apiVersion": 1, + "author": { + "name": "Hans5958", + "id": "279855717203050496" + }, + "service": "GeoGuessr", + "description": { + "en": "GeoGuessr is a web-based geographic discovery game designed by Anton Wallén, a Swedish IT consultant, released on 9 May 2013.", + "nl": "GeoGuessr is een webgebaseerd geografisch ontdekkingsspel ontworpen door Anton Wallén, een Zweedse IT-consultant, uitgebracht op 9 mei 2013." + }, + "url": [ + "www.geoguessr.com", + "geoguessr.com" + ], + "version": "1.2.27", + "logo": "https://cdn.rcd.gg/PreMiD/websites/G/GeoGuessr/assets/logo.png", + "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/GeoGuessr/assets/thumbnail.png", + "color": "#CC2F2F", + "category": "games", + "tags": [ + "geography", + "maps", + "guessing" + ] +} diff --git a/websites/G/GeoGuessr/presence.ts b/websites/G/GeoGuessr/presence.ts index 70a699d6a872..94ea334f5623 100644 --- a/websites/G/GeoGuessr/presence.ts +++ b/websites/G/GeoGuessr/presence.ts @@ -1,178 +1,191 @@ const presence = new Presence({ - clientId: "654906151523057664", -}); + clientId: '654906151523057664', +}) -let currentURL = new URL(document.location.href), - currentPath = currentURL.pathname - .replace(/^\/|\/$|\/index\.html$|.html$/g, "") - .split("/"); -const browsingTimestamp = Math.floor(Date.now() / 1000); +let currentURL = new URL(document.location.href) +let currentPath = currentURL.pathname + .replace(/^\/|\/$|\/index\.html$|.html$/g, '') + .split('/') +const browsingTimestamp = Math.floor(Date.now() / 1000) let presenceData: PresenceData = { - details: "Viewing an unsupported page", - largeImageKey: - "https://cdn.rcd.gg/PreMiD/websites/G/GeoGuessr/assets/logo.png", - startTimestamp: browsingTimestamp, -}; + details: 'Viewing an unsupported page', + largeImageKey: 'https://cdn.rcd.gg/PreMiD/websites/G/GeoGuessr/assets/logo.png', + startTimestamp: browsingTimestamp, +} const updateCallback = { - _function: null as () => void, - get function(): () => void { - return this._function; - }, - set function(parameter) { - this._function = parameter; - }, - get present(): boolean { - return this._function !== null; - }, - }, - /** - * Initialize/reset presenceData. - */ - resetData = ( - defaultData: PresenceData = { - details: "Viewing an unsupported page", - largeImageKey: - "https://cdn.rcd.gg/PreMiD/websites/G/GeoGuessr/assets/logo.png", - startTimestamp: browsingTimestamp, - } - ): void => { - currentURL = new URL(document.location.href); - currentPath = currentURL.pathname - .replace(/^\/|\/$|\/index\.html$|.html$/g, "") - .split("/"); - presenceData = { ...defaultData }; - }; + _function: null as unknown as () => void, + get function(): () => void { + return this._function + }, + set function(parameter) { + this._function = parameter + }, + get present(): boolean { + return this._function !== null + }, +} +/** + * Initialize/reset presenceData. + */ +function resetData(defaultData: PresenceData = { + details: 'Viewing an unsupported page', + largeImageKey: 'https://cdn.rcd.gg/PreMiD/websites/G/GeoGuessr/assets/logo.png', + startTimestamp: browsingTimestamp, +}): void { + currentURL = new URL(document.location.href) + currentPath = currentURL.pathname + .replace(/^\/|\/$|\/index\.html$|.html$/g, '') + .split('/') + presenceData = { ...defaultData } +} ((): void => { - let loadedPath: string, - presenceDataPlaced: PresenceData = {}, - forceUpdate = false; + let loadedPath: string + let presenceDataPlaced: PresenceData = {} + let forceUpdate = false - updateCallback.function = (): void => { - if (loadedPath !== currentURL.pathname || forceUpdate) { - loadedPath = currentURL.pathname; + updateCallback.function = (): void => { + if (loadedPath !== currentURL.pathname || forceUpdate) { + loadedPath = currentURL.pathname - if (currentPath[0] !== "game") forceUpdate = false; + if (currentPath[0] !== 'game') + forceUpdate = false - if (currentPath[0] === "") presenceData.details = "On the home page"; - else if (currentPath[0] === "game") { - forceUpdate = true; - presenceData.details = document.querySelector( - ".game-status[data-qa=map-name] .game-status__body" - ).textContent; - if (document.querySelector(".result")) { - presenceData.state = `${ - Number( - document - .querySelector( - ".game-status[data-qa=round-number] .game-status__body" - ) - .textContent.split(" / ")[0] - ) + 1 - } of 5, ${ - document.querySelector( - ".game-status[data-qa=score] .game-status__body" - ).textContent - } points`; - if ( - document - .querySelector( - ".game-status[data-qa=round-number] .game-status__body" - ) - .textContent.split(" / ")[0] === "5" - ) { - presenceData.state = `Finished, ${ - document.querySelector( - ".game-status[data-qa=score] .game-status__body" - ).textContent - } points`; - } - } else { - presenceData.state = `${ - document - .querySelector( - ".game-status[data-qa=round-number] .game-status__body" - ) - .textContent.split(" / ")[0] - } of 5, ${ - document.querySelector( - ".game-status[data-qa=score] .game-status__body" - ).textContent - } points`; - } - } else if (currentPath[0] === "maps" && !currentPath[1]) - presenceData.details = "Looking for a map"; - else { - switch (currentPath[0]) { - case "maps": { - if (document.querySelector(".map-block__title")) { - presenceData.details = "Viewing a map"; - presenceData.state = - document.querySelector(".map-block__title").textContent; - } else presenceData.details = "Looking for a map"; + if (currentPath[0] === '') { + presenceData.details = 'On the home page' + } + else if (currentPath[0] === 'game') { + forceUpdate = true + presenceData.details = document.querySelector( + '.game-status[data-qa=map-name] .game-status__body', + )?.textContent + if (document.querySelector('.result')) { + presenceData.state = `${ + Number( + document + .querySelector( + '.game-status[data-qa=round-number] .game-status__body', + ) + ?.textContent + ?.split(' / ')[0], + ) + 1 + } of 5, ${ + document.querySelector( + '.game-status[data-qa=score] .game-status__body', + )?.textContent + } points` + if ( + document + .querySelector( + '.game-status[data-qa=round-number] .game-status__body', + ) + ?.textContent + ?.split(' / ')[0] === '5' + ) { + presenceData.state = `Finished, ${ + document.querySelector( + '.game-status[data-qa=score] .game-status__body', + )?.textContent + } points` + } + } + else { + presenceData.state = `${ + document + .querySelector( + '.game-status[data-qa=round-number] .game-status__body', + ) + ?.textContent + ?.split(' / ')[0] + } of 5, ${ + document.querySelector( + '.game-status[data-qa=score] .game-status__body', + )?.textContent + } points` + } + } + else if (currentPath[0] === 'maps' && !currentPath[1]) { + presenceData.details = 'Looking for a map' + } + else { + switch (currentPath[0]) { + case 'maps': { + if (document.querySelector('.map-block__title')) { + presenceData.details = 'Viewing a map' + presenceData.state = document.querySelector('.map-block__title')?.textContent + } + else { + presenceData.details = 'Looking for a map' + } - break; - } - case "user": { - presenceData.details = "Viewing a user profile"; - presenceData.state = document.querySelector( - ".profile-summary__nick" - ).textContent; + break + } + case 'user': { + presenceData.details = 'Viewing a user profile' + presenceData.state = document.querySelector( + '.profile-summary__nick', + )?.textContent - break; - } - case "me": { - if (!currentPath[2]) - presenceData.details = "Viewing their own profile"; - else { - presenceData.details = "Viewing a personal page"; - presenceData.state = { - settings: "Settings", - leagues: "Leagues", - activities: "Activities", - current: "Ongoing games", - likes: "Favorite maps", - badges: "Badges", - maps: "My maps", - "map-maker": "Map Maker", - }[currentURL.pathname.split("/")[2]]; - } + break + } + case 'me': { + if (!currentPath[2]) { + presenceData.details = 'Viewing their own profile' + } + else { + presenceData.details = 'Viewing a personal page' + presenceData.state = { + 'settings': 'Settings', + 'leagues': 'Leagues', + 'activities': 'Activities', + 'current': 'Ongoing games', + 'likes': 'Favorite maps', + 'badges': 'Badges', + 'maps': 'My maps', + 'map-maker': 'Map Maker', + }[currentURL.pathname.split('/')[2]] + } - break; - } - case "signin": { - presenceData.details = "Signing in"; - break; - } - case "signup": { - presenceData.details = "Registering an account"; - break; - } - default: - if (document.title === "GeoGuessr - Let's explore the world!") - forceUpdate = true; - else { - forceUpdate = false; - presenceData.details = "Viewing a page"; - presenceData.state = document.title.replace(" - GeoGuessr", ""); - } - } - } + break + } + case 'signin': { + presenceData.details = 'Signing in' + break + } + case 'signup': { + presenceData.details = 'Registering an account' + break + } + default: + if (document.title === 'GeoGuessr - Let\'s explore the world!') { + forceUpdate = true + } + else { + forceUpdate = false + presenceData.details = 'Viewing a page' + presenceData.state = document.title.replace(' - GeoGuessr', '') + } + } + } - presenceDataPlaced = presenceData; - } else presenceData = presenceDataPlaced; - }; -})(); + presenceDataPlaced = presenceData + } + else { + presenceData = presenceDataPlaced + } + } +})() if (updateCallback.present) { - const defaultData = { ...presenceData }; - presence.on("UpdateData", async () => { - resetData(defaultData); - updateCallback.function(); - presence.setActivity(presenceData); - }); -} else { - presence.on("UpdateData", async () => { - presence.setActivity(presenceData); - }); + const defaultData = { ...presenceData } + presence.on('UpdateData', async () => { + resetData(defaultData) + updateCallback.function() + presence.setActivity(presenceData) + }) +} +else { + presence.on('UpdateData', async () => { + presence.setActivity(presenceData) + }) } diff --git a/websites/G/Geode/metadata.json b/websites/G/Geode/metadata.json index 7930c82db868..bda6314af130 100644 --- a/websites/G/Geode/metadata.json +++ b/websites/G/Geode/metadata.json @@ -1,41 +1,41 @@ { - "$schema": "https://schemas.premid.app/metadata/1.12", - "apiVersion": 1, - "author": { - "id": "205984221859151873", - "name": "joerkig" - }, - "service": "Geode", - "description": { - "en": "The main page for Geode SDK - a mod loader and modding framework for Geometry Dash." - }, - "url": [ - "geode-sdk.org", - "docs.geode-sdk.org" - ], - "version": "1.0.8", - "logo": "https://cdn.rcd.gg/PreMiD/websites/G/Geode/assets/logo.png", - "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/Geode/assets/thumbnail.png", - "color": "#f5dd9f", - "category": "games", - "tags": [ - "gd", - "geometry", - "dash", - "modding" - ], - "settings": [ - { - "id": "time", - "title": "Show Timestamps", - "icon": "fad fa-stopwatch", - "value": true - }, - { - "id": "buttons", - "title": "Show Buttons", - "icon": "fas fa-compress-arrows-alt", - "value": true - } - ] -} \ No newline at end of file + "$schema": "https://schemas.premid.app/metadata/1.12", + "apiVersion": 1, + "author": { + "id": "205984221859151873", + "name": "joerkig" + }, + "service": "Geode", + "description": { + "en": "The main page for Geode SDK - a mod loader and modding framework for Geometry Dash." + }, + "url": [ + "geode-sdk.org", + "docs.geode-sdk.org" + ], + "version": "1.0.8", + "logo": "https://cdn.rcd.gg/PreMiD/websites/G/Geode/assets/logo.png", + "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/Geode/assets/thumbnail.png", + "color": "#f5dd9f", + "category": "games", + "tags": [ + "gd", + "geometry", + "dash", + "modding" + ], + "settings": [ + { + "id": "time", + "title": "Show Timestamps", + "icon": "fad fa-stopwatch", + "value": true + }, + { + "id": "buttons", + "title": "Show Buttons", + "icon": "fas fa-compress-arrows-alt", + "value": true + } + ] +} diff --git a/websites/G/Geode/presence.ts b/websites/G/Geode/presence.ts index 8f1d65ea2cd7..9a4d0ca0df79 100644 --- a/websites/G/Geode/presence.ts +++ b/websites/G/Geode/presence.ts @@ -1,63 +1,67 @@ const presence = new Presence({ - clientId: "939892980054110238", - }), - browsingTimestamp = Math.floor(Date.now() / 1000); + clientId: '939892980054110238', +}) +const browsingTimestamp = Math.floor(Date.now() / 1000) const enum Assets { - Logo = "https://cdn.rcd.gg/PreMiD/websites/G/Geode/assets/logo.png", + Logo = 'https://cdn.rcd.gg/PreMiD/websites/G/Geode/assets/logo.png', } -presence.on("UpdateData", async () => { - const [buttons, time] = await Promise.all([ - presence.getSetting("buttons"), - presence.getSetting("time"), - ]), - presenceData: PresenceData = { - largeImageKey: Assets.Logo, - startTimestamp: browsingTimestamp, - }, - { pathname, href, hostname } = document.location; +presence.on('UpdateData', async () => { + const [buttons, time] = await Promise.all([ + presence.getSetting('buttons'), + presence.getSetting('time'), + ]) + const presenceData: PresenceData = { + largeImageKey: Assets.Logo, + startTimestamp: browsingTimestamp, + } + const { pathname, href, hostname } = document.location - if (hostname.split(".")[0] === "geode-sdk") { - switch (pathname.split("/")[1]) { - case "": { - presenceData.details = "Viewing homepage"; - break; - } - case "mods": { - if (!pathname.split("/")[2]) presenceData.details = "Browsing mods"; - else { - presenceData.details = `${ - document.querySelector("h1.font-head").textContent - } ${document.querySelector("h3.font-head em").textContent}`; - presenceData.state = document - .querySelector("h3.font-head") - .textContent.replace( - document.querySelector("h3.font-head em").textContent, - "" - ); - presenceData.largeImageKey = - document.querySelector("img"); - presenceData.buttons = [ - { - label: "View Page", - url: href, - }, - ]; - } - break; - } - } - } else if (hostname.split(".")[0] === "docs") { - presenceData.details = "Viewing documentation"; - presenceData.state = document.querySelector("h1"); - } + if (hostname.split('.')[0] === 'geode-sdk') { + switch (pathname.split('/')[1]) { + case '': { + presenceData.details = 'Viewing homepage' + break + } + case 'mods': { + if (!pathname.split('/')[2]) { + presenceData.details = 'Browsing mods' + } + else { + presenceData.details = `${ + document.querySelector('h1.font-head')?.textContent + } ${document.querySelector('h3.font-head em')?.textContent}` + presenceData.state = document + .querySelector('h3.font-head') + ?.textContent + ?.replace( + document.querySelector('h3.font-head em')?.textContent ?? '', + '', + ) + presenceData.largeImageKey = document.querySelector('img') + presenceData.buttons = [ + { + label: 'View Page', + url: href, + }, + ] + } + break + } + } + } + else if (hostname.split('.')[0] === 'docs') { + presenceData.details = 'Viewing documentation' + presenceData.state = document.querySelector('h1') + } - if (!buttons) delete presenceData.buttons; - if (!time) { - delete presenceData.startTimestamp; - delete presenceData.endTimestamp; - } + if (!buttons) + delete presenceData.buttons + if (!time) { + delete presenceData.startTimestamp + delete presenceData.endTimestamp + } - presence.setActivity(presenceData); -}); + presence.setActivity(presenceData) +}) diff --git a/websites/G/Geotastic/metadata.json b/websites/G/Geotastic/metadata.json index dfef7db77fdb..35cff837277b 100644 --- a/websites/G/Geotastic/metadata.json +++ b/websites/G/Geotastic/metadata.json @@ -1,24 +1,24 @@ { - "$schema": "https://schemas.premid.app/metadata/1.12", - "apiVersion": 1, - "author": { - "name": "Nate", - "id": "196817730257551360" - }, - "service": "Geotastic", - "description": { - "en": "Geotastic is a geographical location guessing game created by Eduard But from Edutastic Games.", - "fr": "Geotastic est un jeu de devinette de localisation géographique créé par Eduard But de Edutastic Games." - }, - "url": "geotastic.net", - "version": "1.0.9", - "logo": "https://cdn.rcd.gg/PreMiD/websites/G/Geotastic/assets/logo.png", - "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/Geotastic/assets/thumbnail.png", - "color": "#39bf7a", - "category": "games", - "tags": [ - "geography", - "maps", - "guessing" - ] -} \ No newline at end of file + "$schema": "https://schemas.premid.app/metadata/1.12", + "apiVersion": 1, + "author": { + "name": "Nate", + "id": "196817730257551360" + }, + "service": "Geotastic", + "description": { + "en": "Geotastic is a geographical location guessing game created by Eduard But from Edutastic Games.", + "fr": "Geotastic est un jeu de devinette de localisation géographique créé par Eduard But de Edutastic Games." + }, + "url": "geotastic.net", + "version": "1.0.9", + "logo": "https://cdn.rcd.gg/PreMiD/websites/G/Geotastic/assets/logo.png", + "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/Geotastic/assets/thumbnail.png", + "color": "#39bf7a", + "category": "games", + "tags": [ + "geography", + "maps", + "guessing" + ] +} diff --git a/websites/G/Geotastic/presence.ts b/websites/G/Geotastic/presence.ts index fec9dafcfc5e..1a4b4f8da15f 100644 --- a/websites/G/Geotastic/presence.ts +++ b/websites/G/Geotastic/presence.ts @@ -1,98 +1,105 @@ const presence = new Presence({ - clientId: "978557181911773214", - }), - browsingTimestamp = Math.floor(Date.now() / 1000); + clientId: '978557181911773214', +}) +const browsingTimestamp = Math.floor(Date.now() / 1000) -presence.on("UpdateData", async () => { - let presenceData: PresenceData = { - largeImageKey: - "https://cdn.rcd.gg/PreMiD/websites/G/Geotastic/assets/logo.png", - details: "Viewing an unsupported page", - startTimestamp: browsingTimestamp, - }; - const pages: Record = { - "/home": { details: "Viewing the home page" }, - "/local-lobby": { details: "Creating a local lobby" }, - "/user-challenges/find": { details: "Browsing unplayed user challenges" }, - "/user-challenges/played": { details: "Browsing played user challenges" }, - "/user-challenges/own": { details: "Browsing created user challenges" }, - "/user-challenges/create": { details: "Creating a challenge" }, - "/matchmaking-lobby": { details: "In a matchmaking lobby" }, - "/community-map": { details: "Viewing the community map" }, - "/squad/list": { details: "Browsing the list of squads" }, - "/squad/management": { details: "Viewing the squad management page" }, - "/map-editor/maps": { details: "Creating a map" }, - "/map-editor/drop-groups": { details: "Viewing their drop groups" }, - "/events": { details: "Browsing past and future events" }, - "/account/profile": { details: "Viewing their profile settings" }, - "/account/statistics": { details: "Viewing their statistics" }, - "/account/trophies": { details: "Viewing their trophies" }, - "/account/friends": { details: "Viewing their friends" }, - "/account/supporter-status": { - details: "Viewing their supporter status", - }, - "/account/quota-consumption": { - details: "Viewing their quota consumption", - }, - "/account/account-settings": { details: "Viewing their account settings" }, - }; +presence.on('UpdateData', async () => { + let presenceData: PresenceData = { + largeImageKey: 'https://cdn.rcd.gg/PreMiD/websites/G/Geotastic/assets/logo.png', + details: 'Viewing an unsupported page', + startTimestamp: browsingTimestamp, + } + const pages: Record = { + '/home': { details: 'Viewing the home page' }, + '/local-lobby': { details: 'Creating a local lobby' }, + '/user-challenges/find': { details: 'Browsing unplayed user challenges' }, + '/user-challenges/played': { details: 'Browsing played user challenges' }, + '/user-challenges/own': { details: 'Browsing created user challenges' }, + '/user-challenges/create': { details: 'Creating a challenge' }, + '/matchmaking-lobby': { details: 'In a matchmaking lobby' }, + '/community-map': { details: 'Viewing the community map' }, + '/squad/list': { details: 'Browsing the list of squads' }, + '/squad/management': { details: 'Viewing the squad management page' }, + '/map-editor/maps': { details: 'Creating a map' }, + '/map-editor/drop-groups': { details: 'Viewing their drop groups' }, + '/events': { details: 'Browsing past and future events' }, + '/account/profile': { details: 'Viewing their profile settings' }, + '/account/statistics': { details: 'Viewing their statistics' }, + '/account/trophies': { details: 'Viewing their trophies' }, + '/account/friends': { details: 'Viewing their friends' }, + '/account/supporter-status': { + details: 'Viewing their supporter status', + }, + '/account/quota-consumption': { + details: 'Viewing their quota consumption', + }, + '/account/account-settings': { details: 'Viewing their account settings' }, + } - for (const [path, data] of Object.entries(pages)) { - if (document.location.pathname.includes(path)) - presenceData = { ...presenceData, ...data }; - } + for (const [path, data] of Object.entries(pages)) { + if (document.location.pathname.includes(path)) + presenceData = { ...presenceData, ...data } as PresenceData + } - switch (true) { - case document.location.pathname.includes("/challenge-details/"): - presenceData.details = "Viewing a challenge"; - break; - case document.location.pathname.includes("/online-lobby/"): - presenceData.details = "In an online lobby"; - break; - case document.location.pathname.includes("/events/"): - presenceData.details = "Viewing an event"; - presenceData.state = document.querySelector("h1").textContent; - break; - case document.location.pathname.includes("/help-out/"): - presenceData.details = "Viewing ways to support Geotastic"; - break; - } + switch (true) { + case document.location.pathname.includes('/challenge-details/'): + presenceData.details = 'Viewing a challenge' + break + case document.location.pathname.includes('/online-lobby/'): + presenceData.details = 'In an online lobby' + break + case document.location.pathname.includes('/events/'): + presenceData.details = 'Viewing an event' + presenceData.state = document.querySelector('h1')?.textContent + break + case document.location.pathname.includes('/help-out/'): + presenceData.details = 'Viewing ways to support Geotastic' + break + } - if ( - document.location.pathname === "/play" || - document.location.pathname.includes("/play-online/") - ) { - if (document.querySelector(".active-component-prepare")) - presenceData.details = "Preparing for a round"; - else if (document.querySelector(".active-component-play")) { - if (document.querySelector(".side-bar")) { - presenceData.details = "In an online battle"; - presenceData.state = `Playing map ${ - document.querySelector(".meta-infos").querySelectorAll("span")[1] - .textContent - }`; - } else { - const info = document - .querySelector(".meta-infos") - .querySelectorAll("span"); - presenceData.details = `Playing map ${info[1].textContent}`; - presenceData.state = `${info[2].textContent} ${info[3].textContent}`; - } - } else if (document.querySelector(".active-component-result")) { - presenceData.details = document - .querySelector(".round-info") - .querySelector("span").textContent; - presenceData.state = `Score ${ - document.querySelector(".own-score").textContent - }`; - } else if (document.querySelector(".active-component-finished")) { - presenceData.details = "Round finished"; - presenceData.state = `Final score ${ - document.querySelector(".score").textContent - }`; - } else presenceData.details = "Playing a game"; - } + if ( + document.location.pathname === '/play' + || document.location.pathname.includes('/play-online/') + ) { + if (document.querySelector('.active-component-prepare')) { + presenceData.details = 'Preparing for a round' + } + else if (document.querySelector('.active-component-play')) { + if (document.querySelector('.side-bar')) { + presenceData.details = 'In an online battle' + presenceData.state = `Playing map ${ + document.querySelector('.meta-infos')?.querySelectorAll('span')[1].textContent + }` + } + else { + const info = document + .querySelector('.meta-infos') + ?.querySelectorAll('span') + presenceData.details = `Playing map ${info?.[1]?.textContent}` + presenceData.state = `${info?.[2]?.textContent} ${info?.[3]?.textContent}` + } + } + else if (document.querySelector('.active-component-result')) { + presenceData.details = document + .querySelector('.round-info') + ?.querySelector('span') + ?.textContent + presenceData.state = `Score ${ + document.querySelector('.own-score')?.textContent + }` + } + else if (document.querySelector('.active-component-finished')) { + presenceData.details = 'Round finished' + presenceData.state = `Final score ${ + document.querySelector('.score')?.textContent + }` + } + else { + presenceData.details = 'Playing a game' + } + } - if (presenceData.details) presence.setActivity(presenceData); - else presence.setActivity(); -}); + if (presenceData.details) + presence.setActivity(presenceData) + else presence.setActivity() +}) diff --git a/websites/G/Gfycat/metadata.json b/websites/G/Gfycat/metadata.json index 43cfc3fc28eb..92ef46cbaab8 100644 --- a/websites/G/Gfycat/metadata.json +++ b/websites/G/Gfycat/metadata.json @@ -1,24 +1,24 @@ { - "$schema": "https://schemas.premid.app/metadata/1.12", - "apiVersion": 1, - "author": { - "name": "Lacking", - "id": "132693143173857281" - }, - "service": "Gfycat", - "description": { - "en": "Gfycat is the top destination for GIFs and videos. Create your own GIF or browse the best gaming GIFs, reactions GIFs, funny GIFs and more.", - "nl": "Gfycat is de topbestemming voor GIFs en video's. Maak je eigen GIF of blader door de beste gaming GIF's, reacties GIF's, grappige GIF's en meer." - }, - "url": "gfycat.com", - "version": "1.2.24", - "logo": "https://cdn.rcd.gg/PreMiD/websites/G/Gfycat/assets/logo.png", - "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/Gfycat/assets/thumbnail.png", - "color": "#3aa8ff", - "category": "videos", - "tags": [ - "gfycat", - "gif", - "video" - ] -} \ No newline at end of file + "$schema": "https://schemas.premid.app/metadata/1.12", + "apiVersion": 1, + "author": { + "name": "Lacking", + "id": "132693143173857281" + }, + "service": "Gfycat", + "description": { + "en": "Gfycat is the top destination for GIFs and videos. Create your own GIF or browse the best gaming GIFs, reactions GIFs, funny GIFs and more.", + "nl": "Gfycat is de topbestemming voor GIFs en video's. Maak je eigen GIF of blader door de beste gaming GIF's, reacties GIF's, grappige GIF's en meer." + }, + "url": "gfycat.com", + "version": "1.2.24", + "logo": "https://cdn.rcd.gg/PreMiD/websites/G/Gfycat/assets/logo.png", + "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/Gfycat/assets/thumbnail.png", + "color": "#3aa8ff", + "category": "videos", + "tags": [ + "gfycat", + "gif", + "video" + ] +} diff --git a/websites/G/Gfycat/presence.ts b/websites/G/Gfycat/presence.ts index b9e9a77cbfbf..75210fbd7360 100644 --- a/websites/G/Gfycat/presence.ts +++ b/websites/G/Gfycat/presence.ts @@ -1,92 +1,97 @@ const presence = new Presence({ - clientId: "630874255990587402", - }), - strings = presence.getStrings({ - play: "general.playing", - pause: "general.paused", - }); + clientId: '630874255990587402', +}) +const strings = presence.getStrings({ + play: 'general.playing', + pause: 'general.paused', +}) -presence.on("UpdateData", async () => { - const presenceData: PresenceData = { - largeImageKey: - "https://cdn.rcd.gg/PreMiD/websites/G/Gfycat/assets/logo.png", - }; +presence.on('UpdateData', async () => { + const presenceData: PresenceData = { + largeImageKey: 'https://cdn.rcd.gg/PreMiD/websites/G/Gfycat/assets/logo.png', + } - if (document.location.pathname.startsWith("/discover")) { - const section = document.querySelector(".multiple-view__title").textContent; - if (section) presenceData.state = section; + if (document.location.pathname.startsWith('/discover')) { + const section = document.querySelector('.multiple-view__title')?.textContent + if (section) + presenceData.state = section - presenceData.details = "Browsing..."; - presenceData.startTimestamp = Date.now(); + presenceData.details = 'Browsing...' + presenceData.startTimestamp = Date.now() - presence.setActivity(presenceData); - } else if (document.location.pathname.startsWith("/gifs/search")) { - const searchText = document.querySelector( - ".feed-with-player__title" - ).textContent; + presence.setActivity(presenceData) + } + else if (document.location.pathname.startsWith('/gifs/search')) { + const searchText = document.querySelector( + '.feed-with-player__title', + )?.textContent - presenceData.details = "Searching..."; - if (searchText) presenceData.state = searchText; + presenceData.details = 'Searching...' + if (searchText) + presenceData.state = searchText - presenceData.startTimestamp = Date.now(); - presenceData.smallImageKey = Assets.Search; - presenceData.smallImageText = "Searching"; + presenceData.startTimestamp = Date.now() + presenceData.smallImageKey = Assets.Search + presenceData.smallImageText = 'Searching' - presence.setActivity(presenceData); - } else if ( - document.location.pathname.startsWith("/upload") || - document.location.pathname.startsWith("/create") - ) { - presenceData.details = "Uploading..."; - presenceData.startTimestamp = Date.now(); + presence.setActivity(presenceData) + } + else if ( + document.location.pathname.startsWith('/upload') + || document.location.pathname.startsWith('/create') + ) { + presenceData.details = 'Uploading...' + presenceData.startTimestamp = Date.now() - presence.setActivity(presenceData); - } else if (document.location.pathname.startsWith("/@")) { - presenceData.details = "Viewing profile"; - presenceData.state = document.querySelector( - ".profile-container .profile-info-container .name" - ).textContent; - presenceData.startTimestamp = Date.now(); + presence.setActivity(presenceData) + } + else if (document.location.pathname.startsWith('/@')) { + presenceData.details = 'Viewing profile' + presenceData.state = document.querySelector( + '.profile-container .profile-info-container .name', + )?.textContent + presenceData.startTimestamp = Date.now() - presence.setActivity(presenceData); - } else if (document.location.pathname.startsWith("/jobs")) { - presenceData.details = "Browsing jobs"; - presenceData.startTimestamp = Date.now(); + presence.setActivity(presenceData) + } + else if (document.location.pathname.startsWith('/jobs')) { + presenceData.details = 'Browsing jobs' + presenceData.startTimestamp = Date.now() - presence.setActivity(presenceData); - } else { - const player: HTMLVideoElement = document.querySelector( - ".video-player-wrapper video" - ); + presence.setActivity(presenceData) + } + else { + const player = document.querySelector( + '.video-player-wrapper video', + ) - if (player) { - [presenceData.startTimestamp, presenceData.endTimestamp] = - presence.getTimestamps( - Math.floor(player.currentTime), - Math.floor(player.duration) - ); + if (player) { + [presenceData.startTimestamp, presenceData.endTimestamp] = presence.getTimestamps( + Math.floor(player.currentTime), + Math.floor(player.duration), + ) - presenceData.details = - document.querySelector(".gif-info .title").textContent; - presenceData.state = document.querySelector( - ".gif-info .gif-views" - ).textContent; - presenceData.smallImageKey = player.paused ? Assets.Pause : Assets.Play; - presenceData.smallImageText = player.paused - ? (await strings).pause - : (await strings).play; + presenceData.details = document.querySelector('.gif-info .title')?.textContent + presenceData.state = document.querySelector( + '.gif-info .gif-views', + )?.textContent + presenceData.smallImageKey = player.paused ? Assets.Pause : Assets.Play + presenceData.smallImageText = player.paused + ? (await strings).pause + : (await strings).play - if (player.paused) { - delete presenceData.startTimestamp; - delete presenceData.endTimestamp; - } + if (player.paused) { + delete presenceData.startTimestamp + delete presenceData.endTimestamp + } - presence.setActivity(presenceData); - } else { - presenceData.details = "Browsing..."; - presenceData.startTimestamp = Date.now(); + presence.setActivity(presenceData) + } + else { + presenceData.details = 'Browsing...' + presenceData.startTimestamp = Date.now() - presence.setActivity(presenceData); - } - } -}); + presence.setActivity(presenceData) + } + } +}) diff --git a/websites/G/Giggl/metadata.json b/websites/G/Giggl/metadata.json index 2198d6083583..bea419133945 100644 --- a/websites/G/Giggl/metadata.json +++ b/websites/G/Giggl/metadata.json @@ -1,52 +1,52 @@ { - "$schema": "https://schemas.premid.app/metadata/1.12", - "apiVersion": 1, - "author": { - "name": "CRUGG", - "id": "228965621478588416" - }, - "contributors": [ - { - "name": "Encrypted", - "id": "564434085708038144" - } - ], - "service": "Giggl", - "description": { - "en": "Watch & browse the web, together - From hosting virtual movie nights, browsing the web with friends or watching anime with your long-distance partner: Giggl lets you do that together in real-time." - }, - "url": [ - "giggl.app", - "canary.giggl.app", - "status.giggl.app" - ], - "version": "2.0.17", - "logo": "https://cdn.rcd.gg/PreMiD/websites/G/Giggl/assets/logo.jpg", - "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/Giggl/assets/thumbnail.png", - "color": "#FF0099", - "category": "videos", - "tags": [ - "voice", - "browsing", - "watching", - "media" - ], - "settings": [ - { - "id": "lang", - "multiLanguage": true - }, - { - "id": "privacy", - "title": "Privacy Mode", - "icon": "fad fa-user-secret", - "value": false - }, - { - "id": "time", - "title": "Show timestamps", - "icon": "fad fa-stopwatch", - "value": true - } - ] -} \ No newline at end of file + "$schema": "https://schemas.premid.app/metadata/1.12", + "apiVersion": 1, + "author": { + "name": "CRUGG", + "id": "228965621478588416" + }, + "contributors": [ + { + "name": "Encrypted", + "id": "564434085708038144" + } + ], + "service": "Giggl", + "description": { + "en": "Watch & browse the web, together - From hosting virtual movie nights, browsing the web with friends or watching anime with your long-distance partner: Giggl lets you do that together in real-time." + }, + "url": [ + "giggl.app", + "canary.giggl.app", + "status.giggl.app" + ], + "version": "2.0.17", + "logo": "https://cdn.rcd.gg/PreMiD/websites/G/Giggl/assets/logo.jpg", + "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/Giggl/assets/thumbnail.png", + "color": "#FF0099", + "category": "videos", + "tags": [ + "voice", + "browsing", + "watching", + "media" + ], + "settings": [ + { + "id": "lang", + "multiLanguage": true + }, + { + "id": "privacy", + "title": "Privacy Mode", + "icon": "fad fa-user-secret", + "value": false + }, + { + "id": "time", + "title": "Show timestamps", + "icon": "fad fa-stopwatch", + "value": true + } + ] +} diff --git a/websites/G/Giggl/presence.ts b/websites/G/Giggl/presence.ts index 6d9f1850176c..fe434e7758e4 100644 --- a/websites/G/Giggl/presence.ts +++ b/websites/G/Giggl/presence.ts @@ -1,82 +1,84 @@ const presence = new Presence({ - clientId: "876239113307709493", - }), - browsingTimestamp = Math.floor(Date.now() / 1000); + clientId: '876239113307709493', +}) +const browsingTimestamp = Math.floor(Date.now() / 1000) async function getStrings() { - return presence.getStrings( - { - home: "general.viewHome", - user: "general.viewUser", - call: "general.inCall", - reading: "general.readingAbout", - browsing: "general.browsing", - }, - await presence.getSetting("lang").catch(() => "en") - ); + return presence.getStrings( + { + home: 'general.viewHome', + user: 'general.viewUser', + call: 'general.inCall', + reading: 'general.readingAbout', + browsing: 'general.browsing', + }, + await presence.getSetting('lang').catch(() => 'en'), + ) } -let strings: Awaited>, - oldLang: string = null; +let strings: Awaited> +let oldLang: string | null = null -presence.on("UpdateData", async () => { - const presenceData: PresenceData = { - largeImageKey: - "https://cdn.rcd.gg/PreMiD/websites/G/Giggl/assets/logo.jpg", - }, - privacy = await presence.getSetting("privacy"), - newLang = await presence.getSetting("lang").catch(() => "en"), - timestamps = await presence.getSetting("time"); +presence.on('UpdateData', async () => { + const presenceData: PresenceData = { + largeImageKey: 'https://cdn.rcd.gg/PreMiD/websites/G/Giggl/assets/logo.jpg', + } + const privacy = await presence.getSetting('privacy') + const newLang = await presence.getSetting('lang').catch(() => 'en') + const timestamps = await presence.getSetting('time') - if (oldLang !== newLang || !strings) { - oldLang = newLang; - strings = await getStrings(); - } + if (oldLang !== newLang || !strings) { + oldLang = newLang + strings = await getStrings() + } - switch (document.location.hostname) { - case "giggl.app": { - switch (document.location.pathname) { - case "/": - presenceData.details = (await strings).home; - break; - case "/jobs": - presenceData.details = `${(await strings).reading} Jobs`; - break; - case "/isp": - presenceData.details = `${(await strings).reading} Giggl Networking`; - break; - } + switch (document.location.hostname) { + case 'giggl.app': { + switch (document.location.pathname) { + case '/': + presenceData.details = (await strings).home + break + case '/jobs': + presenceData.details = `${(await strings).reading} Jobs` + break + case '/isp': + presenceData.details = `${(await strings).reading} Giggl Networking` + break + } - break; - } - case "canary.giggl.app": { - presenceData.details = (await strings).browsing; + break + } + case 'canary.giggl.app': { + presenceData.details = (await strings).browsing - if (document.location.pathname.startsWith("/portal")) { - presenceData.details = "In a Portal"; - [presenceData.state] = document - .querySelector("title") - .textContent.split(" • "); - } else if (document.querySelector("svg.feather.feather-phone-missed")) { - presenceData.smallImageKey = Assets.Call; - presenceData.smallImageText = (await strings).call; - } else if (document.querySelector(".feather.feather-map-pin")) { - presenceData.details = (await strings).user; - presenceData.state = document.querySelector("p").textContent; - } + if (document.location.pathname.startsWith('/portal')) { + presenceData.details = 'In a Portal'; + [presenceData.state] = document + .querySelector('title') + ?.textContent + ?.split(' • ') ?? [] + } + else if (document.querySelector('svg.feather.feather-phone-missed')) { + presenceData.smallImageKey = Assets.Call + presenceData.smallImageText = (await strings).call + } + else if (document.querySelector('.feather.feather-map-pin')) { + presenceData.details = (await strings).user + presenceData.state = document.querySelector('p')?.textContent + } - break; - } - case "status.giggl.app": - { - presenceData.details = "Viewing the status page"; - // No default - } - break; - } + break + } + case 'status.giggl.app': { + presenceData.details = 'Viewing the status page' + break + } + } - if (privacy) delete presenceData.state; - if (timestamps) presenceData.startTimestamp = browsingTimestamp; + if (privacy) + delete presenceData.state + if (timestamps) + presenceData.startTimestamp = browsingTimestamp - presence.setActivity(presenceData); -}); + presence.setActivity(presenceData) +}) diff --git a/websites/G/Giphy/metadata.json b/websites/G/Giphy/metadata.json index 50b5f35449d2..e4ca56f2fd62 100644 --- a/websites/G/Giphy/metadata.json +++ b/websites/G/Giphy/metadata.json @@ -1,29 +1,29 @@ { - "$schema": "https://schemas.premid.app/metadata/1.12", - "apiVersion": 1, - "author": { - "name": "Nekolen", - "id": "270125856679002113" - }, - "service": "Giphy", - "description": { - "en": "Giphy is a Gif search and creation engine.", - "ro": "Giphy este un motor de căutare și creare Gif.", - "pt_BR": "Giphy é um mecanismo de pesquisa e criação de GIF.", - "fr": "Giphy est un moteur de recherche et création de GIF.", - "uk_UA": "Giphy - це система пошуку та створення GIF.", - "nl": "Giphy is een GIF-zoek- en creatiesysteem.", - "vi_VN": "Giphy là công cụ tìm kiếm và tạo Gif." - }, - "url": "giphy.com", - "version": "1.2.26", - "logo": "https://cdn.rcd.gg/PreMiD/websites/G/Giphy/assets/logo.png", - "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/Giphy/assets/thumbnail.png", - "color": "#00FF00", - "category": "other", - "tags": [ - "gif", - "editor", - "creator" - ] -} \ No newline at end of file + "$schema": "https://schemas.premid.app/metadata/1.12", + "apiVersion": 1, + "author": { + "name": "Nekolen", + "id": "270125856679002113" + }, + "service": "Giphy", + "description": { + "en": "Giphy is a Gif search and creation engine.", + "ro": "Giphy este un motor de căutare și creare Gif.", + "pt_BR": "Giphy é um mecanismo de pesquisa e criação de GIF.", + "fr": "Giphy est un moteur de recherche et création de GIF.", + "uk_UA": "Giphy - це система пошуку та створення GIF.", + "nl": "Giphy is een GIF-zoek- en creatiesysteem.", + "vi_VN": "Giphy là công cụ tìm kiếm và tạo Gif." + }, + "url": "giphy.com", + "version": "1.2.26", + "logo": "https://cdn.rcd.gg/PreMiD/websites/G/Giphy/assets/logo.png", + "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/Giphy/assets/thumbnail.png", + "color": "#00FF00", + "category": "other", + "tags": [ + "gif", + "editor", + "creator" + ] +} diff --git a/websites/G/Giphy/presence.ts b/websites/G/Giphy/presence.ts index 742b3592c274..473f761ad204 100644 --- a/websites/G/Giphy/presence.ts +++ b/websites/G/Giphy/presence.ts @@ -1,42 +1,49 @@ const presence = new Presence({ - clientId: "630507230852022273", -}); + clientId: '630507230852022273', +}) const enum Assets { - Browsing = "https://cdn.rcd.gg/PreMiD/websites/G/Giphy/assets/0.png", - Creating = "https://cdn.rcd.gg/PreMiD/websites/G/Giphy/assets/1.png", - Logo = "https://cdn.rcd.gg/PreMiD/websites/G/Giphy/assets/logo.png", + Browsing = 'https://cdn.rcd.gg/PreMiD/websites/G/Giphy/assets/0.png', + Creating = 'https://cdn.rcd.gg/PreMiD/websites/G/Giphy/assets/1.png', + Logo = 'https://cdn.rcd.gg/PreMiD/websites/G/Giphy/assets/logo.png', } -presence.on("UpdateData", async () => { - const presenceData: PresenceData = { - largeImageKey: "https://cdn.rcd.gg/PreMiD/websites/G/Giphy/assets/logo.png", - }; +presence.on('UpdateData', async () => { + const presenceData: PresenceData = { + largeImageKey: 'https://cdn.rcd.gg/PreMiD/websites/G/Giphy/assets/logo.png', + } - if (document.location.pathname === "/") { - presenceData.details = "Browsing Gifs..."; - presenceData.state = "at Homepage"; - presenceData.smallImageKey = Assets.Browsing; - presenceData.smallImageText = "browsing"; - } else if (document.location.pathname.includes("create/gifmaker")) { - presenceData.details = "Creating a Gif"; - presenceData.state = "at Creation page"; - presenceData.smallImageKey = Assets.Creating; - presenceData.smallImageText = "creating"; - } else { - const at = document.location.pathname; - let doing; - if (at.includes("entertainment")) doing = "Entertainment"; - else if (at.includes("sports")) doing = "Sports"; - else if (at.includes("stickers")) doing = "Stickers"; - else if (at.includes("artist")) doing = "Artists"; - else if (at.includes("reaction")) doing = "Reactions"; + if (document.location.pathname === '/') { + presenceData.details = 'Browsing Gifs...' + presenceData.state = 'at Homepage' + presenceData.smallImageKey = Assets.Browsing + presenceData.smallImageText = 'browsing' + } + else if (document.location.pathname.includes('create/gifmaker')) { + presenceData.details = 'Creating a Gif' + presenceData.state = 'at Creation page' + presenceData.smallImageKey = Assets.Creating + presenceData.smallImageText = 'creating' + } + else { + const at = document.location.pathname + let doing + if (at.includes('entertainment')) + doing = 'Entertainment' + else if (at.includes('sports')) + doing = 'Sports' + else if (at.includes('stickers')) + doing = 'Stickers' + else if (at.includes('artist')) + doing = 'Artists' + else if (at.includes('reaction')) + doing = 'Reactions' - presenceData.details = "Browsing Gifs..."; - presenceData.state = `at ${doing} page`; - presenceData.smallImageKey = Assets.Browsing; - presenceData.smallImageText = "browsing"; - } + presenceData.details = 'Browsing Gifs...' + presenceData.state = `at ${doing} page` + presenceData.smallImageKey = Assets.Browsing + presenceData.smallImageText = 'browsing' + } - presence.setActivity(presenceData); -}); + presence.setActivity(presenceData) +}) diff --git a/websites/G/GitHub Codespaces/metadata.json b/websites/G/GitHub Codespaces/metadata.json index 3c20c3789c4e..c9608ad6fc0b 100644 --- a/websites/G/GitHub Codespaces/metadata.json +++ b/websites/G/GitHub Codespaces/metadata.json @@ -1,42 +1,42 @@ { - "$schema": "https://schemas.premid.app/metadata/1.12", - "apiVersion": 1, - "author": { - "name": "Snazzah", - "id": "158049329150427136" - }, - "service": "GitHub Codespaces", - "description": { - "en": "Contribute to projects without complicating your local setup. Spin up dev environments with a click — even for projects you haven't worked on before — and switch between them with ease.", - "nl": "Draag bij aan projecten zonder uw lokale installatie ingewikkelder te maken. Zet met één klik een ontwikkelomgeving op, zelfs voor projecten waar u nog niet eerder aan hebt gewerkt, en schakel er gemakkelijk tussen.", - "vi_VN": "Đóng góp và dự án mà không cần rối tung hệ thống của bạn. Tạo các một trường phát triển với chỉ một nhấp — ngay cả với các dự án bạn chưa từng làm — và luân phiên giữa chúng một cách dễ dàng." - }, - "url": "github.dev", - "regExp": "(.*[.])?github.dev", - "version": "1.0.29", - "logo": "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/logo.png", - "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/thumbnail.png", - "color": "#000000", - "category": "other", - "tags": [ - "programming", - "sharing", - "coding" - ], - "settings": [ - { - "id": "details", - "title": "Details Template", - "icon": "fas fa-info", - "value": "Editing %file%", - "placeholder": "can use %file%, %path%, %workspace%, %folder%, %workspaceOrFolder%, %ext%" - }, - { - "id": "state", - "title": "State Template", - "icon": "fas fa-bars", - "value": "Workspace: %workspace%", - "placeholder": "can use %file%, %path%, %workspace%, %folder%, %workspaceOrFolder%, %ext%" - } - ] -} \ No newline at end of file + "$schema": "https://schemas.premid.app/metadata/1.12", + "apiVersion": 1, + "author": { + "name": "Snazzah", + "id": "158049329150427136" + }, + "service": "GitHub Codespaces", + "description": { + "en": "Contribute to projects without complicating your local setup. Spin up dev environments with a click — even for projects you haven't worked on before — and switch between them with ease.", + "nl": "Draag bij aan projecten zonder uw lokale installatie ingewikkelder te maken. Zet met één klik een ontwikkelomgeving op, zelfs voor projecten waar u nog niet eerder aan hebt gewerkt, en schakel er gemakkelijk tussen.", + "vi_VN": "Đóng góp và dự án mà không cần rối tung hệ thống của bạn. Tạo các một trường phát triển với chỉ một nhấp — ngay cả với các dự án bạn chưa từng làm — và luân phiên giữa chúng một cách dễ dàng." + }, + "url": "github.dev", + "regExp": "(.*[.])?github.dev", + "version": "1.0.29", + "logo": "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/logo.png", + "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/thumbnail.png", + "color": "#000000", + "category": "other", + "tags": [ + "programming", + "sharing", + "coding" + ], + "settings": [ + { + "id": "details", + "title": "Details Template", + "icon": "fas fa-info", + "value": "Editing %file%", + "placeholder": "can use %file%, %path%, %workspace%, %folder%, %workspaceOrFolder%, %ext%" + }, + { + "id": "state", + "title": "State Template", + "icon": "fas fa-bars", + "value": "Workspace: %workspace%", + "placeholder": "can use %file%, %path%, %workspace%, %folder%, %workspaceOrFolder%, %ext%" + } + ] +} diff --git a/websites/G/GitHub Codespaces/presence.ts b/websites/G/GitHub Codespaces/presence.ts index 0a60d5c2cdc2..87cfc80202df 100644 --- a/websites/G/GitHub Codespaces/presence.ts +++ b/websites/G/GitHub Codespaces/presence.ts @@ -1,783 +1,679 @@ interface ImageKeyMap { - [key: string]: { image: string }; + [key: string]: { image: string } } const presence = new Presence({ - clientId: "778572824708775946", - }), - // Maps editor mode titles to respective images - langMap: ImageKeyMap = { - "arma header file": { image: "sqf" }, - actionscript: { image: "as" }, - autohotkey: { image: "ahk" }, - "babel javascript": { image: "babel" }, - batch: { image: "bat" }, - "c#": { image: "csharp" }, - "c++": { image: "cpp" }, - "cmake cache": { image: "cmake" }, - coffeescript: { image: "coffee" }, - "cuda c++": { image: "cuda" }, - diet: { image: "d" }, - "d++": { image: "d" }, - "dm script": { image: "dm" }, - "denizen script": { image: "denizen" }, - "dlangui markup language": { image: "d" }, - dockerfile: { image: "docker" }, - "embedded elixir": { image: "elixir" }, - "f#": { image: "fsharp" }, - gdscript: { image: "godot" }, - "git commit message": { image: "git" }, - "git rebase message": { image: "git" }, - "html (c#)": { image: "cshtml" }, - "html (embedded elixir)": { image: "elixir" }, - "html (twig)": { image: "twig" }, - hxml: { image: "haxe" }, - "haxe ast dump": { image: "haxe" }, - ignore: { image: "git" }, - jsonc: { image: "json" }, - javascript: { image: "js" }, - "javascript react": { image: "jsx" }, - "javascript for automation (jxa)": { image: "js" }, - "julia markdown": { image: "julia" }, - "literate haskell": { image: "haskell" }, - "markdown react": { image: "markdownx" }, - merlin: { image: "ocaml" }, - ocamlbuild: { image: "ocaml" }, - opam: { image: "ocaml" }, - nimble: { image: "nim" }, - "objective-c": { image: "objc" }, - "objective-c++": { image: "objc" }, - "perl 6": { image: "perl" }, - "plain text": { image: "txt" }, - reason: { image: "reasonml" }, - sass: { image: "scss" }, - "shell script": { image: "shell" }, - typescript: { image: "ts" }, - "typescript react": { image: "tsx" }, - "visual basic": { image: "vb" }, - "vue.js": { image: "vue" }, - "vue-postcss": { image: "postcss" }, - "vue-html": { image: "html" }, - xsl: { image: "xml" }, - webassembly: { image: "wasm" }, - "arsd.dscript": { image: "d" }, - "haxe.argument": { image: "haxe" }, - "haxe.type": { image: "haxe" }, - "ocaml.hover.info": { image: "ocaml" }, - "ocaml.hover.type": { image: "ocaml" }, - "reason.hover.info": { image: "reasonml" }, - "reason.hover.signature": { image: "reasonml" }, - "reason.hover.type": { image: "reasonml" }, - "jest-snapshot": { image: "jest" }, - erb: { image: "ruby" }, - "x86 and x86_64 Assembly": { image: "assembly" }, - // Auto-maps keys to identical image keys - }, - // https://github.com/iCrawl/discord-vscode/blob/master/src/data/languages.json - knownExtensions: ImageKeyMap = { - ".ahk": { image: "ahk" }, - ".ahkl": { image: "ahk" }, - "androidmanifest.xml": { image: "android" }, - "/^angular[^.]*\\.js$/i": { image: "angular" }, - ".applescript": { image: "applescript" }, - "/(\\.)?appveyor\\.yml/i": { image: "appveyor" }, - ".ino": { image: "arduino" }, - ".swf": { image: "as" }, - ".as": { image: "as" }, - ".jsfl": { image: "as" }, - ".swc": { image: "as" }, - ".asp": { image: "asp" }, - ".asax": { image: "asp" }, - ".ascx": { image: "asp" }, - ".ashx": { image: "asp" }, - ".asmx": { image: "asp" }, - ".aspx": { image: "asp" }, - ".axd": { image: "asp" }, - "/\\.setTrayTitle(l?a|[ls]?o|out|s|a51|asm|axf|elf|prx|puff|z80)$/i": { - image: "assembly", - }, - ".agc": { image: "assembly" }, - ".ko": { image: "assembly" }, - ".lst": { image: "assembly" }, - "/\\.setTrayTitle((c([+px]{2}?)?-?)?objdump|bsdiff|bin|dat|pak|pdb)$/i": { - image: "assembly", - }, - ".d-objdump": { image: "assembly" }, - "/\\.gcode|\\.gco/i": { image: "assembly" }, - "/\\.rpy[bc]$/i": { image: "assembly" }, - "/\\.py[co]$/i": { image: "assembly" }, - ".swp": { image: "assembly" }, - ".DS_Store": { image: "assembly" }, - ".au3": { image: "autoit" }, - "babel.config.js": { image: "babel" }, - "/\\.babelrc/i": { image: "babel" }, - ".bat": { image: "bat" }, - ".batch": { image: "bat" }, - ".cmd": { image: "bat" }, - "/\\.setTrayTitle(exe|com|msi)$/i": { image: "bat" }, - ".reg": { image: "bat" }, - "/^(\\.bowerrc|bower\\.json|Bowerfile)$/i": { image: "bower" }, - "/\\.bf?$/i": { image: "brainfuck" }, - "/\\.c$/i": { image: "c" }, - "/(cargo.toml|cargo.lock)/i": { image: "cargo" }, - "circle.yml": { image: "circleci" }, - ".clj": { image: "clojure" }, - ".cl2": { image: "clojure" }, - ".cljc": { image: "clojure" }, - ".cljx": { image: "clojure" }, - ".hic": { image: "clojure" }, - "/\\.cljs(cm)?$/i": { image: "clojure" }, - ".cmake": { image: "cmake" }, - "/^CMakeLists\\.txt$/": { image: "cmake" }, - "/\\.codeclimate\\.setTrayTitle(yml|json)/i": { image: "codeclimate" }, - ".coffee": { image: "coffee" }, - ".cjsx": { image: "coffee" }, - ".coffee.ecr": { image: "coffee" }, - ".coffee.erb": { image: "coffee" }, - ".litcoffee": { image: "coffee" }, - ".iced": { image: "coffee" }, - "/\\.c[+px]{2}$|\\.cc$/i": { image: "cpp" }, - "/\\.h[+px]{2}$/i": { image: "cpp" }, - "/\\.[it]pp$/i": { image: "cpp" }, - "/\\.setTrayTitle(tcc|inl)$/i": { image: "cpp" }, - ".cats": { image: "cpp" }, - ".idc": { image: "cpp" }, - ".w": { image: "cpp" }, - ".nc": { image: "cpp" }, - ".upc": { image: "cpp" }, - ".xpm": { image: "cpp" }, - "/\\.e?cr$/i": { image: "crystal" }, - ".cs": { image: "csharp" }, - ".csx": { image: "csharp" }, - ".cshtml": { image: "cshtml" }, - // ".css": { "image": "css" }, - ".css.map": { image: "cssmap" }, - ".cu": { image: "cuda" }, - "/\\.di?$/i": { image: "d" }, - ".dart": { image: "dart" }, - ".dfm": { image: "delphi" }, - ".dpr": { image: "delphi" }, - ".dsc": { image: "denizen" }, - ".dm": { image: "dm" }, - ".dme": { image: "dm" }, - ".dmm": { image: "dm" }, - "/^(Dockerfile|docker-compose)|\\.docker(file|ignore)$/i": { - image: "docker", - }, - "/^docker-sync\\.yml$/i": { image: "docker" }, - ".editorconfig": { image: "editorconfig" }, - ".ejs": { image: "ejs" }, - ".ex": { image: "elixir" }, - "/\\.setTrayTitle(exs|l?eex)$/i": { image: "elixir" }, - "/^mix\\.setTrayTitle(exs?|lock)$/i": { image: "elixir" }, - ".elm": { image: "elm" }, - ".env": { image: "env" }, - ".erl": { image: "erlang" }, - ".beam": { image: "erlang" }, - ".hrl": { image: "erlang" }, - ".xrl": { image: "erlang" }, - ".yrl": { image: "erlang" }, - ".app.src": { image: "erlang" }, - "/^Emakefile$/": { image: "erlang" }, - "/^rebar(\\.config)?\\.lock$/i": { image: "erlang" }, - "/\\.setTrayTitle(eslintrc|eslintignore)/i": { image: "eslint" }, - "/(\\.firebaserc|firebase\\.json)/i": { image: "firebase" }, - ".flowconfig": { image: "flowconfig" }, - ".fs": { image: "fsharp" }, - ".fsi": { image: "fsharp" }, - ".fsscript": { image: "fsharp" }, - ".fsx": { image: "fsharp" }, - "/gatsby-(browser|node|ssr|config)\\.js/i": { image: "gatsbyjs" }, - "/^Gemfile(\\.lock)?$/i": { image: "gemfile" }, - "/^\\.git|^\\.keep$|\\.mailmap$/i": { image: "git" }, - ".go": { image: "go" }, - ".gd": { image: "godot" }, - ".gradle": { image: "gradle" }, - gradlew: { image: "gradle" }, - ".gql": { image: "graphql" }, - ".graphql": { image: "graphql" }, - ".groovy": { image: "groovy" }, - ".gvy": { image: "groovy" }, - ".gy": { image: "groovy" }, - ".gsh": { image: "groovy" }, - "/gruntfile\\.setTrayTitle(js|coffee)/i": { image: "gruntfile" }, - "gulpfile.js": { image: "gulp" }, - "/\\.setTrayTitle(hbs|handlebars|(mu)?stache)$/i": { image: "handlebars" }, - ".prg": { image: "harbour" }, - ".hbp": { image: "harbour" }, - ".hbc": { image: "harbour" }, - ".rc": { image: "harbour" }, - ".fmg": { image: "harbour" }, - ".hs": { image: "haskell" }, - ".hsc": { image: "haskell" }, - ".c2hs": { image: "haskell" }, - ".lhs": { image: "haskell" }, - ".hx": { image: "haxe" }, - ".hxml": { image: "haxe" }, - "/^procfile/i": { image: "heroku" }, - "heroku.yml": { image: "heroku" }, - ".hjson": { image: "hjson" }, - "/\\.x?html?$/i": { image: "html" }, - ".http": { image: "http" }, - ".rest": { image: "http" }, - ".jar": { image: "java" }, - ".java": { image: "java" }, - "jest.config.js": { image: "jest" }, - // ".js": { "image": "js" }, - ".es6": { image: "js" }, - ".es": { image: "js" }, - ".mjs": { image: "js" }, - ".js.map": { image: "jsmap" }, - // ".json": { "image": "json" }, - ".jsonc": { image: "json" }, - ".jsx": { image: "jsx" }, - "/\\.setTrayTitle(jil|jl)/i": { image: "julia" }, - ".ipynb": { image: "jupyter" }, - ".kt": { image: "kotlin" }, - ".ktm": { image: "kotlin" }, - ".kts": { image: "kotlin" }, - ".less": { image: "less" }, - ".lsp": { image: "lisp" }, - ".lisp": { image: "lisp" }, - ".l": { image: "lisp" }, - ".nl": { image: "lisp" }, - ".ny": { image: "lisp" }, - ".podsl": { image: "lisp" }, - ".sexp": { image: "lisp" }, - ".ls": { image: "livescript" }, - ".log": { image: "log" }, - ".lua": { image: "lua" }, - ".pd_lua": { image: "lua" }, - ".rbxs": { image: "lua" }, - ".wlua": { image: "lua" }, - "/^Makefile/": { image: "makefile" }, - "/^mk\\.config$/": { image: "makefile" }, - "/\\.setTrayTitle(mk|mak|make)$/i": { image: "makefile" }, - "/^BSDmakefile$/i": { image: "makefile" }, - "/^GNUmakefile$/i": { image: "makefile" }, - "/^makefile\\.sco$/i": { image: "makefile" }, - "/^Kbuild$/": { image: "makefile" }, - "/^makefile$/": { image: "makefile" }, - "/^mkfile$/i": { image: "makefile" }, - "/^\\.?qmake$/i": { image: "makefile" }, - "/\\.setTrayTitle(h|geo|topo)$/i": { image: "manifest" }, - ".cson": { image: "manifest" }, - ".json5": { image: "manifest" }, - ".ndjson": { image: "manifest" }, - ".fea": { image: "manifest" }, - ".json.eex": { image: "manifest" }, - ".proto": { image: "manifest" }, - ".pytb": { image: "manifest" }, - ".pydeps": { image: "manifest" }, - "/\\.pot?$/i": { image: "manifest" }, - ".ejson": { image: "manifest" }, - ".edn": { image: "manifest" }, - ".eam.fs": { image: "manifest" }, - ".qml": { image: "manifest" }, - ".qbs": { image: "manifest" }, - ".ston": { image: "manifest" }, - ".ttl": { image: "manifest" }, - ".rviz": { image: "manifest" }, - ".syntax": { image: "manifest" }, - ".webmanifest": { image: "manifest" }, - "/^pkginfo$/": { image: "manifest" }, - "/^mime\\.types$/i": { image: "manifest" }, - "/^METADATA\\.pb$/": { image: "manifest" }, - "/[\\/\\\\](?:magic[\\/\\\\]Magdir|file[\\/\\\\]magic)[\\/\\\\][-.\\w]+$/i": - { - image: "manifest", - }, - "/(\\\\|\\/)dev[-\\w]+\\1(?:[^\\\\\\/]+\\1)*(?!DESC|NOTES)(?:[A-Z][-A-Z]*)(?:\\.in)?$/": - { - image: "manifest", - }, - "lib/icons/.icondb.js": { image: "manifest" }, - "/\\.git[\\/\\\\](.*[\\/\\\\])?(HEAD|ORIG_HEAD|packed-refs|logs[\\/\\\\](.+[\\/\\\\])?[^\\/\\\\]+)$/": - { - image: "manifest", - }, - "/\\.setTrayTitle(md|mdown|markdown|mkd|mkdown|mdwn|mkdn|rmd|ron|pmd)$/i": { - image: "markdown", - }, - ".mdx": { image: "markdownx" }, - ".marko": { image: "marko" }, - ".nim": { image: "nim" }, - ".nims": { image: "nim" }, - ".nimble": { image: "nim" }, - ".nix": { image: "nix" }, - "nodemon.json": { image: "nodemon" }, - ".npmrc": { image: "npm" }, - "/\\.mm?$/i": { image: "objc" }, - ".pch": { image: "objc" }, - ".x": { image: "objc" }, - ".ml": { image: "ocaml" }, - ".mli": { image: "ocaml" }, - ".eliom": { image: "ocaml" }, - ".eliomi": { image: "ocaml" }, - ".ml4": { image: "ocaml" }, - ".mll": { image: "ocaml" }, - ".mly": { image: "ocaml" }, - "/\\.pas(cal)?$/i": { image: "pascal" }, - ".lpr": { image: "pascal" }, - ".p": { image: "pawn" }, - ".inc": { image: "pawn" }, - ".sma": { image: "pawn" }, - ".pwn": { image: "pawn" }, - ".sp": { image: "pawn" }, - "/\\.p(er)?l$/i": { image: "perl" }, - ".al": { image: "perl" }, - ".ph": { image: "perl" }, - ".plx": { image: "perl" }, - ".pm": { image: "perl" }, - "/\\.setTrayTitle(psgi|xs)$/i": { image: "perl" }, - ".pl6": { image: "perl" }, - "/\\.[tp]6$|\\.6pl$/i": { image: "perl" }, - "/\\.setTrayTitle(pm6|p6m)$/i": { image: "perl" }, - ".6pm": { image: "perl" }, - ".nqp": { image: "perl" }, - ".p6l": { image: "perl" }, - ".pod6": { image: "perl" }, - "/^Rexfile$/": { image: "perl" }, - "/\\.php([st\\d]|_cs)?$/i": { image: "php" }, - "/^Phakefile/": { image: "php" }, - ".pony": { image: "ponylang" }, - ".pcss": { image: "postcss" }, - ".ps1": { image: "powershell" }, - ".psd1": { image: "powershell" }, - ".psm1": { image: "powershell" }, - ".ps1xml": { image: "powershell" }, - ".prettierignore": { image: "prettier" }, - "/\\.prettier((rc)|(\\.setTrayTitle(toml|yml|yaml|json|js))?$){2}/i": { - image: "prettier", - }, - "prettier.config.js": { image: "prettier" }, - "prisma.yml": { image: "prisma" }, - ".pde": { image: "processing" }, - ".jade": { image: "pug" }, - ".pug": { image: "pug" }, - ".purs": { image: "purescript" }, - ".py": { image: "python" }, - ".ipy": { image: "python" }, - ".isolate": { image: "python" }, - ".pep": { image: "python" }, - ".gyp": { image: "python" }, - ".gypi": { image: "python" }, - ".pyde": { image: "python" }, - ".pyp": { image: "python" }, - ".pyt": { image: "python" }, - ".py3": { image: "python" }, - ".pyi": { image: "python" }, - ".pyw": { image: "python" }, - ".tac": { image: "python" }, - ".wsgi": { image: "python" }, - ".xpy": { image: "python" }, - ".rpy": { image: "python" }, - "/\\.?(pypirc|pythonrc|python-venv)$/i": { image: "python" }, - "/^(SConstruct|SConscript)$/": { image: "python" }, - "/^(Snakefile|WATCHLISTS)$/": { image: "python" }, - "/^wscript$/": { image: "python" }, - "/\\.setTrayTitle(r|Rprofile|rsx|rd)$/i": { image: "r" }, - ".re": { image: "reasonml" }, - "/\\.setTrayTitle(rb|ru|ruby|erb|gemspec|god|mspec|pluginspec|podspec|rabl|rake|opal)$/i": - { - image: "ruby", - }, - "/^\\.?(irbrc|gemrc|pryrc|ruby-(gemset|version))$/i": { image: "ruby" }, - "/^(Appraisals|(Rake|[bB]uild|Cap|Danger|Deliver|Fast|Guard|Jar|Maven|Pod|Puppet|Snap)file(\\.lock)?)$/": - { - image: "ruby", - }, - "/\\.setTrayTitle(jbuilder|rbuild|rb[wx]|builder)$/i": { image: "ruby" }, - "/^rails$/": { image: "ruby" }, - ".watchr": { image: "ruby" }, - ".rs": { image: "rust" }, - "/\\.setTrayTitle(sc|scala)$/i": { image: "scala" }, - ".scss": { image: "scss" }, - ".sass": { image: "scss" }, - "/\\.setTrayTitle(sh|rc|bats|bash|tool|install|command)$/i": { - image: "shell", - }, - "/^(\\.?bash(rc|[-_]?(profile|login|logout|history|prompt))|_osc|config|install-sh|PKGBUILD)$/i": - { - image: "shell", - }, - "/\\.setTrayTitle(ksh|mksh|pdksh)$/i": { image: "shell" }, - ".sh-session": { image: "shell" }, - "/\\.zsh(-theme|_history)?$|^\\.?(antigen|zpreztorc|zlogin|zlogout|zprofile|zshenv|zshrc)$/i": - { - image: "shell", - }, - "/\\.fish$|^\\.fishrc$/i": { image: "shell" }, - "/^\\.?(login|profile)$/": { image: "shell" }, - ".inputrc": { image: "shell" }, - ".tmux": { image: "shell" }, - "/^(configure|config\\.setTrayTitle(guess|rpath|status|sub)|depcomp|libtool|compile)$/": - { - image: "shell", - }, - "/^\\/(private\\/)?etc\\/([^\\/]+\\/)*(profile$|nanorc$|rc\\.|csh\\.)/i": { - image: "shell", - }, - "/^\\.?cshrc$/i": { image: "shell" }, - ".profile": { image: "shell" }, - ".tcsh": { image: "shell" }, - ".csh": { image: "shell" }, - ".sqf": { image: "sqf" }, - "/\\.setTrayTitle(my)?sql$/i": { image: "sql" }, - ".ddl": { image: "sql" }, - ".udf": { image: "sql" }, - ".hql": { image: "sql" }, - ".viw": { image: "sql" }, - ".prc": { image: "sql" }, - ".cql": { image: "sql" }, - ".db2": { image: "sql" }, - "/\\.setTrayTitle(styl|stylus)$/i": { image: "stylus" }, - ".svelte": { image: "svelte" }, - ".svg": { image: "svg" }, - ".swift": { image: "swift" }, - ".tex": { image: "tex" }, - ".ltx": { image: "tex" }, - ".aux": { image: "tex" }, - ".sty": { image: "tex" }, - ".dtx": { image: "tex" }, - ".cls": { image: "tex" }, - ".ins": { image: "tex" }, - ".lbx": { image: "tex" }, - ".mkiv": { image: "tex" }, - ".mkvi": { image: "tex" }, - ".mkii": { image: "tex" }, - ".texi": { image: "tex" }, - "/^hyphen(ex)?\\.setTrayTitle(cs|den|det|fr|sv|us)$/": { image: "tex" }, - "/\\.te?xt$/i": { image: "text" }, - ".rtf": { image: "text" }, - "/\\.i?nfo$/i": { image: "text" }, - ".msg": { image: "text" }, - "/\\.setTrayTitle(utxt|utf8)$/i": { image: "text" }, - ".toml": { image: "toml" }, - ".travis.yml": { image: "travis" }, - ".ts": { image: "ts" }, - ".tsx": { image: "tsx" }, - ".twig": { image: "twig" }, - ".v": { image: "v" }, - ".vh": { image: "v" }, - ".vala": { image: "vala" }, - ".vapi": { image: "vala" }, - ".vb": { image: "vb" }, - ".vbs": { image: "vb" }, - ".vbhtml": { image: "vb" }, - ".vbproj": { image: "vb" }, - ".vba": { image: "vba" }, - ".vcxproj": { image: "vcxproj" }, - ".vscodeignore": { image: "vscodeignore" }, - ".vue": { image: "vue" }, - ".wat": { image: "wasm" }, - ".wast": { image: "wasm" }, - ".wasm": { image: "wasm" }, - "/webpack(\\.dev|\\.development|\\.prod|\\.production)?\\.config(\\.babel)?\\.setTrayTitle(js|jsx|coffee|ts|json|json5|yaml|yml)/i": - { - image: "webpack", - }, - ".xml": { image: "xml" }, - "/\\.ya?ml$/i": { image: "yaml" }, - "/^yarn(\\.lock)?$/i": { image: "yarn" }, - ".yarnrc": { image: "yarn" }, - ".zig": { image: "zig" }, - - ".json": { image: "json" }, - ".js": { image: "js" }, - ".css": { image: "css" }, - }, - assets = { - arduino: - "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/0.png", - appveyor: - "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/1.png", - assembly: - "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/2.png", - ahk: "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/3.png", - angular: - "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/4.png", - android: - "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/5.png", - as: "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/6.png", - applescript: - "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/7.png", - c: "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/8.png", - asp: "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/9.png", - bower: - "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/10.png", - bat: "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/11.png", - autoit: - "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/12.png", - cargo: - "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/13.png", - cmake: - "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/14.png", - clojure: - "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/15.png", - circleci: - "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/16.png", - brainfuck: - "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/17.png", - css: "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/18.png", - crystal: - "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/19.png", - elm: "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/20.png", - cshtml: - "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/21.png", - docker: - "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/22.png", - cssmap: - "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/23.png", - coffee: - "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/24.png", - dart: "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/25.png", - dm: "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/26.png", - elixir: - "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/27.png", - d: "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/28.png", - cuda: "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/29.png", - denizen: - "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/30.png", - cpp: "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/31.png", - ejs: "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/32.png", - delphi: - "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/33.png", - csharp: - "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/34.png", - editorconfig: - "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/35.png", - fsharp: - "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/36.png", - flowconfig: - "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/37.png", - env: "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/38.png", - firebase: - "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/39.png", - git: "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/40.png", - gemfile: - "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/41.png", - haskell: - "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/42.png", - erlang: - "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/43.png", - heroku: - "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/44.png", - gradle: - "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/45.png", - go: "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/46.png", - handlebars: - "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/47.png", - eslint: - "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/48.png", - haxe: "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/49.png", - harbour: - "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/50.png", - gulp: "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/51.png", - godot: - "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/52.png", - graphql: - "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/53.png", - groovy: - "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/54.png", - gruntfile: - "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/55.png", - json: "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/56.png", - julia: - "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/57.png", - log: "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/58.png", - hjson: - "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/59.png", - jsx: "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/60.png", - js: "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/61.png", - jsmap: - "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/62.png", - makefile: - "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/63.png", - kotlin: - "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/64.png", - html: "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/65.png", - http: "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/66.png", - lua: "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/67.png", - less: "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/68.png", - livescript: - "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/69.png", - jest: "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/70.png", - java: "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/71.png", - lisp: "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/72.png", - jupyter: - "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/73.png", - manifest: - "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/74.png", - marko: - "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/75.png", - npm: "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/76.png", - nim: "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/77.png", - markdownx: - "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/78.png", - markdown: - "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/79.png", - nodemon: - "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/80.png", - r: "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/81.png", - prisma: - "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/82.png", - reasonml: - "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/83.png", - python: - "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/84.png", - php: "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/85.png", - powershell: - "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/86.png", - ocaml: - "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/87.png", - perl: "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/88.png", - prettier: - "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/89.png", - pawn: "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/90.png", - purescript: - "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/91.png", - objc: "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/92.png", - ponylang: - "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/93.png", - postcss: - "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/94.png", - pug: "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/95.png", - pascal: - "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/96.png", - processing: - "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/97.png", - ruby: "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/98.png", - rust: "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/99.png", - scss: "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/100.png", - stylus: - "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/101.png", - shell: - "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/102.png", - scala: - "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/103.png", - sqf: "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/104.png", - sql: "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/105.png", - svelte: - "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/106.png", - swift: - "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/107.png", - svg: "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/108.png", - toml: "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/109.png", - txt: "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/110.png", - travis: - "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/111.png", - tex: "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/112.png", - text: "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/113.png", - tsx: "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/114.png", - ts: "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/115.png", - v: "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/116.png", - yaml: "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/117.png", - vb: "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/118.png", - vcxproj: - "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/119.png", - yarn: "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/120.png", - wasm: "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/121.png", - vala: "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/122.png", - xml: "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/123.png", - vue: "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/124.png", - vba: "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/125.png", - vscodeignore: - "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/126.png", - zig: "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/127.png", - webpack: - "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/128.png", - twig: "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/129.png", - gatsbyjs: - "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/130.png", - }; + clientId: '778572824708775946', +}) +// Maps editor mode titles to respective images +const langMap: ImageKeyMap = { + 'arma header file': { image: 'sqf' }, + 'actionscript': { image: 'as' }, + 'autohotkey': { image: 'ahk' }, + 'babel javascript': { image: 'babel' }, + 'batch': { image: 'bat' }, + 'c#': { image: 'csharp' }, + 'c++': { image: 'cpp' }, + 'cmake cache': { image: 'cmake' }, + 'coffeescript': { image: 'coffee' }, + 'cuda c++': { image: 'cuda' }, + 'diet': { image: 'd' }, + 'd++': { image: 'd' }, + 'dm script': { image: 'dm' }, + 'denizen script': { image: 'denizen' }, + 'dlangui markup language': { image: 'd' }, + 'dockerfile': { image: 'docker' }, + 'embedded elixir': { image: 'elixir' }, + 'f#': { image: 'fsharp' }, + 'gdscript': { image: 'godot' }, + 'git commit message': { image: 'git' }, + 'git rebase message': { image: 'git' }, + 'html (c#)': { image: 'cshtml' }, + 'html (embedded elixir)': { image: 'elixir' }, + 'html (twig)': { image: 'twig' }, + 'hxml': { image: 'haxe' }, + 'haxe ast dump': { image: 'haxe' }, + 'ignore': { image: 'git' }, + 'jsonc': { image: 'json' }, + 'javascript': { image: 'js' }, + 'javascript react': { image: 'jsx' }, + 'javascript for automation (jxa)': { image: 'js' }, + 'julia markdown': { image: 'julia' }, + 'literate haskell': { image: 'haskell' }, + 'markdown react': { image: 'markdownx' }, + 'merlin': { image: 'ocaml' }, + 'ocamlbuild': { image: 'ocaml' }, + 'opam': { image: 'ocaml' }, + 'nimble': { image: 'nim' }, + 'objective-c': { image: 'objc' }, + 'objective-c++': { image: 'objc' }, + 'perl 6': { image: 'perl' }, + 'plain text': { image: 'txt' }, + 'reason': { image: 'reasonml' }, + 'sass': { image: 'scss' }, + 'shell script': { image: 'shell' }, + 'typescript': { image: 'ts' }, + 'typescript react': { image: 'tsx' }, + 'visual basic': { image: 'vb' }, + 'vue.js': { image: 'vue' }, + 'vue-postcss': { image: 'postcss' }, + 'vue-html': { image: 'html' }, + 'xsl': { image: 'xml' }, + 'webassembly': { image: 'wasm' }, + 'arsd.dscript': { image: 'd' }, + 'haxe.argument': { image: 'haxe' }, + 'haxe.type': { image: 'haxe' }, + 'ocaml.hover.info': { image: 'ocaml' }, + 'ocaml.hover.type': { image: 'ocaml' }, + 'reason.hover.info': { image: 'reasonml' }, + 'reason.hover.signature': { image: 'reasonml' }, + 'reason.hover.type': { image: 'reasonml' }, + 'jest-snapshot': { image: 'jest' }, + 'erb': { image: 'ruby' }, + 'x86 and x86_64 Assembly': { image: 'assembly' }, + // Auto-maps keys to identical image keys +} +// https://github.com/iCrawl/discord-vscode/blob/master/src/data/languages.json +const knownExtensions: ImageKeyMap = { + '.ahk': { image: 'ahk' }, + '.ahkl': { image: 'ahk' }, + 'androidmanifest.xml': { image: 'android' }, + '/^angular[^.]*\\.js$/i': { image: 'angular' }, + '.applescript': { image: 'applescript' }, + '/(\\.)?appveyor\\.yml/i': { image: 'appveyor' }, + '.ino': { image: 'arduino' }, + '.swf': { image: 'as' }, + '.as': { image: 'as' }, + '.jsfl': { image: 'as' }, + '.swc': { image: 'as' }, + '.asp': { image: 'asp' }, + '.asax': { image: 'asp' }, + '.ascx': { image: 'asp' }, + '.ashx': { image: 'asp' }, + '.asmx': { image: 'asp' }, + '.aspx': { image: 'asp' }, + '.axd': { image: 'asp' }, + '/\\.setTrayTitle(l?a|[ls]?o|out|s|a51|asm|axf|elf|prx|puff|z80)$/i': { + image: 'assembly', + }, + '.agc': { image: 'assembly' }, + '.ko': { image: 'assembly' }, + '.lst': { image: 'assembly' }, + '/\\.setTrayTitle((c([+px]{2}?)?-?)?objdump|bsdiff|bin|dat|pak|pdb)$/i': { + image: 'assembly', + }, + '.d-objdump': { image: 'assembly' }, + '/\\.gcode|\\.gco/i': { image: 'assembly' }, + '/\\.rpy[bc]$/i': { image: 'assembly' }, + '/\\.py[co]$/i': { image: 'assembly' }, + '.swp': { image: 'assembly' }, + '.DS_Store': { image: 'assembly' }, + '.au3': { image: 'autoit' }, + 'babel.config.js': { image: 'babel' }, + '/\\.babelrc/i': { image: 'babel' }, + '.bat': { image: 'bat' }, + '.batch': { image: 'bat' }, + '.cmd': { image: 'bat' }, + '/\\.setTrayTitle(exe|com|msi)$/i': { image: 'bat' }, + '.reg': { image: 'bat' }, + '/^(\\.bowerrc|bower\\.json|Bowerfile)$/i': { image: 'bower' }, + '/\\.bf?$/i': { image: 'brainfuck' }, + '/\\.c$/i': { image: 'c' }, + '/(cargo.toml|cargo.lock)/i': { image: 'cargo' }, + 'circle.yml': { image: 'circleci' }, + '.clj': { image: 'clojure' }, + '.cl2': { image: 'clojure' }, + '.cljc': { image: 'clojure' }, + '.cljx': { image: 'clojure' }, + '.hic': { image: 'clojure' }, + '/\\.cljs(cm)?$/i': { image: 'clojure' }, + '.cmake': { image: 'cmake' }, + '/^CMakeLists\\.txt$/': { image: 'cmake' }, + '/\\.codeclimate\\.setTrayTitle(yml|json)/i': { image: 'codeclimate' }, + '.coffee': { image: 'coffee' }, + '.cjsx': { image: 'coffee' }, + '.coffee.ecr': { image: 'coffee' }, + '.coffee.erb': { image: 'coffee' }, + '.litcoffee': { image: 'coffee' }, + '.iced': { image: 'coffee' }, + '/\\.c[+px]{2}$|\\.cc$/i': { image: 'cpp' }, + '/\\.h[+px]{2}$/i': { image: 'cpp' }, + '/\\.[it]pp$/i': { image: 'cpp' }, + '/\\.setTrayTitle(tcc|inl)$/i': { image: 'cpp' }, + '.cats': { image: 'cpp' }, + '.idc': { image: 'cpp' }, + '.w': { image: 'cpp' }, + '.nc': { image: 'cpp' }, + '.upc': { image: 'cpp' }, + '.xpm': { image: 'cpp' }, + '/\\.e?cr$/i': { image: 'crystal' }, + '.cs': { image: 'csharp' }, + '.csx': { image: 'csharp' }, + '.cshtml': { image: 'cshtml' }, + // ".css": { "image": "css" }, + '.css.map': { image: 'cssmap' }, + '.cu': { image: 'cuda' }, + '/\\.di?$/i': { image: 'd' }, + '.dart': { image: 'dart' }, + '.dfm': { image: 'delphi' }, + '.dpr': { image: 'delphi' }, + '.dsc': { image: 'denizen' }, + '.dm': { image: 'dm' }, + '.dme': { image: 'dm' }, + '.dmm': { image: 'dm' }, + '/^(Dockerfile|docker-compose)|\\.docker(file|ignore)$/i': { + image: 'docker', + }, + '/^docker-sync\\.yml$/i': { image: 'docker' }, + '.editorconfig': { image: 'editorconfig' }, + '.ejs': { image: 'ejs' }, + '.ex': { image: 'elixir' }, + '/\\.setTrayTitle(exs|l?eex)$/i': { image: 'elixir' }, + '/^mix\\.setTrayTitle(exs?|lock)$/i': { image: 'elixir' }, + '.elm': { image: 'elm' }, + '.env': { image: 'env' }, + '.erl': { image: 'erlang' }, + '.beam': { image: 'erlang' }, + '.hrl': { image: 'erlang' }, + '.xrl': { image: 'erlang' }, + '.yrl': { image: 'erlang' }, + '.app.src': { image: 'erlang' }, + '/^Emakefile$/': { image: 'erlang' }, + '/^rebar(\\.config)?\\.lock$/i': { image: 'erlang' }, + '/\\.setTrayTitle(eslintrc|eslintignore)/i': { image: 'eslint' }, + '/(\\.firebaserc|firebase\\.json)/i': { image: 'firebase' }, + '.flowconfig': { image: 'flowconfig' }, + '.fs': { image: 'fsharp' }, + '.fsi': { image: 'fsharp' }, + '.fsscript': { image: 'fsharp' }, + '.fsx': { image: 'fsharp' }, + '/gatsby-(browser|node|ssr|config)\\.js/i': { image: 'gatsbyjs' }, + '/^Gemfile(\\.lock)?$/i': { image: 'gemfile' }, + '/^\\.git|^\\.keep$|\\.mailmap$/i': { image: 'git' }, + '.go': { image: 'go' }, + '.gd': { image: 'godot' }, + '.gradle': { image: 'gradle' }, + 'gradlew': { image: 'gradle' }, + '.gql': { image: 'graphql' }, + '.graphql': { image: 'graphql' }, + '.groovy': { image: 'groovy' }, + '.gvy': { image: 'groovy' }, + '.gy': { image: 'groovy' }, + '.gsh': { image: 'groovy' }, + '/gruntfile\\.setTrayTitle(js|coffee)/i': { image: 'gruntfile' }, + 'gulpfile.js': { image: 'gulp' }, + '/\\.setTrayTitle(hbs|handlebars|(mu)?stache)$/i': { image: 'handlebars' }, + '.prg': { image: 'harbour' }, + '.hbp': { image: 'harbour' }, + '.hbc': { image: 'harbour' }, + '.rc': { image: 'harbour' }, + '.fmg': { image: 'harbour' }, + '.hs': { image: 'haskell' }, + '.hsc': { image: 'haskell' }, + '.c2hs': { image: 'haskell' }, + '.lhs': { image: 'haskell' }, + '.hx': { image: 'haxe' }, + '.hxml': { image: 'haxe' }, + '/^procfile/i': { image: 'heroku' }, + 'heroku.yml': { image: 'heroku' }, + '.hjson': { image: 'hjson' }, + '/\\.x?html?$/i': { image: 'html' }, + '.http': { image: 'http' }, + '.rest': { image: 'http' }, + '.jar': { image: 'java' }, + '.java': { image: 'java' }, + 'jest.config.js': { image: 'jest' }, + // ".js": { "image": "js" }, + '.es6': { image: 'js' }, + '.es': { image: 'js' }, + '.mjs': { image: 'js' }, + '.js.map': { image: 'jsmap' }, + // ".json": { "image": "json" }, + '.jsonc': { image: 'json' }, + '.jsx': { image: 'jsx' }, + '/\\.setTrayTitle(jil|jl)/i': { image: 'julia' }, + '.ipynb': { image: 'jupyter' }, + '.kt': { image: 'kotlin' }, + '.ktm': { image: 'kotlin' }, + '.kts': { image: 'kotlin' }, + '.less': { image: 'less' }, + '.lsp': { image: 'lisp' }, + '.lisp': { image: 'lisp' }, + '.l': { image: 'lisp' }, + '.nl': { image: 'lisp' }, + '.ny': { image: 'lisp' }, + '.podsl': { image: 'lisp' }, + '.sexp': { image: 'lisp' }, + '.ls': { image: 'livescript' }, + '.log': { image: 'log' }, + '.lua': { image: 'lua' }, + '.pd_lua': { image: 'lua' }, + '.rbxs': { image: 'lua' }, + '.wlua': { image: 'lua' }, + '/^Makefile/': { image: 'makefile' }, + '/^mk\\.config$/': { image: 'makefile' }, + '/\\.setTrayTitle(mk|mak|make)$/i': { image: 'makefile' }, + '/^BSDmakefile$/i': { image: 'makefile' }, + '/^GNUmakefile$/i': { image: 'makefile' }, + '/^makefile\\.sco$/i': { image: 'makefile' }, + '/^Kbuild$/': { image: 'makefile' }, + '/^makefile$/': { image: 'makefile' }, + '/^mkfile$/i': { image: 'makefile' }, + '/^\\.?qmake$/i': { image: 'makefile' }, + '/\\.setTrayTitle(h|geo|topo)$/i': { image: 'manifest' }, + '.cson': { image: 'manifest' }, + '.json5': { image: 'manifest' }, + '.ndjson': { image: 'manifest' }, + '.fea': { image: 'manifest' }, + '.json.eex': { image: 'manifest' }, + '.proto': { image: 'manifest' }, + '.pytb': { image: 'manifest' }, + '.pydeps': { image: 'manifest' }, + '/\\.pot?$/i': { image: 'manifest' }, + '.ejson': { image: 'manifest' }, + '.edn': { image: 'manifest' }, + '.eam.fs': { image: 'manifest' }, + '.qml': { image: 'manifest' }, + '.qbs': { image: 'manifest' }, + '.ston': { image: 'manifest' }, + '.ttl': { image: 'manifest' }, + '.rviz': { image: 'manifest' }, + '.syntax': { image: 'manifest' }, + '.webmanifest': { image: 'manifest' }, + '/^pkginfo$/': { image: 'manifest' }, + '/^mime\\.types$/i': { image: 'manifest' }, + '/^METADATA\\.pb$/': { image: 'manifest' }, + '/[\\/\\\\](?:magic[\\/\\\\]Magdir|file[\\/\\\\]magic)[\\/\\\\][-.\\w]+$/i': { image: 'manifest' }, + '/(\\\\|\\/)dev[-\\w]+\\1(?:[^\\\\\\/]+\\1)*(?!DESC|NOTES)(?:[A-Z][-A-Z]*)(?:\\.in)?$/': { image: 'manifest' }, + 'lib/icons/.icondb.js': { image: 'manifest' }, + '/\\.git[\\/\\\\](.*[\\/\\\\])?(HEAD|ORIG_HEAD|packed-refs|logs[\\/\\\\](.+[\\/\\\\])?[^\\/\\\\]+)$/': { image: 'manifest' }, + '/\\.setTrayTitle(md|mdown|markdown|mkd|mkdown|mdwn|mkdn|rmd|ron|pmd)$/i': { image: 'markdown' }, + '.mdx': { image: 'markdownx' }, + '.marko': { image: 'marko' }, + '.nim': { image: 'nim' }, + '.nims': { image: 'nim' }, + '.nimble': { image: 'nim' }, + '.nix': { image: 'nix' }, + 'nodemon.json': { image: 'nodemon' }, + '.npmrc': { image: 'npm' }, + '/\\.mm?$/i': { image: 'objc' }, + '.pch': { image: 'objc' }, + '.x': { image: 'objc' }, + '.ml': { image: 'ocaml' }, + '.mli': { image: 'ocaml' }, + '.eliom': { image: 'ocaml' }, + '.eliomi': { image: 'ocaml' }, + '.ml4': { image: 'ocaml' }, + '.mll': { image: 'ocaml' }, + '.mly': { image: 'ocaml' }, + '/\\.pas(cal)?$/i': { image: 'pascal' }, + '.lpr': { image: 'pascal' }, + '.p': { image: 'pawn' }, + '.inc': { image: 'pawn' }, + '.sma': { image: 'pawn' }, + '.pwn': { image: 'pawn' }, + '.sp': { image: 'pawn' }, + '/\\.p(er)?l$/i': { image: 'perl' }, + '.al': { image: 'perl' }, + '.ph': { image: 'perl' }, + '.plx': { image: 'perl' }, + '.pm': { image: 'perl' }, + '/\\.setTrayTitle(psgi|xs)$/i': { image: 'perl' }, + '.pl6': { image: 'perl' }, + '/\\.[tp]6$|\\.6pl$/i': { image: 'perl' }, + '/\\.setTrayTitle(pm6|p6m)$/i': { image: 'perl' }, + '.6pm': { image: 'perl' }, + '.nqp': { image: 'perl' }, + '.p6l': { image: 'perl' }, + '.pod6': { image: 'perl' }, + '/^Rexfile$/': { image: 'perl' }, + '/\\.php([st\\d]|_cs)?$/i': { image: 'php' }, + '/^Phakefile/': { image: 'php' }, + '.pony': { image: 'ponylang' }, + '.pcss': { image: 'postcss' }, + '.ps1': { image: 'powershell' }, + '.psd1': { image: 'powershell' }, + '.psm1': { image: 'powershell' }, + '.ps1xml': { image: 'powershell' }, + '.prettierignore': { image: 'prettier' }, + '/\\.prettier((rc)|(\\.setTrayTitle(toml|yml|yaml|json|js))?$){2}/i': { image: 'prettier' }, + 'prettier.config.js': { image: 'prettier' }, + 'prisma.yml': { image: 'prisma' }, + '.pde': { image: 'processing' }, + '.jade': { image: 'pug' }, + '.pug': { image: 'pug' }, + '.purs': { image: 'purescript' }, + '.py': { image: 'python' }, + '.ipy': { image: 'python' }, + '.isolate': { image: 'python' }, + '.pep': { image: 'python' }, + '.gyp': { image: 'python' }, + '.gypi': { image: 'python' }, + '.pyde': { image: 'python' }, + '.pyp': { image: 'python' }, + '.pyt': { image: 'python' }, + '.py3': { image: 'python' }, + '.pyi': { image: 'python' }, + '.pyw': { image: 'python' }, + '.tac': { image: 'python' }, + '.wsgi': { image: 'python' }, + '.xpy': { image: 'python' }, + '.rpy': { image: 'python' }, + '/\\.?(pypirc|pythonrc|python-venv)$/i': { image: 'python' }, + '/^(SConstruct|SConscript)$/': { image: 'python' }, + '/^(Snakefile|WATCHLISTS)$/': { image: 'python' }, + '/^wscript$/': { image: 'python' }, + '/\\.setTrayTitle(r|Rprofile|rsx|rd)$/i': { image: 'r' }, + '.re': { image: 'reasonml' }, + '/\\.setTrayTitle(rb|ru|ruby|erb|gemspec|god|mspec|pluginspec|podspec|rabl|rake|opal)$/i': { image: 'ruby' }, + '/^\\.?(irbrc|gemrc|pryrc|ruby-(gemset|version))$/i': { image: 'ruby' }, + '/^(Appraisals|(Rake|[bB]uild|Cap|Danger|Deliver|Fast|Guard|Jar|Maven|Pod|Puppet|Snap)file(\\.lock)?)$/': { image: 'ruby' }, + '/\\.setTrayTitle(jbuilder|rbuild|rb[wx]|builder)$/i': { image: 'ruby' }, + '/^rails$/': { image: 'ruby' }, + '.watchr': { image: 'ruby' }, + '.rs': { image: 'rust' }, + '/\\.setTrayTitle(sc|scala)$/i': { image: 'scala' }, + '.scss': { image: 'scss' }, + '.sass': { image: 'scss' }, + '/\\.setTrayTitle(sh|rc|bats|bash|tool|install|command)$/i': { image: 'shell' }, + '/^(\\.?bash(rc|[-_]?(profile|login|logout|history|prompt))|_osc|config|install-sh|PKGBUILD)$/i': { image: 'shell' }, + '/\\.setTrayTitle(ksh|mksh|pdksh)$/i': { image: 'shell' }, + '.sh-session': { image: 'shell' }, + '/\\.zsh(-theme|_history)?$|^\\.?(antigen|zpreztorc|zlogin|zlogout|zprofile|zshenv|zshrc)$/i': { image: 'shell' }, + '/\\.fish$|^\\.fishrc$/i': { image: 'shell' }, + '/^\\.?(login|profile)$/': { image: 'shell' }, + '.inputrc': { image: 'shell' }, + '.tmux': { image: 'shell' }, + '/^(configure|config\\.setTrayTitle(guess|rpath|status|sub)|depcomp|libtool|compile)$/': { image: 'shell' }, + '/^\\/(private\\/)?etc\\/([^\\/]+\\/)*(profile$|nanorc$|rc\\.|csh\\.)/i': { image: 'shell' }, + '/^\\.?cshrc$/i': { image: 'shell' }, + '.profile': { image: 'shell' }, + '.tcsh': { image: 'shell' }, + '.csh': { image: 'shell' }, + '.sqf': { image: 'sqf' }, + '/\\.setTrayTitle(my)?sql$/i': { image: 'sql' }, + '.ddl': { image: 'sql' }, + '.udf': { image: 'sql' }, + '.hql': { image: 'sql' }, + '.viw': { image: 'sql' }, + '.prc': { image: 'sql' }, + '.cql': { image: 'sql' }, + '.db2': { image: 'sql' }, + '/\\.setTrayTitle(styl|stylus)$/i': { image: 'stylus' }, + '.svelte': { image: 'svelte' }, + '.svg': { image: 'svg' }, + '.swift': { image: 'swift' }, + '.tex': { image: 'tex' }, + '.ltx': { image: 'tex' }, + '.aux': { image: 'tex' }, + '.sty': { image: 'tex' }, + '.dtx': { image: 'tex' }, + '.cls': { image: 'tex' }, + '.ins': { image: 'tex' }, + '.lbx': { image: 'tex' }, + '.mkiv': { image: 'tex' }, + '.mkvi': { image: 'tex' }, + '.mkii': { image: 'tex' }, + '.texi': { image: 'tex' }, + '/^hyphen(ex)?\\.setTrayTitle(cs|den|det|fr|sv|us)$/': { image: 'tex' }, + '/\\.te?xt$/i': { image: 'text' }, + '.rtf': { image: 'text' }, + '/\\.i?nfo$/i': { image: 'text' }, + '.msg': { image: 'text' }, + '/\\.setTrayTitle(utxt|utf8)$/i': { image: 'text' }, + '.toml': { image: 'toml' }, + '.travis.yml': { image: 'travis' }, + '.ts': { image: 'ts' }, + '.tsx': { image: 'tsx' }, + '.twig': { image: 'twig' }, + '.v': { image: 'v' }, + '.vh': { image: 'v' }, + '.vala': { image: 'vala' }, + '.vapi': { image: 'vala' }, + '.vb': { image: 'vb' }, + '.vbs': { image: 'vb' }, + '.vbhtml': { image: 'vb' }, + '.vbproj': { image: 'vb' }, + '.vba': { image: 'vba' }, + '.vcxproj': { image: 'vcxproj' }, + '.vscodeignore': { image: 'vscodeignore' }, + '.vue': { image: 'vue' }, + '.wat': { image: 'wasm' }, + '.wast': { image: 'wasm' }, + '.wasm': { image: 'wasm' }, + '/webpack(\\.dev|\\.development|\\.prod|\\.production)?\\.config(\\.babel)?\\.setTrayTitle(js|jsx|coffee|ts|json|json5|yaml|yml)/i': { image: 'webpack' }, + '.xml': { image: 'xml' }, + '/\\.ya?ml$/i': { image: 'yaml' }, + '/^yarn(\\.lock)?$/i': { image: 'yarn' }, + '.yarnrc': { image: 'yarn' }, + '.zig': { image: 'zig' }, + '.json': { image: 'json' }, + '.js': { image: 'js' }, + '.css': { image: 'css' }, +} +const assets = { + arduino: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/0.png', + appveyor: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/1.png', + assembly: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/2.png', + ahk: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/3.png', + angular: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/4.png', + android: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/5.png', + as: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/6.png', + applescript: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/7.png', + c: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/8.png', + asp: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/9.png', + bower: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/10.png', + bat: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/11.png', + autoit: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/12.png', + cargo: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/13.png', + cmake: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/14.png', + clojure: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/15.png', + circleci: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/16.png', + brainfuck: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/17.png', + css: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/18.png', + crystal: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/19.png', + elm: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/20.png', + cshtml: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/21.png', + docker: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/22.png', + cssmap: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/23.png', + coffee: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/24.png', + dart: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/25.png', + dm: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/26.png', + elixir: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/27.png', + d: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/28.png', + cuda: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/29.png', + denizen: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/30.png', + cpp: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/31.png', + ejs: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/32.png', + delphi: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/33.png', + csharp: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/34.png', + editorconfig: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/35.png', + fsharp: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/36.png', + flowconfig: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/37.png', + env: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/38.png', + firebase: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/39.png', + git: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/40.png', + gemfile: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/41.png', + haskell: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/42.png', + erlang: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/43.png', + heroku: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/44.png', + gradle: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/45.png', + go: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/46.png', + handlebars: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/47.png', + eslint: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/48.png', + haxe: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/49.png', + harbour: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/50.png', + gulp: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/51.png', + godot: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/52.png', + graphql: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/53.png', + groovy: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/54.png', + gruntfile: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/55.png', + json: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/56.png', + julia: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/57.png', + log: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/58.png', + hjson: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/59.png', + jsx: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/60.png', + js: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/61.png', + jsmap: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/62.png', + makefile: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/63.png', + kotlin: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/64.png', + html: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/65.png', + http: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/66.png', + lua: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/67.png', + less: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/68.png', + livescript: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/69.png', + jest: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/70.png', + java: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/71.png', + lisp: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/72.png', + jupyter: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/73.png', + manifest: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/74.png', + marko: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/75.png', + npm: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/76.png', + nim: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/77.png', + markdownx: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/78.png', + markdown: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/79.png', + nodemon: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/80.png', + r: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/81.png', + prisma: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/82.png', + reasonml: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/83.png', + python: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/84.png', + php: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/85.png', + powershell: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/86.png', + ocaml: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/87.png', + perl: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/88.png', + prettier: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/89.png', + pawn: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/90.png', + purescript: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/91.png', + objc: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/92.png', + ponylang: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/93.png', + postcss: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/94.png', + pug: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/95.png', + pascal: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/96.png', + processing: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/97.png', + ruby: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/98.png', + rust: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/99.png', + scss: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/100.png', + stylus: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/101.png', + shell: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/102.png', + scala: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/103.png', + sqf: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/104.png', + sql: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/105.png', + svelte: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/106.png', + swift: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/107.png', + svg: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/108.png', + toml: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/109.png', + txt: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/110.png', + travis: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/111.png', + tex: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/112.png', + text: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/113.png', + tsx: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/114.png', + ts: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/115.png', + v: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/116.png', + yaml: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/117.png', + vb: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/118.png', + vcxproj: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/119.png', + yarn: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/120.png', + wasm: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/121.png', + vala: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/122.png', + xml: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/123.png', + vue: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/124.png', + vba: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/125.png', + vscodeignore: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/126.png', + zig: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/127.png', + webpack: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/128.png', + twig: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/129.png', + gatsbyjs: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/130.png', +} const enum Assets { - Logo = "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/131.png", - Idle = "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/132.png", - Logo2 = "https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/133.png", + Logo = 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/131.png', + Idle = 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/132.png', + Logo2 = 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub%20Codespaces/assets/133.png', } -let lastFileChange: number = null, - lastFile: string = null; +let lastFileChange: number | null = null +let lastFile: string | null = null -presence.on("UpdateData", async () => { - const presenceData: PresenceData = { - smallImageKey: Assets.Logo, - smallImageText: "GitHub Codespaces", - }, - activeTab = document.querySelector(".tab.active"), - editorMode = document.querySelector("#status.editor.mode"); +presence.on('UpdateData', async () => { + const presenceData: PresenceData = { + smallImageKey: Assets.Logo, + smallImageText: 'GitHub Codespaces', + } + const activeTab = document.querySelector('.tab.active') + const editorMode = document.querySelector('#status.editor.mode') - // Preparing Screen - if (document.querySelector(".vscs-splash-screen-steps-pane")) { - presenceData.largeImageKey = Assets.Logo2; - presenceData.details = "Preparing a codespace..."; - delete presenceData.smallImageKey; + // Preparing Screen + if (document.querySelector('.vscs-splash-screen-steps-pane')) { + presenceData.largeImageKey = Assets.Logo2 + presenceData.details = 'Preparing a codespace...' + delete presenceData.smallImageKey - if (document.querySelector(".vso-splash-screen__button")) - presenceData.details = "Inactive Codespace"; - // Idle/Start Screen - } else if (activeTab && editorMode) { - const scmTab = Array.from(document.querySelectorAll("#status\\.scm")) - .reverse() - .find(scmTab => scmTab && scmTab.hasAttribute("aria-label")), - workspace = scmTab - ? scmTab.getAttribute("aria-label").split("(Git)")[0] - : null, - filename = activeTab.getAttribute("data-resource-name"), - filepath = activeTab.getAttribute("title"), - syntaxMode = editorMode.getAttribute("aria-label").toLowerCase(), - largeImageKey = - knownExtensions[ - Object.keys(knownExtensions).find(key => { - if (filename.endsWith(key)) return true; - const match = /^\/(.*)\/([mgiy]+)$/.exec(key); - if (!match) return false; - return new RegExp(match[1], match[2]).test(filename); - }) - ] ?? (syntaxMode in langMap ? langMap[syntaxMode] : null); + if (document.querySelector('.vso-splash-screen__button')) + presenceData.details = 'Inactive Codespace' + // Idle/Start Screen + } + else if (activeTab && editorMode) { + const scmTab = Array.from(document.querySelectorAll('#status\\.scm')) + .reverse() + .find(scmTab => scmTab && scmTab.hasAttribute('aria-label')) + const workspace = scmTab + ? scmTab.getAttribute('aria-label')?.split('(Git)')[0] + : null + const filename = activeTab.getAttribute('data-resource-name') + const filepath = activeTab.getAttribute('title') + const syntaxMode = editorMode.getAttribute('aria-label')!.toLowerCase() + const largeImageKey = knownExtensions[ + Object.keys(knownExtensions).find((key) => { + if (filename?.endsWith(key)) + return true + const match = /^\/(.*)\/([mgiy]+)$/.exec(key) + if (!match) + return false + return new RegExp(match[1], match[2]).test(filename ?? '') + }) ?? '' + ] ?? (syntaxMode in langMap ? langMap[syntaxMode] : null) - if (lastFile !== filepath) { - lastFile = filepath; - lastFileChange = Date.now(); - } + if (lastFile !== filepath) { + lastFile = filepath + lastFileChange = Date.now() + } - presenceData.startTimestamp = lastFileChange; - presenceData.largeImageKey = - assets[ - (largeImageKey ? largeImageKey.image : "txt") as keyof typeof assets - ]; - presenceData.details = (await presence.getSetting("details")) - .replaceAll("%file%", filename) - .replaceAll("%path%", filepath) - .replaceAll("%folder%", filepath.split("/").reverse()[1]) - .replaceAll( - "%ext%", - (largeImageKey ? largeImageKey.image : "txt").toUpperCase() - ) - .replaceAll("%workspace%", workspace || "N/A") - .replaceAll( - "%workspaceOrFolder%", - workspace || filepath.split("/").reverse()[1] - ); - presenceData.state = (await presence.getSetting("state")) - .replaceAll("%file%", filename) - .replaceAll("%path%", filepath) - .replaceAll("%folder%", filepath.split("/").reverse()[1]) - .replaceAll( - "%ext%", - (largeImageKey ? largeImageKey.image : "txt").toUpperCase() - ) - .replaceAll("%workspace%", workspace || "N/A") - .replaceAll( - "%workspaceOrFolder%", - workspace || filepath.split("/").reverse()[1] - ); - } else if (!editorMode) { - presenceData.largeImageKey = Assets.Idle; - presenceData.details = "Idling"; - } + presenceData.startTimestamp = lastFileChange + presenceData.largeImageKey = assets[ + (largeImageKey ? largeImageKey.image : 'txt') as keyof typeof assets + ] + presenceData.details = (await presence.getSetting('details')) + .replaceAll('%file%', filename ?? '') + .replaceAll('%path%', filepath ?? '') + .replaceAll('%folder%', filepath?.split('/').reverse()[1] ?? '') + .replaceAll( + '%ext%', + (largeImageKey ? largeImageKey.image : 'txt').toUpperCase(), + ) + .replaceAll('%workspace%', workspace || 'N/A') + .replaceAll( + '%workspaceOrFolder%', + workspace || filepath?.split('/').reverse()[1] || '', + ) + presenceData.state = (await presence.getSetting('state')) + .replaceAll('%file%', filename ?? '') + .replaceAll('%path%', filepath ?? '') + .replaceAll('%folder%', filepath?.split('/').reverse()[1] ?? '') + .replaceAll( + '%ext%', + (largeImageKey ? largeImageKey.image : 'txt').toUpperCase(), + ) + .replaceAll('%workspace%', workspace || 'N/A') + .replaceAll( + '%workspaceOrFolder%', + workspace || filepath?.split('/').reverse()[1] || '', + ) + } + else if (!editorMode) { + presenceData.largeImageKey = Assets.Idle + presenceData.details = 'Idling' + } - if (!presenceData.largeImageKey) presence.setActivity(); - else presence.setActivity(presenceData); -}); + if (!presenceData.largeImageKey) + presence.setActivity() + else presence.setActivity(presenceData) +}) diff --git a/websites/G/GitHub/metadata.json b/websites/G/GitHub/metadata.json index 7409e49d2a16..52e537a1f965 100644 --- a/websites/G/GitHub/metadata.json +++ b/websites/G/GitHub/metadata.json @@ -1,67 +1,67 @@ { - "$schema": "https://schemas.premid.app/metadata/1.12", - "apiVersion": 1, - "author": { - "name": "TheDrop.", - "id": "293828021134295040" - }, - "contributors": [ - { - "name": "Encrypted", - "id": "564434085708038144" - }, - { - "name": "veryCrunchy", - "id": "576097150359044106" - } - ], - "service": "GitHub", - "description": { - "en": "GitHub is a project management and code versioning system as well as a social network platform made for developers.", - "tr": "GitHub bir proje yönetimi ve kod versiyonlama sisteminin yanı sıra geliştiriciler için yapılmış bir sosyal ağ platformudur.", - "de": "GitHub ist ein Projektmanagement- und Codeversionierungssystem sowie eine soziale Plattform für Entwickler.", - "ro": "GitHub este un sistem de gestionare pentru proiecte și cod, precum și o rețea de socializare pentru developeri.", - "pt_BR": "GitHub é um sistema de versionamento de código e gerenciamento de projetos assim como rede social feita para desenvolvedores.", - "fr": "GitHub est un système de gestionnement de projet et de gestionnement de version de code ainsi qu'une plateforme de réseau social faite pour développeurs.", - "uk_UA": "GitHub — це система управління проектами та версіями коду, а також платформа соціальної мережі, створена для розробників.", - "nl": "GitHub is een systeem voor projectbeheer en codeversie systeem, evenals een sociaal netwerkplatform gemaakt voor ontwikkelaars.", - "zh_CN": "GitHub是通过Git进行版本控制的软件源代码托管服务平台。", - "zh_TW": "GitHub是透過Git進行版本控制的軟體原始碼代管服務平台。", - "pl": "GitHub to system do zarządzania projektami i wersjonowania kodu, a także platforma społecznościowa stworzona dla programistów.", - "vi_VN": "GitHub là hệ thống quản lý mã và dự án cũng như là nền tảng mạng xã hội dành cho các nhà phát triển." - }, - "url": [ - "github.com", - "gist.github.com" - ], - "version": "2.11.13", - "logo": "https://cdn.rcd.gg/PreMiD/websites/G/GitHub/assets/logo.png", - "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/GitHub/assets/thumbnail.png", - "color": "#171515", - "category": "other", - "tags": [ - "programming", - "sharing", - "coding" - ], - "settings": [ - { - "id": "cover", - "title": "Show Cover", - "icon": "fad fa-images", - "value": true - }, - { - "id": "timestamp", - "title": "Show timestamps", - "icon": "fad fa-stopwatch", - "value": true - }, - { - "id": "privacy", - "title": "Privacy Mode", - "icon": "fad fa-user-secret", - "value": false - } - ] -} \ No newline at end of file + "$schema": "https://schemas.premid.app/metadata/1.12", + "apiVersion": 1, + "author": { + "name": "TheDrop.", + "id": "293828021134295040" + }, + "contributors": [ + { + "name": "Encrypted", + "id": "564434085708038144" + }, + { + "name": "veryCrunchy", + "id": "576097150359044106" + } + ], + "service": "GitHub", + "description": { + "en": "GitHub is a project management and code versioning system as well as a social network platform made for developers.", + "tr": "GitHub bir proje yönetimi ve kod versiyonlama sisteminin yanı sıra geliştiriciler için yapılmış bir sosyal ağ platformudur.", + "de": "GitHub ist ein Projektmanagement- und Codeversionierungssystem sowie eine soziale Plattform für Entwickler.", + "ro": "GitHub este un sistem de gestionare pentru proiecte și cod, precum și o rețea de socializare pentru developeri.", + "pt_BR": "GitHub é um sistema de versionamento de código e gerenciamento de projetos assim como rede social feita para desenvolvedores.", + "fr": "GitHub est un système de gestionnement de projet et de gestionnement de version de code ainsi qu'une plateforme de réseau social faite pour développeurs.", + "uk_UA": "GitHub — це система управління проектами та версіями коду, а також платформа соціальної мережі, створена для розробників.", + "nl": "GitHub is een systeem voor projectbeheer en codeversie systeem, evenals een sociaal netwerkplatform gemaakt voor ontwikkelaars.", + "zh_CN": "GitHub是通过Git进行版本控制的软件源代码托管服务平台。", + "zh_TW": "GitHub是透過Git進行版本控制的軟體原始碼代管服務平台。", + "pl": "GitHub to system do zarządzania projektami i wersjonowania kodu, a także platforma społecznościowa stworzona dla programistów.", + "vi_VN": "GitHub là hệ thống quản lý mã và dự án cũng như là nền tảng mạng xã hội dành cho các nhà phát triển." + }, + "url": [ + "github.com", + "gist.github.com" + ], + "version": "2.11.13", + "logo": "https://cdn.rcd.gg/PreMiD/websites/G/GitHub/assets/logo.png", + "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/GitHub/assets/thumbnail.png", + "color": "#171515", + "category": "other", + "tags": [ + "programming", + "sharing", + "coding" + ], + "settings": [ + { + "id": "cover", + "title": "Show Cover", + "icon": "fad fa-images", + "value": true + }, + { + "id": "timestamp", + "title": "Show timestamps", + "icon": "fad fa-stopwatch", + "value": true + }, + { + "id": "privacy", + "title": "Privacy Mode", + "icon": "fad fa-user-secret", + "value": false + } + ] +} diff --git a/websites/G/GitHub/presence.ts b/websites/G/GitHub/presence.ts index 20617c019983..df57c565270a 100644 --- a/websites/G/GitHub/presence.ts +++ b/websites/G/GitHub/presence.ts @@ -1,356 +1,376 @@ /* eslint-disable no-case-declarations */ const presence = new Presence({ - clientId: "607587875122446359", - }), - browsingTimestamp = Math.floor(Date.now() / 1000); + clientId: '607587875122446359', +}) +const browsingTimestamp = Math.floor(Date.now() / 1000) -presence.on("UpdateData", async () => { - let presenceData: PresenceData = { - largeImageKey: - "https://cdn.rcd.gg/PreMiD/websites/G/GitHub/assets/logo.png", - }; - const pages: Record = { - login: { - details: "Logging in", - }, - settings: { - details: "Viewing settings", - }, - explore: { - details: "Browsing repositories", - }, - discover: { - details: "Browsing repositories", - }, - marketplace: { - details: "Browsing marketplace", - }, - pulls: { details: "Viewing pull requests" }, - issues: { details: "Viewing issues" }, - notifications: { - details: "Viewing notifications", - }, - watching: { details: "Browsing interested repositories" }, - new: { details: "Creating a repository" }, - topics: { details: "Browsing topics" }, - trending: { details: "Browsing trending repositories" }, - collections: { details: "Browsing collections" }, - events: { details: "Browsing events" }, - codespaces: { details: "Browsing codespaces" }, - search: { - details: "Searching for", - state: new URLSearchParams(document.location.search).get("q"), - }, - "trending/developers": { - details: "Browsing trending developers", - }, - "new/import": { details: "Importing a repository" }, - "new/project": { details: "Creating a project" }, - "organization/new": { details: "Creating an organization" }, - "notifications/subscriptions": { - details: "Viewing subscriptions", - }, - }, - { pathname, search, href, hostname } = document.location, - [cover, timestamp, privacy] = await Promise.all([ - presence.getSetting("cover"), - presence.getSetting("timestamp"), - presence.getSetting("privacy"), - ]); +presence.on('UpdateData', async () => { + let presenceData: PresenceData = { + largeImageKey: 'https://cdn.rcd.gg/PreMiD/websites/G/GitHub/assets/logo.png', + } + const pages: Record = { + 'login': { + details: 'Logging in', + }, + 'settings': { + details: 'Viewing settings', + }, + 'explore': { + details: 'Browsing repositories', + }, + 'discover': { + details: 'Browsing repositories', + }, + 'marketplace': { + details: 'Browsing marketplace', + }, + 'pulls': { details: 'Viewing pull requests' }, + 'issues': { details: 'Viewing issues' }, + 'notifications': { + details: 'Viewing notifications', + }, + 'watching': { details: 'Browsing interested repositories' }, + 'new': { details: 'Creating a repository' }, + 'topics': { details: 'Browsing topics' }, + 'trending': { details: 'Browsing trending repositories' }, + 'collections': { details: 'Browsing collections' }, + 'events': { details: 'Browsing events' }, + 'codespaces': { details: 'Browsing codespaces' }, + 'search': { + details: 'Searching for', + state: new URLSearchParams(document.location.search).get('q'), + }, + 'trending/developers': { + details: 'Browsing trending developers', + }, + 'new/import': { details: 'Importing a repository' }, + 'new/project': { details: 'Creating a project' }, + 'organization/new': { details: 'Creating an organization' }, + 'notifications/subscriptions': { + details: 'Viewing subscriptions', + }, + } + const { pathname, search, href, hostname } = document.location + const [cover, timestamp, privacy] = await Promise.all([ + presence.getSetting('cover'), + presence.getSetting('timestamp'), + presence.getSetting('privacy'), + ]) - for (const [path, data] of Object.entries(pages)) { - if (pathname.includes(`/${path}`)) - presenceData = { ...presenceData, ...data }; - } - if (hostname === "github.com") { - switch (true) { - // * For Profiles - case !!document.querySelector("body.page-profile"): - if (privacy) { - presenceData.details = "Viewing a profile"; - break; - } - const searchParam = new URLSearchParams(search).get("tab"), - profileName = document - .querySelector("span.p-nickname") - ?.textContent.split("·")[0] - .trim(); - presenceData.buttons = [{ label: "View Profile", url: href }]; - if (cover) { - presenceData.largeImageKey = `${ - document.querySelector("img.avatar-user").src - }.png`; - } - if (searchParam) - presenceData.details = `Viewing ${profileName}'s ${searchParam}`; - else presenceData.details = `Viewing ${profileName}'s profile`; - break; - // * For repositories - case !!document.querySelector( - "div#repository-container-header" - ): - const repository = { - owner: pathname.split("/")[1], - name: pathname.split("/")[2], - target: pathname.split("/")[4], - id: pathname.split("/")[4], - }; - presenceData.buttons = [{ label: "View Repository", url: href }]; - if (cover && !privacy) { - presenceData.largeImageKey = `https://avatars.githubusercontent.com/u/${ - document.querySelector( - 'meta[name~="octolytics-dimension-user_id"]' - )?.content - }`; - } + for (const [path, data] of Object.entries(pages)) { + if (pathname.includes(`/${path}`)) + presenceData = { ...presenceData, ...data } as PresenceData + } + if (hostname === 'github.com') { + switch (true) { + // * For Profiles + case !!document.querySelector('body.page-profile'): + if (privacy) { + presenceData.details = 'Viewing a profile' + break + } + const searchParam = new URLSearchParams(search).get('tab') + const profileName = document + .querySelector('span.p-nickname') + ?.textContent + ?.split('·')[0] + .trim() + presenceData.buttons = [{ label: 'View Profile', url: href }] + if (cover) { + presenceData.largeImageKey = `${ + document.querySelector('img.avatar-user')?.src + }.png` + } + if (searchParam) + presenceData.details = `Viewing ${profileName}'s ${searchParam}` + else presenceData.details = `Viewing ${profileName}'s profile` + break + // * For repositories + case !!document.querySelector( + 'div#repository-container-header', + ): + const repository = { + owner: pathname.split('/')[1], + name: pathname.split('/')[2], + target: pathname.split('/')[4], + id: pathname.split('/')[4], + } + presenceData.buttons = [{ label: 'View Repository', url: href }] + if (cover && !privacy) { + presenceData.largeImageKey = `https://avatars.githubusercontent.com/u/${ + document.querySelector( + 'meta[name~="octolytics-dimension-user_id"]', + )?.content + }` + } - if (pathname.includes("/tree/")) { - if (privacy) { - presenceData.details = "Viewing a repository"; - presenceData.state = "In a folder"; - delete presenceData.buttons; - break; - } - presenceData.details = `Browsing repository ${repository.owner}/${repository.name}`; + if (pathname.includes('/tree/')) { + if (privacy) { + presenceData.details = 'Viewing a repository' + presenceData.state = 'In a folder' + delete presenceData.buttons + break + } + presenceData.details = `Browsing repository ${repository.owner}/${repository.name}` - presenceData.state = `In folder ${pathname - .split("/") - .slice(4) - .join("/")}`; - } else if (pathname.includes("/blob/")) { - if (privacy) { - presenceData.details = "Browsing a repository"; - presenceData.state = "Viewing a file"; - delete presenceData.buttons; - break; - } - const pathFolder = document - .querySelector("#repos-header-breadcrumb-wide > ol") - ?.textContent.trim() - .split("/") - .slice(1) - .join("/"), - fileName = document.querySelector("#file-name-id-wide").textContent; - presenceData.details = `Browsing repository ${repository.owner}/${repository.name}`; - presenceData.state = `Viewing file ${(pathFolder - ? `${pathFolder}/${fileName}` - : fileName - )?.trim()} at ${repository.target}`; - } else if (pathname.includes("/issues")) { - if (pathname.includes("/issues/")) { - if (pathname.includes("new")) { - if (privacy) { - presenceData.details = "Creating an issue"; - delete presenceData.state; - delete presenceData.buttons; - break; - } - presenceData.details = `Creating an issue in ${repository.owner}/${repository.name}`; - } else { - if (privacy) { - presenceData.details = "Looking at an issue"; - delete presenceData.state; - delete presenceData.buttons; - break; - } - presenceData.details = `Looking at issue #${repository.id}`; - presenceData.state = `${ - document - .querySelector("a.author") - ?.textContent?.trim() ?? - document.querySelector('[href="#top"]')?.textContent?.trim() - } - ${ - document.querySelector("h1.gh-header-title") - ?.textContent - }`; - presenceData.buttons = [{ label: "View Issue", url: href }]; - } - } else { - if (privacy) { - presenceData.details = "Browsing issues"; - delete presenceData.state; - delete presenceData.buttons; - break; - } - presenceData.details = "Browsing issues"; - presenceData.state = `${repository.owner}/${repository.name}`; - } - } else if (pathname.includes("/pulls")) { - if (privacy) { - presenceData.details = "Browsing pull requests"; - delete presenceData.state; - delete presenceData.buttons; - break; - } - presenceData.details = "Browsing pull requests"; - presenceData.state = `${repository.owner}/${repository.name}`; - } else if (pathname.includes("/pull")) { - if (privacy) { - presenceData.details = "Looking at a pull request"; - delete presenceData.state; - delete presenceData.buttons; - break; - } - presenceData.details = `Looking at pull request #${repository.id}`; - presenceData.state = `${ - document.querySelector("a.author.Link--primary") - ?.textContent ?? - document.querySelector('[class*="author Link"]')?.textContent - } - ${ - document.querySelector("h1.gh-header-title") - ?.textContent - }`; - presenceData.buttons = [{ label: "View Pull Request", url: href }]; - } else if (pathname.endsWith("/discussions")) { - if (privacy) { - presenceData.details = "Browsing discussions"; - delete presenceData.state; - delete presenceData.buttons; - break; - } - presenceData.details = "Browsing discussions in"; - presenceData.state = `${repository.owner}/${repository.name}`; - } else if (pathname.includes("/discussions/")) { - if (privacy) { - presenceData.details = "Looking at a discussion"; - delete presenceData.state; - delete presenceData.buttons; - break; - } - presenceData.details = `Looking at discussion #${repository.id}`; - presenceData.state = `${ - document.querySelectorAll("a.author")[0] - ?.textContent - } - ${ - document.querySelector("h1.gh-header-title") - ?.textContent - }`; - presenceData.buttons = [{ label: "View Discussion", url: href }]; - } else if ( - pathname.includes("/pulse") || - pathname.includes("/graphs/contributors") || - pathname.includes("/community") || - pathname.includes("/graphs/commit-activity") || - pathname.includes("/graphs/code-frequency") || - pathname.includes("/network/dependencies") || - pathname.includes("/graphs/commit-activity") || - pathname.includes("/network") || - pathname.includes("/network/members") - ) { - if (privacy) { - presenceData.details = "Browsing insights"; - delete presenceData.state; - delete presenceData.buttons; - break; - } - presenceData.details = `Browsing insights of ${repository.owner} / ${repository.name}`; + presenceData.state = `In folder ${pathname + .split('/') + .slice(4) + .join('/')}` + } + else if (pathname.includes('/blob/')) { + if (privacy) { + presenceData.details = 'Browsing a repository' + presenceData.state = 'Viewing a file' + delete presenceData.buttons + break + } + const pathFolder = document + .querySelector('#repos-header-breadcrumb-wide > ol') + ?.textContent + ?.trim() + .split('/') + .slice(1) + .join('/') + const fileName = document.querySelector('#file-name-id-wide')?.textContent + presenceData.details = `Browsing repository ${repository.owner}/${repository.name}` + presenceData.state = `Viewing file ${(pathFolder + ? `${pathFolder}/${fileName}` + : fileName + )?.trim()} at ${repository.target}` + } + else if (pathname.includes('/issues')) { + if (pathname.includes('/issues/')) { + if (pathname.includes('new')) { + if (privacy) { + presenceData.details = 'Creating an issue' + delete presenceData.state + delete presenceData.buttons + break + } + presenceData.details = `Creating an issue in ${repository.owner}/${repository.name}` + } + else { + if (privacy) { + presenceData.details = 'Looking at an issue' + delete presenceData.state + delete presenceData.buttons + break + } + presenceData.details = `Looking at issue #${repository.id}` + presenceData.state = `${ + document + .querySelector('a.author') + ?.textContent + ?.trim() + ?? document.querySelector('[href="#top"]')?.textContent?.trim() + } - ${ + document.querySelector('h1.gh-header-title') + ?.textContent + }` + presenceData.buttons = [{ label: 'View Issue', url: href }] + } + } + else { + if (privacy) { + presenceData.details = 'Browsing issues' + delete presenceData.state + delete presenceData.buttons + break + } + presenceData.details = 'Browsing issues' + presenceData.state = `${repository.owner}/${repository.name}` + } + } + else if (pathname.includes('/pulls')) { + if (privacy) { + presenceData.details = 'Browsing pull requests' + delete presenceData.state + delete presenceData.buttons + break + } + presenceData.details = 'Browsing pull requests' + presenceData.state = `${repository.owner}/${repository.name}` + } + else if (pathname.includes('/pull')) { + if (privacy) { + presenceData.details = 'Looking at a pull request' + delete presenceData.state + delete presenceData.buttons + break + } + presenceData.details = `Looking at pull request #${repository.id}` + presenceData.state = `${ + document.querySelector('a.author.Link--primary') + ?.textContent + ?? document.querySelector('[class*="author Link"]')?.textContent + } - ${ + document.querySelector('h1.gh-header-title') + ?.textContent + }` + presenceData.buttons = [{ label: 'View Pull Request', url: href }] + } + else if (pathname.endsWith('/discussions')) { + if (privacy) { + presenceData.details = 'Browsing discussions' + delete presenceData.state + delete presenceData.buttons + break + } + presenceData.details = 'Browsing discussions in' + presenceData.state = `${repository.owner}/${repository.name}` + } + else if (pathname.includes('/discussions/')) { + if (privacy) { + presenceData.details = 'Looking at a discussion' + delete presenceData.state + delete presenceData.buttons + break + } + presenceData.details = `Looking at discussion #${repository.id}` + presenceData.state = `${ + document.querySelectorAll('a.author')[0] + ?.textContent + } - ${ + document.querySelector('h1.gh-header-title') + ?.textContent + }` + presenceData.buttons = [{ label: 'View Discussion', url: href }] + } + else if ( + pathname.includes('/pulse') + || pathname.includes('/graphs/contributors') + || pathname.includes('/community') + || pathname.includes('/graphs/commit-activity') + || pathname.includes('/graphs/code-frequency') + || pathname.includes('/network/dependencies') + || pathname.includes('/graphs/commit-activity') + || pathname.includes('/network') + || pathname.includes('/network/members') + ) { + if (privacy) { + presenceData.details = 'Browsing insights' + delete presenceData.state + delete presenceData.buttons + break + } + presenceData.details = `Browsing insights of ${repository.owner} / ${repository.name}` - presenceData.state = document.querySelector( - "nav a.js-selected-navigation-item.selected.menu-item" - )?.textContent; - } else { - if (privacy) { - presenceData.details = "Browsing a repository"; - delete presenceData.state; - delete presenceData.buttons; - break; - } - presenceData.details = "Browsing repository"; - presenceData.state = `${repository.owner}/${repository.name}`; - } - break; - case pathname.includes("/orgs/"): - if (privacy) { - presenceData.details = "Viewing the people in an organization"; - delete presenceData.state; - delete presenceData.buttons; - break; - } - presenceData.details = `Viewing ${pathname.split("/")[2]}'s ${ - pathname.split("/")[3] - }`; + presenceData.state = document.querySelector( + 'nav a.js-selected-navigation-item.selected.menu-item', + )?.textContent + } + else { + if (privacy) { + presenceData.details = 'Browsing a repository' + delete presenceData.state + delete presenceData.buttons + break + } + presenceData.details = 'Browsing repository' + presenceData.state = `${repository.owner}/${repository.name}` + } + break + case pathname.includes('/orgs/'): + if (privacy) { + presenceData.details = 'Viewing the people in an organization' + delete presenceData.state + delete presenceData.buttons + break + } + presenceData.details = `Viewing ${pathname.split('/')[2]}'s ${ + pathname.split('/')[3] + }` - break; - case !!document.querySelector( - 'meta[name="hovercard-subject-tag"]' - ): - presenceData.details = "Viewing an organization"; + break + case !!document.querySelector( + 'meta[name="hovercard-subject-tag"]', + ): + presenceData.details = 'Viewing an organization' - if (privacy) { - delete presenceData.state; - delete presenceData.buttons; - break; - } + if (privacy) { + delete presenceData.state + delete presenceData.buttons + break + } - presenceData.state = document.title; - if (cover) { - presenceData.largeImageKey = `${ - document.querySelector( - 'meta[property~="og:image"]' - )?.content ?? - document.querySelector( - "img[itemprop='image'].avatar" - )?.src ?? - presenceData.largeImageKey - }`; - } - break; - case pathname.includes("/features"): - presenceData.details = "Browsing features"; - if (pathname.includes("copilot")) - presenceData.state = "Looking at Github Copilot"; + presenceData.state = document.title + if (cover) { + presenceData.largeImageKey = `${ + document.querySelector( + 'meta[property~="og:image"]', + )?.content + ?? document.querySelector( + 'img[itemprop=\'image\'].avatar', + )?.src + ?? presenceData.largeImageKey + }` + } + break + case pathname.includes('/features'): + presenceData.details = 'Browsing features' + if (pathname.includes('copilot')) + presenceData.state = 'Looking at Github Copilot' - break; + break - case pathname === "/" || !pathname: - presenceData.details = "Viewing the home page"; - break; - } - } else if (pathname === "/") presenceData.details = "Creating a GitHub gist"; - else if (pathname.includes("/discover")) - presenceData.details = "Browsing GitHub gists"; - else if (pathname.includes("/forked")) - presenceData.details = "Browsing forked GitHub gists"; - else if (pathname.includes("/starred")) - presenceData.details = "Browsing starred GitHub gists"; - else { - switch (true) { - // * For Profiles - case !!document.querySelector("div.js-profile-editable-replace"): - if (privacy) { - presenceData.details = "Viewing a profile"; - break; - } - const searchParam = new URLSearchParams(search).get("tab"), - profileName = document - .querySelector("span.p-nickname") - ?.textContent.trim(); - presenceData.buttons = [{ label: "View Profile", url: href }]; - if (cover) { - presenceData.largeImageKey = `${ - document.querySelector( - "img.avatar.avatar-user.width-full" - ).src - }.png`; - } - if (searchParam) - presenceData.details = `Viewing ${profileName}'s ${searchParam}`; - else presenceData.details = `Viewing ${profileName}'s profile`; - break; - // * For gists - case !!document.querySelector("div.repository-content.gist-content"): - if (privacy) { - presenceData.details = "Viewing a gist"; - break; - } - const gist = { - owner: pathname.split("/")[1], - name: document.querySelector("[itemprop = 'name'] > a").innerHTML, - }; - presenceData.buttons = [{ label: "View Gist", url: href }]; - presenceData.details = `Browsing gist ${gist.name} by ${gist.owner}`; - } - } - if (timestamp) presenceData.startTimestamp = browsingTimestamp; - presence.setActivity(presenceData); -}); + case pathname === '/' || !pathname: + presenceData.details = 'Viewing the home page' + break + } + } + else if (pathname === '/') { + presenceData.details = 'Creating a GitHub gist' + } + else if (pathname.includes('/discover')) { + presenceData.details = 'Browsing GitHub gists' + } + else if (pathname.includes('/forked')) { + presenceData.details = 'Browsing forked GitHub gists' + } + else if (pathname.includes('/starred')) { + presenceData.details = 'Browsing starred GitHub gists' + } + else { + switch (true) { + // * For Profiles + case !!document.querySelector('div.js-profile-editable-replace'): + if (privacy) { + presenceData.details = 'Viewing a profile' + break + } + const searchParam = new URLSearchParams(search).get('tab') + const profileName = document + .querySelector('span.p-nickname') + ?.textContent + ?.trim() + presenceData.buttons = [{ label: 'View Profile', url: href }] + if (cover) { + presenceData.largeImageKey = `${ + document.querySelector( + 'img.avatar.avatar-user.width-full', + )?.src + }.png` + } + if (searchParam) + presenceData.details = `Viewing ${profileName}'s ${searchParam}` + else presenceData.details = `Viewing ${profileName}'s profile` + break + // * For gists + case !!document.querySelector('div.repository-content.gist-content'): + if (privacy) { + presenceData.details = 'Viewing a gist' + break + } + const gist = { + owner: pathname.split('/')[1], + name: document.querySelector('[itemprop = \'name\'] > a')?.innerHTML, + } + presenceData.buttons = [{ label: 'View Gist', url: href }] + presenceData.details = `Browsing gist ${gist.name} by ${gist.owner}` + } + } + if (timestamp) + presenceData.startTimestamp = browsingTimestamp + presence.setActivity(presenceData) +}) diff --git a/websites/G/GitLab/metadata.json b/websites/G/GitLab/metadata.json index 87d515716f6a..4d5962ded0b0 100644 --- a/websites/G/GitLab/metadata.json +++ b/websites/G/GitLab/metadata.json @@ -1,35 +1,35 @@ { - "$schema": "https://schemas.premid.app/metadata/1.12", - "apiVersion": 1, - "author": { - "name": "GURRMAN375D", - "id": "446528923535278082" - }, - "service": "GitLab", - "description": { - "en": "GitLab is a project management and code versioning system as well as a social network platform made for developers.", - "nl": "GitLab is a project management and code versioning system as well as a social network platform made for developers.", - "vi_VN": "GitLab là hệ thống quản lý mã và dự án cũng như là nền tảng mạng xã hội dành cho các nhà phát triển." - }, - "url": "gitlab.com", - "regExp": "([a-z0-9-]+[.])*gitlab[.]com[/]", - "version": "1.1.25", - "logo": "https://cdn.rcd.gg/PreMiD/websites/G/GitLab/assets/logo.png", - "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/GitLab/assets/thumbnail.png", - "color": "#ff4400", - "category": "other", - "tags": [ - "programming", - "sharing", - "coding", - "gitlab" - ], - "settings": [ - { - "id": "lock", - "icon": "fas fa-lock", - "title": "Hide Private", - "value": true - } - ] -} \ No newline at end of file + "$schema": "https://schemas.premid.app/metadata/1.12", + "apiVersion": 1, + "author": { + "name": "GURRMAN375D", + "id": "446528923535278082" + }, + "service": "GitLab", + "description": { + "en": "GitLab is a project management and code versioning system as well as a social network platform made for developers.", + "nl": "GitLab is a project management and code versioning system as well as a social network platform made for developers.", + "vi_VN": "GitLab là hệ thống quản lý mã và dự án cũng như là nền tảng mạng xã hội dành cho các nhà phát triển." + }, + "url": "gitlab.com", + "regExp": "([a-z0-9-]+[.])*gitlab[.]com[/]", + "version": "1.1.25", + "logo": "https://cdn.rcd.gg/PreMiD/websites/G/GitLab/assets/logo.png", + "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/GitLab/assets/thumbnail.png", + "color": "#ff4400", + "category": "other", + "tags": [ + "programming", + "sharing", + "coding", + "gitlab" + ], + "settings": [ + { + "id": "lock", + "icon": "fas fa-lock", + "title": "Hide Private", + "value": true + } + ] +} diff --git a/websites/G/GitLab/presence.ts b/websites/G/GitLab/presence.ts index 4de6152237f6..fc55513ea372 100644 --- a/websites/G/GitLab/presence.ts +++ b/websites/G/GitLab/presence.ts @@ -1,184 +1,214 @@ const presence = new Presence({ - clientId: "709526684428271687", - }), - browsingTimestamp = Math.floor(Date.now() / 1000); + clientId: '709526684428271687', +}) +const browsingTimestamp = Math.floor(Date.now() / 1000) -let owner, title, presenceprivate; -presence.on("UpdateData", async () => { - const presenceData: PresenceData = { - largeImageKey: - "https://cdn.rcd.gg/PreMiD/websites/G/GitLab/assets/logo.png", - startTimestamp: browsingTimestamp, - }, - lock = await presence.getSetting("lock"); - presenceprivate = document.querySelector( - "div.d-inline-flex.align-items-baseline > h1 > span" - ); - if (window.location.hostname === "gitlab.com") { - if ( - document.location.pathname === "/" || - document.location.pathname.includes("/dashboard/projects") - ) { - if (document.location.pathname === "/dashboard/projects/starred") - presenceData.details = "Viewing Starred"; - else presenceData.details = "Viewing Dashboard"; - } else if (document.location.pathname === "/projects/new/") - presenceData.details = "Creating a project"; - else if (document.location.pathname === "/groups/new") - presenceData.details = "Creating a group"; - else if (document.location.pathname.includes("/explore")) { - if (document.location.pathname === "/explore/snippets") - presenceData.details = "Exploring Snippets"; - else presenceData.details = "Exploring projects"; - } else { - switch (document.location.pathname) { - case "/dashboard/groups": { - presenceData.details = "Viewing Groups"; - break; - } - case "/dashboard/activity": { - presenceData.details = "Viewing Activity"; - break; - } - case "/dashboard/milestones": { - presenceData.details = "Viewing Milestones"; - break; - } - case "/dashboard/snippets": { - presenceData.details = "Viewing Snippets"; - break; - } - case "/-/operations/environments": { - presenceData.details = "Viewing Environments"; - break; - } - case "/-/operations": { - presenceData.details = "Viewing Operations"; - break; - } - case "/-/security": { - presenceData.details = "Viewing Security"; - break; - } - case "/dashboard/issues": { - presenceData.details = "Viewing Issuses"; - break; - } - case "/dashboard/merge_requests": { - presenceData.details = "Viewing Merge Requests"; - break; - } - case "/dashboard/todos": { - presenceData.details = "Viewing TODOS"; - break; - } - case "/help": { - presenceData.details = "Viewing Help"; - break; - } - case "/users/sign_in": { - presenceData.details = "Signning in or Registering"; - break; - } - case "/search": { - title = document.querySelector( - "#dashboard_search" - ) as HTMLTextAreaElement; - presenceData.details = "Searching"; - presenceData.state = title.textContent; - presenceData.smallImageKey = Assets.Search; - presenceData.smallImageText = "Searching"; +let owner, title, presenceprivate +presence.on('UpdateData', async () => { + const presenceData: PresenceData = { + largeImageKey: 'https://cdn.rcd.gg/PreMiD/websites/G/GitLab/assets/logo.png', + startTimestamp: browsingTimestamp, + } + const lock = await presence.getSetting('lock') + presenceprivate = document.querySelector( + 'div.d-inline-flex.align-items-baseline > h1 > span', + ) + if (window.location.hostname === 'gitlab.com') { + if ( + document.location.pathname === '/' + || document.location.pathname.includes('/dashboard/projects') + ) { + if (document.location.pathname === '/dashboard/projects/starred') + presenceData.details = 'Viewing Starred' + else presenceData.details = 'Viewing Dashboard' + } + else if (document.location.pathname === '/projects/new/') { + presenceData.details = 'Creating a project' + } + else if (document.location.pathname === '/groups/new') { + presenceData.details = 'Creating a group' + } + else if (document.location.pathname.includes('/explore')) { + if (document.location.pathname === '/explore/snippets') + presenceData.details = 'Exploring Snippets' + else presenceData.details = 'Exploring projects' + } + else { + switch (document.location.pathname) { + case '/dashboard/groups': { + presenceData.details = 'Viewing Groups' + break + } + case '/dashboard/activity': { + presenceData.details = 'Viewing Activity' + break + } + case '/dashboard/milestones': { + presenceData.details = 'Viewing Milestones' + break + } + case '/dashboard/snippets': { + presenceData.details = 'Viewing Snippets' + break + } + case '/-/operations/environments': { + presenceData.details = 'Viewing Environments' + break + } + case '/-/operations': { + presenceData.details = 'Viewing Operations' + break + } + case '/-/security': { + presenceData.details = 'Viewing Security' + break + } + case '/dashboard/issues': { + presenceData.details = 'Viewing Issuses' + break + } + case '/dashboard/merge_requests': { + presenceData.details = 'Viewing Merge Requests' + break + } + case '/dashboard/todos': { + presenceData.details = 'Viewing TODOS' + break + } + case '/help': { + presenceData.details = 'Viewing Help' + break + } + case '/users/sign_in': { + presenceData.details = 'Signning in or Registering' + break + } + case '/search': { + title = document.querySelector( + '#dashboard_search', + ) as HTMLTextAreaElement + presenceData.details = 'Searching' + presenceData.state = title.textContent + presenceData.smallImageKey = Assets.Search + presenceData.smallImageText = 'Searching' - break; - } - default: { - title = document.querySelector( - "body > div.layout-page.page-with-contextual-sidebar > div.content-wrapper > div.alert-wrapper > nav > div > div > ul > li:nth-child(2) > a > span" - ) as HTMLTextAreaElement; - owner = document.querySelector( - "body > div.layout-page.page-with-contextual-sidebar > div.content-wrapper > div.alert-wrapper > nav > div > div > ul > li:nth-child(1) > a" - ) as HTMLTextAreaElement; - if ( - (presenceprivate as HTMLTextAreaElement).title.startsWith( - "Private -" - ) && - lock - ) { - presenceData.details = "Viewing a Private Presence"; - presenceData.state = "or Private Group"; - } else if (title && owner) { - presenceData.details = title.textContent; - presenceData.state = owner.textContent; - } else if (title === null && owner) { - presenceData.details = owner.textContent; - presenceData.state = "My Respository"; - } else if (title === null && owner === null) { - owner = document.querySelector( - "#content-body > div.user-profile > div.cover-block.user-cover-block > div.profile-header > div.user-info > p > span:nth-child(1)" - ) as HTMLTextAreaElement; - presenceData.details = "Viewing:"; - presenceData.state = owner.textContent; - } else presenceData.details = "Viewing Unknown"; - } - } - } - } else if (window.location.hostname === "about.gitlab.com") { - switch (document.location.pathname) { - case "/": { - presenceData.details = "Viewing Home Page"; - break; - } - case "/stages-devops-lifecycle/": { - presenceData.details = "Viewing DevOps Lifecycle"; - break; - } - case "/services/": - { - presenceData.details = "Viewing Profesional Services"; - // No default - } - break; - } - title = document.querySelector( - "body > div.wrapper.gitlab-ee-page > div.image-title > div > div > h1" - ); - if (title) presenceData.details = `Viewing ${title.textContent}`; - else if (title === null) { - title = document.querySelector("body > div.blank-header > div > h1"); - if (title) presenceData.details = `Viewing ${title.textContent}`; - else if (title === null) { - title = document.querySelector("body > div.wrapper > div > h1"); - if (title) presenceData.details = `Viewing ${title.textContent}`; - else if (title === null) { - title = document.querySelector( - "body > div.wrapper.blog-landing > div.blog-landing-content > div.blog-hero > div > a > h2" - ); - if (title) presenceData.details = `Viewing ${title.textContent}`; - else if (title === null) { - title = document.querySelector( - "body > div.blog.article > div.cover > div > div > h1" - ); - if (title) presenceData.details = `Viewing ${title.textContent}`; - else { - title = document.querySelector( - "body > div.reseller-hero.text-center > div > h1" - ); - if (title) presenceData.details = `Viewing ${title.textContent}`; - } - } - } - } else presenceData.details = "Viewing Solutions"; - } else if (document.location.pathname === "/services/implementation/") { - title = document.querySelector("body > div.wrapper > div > h1"); - presenceData.details = `Viewing ${title.textContent}`; - } else presenceData.details = "Viewing Unknown"; - } else presenceData.details = "Viewing Unknown"; - if (!presenceData.details) { - //This will fire if you do not set presence details + break + } + default: { + title = document.querySelector( + 'body > div.layout-page.page-with-contextual-sidebar > div.content-wrapper > div.alert-wrapper > nav > div > div > ul > li:nth-child(2) > a > span', + ) as HTMLTextAreaElement + owner = document.querySelector( + 'body > div.layout-page.page-with-contextual-sidebar > div.content-wrapper > div.alert-wrapper > nav > div > div > ul > li:nth-child(1) > a', + ) as HTMLTextAreaElement + if ( + (presenceprivate as HTMLTextAreaElement).title.startsWith( + 'Private -', + ) + && lock + ) { + presenceData.details = 'Viewing a Private Presence' + presenceData.state = 'or Private Group' + } + else if (title && owner) { + presenceData.details = title.textContent + presenceData.state = owner.textContent + } + else if (title === null && owner) { + presenceData.details = owner.textContent + presenceData.state = 'My Respository' + } + else if (title === null && owner === null) { + owner = document.querySelector( + '#content-body > div.user-profile > div.cover-block.user-cover-block > div.profile-header > div.user-info > p > span:nth-child(1)', + ) as HTMLTextAreaElement + presenceData.details = 'Viewing:' + presenceData.state = owner.textContent + } + else { + presenceData.details = 'Viewing Unknown' + } + } + } + } + } + else if (window.location.hostname === 'about.gitlab.com') { + switch (document.location.pathname) { + case '/': { + presenceData.details = 'Viewing Home Page' + break + } + case '/stages-devops-lifecycle/': { + presenceData.details = 'Viewing DevOps Lifecycle' + break + } + case '/services/': { + presenceData.details = 'Viewing Profesional Services' + break + } + } + title = document.querySelector( + 'body > div.wrapper.gitlab-ee-page > div.image-title > div > div > h1', + ) + if (title) { + presenceData.details = `Viewing ${title.textContent}` + } + else if (title === null) { + title = document.querySelector('body > div.blank-header > div > h1') + if (title) { + presenceData.details = `Viewing ${title.textContent}` + } + else if (title === null) { + title = document.querySelector('body > div.wrapper > div > h1') + if (title) { + presenceData.details = `Viewing ${title.textContent}` + } + else if (title === null) { + title = document.querySelector( + 'body > div.wrapper.blog-landing > div.blog-landing-content > div.blog-hero > div > a > h2', + ) + if (title) { + presenceData.details = `Viewing ${title.textContent}` + } + else if (title === null) { + title = document.querySelector( + 'body > div.blog.article > div.cover > div > div > h1', + ) + if (title) { + presenceData.details = `Viewing ${title.textContent}` + } + else { + title = document.querySelector( + 'body > div.reseller-hero.text-center > div > h1', + ) + if (title) + presenceData.details = `Viewing ${title.textContent}` + } + } + } + } + else { + presenceData.details = 'Viewing Solutions' + } + } + else if (document.location.pathname === '/services/implementation/') { + title = document.querySelector('body > div.wrapper > div > h1') + presenceData.details = `Viewing ${title?.textContent}` + } + else { + presenceData.details = 'Viewing Unknown' + } + } + else { + presenceData.details = 'Viewing Unknown' + } + if (!presenceData.details) { + // This will fire if you do not set presence details - presence.setActivity(); - } else { - //This will fire if you set presence details - presence.setActivity(presenceData); - } -}); + presence.setActivity() + } + else { + // This will fire if you set presence details + presence.setActivity(presenceData) + } +}) diff --git a/websites/G/Gitbook/metadata.json b/websites/G/Gitbook/metadata.json index 9caaf83ad8c6..3d28f9201689 100644 --- a/websites/G/Gitbook/metadata.json +++ b/websites/G/Gitbook/metadata.json @@ -1,24 +1,24 @@ { - "$schema": "https://schemas.premid.app/metadata/1.12", - "apiVersion": 1, - "author": { - "name": "Snazzah", - "id": "158049329150427136" - }, - "service": "Gitbook", - "description": { - "en": "Share knowledge, boost your team's productivity and make your users happy.", - "nl": "Deel kennis, verhoog de productiviteit van uw team en maak uw gebruikers blij." - }, - "url": "app.gitbook.com", - "regExp": "([a-z0-9-]+)[.]gitbook[.]io|app[.]gitbook[.]com", - "version": "1.0.19", - "logo": "https://cdn.rcd.gg/PreMiD/websites/G/Gitbook/assets/logo.png", - "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/Gitbook/assets/thumbnail.png", - "color": "#3884FF", - "category": "other", - "tags": [ - "documentation", - "collaboration" - ] -} \ No newline at end of file + "$schema": "https://schemas.premid.app/metadata/1.12", + "apiVersion": 1, + "author": { + "name": "Snazzah", + "id": "158049329150427136" + }, + "service": "Gitbook", + "description": { + "en": "Share knowledge, boost your team's productivity and make your users happy.", + "nl": "Deel kennis, verhoog de productiviteit van uw team en maak uw gebruikers blij." + }, + "url": "app.gitbook.com", + "regExp": "([a-z0-9-]+)[.]gitbook[.]io|app[.]gitbook[.]com", + "version": "1.0.19", + "logo": "https://cdn.rcd.gg/PreMiD/websites/G/Gitbook/assets/logo.png", + "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/Gitbook/assets/thumbnail.png", + "color": "#3884FF", + "category": "other", + "tags": [ + "documentation", + "collaboration" + ] +} diff --git a/websites/G/Gitbook/presence.ts b/websites/G/Gitbook/presence.ts index 4992475b448a..306296272dda 100644 --- a/websites/G/Gitbook/presence.ts +++ b/websites/G/Gitbook/presence.ts @@ -1,53 +1,61 @@ const presence = new Presence({ - clientId: "719757905888542730", -}); - -let actionTimestamp: number = null; - -presence.on("UpdateData", async () => { - const presenceData: PresenceData = { - largeImageKey: - "https://cdn.rcd.gg/PreMiD/websites/G/Gitbook/assets/logo.png", - }; - - if (location.hostname === "app.gitbook.com") { - // In dashboard? - if (document.querySelector("[class*=--dashboardBody-")) { - const dashName = document.querySelector( - "[class*=--dashboardMenu-] [class*=--headerText-]" - ); - presenceData.details = dashName - ? `In ${dashName.textContent}'s Dashboard` - : "In a Dashboard"; - actionTimestamp = null; - } else { - presenceData.smallImageKey = Assets.Writing; - presenceData.smallImageText = "Editing"; - - const docName = document.querySelector("[class*='logoText-'] span"), - pageName = document.querySelector("[class*=--navButtonOpened-] span"); - - actionTimestamp ??= Date.now(); - if (docName) presenceData.details = `Editing ${docName.textContent}`; - if (pageName) presenceData.state = `on ${pageName.textContent}`; - presenceData.startTimestamp = actionTimestamp; - } - } else { - presenceData.smallImageKey = Assets.Reading; - presenceData.smallImageText = "Viewing"; - - const docName = document.querySelector("[class*='logoText-'] span"), - pageName = document.querySelector("[class*=--navButtonOpened-] span"); - - actionTimestamp ??= Date.now(); - if (docName) presenceData.details = `Viewing ${docName.textContent}`; - if (pageName) presenceData.state = `on ${pageName.textContent}`; - presenceData.startTimestamp = actionTimestamp; - } - - // If data doesn't exist clear else set activity to the presence data - if (!presenceData.details) { - // Clear tray - presence.setActivity(); // Clear activity - } else presence.setActivity(presenceData); -}); + clientId: '719757905888542730', +}) + +let actionTimestamp: number | null = null + +presence.on('UpdateData', async () => { + const presenceData: PresenceData = { + largeImageKey: 'https://cdn.rcd.gg/PreMiD/websites/G/Gitbook/assets/logo.png', + } + + if (location.hostname === 'app.gitbook.com') { + // In dashboard? + if (document.querySelector('[class*=--dashboardBody-')) { + const dashName = document.querySelector( + '[class*=--dashboardMenu-] [class*=--headerText-]', + ) + presenceData.details = dashName + ? `In ${dashName.textContent}'s Dashboard` + : 'In a Dashboard' + actionTimestamp = null + } + else { + presenceData.smallImageKey = Assets.Writing + presenceData.smallImageText = 'Editing' + + const docName = document.querySelector('[class*=\'logoText-\'] span') + const pageName = document.querySelector('[class*=--navButtonOpened-] span') + + actionTimestamp ??= Date.now() + if (docName) + presenceData.details = `Editing ${docName.textContent}` + if (pageName) + presenceData.state = `on ${pageName.textContent}` + presenceData.startTimestamp = actionTimestamp + } + } + else { + presenceData.smallImageKey = Assets.Reading + presenceData.smallImageText = 'Viewing' + + const docName = document.querySelector('[class*=\'logoText-\'] span') + const pageName = document.querySelector('[class*=--navButtonOpened-] span') + + actionTimestamp ??= Date.now() + if (docName) + presenceData.details = `Viewing ${docName.textContent}` + if (pageName) + presenceData.state = `on ${pageName.textContent}` + presenceData.startTimestamp = actionTimestamp + } + + // If data doesn't exist clear else set activity to the presence data + if (!presenceData.details) { + // Clear tray + presence.setActivity() // Clear activity + } + else { + presence.setActivity(presenceData) + } +}) diff --git a/websites/G/Gitea/metadata.json b/websites/G/Gitea/metadata.json index 877bb9e4a0c4..5459c5386fd8 100644 --- a/websites/G/Gitea/metadata.json +++ b/websites/G/Gitea/metadata.json @@ -1,27 +1,27 @@ { - "$schema": "https://schemas.premid.app/metadata/1.12", - "apiVersion": 1, - "author": { - "name": "CRUGG", - "id": "228965621478588416" - }, - "service": "Gitea", - "description": { - "en": "Gitea is an Open-Source Git Platform heavily inspired by GitHub", - "de": "Gitea ist eine Open-Source Git Plattform, welche sehr stark an GitHub angelehnt ist", - "nl": "Gitea is een Open-Source Git Platform, sterk geïnspireerd door GitHub" - }, - "url": "gitea.com", - "version": "1.2.25", - "logo": "https://cdn.rcd.gg/PreMiD/websites/G/Gitea/assets/logo.png", - "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/Gitea/assets/thumbnail.png", - "color": "#5aa509", - "category": "other", - "tags": [ - "git", - "programming", - "development", - "sharing", - "coding" - ] -} \ No newline at end of file + "$schema": "https://schemas.premid.app/metadata/1.12", + "apiVersion": 1, + "author": { + "name": "CRUGG", + "id": "228965621478588416" + }, + "service": "Gitea", + "description": { + "en": "Gitea is an Open-Source Git Platform heavily inspired by GitHub", + "de": "Gitea ist eine Open-Source Git Plattform, welche sehr stark an GitHub angelehnt ist", + "nl": "Gitea is een Open-Source Git Platform, sterk geïnspireerd door GitHub" + }, + "url": "gitea.com", + "version": "1.2.25", + "logo": "https://cdn.rcd.gg/PreMiD/websites/G/Gitea/assets/logo.png", + "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/Gitea/assets/thumbnail.png", + "color": "#5aa509", + "category": "other", + "tags": [ + "git", + "programming", + "development", + "sharing", + "coding" + ] +} diff --git a/websites/G/Gitea/presence.ts b/websites/G/Gitea/presence.ts index d89cd0e0e459..e45cfed3c211 100644 --- a/websites/G/Gitea/presence.ts +++ b/websites/G/Gitea/presence.ts @@ -1,163 +1,196 @@ const presence = new Presence({ - clientId: "682218734391394338", - }), - browsingTimestamp = Math.floor(Date.now() / 1000); + clientId: '682218734391394338', +}) +const browsingTimestamp = Math.floor(Date.now() / 1000) -presence.on("UpdateData", async () => { - const presenceData: PresenceData = { - largeImageKey: "https://cdn.rcd.gg/PreMiD/websites/G/Gitea/assets/logo.png", - startTimestamp: browsingTimestamp, - }; - switch (document.location.pathname) { - case "/": { - presenceData.details = "Viewing the front page..."; - break; - } - case "/user/login": - case "/user/login/openid": { - presenceData.details = "Logging in..."; - break; - } - case "/user/sign_up": { - presenceData.details = "Signing up..."; - break; - } - case "/issues": { - presenceData.details = "Viewing their Issues..."; - break; - } - case "/pulls": { - presenceData.details = "Viewing their Pull Requests..."; - break; - } - case "/milestones": { - presenceData.details = "Viewing their Milestones..."; - break; - } - case "/explore/repos": { - presenceData.details = "Exploring Repositories..."; - break; - } - case "/explore/users": { - presenceData.details = "Exploring Users..."; - break; - } - case "/explore/organizations": { - presenceData.details = "Exploring Organizations..."; - break; - } - default: - if (document.location.pathname.startsWith("/user/settings")) - presenceData.details = "Changing their Settings..."; - else if (document.location.pathname.startsWith("/notifications")) - presenceData.details = "Checking their Notifications..."; - else if (document.location.pathname.startsWith("/repo/create")) - presenceData.details = "Creating a new Repository..."; - else if (document.location.pathname.startsWith("/repo/migrate")) - presenceData.details = "Creating a new Migration Repository..."; - else if (document.location.pathname.startsWith("/org/create")) - presenceData.details = "Creating a new Organization..."; - else if (document.querySelector(".user.profile")) { - // Profile Page - presenceData.details = `Viewing Profile: ${ - document.querySelectorAll(".username")[0].textContent - }`; - if ( - document.querySelectorAll(".username")[0].parentElement - .firstElementChild - ) { - presenceData.details += ` (${ - document.querySelectorAll(".username")[0].parentElement - .firstElementChild.textContent - })`; - } - const tab = new URLSearchParams(window.location.search).get("tab"); - if (tab) { - switch (tab) { - case "activity": { - presenceData.state = "Tab: Public Activity"; - break; - } - case "stars": { - presenceData.state = "Tab: Starred Repositories"; - break; - } - case "following": { - presenceData.state = "Tab: Following"; - break; - } - case "followers": - { - presenceData.state = "Tab: Followers"; - // No default - } - break; - } - } else presenceData.state = "Tab: Repositories"; - } else if (document.querySelector("#org-info")) { - // Organization Page - const displayName = document - .querySelector("#org-info") - .querySelector(".ui.header") - .textContent.replace(/\s*(?=(shaare))/gm, "") - .replace(/(?<=(shaare))\s*/gm, ""), - [, orgName] = document.location.pathname.split("/"); - if (displayName === orgName) - presenceData.details = `Viewing Organization: ${orgName}`; - else - presenceData.details = `Viewing Organization: ${displayName} (${orgName})`; - } else if (document.querySelector(".repository")) { - // Repository Page - presenceData.details = `Viewing Repository: ${ - document.location.pathname.split("/")[1] - }/${document.location.pathname.split("/")[2]}`; - if (document.location.pathname.split("/")[3] === "issues") { - if (document.querySelector("#issue-title")) { - presenceData.state = `Viewing an Issue... (${ - document.querySelector(".index").textContent - })`; - } else presenceData.state = "Viewing Issues..."; - } else if (document.location.pathname.split("/")[3] === "pulls") { - if (document.querySelector("#issue-title")) { - presenceData.state = `Viewing a Pull Request... (${ - document.querySelector(".index").textContent - })`; - } else presenceData.state = "Viewing Pull Requests..."; - } else if (document.location.pathname.split("/")[3] === "releases") - presenceData.state = "Viewing Releases..."; - else if (document.location.pathname.split("/")[3] === "wiki") { - presenceData.state = "Viewing Wiki..."; - if (document.querySelector(".basic.small.button")) { - presenceData.state += ` (${document - .querySelector(".basic.small.button") - .firstElementChild.textContent.match(/.*<\/strong>/m)[0] - .replace(/(|<\/strong>)/gm, "")})`; - } - } else if (document.location.pathname.split("/")[3] === "activity") - presenceData.state = "Viewing Activity..."; - else if (document.location.pathname.split("/")[3] === "src") { - presenceData.state = `Viewing Files... (${ - document.querySelectorAll(".octicon-git-branch")[1].parentNode - .lastChild.textContent - } Branch)`; - } else if (document.location.pathname.split("/")[3] === "commits") { - presenceData.state = `Viewing Commits... (${ - document.querySelectorAll(".octicon-git-branch")[1].parentNode - .lastChild.textContent - } Branch)`; - } else if (document.location.pathname.split("/")[3] === "branches") - presenceData.state = "Viewing Branches"; - else if (document.location.pathname.split("/")[3] === "forks") - presenceData.state = "Viewing Forks"; - else if (document.location.pathname.split("/")[3] === "stars") - presenceData.state = "Viewing Stargazers"; - else if (document.location.pathname.split("/")[3] === "watchers") - presenceData.state = "Viewing Watchers"; - else if (document.location.pathname.split("/")[3] === "labels") - presenceData.state = "Viewing Labels"; - else if (!document.location.pathname.split("/")[3]) - presenceData.state = "Viewing Files... (master Branch)"; - } - } - presence.setActivity(presenceData); -}); +presence.on('UpdateData', async () => { + const presenceData: PresenceData = { + largeImageKey: 'https://cdn.rcd.gg/PreMiD/websites/G/Gitea/assets/logo.png', + startTimestamp: browsingTimestamp, + } + switch (document.location.pathname) { + case '/': { + presenceData.details = 'Viewing the front page...' + break + } + case '/user/login': + case '/user/login/openid': { + presenceData.details = 'Logging in...' + break + } + case '/user/sign_up': { + presenceData.details = 'Signing up...' + break + } + case '/issues': { + presenceData.details = 'Viewing their Issues...' + break + } + case '/pulls': { + presenceData.details = 'Viewing their Pull Requests...' + break + } + case '/milestones': { + presenceData.details = 'Viewing their Milestones...' + break + } + case '/explore/repos': { + presenceData.details = 'Exploring Repositories...' + break + } + case '/explore/users': { + presenceData.details = 'Exploring Users...' + break + } + case '/explore/organizations': { + presenceData.details = 'Exploring Organizations...' + break + } + default: + if (document.location.pathname.startsWith('/user/settings')) { + presenceData.details = 'Changing their Settings...' + } + else if (document.location.pathname.startsWith('/notifications')) { + presenceData.details = 'Checking their Notifications...' + } + else if (document.location.pathname.startsWith('/repo/create')) { + presenceData.details = 'Creating a new Repository...' + } + else if (document.location.pathname.startsWith('/repo/migrate')) { + presenceData.details = 'Creating a new Migration Repository...' + } + else if (document.location.pathname.startsWith('/org/create')) { + presenceData.details = 'Creating a new Organization...' + } + else if (document.querySelector('.user.profile')) { + // Profile Page + presenceData.details = `Viewing Profile: ${ + document.querySelectorAll('.username')[0].textContent + }` + if ( + document.querySelectorAll('.username')[0].parentElement + ?.firstElementChild + ) { + presenceData.details += ` (${ + document.querySelectorAll('.username')[0].parentElement + ?.firstElementChild + ?.textContent + })` + } + const tab = new URLSearchParams(window.location.search).get('tab') + if (tab) { + switch (tab) { + case 'activity': { + presenceData.state = 'Tab: Public Activity' + break + } + case 'stars': { + presenceData.state = 'Tab: Starred Repositories' + break + } + case 'following': { + presenceData.state = 'Tab: Following' + break + } + case 'followers': { + presenceData.state = 'Tab: Followers' + break + } + } + } + else { + presenceData.state = 'Tab: Repositories' + } + } + else if (document.querySelector('#org-info')) { + // Organization Page + const displayName = document + .querySelector('#org-info') + ?.querySelector('.ui.header') + ?.textContent + ?.replace(/\s*(?=(shaare))/g, '') + .replace(/(?<=(shaare))\s*/g, '') + const [, orgName] = document.location.pathname.split('/') + if (displayName === orgName) + presenceData.details = `Viewing Organization: ${orgName}` + else + presenceData.details = `Viewing Organization: ${displayName} (${orgName})` + } + else if (document.querySelector('.repository')) { + // Repository Page + presenceData.details = `Viewing Repository: ${ + document.location.pathname.split('/')[1] + }/${document.location.pathname.split('/')[2]}` + if (document.location.pathname.split('/')[3] === 'issues') { + if (document.querySelector('#issue-title')) { + presenceData.state = `Viewing an Issue... (${ + document.querySelector('.index')?.textContent + })` + } + else { + presenceData.state = 'Viewing Issues...' + } + } + else if (document.location.pathname.split('/')[3] === 'pulls') { + if (document.querySelector('#issue-title')) { + presenceData.state = `Viewing a Pull Request... (${ + document.querySelector('.index')?.textContent + })` + } + else { + presenceData.state = 'Viewing Pull Requests...' + } + } + else if (document.location.pathname.split('/')[3] === 'releases') { + presenceData.state = 'Viewing Releases...' + } + else if (document.location.pathname.split('/')[3] === 'wiki') { + presenceData.state = 'Viewing Wiki...' + if (document.querySelector('.basic.small.button')) { + presenceData.state += ` (${document + .querySelector('.basic.small.button') + ?.firstElementChild + ?.textContent + ?.match(/.*<\/strong>/)?.[0] + ?.replace(/(|<\/strong>)/g, '')})` + } + } + else if (document.location.pathname.split('/')[3] === 'activity') { + presenceData.state = 'Viewing Activity...' + } + else if (document.location.pathname.split('/')[3] === 'src') { + presenceData.state = `Viewing Files... (${ + document.querySelectorAll('.octicon-git-branch')[1].parentNode + ?.lastChild + ?.textContent + } Branch)` + } + else if (document.location.pathname.split('/')[3] === 'commits') { + presenceData.state = `Viewing Commits... (${ + document.querySelectorAll('.octicon-git-branch')[1].parentNode + ?.lastChild + ?.textContent + } Branch)` + } + else if (document.location.pathname.split('/')[3] === 'branches') { + presenceData.state = 'Viewing Branches' + } + else if (document.location.pathname.split('/')[3] === 'forks') { + presenceData.state = 'Viewing Forks' + } + else if (document.location.pathname.split('/')[3] === 'stars') { + presenceData.state = 'Viewing Stargazers' + } + else if (document.location.pathname.split('/')[3] === 'watchers') { + presenceData.state = 'Viewing Watchers' + } + else if (document.location.pathname.split('/')[3] === 'labels') { + presenceData.state = 'Viewing Labels' + } + else if (!document.location.pathname.split('/')[3]) { + presenceData.state = 'Viewing Files... (master Branch)' + } + } + } + presence.setActivity(presenceData) +}) diff --git a/websites/G/Glimesh/metadata.json b/websites/G/Glimesh/metadata.json index 5a9da110d238..ea48de426ae8 100644 --- a/websites/G/Glimesh/metadata.json +++ b/websites/G/Glimesh/metadata.json @@ -1,50 +1,50 @@ { - "$schema": "https://schemas.premid.app/metadata/1.12", - "apiVersion": 1, - "author": { - "name": "Nathaniel.", - "id": "147891648628654082" - }, - "service": "Glimesh", - "description": { - "en": "Glimesh is the next generation streaming platform built by the community for the community.", - "nl": "Glimesh is het streamingplatform van de volgende generatie dat door de community voor de community is gebouwd." - }, - "url": [ - "glimesh.tv", - "support.glimesh.tv", - "blog.glimesh.tv", - "glim.shop" - ], - "version": "1.0.23", - "logo": "https://cdn.rcd.gg/PreMiD/websites/G/Glimesh/assets/logo.png", - "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/Glimesh/assets/thumbnail.jpg", - "color": "#2c409b", - "category": "videos", - "tags": [ - "stream", - "glimesh", - "tv", - "live" - ], - "settings": [ - { - "id": "show_details", - "title": "Show Details", - "icon": "fas fa-address-card", - "value": true - }, - { - "id": "show_buttons", - "title": "Show Buttons", - "icon": "fab fa-codepen", - "value": true - }, - { - "id": "show_timestamps", - "title": "Show Timestamps", - "icon": "fas fa-clock", - "value": true - } - ] -} \ No newline at end of file + "$schema": "https://schemas.premid.app/metadata/1.12", + "apiVersion": 1, + "author": { + "name": "Nathaniel.", + "id": "147891648628654082" + }, + "service": "Glimesh", + "description": { + "en": "Glimesh is the next generation streaming platform built by the community for the community.", + "nl": "Glimesh is het streamingplatform van de volgende generatie dat door de community voor de community is gebouwd." + }, + "url": [ + "glimesh.tv", + "support.glimesh.tv", + "blog.glimesh.tv", + "glim.shop" + ], + "version": "1.0.23", + "logo": "https://cdn.rcd.gg/PreMiD/websites/G/Glimesh/assets/logo.png", + "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/Glimesh/assets/thumbnail.jpg", + "color": "#2c409b", + "category": "videos", + "tags": [ + "stream", + "glimesh", + "tv", + "live" + ], + "settings": [ + { + "id": "show_details", + "title": "Show Details", + "icon": "fas fa-address-card", + "value": true + }, + { + "id": "show_buttons", + "title": "Show Buttons", + "icon": "fab fa-codepen", + "value": true + }, + { + "id": "show_timestamps", + "title": "Show Timestamps", + "icon": "fas fa-clock", + "value": true + } + ] +} diff --git a/websites/G/Glimesh/presence.ts b/websites/G/Glimesh/presence.ts index bed6ad403785..2a2e3057418d 100644 --- a/websites/G/Glimesh/presence.ts +++ b/websites/G/Glimesh/presence.ts @@ -1,187 +1,204 @@ const presence = new Presence({ - clientId: "825888886285795329", -}); - -let elapsedTime: number = null; - -presence.on("UpdateData", async () => { - const locationHref = document.location.href, - locationPath = document.location.pathname, - presenceData: PresenceData = { - largeImageKey: - "https://cdn.rcd.gg/PreMiD/websites/G/Glimesh/assets/logo.png", - }; - - switch (document.location.host) { - case "glimesh.tv": { - presenceData.details = "Browsing..."; - if (locationPath === "/") presenceData.details = "Viewing Home Page"; - else if (locationPath.match("/streams/")) { - presenceData.details = "Viewing Category"; - presenceData.state = document.title.replace(" - Glimesh", ""); - } else if (locationPath === "/users" || locationPath === "/users/") - presenceData.details = "Viewing All Users"; - else if (locationPath.match("users/settings")) - presenceData.details = "Viewing Settings"; - else if (locationPath.match("/about")) { - presenceData.details = "Reading about Glimesh"; - if (locationPath.match("alpha")) { - presenceData.details = "Reading About"; - presenceData.state = "Alpha Features"; - } else if (locationPath.match("streaming")) { - presenceData.details = "Reading About"; - presenceData.state = "Streaming"; - } else if (locationPath.match("team")) - presenceData.details = "Viewing the Team"; - else if (locationPath.match("mission")) - presenceData.details = "Reading the Mission"; - else if (locationPath.match("credits")) - presenceData.details = "Reading the Credits"; - else if (locationPath.match("dmca")) { - presenceData.details = "Reading About"; - presenceData.state = "DMCA Policy"; - } else if (locationPath.match("faq")) { - presenceData.details = "Reading"; - presenceData.state = "Frequently asked Questions"; - } else if (locationPath.match("terms")) { - presenceData.details = "Reading the"; - presenceData.state = "Terms of Service"; - } else if (locationPath.match("condut")) { - presenceData.details = "Reading the"; - presenceData.state = "Rules of Conduct"; - } else if (locationPath.match("privacy")) { - presenceData.details = "Reading the"; - presenceData.state = "Privacy Policy"; - } else if (locationPath.match("open-data")) { - presenceData.details = "Viewing Open Data"; - presenceData.state = "Platform User Growth"; - - if (locationPath.match("subscriptions")) - presenceData.state = "Recurring Subscriptions"; - else if (locationPath.match("streams")) - presenceData.state = "Live Streams"; - } - } else if (locationPath.match("/profile")) { - presenceData.details = `Viewing${ - !(await presence.getSetting("show_details")) ? " a " : " " - }Profile`; - - if (await presence.getSetting("show_details")) { - presenceData.state = document.title.replace( - "'s Profile - Glimesh", - "" - ); - } - - if ( - (await presence.getSetting("show_buttons")) && - (await presence.getSetting("show_details")) - ) { - presenceData.buttons = [ - { - label: "View Profile", - url: locationHref, - }, - ]; - } - } else if (document.querySelector("#video-column")) { - presenceData.details = (await presence.getSetting( - "show_details" - )) - ? document.title.replace(" - Glimesh", "") - : "Watching a Stream"; - if (await presence.getSetting("show_details")) - presenceData.state = document.querySelector("h3").textContent; - - const video = document.querySelector("video"); - - if ( - (await presence.getSetting("show_buttons")) && - (await presence.getSetting("show_details")) - ) { - presenceData.buttons = [ - { - label: "View Profile", - url: ( - document.querySelector( - "#video-column > div > div.card-footer.p-1.d-none.d-sm-block > div > div.col-8.d-inline-flex.align-items-center > a" - ) as HTMLAnchorElement - ).href, - }, - ]; - } - - if (video && !isNaN(video.duration)) { - if ( - (await presence.getSetting("show_buttons")) && - (await presence.getSetting("show_details")) - ) { - presenceData.buttons.unshift({ - label: "Watch Stream", - url: locationHref, - }); - } - - if (!video.paused) { - if (elapsedTime === null) - elapsedTime = Math.floor(Date.now() / 1000); - - presenceData.smallImageKey = Assets.Play; - presenceData.smallImageText = "Live!"; - - if (await presence.getSetting("show_timestamps")) - presenceData.startTimestamp = elapsedTime; - } else { - presenceData.smallImageKey = Assets.Pause; - presenceData.smallImageText = "Paused"; - - if (await presence.getSetting("show_timestamps")) - presenceData.startTimestamp = 0; - } - } - } - - break; - } - case "glim.shop": { - presenceData.details = "Viewing Merch Store"; - break; - } - case "support.glimesh.tv": { - presenceData.details = "Viewing Support"; - break; - } - case "blog.glimesh.tv": { - presenceData.details = "Viewing Blogs"; - - if (locationPath.match("/posts")) { - presenceData.details = `Reading${ - !(await presence.getSetting("show_details")) ? " a " : " " - }Blog`; - if (await presence.getSetting("show_details")) { - presenceData.state = document.querySelector( - "body > div > div > div > h1 > a" - ).textContent; - } - - if ( - (await presence.getSetting("show_buttons")) && - (await presence.getSetting("show_details")) - ) { - presenceData.buttons = [ - { - label: "View Blog Post", - url: locationHref, - }, - ]; - } - } - - break; - } - // No default - } - - if (presenceData.details) presence.setActivity(presenceData); - else presence.setActivity(); -}); + clientId: '825888886285795329', +}) + +let elapsedTime: number | null = null + +presence.on('UpdateData', async () => { + const locationHref = document.location.href + const locationPath = document.location.pathname + const presenceData: PresenceData = { + largeImageKey: 'https://cdn.rcd.gg/PreMiD/websites/G/Glimesh/assets/logo.png', + } + + switch (document.location.host) { + case 'glimesh.tv': { + presenceData.details = 'Browsing...' + if (locationPath === '/') { + presenceData.details = 'Viewing Home Page' + } + else if (locationPath.match('/streams/')) { + presenceData.details = 'Viewing Category' + presenceData.state = document.title.replace(' - Glimesh', '') + } + else if (locationPath === '/users' || locationPath === '/users/') { + presenceData.details = 'Viewing All Users' + } + else if (locationPath.match('users/settings')) { + presenceData.details = 'Viewing Settings' + } + else if (locationPath.match('/about')) { + presenceData.details = 'Reading about Glimesh' + if (locationPath.match('alpha')) { + presenceData.details = 'Reading About' + presenceData.state = 'Alpha Features' + } + else if (locationPath.match('streaming')) { + presenceData.details = 'Reading About' + presenceData.state = 'Streaming' + } + else if (locationPath.match('team')) { + presenceData.details = 'Viewing the Team' + } + else if (locationPath.match('mission')) { + presenceData.details = 'Reading the Mission' + } + else if (locationPath.match('credits')) { + presenceData.details = 'Reading the Credits' + } + else if (locationPath.match('dmca')) { + presenceData.details = 'Reading About' + presenceData.state = 'DMCA Policy' + } + else if (locationPath.match('faq')) { + presenceData.details = 'Reading' + presenceData.state = 'Frequently asked Questions' + } + else if (locationPath.match('terms')) { + presenceData.details = 'Reading the' + presenceData.state = 'Terms of Service' + } + else if (locationPath.match('condut')) { + presenceData.details = 'Reading the' + presenceData.state = 'Rules of Conduct' + } + else if (locationPath.match('privacy')) { + presenceData.details = 'Reading the' + presenceData.state = 'Privacy Policy' + } + else if (locationPath.match('open-data')) { + presenceData.details = 'Viewing Open Data' + presenceData.state = 'Platform User Growth' + + if (locationPath.match('subscriptions')) + presenceData.state = 'Recurring Subscriptions' + else if (locationPath.match('streams')) + presenceData.state = 'Live Streams' + } + } + else if (locationPath.match('/profile')) { + presenceData.details = `Viewing${ + !(await presence.getSetting('show_details')) ? ' a ' : ' ' + }Profile` + + if (await presence.getSetting('show_details')) { + presenceData.state = document.title.replace( + '\'s Profile - Glimesh', + '', + ) + } + + if ( + (await presence.getSetting('show_buttons')) + && (await presence.getSetting('show_details')) + ) { + presenceData.buttons = [ + { + label: 'View Profile', + url: locationHref, + }, + ] + } + } + else if (document.querySelector('#video-column')) { + presenceData.details = (await presence.getSetting( + 'show_details', + )) + ? document.title.replace(' - Glimesh', '') + : 'Watching a Stream' + if (await presence.getSetting('show_details')) + presenceData.state = document.querySelector('h3')?.textContent + + const video = document.querySelector('video') + + if ( + (await presence.getSetting('show_buttons')) + && (await presence.getSetting('show_details')) + ) { + presenceData.buttons = [ + { + label: 'View Profile', + url: ( + document.querySelector( + '#video-column > div > div.card-footer.p-1.d-none.d-sm-block > div > div.col-8.d-inline-flex.align-items-center > a', + ) as HTMLAnchorElement + ).href, + }, + ] + } + + if (video && !Number.isNaN(video.duration)) { + if ( + (await presence.getSetting('show_buttons')) + && (await presence.getSetting('show_details')) + ) { + presenceData.buttons?.unshift({ + label: 'Watch Stream', + url: locationHref, + }) + } + + if (!video.paused) { + if (elapsedTime === null) + elapsedTime = Math.floor(Date.now() / 1000) + + presenceData.smallImageKey = Assets.Play + presenceData.smallImageText = 'Live!' + + if (await presence.getSetting('show_timestamps')) + presenceData.startTimestamp = elapsedTime + } + else { + presenceData.smallImageKey = Assets.Pause + presenceData.smallImageText = 'Paused' + + if (await presence.getSetting('show_timestamps')) + presenceData.startTimestamp = 0 + } + } + } + + break + } + case 'glim.shop': { + presenceData.details = 'Viewing Merch Store' + break + } + case 'support.glimesh.tv': { + presenceData.details = 'Viewing Support' + break + } + case 'blog.glimesh.tv': { + presenceData.details = 'Viewing Blogs' + + if (locationPath.match('/posts')) { + presenceData.details = `Reading${ + !(await presence.getSetting('show_details')) ? ' a ' : ' ' + }Blog` + if (await presence.getSetting('show_details')) { + presenceData.state = document.querySelector( + 'body > div > div > div > h1 > a', + )?.textContent + } + + if ( + (await presence.getSetting('show_buttons')) + && (await presence.getSetting('show_details')) + ) { + presenceData.buttons = [ + { + label: 'View Blog Post', + url: locationHref, + }, + ] + } + } + + break + } + } + + if (presenceData.details) + presence.setActivity(presenceData) + else presence.setActivity() +}) diff --git a/websites/G/Glitch/metadata.json b/websites/G/Glitch/metadata.json index 38fda58c4f3a..c03412209860 100644 --- a/websites/G/Glitch/metadata.json +++ b/websites/G/Glitch/metadata.json @@ -1,30 +1,30 @@ { - "$schema": "https://schemas.premid.app/metadata/1.12", - "apiVersion": 1, - "author": { - "name": "Callum", - "id": "506899274748133376" - }, - "service": "Glitch", - "description": { - "en": "Glitch is the friendly community where you can find or create the app of your dreams. Over a million people have become part of the Glitch community, creating amazing apps, bots, websites, art projects, virtual reality experiences, interactive infographics and much more.", - "ga_IE": "Is é Glitch an pobal cairdiúil inar féidir leat an app do aislingí a aimsiú nó a chruthú. Tá níos mó ná milliún duine anois mar chuid de phobal Glitch, ag cruthú apps, bots, láithreáin ghréasáin, tionscadail ealaíne, eispéiris réaltachta fhíorúla, grafaicí faisnéise idirghníomhacha agus i bhfad níos mó.", - "nl": "Glitch is de vriendelijke community waar je de app van je dromen kunt vinden of maken. Meer dan een miljoen mensen zijn onderdeel geworden van de Glitch-community en hebben geweldige apps, bots, websites, kunstprojecten, virtual reality-ervaringen, interactieve infographics en nog veel meer gemaakt." - }, - "url": [ - "glitch.com", - "support.glitch.com", - "status.glitch.com" - ], - "regExp": "([a-z0-9-]+[.])*glitch([.][a-z]+)+[/]", - "version": "1.8.24", - "logo": "https://cdn.rcd.gg/PreMiD/websites/G/Glitch/assets/logo.png", - "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/Glitch/assets/thumbnail.png", - "color": "#f003fc", - "category": "other", - "tags": [ - "developing", - "hosting", - "community" - ] -} \ No newline at end of file + "$schema": "https://schemas.premid.app/metadata/1.12", + "apiVersion": 1, + "author": { + "name": "Callum", + "id": "506899274748133376" + }, + "service": "Glitch", + "description": { + "en": "Glitch is the friendly community where you can find or create the app of your dreams. Over a million people have become part of the Glitch community, creating amazing apps, bots, websites, art projects, virtual reality experiences, interactive infographics and much more.", + "ga_IE": "Is é Glitch an pobal cairdiúil inar féidir leat an app do aislingí a aimsiú nó a chruthú. Tá níos mó ná milliún duine anois mar chuid de phobal Glitch, ag cruthú apps, bots, láithreáin ghréasáin, tionscadail ealaíne, eispéiris réaltachta fhíorúla, grafaicí faisnéise idirghníomhacha agus i bhfad níos mó.", + "nl": "Glitch is de vriendelijke community waar je de app van je dromen kunt vinden of maken. Meer dan een miljoen mensen zijn onderdeel geworden van de Glitch-community en hebben geweldige apps, bots, websites, kunstprojecten, virtual reality-ervaringen, interactieve infographics en nog veel meer gemaakt." + }, + "url": [ + "glitch.com", + "support.glitch.com", + "status.glitch.com" + ], + "regExp": "([a-z0-9-]+[.])*glitch([.][a-z]+)+[/]", + "version": "1.8.24", + "logo": "https://cdn.rcd.gg/PreMiD/websites/G/Glitch/assets/logo.png", + "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/Glitch/assets/thumbnail.png", + "color": "#f003fc", + "category": "other", + "tags": [ + "developing", + "hosting", + "community" + ] +} diff --git a/websites/G/Glitch/presence.ts b/websites/G/Glitch/presence.ts index 397f763772a8..40de3afd86af 100644 --- a/websites/G/Glitch/presence.ts +++ b/websites/G/Glitch/presence.ts @@ -1,86 +1,108 @@ const presence = new Presence({ - clientId: "630101652380188692", -}); + clientId: '630101652380188692', +}) -presence.on("UpdateData", () => { - const presenceData: PresenceData = { - largeImageKey: - "https://cdn.rcd.gg/PreMiD/websites/G/Glitch/assets/logo.png", - }; +presence.on('UpdateData', () => { + const presenceData: PresenceData = { + largeImageKey: 'https://cdn.rcd.gg/PreMiD/websites/G/Glitch/assets/logo.png', + } - if (window.location.href.includes(".glitch.me")) { - presenceData.details = "Viewing a webpage"; - presenceData.state = window.location.hostname; - } else if (window.location.href.includes("status.glitch.com")) - presenceData.details = "https://status.glitch.com"; - else if (window.location.href.includes("support.glitch.com")) { - if (window.location.pathname.toLowerCase() === "/") { - presenceData.details = "Viewing support topics"; - presenceData.state = "Latest topics"; - } else if (window.location.pathname.toLowerCase() === "/latest") { - presenceData.details = "Viewing support topics"; - presenceData.state = "Latest topics"; - } else if (window.location.pathname.toLowerCase() === "/new") { - presenceData.details = "Viewing support topics"; - presenceData.state = "New topics"; - } else if (window.location.pathname.toLowerCase() === "/unread") { - presenceData.details = "Viewing support topics"; - presenceData.state = "Unread topics"; - } else if (window.location.pathname.toLowerCase() === "/top") { - presenceData.details = "Viewing support topics"; - presenceData.state = "Top topics"; - } else if (window.location.pathname.toLowerCase() === "/categories") { - presenceData.details = "Viewing support topics"; - presenceData.state = "Categories"; - } else if ( - window.location.href.toLowerCase().includes("support.glitch.com/t/") - ) { - presenceData.details = "Viewing a topic:"; - presenceData.state = document.title; - } else if ( - window.location.href.toLowerCase().includes("support.glitch.com/u/") - ) { - presenceData.details = "Viewing a user profile:"; - presenceData.state = document.querySelector( - "body > section > div > div > div > section > section > div > div > div > div > h2 " - ).textContent; - } - } else { - presenceData.details = "Viewing a page:"; - if (window.location.pathname.toLowerCase() === "/") - presenceData.state = "Homepage"; - else if (window.location.pathname.toLowerCase().includes("/questions")) { - presenceData.details = "Viewing a page:"; - presenceData.state = "Questions"; - } else if (window.location.pathname.toLowerCase().includes("/create")) { - presenceData.details = "Viewing a page:"; - presenceData.state = "Create"; - } else if (window.location.pathname.toLowerCase().includes("/about")) { - presenceData.details = "Viewing a page:"; - presenceData.state = "About"; - } else if (window.location.pathname.toLowerCase().includes("/culture")) { - presenceData.details = "Viewing a page:"; - presenceData.state = "Blog & Culture"; - } else if (window.location.pathname.toLowerCase().includes("/help")) { - presenceData.details = "Viewing a page:"; - presenceData.state = "Help & FAQ"; - } else if (window.location.pathname.toLowerCase().includes("/legal")) { - presenceData.details = "Viewing a page:"; - presenceData.state = "Legal"; - } else if (window.location.pathname.toLowerCase().includes("edit")) { - presenceData.details = "Editing a project:"; - presenceData.state = document.querySelector( - "body > div > div > header > nav > button > div > span" - ).textContent; - } else if (window.location.pathname.toLowerCase().includes("~")) { - presenceData.details = "Viewing a project:"; - presenceData.state = window.location.pathname.replace("/", ""); - } else if (window.location.pathname.toLowerCase().includes("@")) { - presenceData.details = "Viewing a team or user:"; - presenceData.state = window.location.pathname.replace("/", ""); - } else delete presenceData.details; - } + if (window.location.href.includes('.glitch.me')) { + presenceData.details = 'Viewing a webpage' + presenceData.state = window.location.hostname + } + else if (window.location.href.includes('status.glitch.com')) { + presenceData.details = 'https://status.glitch.com' + } + else if (window.location.href.includes('support.glitch.com')) { + if (window.location.pathname.toLowerCase() === '/') { + presenceData.details = 'Viewing support topics' + presenceData.state = 'Latest topics' + } + else if (window.location.pathname.toLowerCase() === '/latest') { + presenceData.details = 'Viewing support topics' + presenceData.state = 'Latest topics' + } + else if (window.location.pathname.toLowerCase() === '/new') { + presenceData.details = 'Viewing support topics' + presenceData.state = 'New topics' + } + else if (window.location.pathname.toLowerCase() === '/unread') { + presenceData.details = 'Viewing support topics' + presenceData.state = 'Unread topics' + } + else if (window.location.pathname.toLowerCase() === '/top') { + presenceData.details = 'Viewing support topics' + presenceData.state = 'Top topics' + } + else if (window.location.pathname.toLowerCase() === '/categories') { + presenceData.details = 'Viewing support topics' + presenceData.state = 'Categories' + } + else if ( + window.location.href.toLowerCase().includes('support.glitch.com/t/') + ) { + presenceData.details = 'Viewing a topic:' + presenceData.state = document.title + } + else if ( + window.location.href.toLowerCase().includes('support.glitch.com/u/') + ) { + presenceData.details = 'Viewing a user profile:' + presenceData.state = document.querySelector( + 'body > section > div > div > div > section > section > div > div > div > div > h2 ', + )?.textContent + } + } + else { + presenceData.details = 'Viewing a page:' + if (window.location.pathname.toLowerCase() === '/') { + presenceData.state = 'Homepage' + } + else if (window.location.pathname.toLowerCase().includes('/questions')) { + presenceData.details = 'Viewing a page:' + presenceData.state = 'Questions' + } + else if (window.location.pathname.toLowerCase().includes('/create')) { + presenceData.details = 'Viewing a page:' + presenceData.state = 'Create' + } + else if (window.location.pathname.toLowerCase().includes('/about')) { + presenceData.details = 'Viewing a page:' + presenceData.state = 'About' + } + else if (window.location.pathname.toLowerCase().includes('/culture')) { + presenceData.details = 'Viewing a page:' + presenceData.state = 'Blog & Culture' + } + else if (window.location.pathname.toLowerCase().includes('/help')) { + presenceData.details = 'Viewing a page:' + presenceData.state = 'Help & FAQ' + } + else if (window.location.pathname.toLowerCase().includes('/legal')) { + presenceData.details = 'Viewing a page:' + presenceData.state = 'Legal' + } + else if (window.location.pathname.toLowerCase().includes('edit')) { + presenceData.details = 'Editing a project:' + presenceData.state = document.querySelector( + 'body > div > div > header > nav > button > div > span', + )?.textContent + } + else if (window.location.pathname.toLowerCase().includes('~')) { + presenceData.details = 'Viewing a project:' + presenceData.state = window.location.pathname.replace('/', '') + } + else if (window.location.pathname.toLowerCase().includes('@')) { + presenceData.details = 'Viewing a team or user:' + presenceData.state = window.location.pathname.replace('/', '') + } + else { + delete presenceData.details + } + } - if (presenceData.details) presence.setActivity(presenceData); - else presence.setActivity(); -}); + if (presenceData.details) + presence.setActivity(presenceData) + else presence.setActivity() +}) diff --git a/websites/G/Glynet/metadata.json b/websites/G/Glynet/metadata.json index c3d61b1d3e93..90449ee4f1b1 100644 --- a/websites/G/Glynet/metadata.json +++ b/websites/G/Glynet/metadata.json @@ -1,30 +1,30 @@ { - "$schema": "https://schemas.premid.app/metadata/1.12", - "apiVersion": 1, - "author": { - "name": "Arda", - "id": "403225819222245377" - }, - "service": "Glynet", - "description": { - "tr": "Glynet, yeni açılmış bir sosyal medya sitesi.", - "en": "Glynet is a social media website that launched newly.", - "nl": "Glynet is een website voor sociale media die onlangs is gelanceerd." - }, - "url": [ - "www.glynet.com", - "glynet.com" - ], - "version": "1.2.24", - "logo": "https://cdn.rcd.gg/PreMiD/websites/G/Glynet/assets/logo.png", - "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/Glynet/assets/thumbnail.png", - "color": "#FFFFFF", - "category": "socials", - "tags": [ - "social-media", - "music", - "turkish", - "glynet", - "news" - ] -} \ No newline at end of file + "$schema": "https://schemas.premid.app/metadata/1.12", + "apiVersion": 1, + "author": { + "name": "Arda", + "id": "403225819222245377" + }, + "service": "Glynet", + "description": { + "tr": "Glynet, yeni açılmış bir sosyal medya sitesi.", + "en": "Glynet is a social media website that launched newly.", + "nl": "Glynet is een website voor sociale media die onlangs is gelanceerd." + }, + "url": [ + "www.glynet.com", + "glynet.com" + ], + "version": "1.2.24", + "logo": "https://cdn.rcd.gg/PreMiD/websites/G/Glynet/assets/logo.png", + "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/Glynet/assets/thumbnail.png", + "color": "#FFFFFF", + "category": "socials", + "tags": [ + "social-media", + "music", + "turkish", + "glynet", + "news" + ] +} diff --git a/websites/G/Glynet/presence.ts b/websites/G/Glynet/presence.ts index 5ee628b6f0fe..d2ca8f37c7ee 100644 --- a/websites/G/Glynet/presence.ts +++ b/websites/G/Glynet/presence.ts @@ -1,70 +1,71 @@ -const presence = new Presence({ clientId: "655480486046466098" }), - browsingTimestamp = Math.floor(Date.now() / 1000), - presenceData: PresenceData = { - largeImageKey: - "https://cdn.rcd.gg/PreMiD/websites/G/Glynet/assets/logo.png", - startTimestamp: browsingTimestamp, - }; +const presence = new Presence({ clientId: '655480486046466098' }) +const browsingTimestamp = Math.floor(Date.now() / 1000) +const presenceData: PresenceData = { + largeImageKey: 'https://cdn.rcd.gg/PreMiD/websites/G/Glynet/assets/logo.png', + startTimestamp: browsingTimestamp, +} -presence.on("UpdateData", () => { - const page = document.location.pathname; +presence.on('UpdateData', () => { + const page = document.location.pathname - if (page === "/") presenceData.details = "Ana sayfa"; + if (page === '/') + presenceData.details = 'Ana sayfa' - if (page.startsWith("/feed")) { - presenceData.details = "Ana sayfa"; - presenceData.state = "Duvarını kontrol ediyor..."; - } + if (page.startsWith('/feed')) { + presenceData.details = 'Ana sayfa' + presenceData.state = 'Duvarını kontrol ediyor...' + } - // Explore - if (page.startsWith("/explore")) presenceData.details = "Keşfet bölümünde..."; + // Explore + if (page.startsWith('/explore')) + presenceData.details = 'Keşfet bölümünde...' - // Hashtags - if (page.startsWith("/hashtag-")) { - presenceData.details = "Bir etikete bakıyor..."; - presenceData.state = document.querySelector( - "#content > div > div:nth-child(2) > div.eksigimneanlamiyorum > div > a" - )?.textContent; - } + // Hashtags + if (page.startsWith('/hashtag-')) { + presenceData.details = 'Bir etikete bakıyor...' + presenceData.state = document.querySelector( + '#content > div > div:nth-child(2) > div.eksigimneanlamiyorum > div > a', + )?.textContent + } - if (page.startsWith("/news")) - presenceData.details = "Haberlere göz atıyor..."; + if (page.startsWith('/news')) + presenceData.details = 'Haberlere göz atıyor...' - // Users - if (page.startsWith("/@")) { - presenceData.details = "Bir profile göz atıyor..."; - presenceData.state = document.querySelector( - "#profiletop_username" - )?.textContent; - } + // Users + if (page.startsWith('/@')) { + presenceData.details = 'Bir profile göz atıyor...' + presenceData.state = document.querySelector( + '#profiletop_username', + )?.textContent + } - // Server Errors + // Server Errors - if (page.startsWith("/404")) { - presenceData.details = "Server Error: 404"; - presenceData.state = "Sayfa bulunamadı."; - } + if (page.startsWith('/404')) { + presenceData.details = 'Server Error: 404' + presenceData.state = 'Sayfa bulunamadı.' + } - if (page.startsWith("/403")) { - presenceData.details = "Server Error: 403"; - presenceData.state = "Yasaklı Bölge!"; - } - if (page.startsWith("/503") || page.startsWith("/500")) { - presenceData.details = `Server Error: ${page.substring(1)}`; - presenceData.state = "Sunucuya şu anda ulaşılamıyor."; - } - if (page.startsWith("/400")) { - presenceData.details = "Server Error: 400"; - presenceData.state = "Geçersiz istek."; - } - if (typeof presenceData.details === "string") - presence.setActivity(presenceData); - else { - presence.setActivity({ - details: "Bilinmeyen bir sayfada...", - startTimestamp: browsingTimestamp, - largeImageKey: - "https://cdn.rcd.gg/PreMiD/websites/G/Glynet/assets/logo.png", - }); - } -}); + if (page.startsWith('/403')) { + presenceData.details = 'Server Error: 403' + presenceData.state = 'Yasaklı Bölge!' + } + if (page.startsWith('/503') || page.startsWith('/500')) { + presenceData.details = `Server Error: ${page.substring(1)}` + presenceData.state = 'Sunucuya şu anda ulaşılamıyor.' + } + if (page.startsWith('/400')) { + presenceData.details = 'Server Error: 400' + presenceData.state = 'Geçersiz istek.' + } + if (typeof presenceData.details === 'string') { + presence.setActivity(presenceData) + } + else { + presence.setActivity({ + details: 'Bilinmeyen bir sayfada...', + startTimestamp: browsingTimestamp, + largeImageKey: 'https://cdn.rcd.gg/PreMiD/websites/G/Glynet/assets/logo.png', + }) + } +}) diff --git a/websites/G/Gmail/metadata.json b/websites/G/Gmail/metadata.json index 922ca1a373d1..42b0c6583bad 100644 --- a/websites/G/Gmail/metadata.json +++ b/websites/G/Gmail/metadata.json @@ -1,55 +1,55 @@ { - "$schema": "https://schemas.premid.app/metadata/1.12", - "apiVersion": 1, - "author": { - "name": "RisingSunLight", - "id": "240521747852558347" - }, - "contributors": [ - { - "name": "Striker", - "id": "215509157837537280" - }, - { - "name": "Tellen", - "id": "535214819520020510" - } - ], - "service": "Gmail", - "description": { - "en": "Gmail is a free email service developed by Google. Users can access Gmail on the web and using third-party programs that synchronize email content through POP or IMAP protocols. Gmail started as a limited beta release on April 1, 2004 and ended its testing phase on July 7, 2009.", - "fr": "Gmail est un service d'email gratuit développé par Google. Les utilisateurs peuvent accéder à Gmail sur le web et utiliser des programmes tiers qui permettent de synchroniser leurs emails grâce à des protocoles POP ou IMAP. Gmail a commencé avec une version bêta limitée le 1er avril 2004 et a terminé sa phase de test le 7 juillet 2009.", - "zh_CN": "Gmail是Google开发的免费电子邮件服务。", - "nl": "Gmail is een gratis e-mailservice van Google. Gebruikers hebben toegang tot Gmail via beveiligde webmail of via het POP3- of IMAP4-protocol.", - "vi_VN": "Gmail là dịch vụ thư điện tử miễn phí được phát triển bởi Google. Người dùng có thể truy cập Gmail trên web và sử dụng phần mềm bên thứ ba để đồng bộ nội dung thư qua phương thức POP hoặc IMAP. Gmail phát hành bản beta đóng kín vào 1 Tháng 4 2004 và kết thúc quá trình thử nghiệm vào 7 Tháng 7 năm 2009." - }, - "url": "mail.google.com", - "version": "2.0.11", - "logo": "https://cdn.rcd.gg/PreMiD/websites/G/Gmail/assets/logo.png", - "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/Gmail/assets/thumbnail.png", - "color": "#DD4B3E", - "category": "other", - "tags": [ - "gmail", - "email", - "other" - ], - "settings": [ - { - "id": "lang", - "multiLanguage": true - }, - { - "id": "privacy", - "title": "Privacy Mode", - "icon": "fad fa-user-secret", - "value": false - }, - { - "id": "time", - "title": "Show Timestamp", - "icon": "fad fa-stopwatch", - "value": true - } - ] -} \ No newline at end of file + "$schema": "https://schemas.premid.app/metadata/1.12", + "apiVersion": 1, + "author": { + "name": "RisingSunLight", + "id": "240521747852558347" + }, + "contributors": [ + { + "name": "Striker", + "id": "215509157837537280" + }, + { + "name": "Tellen", + "id": "535214819520020510" + } + ], + "service": "Gmail", + "description": { + "en": "Gmail is a free email service developed by Google. Users can access Gmail on the web and using third-party programs that synchronize email content through POP or IMAP protocols. Gmail started as a limited beta release on April 1, 2004 and ended its testing phase on July 7, 2009.", + "fr": "Gmail est un service d'email gratuit développé par Google. Les utilisateurs peuvent accéder à Gmail sur le web et utiliser des programmes tiers qui permettent de synchroniser leurs emails grâce à des protocoles POP ou IMAP. Gmail a commencé avec une version bêta limitée le 1er avril 2004 et a terminé sa phase de test le 7 juillet 2009.", + "zh_CN": "Gmail是Google开发的免费电子邮件服务。", + "nl": "Gmail is een gratis e-mailservice van Google. Gebruikers hebben toegang tot Gmail via beveiligde webmail of via het POP3- of IMAP4-protocol.", + "vi_VN": "Gmail là dịch vụ thư điện tử miễn phí được phát triển bởi Google. Người dùng có thể truy cập Gmail trên web và sử dụng phần mềm bên thứ ba để đồng bộ nội dung thư qua phương thức POP hoặc IMAP. Gmail phát hành bản beta đóng kín vào 1 Tháng 4 2004 và kết thúc quá trình thử nghiệm vào 7 Tháng 7 năm 2009." + }, + "url": "mail.google.com", + "version": "2.0.11", + "logo": "https://cdn.rcd.gg/PreMiD/websites/G/Gmail/assets/logo.png", + "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/Gmail/assets/thumbnail.png", + "color": "#DD4B3E", + "category": "other", + "tags": [ + "gmail", + "email", + "other" + ], + "settings": [ + { + "id": "lang", + "multiLanguage": true + }, + { + "id": "privacy", + "title": "Privacy Mode", + "icon": "fad fa-user-secret", + "value": false + }, + { + "id": "time", + "title": "Show Timestamp", + "icon": "fad fa-stopwatch", + "value": true + } + ] +} diff --git a/websites/G/Gmail/presence.ts b/websites/G/Gmail/presence.ts index 9bc9fd42e76a..22516aa78726 100644 --- a/websites/G/Gmail/presence.ts +++ b/websites/G/Gmail/presence.ts @@ -1,114 +1,122 @@ const presence = new Presence({ - clientId: "808667100319186964", - }), - browsingTimestamp = Math.floor(Date.now() / 1000); + clientId: '808667100319186964', +}) +const browsingTimestamp = Math.floor(Date.now() / 1000) async function getStrings() { - return presence.getStrings( - { - categoryPrimary: "gmail.categoryPrimary", - categorySocial: "gmail.categorySocial", - categoryUpdates: "gmail.categoryUpdates", - categoryPromotions: "gmail.categoryPromotions", - categoryForum: "gmail.categoryForum", - inLabel: "gmail.inLabel", - generalSettings: "gmail.generalSettings", - labelSettings: "gmail.labelSettings", - inboxSettings: "gmail.inboxSettings", - accountSetting: "gmail.accountSetting", - filterSettings: "gmail.filterSettings", - fwdAndPOPSettings: "gmail.fwdAndPOPSettings", - addonsSettings: "gmail.addonsSettings", - chatSettings: "gmail.chatSettings", - advancedSettings: "gmail.advancedSettings", - offlineSettings: "gmail.offlineSettings", - themesSettings: "gmail.themesSettings", - lookingForEmail: "gmail.lookingForEmail", - viewingEmail: "gmail.viewingEmail", - viewingStarredEmails: "gmail.viewingStarredEmails", - viewingSentEmails: "gmail.viewingSentEmails", - viewingSnoozedEmails: "gmail.viewingSnoozedEmails", - viewingDrafts: "gmail.viewingDrafts", - viewingImportantEmails: "gmail.viewingImportantEmails", - viewingTrash: "gmail.viewingTrash", - viewingChats: "gmail.viewingChats", - viewingScheduled: "gmail.viewingScheduled", - viewingSpam: "gmail.viewingSpam", - viewingAllEmails: "gmail.viewingAllEmails", - composingEmail: "gmail.composingEmail", - }, - await presence.getSetting("lang").catch(() => "en") - ); + return presence.getStrings( + { + categoryPrimary: 'gmail.categoryPrimary', + categorySocial: 'gmail.categorySocial', + categoryUpdates: 'gmail.categoryUpdates', + categoryPromotions: 'gmail.categoryPromotions', + categoryForum: 'gmail.categoryForum', + inLabel: 'gmail.inLabel', + generalSettings: 'gmail.generalSettings', + labelSettings: 'gmail.labelSettings', + inboxSettings: 'gmail.inboxSettings', + accountSetting: 'gmail.accountSetting', + filterSettings: 'gmail.filterSettings', + fwdAndPOPSettings: 'gmail.fwdAndPOPSettings', + addonsSettings: 'gmail.addonsSettings', + chatSettings: 'gmail.chatSettings', + advancedSettings: 'gmail.advancedSettings', + offlineSettings: 'gmail.offlineSettings', + themesSettings: 'gmail.themesSettings', + lookingForEmail: 'gmail.lookingForEmail', + viewingEmail: 'gmail.viewingEmail', + viewingStarredEmails: 'gmail.viewingStarredEmails', + viewingSentEmails: 'gmail.viewingSentEmails', + viewingSnoozedEmails: 'gmail.viewingSnoozedEmails', + viewingDrafts: 'gmail.viewingDrafts', + viewingImportantEmails: 'gmail.viewingImportantEmails', + viewingTrash: 'gmail.viewingTrash', + viewingChats: 'gmail.viewingChats', + viewingScheduled: 'gmail.viewingScheduled', + viewingSpam: 'gmail.viewingSpam', + viewingAllEmails: 'gmail.viewingAllEmails', + composingEmail: 'gmail.composingEmail', + }, + await presence.getSetting('lang').catch(() => 'en'), + ) } -let strings: Awaited>, - oldLang: string = null; +let strings: Awaited> +let oldLang: string | null = null -presence.on("UpdateData", async () => { - const presenceData: PresenceData = { - largeImageKey: - "https://cdn.rcd.gg/PreMiD/websites/G/Gmail/assets/logo.png", - startTimestamp: browsingTimestamp, - }, - path = window.location.href, - [newLang, privacy, time] = await Promise.all([ - presence.getSetting("lang").catch(() => "en"), - presence.getSetting("privacy"), - presence.getSetting("time"), - ]); +presence.on('UpdateData', async () => { + const presenceData: PresenceData = { + largeImageKey: 'https://cdn.rcd.gg/PreMiD/websites/G/Gmail/assets/logo.png', + startTimestamp: browsingTimestamp, + } + const path = window.location.href + const [newLang, privacy, time] = await Promise.all([ + presence.getSetting('lang').catch(() => 'en'), + presence.getSetting('privacy'), + presence.getSetting('time'), + ]) - if (!time) delete presenceData.startTimestamp; - if (oldLang !== newLang || !strings) { - oldLang = newLang; - strings = await getStrings(); - } + if (!time) + delete presenceData.startTimestamp + if (oldLang !== newLang || !strings) { + oldLang = newLang + strings = await getStrings() + } - const pages: Record = { - "category/primary": strings.categoryPrimary, - "category/social": strings.categorySocial, - "category/updates": strings.categoryUpdates, - "category/promotions": strings.categoryPromotions, - "category/forum": strings.categoryForum, - "settings/general": strings.generalSettings, - settings: strings.generalSettings, - "settings/labels": strings.labelSettings, - "settings/inbox": strings.inboxSettings, - "settings/accounts": strings.accountSetting, - "settings/filters": strings.filterSettings, - "settings/fwdandpop": strings.fwdAndPOPSettings, - "settings/addons": strings.addonsSettings, - "settings/chat": strings.chatSettings, - "settings/advanced": strings.advancedSettings, - "settings/offline": strings.offlineSettings, - "settings/oldthemes": strings.themesSettings, - inbox: strings.categoryPrimary, - starred: strings.viewingStarredEmails, - snoozed: strings.viewingSnoozedEmails, - sent: strings.viewingSentEmails, - drafts: strings.viewingDrafts, - imp: strings.viewingImportantEmails, - chats: strings.viewingChats, - scheduled: strings.viewingScheduled, - all: strings.viewingAllEmails, - spam: strings.viewingSpam, - trash: strings.viewingTrash, - }, - currentPage = path.split("#")[1]; + const pages: Record = { + 'category/primary': strings.categoryPrimary, + 'category/social': strings.categorySocial, + 'category/updates': strings.categoryUpdates, + 'category/promotions': strings.categoryPromotions, + 'category/forum': strings.categoryForum, + 'settings/general': strings.generalSettings, + 'settings': strings.generalSettings, + 'settings/labels': strings.labelSettings, + 'settings/inbox': strings.inboxSettings, + 'settings/accounts': strings.accountSetting, + 'settings/filters': strings.filterSettings, + 'settings/fwdandpop': strings.fwdAndPOPSettings, + 'settings/addons': strings.addonsSettings, + 'settings/chat': strings.chatSettings, + 'settings/advanced': strings.advancedSettings, + 'settings/offline': strings.offlineSettings, + 'settings/oldthemes': strings.themesSettings, + 'inbox': strings.categoryPrimary, + 'starred': strings.viewingStarredEmails, + 'snoozed': strings.viewingSnoozedEmails, + 'sent': strings.viewingSentEmails, + 'drafts': strings.viewingDrafts, + 'imp': strings.viewingImportantEmails, + 'chats': strings.viewingChats, + 'scheduled': strings.viewingScheduled, + 'all': strings.viewingAllEmails, + 'spam': strings.viewingSpam, + 'trash': strings.viewingTrash, + } + const currentPage = path.split('#')[1] - if (pages[currentPage]) presenceData.details = pages[currentPage]; - else if (path.includes("compose=")) - presenceData.details = strings.composingEmail; - else if (path.match("#search")) - presenceData.details = strings.lookingForEmail; - else if (path.match("#label")) { - presenceData.details = strings.inLabel; - if (!privacy) { - presenceData.state = document - .querySelector("div.aim.ain > div") - .getAttribute("data-tooltip"); - } - } else presenceData.details = strings.viewingEmail; + if (pages[currentPage]) { + presenceData.details = pages[currentPage] + } + else if (path.includes('compose=')) { + presenceData.details = strings.composingEmail + } + else if (path.match('#search')) { + presenceData.details = strings.lookingForEmail + } + else if (path.match('#label')) { + presenceData.details = strings.inLabel + if (!privacy) { + presenceData.state = document + .querySelector('div.aim.ain > div') + ?.getAttribute('data-tooltip') + } + } + else { + presenceData.details = strings.viewingEmail + } - if (presenceData.details) presence.setActivity(presenceData); - else presence.setActivity(); -}); + if (presenceData.details) + presence.setActivity(presenceData) + else presence.setActivity() +}) diff --git a/websites/G/GoFundMe/metadata.json b/websites/G/GoFundMe/metadata.json index d9758cbd4e34..1c22f96160a9 100644 --- a/websites/G/GoFundMe/metadata.json +++ b/websites/G/GoFundMe/metadata.json @@ -1,26 +1,26 @@ { - "$schema": "https://schemas.premid.app/metadata/1.12", - "apiVersion": 1, - "author": { - "name": "rushia", - "id": "398752205043400724" - }, - "service": "GoFundMe", - "description": { - "en": "GoFundMe is an American for-profit crowdfunding platform that allows people to raise money for events ranging from life events such as celebrations and graduations to challenging circumstances like accidents and illnesses. " - }, - "url": "gofundme.com", - "regExp": "([a-z0-9]+)[.]gofundme[.]com", - "version": "1.0.18", - "logo": "https://cdn.rcd.gg/PreMiD/websites/G/GoFundMe/assets/logo.png", - "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/GoFundMe/assets/thumbnail.png", - "color": "#00b640", - "category": "other", - "tags": [ - "fundraiser", - "donate", - "donation", - "fundraising", - "charity" - ] -} \ No newline at end of file + "$schema": "https://schemas.premid.app/metadata/1.12", + "apiVersion": 1, + "author": { + "name": "rushia", + "id": "398752205043400724" + }, + "service": "GoFundMe", + "description": { + "en": "GoFundMe is an American for-profit crowdfunding platform that allows people to raise money for events ranging from life events such as celebrations and graduations to challenging circumstances like accidents and illnesses. " + }, + "url": "gofundme.com", + "regExp": "([a-z0-9]+)[.]gofundme[.]com", + "version": "1.0.18", + "logo": "https://cdn.rcd.gg/PreMiD/websites/G/GoFundMe/assets/logo.png", + "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/GoFundMe/assets/thumbnail.png", + "color": "#00b640", + "category": "other", + "tags": [ + "fundraiser", + "donate", + "donation", + "fundraising", + "charity" + ] +} diff --git a/websites/G/GoFundMe/presence.ts b/websites/G/GoFundMe/presence.ts index 8b1c2be4194d..268ed8732988 100644 --- a/websites/G/GoFundMe/presence.ts +++ b/websites/G/GoFundMe/presence.ts @@ -1,93 +1,104 @@ const presence = new Presence({ - clientId: "865564674326003712", - }), - browsingTimestamp = Math.floor(Date.now() / 1000); + clientId: '865564674326003712', +}) +const browsingTimestamp = Math.floor(Date.now() / 1000) -presence.on("UpdateData", async () => { - const presenceData: PresenceData = { - largeImageKey: - "https://cdn.rcd.gg/PreMiD/websites/G/GoFundMe/assets/logo.png", - startTimestamp: browsingTimestamp, - }, - { pathname, href } = location; +presence.on('UpdateData', async () => { + const presenceData: PresenceData = { + largeImageKey: 'https://cdn.rcd.gg/PreMiD/websites/G/GoFundMe/assets/logo.png', + startTimestamp: browsingTimestamp, + } + const { pathname, href } = location - if (pathname === "/") presenceData.details = "Viewing homepage"; - else if (pathname.includes(`/f/${pathname.split("/")[2]}`)) { - presenceData.details = "Viewing fundraiser:"; - presenceData.state = document.querySelector( - "#root > div > main > div.p-campaign > header > h1" - ).textContent; - presenceData.buttons = [ - { - label: "View fundraiser", - url: href, - }, - ]; - } else if (pathname === "/sign-in" || pathname === "/sign-in/") - presenceData.details = "Logging In"; - else if (pathname === "/sign-up" || pathname === "/sign-up/") - presenceData.details = "Signing Up for an account"; - else if (pathname.includes("/forgot-password")) - presenceData.details = "Resetting a password"; - else { - switch (pathname) { - case "/c/how-it-works": - case "/c/how-it-works/": { - presenceData.details = "Reading How GoFundMe Works"; - break; - } - case "/c/why-gofundme": - case "/c/why-gofundme/": { - presenceData.details = "Reading Why to choose GoFundMe"; - break; - } - case "/campaigns": - case "/campaigns/": { - presenceData.details = "Viewing my fundraisers"; - break; - } - case "/donations": - case "/donations/": { - presenceData.details = "Viewing the donations I've made"; - break; - } - default: - if (pathname.includes("/settings")) presenceData.details = "Settings"; - else if (pathname.includes("/create")) - presenceData.details = "Creating a fundraiser"; - else if (pathname.includes("/discover")) - presenceData.details = "Browsing Fundraiser"; - else if (pathname.includes("/start")) - presenceData.details = "Starting a fundraiser"; - else { - switch (pathname) { - case "/c/success": - case "/c/success/": { - presenceData.details = "Viewing Success Stories"; - break; - } - case "/c/cause": - case "/c/cause/": { - presenceData.details = "GoFundMe Causes "; - break; - } - case "/c/cause/justice-and-equality": - case "/c/cause/justice-and-equality/": { - presenceData.details = "GoFundMe Causes"; - presenceData.state = "Justice & Equality"; + if (pathname === '/') { + presenceData.details = 'Viewing homepage' + } + else if (pathname.includes(`/f/${pathname.split('/')[2]}`)) { + presenceData.details = 'Viewing fundraiser:' + presenceData.state = document.querySelector( + '#root > div > main > div.p-campaign > header > h1', + )?.textContent + presenceData.buttons = [ + { + label: 'View fundraiser', + url: href, + }, + ] + } + else if (pathname === '/sign-in' || pathname === '/sign-in/') { + presenceData.details = 'Logging In' + } + else if (pathname === '/sign-up' || pathname === '/sign-up/') { + presenceData.details = 'Signing Up for an account' + } + else if (pathname.includes('/forgot-password')) { + presenceData.details = 'Resetting a password' + } + else { + switch (pathname) { + case '/c/how-it-works': + case '/c/how-it-works/': { + presenceData.details = 'Reading How GoFundMe Works' + break + } + case '/c/why-gofundme': + case '/c/why-gofundme/': { + presenceData.details = 'Reading Why to choose GoFundMe' + break + } + case '/campaigns': + case '/campaigns/': { + presenceData.details = 'Viewing my fundraisers' + break + } + case '/donations': + case '/donations/': { + presenceData.details = 'Viewing the donations I\'ve made' + break + } + default: + if (pathname.includes('/settings')) { + presenceData.details = 'Settings' + } + else if (pathname.includes('/create')) { + presenceData.details = 'Creating a fundraiser' + } + else if (pathname.includes('/discover')) { + presenceData.details = 'Browsing Fundraiser' + } + else if (pathname.includes('/start')) { + presenceData.details = 'Starting a fundraiser' + } + else { + switch (pathname) { + case '/c/success': + case '/c/success/': { + presenceData.details = 'Viewing Success Stories' + break + } + case '/c/cause': + case '/c/cause/': { + presenceData.details = 'GoFundMe Causes ' + break + } + case '/c/cause/justice-and-equality': + case '/c/cause/justice-and-equality/': { + presenceData.details = 'GoFundMe Causes' + presenceData.state = 'Justice & Equality' - break; - } - default: - if (pathname.startsWith("/s")) { - presenceData.details = "Searching for a fundraiser:"; - presenceData.state = new URL(href).searchParams.get("q"); - } - } - } - } - } + break + } + default: + if (pathname.startsWith('/s')) { + presenceData.details = 'Searching for a fundraiser:' + presenceData.state = new URL(href).searchParams.get('q') + } + } + } + } + } - if (!presenceData.details) presence.setActivity(); - else presence.setActivity(presenceData); -}); + if (!presenceData.details) + presence.setActivity() + else presence.setActivity(presenceData) +}) diff --git a/websites/G/GoPlay/metadata.json b/websites/G/GoPlay/metadata.json index 8f194e9efc1f..7a7e191dbc7b 100644 --- a/websites/G/GoPlay/metadata.json +++ b/websites/G/GoPlay/metadata.json @@ -1,39 +1,39 @@ { - "$schema": "https://schemas.premid.app/metadata/1.12", - "apiVersion": 1, - "author": { - "name": "Striker", - "id": "215509157837537280" - }, - "service": "GoPlay", - "description": { - "en": "Goplay is the home to the kdrama streaming service. You can watched free shows uninterupted in HD with no ads.", - "ga_IE": "Is é Goplay an baile don tseirbhís sruthú kdrama. Is féidir leat féachaint ar thaispeántais saor in aisce gan bhriseadh i HD gan aon fhógraí.", - "nl": "GoPlay is de thuisbasis van de anime-streamingdienst GoPlay. U kunt ononderbroken gratis shows in HD bekijken zonder advertenties.", - "vi_VN": "GoPlay là nơi để xem kdrama trực tuyến. Bạn có thể xem các chương trình miễn phí, không bị gián đoạn bởi các quảng cáo." - }, - "url": [ - "goplay.ml", - "goplay.su", - "kdrama.anontpp.com" - ], - "version": "2.0.0", - "logo": "https://cdn.rcd.gg/PreMiD/websites/G/GoPlay/assets/logo.png", - "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/GoPlay/assets/thumbnail.png", - "color": "#F4ADEE", - "category": "videos", - "tags": [ - "goplay", - "movies", - "shows", - "entertainment" - ], - "settings": [ - { - "id": "cover", - "title": "Show Cover", - "icon": "fad fa-images", - "value": true - } - ] -} \ No newline at end of file + "$schema": "https://schemas.premid.app/metadata/1.12", + "apiVersion": 1, + "author": { + "name": "Striker", + "id": "215509157837537280" + }, + "service": "GoPlay", + "description": { + "en": "Goplay is the home to the kdrama streaming service. You can watched free shows uninterupted in HD with no ads.", + "ga_IE": "Is é Goplay an baile don tseirbhís sruthú kdrama. Is féidir leat féachaint ar thaispeántais saor in aisce gan bhriseadh i HD gan aon fhógraí.", + "nl": "GoPlay is de thuisbasis van de anime-streamingdienst GoPlay. U kunt ononderbroken gratis shows in HD bekijken zonder advertenties.", + "vi_VN": "GoPlay là nơi để xem kdrama trực tuyến. Bạn có thể xem các chương trình miễn phí, không bị gián đoạn bởi các quảng cáo." + }, + "url": [ + "goplay.ml", + "goplay.su", + "kdrama.anontpp.com" + ], + "version": "2.0.0", + "logo": "https://cdn.rcd.gg/PreMiD/websites/G/GoPlay/assets/logo.png", + "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/GoPlay/assets/thumbnail.png", + "color": "#F4ADEE", + "category": "videos", + "tags": [ + "goplay", + "movies", + "shows", + "entertainment" + ], + "settings": [ + { + "id": "cover", + "title": "Show Cover", + "icon": "fad fa-images", + "value": true + } + ] +} diff --git a/websites/G/GoPlay/presence.ts b/websites/G/GoPlay/presence.ts index a417f3b057e9..0c3987fc3b5c 100644 --- a/websites/G/GoPlay/presence.ts +++ b/websites/G/GoPlay/presence.ts @@ -1,51 +1,50 @@ const presence = new Presence({ - clientId: "708314580304003124", -}); - -let oldUrl: string, elapsed: number; - -presence.on("UpdateData", async () => { - const path = location.pathname.replace(/\/?$/, "/"), - video: HTMLVideoElement = document.querySelector("video"), - presenceData: PresenceData = { - details: "Browsing", - type: ActivityType.Watching, - largeImageKey: - "https://cdn.rcd.gg/PreMiD/websites/G/GoPlay/assets/logo.png", - }; - - if (oldUrl !== path) { - oldUrl = path; - elapsed = Math.floor(Date.now() / 1000); - } - - if (elapsed) presenceData.startTimestamp = elapsed; - if (video) { - const state = Array.from( - document.querySelector("#infotitle").childNodes - ).flatMap(node => node.textContent.trim() || []); - - presenceData.smallImageKey = video.paused ? Assets.Pause : Assets.Play; - presenceData.smallImageText = video.paused ? "Paused" : "Playing"; - - if (!video.paused) { - [presenceData.startTimestamp, presenceData.endTimestamp] = - presence.getTimestampsfromMedia(video); - } - - if (state[1] !== "Feature Film") - [presenceData.details, presenceData.state] = state; - else [presenceData.details] = state; - - if (presence.getSetting("cover")) { - presenceData.largeImageKey = document.querySelector( - "meta[property='og:image']" - ).content; - } - } - - if (document.location.search.includes("search")) - presenceData.details = "Searching for something"; - - presence.setActivity(presenceData); -}); + clientId: '708314580304003124', +}) + +let oldUrl: string, elapsed: number + +presence.on('UpdateData', async () => { + const path = location.pathname.replace(/\/?$/, '/') + const video = document.querySelector('video') + const presenceData: PresenceData = { + details: 'Browsing', + type: ActivityType.Watching, + largeImageKey: 'https://cdn.rcd.gg/PreMiD/websites/G/GoPlay/assets/logo.png', + } + + if (oldUrl !== path) { + oldUrl = path + elapsed = Math.floor(Date.now() / 1000) + } + + if (elapsed) + presenceData.startTimestamp = elapsed + if (video) { + const state = Array.from( + document.querySelector('#infotitle')?.childNodes ?? [], + ).flatMap(node => node.textContent?.trim() ?? []) + + presenceData.smallImageKey = video.paused ? Assets.Pause : Assets.Play + presenceData.smallImageText = video.paused ? 'Paused' : 'Playing' + + if (!video.paused) { + [presenceData.startTimestamp, presenceData.endTimestamp] = presence.getTimestampsfromMedia(video) + } + + if (state[1] !== 'Feature Film') + [presenceData.details, presenceData.state] = state + else [presenceData.details] = state + + if (await presence.getSetting('cover')) { + presenceData.largeImageKey = document.querySelector( + 'meta[property=\'og:image\']', + )?.content + } + } + + if (document.location.search.includes('search')) + presenceData.details = 'Searching for something' + + presence.setActivity(presenceData) +}) diff --git a/websites/G/Gogoanime/iframe.ts b/websites/G/Gogoanime/iframe.ts index 75847a6230e2..d46abfc98584 100644 --- a/websites/G/Gogoanime/iframe.ts +++ b/websites/G/Gogoanime/iframe.ts @@ -1,33 +1,32 @@ -const iframe = new iFrame(); +const iframe = new iFrame() -iframe.on("UpdateData", async () => { - const videoInfos = - document.querySelector("video") ?? - document.querySelector('[class*="jw-video]'), - dur = document.querySelector("[jw-text-duration]"); - if (videoInfos && !isNaN(videoInfos.duration)) { - iframe.send({ - iframeVideo: { - version: 0, - currentTime: videoInfos.currentTime, - duration: videoInfos.duration, - paused: videoInfos.paused, - }, - }); - } else if (!videoInfos && dur) { - iframe.send({ - iframeVideo: { - version: 1, - currentTime2: document.querySelector("[class*='jw-text-elapsed']") - ?.textContent, - duration2: dur.textContent, - paused: document - .querySelector('[id="mediaplayer"]') - ?.className?.toLowerCase() - .includes("-paused") - ? true - : false, - }, - }); - } -}); +iframe.on('UpdateData', async () => { + const videoInfos = document.querySelector('video') + ?? document.querySelector('[class*="jw-video]') + const dur = document.querySelector('[jw-text-duration]') + if (videoInfos && !Number.isNaN(videoInfos.duration)) { + iframe.send({ + iframeVideo: { + version: 0, + currentTime: videoInfos.currentTime, + duration: videoInfos.duration, + paused: videoInfos.paused, + }, + }) + } + else if (!videoInfos && dur) { + iframe.send({ + iframeVideo: { + version: 1, + currentTime2: document.querySelector('[class*=\'jw-text-elapsed\']') + ?.textContent, + duration2: dur.textContent, + paused: !!document + .querySelector('[id="mediaplayer"]') + ?.className + ?.toLowerCase() + .includes('-paused'), + }, + }) + } +}) diff --git a/websites/G/Gogoanime/metadata.json b/websites/G/Gogoanime/metadata.json index b211886cbb1e..bfa24772f42e 100644 --- a/websites/G/Gogoanime/metadata.json +++ b/websites/G/Gogoanime/metadata.json @@ -1,39 +1,39 @@ { - "$schema": "https://schemas.premid.app/metadata/1.12", - "apiVersion": 1, - "author": { - "name": "Psycho", - "id": "444779014888882177" - }, - "contributors": [ - { - "name": "Undo", - "id": "246660882803720193" - } - ], - "service": "Gogoanime", - "description": { - "en": "Watch anime series and movies with English sub & dub options. Download high-quality anime for free.", - "nl": "Bekijk anime series en films met Engelse sub & dub opties. Download gratis anime van hoge kwaliteit.", - "es": "Ver series y películas de anime con subtítulos y doblaje en inglés. Descarga anime de alta calidad gratis.", - "de": "Schauen Sie Anime-Serien und -Filme mit englischen Untertiteln und Synchronisation. Laden Sie hochwertige Anime kostenlos herunter." - }, - "url": [ - "gogotaku.info", - "gogoanime.pe", - "anitaku.so" - ], - "regExp": "(ww(w*|[0-9]*)\\.)?(anitaku|gogoanime|gogotaku)([0-9]+)?\\..*", - "version": "2.1.18", - "logo": "https://cdn.rcd.gg/PreMiD/websites/G/Gogoanime/assets/logo.png", - "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/Gogoanime/assets/thumbnail.png", - "color": "#FFC119", - "category": "anime", - "tags": [ - "anime", - "video", - "streaming" - ], - "iframe": true, - "iFrameRegExp": "(gogo(hd)?\\.[a-z]*)|(sbplay([0-9]*)?\\.[a-z]*)|(fembed(-hd)?\\.[a-z]*)|(mp4(-)?upload\\.[a-z]*)|(embtaku\\.[a-z]*)|(.*)" -} \ No newline at end of file + "$schema": "https://schemas.premid.app/metadata/1.12", + "apiVersion": 1, + "author": { + "name": "Psycho", + "id": "444779014888882177" + }, + "contributors": [ + { + "name": "Undo", + "id": "246660882803720193" + } + ], + "service": "Gogoanime", + "description": { + "en": "Watch anime series and movies with English sub & dub options. Download high-quality anime for free.", + "nl": "Bekijk anime series en films met Engelse sub & dub opties. Download gratis anime van hoge kwaliteit.", + "es": "Ver series y películas de anime con subtítulos y doblaje en inglés. Descarga anime de alta calidad gratis.", + "de": "Schauen Sie Anime-Serien und -Filme mit englischen Untertiteln und Synchronisation. Laden Sie hochwertige Anime kostenlos herunter." + }, + "url": [ + "gogotaku.info", + "gogoanime.pe", + "anitaku.so" + ], + "regExp": "(ww(w*|[0-9]*)\\.)?(anitaku|gogoanime|gogotaku)([0-9]+)?\\..*", + "version": "2.1.18", + "logo": "https://cdn.rcd.gg/PreMiD/websites/G/Gogoanime/assets/logo.png", + "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/Gogoanime/assets/thumbnail.png", + "color": "#FFC119", + "category": "anime", + "tags": [ + "anime", + "video", + "streaming" + ], + "iframe": true, + "iFrameRegExp": "(gogo(hd)?\\.[a-z]*)|(sbplay([0-9]*)?\\.[a-z]*)|(fembed(-hd)?\\.[a-z]*)|(mp4(-)?upload\\.[a-z]*)|(embtaku\\.[a-z]*)|(.*)" +} diff --git a/websites/G/Gogoanime/presence.ts b/websites/G/Gogoanime/presence.ts index 3f7ba46655f9..bccb0153d95a 100644 --- a/websites/G/Gogoanime/presence.ts +++ b/websites/G/Gogoanime/presence.ts @@ -1,371 +1,383 @@ const presence = new Presence({ - clientId: "696341580096733185", - }), - browsingTimestamp = Math.floor(Date.now() / 1000); + clientId: '696341580096733185', +}) +const browsingTimestamp = Math.floor(Date.now() / 1000) -let currentTime = 0, - currentTime2 = "00:00", - duration = 0, - duration2 = "00:00", - paused = true; // true if the current gogoanime domain is a clone +let currentTime = 0 +let currentTime2 = '00:00' +let duration = 0 +let duration2 = '00:00' +let paused = true // true if the current gogoanime domain is a clone const detailed = { - // both the state and logo to use - NOTFOUND: ["404", ""], - BROWSING: ["Browsing...", "browsing"], - READING: ["Reading...", "reading"], - SEARCHING: ["Searching...", "browsing"], - WATCHING: ["Watching...", ""], - LOGIN: ["Logging in...", "login"], - SIGNUP: ["Signing up...", "signup"], - BOOKMARK: ["Managing bookmarks...", "bookmark"], - REQUESTING: ["Requesting an anime...", "request"], - CONTACTING: ["Contacting the support...", "contact"], -}; + // both the state and logo to use + NOTFOUND: ['404', ''], + BROWSING: ['Browsing...', 'browsing'], + READING: ['Reading...', 'reading'], + SEARCHING: ['Searching...', 'browsing'], + WATCHING: ['Watching...', ''], + LOGIN: ['Logging in...', 'login'], + SIGNUP: ['Signing up...', 'signup'], + BOOKMARK: ['Managing bookmarks...', 'bookmark'], + REQUESTING: ['Requesting an anime...', 'request'], + CONTACTING: ['Contacting the support...', 'contact'], +} interface IFrameData { - iframeVideo: { - version: number; - currentTime: number; - currentTime2: string; - duration: number; - duration2: string; - paused: boolean; - }; + iframeVideo: { + version: number + currentTime: number + currentTime2: string + duration: number + duration2: string + paused: boolean + } } -presence.on("iFrameData", (data: IFrameData) => { - if (data.iframeVideo.version === 0) { - if (data.iframeVideo.duration) { - ({ - paused: paused, - currentTime: currentTime, - duration: duration, - } = data.iframeVideo); - } - } else { - ({ - paused: paused, - currentTime2: currentTime2, - duration2: duration2, - } = data.iframeVideo); - } -}); +presence.on('iFrameData', (inc: unknown) => { + const data = inc as IFrameData + if (data.iframeVideo.version === 0) { + if (data.iframeVideo.duration) { + ({ + paused, + currentTime, + duration, + } = data.iframeVideo) + } + } + else { + ({ + paused, + currentTime2, + duration2, + } = data.iframeVideo) + } +}) function upperCaseFirstChar(word: string) { - if (word) return `${word[0].toUpperCase()}${word.slice(1, word.length)}`; + if (word) + return `${word[0].toUpperCase()}${word.slice(1, word.length)}` } function formatStr(anime: string[]): string { - return anime - .reduce((t, c): string => { - return `${t + upperCaseFirstChar(c)} `; - }, "") - .replaceAll("Dub", "(Dub)"); + return anime + .reduce((t, c): string => { + return `${t + upperCaseFirstChar(c)} ` + }, '') + .replaceAll('Dub', '(Dub)') } -presence.on("UpdateData", async () => { - const { pathname, href } = document.location, - dataPage = document - .querySelector('[class="pagination-list"]') - ?.querySelector("a") - ?.getAttribute("data-page"), - dataMaxPage = document - .querySelector('[class="pagination-list"]') - ?.lastElementChild?.querySelector("a") - ?.getAttribute("data-page"); +presence.on('UpdateData', async () => { + const { pathname, href } = document.location + const dataPage = document + .querySelector('[class="pagination-list"]') + ?.querySelector('a') + ?.getAttribute('data-page') + const dataMaxPage = document + .querySelector('[class="pagination-list"]') + ?.lastElementChild + ?.querySelector('a') + ?.getAttribute('data-page') - let usedSearchEl: HTMLInputElement; - if (!pathname.includes("login.html")) { - const allInput: NodeListOf = document.querySelectorAll( - 'input[type="search"],input[name="keyword"]' - ), - inputArray: HTMLInputElement[] = []; - let inputElement: HTMLInputElement; - for (const i in allInput) inputArray.push(allInput[i] as HTMLInputElement); + let usedSearchEl: HTMLInputElement | null = null + if (!pathname.includes('login.html')) { + const allInput: NodeListOf = document.querySelectorAll( + 'input[type="search"],input[name="keyword"]', + ) + const inputArray: HTMLInputElement[] = [] + let inputElement: HTMLInputElement + for (const i in allInput) inputArray.push(allInput[i] as HTMLInputElement) - for (inputElement of inputArray) { - if ( - inputElement?.value?.trim()?.length >= 2 && - inputElement.className !== "btngui" && - inputElement.className !== "reset" - ) - usedSearchEl = inputElement; - } - } else usedSearchEl = null; - let state: string, - detail: string[] = detailed.BROWSING; - if ( - document.querySelector("#wrapper_bg > section h1.entry-title") - ?.textContent === "404" - ) - detail = detailed.NOTFOUND; - else { - switch (true) { - case pathname.includes("/watch/"): - case document.querySelector('[class="title_name"]') !== null: - case document.querySelector('[class="anime_video_body_watch"]') !== null: - case document.querySelector('[class="anime_muti_link"]') !== null: { - let title = - document.querySelector('[class="anime-info"] > a')?.textContent ?? - document.querySelector('[class="title_name"]')?.textContent; + for (inputElement of inputArray) { + if ( + inputElement?.value?.trim()?.length >= 2 + && inputElement.className !== 'btngui' + && inputElement.className !== 'reset' + ) { + usedSearchEl = inputElement + } + } + } + else { + usedSearchEl = null + } + let state: string | undefined + let detail: string[] = detailed.BROWSING + if ( + document.querySelector('#wrapper_bg > section h1.entry-title') + ?.textContent === '404' + ) { + detail = detailed.NOTFOUND + } + else { + switch (true) { + case pathname.includes('/watch/'): + case document.querySelector('[class="title_name"]') !== null: + case document.querySelector('[class="anime_video_body_watch"]') !== null: + case document.querySelector('[class="anime_muti_link"]') !== null: { + let title = document.querySelector('[class="anime-info"] > a')?.textContent + ?? document.querySelector('[class="title_name"]')?.textContent - if (!title) { - title = pathname.includes("/movie/") - ? pathname - .split("/")?.[2] - ?.replace(/-/gm, " ") - ?.replace(/\(dub\)/gm, "") - : pathname - .split("/")?.[1] - ?.replace(/-/gm, " ") - ?.replace(/\(dub\)/gm, ""); - } - const titleReplaced = - document - .querySelector('[id="episode_related"] > li > [class*="active"]') - ?.textContent?.replace(/(DUB)|(dub)|(SUB)|(sub)|(\n)/gm, "") - ?.replace("EP", "Episode") - ?.trim() ?? - document - .querySelector('[class="each_episode active"]') - ?.textContent?.trim() ?? - document.querySelector('[class="active"]')?.textContent?.trim() ?? - document - .querySelector('[class="anime_video_body"] > h1') - ?.textContent?.toLowerCase() - ?.replace( - /(for free on gogoanime at gogoanime)|(english subbed at gogoanime)|(watch)/gm, - "" - ); - detail = detailed.WATCHING; - state = titleReplaced - ? `${upperCaseFirstChar(title?.toLowerCase())} | ${upperCaseFirstChar( - titleReplaced - .toLowerCase() - ?.replace(/(sub)|(dub)(ova)/gm, "") - ?.replace("ep ", "Episode ") - )}` - : `${upperCaseFirstChar(title?.toLowerCase())}`; - break; - } - case pathname.includes("/anime-list"): { - state = "The anime list"; - break; - } - case pathname.includes("/new-season"): - case pathname.includes("/recent-release-anime"): { - state = "Most recent anime"; - break; - } - case pathname.includes("/anime-movies"): { - state = "Anime movies"; - break; - } - case pathname.includes("/popular"): { - state = "Most popular anime"; - break; - } - case pathname.includes("/news/reviews"): { - state = "Anime reviews"; - break; - } - case pathname.includes("/news/trailers"): { - state = "Anime trailers"; - break; - } - case pathname.includes("/requested-list"): { - state = "The requested anime list"; - break; - } - case pathname.includes("/upcoming-anime"): { - state = "Upcoming anime"; - break; - } - case pathname.includes("/genre/"): { - // element otherwise use the url path as fallback - state = `Anime: ${ - document.querySelector( - "#wrapper_bg > section > section.content_left > div.main_body > div:nth-child(2) > div.anime_info_body_bg > h1" - )?.textContent ?? formatStr(pathname.split("/").pop().split("-")) - }`; - break; - } - case pathname.includes("/season/"): - case pathname.includes("/sub-category/"): { - state = `${formatStr(pathname.split("/").pop().split("-"))}`; - break; - } - case pathname === "/announcement.html": { - state = "Announcements"; - break; - } - case pathname === "/news.html": { - state = "News"; - break; - } - case pathname === "/privacy.html": { - state = "Announcements"; - break; - } - case pathname === "/about.html": - case pathname === "/about-us.html": { - state = "About us"; - break; - } - case pathname === "contact-us.html": { - detail = detailed.CONTACTING; - break; - } - case pathname === "/login.html": { - detail = detailed.LOGIN; - break; - } - case pathname === "/register.html": { - detail = detailed.SIGNUP; - break; - } - case pathname === "/user/bookmark": { - detail = detailed.BOOKMARK; - break; - } - case pathname === "//search.html": { - detail = detailed.SEARCHING; - state = `Keyword: ${formatStr( - new URLSearchParams(window.location.search).get("keyword").split(" ") - )}`; + if (!title) { + title = pathname.includes('/movie/') + ? pathname + .split('/')?.[2] + ?.replace(/-/g, ' ') + ?.replace(/\(dub\)/g, '') + : pathname + .split('/')?.[1] + ?.replace(/-/g, ' ') + ?.replace(/\(dub\)/g, '') + } + const titleReplaced = document + .querySelector('[id="episode_related"] > li > [class*="active"]') + ?.textContent + ?.replace(/(DUB)|(dub)|(SUB)|(sub)|(\n)/g, '') + ?.replace('EP', 'Episode') + ?.trim() + ?? document + .querySelector('[class="each_episode active"]') + ?.textContent + ?.trim() + ?? document.querySelector('[class="active"]')?.textContent?.trim() + ?? document + .querySelector('[class="anime_video_body"] > h1') + ?.textContent + ?.toLowerCase() + ?.replace( + /(for free on gogoanime at gogoanime)|(english subbed at gogoanime)|(watch)/g, + '', + ) + detail = detailed.WATCHING + state = titleReplaced + ? `${upperCaseFirstChar(title?.toLowerCase())} | ${upperCaseFirstChar( + titleReplaced + .toLowerCase() + ?.replace(/(sub)|(dub)(ova)/g, '') + ?.replace('ep ', 'Episode '), + )}` + : `${upperCaseFirstChar(title?.toLowerCase())}` + break + } + case pathname.includes('/anime-list'): { + state = 'The anime list' + break + } + case pathname.includes('/new-season'): + case pathname.includes('/recent-release-anime'): { + state = 'Most recent anime' + break + } + case pathname.includes('/anime-movies'): { + state = 'Anime movies' + break + } + case pathname.includes('/popular'): { + state = 'Most popular anime' + break + } + case pathname.includes('/news/reviews'): { + state = 'Anime reviews' + break + } + case pathname.includes('/news/trailers'): { + state = 'Anime trailers' + break + } + case pathname.includes('/requested-list'): { + state = 'The requested anime list' + break + } + case pathname.includes('/upcoming-anime'): { + state = 'Upcoming anime' + break + } + case pathname.includes('/genre/'): { + // element otherwise use the url path as fallback + state = `Anime: ${ + document.querySelector( + '#wrapper_bg > section > section.content_left > div.main_body > div:nth-child(2) > div.anime_info_body_bg > h1', + )?.textContent ?? formatStr(pathname.split('/').pop()!.split('-')) + }` + break + } + case pathname.includes('/season/'): + case pathname.includes('/sub-category/'): { + state = `${formatStr(pathname.split('/').pop()!.split('-'))}` + break + } + case pathname === '/announcement.html': { + state = 'Announcements' + break + } + case pathname === '/news.html': { + state = 'News' + break + } + case pathname === '/privacy.html': { + state = 'Announcements' + break + } + case pathname === '/about.html': + case pathname === '/about-us.html': { + state = 'About us' + break + } + case pathname === 'contact-us.html': { + detail = detailed.CONTACTING + break + } + case pathname === '/login.html': { + detail = detailed.LOGIN + break + } + case pathname === '/register.html': { + detail = detailed.SIGNUP + break + } + case pathname === '/user/bookmark': { + detail = detailed.BOOKMARK + break + } + case pathname === '//search.html': { + detail = detailed.SEARCHING + state = `Keyword: ${formatStr( + new URLSearchParams(window.location.search).get('keyword')!.split(' '), + )}` - break; - } - case pathname === "/request-anime.html": { - detail = detailed.REQUESTING; + break + } + case pathname === '/request-anime.html': { + detail = detailed.REQUESTING - state = `Anime: ${ - (document.getElementsByName("title")[0] as HTMLInputElement)?.value - }`; - break; - } - case pathname.includes("/requested/"): { - state = `Requested anime: ${ - document.querySelector( - "#wrapper_bg > section > section.content_left > div > div.anime_info_body > div > h1" - )?.textContent ?? formatStr(pathname.split("/").pop().split("-")) - }`; - break; - } - case pathname.includes("/news/"): { - detail = detailed.READING; - state = `News: ${ - document.querySelector( - "#wrapper_bg > section > section.content_left > div > div.page_content > h1" - ).textContent - }`; - break; - } - case pathname.includes("/announcement/"): { - detail = detailed.READING; - state = `Announcement: ${ - document.querySelector( - "#wrapper_bg > section > section.content_left > div > div.page_content > h1" - ).textContent - }`; - break; - } - case pathname.includes("/reviews/"): { - detail = detailed.READING; - state = `Review Of: ${ - document.querySelector( - "#wrapper_bg > section > section.content_left > div > div.page_content > h1" - ).textContent - }`; - break; - } - case pathname.includes("/trailers/"): { - detail = detailed.WATCHING; - const anime = document.querySelector( - "#wrapper_bg > section > section.content_right.block_mb > div:nth-child(1) > div > div.related_right.center_col1 > div > ul > li > div.name > a > h4" - ).textContent; - state = `Trailer Of: ${anime}`; - break; - } - case pathname === "/": { - const sel = document.querySelector( - "#load_recent_release > div.anime_name.recent_release > h2" - )?.children; - if (sel) { - for (const child of sel) { - if (child.className.includes("active")) { - switch (child.textContent) { - case "DUB": - state = - dataPage && dataMaxPage - ? `Recent dubbed anime releases (page ${dataPage}/${dataMaxPage})` - : "Recent dubbed anime releases"; - break; - case "Chinese": - state = - dataPage && dataMaxPage - ? `Recent Chinese anime releases (page ${dataPage}/${dataMaxPage})` - : "Recent Chinese anime releases"; - break; - default: - state = - dataPage && dataMaxPage - ? `Recent anime releases (page ${dataPage}/${dataMaxPage})` - : "Recent anime releases"; - break; - } - break; - } - } - } else state = "Home"; + state = `Anime: ${ + (document.getElementsByName('title')[0] as HTMLInputElement)?.value + }` + break + } + case pathname.includes('/requested/'): { + state = `Requested anime: ${ + document.querySelector( + '#wrapper_bg > section > section.content_left > div > div.anime_info_body > div > h1', + )?.textContent ?? formatStr(pathname.split('/').pop()!.split('-')) + }` + break + } + case pathname.includes('/news/'): { + detail = detailed.READING + state = `News: ${ + document.querySelector( + '#wrapper_bg > section > section.content_left > div > div.page_content > h1', + )?.textContent + }` + break + } + case pathname.includes('/announcement/'): { + detail = detailed.READING + state = `Announcement: ${ + document.querySelector( + '#wrapper_bg > section > section.content_left > div > div.page_content > h1', + )?.textContent + }` + break + } + case pathname.includes('/reviews/'): { + detail = detailed.READING + state = `Review Of: ${ + document.querySelector( + '#wrapper_bg > section > section.content_left > div > div.page_content > h1', + )?.textContent + }` + break + } + case pathname.includes('/trailers/'): { + detail = detailed.WATCHING + const anime = document.querySelector( + '#wrapper_bg > section > section.content_right.block_mb > div:nth-child(1) > div > div.related_right.center_col1 > div > ul > li > div.name > a > h4', + )?.textContent + state = `Trailer Of: ${anime}` + break + } + case pathname === '/': { + const sel = document.querySelector( + '#load_recent_release > div.anime_name.recent_release > h2', + )?.children + if (sel) { + for (const child of sel) { + if (child.className.includes('active')) { + switch (child.textContent) { + case 'DUB': + state = dataPage && dataMaxPage + ? `Recent dubbed anime releases (page ${dataPage}/${dataMaxPage})` + : 'Recent dubbed anime releases' + break + case 'Chinese': + state = dataPage && dataMaxPage + ? `Recent Chinese anime releases (page ${dataPage}/${dataMaxPage})` + : 'Recent Chinese anime releases' + break + default: + state = dataPage && dataMaxPage + ? `Recent anime releases (page ${dataPage}/${dataMaxPage})` + : 'Recent anime releases' + break + } + break + } + } + } + else { + state = 'Home' + } - break; - } - } - } - const presenceData: PresenceData = { - largeImageKey: - "https://cdn.rcd.gg/PreMiD/websites/G/Gogoanime/assets/logo.png", - state, - details: detail[0], - }; - if (usedSearchEl?.value) { - presenceData.details = "Searching for:"; - presenceData.state = usedSearchEl.value.replace(/ /gm, ""); - presenceData.smallImageKey = Assets.Search; - return presence.setActivity(presenceData); - } - if (detail === detailed.NOTFOUND) presence.setActivity(); - else if (duration || duration2) { - if (!duration && duration2) { - duration = presence.timestampFromFormat(duration2); - currentTime = presence.timestampFromFormat(currentTime2); - } - if (paused) { - presenceData.smallImageKey = Assets.Pause; - presenceData.smallImageText = `${ - presence.getTimestamps(currentTime, duration)[1] - } left`; - } else { - presenceData.smallImageKey = Assets.Play; - [presenceData.startTimestamp, presenceData.endTimestamp] = - presence.getTimestamps(currentTime, duration); - } - presenceData.buttons = [ - { - label: "Watch Video", - url: href, - }, - ]; - presence.setActivity(presenceData); - } else { - presenceData.startTimestamp = browsingTimestamp; - presence.setActivity(presenceData); - presenceData.buttons = [ - { - label: "Browse", - url: href, - }, - ]; - } -}); + break + } + } + } + const presenceData: PresenceData = { + largeImageKey: 'https://cdn.rcd.gg/PreMiD/websites/G/Gogoanime/assets/logo.png', + state, + details: detail[0], + } + if (usedSearchEl?.value) { + presenceData.details = 'Searching for:' + presenceData.state = usedSearchEl.value.replace(/ /g, '') + presenceData.smallImageKey = Assets.Search + return presence.setActivity(presenceData) + } + if (detail === detailed.NOTFOUND) { + presence.setActivity() + } + else if (duration || duration2) { + if (!duration && duration2) { + duration = presence.timestampFromFormat(duration2) + currentTime = presence.timestampFromFormat(currentTime2) + } + if (paused) { + presenceData.smallImageKey = Assets.Pause + presenceData.smallImageText = `${ + presence.getTimestamps(currentTime, duration)[1] + } left` + } + else { + presenceData.smallImageKey = Assets.Play; + [presenceData.startTimestamp, presenceData.endTimestamp] = presence.getTimestamps(currentTime, duration) + } + presenceData.buttons = [ + { + label: 'Watch Video', + url: href, + }, + ] + presence.setActivity(presenceData) + } + else { + presenceData.startTimestamp = browsingTimestamp + presence.setActivity(presenceData) + presenceData.buttons = [ + { + label: 'Browse', + url: href, + }, + ] + } +}) diff --git a/websites/G/Goodreads/metadata.json b/websites/G/Goodreads/metadata.json index a7c7a6f357ca..f9aa66ab522e 100644 --- a/websites/G/Goodreads/metadata.json +++ b/websites/G/Goodreads/metadata.json @@ -1,21 +1,21 @@ { - "$schema": "https://schemas.premid.app/metadata/1.12", - "apiVersion": 1, - "author": { - "name": "Vaz", - "id": "258926263132094464" - }, - "service": "Goodreads", - "description": { - "en": "Goodreads is an American social cataloging website that allows individuals to search its database of books, annotations, quotes, and reviews." - }, - "url": "www.goodreads.com", - "version": "1.1.6", - "logo": "https://cdn.rcd.gg/PreMiD/websites/G/Goodreads/assets/logo.png", - "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/Goodreads/assets/thumbnail.png", - "color": "#b5ae84", - "category": "other", - "tags": [ - "books" - ] -} \ No newline at end of file + "$schema": "https://schemas.premid.app/metadata/1.12", + "apiVersion": 1, + "author": { + "name": "Vaz", + "id": "258926263132094464" + }, + "service": "Goodreads", + "description": { + "en": "Goodreads is an American social cataloging website that allows individuals to search its database of books, annotations, quotes, and reviews." + }, + "url": "www.goodreads.com", + "version": "1.1.6", + "logo": "https://cdn.rcd.gg/PreMiD/websites/G/Goodreads/assets/logo.png", + "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/Goodreads/assets/thumbnail.png", + "color": "#b5ae84", + "category": "other", + "tags": [ + "books" + ] +} diff --git a/websites/G/Goodreads/presence.ts b/websites/G/Goodreads/presence.ts index a62617af7bdf..7ef1b4431575 100644 --- a/websites/G/Goodreads/presence.ts +++ b/websites/G/Goodreads/presence.ts @@ -1,148 +1,168 @@ -const presence = new Presence({ clientId: "867525909204566056" }), - timeElapsed: number = Math.floor(Date.now() / 1000); +const presence = new Presence({ clientId: '867525909204566056' }) +const timeElapsed: number = Math.floor(Date.now() / 1000) -presence.on("UpdateData", async () => { - const presenceData: PresenceData = { - largeImageKey: - "https://cdn.rcd.gg/PreMiD/websites/G/Goodreads/assets/logo.png", - details: "Browsing Goodreads", - startTimestamp: timeElapsed, - }, - { pathname, href } = document.location; +presence.on('UpdateData', async () => { + const presenceData: PresenceData = { + largeImageKey: 'https://cdn.rcd.gg/PreMiD/websites/G/Goodreads/assets/logo.png', + details: 'Browsing Goodreads', + startTimestamp: timeElapsed, + } + const { pathname, href } = document.location - if (pathname === "/home" || pathname === "/") - presenceData.details = "Browsing homepage"; - else if (pathname === "/book") presenceData.details = "Browsing books"; - else if (pathname.includes("/book/show/")) { - presenceData.details = "Viewing a book:"; - presenceData.largeImageKey = document - .querySelector(".BookCover img.ResponsiveImage") - .getAttribute("src"); - presenceData.state = document.querySelector("h1").textContent; - presenceData.buttons = [ - { - label: "View Book", - url: href, - }, - ]; + if (pathname === '/home' || pathname === '/') { + presenceData.details = 'Browsing homepage' + } + else if (pathname === '/book') { + presenceData.details = 'Browsing books' + } + else if (pathname.includes('/book/show/')) { + presenceData.details = 'Viewing a book:' + presenceData.largeImageKey = document + .querySelector('.BookCover img.ResponsiveImage') + ?.getAttribute('src') + presenceData.state = document.querySelector('h1')?.textContent + presenceData.buttons = [ + { + label: 'View Book', + url: href, + }, + ] - presenceData.smallImageKey = Assets.Reading; - // author - presenceData.smallImageText = `By: ${ - document.querySelector("span.ContributorLink__name").textContent - }`; - } else if (pathname.includes("/series")) { - const bookseries: string = document.querySelector("h1").textContent; - if (bookseries === "Series") - presenceData.details = "Viewing all book series on Goodreads"; - else { - presenceData.details = "Viewing a book series:"; - presenceData.state = bookseries; + presenceData.smallImageKey = Assets.Reading + // author + presenceData.smallImageText = `By: ${ + document.querySelector('span.ContributorLink__name')?.textContent + }` + } + else if (pathname.includes('/series')) { + const bookseries = document.querySelector('h1')?.textContent + if (bookseries === 'Series') { + presenceData.details = 'Viewing all book series on Goodreads' + } + else { + presenceData.details = 'Viewing a book series:' + presenceData.state = bookseries - presenceData.largeImageKey = document - .querySelector(".gr-box--withShadow.responsiveBook__img") - .getAttribute("src"); // get first book in series img - presenceData.buttons = [ - { - label: "View Series", - url: href, - }, - ]; - } - } else if (pathname.includes("/user/show/")) { - presenceData.details = "Viewing a profile:"; - //Without reading ID for private profiles - const user: string = document.querySelector("h1").textContent; - if (document.querySelector("h1 a") === null) { - //others profiles - presenceData.state = user; - } else { - presenceData.state = user.replace( - document.querySelector("h1 a").textContent, - "" - ); - } - try { - presenceData.largeImageKey = document - .querySelector(".profilePictureIcon") - .getAttribute("src"); - presenceData.buttons = [ - { - label: "View Profile", - url: href, - }, - ]; - } catch { - presenceData.details = "Trying to view a private profile:"; - } - } else if (pathname.includes("/user/year_in_books/")) { - presenceData.details = `Viewing ${ - document.querySelector(".bannerYearText").textContent - } year in books of:`; - presenceData.state = document.querySelector( - ".headerNameContainer .headerName" - ).textContent; - presenceData.largeImageKey = document - .querySelector(".headerImageContainer img") - .getAttribute("src"); - } else if (pathname.includes("/photo/author/")) { - presenceData.details = "Viewing an author photo:"; - presenceData.state = document.querySelector("h1 a").textContent; - presenceData.largeImageKey = document - .querySelector(".profile a img") - .getAttribute("src"); - } else if (pathname.includes("/author/show/")) { - presenceData.details = "Viewing an author:"; - presenceData.state = document.querySelector(".authorName span").textContent; + presenceData.largeImageKey = document + .querySelector('.gr-box--withShadow.responsiveBook__img') + ?.getAttribute('src') // get first book in series img + presenceData.buttons = [ + { + label: 'View Series', + url: href, + }, + ] + } + } + else if (pathname.includes('/user/show/')) { + presenceData.details = 'Viewing a profile:' + // Without reading ID for private profiles + const user = document.querySelector('h1')?.textContent + if (document.querySelector('h1 a') === null) { + // others profiles + presenceData.state = user + } + else { + presenceData.state = user?.replace( + document.querySelector('h1 a')?.textContent ?? '', + '', + ) + } + try { + presenceData.largeImageKey = document + .querySelector('.profilePictureIcon') + ?.getAttribute('src') + presenceData.buttons = [ + { + label: 'View Profile', + url: href, + }, + ] + } + catch { + presenceData.details = 'Trying to view a private profile:' + } + } + else if (pathname.includes('/user/year_in_books/')) { + presenceData.details = `Viewing ${ + document.querySelector('.bannerYearText')?.textContent + } year in books of:` + presenceData.state = document.querySelector( + '.headerNameContainer .headerName', + )?.textContent + presenceData.largeImageKey = document + .querySelector('.headerImageContainer img') + ?.getAttribute('src') + } + else if (pathname.includes('/photo/author/')) { + presenceData.details = 'Viewing an author photo:' + presenceData.state = document.querySelector('h1 a')?.textContent + presenceData.largeImageKey = document + .querySelector('.profile a img') + ?.getAttribute('src') + } + else if (pathname.includes('/author/show/')) { + presenceData.details = 'Viewing an author:' + presenceData.state = document.querySelector('.authorName span')?.textContent - presenceData.largeImageKey = document - .querySelector(".leftContainer.authorLeftContainer img") - .getAttribute("src"); - presenceData.buttons = [ - { - label: "View Author", - url: href, - }, - ]; - } else if (pathname.includes("/group/show/")) { - presenceData.details = "Viewing a group:"; - presenceData.state = document.querySelector("h1").textContent; - } else if (pathname.includes("/topic")) - presenceData.details = "Browsing discussions"; - else if (pathname.includes("/review/edit/")) { - presenceData.details = "Writing a book review..."; - try { - presenceData.state = document.querySelector("a.bookTitle").textContent; - presenceData.smallImageKey = document - .querySelector(".leftAlignedImage") - .getAttribute("src"); - presenceData.smallImageText = `Rating for ${document - .querySelector(".stars") - .getAttribute("data-rating")}☆ stars`; - } catch { - presenceData.state = "Trying to edit an unknown book..."; - } + presenceData.largeImageKey = document + .querySelector('.leftContainer.authorLeftContainer img') + ?.getAttribute('src') + presenceData.buttons = [ + { + label: 'View Author', + url: href, + }, + ] + } + else if (pathname.includes('/group/show/')) { + presenceData.details = 'Viewing a group:' + presenceData.state = document.querySelector('h1')?.textContent + } + else if (pathname.includes('/topic')) { + presenceData.details = 'Browsing discussions' + } + else if (pathname.includes('/review/edit/')) { + presenceData.details = 'Writing a book review...' + try { + presenceData.state = document.querySelector('a.bookTitle')?.textContent + presenceData.smallImageKey = document + .querySelector('.leftAlignedImage') + ?.getAttribute('src') + presenceData.smallImageText = `Rating for ${document + .querySelector('.stars') + ?.getAttribute('data-rating')}☆ stars` + } + catch { + presenceData.state = 'Trying to edit an unknown book...' + } - presenceData.largeImageKey = Assets.Writing; - } else if (pathname.includes("/review/list/")) - presenceData.details = "Browsing bookshelves"; - else if (pathname.includes("/review/show")) { - presenceData.details = "Reading a review..."; - presenceData.smallImageKey = Assets.Reading; - presenceData.smallImageText = "On Goodreads"; - } else if (pathname.includes("/recommendations")) - presenceData.details = "Browsing recommendations"; - else if ( - pathname.includes("/challenges") || - pathname.includes("/user_challenges") - ) - presenceData.details = "Viewing reading challenge"; - else if (pathname.includes("/quotes")) - presenceData.details = "Browsing quotes"; - else if (pathname.includes("/search")) { - presenceData.details = "Searching for a book..."; - presenceData.smallImageKey = Assets.Search; - presenceData.smallImageText = "On Goodreads"; - } - presence.setActivity(presenceData); -}); + presenceData.largeImageKey = Assets.Writing + } + else if (pathname.includes('/review/list/')) { + presenceData.details = 'Browsing bookshelves' + } + else if (pathname.includes('/review/show')) { + presenceData.details = 'Reading a review...' + presenceData.smallImageKey = Assets.Reading + presenceData.smallImageText = 'On Goodreads' + } + else if (pathname.includes('/recommendations')) { + presenceData.details = 'Browsing recommendations' + } + else if ( + pathname.includes('/challenges') + || pathname.includes('/user_challenges') + ) { + presenceData.details = 'Viewing reading challenge' + } + else if (pathname.includes('/quotes')) { + presenceData.details = 'Browsing quotes' + } + else if (pathname.includes('/search')) { + presenceData.details = 'Searching for a book...' + presenceData.smallImageKey = Assets.Search + presenceData.smallImageText = 'On Goodreads' + } + presence.setActivity(presenceData) +}) diff --git a/websites/G/Google Calendar/metadata.json b/websites/G/Google Calendar/metadata.json index c876f4b18c78..66f929a53dcf 100644 --- a/websites/G/Google Calendar/metadata.json +++ b/websites/G/Google Calendar/metadata.json @@ -1,37 +1,37 @@ { - "$schema": "https://schemas.premid.app/metadata/1.12", - "apiVersion": 1, - "author": { - "name": "Tellen", - "id": "535214819520020510" - }, - "contributors": [ - { - "name": "Bas950", - "id": "241278257335500811" - } - ], - "service": "Google Calendar", - "description": { - "en": "Google Calendar is a time-management and scheduling calendar service developed by Google.", - "it": "Google Calendar è un sistema di calendari concepito da Google.", - "nl": "Google Agenda is een online agenda. Het is een gratis service van Google en kan worden gebruikt met een Google-account.", - "vi_VN": "Google Calendar là dịch vụ quản lý kế hoạch và thời gian được phát triển bởi Google." - }, - "url": [ - "calendar.google.com", - "www.calendar.google.com" - ], - "version": "1.2.23", - "logo": "https://cdn.rcd.gg/PreMiD/websites/G/Google%20Calendar/assets/logo.png", - "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/Google%20Calendar/assets/thumbnail.png", - "color": "#4689F4", - "category": "other", - "tags": [ - "calendar", - "schedule", - "google", - "organization", - "popular" - ] -} \ No newline at end of file + "$schema": "https://schemas.premid.app/metadata/1.12", + "apiVersion": 1, + "author": { + "name": "Tellen", + "id": "535214819520020510" + }, + "contributors": [ + { + "name": "Bas950", + "id": "241278257335500811" + } + ], + "service": "Google Calendar", + "description": { + "en": "Google Calendar is a time-management and scheduling calendar service developed by Google.", + "it": "Google Calendar è un sistema di calendari concepito da Google.", + "nl": "Google Agenda is een online agenda. Het is een gratis service van Google en kan worden gebruikt met een Google-account.", + "vi_VN": "Google Calendar là dịch vụ quản lý kế hoạch và thời gian được phát triển bởi Google." + }, + "url": [ + "calendar.google.com", + "www.calendar.google.com" + ], + "version": "1.2.23", + "logo": "https://cdn.rcd.gg/PreMiD/websites/G/Google%20Calendar/assets/logo.png", + "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/Google%20Calendar/assets/thumbnail.png", + "color": "#4689F4", + "category": "other", + "tags": [ + "calendar", + "schedule", + "google", + "organization", + "popular" + ] +} diff --git a/websites/G/Google Calendar/presence.ts b/websites/G/Google Calendar/presence.ts index c7e014da603d..27df0ecdcfe4 100644 --- a/websites/G/Google Calendar/presence.ts +++ b/websites/G/Google Calendar/presence.ts @@ -1,103 +1,128 @@ const presence = new Presence({ - clientId: "671599195462959104", - }), - browsingTimestamp = Math.floor(Date.now() / 1000); + clientId: '671599195462959104', +}) +const browsingTimestamp = Math.floor(Date.now() / 1000) -presence.on("UpdateData", () => { - const presenceData: PresenceData = { - largeImageKey: - "https://cdn.rcd.gg/PreMiD/websites/G/Google%20Calendar/assets/logo.png", - startTimestamp: browsingTimestamp, - }; +presence.on('UpdateData', () => { + const presenceData: PresenceData = { + largeImageKey: 'https://cdn.rcd.gg/PreMiD/websites/G/Google%20Calendar/assets/logo.png', + startTimestamp: browsingTimestamp, + } - if (document.location.pathname === "/") - presenceData.details = "In the Homepage"; - else if (document.location.pathname.startsWith("/calendar/")) { - if (document.location.pathname.startsWith("/calendar/r/day")) { - presenceData.details = "Viewing the day schedule:"; - presenceData.state = document - .querySelector("head > title") - .textContent.replace("Google Calendar - ", "") - .replaceAll(",", " -"); - } else if (document.location.pathname.startsWith("/calendar/r/week")) { - presenceData.details = "Viewing the week schedule:"; - presenceData.state = document - .querySelector("head > title") - .textContent.replace("Google Calendar - ", "") - .replaceAll(",", " -"); - } else if (document.location.pathname.startsWith("/calendar/r/month")) { - presenceData.details = "Viewing the month schedule:"; - presenceData.state = document - .querySelector("head > title") - .textContent.replace("Google Calendar - ", ""); - } else if (document.location.pathname.startsWith("/calendar/r/year")) { - presenceData.details = "Viewing the year schedule:"; - [, presenceData.state] = document - .querySelector("head > title") - .textContent.replace("Google Calendar - ", "") - .split(" "); - } else if (document.location.pathname.startsWith("/calendar/r/agenda")) - presenceData.details = "Browsing in the schedule"; - else if (document.location.pathname.startsWith("/calendar/r/customday")) { - presenceData.details = "Viewing the schedule of"; - presenceData.state = "custom days"; - } else if (document.location.pathname.startsWith("/calendar/r/eventedit")) - presenceData.details = "Editing a event"; - else if (document.location.pathname.startsWith("/calendar/r/search")) { - presenceData.details = "Searching the event:"; - presenceData.state = document.location.href - .replace("https://calendar.google.com/calendar/r/search?q=", "") - .replaceAll("%20", " "); - } else if (document.location.pathname.startsWith("/calendar/r/trash")) - presenceData.details = "Browsing the Trash"; - else if (document.location.pathname === "/calendar/r/settings") - presenceData.details = "In the general settings"; - else if ( - document.location.pathname.startsWith("/calendar/r/settings/addcalendar") - ) - presenceData.details = "Adding a calendar"; - else if ( - document.location.pathname.startsWith( - "/calendar/r/settings/createcalendar" - ) - ) - presenceData.details = "Creating a calendar"; - else if ( - document.location.pathname.startsWith( - "/calendar/r/settings/browsecalendars" - ) - ) - presenceData.details = "Browsing the calendars"; - else if ( - document.location.pathname.startsWith("/calendar/r/settings/addbyurl") - ) - presenceData.details = "Adding a calendar"; - else if ( - document.location.pathname.startsWith("/calendar/r/settings/export") - ) { - presenceData.details = "Exporting or ixporting"; - presenceData.state = "a calendar"; - } else if ( - document.location.pathname.startsWith("/calendar/r/settings/calendar") - ) { - presenceData.details = "In the settings of a"; - presenceData.state = "calendar"; - } else if ( - document.location.href.startsWith( - "https://calendar.google.com/calendar/embed?" - ) - ) { - presenceData.details = "Browsing the calendar:"; - presenceData.state = document.querySelector("head > title").textContent; - } else if ( - document.location.href.startsWith( - "https://calendar.google.com/calendar/embedhelper?" - ) - ) - presenceData.details = "Customizing a calendar"; - else presenceData.details = "Viewing the calendar"; - } + if (document.location.pathname === '/') { + presenceData.details = 'In the Homepage' + } + else if (document.location.pathname.startsWith('/calendar/')) { + if (document.location.pathname.startsWith('/calendar/r/day')) { + presenceData.details = 'Viewing the day schedule:' + presenceData.state = document + .querySelector('head > title') + ?.textContent + ?.replace('Google Calendar - ', '') + ?.replaceAll(',', ' -') + } + else if (document.location.pathname.startsWith('/calendar/r/week')) { + presenceData.details = 'Viewing the week schedule:' + presenceData.state = document + .querySelector('head > title') + ?.textContent + ?.replace('Google Calendar - ', '') + ?.replaceAll(',', ' -') + } + else if (document.location.pathname.startsWith('/calendar/r/month')) { + presenceData.details = 'Viewing the month schedule:' + presenceData.state = document + .querySelector('head > title') + ?.textContent + ?.replace('Google Calendar - ', '') + } + else if (document.location.pathname.startsWith('/calendar/r/year')) { + presenceData.details = 'Viewing the year schedule:'; + [, presenceData.state] = document + .querySelector('head > title') + ?.textContent + ?.replace('Google Calendar - ', '') + ?.split(' ') ?? [] + } + else if (document.location.pathname.startsWith('/calendar/r/agenda')) { + presenceData.details = 'Browsing in the schedule' + } + else if (document.location.pathname.startsWith('/calendar/r/customday')) { + presenceData.details = 'Viewing the schedule of' + presenceData.state = 'custom days' + } + else if (document.location.pathname.startsWith('/calendar/r/eventedit')) { + presenceData.details = 'Editing a event' + } + else if (document.location.pathname.startsWith('/calendar/r/search')) { + presenceData.details = 'Searching the event:' + presenceData.state = document.location.href + .replace('https://calendar.google.com/calendar/r/search?q=', '') + .replaceAll('%20', ' ') + } + else if (document.location.pathname.startsWith('/calendar/r/trash')) { + presenceData.details = 'Browsing the Trash' + } + else if (document.location.pathname === '/calendar/r/settings') { + presenceData.details = 'In the general settings' + } + else if ( + document.location.pathname.startsWith('/calendar/r/settings/addcalendar') + ) { + presenceData.details = 'Adding a calendar' + } + else if ( + document.location.pathname.startsWith( + '/calendar/r/settings/createcalendar', + ) + ) { + presenceData.details = 'Creating a calendar' + } + else if ( + document.location.pathname.startsWith( + '/calendar/r/settings/browsecalendars', + ) + ) { + presenceData.details = 'Browsing the calendars' + } + else if ( + document.location.pathname.startsWith('/calendar/r/settings/addbyurl') + ) { + presenceData.details = 'Adding a calendar' + } + else if ( + document.location.pathname.startsWith('/calendar/r/settings/export') + ) { + presenceData.details = 'Exporting or ixporting' + presenceData.state = 'a calendar' + } + else if ( + document.location.pathname.startsWith('/calendar/r/settings/calendar') + ) { + presenceData.details = 'In the settings of a' + presenceData.state = 'calendar' + } + else if ( + document.location.href.startsWith( + 'https://calendar.google.com/calendar/embed?', + ) + ) { + presenceData.details = 'Browsing the calendar:' + presenceData.state = document.querySelector('head > title')?.textContent + } + else if ( + document.location.href.startsWith( + 'https://calendar.google.com/calendar/embedhelper?', + ) + ) { + presenceData.details = 'Customizing a calendar' + } + else { + presenceData.details = 'Viewing the calendar' + } + } - if (presenceData.details) presence.setActivity(presenceData); - else presence.setActivity(); -}); + if (presenceData.details) + presence.setActivity(presenceData) + else presence.setActivity() +}) diff --git a/websites/G/Google Classroom/metadata.json b/websites/G/Google Classroom/metadata.json index d36b8e3cf815..4037480ac588 100644 --- a/websites/G/Google Classroom/metadata.json +++ b/websites/G/Google Classroom/metadata.json @@ -1,44 +1,44 @@ { - "$schema": "https://schemas.premid.app/metadata/1.12", - "apiVersion": 1, - "author": { - "name": "allvzx", - "id": "369507341973979136" - }, - "contributors": [ - { - "name": "Encrypted", - "id": "564434085708038144" - } - ], - "service": "Google Classroom", - "description": { - "en": "Google Classroom is a free web service, developed by Google for schools, that aims to simplify creating, distributing, and grading assignments in a paperless way. The primary purpose of Google Classroom is to streamline the process of sharing files between teachers and students.", - "nl": "Google Classroom is een gratis en makkelijke tool waarmee docenten voortgang efficiënt kunnen beheren en beoordelen, en waarmee ze in contact kunnen blijven met leerlingen, zelfs onderweg of vanuit huis.", - "fr": "Google Classroom est service web gratuit, développé par Google pour les écoles, qui a pour but de simplifier la création, la distribution, et la notation des devoirs de manière numérique. Le but primaire de Google Classroom est de simplifier le processus de partage de fichiers entre les professeurs et les étudiants.", - "vi_VN": "Google Classroom là dịch vụ web miễn phí, được phát triển bởi Google dành cho các trường học, nhằm mục đích đơn giản hoá việc tạo, phân phối, và đánh giá các bài tập một cách không cần giấy bút. Mục đích chính của Google Classroom là sắp xếp gọn gàng quá trình chia sẻ tệp giữa giáo viên và học sinh." - }, - "url": "classroom.google.com", - "version": "1.1.30", - "logo": "https://cdn.rcd.gg/PreMiD/websites/G/Google%20Classroom/assets/logo.png", - "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/Google%20Classroom/assets/thumbnail.png", - "color": "#1e8e3e", - "category": "other", - "tags": [ - "google", - "classroom", - "school" - ], - "settings": [ - { - "id": "lang", - "multiLanguage": true - }, - { - "id": "privacy", - "title": "Privacy Mode", - "icon": "fad fa-user-secret", - "value": true - } - ] -} \ No newline at end of file + "$schema": "https://schemas.premid.app/metadata/1.12", + "apiVersion": 1, + "author": { + "name": "allvzx", + "id": "369507341973979136" + }, + "contributors": [ + { + "name": "Encrypted", + "id": "564434085708038144" + } + ], + "service": "Google Classroom", + "description": { + "en": "Google Classroom is a free web service, developed by Google for schools, that aims to simplify creating, distributing, and grading assignments in a paperless way. The primary purpose of Google Classroom is to streamline the process of sharing files between teachers and students.", + "nl": "Google Classroom is een gratis en makkelijke tool waarmee docenten voortgang efficiënt kunnen beheren en beoordelen, en waarmee ze in contact kunnen blijven met leerlingen, zelfs onderweg of vanuit huis.", + "fr": "Google Classroom est service web gratuit, développé par Google pour les écoles, qui a pour but de simplifier la création, la distribution, et la notation des devoirs de manière numérique. Le but primaire de Google Classroom est de simplifier le processus de partage de fichiers entre les professeurs et les étudiants.", + "vi_VN": "Google Classroom là dịch vụ web miễn phí, được phát triển bởi Google dành cho các trường học, nhằm mục đích đơn giản hoá việc tạo, phân phối, và đánh giá các bài tập một cách không cần giấy bút. Mục đích chính của Google Classroom là sắp xếp gọn gàng quá trình chia sẻ tệp giữa giáo viên và học sinh." + }, + "url": "classroom.google.com", + "version": "1.1.30", + "logo": "https://cdn.rcd.gg/PreMiD/websites/G/Google%20Classroom/assets/logo.png", + "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/Google%20Classroom/assets/thumbnail.png", + "color": "#1e8e3e", + "category": "other", + "tags": [ + "google", + "classroom", + "school" + ], + "settings": [ + { + "id": "lang", + "multiLanguage": true + }, + { + "id": "privacy", + "title": "Privacy Mode", + "icon": "fad fa-user-secret", + "value": true + } + ] +} diff --git a/websites/G/Google Classroom/presence.ts b/websites/G/Google Classroom/presence.ts index 65bbca8d2906..7f63388281b2 100644 --- a/websites/G/Google Classroom/presence.ts +++ b/websites/G/Google Classroom/presence.ts @@ -1,113 +1,117 @@ const presence = new Presence({ - clientId: "632293282847784973", - }), - browsingTimestamp = Math.floor(Date.now() / 1000); + clientId: '632293282847784973', +}) +const browsingTimestamp = Math.floor(Date.now() / 1000) async function getStrings() { - return presence.getStrings( - { - home: "general.viewHome", - calendar: "googleclassroom.calendar", - todo: "googleclassroom.todo", - assignmentPrivate: "googleclassroom.assignmentPrivate", - assignment: "googleclassroom.assignment", - class: "googleclassroom.class", - classworkPrivate: "googleclassroom.classworkPrivate", - classwork: "googleclassroom.classwork", - classmembersPrivate: "googleclassroom.classmembersPrivate", - classmembers: "googleclassroom.classmembers", - settings: "googleclassroom.settings", - }, - await presence.getSetting("lang").catch(() => "en") - ); + return presence.getStrings( + { + home: 'general.viewHome', + calendar: 'googleclassroom.calendar', + todo: 'googleclassroom.todo', + assignmentPrivate: 'googleclassroom.assignmentPrivate', + assignment: 'googleclassroom.assignment', + class: 'googleclassroom.class', + classworkPrivate: 'googleclassroom.classworkPrivate', + classwork: 'googleclassroom.classwork', + classmembersPrivate: 'googleclassroom.classmembersPrivate', + classmembers: 'googleclassroom.classmembers', + settings: 'googleclassroom.settings', + }, + await presence.getSetting('lang').catch(() => 'en'), + ) } -let strings: Awaited> = null, - oldLang: string = null; +let strings: Awaited> | null = null +let oldLang: string | null = null -presence.on("UpdateData", async () => { - const presenceData: PresenceData = { - largeImageKey: - "https://cdn.rcd.gg/PreMiD/websites/G/Google%20Classroom/assets/logo.png", - startTimestamp: browsingTimestamp, - }, - path = document.location.pathname.split("/"), - [newLang, privacy] = await Promise.all([ - presence.getSetting("lang").catch(() => "en"), - presence.getSetting("privacy"), - ]); +presence.on('UpdateData', async () => { + const presenceData: PresenceData = { + largeImageKey: 'https://cdn.rcd.gg/PreMiD/websites/G/Google%20Classroom/assets/logo.png', + startTimestamp: browsingTimestamp, + } + const path = document.location.pathname.split('/') + const [newLang, privacy] = await Promise.all([ + presence.getSetting('lang').catch(() => 'en'), + presence.getSetting('privacy'), + ]) - if (oldLang !== newLang) { - oldLang = newLang; - strings = await getStrings(); - } + if (oldLang !== newLang || !strings) { + oldLang = newLang + strings = await getStrings() + } - path.shift(); - if (path[0] === "u") path.splice(0, 2); + path.shift() + if (path[0] === 'u') + path.splice(0, 2) - switch (path[0]) { - case "h": { - presenceData.details = strings.home; - break; - } - case "calendar": { - presenceData.details = strings.calendar; - break; - } - case "a": { - presenceData.details = strings.todo; - break; - } - case "c": { - const classroom = document.querySelector('span[class="YVvGBb dDKhVc"]') - ? `${document.querySelector('span[id="UGb2Qe"]').textContent} - ${ - document.querySelector('span[class="YVvGBb dDKhVc"]').textContent - }` - : document.querySelector('span[id="UGb2Qe"]').textContent; - if (path[2] && path[2] === "a") { - presenceData.details = privacy - ? strings.assignmentPrivate - : strings.assignment; - } else presenceData.details = strings.class; + switch (path[0]) { + case 'h': { + presenceData.details = strings.home + break + } + case 'calendar': { + presenceData.details = strings.calendar + break + } + case 'a': { + presenceData.details = strings.todo + break + } + case 'c': { + const classroom = document.querySelector('span[class="YVvGBb dDKhVc"]') + ? `${document.querySelector('span[id="UGb2Qe"]')?.textContent} - ${ + document.querySelector('span[class="YVvGBb dDKhVc"]')?.textContent + }` + : document.querySelector('span[id="UGb2Qe"]')?.textContent + if (path[2] && path[2] === 'a') { + presenceData.details = privacy + ? strings.assignmentPrivate + : strings.assignment + } + else { + presenceData.details = strings.class + } - if (!privacy) presenceData.state = classroom; + if (!privacy) + presenceData.state = classroom - break; - } - case "w": { - const classroom = document.querySelector('span[class="YVvGBb dDKhVc"]') - ? `${document.querySelector('span[id="UGb2Qe"]').textContent} - ${ - document.querySelector('span[class="YVvGBb dDKhVc"]').textContent - }` - : document.querySelector('span[id="UGb2Qe"]').textContent; - presenceData.details = privacy - ? strings.classworkPrivate - : strings.classwork; - if (!privacy) presenceData.state = classroom; + break + } + case 'w': { + const classroom = document.querySelector('span[class="YVvGBb dDKhVc"]') + ? `${document.querySelector('span[id="UGb2Qe"]')?.textContent} - ${ + document.querySelector('span[class="YVvGBb dDKhVc"]')?.textContent + }` + : document.querySelector('span[id="UGb2Qe"]')?.textContent + presenceData.details = privacy + ? strings.classworkPrivate + : strings.classwork + if (!privacy) + presenceData.state = classroom - break; - } - case "r": { - const classroom = document.querySelector('span[class="YVvGBb dDKhVc"]') - ? `${document.querySelector('span[id="UGb2Qe"]').textContent} - ${ - document.querySelector('span[class="YVvGBb dDKhVc"]').textContent - }` - : document.querySelector('span[id="UGb2Qe"]').textContent; - presenceData.details = privacy - ? strings.classmembersPrivate - : strings.classmembers; + break + } + case 'r': { + const classroom = document.querySelector('span[class="YVvGBb dDKhVc"]') + ? `${document.querySelector('span[id="UGb2Qe"]')?.textContent} - ${ + document.querySelector('span[class="YVvGBb dDKhVc"]')?.textContent + }` + : document.querySelector('span[id="UGb2Qe"]')?.textContent + presenceData.details = privacy + ? strings.classmembersPrivate + : strings.classmembers - if (!privacy) presenceData.state = classroom; + if (!privacy) + presenceData.state = classroom - break; - } - case "s": - { - presenceData.details = strings.settings; - // No default - } - break; - } + break + } + case 's': { + presenceData.details = strings.settings + break + } + } - presence.setActivity(presenceData); -}); + presence.setActivity(presenceData) +}) diff --git a/websites/G/Google Colab/metadata.json b/websites/G/Google Colab/metadata.json index cae6cfff1599..0a9bfc2f67c7 100644 --- a/websites/G/Google Colab/metadata.json +++ b/websites/G/Google Colab/metadata.json @@ -1,25 +1,25 @@ { - "$schema": "https://schemas.premid.app/metadata/1.12", - "apiVersion": 1, - "author": { - "name": "theusaf", - "id": "193714715631812608" - }, - "service": "Google Colab", - "description": { - "en": "Colab, or \"Colaboratory\", allows you to write and execute Python in your browser, with zero configuration required, access to GPUs free of charge, and easy sharing" - }, - "url": "colab.research.google.com", - "version": "1.0.14", - "logo": "https://cdn.rcd.gg/PreMiD/websites/G/Google%20Colab/assets/logo.png", - "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/Google%20Colab/assets/thumbnail.png", - "color": "#f9ab00", - "category": "other", - "tags": [ - "colaboratory", - "programming", - "notebook", - "juypter", - "markdown" - ] -} \ No newline at end of file + "$schema": "https://schemas.premid.app/metadata/1.12", + "apiVersion": 1, + "author": { + "name": "theusaf", + "id": "193714715631812608" + }, + "service": "Google Colab", + "description": { + "en": "Colab, or \"Colaboratory\", allows you to write and execute Python in your browser, with zero configuration required, access to GPUs free of charge, and easy sharing" + }, + "url": "colab.research.google.com", + "version": "1.0.14", + "logo": "https://cdn.rcd.gg/PreMiD/websites/G/Google%20Colab/assets/logo.png", + "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/Google%20Colab/assets/thumbnail.png", + "color": "#f9ab00", + "category": "other", + "tags": [ + "colaboratory", + "programming", + "notebook", + "juypter", + "markdown" + ] +} diff --git a/websites/G/Google Colab/presence.ts b/websites/G/Google Colab/presence.ts index 28121816939e..d16d92687bd9 100644 --- a/websites/G/Google Colab/presence.ts +++ b/websites/G/Google Colab/presence.ts @@ -1,94 +1,111 @@ const presence = new Presence({ - clientId: "959487033963843594", - }), - browsingTimestamp = Math.floor(Date.now() / 1000); + clientId: '959487033963843594', +}) +const browsingTimestamp = Math.floor(Date.now() / 1000) const enum Assets { - Logo = "https://cdn.rcd.gg/PreMiD/websites/G/Google%20Colab/assets/logo.png", - Comment = "https://cdn.rcd.gg/PreMiD/websites/G/Google%20Colab/assets/0.png", - Information = "https://cdn.rcd.gg/PreMiD/websites/G/Google%20Colab/assets/1.png", + Logo = 'https://cdn.rcd.gg/PreMiD/websites/G/Google%20Colab/assets/logo.png', + Comment = 'https://cdn.rcd.gg/PreMiD/websites/G/Google%20Colab/assets/0.png', + Information = 'https://cdn.rcd.gg/PreMiD/websites/G/Google%20Colab/assets/1.png', } -presence.on("UpdateData", () => { - const presenceData: PresenceData = { - largeImageKey: Assets.Logo, - startTimestamp: browsingTimestamp, - }, - notebookTitle = - document.querySelector("#doc-name")?.value, - selected = document.querySelector(".cell.focused"), - { pathname } = location; +presence.on('UpdateData', () => { + const presenceData: PresenceData = { + largeImageKey: Assets.Logo, + startTimestamp: browsingTimestamp, + } + const notebookTitle = document.querySelector('#doc-name')?.value + const selected = document.querySelector('.cell.focused') + const { pathname } = location - if (pathname === "/diff") { - presenceData.details = "Viewing a diff"; - if (document.querySelector(".diff-raw[aria-checked=true]")) - presenceData.state = "Raw diff"; - else if (document.querySelector(".diff-inline[aria-checked=true]")) { - const [diff1, diff2] = document.querySelectorAll(".view-zones"); - presenceData.state = `${ - diff1.querySelector(".view-line").textContent - } vs ${diff2.querySelector(".view-line").textContent}`; - } else { - const [diff1, diff2] = document.querySelectorAll(".view-lines"); - presenceData.state = `${ - diff1.querySelector(".view-line").textContent - } vs ${diff2.querySelector(".view-line").textContent}`; - } - } else if (document.querySelector("#notebook-info")) { - presenceData.details = "Viewing notebook info"; - presenceData.state = notebookTitle; - } else if (document.querySelector(".notebook-settings")) - presenceData.details = "Editing Notebook Settings"; - else if (document.querySelector(".colab-open-dialog")) { - presenceData.details = "Opening Notebook"; - presenceData.state = `From ${ - document.querySelector(".colab-open-dialog .iron-selected").textContent - }`; - } else if (document.querySelector("#preferences-dialog")) - presenceData.details = "Editing Settings"; - else { - // Editing or viewing a file - // Checking if the user has edit permissions - if ( - document - .querySelector("colab-last-saved-indicator") - .getAttribute("command") === "save" - ) - presenceData.details = `Viewing ${notebookTitle}`; - else presenceData.details = `Editing ${notebookTitle}`; + if (pathname === '/diff') { + presenceData.details = 'Viewing a diff' + if (document.querySelector('.diff-raw[aria-checked=true]')) { + presenceData.state = 'Raw diff' + } + else if (document.querySelector('.diff-inline[aria-checked=true]')) { + const [diff1, diff2] = document.querySelectorAll('.view-zones') + presenceData.state = `${ + diff1.querySelector('.view-line')?.textContent + } vs ${diff2.querySelector('.view-line')?.textContent}` + } + else { + const [diff1, diff2] = document.querySelectorAll('.view-lines') + presenceData.state = `${ + diff1.querySelector('.view-line')?.textContent + } vs ${diff2.querySelector('.view-line')?.textContent}` + } + } + else if (document.querySelector('#notebook-info')) { + presenceData.details = 'Viewing notebook info' + presenceData.state = notebookTitle + } + else if (document.querySelector('.notebook-settings')) { + presenceData.details = 'Editing Notebook Settings' + } + else if (document.querySelector('.colab-open-dialog')) { + presenceData.details = 'Opening Notebook' + presenceData.state = `From ${ + document.querySelector('.colab-open-dialog .iron-selected')?.textContent + }` + } + else if (document.querySelector('#preferences-dialog')) { + presenceData.details = 'Editing Settings' + } + else { + // Editing or viewing a file + // Checking if the user has edit permissions + if ( + document + .querySelector('colab-last-saved-indicator') + ?.getAttribute('command') === 'save' + ) { + presenceData.details = `Viewing ${notebookTitle}` + } + else { + presenceData.details = `Editing ${notebookTitle}` + } - // Getting the type of the selected cell - if (selected?.classList.contains("code")) - presenceData.state = "Editing code block"; - else if (selected?.classList.contains("text")) { - if (selected.classList.contains("edit")) - presenceData.state = "Editing text block"; - else presenceData.state = "Viewing text block"; - } + // Getting the type of the selected cell + if (selected?.classList.contains('code')) { + presenceData.state = 'Editing code block' + } + else if (selected?.classList.contains('text')) { + if (selected.classList.contains('edit')) + presenceData.state = 'Editing text block' + else presenceData.state = 'Viewing text block' + } - // Checking if the user is commenting - if (document.querySelector(".comment-fragment.editing.focused")) { - presenceData.smallImageKey = Assets.Comment; - presenceData.smallImageText = "Commenting"; - } else { - // Checking runtime resources - const connectShadowRoot = document.querySelector( - "colab-connect-button" - ).shadowRoot; - if (connectShadowRoot.querySelector("#connect-button-resource-display")) { - presenceData.smallImageKey = Assets.Information; - presenceData.smallImageText = `Ram: ${ - connectShadowRoot - .querySelector(".ram") - .shadowRoot.querySelector(".total > div").style.width - } Disk: ${ - connectShadowRoot - .querySelector(".disk") - .shadowRoot.querySelector(".total > div").style.width - }`; - } - } - } + // Checking if the user is commenting + if (document.querySelector('.comment-fragment.editing.focused')) { + presenceData.smallImageKey = Assets.Comment + presenceData.smallImageText = 'Commenting' + } + else { + // Checking runtime resources + const connectShadowRoot = document.querySelector( + 'colab-connect-button', + )?.shadowRoot + if (connectShadowRoot?.querySelector('#connect-button-resource-display')) { + presenceData.smallImageKey = Assets.Information + presenceData.smallImageText = `Ram: ${ + connectShadowRoot + ?.querySelector('.ram') + ?.shadowRoot + ?.querySelector('.total > div') + ?.style + ?.width + } Disk: ${ + connectShadowRoot + ?.querySelector('.disk') + ?.shadowRoot + ?.querySelector('.total > div') + ?.style + ?.width + }` + } + } + } - presence.setActivity(presenceData); -}); + presence.setActivity(presenceData) +}) diff --git a/websites/G/Google Docs/Google Docs.json b/websites/G/Google Docs/Google Docs.json index 0c0ac4bbd580..b7a10601a792 100644 --- a/websites/G/Google Docs/Google Docs.json +++ b/websites/G/Google Docs/Google Docs.json @@ -47,4 +47,4 @@ "description": "Displayed when the user is viewing a Google Sheet", "message": "Viewing a spreadsheet" } -} \ No newline at end of file +} diff --git a/websites/G/Google Docs/metadata.json b/websites/G/Google Docs/metadata.json index 08d3b59e790f..732a6a01e0e7 100644 --- a/websites/G/Google Docs/metadata.json +++ b/websites/G/Google Docs/metadata.json @@ -1,49 +1,49 @@ { - "$schema": "https://schemas.premid.app/metadata/1.12", - "apiVersion": 1, - "author": { - "name": "Encrypted", - "id": "564434085708038144" - }, - "contributors": [ - { - "name": "Callum", - "id": "506899274748133376" - } - ], - "service": "Google Docs", - "description": { - "en": "Google Docs is a word processor included as part of a free, web-based software office suite offered by Google within its Google Drive service. This service also includes Google Sheets and Google Slides, a spreadsheet and presentation program respectively.", - "zh_CN": "Google文档,是Google提供的网页式办公包在线服务,包含文字处理(Google文档)、电子表格(Google表格)、幻灯片演示(Google幻灯片)和交互表单(Google表单)。用户可在线免费创建和编辑文件,同时与其他用户共同协作。", - "zh_TW": "Google文件,是Google提供的網頁式辦公套件線上服務,包含文書處理(Google文件)、電子試算表(Google試算表)、簡報演示(Google簡報)和互動表單(Google表單)。用戶可線上免費建立和編輯檔案,同時與其他用戶共同協作。", - "ga_IE": "Is próiseálaí focal é Google Docs atá mar chuid de shraith oifige bogearraí gréasán-bhunaithe saor in aisce a chuireann Google ar fáil laistigh dá sheirbhís Google Drive. Áirítear leis an tseirbhís seo freisin Google Sheets agus Google Slides, clár scarbhileoige agus cur i láthair faoi seach.", - "nl": "Google Documenten is een gratis webgebaseerde tekstverwerker die deel uitmaakt van een virtueel kantoor aangeboden door Google binnen de Google Drive-service. Deze dienst bevat ook onder andere Google Spreadsheets en Google Presentaties.", - "vi_VN": "Google Docs là một ứng dụng hỗ trợ soạn thảo văn phòng trực tuyến được cung cấp miễn phí bởi Google. Nó bao gồm ba bộ ứng dụng: soạn thảo văn bản, soạn thảo bản tính và soạn thảo trình chiếu." - }, - "url": "docs.google.com", - "regExp": "docs[.]google([.][a-z]+)+[/]", - "version": "1.4.31", - "logo": "https://cdn.rcd.gg/PreMiD/websites/G/Google%20Docs/assets/logo.png", - "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/Google%20Docs/assets/thumbnail.jpg", - "color": "#3a404a", - "category": "other", - "tags": [ - "google", - "sheets", - "slides", - "forms", - "docs" - ], - "settings": [ - { - "id": "lang", - "multiLanguage": true - }, - { - "id": "privacy", - "title": "Privacy Mode", - "icon": "fad fa-user-secret", - "value": false - } - ] -} \ No newline at end of file + "$schema": "https://schemas.premid.app/metadata/1.12", + "apiVersion": 1, + "author": { + "name": "Encrypted", + "id": "564434085708038144" + }, + "contributors": [ + { + "name": "Callum", + "id": "506899274748133376" + } + ], + "service": "Google Docs", + "description": { + "en": "Google Docs is a word processor included as part of a free, web-based software office suite offered by Google within its Google Drive service. This service also includes Google Sheets and Google Slides, a spreadsheet and presentation program respectively.", + "zh_CN": "Google文档,是Google提供的网页式办公包在线服务,包含文字处理(Google文档)、电子表格(Google表格)、幻灯片演示(Google幻灯片)和交互表单(Google表单)。用户可在线免费创建和编辑文件,同时与其他用户共同协作。", + "zh_TW": "Google文件,是Google提供的網頁式辦公套件線上服務,包含文書處理(Google文件)、電子試算表(Google試算表)、簡報演示(Google簡報)和互動表單(Google表單)。用戶可線上免費建立和編輯檔案,同時與其他用戶共同協作。", + "ga_IE": "Is próiseálaí focal é Google Docs atá mar chuid de shraith oifige bogearraí gréasán-bhunaithe saor in aisce a chuireann Google ar fáil laistigh dá sheirbhís Google Drive. Áirítear leis an tseirbhís seo freisin Google Sheets agus Google Slides, clár scarbhileoige agus cur i láthair faoi seach.", + "nl": "Google Documenten is een gratis webgebaseerde tekstverwerker die deel uitmaakt van een virtueel kantoor aangeboden door Google binnen de Google Drive-service. Deze dienst bevat ook onder andere Google Spreadsheets en Google Presentaties.", + "vi_VN": "Google Docs là một ứng dụng hỗ trợ soạn thảo văn phòng trực tuyến được cung cấp miễn phí bởi Google. Nó bao gồm ba bộ ứng dụng: soạn thảo văn bản, soạn thảo bản tính và soạn thảo trình chiếu." + }, + "url": "docs.google.com", + "regExp": "docs[.]google([.][a-z]+)+[/]", + "version": "1.4.31", + "logo": "https://cdn.rcd.gg/PreMiD/websites/G/Google%20Docs/assets/logo.png", + "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/Google%20Docs/assets/thumbnail.jpg", + "color": "#3a404a", + "category": "other", + "tags": [ + "google", + "sheets", + "slides", + "forms", + "docs" + ], + "settings": [ + { + "id": "lang", + "multiLanguage": true + }, + { + "id": "privacy", + "title": "Privacy Mode", + "icon": "fad fa-user-secret", + "value": false + } + ] +} diff --git a/websites/G/Google Docs/presence.ts b/websites/G/Google Docs/presence.ts index 6cc9a4a7c99f..0aa56a936715 100644 --- a/websites/G/Google Docs/presence.ts +++ b/websites/G/Google Docs/presence.ts @@ -1,90 +1,95 @@ const presence = new Presence({ - clientId: "630478614894477337", - }), - browsingTimestamp = Math.floor(Date.now() / 1000); + clientId: '630478614894477337', +}) +const browsingTimestamp = Math.floor(Date.now() / 1000) -let title: string; +let title: string async function getStrings() { - return presence.getStrings( - { - editingDoc: "googledocs.editingDoc", - viewingDoc: "googledocs.viewingDoc", - browsingDoc: "googledocs.browsingDoc", - editingForm: "googledocs.editingForm", - viewingForm: "googledocs.viewingForm", - browsingForm: "googledocs.browsingForm", - editingSheet: "googledocs.editingSheet", - viewingSheet: "googledocs.viewingSheet", - browsingSheet: "googledocs.browsingSheet", - editingPresentation: "googledocs.editingPresentation", - browsingPresentation: "googledocs.browsingPresentation", - vieiwngPresentation: "googledocs.viewingPresentation", - }, - await presence.getSetting("lang").catch(() => "en") - ); + return presence.getStrings( + { + editingDoc: 'googledocs.editingDoc', + viewingDoc: 'googledocs.viewingDoc', + browsingDoc: 'googledocs.browsingDoc', + editingForm: 'googledocs.editingForm', + viewingForm: 'googledocs.viewingForm', + browsingForm: 'googledocs.browsingForm', + editingSheet: 'googledocs.editingSheet', + viewingSheet: 'googledocs.viewingSheet', + browsingSheet: 'googledocs.browsingSheet', + editingPresentation: 'googledocs.editingPresentation', + browsingPresentation: 'googledocs.browsingPresentation', + vieiwngPresentation: 'googledocs.viewingPresentation', + }, + await presence.getSetting('lang').catch(() => 'en'), + ) } -let strings: Awaited>, - oldLang: string = null; +let strings: Awaited> +let oldLang: string | null = null const enum Assets { - DocsLogo = "https://cdn.rcd.gg/PreMiD/websites/G/Google%20Docs/assets/0.png", - FormsLogo = "https://cdn.rcd.gg/PreMiD/websites/G/Google%20Docs/assets/1.png", - SheetsLogo = "https://cdn.rcd.gg/PreMiD/websites/G/Google%20Docs/assets/2.png", - SlidesLogo = "https://cdn.rcd.gg/PreMiD/websites/G/Google%20Docs/assets/3.png", + DocsLogo = 'https://cdn.rcd.gg/PreMiD/websites/G/Google%20Docs/assets/0.png', + FormsLogo = 'https://cdn.rcd.gg/PreMiD/websites/G/Google%20Docs/assets/1.png', + SheetsLogo = 'https://cdn.rcd.gg/PreMiD/websites/G/Google%20Docs/assets/2.png', + SlidesLogo = 'https://cdn.rcd.gg/PreMiD/websites/G/Google%20Docs/assets/3.png', } -presence.on("UpdateData", async () => { - const presenceData: PresenceData = { - startTimestamp: browsingTimestamp, - }, - privacy = await presence.getSetting("privacy"), - newLang = await presence.getSetting("lang").catch(() => "en"); +presence.on('UpdateData', async () => { + const presenceData: PresenceData = { + startTimestamp: browsingTimestamp, + } + const privacy = await presence.getSetting('privacy') + const newLang = await presence.getSetting('lang').catch(() => 'en') - if (oldLang !== newLang || !strings) { - oldLang = newLang; - strings = await getStrings(); - } + if (oldLang !== newLang || !strings) { + oldLang = newLang + strings = await getStrings() + } - title = document.title - .replace("- Google Docs", "") - .replace("- Google Forms", "") - .replace("- Google Sheets", "") - .replace("- Google Slides", ""); + title = document.title + .replace('- Google Docs', '') + .replace('- Google Forms', '') + .replace('- Google Sheets', '') + .replace('- Google Slides', '') - if (document.location.pathname.includes("/document")) { - presenceData.largeImageKey = Assets.DocsLogo; - if (document.location.pathname.includes("/edit")) - presenceData.details = strings.editingDoc; - else if (document.location.pathname.includes("/document/u/")) - presenceData.details = strings.browsingDoc; - else presenceData.details = strings.viewingDoc; - } else if (document.location.pathname.includes("/forms/")) { - presenceData.largeImageKey = Assets.FormsLogo; - if (document.location.pathname.includes("/edit")) - presenceData.details = strings.editingForm; - else if (document.location.pathname.includes("/forms/u/")) - presenceData.details = strings.browsingForm; - else presenceData.details = strings.viewingForm; - } else if (document.location.pathname.includes("/spreadsheets")) { - presenceData.largeImageKey = Assets.SheetsLogo; - if (document.location.pathname.includes("/edit")) - presenceData.details = strings.editingSheet; - else if (document.location.pathname.includes("/spreadsheets/u/")) - presenceData.details = strings.browsingSheet; - else presenceData.details = strings.viewingSheet; - } else if (document.location.pathname.includes("/presentation/")) { - presenceData.largeImageKey = Assets.SlidesLogo; - if (document.location.pathname.includes("/edit")) - presenceData.details = strings.editingPresentation; - else if (document.location.pathname.includes("/presentation/u/")) - presenceData.details = strings.browsingPresentation; - else presenceData.details = strings.vieiwngPresentation; - } + if (document.location.pathname.includes('/document')) { + presenceData.largeImageKey = Assets.DocsLogo + if (document.location.pathname.includes('/edit')) + presenceData.details = strings.editingDoc + else if (document.location.pathname.includes('/document/u/')) + presenceData.details = strings.browsingDoc + else presenceData.details = strings.viewingDoc + } + else if (document.location.pathname.includes('/forms/')) { + presenceData.largeImageKey = Assets.FormsLogo + if (document.location.pathname.includes('/edit')) + presenceData.details = strings.editingForm + else if (document.location.pathname.includes('/forms/u/')) + presenceData.details = strings.browsingForm + else presenceData.details = strings.viewingForm + } + else if (document.location.pathname.includes('/spreadsheets')) { + presenceData.largeImageKey = Assets.SheetsLogo + if (document.location.pathname.includes('/edit')) + presenceData.details = strings.editingSheet + else if (document.location.pathname.includes('/spreadsheets/u/')) + presenceData.details = strings.browsingSheet + else presenceData.details = strings.viewingSheet + } + else if (document.location.pathname.includes('/presentation/')) { + presenceData.largeImageKey = Assets.SlidesLogo + if (document.location.pathname.includes('/edit')) + presenceData.details = strings.editingPresentation + else if (document.location.pathname.includes('/presentation/u/')) + presenceData.details = strings.browsingPresentation + else presenceData.details = strings.vieiwngPresentation + } - if (!privacy) presenceData.state = title; + if (!privacy) + presenceData.state = title - if (presenceData.details) presence.setActivity(presenceData); - else presence.setActivity(); -}); + if (presenceData.details) + presence.setActivity(presenceData) + else presence.setActivity() +}) diff --git a/websites/G/Google Domains/metadata.json b/websites/G/Google Domains/metadata.json index e7d20be52f1e..d6935fd9ab06 100644 --- a/websites/G/Google Domains/metadata.json +++ b/websites/G/Google Domains/metadata.json @@ -1,43 +1,43 @@ { - "$schema": "https://schemas.premid.app/metadata/1.12", - "apiVersion": 1, - "author": { - "name": "Striker", - "id": "215509157837537280" - }, - "service": "Google Domains", - "description": { - "en": "Google Domains is an internet domain name registration service offered by Google. Google Domains offers domain registration, DNS hosting, DNSSEC, Dynamic DNS, domain forwarding, and email forwarding.", - "nl": "Google Domains is een dienst voor het registreren van internetdomeinnamen die wordt aangeboden door Google. Google Domains biedt domeinregistratie, DNS-hosting, DNSSEC, dynamische DNS, domein doorsturen en e-mail doorsturen.", - "vi_VN": "Google Domains là dịch vụ đăng ký tên miền được cung cấp bởi Google. Google Domains cung cấp đăng kí tên miền, tổ chức DNS, DNSSEC, DNS động, chuyển tên miền, và chuyển tiếp thư điện tử." - }, - "url": "domains.google.com", - "version": "1.0.26", - "logo": "https://cdn.rcd.gg/PreMiD/websites/G/Google%20Domains/assets/logo.jpg", - "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/Google%20Domains/assets/thumbnail.png", - "color": "#FCBC03", - "category": "other", - "tags": [ - "domain" - ], - "settings": [ - { - "id": "domain", - "title": "Show Domain Name", - "icon": "fas fa-file-signature", - "value": false - }, - { - "id": "search", - "title": "Show Search Query", - "icon": "fas fa-search", - "value": true - }, - { - "id": "timestamp", - "title": "Show Timestamps", - "icon": "fas fa-clock", - "value": true - } - ] -} \ No newline at end of file + "$schema": "https://schemas.premid.app/metadata/1.12", + "apiVersion": 1, + "author": { + "name": "Striker", + "id": "215509157837537280" + }, + "service": "Google Domains", + "description": { + "en": "Google Domains is an internet domain name registration service offered by Google. Google Domains offers domain registration, DNS hosting, DNSSEC, Dynamic DNS, domain forwarding, and email forwarding.", + "nl": "Google Domains is een dienst voor het registreren van internetdomeinnamen die wordt aangeboden door Google. Google Domains biedt domeinregistratie, DNS-hosting, DNSSEC, dynamische DNS, domein doorsturen en e-mail doorsturen.", + "vi_VN": "Google Domains là dịch vụ đăng ký tên miền được cung cấp bởi Google. Google Domains cung cấp đăng kí tên miền, tổ chức DNS, DNSSEC, DNS động, chuyển tên miền, và chuyển tiếp thư điện tử." + }, + "url": "domains.google.com", + "version": "1.0.26", + "logo": "https://cdn.rcd.gg/PreMiD/websites/G/Google%20Domains/assets/logo.jpg", + "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/Google%20Domains/assets/thumbnail.png", + "color": "#FCBC03", + "category": "other", + "tags": [ + "domain" + ], + "settings": [ + { + "id": "domain", + "title": "Show Domain Name", + "icon": "fas fa-file-signature", + "value": false + }, + { + "id": "search", + "title": "Show Search Query", + "icon": "fas fa-search", + "value": true + }, + { + "id": "timestamp", + "title": "Show Timestamps", + "icon": "fas fa-clock", + "value": true + } + ] +} diff --git a/websites/G/Google Domains/presence.ts b/websites/G/Google Domains/presence.ts index 9f5376e29184..3d4db2b1d044 100644 --- a/websites/G/Google Domains/presence.ts +++ b/websites/G/Google Domains/presence.ts @@ -1,90 +1,92 @@ const presence = new Presence({ - clientId: "735878480318955660", - }), - strings = presence.getStrings({ - browse: "general.browsing", - search: "general.searching", - }), - getElement = (query: string): string | undefined => { - return document.querySelector(query)?.textContent.trim(); - }; + clientId: '735878480318955660', +}) +const strings = presence.getStrings({ + browse: 'general.browsing', + search: 'general.searching', +}) +function getElement(query: string): string | undefined { + return document.querySelector(query)?.textContent?.trim() +} -let elapsed = Math.floor(Date.now() / 1000), - prevUrl = document.location.href; +let elapsed = Math.floor(Date.now() / 1000) +let prevUrl = document.location.href const statics = { - "/tos/": { - details: "Viewing Page...", - state: "Terms of Service", - }, -}; + '/tos/': { + details: 'Viewing Page...', + state: 'Terms of Service', + }, +} -presence.on("UpdateData", async () => { - const path = location.pathname.replace(/\/?$/, "/"), - showDomain = await presence.getSetting("domain"), - showSearch = await presence.getSetting("search"), - showTimestamps = await presence.getSetting("timestamp"); +presence.on('UpdateData', async () => { + const path = location.pathname.replace(/\/?$/, '/') + const showDomain = await presence.getSetting('domain') + const showSearch = await presence.getSetting('search') + const showTimestamps = await presence.getSetting('timestamp') - let presenceData: PresenceData = { - largeImageKey: - "https://cdn.rcd.gg/PreMiD/websites/G/Google%20Domains/assets/logo.jpg", - startTimestamp: elapsed, - }; + let presenceData: PresenceData = { + largeImageKey: 'https://cdn.rcd.gg/PreMiD/websites/G/Google%20Domains/assets/logo.jpg', + startTimestamp: elapsed, + } - if (document.location.href !== prevUrl) { - prevUrl = document.location.href; - elapsed = Math.floor(Date.now() / 1000); - } + if (document.location.href !== prevUrl) { + prevUrl = document.location.href + elapsed = Math.floor(Date.now() / 1000) + } - for (const [k, v] of Object.entries(statics)) - if (path.match(k)) presenceData = { ...presenceData, ...v }; + for (const [k, v] of Object.entries(statics)) { + if (path.match(k)) + presenceData = { ...presenceData, ...v } + } - if (path.includes("/m/registrar/")) { - const domainName = getElement(".domain-header-title > span"); - presenceData.details = domainName ? "Browsing Domain..." : "Browsing..."; + if (path.includes('/m/registrar/')) { + const domainName = getElement('.domain-header-title > span') + presenceData.details = domainName ? 'Browsing Domain...' : 'Browsing...' - const tab = - getElement(".dreg-ogb-menu-item-selected") || - getElement(".partner-header") || - getElement(".gb_bd"); - presenceData.state = - domainName && showDomain ? `${domainName} (${tab})` : tab && `${tab} tab`; - } + const tab = getElement('.dreg-ogb-menu-item-selected') + || getElement('.partner-header') + || getElement('.gb_bd') + presenceData.state = domainName && showDomain ? `${domainName} (${tab})` : tab && `${tab} tab` + } - if (path.includes("/m/registrar/cart/")) { - presenceData.details = "Viewing Cart..."; - presenceData.state = getElement(".item-count")?.slice(1, -1); - } + if (path.includes('/m/registrar/cart/')) { + presenceData.details = 'Viewing Cart...' + presenceData.state = getElement('.item-count')?.slice(1, -1) + } - if (path.includes("/m/registrar/checkout/")) - presenceData.details = "Viewing Checkout..."; + if (path.includes('/m/registrar/checkout/')) + presenceData.details = 'Viewing Checkout...' - if (path.includes("/m/registrar/search/")) { - presenceData.details = "Searching..."; - presenceData.state = showSearch && document.querySelector("input")?.value; - } + if (path.includes('/m/registrar/search/')) { + presenceData.details = 'Searching...' + presenceData.state = showSearch ? document.querySelector('input')?.value : undefined + } - if (path.includes("/m/registrar/search/favorites/")) { - presenceData.details = "Viewing Favorites..."; - presenceData.state = getElement(".mat-tab-label-active"); - } + if (path.includes('/m/registrar/search/favorites/')) { + presenceData.details = 'Viewing Favorites...' + presenceData.state = getElement('.mat-tab-label-active') + } - if (presenceData.details && typeof presenceData.details === "string") { - if (presenceData.details.match("(Browsing|Viewing)")) { - presenceData.smallImageKey = Assets.Reading; - presenceData.smallImageText = (await strings).browse; - } - if (presenceData.details.match("(Searching)")) { - presenceData.smallImageKey = Assets.Search; - presenceData.smallImageText = (await strings).search; - } - if (!showTimestamps) { - delete presenceData.startTimestamp; - delete presenceData.endTimestamp; - } + if (presenceData.details && typeof presenceData.details === 'string') { + if (presenceData.details.match('(Browsing|Viewing)')) { + presenceData.smallImageKey = Assets.Reading + presenceData.smallImageText = (await strings).browse + } + if (presenceData.details.match('(Searching)')) { + presenceData.smallImageKey = Assets.Search + presenceData.smallImageText = (await strings).search + } + if (!showTimestamps) { + delete presenceData.startTimestamp + delete presenceData.endTimestamp + } - !presenceData.state && delete presenceData.state; + !presenceData.state && delete presenceData.state - presence.setActivity(presenceData); - } else presence.setActivity(); -}); + presence.setActivity(presenceData) + } + else { + presence.setActivity() + } +}) diff --git a/websites/G/Google Drive/metadata.json b/websites/G/Google Drive/metadata.json index 540ba046e58a..afc50aa46074 100644 --- a/websites/G/Google Drive/metadata.json +++ b/websites/G/Google Drive/metadata.json @@ -1,42 +1,42 @@ { - "$schema": "https://schemas.premid.app/metadata/1.12", - "apiVersion": 1, - "author": { - "name": "Callum", - "id": "506899274748133376" - }, - "contributors": [ - { - "name": "Jake.#1111", - "id": "480407581085532180" - } - ], - "service": "Google Drive", - "description": { - "en": "Google Drive is a file storage and synchronization service developed by Google. Launched on April 24, 2012, Google Drive allows users to store files on their servers, synchronize files across devices, and share files.", - "zh_CN": "Google云端硬盘是Google的一个在线同步存储服务,同时结合Google文档及Google我的地图的在线文件编辑功能。", - "zh_TW": "Google雲端硬碟是Google的一個線上同步儲存服務,同時結合Google文件及Google我的地圖的線上檔案編輯功能。", - "ga_IE": "Is seirbhís stórála agus sioncronaithe é Google Drive a d'fhorbair Google. Le seoladh ar 24 Aibreán, 2012, ceadaíonn Google Drive d'úsáideoirí comhaid a stóráil ar a bhfreastalaithe, comhaid a shioncrónú ar fud na bhfeistí, agus comhaid a roinnt.", - "nl": "Google Drive is een service voor bestandsopslag en synchronisatie die is gemaakt en wordt beheerd door Google. Met Google Drive kunnen documenten in de cloud worden opgeslagen, bestanden worden gedeeld en documenten samen met anderen worden bewerkt.", - "vi_VN": "Google Drive là dịch vụ lưu trữ và đồng bộ hóa tập tin được tạo bởi Google. Nó cho phép người dùng có thể lưu trữ tập tin trên đám mây, chia sẻ tập tin, và chỉnh sửa tài liệu, văn bản, bảng tính, và bài thuyết trình với cộng tác viên." - }, - "url": "drive.google.com", - "regExp": "drive[.]google([.][a-z]+)+[/]", - "version": "1.6.11", - "logo": "https://cdn.rcd.gg/PreMiD/websites/G/Google%20Drive/assets/logo.png", - "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/Google%20Drive/assets/thumbnail.png", - "color": "#3aa154", - "category": "other", - "tags": [ - "drive", - "google" - ], - "settings": [ - { - "id": "privacy", - "title": "Privacy Mode", - "icon": "fad fa-user-secret", - "value": true - } - ] -} \ No newline at end of file + "$schema": "https://schemas.premid.app/metadata/1.12", + "apiVersion": 1, + "author": { + "name": "Callum", + "id": "506899274748133376" + }, + "contributors": [ + { + "name": "Jake.#1111", + "id": "480407581085532180" + } + ], + "service": "Google Drive", + "description": { + "en": "Google Drive is a file storage and synchronization service developed by Google. Launched on April 24, 2012, Google Drive allows users to store files on their servers, synchronize files across devices, and share files.", + "zh_CN": "Google云端硬盘是Google的一个在线同步存储服务,同时结合Google文档及Google我的地图的在线文件编辑功能。", + "zh_TW": "Google雲端硬碟是Google的一個線上同步儲存服務,同時結合Google文件及Google我的地圖的線上檔案編輯功能。", + "ga_IE": "Is seirbhís stórála agus sioncronaithe é Google Drive a d'fhorbair Google. Le seoladh ar 24 Aibreán, 2012, ceadaíonn Google Drive d'úsáideoirí comhaid a stóráil ar a bhfreastalaithe, comhaid a shioncrónú ar fud na bhfeistí, agus comhaid a roinnt.", + "nl": "Google Drive is een service voor bestandsopslag en synchronisatie die is gemaakt en wordt beheerd door Google. Met Google Drive kunnen documenten in de cloud worden opgeslagen, bestanden worden gedeeld en documenten samen met anderen worden bewerkt.", + "vi_VN": "Google Drive là dịch vụ lưu trữ và đồng bộ hóa tập tin được tạo bởi Google. Nó cho phép người dùng có thể lưu trữ tập tin trên đám mây, chia sẻ tập tin, và chỉnh sửa tài liệu, văn bản, bảng tính, và bài thuyết trình với cộng tác viên." + }, + "url": "drive.google.com", + "regExp": "drive[.]google([.][a-z]+)+[/]", + "version": "1.6.11", + "logo": "https://cdn.rcd.gg/PreMiD/websites/G/Google%20Drive/assets/logo.png", + "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/Google%20Drive/assets/thumbnail.png", + "color": "#3aa154", + "category": "other", + "tags": [ + "drive", + "google" + ], + "settings": [ + { + "id": "privacy", + "title": "Privacy Mode", + "icon": "fad fa-user-secret", + "value": true + } + ] +} diff --git a/websites/G/Google Drive/presence.ts b/websites/G/Google Drive/presence.ts index 26b1e20a6dfc..2720ef4fe4a0 100644 --- a/websites/G/Google Drive/presence.ts +++ b/websites/G/Google Drive/presence.ts @@ -1,48 +1,59 @@ const presence = new Presence({ - clientId: "630494559956107285", -}); + clientId: '630494559956107285', +}) -presence.on("UpdateData", async () => { - const presenceData: PresenceData = { - largeImageKey: - "https://cdn.rcd.gg/PreMiD/websites/G/Google%20Drive/assets/logo.png", - details: "Viewing page:", - }, - path = document.location.pathname - .toLowerCase() - .replace(/(\/u\/([0-9])+)/g, ""), - privacy = await presence.getSetting("privacy"); +presence.on('UpdateData', async () => { + const presenceData: PresenceData = { + largeImageKey: 'https://cdn.rcd.gg/PreMiD/websites/G/Google%20Drive/assets/logo.png', + details: 'Viewing page:', + } + const path = document.location.pathname + .toLowerCase() + .replace(/(\/u\/(\d)+)/g, '') + const privacy = await presence.getSetting('privacy') - if (path.startsWith("/drive/folders")) { - presenceData.details = "Viewing a folder"; - if (!privacy) - presenceData.state = document.title.replace("- Google Drive", ""); - } else if (path.startsWith("/drive/computer")) - presenceData.state = "Linked computers"; - else if (path.startsWith("/drive/shared-with-me")) - presenceData.state = "Shared files"; - else if (path.startsWith("/drive/recent")) - presenceData.state = "Recently updated files"; - else if (path.startsWith("/drive/starred")) - presenceData.state = "Starred files"; - else if (path.startsWith("/drive/trash")) - presenceData.state = "Deleted files"; - else if (path.startsWith("/drive/backups")) presenceData.state = "Backups"; - else if (path.startsWith("/drive/quota")) - presenceData.state = "Storage quota"; - else if (path.startsWith("/file/")) { - const main = document.title.split("."); - presenceData.details = "Viewing a file"; - if (!privacy) { - presenceData.state = `${ - main.length === 2 ? main[0] : main.slice(0, -1).join("").toString() - }.${main - .slice(-1) - .toString() - .replace("- Google Drive", "") - .toUpperCase()}`; - } - } else presenceData.details = "Browsing..."; + if (path.startsWith('/drive/folders')) { + presenceData.details = 'Viewing a folder' + if (!privacy) + presenceData.state = document.title.replace('- Google Drive', '') + } + else if (path.startsWith('/drive/computer')) { + presenceData.state = 'Linked computers' + } + else if (path.startsWith('/drive/shared-with-me')) { + presenceData.state = 'Shared files' + } + else if (path.startsWith('/drive/recent')) { + presenceData.state = 'Recently updated files' + } + else if (path.startsWith('/drive/starred')) { + presenceData.state = 'Starred files' + } + else if (path.startsWith('/drive/trash')) { + presenceData.state = 'Deleted files' + } + else if (path.startsWith('/drive/backups')) { + presenceData.state = 'Backups' + } + else if (path.startsWith('/drive/quota')) { + presenceData.state = 'Storage quota' + } + else if (path.startsWith('/file/')) { + const main = document.title.split('.') + presenceData.details = 'Viewing a file' + if (!privacy) { + presenceData.state = `${ + main.length === 2 ? main[0] : main.slice(0, -1).join('').toString() + }.${main + .slice(-1) + .toString() + .replace('- Google Drive', '') + .toUpperCase()}` + } + } + else { + presenceData.details = 'Browsing...' + } - presence.setActivity(presenceData); -}); + presence.setActivity(presenceData) +}) diff --git a/websites/G/Google Earth/metadata.json b/websites/G/Google Earth/metadata.json index e2cb7aa4face..338ed82bbd0b 100644 --- a/websites/G/Google Earth/metadata.json +++ b/websites/G/Google Earth/metadata.json @@ -1,25 +1,25 @@ { - "$schema": "https://schemas.premid.app/metadata/1.12", - "apiVersion": 1, - "author": { - "id": "193714715631812608", - "name": "theusaf" - }, - "service": "Google Earth", - "description": { - "en": "Explore worldwide satellite imagery and 3D buildings and terrain for hundreds of cities. Zoom to your house or anywhere else, then dive in for a 360° perspective with Street View. " - }, - "url": "earth.google.com", - "version": "1.0.10", - "logo": "https://cdn.rcd.gg/PreMiD/websites/G/Google%20Earth/assets/logo.png", - "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/Google%20Earth/assets/thumbnail.jpg", - "color": "#255FDB", - "category": "other", - "tags": [ - "3d", - "space", - "explore", - "map", - "satellite" - ] -} \ No newline at end of file + "$schema": "https://schemas.premid.app/metadata/1.12", + "apiVersion": 1, + "author": { + "id": "193714715631812608", + "name": "theusaf" + }, + "service": "Google Earth", + "description": { + "en": "Explore worldwide satellite imagery and 3D buildings and terrain for hundreds of cities. Zoom to your house or anywhere else, then dive in for a 360° perspective with Street View. " + }, + "url": "earth.google.com", + "version": "1.0.10", + "logo": "https://cdn.rcd.gg/PreMiD/websites/G/Google%20Earth/assets/logo.png", + "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/Google%20Earth/assets/thumbnail.jpg", + "color": "#255FDB", + "category": "other", + "tags": [ + "3d", + "space", + "explore", + "map", + "satellite" + ] +} diff --git a/websites/G/Google Earth/presence.ts b/websites/G/Google Earth/presence.ts index 65cd1ab94015..4ebb92fa0d26 100644 --- a/websites/G/Google Earth/presence.ts +++ b/websites/G/Google Earth/presence.ts @@ -1,156 +1,178 @@ const presence = new Presence({ - clientId: "1034133591938060298", - }), - browsingTimestamp = Math.floor(Date.now() / 1000); + clientId: '1034133591938060298', +}) +const browsingTimestamp = Math.floor(Date.now() / 1000) -presence.on("UpdateData", () => { - const presenceData: PresenceData = { - largeImageKey: - "https://cdn.rcd.gg/PreMiD/websites/G/Google%20Earth/assets/logo.png", - startTimestamp: browsingTimestamp, - }, - { pathname } = window.location; +presence.on('UpdateData', () => { + const presenceData: PresenceData = { + largeImageKey: 'https://cdn.rcd.gg/PreMiD/websites/G/Google%20Earth/assets/logo.png', + startTimestamp: browsingTimestamp, + } + const { pathname } = window.location - if (pathname === "/web/") presenceData.details = "Loading"; - else { - const appRoot = document.querySelector("earth-app").shadowRoot, - knowledgeCard = appRoot.querySelector("earth-knowledge-card"), - drawerContainer = appRoot.querySelector("paper-drawer-panel"), - drawerRoot = drawerContainer.querySelector("earth-drawer").shadowRoot, - topToolbarRoot = appRoot.querySelector("earth-top-toolbar").shadowRoot, - imageLightBox = document.querySelector( - "earth-image-lightbox" - ), - voyager = appRoot.querySelector("earth-voyager"), - measurementToolRoot = - drawerContainer.querySelector("earth-measure-tool").shadowRoot, - fullscreenBalloon = appRoot.querySelector( - "earth-balloon-fullscreen" - ); - if ( - pathname.startsWith("/web/search/") && - appRoot - .querySelector("earth-toolbar") - .shadowRoot.querySelector("#search") - .hasAttribute("active") - ) { - presenceData.details = "Searching"; - presenceData.state = drawerRoot - .querySelector("earth-search") - .shadowRoot.querySelector("app-header-layout") - .querySelector("earth-omnibox") - .shadowRoot.querySelector("iron-input > input").value; - } else if (knowledgeCard.getAttribute("hidden") !== "true") { - const mainCardRoot = - knowledgeCard.shadowRoot.querySelector("#top-card").shadowRoot; - presenceData.details = "Looking at a location"; - presenceData.state = `${ - mainCardRoot.querySelector("#title").textContent - } - ${ - mainCardRoot.querySelector("#known-for").textContent - }`; - } else if (knowledgeCard.hasAttribute("expanded")) { - const expandedCartRoot = document - .querySelector("earth-expanded-card") - .shadowRoot.querySelector("app-header-layout") - .querySelector("#card-content"); - presenceData.details = "Viewing more information about a location"; - presenceData.state = `${ - expandedCartRoot.querySelector("#title").textContent - } - ${ - expandedCartRoot.querySelector("#known-for").textContent - }`; - } else { - switch ( - topToolbarRoot - .querySelector("#navigation-action") - .getAttribute("action") - ) { - case "USER_ACTION_NAVIGATION_BACK_VOYAGER_FEED_ITEM": { - presenceData.details = "Viewing a Voyager Feed"; - presenceData.state = - topToolbarRoot.querySelector( - "#toolbar-title" - ).textContent; - break; - } - case "USER_ACTION_NAVIGATION_BACK_PLAY_MODE": { - presenceData.details = "Viewing a project presentation"; - presenceData.state = - topToolbarRoot.querySelector( - "#project-title" - ).textContent; - break; - } - case "USER_ACTION_NAVIGATION_BACK_STREET_VIEW": { - presenceData.details = "Viewing Street View"; - presenceData.state = topToolbarRoot - .querySelector("app-toolbar") - .getAttribute("aria-label"); - break; - } - default: - if (imageLightBox && imageLightBox.style.display !== "none") { - presenceData.details = "Viewing a photo"; - presenceData.largeImageKey = imageLightBox.shadowRoot - .querySelector("#image") - .shadowRoot.querySelector("#sizedImgDiv") - .style.backgroundImage.match(/url\("(.+)"\)/)[1]; - } else if ( - voyager.hasAttribute("enabled") && - voyager.style.display !== "none" - ) - presenceData.details = "Browsing Voyager"; - else if ( - fullscreenBalloon && - fullscreenBalloon.style.display !== "none" - ) - presenceData.details = "Preparing Voyager"; - else if ( - measurementToolRoot - .querySelector("#card") - .getAttribute("hidden") !== "true" - ) { - presenceData.details = "Measuring a distance"; - presenceData.state = - measurementToolRoot.querySelector( - "#formatted-distance" - ).textContent; - } else if ( - appRoot - .querySelector("earth-toolbar") - .shadowRoot.querySelector("#projects") - .hasAttribute("active") - ) { - const root = drawerRoot.querySelector("earth-my-places").shadowRoot, - projectPage = root.querySelector("earth-document-view"), - propertyEditor = root.querySelector("earth-property-editor"); - if (projectPage.getAttribute("hidden") !== "true") { - presenceData.details = "Viewing a project"; - presenceData.state = - projectPage.shadowRoot.querySelector( - "#title" - ).textContent; - } else if (propertyEditor.getAttribute("hidden") !== "true") { - presenceData.details = "Adding something to a project"; - presenceData.state = propertyEditor.shadowRoot - .querySelector("#content-panel") - .shadowRoot.querySelector(".title-input") - .shadowRoot.querySelector("#input").value; - } else presenceData.details = "Browsing their projects"; - } else { - presenceData.details = "Looking at a point on the map"; - presenceData.state = appRoot - .querySelector("earth-view-status") - .shadowRoot.querySelector("#pointer-coordinates") - .textContent.trim(); - } - } - } - } + if (pathname === '/web/') { + presenceData.details = 'Loading' + } + else { + const appRoot = document.querySelector('earth-app')?.shadowRoot + const knowledgeCard = appRoot?.querySelector('earth-knowledge-card') + const drawerContainer = appRoot?.querySelector('paper-drawer-panel') + const drawerRoot = drawerContainer?.querySelector('earth-drawer')?.shadowRoot + const topToolbarRoot = appRoot?.querySelector('earth-top-toolbar')?.shadowRoot + const imageLightBox = document.querySelector( + 'earth-image-lightbox', + ) + const voyager = appRoot?.querySelector('earth-voyager') + const measurementToolRoot = drawerContainer?.querySelector('earth-measure-tool')?.shadowRoot + const fullscreenBalloon = appRoot?.querySelector( + 'earth-balloon-fullscreen', + ) + if ( + pathname.startsWith('/web/search/') + && appRoot + ?.querySelector('earth-toolbar') + ?.shadowRoot + ?.querySelector('#search') + ?.hasAttribute('active') + ) { + presenceData.details = 'Searching' + presenceData.state = drawerRoot + ?.querySelector('earth-search') + ?.shadowRoot + ?.querySelector('app-header-layout') + ?.querySelector('earth-omnibox') + ?.shadowRoot + ?.querySelector('iron-input > input') + ?.value + } + else if (knowledgeCard?.getAttribute('hidden') !== 'true') { + const mainCardRoot = knowledgeCard?.shadowRoot?.querySelector('#top-card')?.shadowRoot + presenceData.details = 'Looking at a location' + presenceData.state = `${ + mainCardRoot?.querySelector('#title')?.textContent + } - ${ + mainCardRoot?.querySelector('#known-for')?.textContent + }` + } + else if (knowledgeCard.hasAttribute('expanded')) { + const expandedCartRoot = document + ?.querySelector('earth-expanded-card') + ?.shadowRoot + ?.querySelector('app-header-layout') + ?.querySelector('#card-content') + presenceData.details = 'Viewing more information about a location' + presenceData.state = `${ + expandedCartRoot?.querySelector('#title')?.textContent + } - ${ + expandedCartRoot?.querySelector('#known-for')?.textContent + }` + } + else { + switch ( + topToolbarRoot + ?.querySelector('#navigation-action') + ?.getAttribute('action') + ) { + case 'USER_ACTION_NAVIGATION_BACK_VOYAGER_FEED_ITEM': { + presenceData.details = 'Viewing a Voyager Feed' + presenceData.state = topToolbarRoot.querySelector( + '#toolbar-title', + )?.textContent + break + } + case 'USER_ACTION_NAVIGATION_BACK_PLAY_MODE': { + presenceData.details = 'Viewing a project presentation' + presenceData.state = topToolbarRoot.querySelector( + '#project-title', + )?.textContent + break + } + case 'USER_ACTION_NAVIGATION_BACK_STREET_VIEW': { + presenceData.details = 'Viewing Street View' + presenceData.state = topToolbarRoot + .querySelector('app-toolbar') + ?.getAttribute('aria-label') + break + } + default: + if (imageLightBox && imageLightBox.style.display !== 'none') { + presenceData.details = 'Viewing a photo' + presenceData.largeImageKey = imageLightBox?.shadowRoot + ?.querySelector('#image') + ?.shadowRoot + ?.querySelector('#sizedImgDiv') + ?.style + ?.backgroundImage + ?.match(/url\("(.+)"\)/)?.[1] + } + else if ( + voyager?.hasAttribute('enabled') + && voyager?.style?.display !== 'none' + ) { + presenceData.details = 'Browsing Voyager' + } + else if ( + fullscreenBalloon + && fullscreenBalloon.style.display !== 'none' + ) { + presenceData.details = 'Preparing Voyager' + } + else if ( + measurementToolRoot + ?.querySelector('#card') + ?.getAttribute('hidden') !== 'true' + ) { + presenceData.details = 'Measuring a distance' + presenceData.state = measurementToolRoot?.querySelector( + '#formatted-distance', + )?.textContent + } + else if ( + appRoot + ?.querySelector('earth-toolbar') + ?.shadowRoot + ?.querySelector('#projects') + ?.hasAttribute('active') + ) { + const root = drawerRoot?.querySelector('earth-my-places')?.shadowRoot + const projectPage = root?.querySelector('earth-document-view') + const propertyEditor = root?.querySelector('earth-property-editor') + if (projectPage?.getAttribute('hidden') !== 'true') { + presenceData.details = 'Viewing a project' + presenceData.state = projectPage?.shadowRoot?.querySelector( + '#title', + )?.textContent + } + else if (propertyEditor?.getAttribute('hidden') !== 'true') { + presenceData.details = 'Adding something to a project' + presenceData.state = propertyEditor?.shadowRoot + ?.querySelector('#content-panel') + ?.shadowRoot + ?.querySelector('.title-input') + ?.shadowRoot + ?.querySelector('#input') + ?.value + } + else { + presenceData.details = 'Browsing their projects' + } + } + else { + presenceData.details = 'Looking at a point on the map' + presenceData.state = appRoot + ?.querySelector('earth-view-status') + ?.shadowRoot + ?.querySelector('#pointer-coordinates') + ?.textContent + ?.trim() + } + } + } + } - presence.info(presenceData.details); + presence.info(presenceData.details) - if (presenceData.details) presence.setActivity(presenceData); - else presence.setActivity(); -}); + if (presenceData.details) + presence.setActivity(presenceData) + else presence.setActivity() +}) diff --git a/websites/G/Google Fonts/metadata.json b/websites/G/Google Fonts/metadata.json index ebce3491295f..58cbc9daabf8 100644 --- a/websites/G/Google Fonts/metadata.json +++ b/websites/G/Google Fonts/metadata.json @@ -1,33 +1,33 @@ { - "$schema": "https://schemas.premid.app/metadata/1.12", - "apiVersion": 1, - "author": { - "name": "Paulé", - "id": "376812375795302402" - }, - "service": "Google Fonts", - "description": { - "en": "Google Fonts is a Google service which provides more than a thousand free licensed font families for Android projects or CSS use.", - "fr": "Google Fonts est un service de Google qui propose plus de mille polices d'écriture gratuites et sous licences libres à disposition de projets Android ou d'applications web (via CSS).", - "nl": "Google Fonts is een Google-service die meer dan duizend gratis gelicentieerde lettertypefamilies biedt voor Android-projecten of CSS-gebruik.", - "vi_VN": "Google Fonts là dịch vụ của Google, cung cấp hơn 1000 bộ phông miễn phí cho các dự án Android và CSS." - }, - "url": "fonts.google.com", - "version": "1.0.26", - "logo": "https://cdn.rcd.gg/PreMiD/websites/G/Google%20Fonts/assets/logo.png", - "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/Google%20Fonts/assets/thumbnail.png", - "color": "#ff5756", - "category": "other", - "tags": [ - "google", - "fonts" - ], - "settings": [ - { - "id": "showButton", - "title": "Show buttons", - "icon": "fas fa-compress-arrows-alt", - "value": true - } - ] -} \ No newline at end of file + "$schema": "https://schemas.premid.app/metadata/1.12", + "apiVersion": 1, + "author": { + "name": "Paulé", + "id": "376812375795302402" + }, + "service": "Google Fonts", + "description": { + "en": "Google Fonts is a Google service which provides more than a thousand free licensed font families for Android projects or CSS use.", + "fr": "Google Fonts est un service de Google qui propose plus de mille polices d'écriture gratuites et sous licences libres à disposition de projets Android ou d'applications web (via CSS).", + "nl": "Google Fonts is een Google-service die meer dan duizend gratis gelicentieerde lettertypefamilies biedt voor Android-projecten of CSS-gebruik.", + "vi_VN": "Google Fonts là dịch vụ của Google, cung cấp hơn 1000 bộ phông miễn phí cho các dự án Android và CSS." + }, + "url": "fonts.google.com", + "version": "1.0.26", + "logo": "https://cdn.rcd.gg/PreMiD/websites/G/Google%20Fonts/assets/logo.png", + "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/Google%20Fonts/assets/thumbnail.png", + "color": "#ff5756", + "category": "other", + "tags": [ + "google", + "fonts" + ], + "settings": [ + { + "id": "showButton", + "title": "Show buttons", + "icon": "fas fa-compress-arrows-alt", + "value": true + } + ] +} diff --git a/websites/G/Google Fonts/presence.ts b/websites/G/Google Fonts/presence.ts index 5643978d13cb..5e32ae43de32 100644 --- a/websites/G/Google Fonts/presence.ts +++ b/websites/G/Google Fonts/presence.ts @@ -1,93 +1,106 @@ const presence = new Presence({ - clientId: "814919836835905566", - }), - tmb = Math.floor(Date.now() / 1000); + clientId: '814919836835905566', +}) +const tmb = Math.floor(Date.now() / 1000) -presence.on("UpdateData", async () => { - const presenceData: PresenceData = { - largeImageKey: - "https://cdn.rcd.gg/PreMiD/websites/G/Google%20Fonts/assets/logo.png", - smallImageKey: - "https://cdn.rcd.gg/PreMiD/websites/G/Google%20Fonts/assets/0.png", - startTimestamp: tmb, - }, - path = document.location.pathname.toLowerCase(), - showButton = await presence.getSetting("showButton"); +presence.on('UpdateData', async () => { + const presenceData: PresenceData = { + largeImageKey: 'https://cdn.rcd.gg/PreMiD/websites/G/Google%20Fonts/assets/logo.png', + smallImageKey: 'https://cdn.rcd.gg/PreMiD/websites/G/Google%20Fonts/assets/0.png', + startTimestamp: tmb, + } + const path = document.location.pathname.toLowerCase() + const showButton = await presence.getSetting('showButton') - if (path === "/") { - const categ = document - .querySelector( - "#main-content > gf-global-toolbar > div.global-toolbar__filters-area > gf-global-filters-row > div > div > gf-toolbar-category-filter > button > span.mat-button-wrapper" - ) - .querySelectorAll(".gf-outlined-menu-button-content")[0].textContent; - if (categ === " Categories ") presenceData.state = "All categories"; - else if (categ.includes("+")) { - presenceData.state = `Categories: ${new URL( - document.location.href - ).searchParams - .get("category") - .replace(/,/gi, ", ")}`; - } else presenceData.state = `Category: ${categ}`; - presenceData.details = "Browsing fonts"; - } else if (path.includes("/specimen")) { - presenceData.details = `Looking at font: ${ - document.querySelector("#main-content > gf-sticky-header > div > h1") - .textContent - }`; - presenceData.state = `Viewing the "${document - .querySelectorAll(".gf-nav__link--active")[0] - .textContent.trim()}" tab`; - if (showButton) { - presenceData.buttons = [ - { - label: "View font", - url: document.URL, - }, - ]; - } - } else if (path === "/featured") - presenceData.details = "Looking at the featured fonts"; - else if (path.includes("/featured/")) { - let featuredFonts; - if (document.querySelectorAll(".gmat-headline-1")[0]) { - featuredFonts = - document.querySelectorAll(".gmat-headline-1")[0].textContent; - } else if (!document.querySelectorAll(".gmat-headline-1")[0]) { - featuredFonts = - document.querySelectorAll(".gmat-headline-4")[0].textContent; - } - presenceData.details = "Looking at a featured font:"; - presenceData.state = featuredFonts; + if (path === '/') { + const categ = document + ?.querySelector( + '#main-content > gf-global-toolbar > div.global-toolbar__filters-area > gf-global-filters-row > div > div > gf-toolbar-category-filter > button > span.mat-button-wrapper', + ) + ?.querySelectorAll('.gf-outlined-menu-button-content')[0] + ?.textContent + if (categ === ' Categories ') { + presenceData.state = 'All categories' + } + else if (categ?.includes('+')) { + presenceData.state = `Categories: ${new URL( + document.location.href, + ).searchParams.get('category')?.replace(/,/g, ', ')}` + } + else { + presenceData.state = `Category: ${categ}` + } + presenceData.details = 'Browsing fonts' + } + else if (path.includes('/specimen')) { + presenceData.details = `Looking at font: ${ + document.querySelector('#main-content > gf-sticky-header > div > h1') + ?.textContent + }` + presenceData.state = `Viewing the "${document + .querySelectorAll('.gf-nav__link--active')[0] + ?.textContent + ?.trim()}" tab` + if (showButton) { + presenceData.buttons = [ + { + label: 'View font', + url: document.URL, + }, + ] + } + } + else if (path === '/featured') { + presenceData.details = 'Looking at the featured fonts' + } + else if (path.includes('/featured/')) { + let featuredFonts + if (document.querySelectorAll('.gmat-headline-1')[0]) { + featuredFonts = document.querySelectorAll('.gmat-headline-1')[0].textContent + } + else if (!document.querySelectorAll('.gmat-headline-1')[0]) { + featuredFonts = document.querySelectorAll('.gmat-headline-4')[0].textContent + } + presenceData.details = 'Looking at a featured font:' + presenceData.state = featuredFonts - if (showButton) { - presenceData.buttons = [ - { - label: "View featured font", - url: document.URL, - }, - ]; - } - } else if (path === "/icons") { - if ( - new URL(document.location.href).searchParams.get("icon.query") === null - ) { - if (document.querySelectorAll(".mdc-chip--selected")[0]) { - presenceData.details = "Browsing Material icons"; // The icons are named "Material icons" like this on the Fonts website - presenceData.state = `Looking at the ${document - .querySelectorAll(".mdc-chip--selected")[0] - .textContent.toLowerCase()} icons`; - } else { - presenceData.details = "Browsing Material icons"; - presenceData.state = "Looking at all icons"; - } - } else { - presenceData.details = "Searching for icons"; - presenceData.state = `Search query: ${new URL( - document.location.href - ).searchParams.get("icon.query")}`; - } - } else if (path === "/about") presenceData.details = "Viewing the about page"; + if (showButton) { + presenceData.buttons = [ + { + label: 'View featured font', + url: document.URL, + }, + ] + } + } + else if (path === '/icons') { + if ( + new URL(document.location.href).searchParams.get('icon.query') === null + ) { + if (document.querySelectorAll('.mdc-chip--selected')[0]) { + presenceData.details = 'Browsing Material icons' // The icons are named "Material icons" like this on the Fonts website + presenceData.state = `Looking at the ${document + .querySelectorAll('.mdc-chip--selected')[0] + ?.textContent + ?.toLowerCase()} icons` + } + else { + presenceData.details = 'Browsing Material icons' + presenceData.state = 'Looking at all icons' + } + } + else { + presenceData.details = 'Searching for icons' + presenceData.state = `Search query: ${new URL( + document.location.href, + ).searchParams.get('icon.query')}` + } + } + else if (path === '/about') { + presenceData.details = 'Viewing the about page' + } - if (presenceData.details) presence.setActivity(presenceData); - else presence.setActivity(); -}); + if (presenceData.details) + presence.setActivity(presenceData) + else presence.setActivity() +}) diff --git a/websites/G/Google Keep/metadata.json b/websites/G/Google Keep/metadata.json index 70bdbb613637..9ed6dec00989 100644 --- a/websites/G/Google Keep/metadata.json +++ b/websites/G/Google Keep/metadata.json @@ -1,38 +1,38 @@ { - "$schema": "https://schemas.premid.app/metadata/1.12", - "apiVersion": 1, - "author": { - "name": "Vasilis", - "id": "241929388403195914" - }, - "contributors": [ - { - "name": "rushia", - "id": "398752205043400724" - } - ], - "service": "Google Keep", - "description": { - "en": "Google Keep is a note-taking service included as part of the free, web-based Google Docs Editors suite offered by Google.", - "vi_VN": "Google Keep là dịch vụ ghi chú, nằm trong bộ Google Docs Editors của Google." - }, - "url": "keep.google.com", - "version": "1.1.14", - "logo": "https://cdn.rcd.gg/PreMiD/websites/G/Google%20Keep/assets/logo.png", - "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/Google%20Keep/assets/thumbnail.png", - "color": "#FFBA00", - "category": "other", - "tags": [ - "notes", - "todo", - "todo-list" - ], - "settings": [ - { - "id": "privacy", - "title": "Privacy Mode", - "icon": "fad fa-user-secret", - "value": false - } - ] -} \ No newline at end of file + "$schema": "https://schemas.premid.app/metadata/1.12", + "apiVersion": 1, + "author": { + "name": "Vasilis", + "id": "241929388403195914" + }, + "contributors": [ + { + "name": "rushia", + "id": "398752205043400724" + } + ], + "service": "Google Keep", + "description": { + "en": "Google Keep is a note-taking service included as part of the free, web-based Google Docs Editors suite offered by Google.", + "vi_VN": "Google Keep là dịch vụ ghi chú, nằm trong bộ Google Docs Editors của Google." + }, + "url": "keep.google.com", + "version": "1.1.14", + "logo": "https://cdn.rcd.gg/PreMiD/websites/G/Google%20Keep/assets/logo.png", + "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/Google%20Keep/assets/thumbnail.png", + "color": "#FFBA00", + "category": "other", + "tags": [ + "notes", + "todo", + "todo-list" + ], + "settings": [ + { + "id": "privacy", + "title": "Privacy Mode", + "icon": "fad fa-user-secret", + "value": false + } + ] +} diff --git a/websites/G/Google Keep/presence.ts b/websites/G/Google Keep/presence.ts index 4d51d556e329..7eb8be909006 100644 --- a/websites/G/Google Keep/presence.ts +++ b/websites/G/Google Keep/presence.ts @@ -1,95 +1,100 @@ const presence = new Presence({ - clientId: "928068375031214170", - }), - timer = Math.floor(Date.now() / 1000); + clientId: '928068375031214170', +}) +const timer = Math.floor(Date.now() / 1000) -presence.on("UpdateData", async () => { - const presenceData: PresenceData = { - largeImageKey: - "https://cdn.rcd.gg/PreMiD/websites/G/Google%20Keep/assets/logo.png", - startTimestamp: timer, - }, - { hash, href } = document.location, - id = href.split("/")[4], - privacy = await presence.getSetting("privacy"); +presence.on('UpdateData', async () => { + const presenceData: PresenceData = { + largeImageKey: 'https://cdn.rcd.gg/PreMiD/websites/G/Google%20Keep/assets/logo.png', + startTimestamp: timer, + } + const { hash, href } = document.location + const id = href.split('/')[4] + const privacy = await presence.getSetting('privacy') - presenceData.details = "Viewing Homepage"; - presenceData.state = "Notes"; + presenceData.details = 'Viewing Homepage' + presenceData.state = 'Notes' - switch (hash) { - case `#LIST/${id}`: { - if (!privacy) { - const listName = - document.querySelector( - "body > div.notes-container.RfDI4d-sKfxWe > div.RfDI4d-Iu19ad > div.RfDI4d-bN97Pc.ogm-kpc > div.gkA7Yd-sKfxWe.ma6Yeb-r8s4j-gkA7Yd > div > div.IZ65Hb-n0tgWb.rymPhb.NYTeh-IT5dJd.RNfche > div.IZ65Hb-TBnied.zTETae-h1U9Be-hxXJme > div.IZ65Hb-s2gQvd > div.IZ65Hb-r4nke-haAclf > div.notranslate.IZ65Hb-YPqjbf.fmcmS-x3Eknd.r4nke-YPqjbf" - ) ?? - document.querySelector( - "body > div.VIpgJd-TUo6Hb.XKSfm-L9AdLc.eo9XGd > div > div.IZ65Hb-TBnied.zTETae-h1U9Be-hxXJme > div.IZ65Hb-s2gQvd > div.IZ65Hb-r4nke-haAclf > div.notranslate.IZ65Hb-YPqjbf.fmcmS-x3Eknd.r4nke-YPqjbf" - ); - presenceData.details = "Reading Tasks:"; - if (listName.textContent) presenceData.state = listName.textContent; - else if (!listName.textContent) presenceData.state = "Untitled List"; - } else { - presenceData.details = "Reading Tasks"; - delete presenceData.state; - } + switch (hash) { + case `#LIST/${id}`: { + if (!privacy) { + const listName = document.querySelector( + 'body > div.notes-container.RfDI4d-sKfxWe > div.RfDI4d-Iu19ad > div.RfDI4d-bN97Pc.ogm-kpc > div.gkA7Yd-sKfxWe.ma6Yeb-r8s4j-gkA7Yd > div > div.IZ65Hb-n0tgWb.rymPhb.NYTeh-IT5dJd.RNfche > div.IZ65Hb-TBnied.zTETae-h1U9Be-hxXJme > div.IZ65Hb-s2gQvd > div.IZ65Hb-r4nke-haAclf > div.notranslate.IZ65Hb-YPqjbf.fmcmS-x3Eknd.r4nke-YPqjbf', + ) + ?? document.querySelector( + 'body > div.VIpgJd-TUo6Hb.XKSfm-L9AdLc.eo9XGd > div > div.IZ65Hb-TBnied.zTETae-h1U9Be-hxXJme > div.IZ65Hb-s2gQvd > div.IZ65Hb-r4nke-haAclf > div.notranslate.IZ65Hb-YPqjbf.fmcmS-x3Eknd.r4nke-YPqjbf', + ) + presenceData.details = 'Reading Tasks:' + if (listName?.textContent) + presenceData.state = listName.textContent + else + presenceData.state = 'Untitled List' + } + else { + presenceData.details = 'Reading Tasks' + delete presenceData.state + } - break; - } - case `#NOTE/${id}`: { - if (!privacy) { - const noteName = document.querySelector( - "body > div.VIpgJd-TUo6Hb.XKSfm-L9AdLc.eo9XGd > div > div.IZ65Hb-TBnied.zTETae-h1U9Be-hxXJme > div.IZ65Hb-s2gQvd > div.IZ65Hb-r4nke-haAclf > div.notranslate.IZ65Hb-YPqjbf.fmcmS-x3Eknd.r4nke-YPqjbf" - ); - presenceData.details = "Reading a Note:"; - if (noteName.textContent) presenceData.state = noteName.textContent; - else if (!noteName.textContent) presenceData.state = "Untitled Note"; - } else { - presenceData.details = "Reading a Note"; - delete presenceData.state; - } + break + } + case `#NOTE/${id}`: { + if (!privacy) { + const noteName = document.querySelector( + 'body > div.VIpgJd-TUo6Hb.XKSfm-L9AdLc.eo9XGd > div > div.IZ65Hb-TBnied.zTETae-h1U9Be-hxXJme > div.IZ65Hb-s2gQvd > div.IZ65Hb-r4nke-haAclf > div.notranslate.IZ65Hb-YPqjbf.fmcmS-x3Eknd.r4nke-YPqjbf', + ) + presenceData.details = 'Reading a Note:' + if (noteName?.textContent) + presenceData.state = noteName.textContent + else + presenceData.state = 'Untitled Note' + } + else { + presenceData.details = 'Reading a Note' + delete presenceData.state + } - break; - } - case "#search": - case `#search/${id}`: { - presenceData.details = "Search"; - delete presenceData.state; + break + } + case '#search': + case `#search/${id}`: { + presenceData.details = 'Search' + delete presenceData.state - break; - } - case "#reminders": { - presenceData.details = "Viewing reminders"; - delete presenceData.state; + break + } + case '#reminders': { + presenceData.details = 'Viewing reminders' + delete presenceData.state - break; - } - case `#label/${id}`: { - if (!privacy) { - presenceData.details = "Viewing a label:"; - presenceData.state = decodeURIComponent(id); - } else { - presenceData.details = "Viewing a label"; - delete presenceData.state; - } + break + } + case `#label/${id}`: { + if (!privacy) { + presenceData.details = 'Viewing a label:' + presenceData.state = decodeURIComponent(id) + } + else { + presenceData.details = 'Viewing a label' + delete presenceData.state + } - break; - } - case "#archive": { - presenceData.details = "Viewing the archive"; - delete presenceData.state; + break + } + case '#archive': { + presenceData.details = 'Viewing the archive' + delete presenceData.state - break; - } - case "#trash": { - presenceData.details = "Viewing the trash"; - delete presenceData.state; + break + } + case '#trash': { + presenceData.details = 'Viewing the trash' + delete presenceData.state - break; - } - // No default - } + break + } + } - if (!presenceData.details) presence.setActivity(); - else presence.setActivity(presenceData); -}); + if (!presenceData.details) + presence.setActivity() + else presence.setActivity(presenceData) +}) diff --git a/websites/G/Google Maps/metadata.json b/websites/G/Google Maps/metadata.json index 57fed605a6ac..9772e68edf0c 100644 --- a/websites/G/Google Maps/metadata.json +++ b/websites/G/Google Maps/metadata.json @@ -1,31 +1,31 @@ { - "$schema": "https://schemas.premid.app/metadata/1.12", - "apiVersion": 1, - "author": { - "name": "Tofuine", - "id": "734631480541708291" - }, - "service": "Google Maps", - "description": { - "en": "Google Maps is a web mapping platform and consumer application offered by Google. It offers satellite imagery, aerial photography, street maps, 360° interactive panoramic views of streets, real-time traffic conditions, and route planning for traveling by foot, car, bike, air and public transportation." - }, - "url": "www.google.com", - "regExp": "www\\.google\\.com\\/maps", - "version": "1.0.9", - "logo": "https://cdn.rcd.gg/PreMiD/websites/G/Google%20Maps/assets/logo.png", - "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/Google%20Maps/assets/thumbnail.png", - "color": "#4e85f2", - "category": "other", - "tags": [ - "maps", - "navigation" - ], - "settings": [ - { - "id": "privacy", - "title": "Privacy Mode", - "icon": "fad fa-user-secret", - "value": true - } - ] -} \ No newline at end of file + "$schema": "https://schemas.premid.app/metadata/1.12", + "apiVersion": 1, + "author": { + "name": "Tofuine", + "id": "734631480541708291" + }, + "service": "Google Maps", + "description": { + "en": "Google Maps is a web mapping platform and consumer application offered by Google. It offers satellite imagery, aerial photography, street maps, 360° interactive panoramic views of streets, real-time traffic conditions, and route planning for traveling by foot, car, bike, air and public transportation." + }, + "url": "maps.google.com", + "regExp": "www\\.google\\.com\\/maps", + "version": "1.0.9", + "logo": "https://cdn.rcd.gg/PreMiD/websites/G/Google%20Maps/assets/logo.png", + "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/Google%20Maps/assets/thumbnail.png", + "color": "#4e85f2", + "category": "other", + "tags": [ + "maps", + "navigation" + ], + "settings": [ + { + "id": "privacy", + "title": "Privacy Mode", + "icon": "fad fa-user-secret", + "value": true + } + ] +} diff --git a/websites/G/Google Maps/presence.ts b/websites/G/Google Maps/presence.ts index abf8c0c4dd78..d642d4f83be4 100644 --- a/websites/G/Google Maps/presence.ts +++ b/websites/G/Google Maps/presence.ts @@ -1,72 +1,87 @@ const presence = new Presence({ - clientId: "993496501886136371", - }), - browsingTimestamp = Math.floor(Date.now() / 1000); + clientId: '993496501886136371', +}) +const browsingTimestamp = Math.floor(Date.now() / 1000) function lettersOnly(str: string) { - return str.replace(/[^a-zA-Z]/g, " "); + return str.replace(/[^a-z]/gi, ' ') } -presence.on("UpdateData", async () => { - const privacy = await presence.getSetting("privacy"), - presenceData: PresenceData = { - largeImageKey: - "https://cdn.rcd.gg/PreMiD/websites/G/Google%20Maps/assets/logo.png", - startTimestamp: browsingTimestamp, - }; - if (document.location.pathname.includes("/place")) { - if (privacy) presenceData.details = "Viewing a place"; - else { - const place = document.location.href, - indexes = []; - for (const [index, element] of Array.from(place).entries()) - if (element === "/") indexes.push(index); +presence.on('UpdateData', async () => { + const privacy = await presence.getSetting('privacy') + const presenceData: PresenceData = { + largeImageKey: 'https://cdn.rcd.gg/PreMiD/websites/G/Google%20Maps/assets/logo.png', + startTimestamp: browsingTimestamp, + } + if (document.location.pathname.includes('/place')) { + if (privacy) { + presenceData.details = 'Viewing a place' + } + else { + const place = document.location.href + const indexes = [] + for (const [index, element] of Array.from(place).entries()) { + if (element === '/') + indexes.push(index) + } - presenceData.details = `Viewing ${lettersOnly( - place.substring(indexes[4] + 1, indexes[5]) - )}`; - presenceData.buttons = [ - { label: "View Place", url: document.location.href }, - ]; - } - } else if (document.location.pathname.includes("/dir")) { - if (privacy) presenceData.details = "Viewing directions to a location"; - else { - presenceData.details = "Viewing directions"; - let from, destination; - if (!document.querySelector("#sb_ifc50 > input")) { - from = document - .querySelector("#sb_ifc51 > input") - .getAttribute("aria-label"); - destination = document - .querySelector("#sb_ifc52 > input") - .getAttribute("aria-label"); - } else { - from = document - .querySelector("#sb_ifc50 > input") - .getAttribute("aria-label"); - destination = document - .querySelector("#sb_ifc51 > input") - .getAttribute("aria-label"); - } - presenceData.state = `${from}, ${destination}`; - presenceData.buttons = [ - { label: "View Directions", url: document.location.href }, - ]; - } - } else if (document.location.pathname.includes("/search")) { - if (privacy) presenceData.details = "Searching for a place"; - else { - const search = document.location.href, - indexes = []; - for (const [index, element] of Array.from(search).entries()) - if (element === "/") indexes.push(index); + presenceData.details = `Viewing ${lettersOnly( + place.substring(indexes[4] + 1, indexes[5]), + )}` + presenceData.buttons = [ + { label: 'View Place', url: document.location.href }, + ] + } + } + else if (document.location.pathname.includes('/dir')) { + if (privacy) { + presenceData.details = 'Viewing directions to a location' + } + else { + presenceData.details = 'Viewing directions' + let from, destination + if (!document.querySelector('#sb_ifc50 > input')) { + from = document + .querySelector('#sb_ifc51 > input') + ?.getAttribute('aria-label') + destination = document + .querySelector('#sb_ifc52 > input') + ?.getAttribute('aria-label') + } + else { + from = document + .querySelector('#sb_ifc50 > input') + ?.getAttribute('aria-label') + destination = document + .querySelector('#sb_ifc51 > input') + ?.getAttribute('aria-label') + } + presenceData.state = `${from}, ${destination}` + presenceData.buttons = [ + { label: 'View Directions', url: document.location.href }, + ] + } + } + else if (document.location.pathname.includes('/search')) { + if (privacy) { + presenceData.details = 'Searching for a place' + } + else { + const search = document.location.href + const indexes = [] + for (const [index, element] of Array.from(search).entries()) { + if (element === '/') + indexes.push(index) + } - presenceData.details = `Searching for ${lettersOnly( - search.substring(indexes[4] + 1, indexes[5]) - )}`; - } - } else presenceData.details = "Viewing map"; + presenceData.details = `Searching for ${lettersOnly( + search.substring(indexes[4] + 1, indexes[5]), + )}` + } + } + else { + presenceData.details = 'Viewing map' + } - presence.setActivity(presenceData); -}); + presence.setActivity(presenceData) +}) diff --git a/websites/G/Google Meet/metadata.json b/websites/G/Google Meet/metadata.json index cd0bb57e2c06..ff00be164395 100644 --- a/websites/G/Google Meet/metadata.json +++ b/websites/G/Google Meet/metadata.json @@ -1,65 +1,65 @@ { - "$schema": "https://schemas.premid.app/metadata/1.12", - "apiVersion": 1, - "author": { - "name": "Drull", - "id": "244953147154366464" - }, - "service": "Google Meet", - "description": { - "en": " Google Meet is a communication platform, developed by Google, which includes instant messaging, video chat, SMS and VOIP.", - "pt_BR": "Google Meet é uma plataforma de comunicação, desenvolvida pela Google, que inclui mensagens instantâneas, chat de vídeo, SMS e VOIP.", - "nl": "Google Meet is een communicatieplatform ontwikkeld door Google en heeft de mogelijkheid om te chatten, te (video)bellen en te sms'en.", - "vi_VN": "Google Meet là một dịch vụ liên lạc qua video do Google phát triển." - }, - "url": "meet.google.com", - "regExp": "meet[.]google([.][a-z]+)+[/]", - "version": "1.3.2", - "logo": "https://cdn.rcd.gg/PreMiD/websites/G/Google%20Meet/assets/logo.png", - "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/Google%20Meet/assets/thumbnail.png", - "color": "#308574", - "category": "socials", - "tags": [ - "google", - "meet", - "video" - ], - "settings": [ - { - "id": "usePresenceName", - "title": "Show Title as Presence", - "icon": "fad fa-user-edit", - "value": false - }, - { - "id": "hideInviteCode", - "title": "Hide invite code from showing", - "icon": "fas fa-user-secret", - "value": true - }, - { - "id": "meetTitle", - "if": { - "usePresenceName": true - }, - "title": "Meeting Title row 0", - "icon": "fas fa-comment-alt-edit", - "value": "%meettime% %meettitle%", - "placeholder": "Use %meettime%, %meettitle%, %meetpeople%" - }, - { - "id": "meetDetail", - "title": "Meeting Details row 1", - "icon": "fas fa-comment-alt-edit", - "value": "%meettime% %meettitle%", - "placeholder": "Use %meettime%, %meettitle%, %meetpeople%" - }, - { - "id": "meetState", - "title": "Meeting State row 2", - "icon": "fas fa-comment-alt-edit", - "value": "%meetpeople%", - "placeholder": "Use %meettime%, %meettitle%, %meetpeople%" - } - ] -} \ No newline at end of file + "$schema": "https://schemas.premid.app/metadata/1.12", + "apiVersion": 1, + "author": { + "name": "Drull", + "id": "244953147154366464" + }, + "service": "Google Meet", + "description": { + "en": " Google Meet is a communication platform, developed by Google, which includes instant messaging, video chat, SMS and VOIP.", + "pt_BR": "Google Meet é uma plataforma de comunicação, desenvolvida pela Google, que inclui mensagens instantâneas, chat de vídeo, SMS e VOIP.", + "nl": "Google Meet is een communicatieplatform ontwikkeld door Google en heeft de mogelijkheid om te chatten, te (video)bellen en te sms'en.", + "vi_VN": "Google Meet là một dịch vụ liên lạc qua video do Google phát triển." + }, + "url": "meet.google.com", + "regExp": "meet[.]google([.][a-z]+)+[/]", + "version": "1.3.2", + "logo": "https://cdn.rcd.gg/PreMiD/websites/G/Google%20Meet/assets/logo.png", + "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/Google%20Meet/assets/thumbnail.png", + "color": "#308574", + "category": "socials", + "tags": [ + "google", + "meet", + "video" + ], + "settings": [ + { + "id": "usePresenceName", + "title": "Show Title as Presence", + "icon": "fad fa-user-edit", + "value": false + }, + { + "id": "hideInviteCode", + "title": "Hide invite code from showing", + "icon": "fas fa-user-secret", + "value": true + }, + { + "id": "meetTitle", + "if": { + "usePresenceName": true + }, + "title": "Meeting Title row 0", + "icon": "fas fa-comment-alt-edit", + "value": "%meettime% %meettitle%", + "placeholder": "Use %meettime%, %meettitle%, %meetpeople%" + }, + { + "id": "meetDetail", + "title": "Meeting Details row 1", + "icon": "fas fa-comment-alt-edit", + "value": "%meettime% %meettitle%", + "placeholder": "Use %meettime%, %meettitle%, %meetpeople%" + }, + { + "id": "meetState", + "title": "Meeting State row 2", + "icon": "fas fa-comment-alt-edit", + "value": "%meetpeople%", + "placeholder": "Use %meettime%, %meettitle%, %meetpeople%" + } + ] +} diff --git a/websites/G/Google Meet/presence.ts b/websites/G/Google Meet/presence.ts index 4c7871d98f04..5646faf57249 100644 --- a/websites/G/Google Meet/presence.ts +++ b/websites/G/Google Meet/presence.ts @@ -1,150 +1,159 @@ const presence = new Presence({ - clientId: "701914032541794386", - }), - browsingTimestamp = Math.floor(Date.now() / 1000); + clientId: '701914032541794386', +}) +const browsingTimestamp = Math.floor(Date.now() / 1000) function capitalizeFirstLetter(string: string) { - if (string) { - return ( - string.trim().charAt(0).toUpperCase() + - string.trim().slice(1).toLowerCase() - ); - } + if (string) { + return ( + string.trim().charAt(0).toUpperCase() + + string.trim().slice(1).toLowerCase() + ) + } +} +let oldURL: string +let pdCache = { + name: '', + details: '', + state: '', + meetTitle: '', + meetDetails: '', + meetState: '', } -let oldURL: string, - pdCache = { - name: "", - details: "", - state: "", - meetTitle: "", - meetDetails: "", - meetState: "", - }; function replacePlaceholders( - original: string, - mTime: string, - mTitle: string, - mPeople: string + original: string, + mTime: string, + mTitle: string, + mPeople: string, ) { - if (!original) return ""; - - let tempString = original; - - if (mTime) tempString = tempString.replace("%meettime%", `| time: ${mTime}`); - else tempString = tempString.replace("%meettime%", ""); - - if (mTitle) - tempString = tempString.replace("%meettitle%", `| title: ${mTitle}`); - else tempString = tempString.replace("%meettitle%", ""); - - if (mPeople) { - tempString = tempString.replace( - "%meetpeople%", - `| amount of attendants: ${mPeople}` - ); - } else tempString = tempString.replace("%meetpeople%", ""); - - if (!tempString) return ""; - else if (tempString?.toLowerCase()?.includes("ready to join?")) return ""; - else if (tempString.at(0) === "|") - tempString = capitalizeFirstLetter(tempString.slice(2)); - else if (tempString.at(1) === "|") - tempString = capitalizeFirstLetter(tempString.slice(3)); - else tempString = capitalizeFirstLetter(tempString); - - return tempString; + if (!original) + return '' + + let tempString: string | undefined = original + + if (mTime) + tempString = tempString.replace('%meettime%', `| time: ${mTime}`) + else tempString = tempString.replace('%meettime%', '') + + if (mTitle) + tempString = tempString.replace('%meettitle%', `| title: ${mTitle}`) + else tempString = tempString.replace('%meettitle%', '') + + if (mPeople) { + tempString = tempString.replace( + '%meetpeople%', + `| amount of attendants: ${mPeople}`, + ) + } + else { + tempString = tempString.replace('%meetpeople%', '') + } + + if (!tempString) + return '' + else if (tempString?.toLowerCase()?.includes('ready to join?')) + return '' + else if (tempString.at(0) === '|') + tempString = capitalizeFirstLetter(tempString.slice(2)) + else if (tempString.at(1) === '|') + tempString = capitalizeFirstLetter(tempString.slice(3)) + else tempString = capitalizeFirstLetter(tempString) + + return tempString } -presence.on("UpdateData", async () => { - const presenceData: PresenceData = { - largeImageKey: - "https://cdn.rcd.gg/PreMiD/websites/G/Google%20Meet/assets/logo.png", - startTimestamp: browsingTimestamp, - }, - [ - usePresenceName, - hideInviteCode, - presenceName, - presenceDetail, - presenceState, - ] = await Promise.all([ - presence.getSetting("usePresenceName"), - presence.getSetting("hideInviteCode"), - presence.getSetting("meetTitle"), - presence.getSetting("meetDetail"), - presence.getSetting("meetState"), - ]), - { href, pathname } = document.location; - - if (pathname.toLowerCase() === "/") { - presenceData.details = "Initial page"; - presenceData.state = "Just waiting"; - return presence.setActivity(presenceData); - } - - let meetTitle = document.querySelector(".lefKC")?.textContent; - - const meetTime = document.querySelector('[jsname="W5i7Bf"]')?.textContent, - meetPeople = document.querySelector(".uGOf1d")?.textContent; - - if ((!meetTitle || !meetTitle?.includes(":") || !meetPeople) && !meetTime) { - presenceData.details = "Waiting for the meeting to start."; - presence.setActivity(presenceData); - return; - } - if ( - href !== oldURL || // If no href - !pdCache?.details || // If no cached details - pdCache?.meetDetails !== presenceDetail || // If cached presence setting details !== current presence setting details - pdCache?.meetState !== presenceState || // If cached presence setting state !== current presence setting state - (usePresenceName && pdCache.meetTitle !== presenceName) // If use presenceName && cached presence setting name !== current presence setting name - ) { - meetTitle = meetTitle?.replace(/([0-9]{2}:[0-9]{2})( )?((am)|(pm))?/gm, ""); - if ( - meetTitle?.toLowerCase()?.match(/[a-z]{3}-[a-z]{4}-[a-z]{3}/gm)?.[0] && - hideInviteCode - ) - // If the invitecode is in the title & the don't show invite code setting is enabled - meetTitle = "Secret"; - - presenceData.details = replacePlaceholders( - presenceDetail, - meetTime, - meetTitle, - meetPeople - ); - - presenceData.state = replacePlaceholders( - presenceState, - meetTime, - meetTitle, - meetPeople - ); - - oldURL = href; - - if (usePresenceName) { - presenceData.name = replacePlaceholders( - presenceName, - meetTime, - meetTitle, - meetPeople - ); - } - pdCache = { - name: presenceData?.name ?? "", - details: presenceData?.details, - state: presenceData?.state, - meetTitle: presenceName ?? "", - meetDetails: presenceDetail ?? "", - meetState: presenceState ?? "", - }; - } else if (pdCache?.details) { - if (usePresenceName) presenceData.name = pdCache.name; - presenceData.details = pdCache.details; - presenceData.state = pdCache.state; - } - - presence.setActivity(presenceData); -}); +presence.on('UpdateData', async () => { + const presenceData: PresenceData = { + largeImageKey: 'https://cdn.rcd.gg/PreMiD/websites/G/Google%20Meet/assets/logo.png', + startTimestamp: browsingTimestamp, + } + const [ + usePresenceName, + hideInviteCode, + presenceName, + presenceDetail, + presenceState, + ] = await Promise.all([ + presence.getSetting('usePresenceName'), + presence.getSetting('hideInviteCode'), + presence.getSetting('meetTitle'), + presence.getSetting('meetDetail'), + presence.getSetting('meetState'), + ]) + const { href, pathname } = document.location + + if (pathname.toLowerCase() === '/') { + presenceData.details = 'Initial page' + presenceData.state = 'Just waiting' + return presence.setActivity(presenceData) + } + + let meetTitle = document.querySelector('.lefKC')?.textContent + + const meetTime = document.querySelector('[jsname="W5i7Bf"]')?.textContent + const meetPeople = document.querySelector('.uGOf1d')?.textContent + + if ((!meetTitle || !meetTitle?.includes(':') || !meetPeople) && !meetTime) { + presenceData.details = 'Waiting for the meeting to start.' + presence.setActivity(presenceData) + return + } + if ( + href !== oldURL // If no href + || !pdCache?.details // If no cached details + || pdCache?.meetDetails !== presenceDetail // If cached presence setting details !== current presence setting details + || pdCache?.meetState !== presenceState // If cached presence setting state !== current presence setting state + || (usePresenceName && pdCache.meetTitle !== presenceName) // If use presenceName && cached presence setting name !== current presence setting name + ) { + meetTitle = meetTitle?.replace(/(\d{2}:\d{2})( )?((am)|(pm))?/g, '') + if ( + meetTitle?.toLowerCase()?.match(/[a-z]{3}-[a-z]{4}-[a-z]{3}/g)?.[0] + && hideInviteCode + ) { + // If the invitecode is in the title & the don't show invite code setting is enabled + meetTitle = 'Secret' + } + + presenceData.details = replacePlaceholders( + presenceDetail, + meetTime ?? '', + meetTitle ?? '', + meetPeople ?? '', + ) + + presenceData.state = replacePlaceholders( + presenceState, + meetTime ?? '', + meetTitle ?? '', + meetPeople ?? '', + ) + + oldURL = href + + if (usePresenceName) { + presenceData.name = replacePlaceholders( + presenceName, + meetTime ?? '', + meetTitle ?? '', + meetPeople ?? '', + ) + } + pdCache = { + name: presenceData?.name ?? '', + details: presenceData?.details ?? '', + state: presenceData?.state ?? '', + meetTitle: presenceName ?? '', + meetDetails: presenceDetail ?? '', + meetState: presenceState ?? '', + } + } + else if (pdCache?.details) { + if (usePresenceName) + presenceData.name = pdCache.name + presenceData.details = pdCache.details + presenceData.state = pdCache.state + } + + presence.setActivity(presenceData) +}) diff --git a/websites/G/Google Messages/metadata.json b/websites/G/Google Messages/metadata.json index 9032b55c72ae..e72385507034 100644 --- a/websites/G/Google Messages/metadata.json +++ b/websites/G/Google Messages/metadata.json @@ -1,32 +1,32 @@ { - "$schema": "https://schemas.premid.app/metadata/1.12", - "apiVersion": 1, - "author": { - "name": "Paulé", - "id": "376812375795302402" - }, - "service": "Google Messages", - "description": { - "en": "Google Messages is a simple, helpful messaging app that keeps you connected with the people who matter most. Text anyone from anywhere across devices.", - "nl": "Google Berichten is een eenvoudige, handige berichten-app waarmee u in contact blijft met de mensen die er het meest toe doen. Sms iedereen overal en op verschillende apparaten.", - "vi_VN": "Google Messages là ứng dụng nhắn tin đơn giản giúp bạn kết nối với những người quan trong nhất. Nhắn tin cho bất kì ai từ mọi nơi xuyên các thiết bị." - }, - "url": "messages.google.com", - "version": "1.0.24", - "logo": "https://cdn.rcd.gg/PreMiD/websites/G/Google%20Messages/assets/logo.png", - "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/Google%20Messages/assets/thumbnail.jpg", - "color": "#1a73e8", - "category": "socials", - "tags": [ - "google", - "message" - ], - "settings": [ - { - "id": "showContact", - "title": "Show contacts name", - "icon": "fas fa-user-friends", - "value": false - } - ] -} \ No newline at end of file + "$schema": "https://schemas.premid.app/metadata/1.12", + "apiVersion": 1, + "author": { + "name": "Paulé", + "id": "376812375795302402" + }, + "service": "Google Messages", + "description": { + "en": "Google Messages is a simple, helpful messaging app that keeps you connected with the people who matter most. Text anyone from anywhere across devices.", + "nl": "Google Berichten is een eenvoudige, handige berichten-app waarmee u in contact blijft met de mensen die er het meest toe doen. Sms iedereen overal en op verschillende apparaten.", + "vi_VN": "Google Messages là ứng dụng nhắn tin đơn giản giúp bạn kết nối với những người quan trong nhất. Nhắn tin cho bất kì ai từ mọi nơi xuyên các thiết bị." + }, + "url": "messages.google.com", + "version": "1.0.24", + "logo": "https://cdn.rcd.gg/PreMiD/websites/G/Google%20Messages/assets/logo.png", + "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/Google%20Messages/assets/thumbnail.jpg", + "color": "#1a73e8", + "category": "socials", + "tags": [ + "google", + "message" + ], + "settings": [ + { + "id": "showContact", + "title": "Show contacts name", + "icon": "fas fa-user-friends", + "value": false + } + ] +} diff --git a/websites/G/Google Messages/presence.ts b/websites/G/Google Messages/presence.ts index 7a070dae219c..1e4191390f9d 100644 --- a/websites/G/Google Messages/presence.ts +++ b/websites/G/Google Messages/presence.ts @@ -1,58 +1,59 @@ const presence = new Presence({ - clientId: "809898713996066827", - }), - tmb = Math.floor(Date.now() / 1000); + clientId: '809898713996066827', +}) +const tmb = Math.floor(Date.now() / 1000) -presence.on("UpdateData", async () => { - const presenceData: PresenceData = { - smallImageKey: - "https://cdn.rcd.gg/PreMiD/websites/G/Google%20Messages/assets/0.png", - smallImageText: "Google", - startTimestamp: tmb, - }, - path = document.location.pathname.toLowerCase(), - showcon = await presence.getSetting("showContact"); - // Home Page - if (path === "/" || path.includes("/intl/")) { - presenceData.largeImageKey = - "https://cdn.rcd.gg/PreMiD/websites/G/Google%20Messages/assets/logo.png"; - presenceData.details = "Home page"; - } else if (path === "/web/authentication") { - presenceData.largeImageKey = - "https://cdn.rcd.gg/PreMiD/websites/G/Google%20Messages/assets/logo.png"; - presenceData.details = "Authentication page"; - } else if (path === "/web/conversations") { - presenceData.details = "Browsing conversations"; - presenceData.largeImageKey = - "https://cdn.rcd.gg/PreMiD/websites/G/Google%20Messages/assets/logo.png"; - } else if ( - path.includes("/web/conversations/") && - path !== "/web/conversations/new" - ) { - // checking parameters - if (!showcon) - presenceData.state = "Hidden (adjustable in Presence settings)"; - else { - presenceData.state = document - .querySelectorAll(".title-container")[0] - .querySelector("div > span > h2").textContent; - } - presenceData.details = "Reading messages from:"; - presenceData.largeImageKey = - "https://cdn.rcd.gg/PreMiD/websites/G/Google%20Messages/assets/logo.png"; - } else if (path === "/web/conversations/new") { - presenceData.largeImageKey = - "https://cdn.rcd.gg/PreMiD/websites/G/Google%20Messages/assets/logo.png"; - presenceData.details = "New conversation page"; - } else if (path === "/web/settings") { - presenceData.largeImageKey = - "https://cdn.rcd.gg/PreMiD/websites/G/Google%20Messages/assets/logo.png"; - presenceData.details = "Browsing settings"; - } else { - presenceData.largeImageKey = - "https://cdn.rcd.gg/PreMiD/websites/G/Google%20Messages/assets/logo.png"; - presenceData.details = "Browsing on Google Messages"; - } - if (presenceData.details) presence.setActivity(presenceData); - else presence.setActivity(); -}); +presence.on('UpdateData', async () => { + const presenceData: PresenceData = { + smallImageKey: 'https://cdn.rcd.gg/PreMiD/websites/G/Google%20Messages/assets/0.png', + smallImageText: 'Google', + startTimestamp: tmb, + } + const path = document.location.pathname.toLowerCase() + const showcon = await presence.getSetting('showContact') + // Home Page + if (path === '/' || path.includes('/intl/')) { + presenceData.largeImageKey = 'https://cdn.rcd.gg/PreMiD/websites/G/Google%20Messages/assets/logo.png' + presenceData.details = 'Home page' + } + else if (path === '/web/authentication') { + presenceData.largeImageKey = 'https://cdn.rcd.gg/PreMiD/websites/G/Google%20Messages/assets/logo.png' + presenceData.details = 'Authentication page' + } + else if (path === '/web/conversations') { + presenceData.details = 'Browsing conversations' + presenceData.largeImageKey = 'https://cdn.rcd.gg/PreMiD/websites/G/Google%20Messages/assets/logo.png' + } + else if ( + path.includes('/web/conversations/') + && path !== '/web/conversations/new' + ) { + // checking parameters + if (!showcon) { + presenceData.state = 'Hidden (adjustable in Presence settings)' + } + else { + presenceData.state = document + .querySelectorAll('.title-container')[0] + ?.querySelector('div > span > h2') + ?.textContent + } + presenceData.details = 'Reading messages from:' + presenceData.largeImageKey = 'https://cdn.rcd.gg/PreMiD/websites/G/Google%20Messages/assets/logo.png' + } + else if (path === '/web/conversations/new') { + presenceData.largeImageKey = 'https://cdn.rcd.gg/PreMiD/websites/G/Google%20Messages/assets/logo.png' + presenceData.details = 'New conversation page' + } + else if (path === '/web/settings') { + presenceData.largeImageKey = 'https://cdn.rcd.gg/PreMiD/websites/G/Google%20Messages/assets/logo.png' + presenceData.details = 'Browsing settings' + } + else { + presenceData.largeImageKey = 'https://cdn.rcd.gg/PreMiD/websites/G/Google%20Messages/assets/logo.png' + presenceData.details = 'Browsing on Google Messages' + } + if (presenceData.details) + presence.setActivity(presenceData) + else presence.setActivity() +}) diff --git a/websites/G/Google Photos/metadata.json b/websites/G/Google Photos/metadata.json index 28b0663f4ac6..9bee9864f4f0 100644 --- a/websites/G/Google Photos/metadata.json +++ b/websites/G/Google Photos/metadata.json @@ -1,35 +1,35 @@ { - "$schema": "https://schemas.premid.app/metadata/1.12", - "apiVersion": 1, - "author": { - "name": "Kyrie", - "id": "368399721494216706" - }, - "service": "Google Photos", - "description": { - "en": "Google Photos is the home for all your photos and videos, automatically organized and easy to share.", - "vi_VN": "Google Photos là nơi cho tất cả các bức ảnh và video của bạn, được tự động sắp xếp và dễ dàng chia sẻ" - }, - "url": "photos.google.com", - "version": "1.0.14", - "logo": "https://cdn.rcd.gg/PreMiD/websites/G/Google%20Photos/assets/logo.png", - "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/Google%20Photos/assets/thumbnail.jpg", - "color": "#FFFFFF", - "category": "socials", - "tags": [ - "google", - "photos", - "images", - "videos", - "storage", - "share" - ], - "settings": [ - { - "id": "albumname", - "title": "Show Album Name", - "icon": "fas fa-images", - "value": false - } - ] -} \ No newline at end of file + "$schema": "https://schemas.premid.app/metadata/1.12", + "apiVersion": 1, + "author": { + "name": "Kyrie", + "id": "368399721494216706" + }, + "service": "Google Photos", + "description": { + "en": "Google Photos is the home for all your photos and videos, automatically organized and easy to share.", + "vi_VN": "Google Photos là nơi cho tất cả các bức ảnh và video của bạn, được tự động sắp xếp và dễ dàng chia sẻ" + }, + "url": "photos.google.com", + "version": "1.0.14", + "logo": "https://cdn.rcd.gg/PreMiD/websites/G/Google%20Photos/assets/logo.png", + "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/Google%20Photos/assets/thumbnail.jpg", + "color": "#FFFFFF", + "category": "socials", + "tags": [ + "google", + "photos", + "images", + "videos", + "storage", + "share" + ], + "settings": [ + { + "id": "albumname", + "title": "Show Album Name", + "icon": "fas fa-images", + "value": false + } + ] +} diff --git a/websites/G/Google Photos/presence.ts b/websites/G/Google Photos/presence.ts index 036073c5c268..136991ad4ccc 100644 --- a/websites/G/Google Photos/presence.ts +++ b/websites/G/Google Photos/presence.ts @@ -1,31 +1,38 @@ const presence = new Presence({ - clientId: "925204937225416704", - }), - browsingTimestamp = Math.floor(Date.now() / 1000); + clientId: '925204937225416704', +}) +const browsingTimestamp = Math.floor(Date.now() / 1000) -presence.on("UpdateData", async () => { - const presenceData: PresenceData = { - largeImageKey: - "https://cdn.rcd.gg/PreMiD/websites/G/Google%20Photos/assets/logo.png", - startTimestamp: browsingTimestamp, - }, - path = document.location.pathname; - if (path === "" || path === "/") presenceData.details = "Browsing photos"; - else if (path.startsWith("/memory")) { - presenceData.details = "Playing back a memory:"; - [presenceData.state] = document.title.split(/-/, 1); - } else if (path.includes("/photo")) presenceData.details = "Viewing a photo"; - else if (path.startsWith("/search")) { - presenceData.details = "Searching for:"; - [presenceData.state] = document.title.split(/-/, 1); - } else if (path === "/albums") presenceData.details = "Browsing albums"; - else if (path.startsWith("/album")) { - presenceData.details = "Viewing an album"; - { - if (await presence.getSetting("albumname")) - [presenceData.state] = document.title.split(/-/, 1); - } - } else if (path.startsWith("/archive")) - presenceData.details = "Viewing the archive"; - presence.setActivity(presenceData); -}); +presence.on('UpdateData', async () => { + const presenceData: PresenceData = { + largeImageKey: 'https://cdn.rcd.gg/PreMiD/websites/G/Google%20Photos/assets/logo.png', + startTimestamp: browsingTimestamp, + } + const path = document.location.pathname + if (path === '' || path === '/') { + presenceData.details = 'Browsing photos' + } + else if (path.startsWith('/memory')) { + presenceData.details = 'Playing back a memory:'; + [presenceData.state] = document.title.split(/-/, 1) + } + else if (path.includes('/photo')) { + presenceData.details = 'Viewing a photo' + } + else if (path.startsWith('/search')) { + presenceData.details = 'Searching for:'; + [presenceData.state] = document.title.split(/-/, 1) + } + else if (path === '/albums') { + presenceData.details = 'Browsing albums' + } + else if (path.startsWith('/album')) { + presenceData.details = 'Viewing an album' + if (await presence.getSetting('albumname')) + [presenceData.state] = document.title.split(/-/, 1) + } + else if (path.startsWith('/archive')) { + presenceData.details = 'Viewing the archive' + } + presence.setActivity(presenceData) +}) diff --git a/websites/G/Google Play/metadata.json b/websites/G/Google Play/metadata.json index b8a497d260c1..e9977e69e18d 100644 --- a/websites/G/Google Play/metadata.json +++ b/websites/G/Google Play/metadata.json @@ -1,23 +1,23 @@ { - "$schema": "https://schemas.premid.app/metadata/1.12", - "apiVersion": 1, - "author": { - "name": "Angelo II", - "id": "698966790356729907" - }, - "service": "Google Play", - "description": { - "en": "Enjoy millions of the latest Android apps, games, music, movies, TV, books, magazines & more.", - "bg": "Насладете се на милиони най-нови приложения за Android, игри, музика, филми, телевизия, книги, списания и др." - }, - "url": "play.google.com", - "version": "1.0.17", - "logo": "https://cdn.rcd.gg/PreMiD/websites/G/Google%20Play/assets/logo.png", - "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/Google%20Play/assets/thumbnail.png", - "color": "#F0464B", - "category": "socials", - "tags": [ - "google", - "googleplay" - ] -} \ No newline at end of file + "$schema": "https://schemas.premid.app/metadata/1.12", + "apiVersion": 1, + "author": { + "name": "Angelo II", + "id": "698966790356729907" + }, + "service": "Google Play", + "description": { + "en": "Enjoy millions of the latest Android apps, games, music, movies, TV, books, magazines & more.", + "bg": "Насладете се на милиони най-нови приложения за Android, игри, музика, филми, телевизия, книги, списания и др." + }, + "url": "play.google.com", + "version": "1.0.17", + "logo": "https://cdn.rcd.gg/PreMiD/websites/G/Google%20Play/assets/logo.png", + "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/Google%20Play/assets/thumbnail.png", + "color": "#F0464B", + "category": "socials", + "tags": [ + "google", + "googleplay" + ] +} diff --git a/websites/G/Google Play/presence.ts b/websites/G/Google Play/presence.ts index f81bf7f3c3c4..72787698b6f0 100644 --- a/websites/G/Google Play/presence.ts +++ b/websites/G/Google Play/presence.ts @@ -1,175 +1,185 @@ const presence = new Presence({ - clientId: "928611702638010398", - }), - appCategories: Record = { - LIBRARIES_AND_DEMO: "Browsing for libraries and demos", - BUSINESS: "Browsing for business apps", - VIDEO_PLAYERS: "Browsing for video players", - WEATHER: "Browsing for weather apps", - HOUSE_AND_HOME: "Browsing for house apps", - PARENTING: "Browsing for apps for parents", - DATING: "Browsing for dating apps", - HEALTH_AND_FITNESS: "Browsing for health apps", - ART_AND_DESIGN: "Browsing for design apps", - TOOLS: "Browsing for tools", - MAPS_AND_NAVIGATION: "Browsing for navigation apps", - BOOKS_AND_REFERENCE: "Browsing for book apps", - COMICS: "Browsing for comics", - COMMUNICATION: "Browsing for communication apps", - BEAUTY: "Browsing for beauty apps", - MEDICAL: "Browsing for medical apps", - MUSIC_AND_AUDIO: "Browsing for audio apps", - LIFESTYLE: "Browsing for lifestyle apps", - NEWS_AND_MAGAZINES: "Browsing for news apps", - EDUCATION: "Browsing for education apps", - SHOPPING: "Browsing for shopping apps", - PERSONALIZATION: "Browsing for personalization apps", - AUTO_AND_VEHICLES: "Browsing for vehicles apps", - ANDROID_WEAR: "Browsing for android watch apps", - PRODUCTIVITY: "Browsing for productivity apps", - TRAVEL_AND_LOCAL: "Browsing for traveling apps", - ENTERTAINMENT: "Browsing for entertaiment apps", - SOCIAL: "Browsing for social apps", - SPORTS: "Browsing for sport apps", - EVENTS: "Browsing for eventing apps", - FINANCE: "Browsing for financing apps", - PHOTOGRAPHY: "Browsing for photography apps", - FOOD_AND_DRINK: "Browsing for food apps", - WATCH_FACE: "Browisng for android watch faces", - }; + clientId: '928611702638010398', +}) +const appCategories: Record = { + LIBRARIES_AND_DEMO: 'Browsing for libraries and demos', + BUSINESS: 'Browsing for business apps', + VIDEO_PLAYERS: 'Browsing for video players', + WEATHER: 'Browsing for weather apps', + HOUSE_AND_HOME: 'Browsing for house apps', + PARENTING: 'Browsing for apps for parents', + DATING: 'Browsing for dating apps', + HEALTH_AND_FITNESS: 'Browsing for health apps', + ART_AND_DESIGN: 'Browsing for design apps', + TOOLS: 'Browsing for tools', + MAPS_AND_NAVIGATION: 'Browsing for navigation apps', + BOOKS_AND_REFERENCE: 'Browsing for book apps', + COMICS: 'Browsing for comics', + COMMUNICATION: 'Browsing for communication apps', + BEAUTY: 'Browsing for beauty apps', + MEDICAL: 'Browsing for medical apps', + MUSIC_AND_AUDIO: 'Browsing for audio apps', + LIFESTYLE: 'Browsing for lifestyle apps', + NEWS_AND_MAGAZINES: 'Browsing for news apps', + EDUCATION: 'Browsing for education apps', + SHOPPING: 'Browsing for shopping apps', + PERSONALIZATION: 'Browsing for personalization apps', + AUTO_AND_VEHICLES: 'Browsing for vehicles apps', + ANDROID_WEAR: 'Browsing for android watch apps', + PRODUCTIVITY: 'Browsing for productivity apps', + TRAVEL_AND_LOCAL: 'Browsing for traveling apps', + ENTERTAINMENT: 'Browsing for entertaiment apps', + SOCIAL: 'Browsing for social apps', + SPORTS: 'Browsing for sport apps', + EVENTS: 'Browsing for eventing apps', + FINANCE: 'Browsing for financing apps', + PHOTOGRAPHY: 'Browsing for photography apps', + FOOD_AND_DRINK: 'Browsing for food apps', + WATCH_FACE: 'Browisng for android watch faces', +} -presence.on("UpdateData", async () => { - const presenceData: PresenceData = { - largeImageKey: - "https://cdn.rcd.gg/PreMiD/websites/G/Google%20Play/assets/logo.png", - }, - query = new URLSearchParams(document.location.search), - paths: string[] = document.location.pathname.split("/"); - if (!paths[0]) paths.shift(); +presence.on('UpdateData', async () => { + const presenceData: PresenceData = { + largeImageKey: 'https://cdn.rcd.gg/PreMiD/websites/G/Google%20Play/assets/logo.png', + } + const query = new URLSearchParams(document.location.search) + const paths: string[] = document.location.pathname.split('/') + if (!paths[0]) + paths.shift() - if (paths[0] === "settings") presenceData.details = "Viewing settings"; - if (paths[0] === "apps" && !paths[1]) - presenceData.details = "Viewing my apps"; - else if (paths[0] === "wishlist") presenceData.details = "Viewing wishlist"; - else if (paths[0] === "store") { - if (paths[1] === "family" && paths[2] === "create") - presenceData.details = "Creating family"; - switch (paths[1]) { - case "paymentmethods": { - presenceData.details = "Viewing payment methods"; - break; - } - case "myplayactivity": { - presenceData.details = "Viewing my activity"; - break; - } - case "search": { - const q = query.get("q"); - presenceData.details = `Searching${q ? ` for ${q}` : ""}`; + if (paths[0] === 'settings') + presenceData.details = 'Viewing settings' + if (paths[0] === 'apps' && !paths[1]) { + presenceData.details = 'Viewing my apps' + } + else if (paths[0] === 'wishlist') { + presenceData.details = 'Viewing wishlist' + } + else if (paths[0] === 'store') { + if (paths[1] === 'family' && paths[2] === 'create') + presenceData.details = 'Creating family' + switch (paths[1]) { + case 'paymentmethods': { + presenceData.details = 'Viewing payment methods' + break + } + case 'myplayactivity': { + presenceData.details = 'Viewing my activity' + break + } + case 'search': { + const q = query.get('q') + presenceData.details = `Searching${q ? ` for ${q}` : ''}` - break; - } - case "account": { - if (!paths[2] || paths[2] === "rewards") - presenceData.details = "Viewing rewards"; - else { - switch (paths[2]) { - case "orderhistory": { - presenceData.details = "Viewing order hystory"; - break; - } - case "family": { - presenceData.details = "Viewing family"; - break; - } - case "subscriptions": - { - presenceData.details = "Viewing subscriptions"; - // No default - } - break; - } - } - break; - } - case "apps": { - if (!paths[2]) presenceData.details = "Browsing for apps"; - else { - switch (paths[2]) { - case "top": { - presenceData.details = "Browsing for the TOP apps"; - break; - } - case "new": { - presenceData.details = "Browsing for the new apps"; - break; - } - case "details": { - if (query.get("id")) { - const body = document.querySelector( - "body > div#fcxH9b > div.WpDbMd > c-wiz > div.T4LgNb > div.ZfcPIb > div.UTg3hd > div.JNury > main.LXrl4c > c-wiz > c-wiz > div.oQ6oV" - ), - logo = body?.querySelector( - "div.hkhL9e > div.xSyT2c > img.T75of" - )?.src, - name = body?.querySelector( - "div.D0ZKYe > div.rlnrKc > div.sIskre > c-wiz > h1.AHFaub > span" - ).textContent; + break + } + case 'account': { + if (!paths[2] || paths[2] === 'rewards') { + presenceData.details = 'Viewing rewards' + } + else { + switch (paths[2]) { + case 'orderhistory': { + presenceData.details = 'Viewing order hystory' + break + } + case 'family': { + presenceData.details = 'Viewing family' + break + } + case 'subscriptions': { + presenceData.details = 'Viewing subscriptions' + break + } + } + } + break + } + case 'apps': { + if (!paths[2]) { + presenceData.details = 'Browsing for apps' + } + else { + switch (paths[2]) { + case 'top': { + presenceData.details = 'Browsing for the TOP apps' + break + } + case 'new': { + presenceData.details = 'Browsing for the new apps' + break + } + case 'details': { + if (query.get('id')) { + const body = document.querySelector( + 'body > div#fcxH9b > div.WpDbMd > c-wiz > div.T4LgNb > div.ZfcPIb > div.UTg3hd > div.JNury > main.LXrl4c > c-wiz > c-wiz > div.oQ6oV', + ) + const logo = body?.querySelector( + 'div.hkhL9e > div.xSyT2c > img.T75of', + )?.src + const name = body?.querySelector( + 'div.D0ZKYe > div.rlnrKc > div.sIskre > c-wiz > h1.AHFaub > span', + )?.textContent - if (logo) presenceData.largeImageKey = await getShortURL(logo); + if (logo) + presenceData.largeImageKey = await getShortURL(logo) - presenceData.details = `Viewing ${name ?? "app"}`; - presenceData.buttons = [ - { - label: "View app", - url: await getShortURL(document.location.href), - }, - ]; - } + presenceData.details = `Viewing ${name ?? 'app'}` + presenceData.buttons = [ + { + label: 'View app', + url: await getShortURL(document.location.href), + }, + ] + } - break; - } - case "category": { - let msg = "Browsing for apps"; - if (paths[3].startsWith("GAME_")) { - msg = `Browsing for ${paths[3] - .replace("GAME_", "") - .replace("_", " ") - .toLowerCase()} games`; - } - if (appCategories[paths[3]]) msg = appCategories[paths[3]]; - if (paths[3] === "GAME") msg = "Browsing for games"; + break + } + case 'category': { + let msg = 'Browsing for apps' + if (paths[3].startsWith('GAME_')) { + msg = `Browsing for ${paths[3] + .replace('GAME_', '') + .replace('_', ' ') + .toLowerCase()} games` + } + if (appCategories[paths[3]]) + msg = appCategories[paths[3]] + if (paths[3] === 'GAME') + msg = 'Browsing for games' - presenceData.details = msg ?? "Browsing for apps"; + presenceData.details = msg ?? 'Browsing for apps' - break; - } - // No default - } - } + break + } + } + } - break; - } - // No default - } - } + break + } + } + } - if (presenceData.details) presence.setActivity(presenceData); - else presence.setActivity(); -}); + if (presenceData.details) + presence.setActivity(presenceData) + else presence.setActivity() +}) -const shortenedURLs: Record = {}; +const shortenedURLs: Record = {} async function getShortURL(url: string) { - if (!url || url.length < 256) return url; - if (shortenedURLs[url]) return shortenedURLs[url]; - try { - const pdURL = await ( - await fetch(`https://pd.premid.app/create/${url}`) - ).text(); - shortenedURLs[url] = pdURL; - return pdURL; - } catch (err) { - presence.error(err); - return url; - } + if (!url || url.length < 256) + return url + if (shortenedURLs[url]) + return shortenedURLs[url] + try { + const pdURL = await ( + await fetch(`https://pd.premid.app/create/${url}`) + ).text() + shortenedURLs[url] = pdURL + return pdURL + } + catch (err) { + presence.error(err as string) + return url + } } diff --git a/websites/G/Google Podcasts/metadata.json b/websites/G/Google Podcasts/metadata.json index 60aa7148392e..9a1e78ba28d4 100644 --- a/websites/G/Google Podcasts/metadata.json +++ b/websites/G/Google Podcasts/metadata.json @@ -1,27 +1,27 @@ { - "$schema": "https://schemas.premid.app/metadata/1.12", - "apiVersion": 1, - "author": { - "name": "MrBartusek", - "id": "212988300137463809" - }, - "service": "Google Podcasts", - "description": { - "en": "With Google Podcasts, you can find and listen to the world's podcasts for free", - "pl": "Z Google Podcasts, możesz odkrywac i słuchać podcasty za darmo", - "nl": "Met Google Podcasts kunt u gratis podcasts van over de hele wereld zoeken en beluisteren", - "vi_VN": "Với Google Podcasts, bạn có thể tìm và lắng nghe các bản podcast trên thế giới miễn phí." - }, - "url": "podcasts.google.com", - "version": "1.1.14", - "logo": "https://cdn.rcd.gg/PreMiD/websites/G/Google%20Podcasts/assets/logo.png", - "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/Google%20Podcasts/assets/thumbnail.jpg", - "color": "#ffffff", - "category": "other", - "tags": [ - "google", - "podcast", - "audio", - "listen" - ] -} \ No newline at end of file + "$schema": "https://schemas.premid.app/metadata/1.12", + "apiVersion": 1, + "author": { + "name": "MrBartusek", + "id": "212988300137463809" + }, + "service": "Google Podcasts", + "description": { + "en": "With Google Podcasts, you can find and listen to the world's podcasts for free", + "pl": "Z Google Podcasts, możesz odkrywac i słuchać podcasty za darmo", + "nl": "Met Google Podcasts kunt u gratis podcasts van over de hele wereld zoeken en beluisteren", + "vi_VN": "Với Google Podcasts, bạn có thể tìm và lắng nghe các bản podcast trên thế giới miễn phí." + }, + "url": "podcasts.google.com", + "version": "1.1.14", + "logo": "https://cdn.rcd.gg/PreMiD/websites/G/Google%20Podcasts/assets/logo.png", + "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/Google%20Podcasts/assets/thumbnail.jpg", + "color": "#ffffff", + "category": "other", + "tags": [ + "google", + "podcast", + "audio", + "listen" + ] +} diff --git a/websites/G/Google Podcasts/presence.ts b/websites/G/Google Podcasts/presence.ts index 115f58f157d6..8d8dbf79ee64 100644 --- a/websites/G/Google Podcasts/presence.ts +++ b/websites/G/Google Podcasts/presence.ts @@ -1,70 +1,75 @@ const presence = new Presence({ - clientId: "777530802887983124", -}); + clientId: '777530802887983124', +}) -presence.on("UpdateData", async () => { - const presenceData: PresenceData = { - largeImageKey: - "https://cdn.rcd.gg/PreMiD/websites/G/Google%20Podcasts/assets/logo.png", - }, - podcastTitle = - document.querySelectorAll(".Ut8Gr").length > 0 && - document.querySelectorAll(".Ut8Gr")[1].textContent; +presence.on('UpdateData', async () => { + const presenceData: PresenceData = { + largeImageKey: 'https://cdn.rcd.gg/PreMiD/websites/G/Google%20Podcasts/assets/logo.png', + } + const podcastTitle = document.querySelectorAll('.Ut8Gr').length > 0 + && document.querySelectorAll('.Ut8Gr')[1].textContent - if (podcastTitle) { - presenceData.details = ( - document.querySelector(".GmW3rb > .BhVIWc") as HTMLImageElement - ).alt; - presenceData.state = podcastTitle; + if (podcastTitle) { + presenceData.details = ( + document.querySelector('.GmW3rb > .BhVIWc') as HTMLImageElement + ).alt + presenceData.state = podcastTitle - const isPaused = - (document.querySelector(".DPvwYc.ERYGad") as HTMLSpanElement).style - .display !== "none"; - presenceData.smallImageKey = isPaused ? Assets.Pause : Assets.Play; - if (!isPaused) { - presenceData.smallImageKey = Assets.Play; - const ts = Math.round(Date.now() / 1000), - elapsedSeconds = parseLength( - document.querySelector(".oG0wpe").children[0].textContent - ); - presenceData.startTimestamp = ts - elapsedSeconds; - presenceData.endTimestamp = - ts + - parseLength(document.querySelector(".oG0wpe").children[1].textContent) - - elapsedSeconds; - } - } else if (document.location.pathname === "/") - presenceData.details = "Browsing podcasts"; - else if (document.location.pathname.includes("feed/")) { - presenceData.details = "Viewing podcast"; - // It's quite tricky to locate the right podcast title because - // website makes new element for each of them - for (const element of document.querySelectorAll(".dbCu3e")) { - if (element.children[0].textContent === document.title) - presenceData.state = `${document.title} by ${element.children[1].textContent}`; - } - } else if (document.location.pathname.includes("/subscriptions")) - presenceData.details = "Browsing subscriptions"; - else if (document.location.pathname.includes("/queue")) - presenceData.details = "Browsing queue"; - else if (document.location.pathname.includes("/subscribe-by-rss-feed")) - presenceData.details = "Subscribing by RSS feed"; - else if (document.location.pathname.includes("/settings")) - presenceData.details = "Browsing settings"; - else if (document.location.pathname.includes("search/")) { - presenceData.details = "Searching for podcast"; - presenceData.state = document.location.pathname.replace("/search/", ""); - } + const isPaused = (document.querySelector('.DPvwYc.ERYGad') as HTMLSpanElement).style.display !== 'none' + presenceData.smallImageKey = isPaused ? Assets.Pause : Assets.Play + if (!isPaused) { + presenceData.smallImageKey = Assets.Play + const ts = Math.round(Date.now() / 1000) + const elapsedSeconds = parseLength( + document.querySelector('.oG0wpe')?.children[0]?.textContent ?? '', + ) + presenceData.startTimestamp = ts - elapsedSeconds + presenceData.endTimestamp = ts + + parseLength(document.querySelector('.oG0wpe')?.children[1]?.textContent ?? '') + - elapsedSeconds + } + } + else if (document.location.pathname === '/') { + presenceData.details = 'Browsing podcasts' + } + else if (document.location.pathname.includes('feed/')) { + presenceData.details = 'Viewing podcast' + // It's quite tricky to locate the right podcast title because + // website makes new element for each of them + for (const element of document.querySelectorAll('.dbCu3e')) { + if (element.children[0].textContent === document.title) + presenceData.state = `${document.title} by ${element.children[1].textContent}` + } + } + else if (document.location.pathname.includes('/subscriptions')) { + presenceData.details = 'Browsing subscriptions' + } + else if (document.location.pathname.includes('/queue')) { + presenceData.details = 'Browsing queue' + } + else if (document.location.pathname.includes('/subscribe-by-rss-feed')) { + presenceData.details = 'Subscribing by RSS feed' + } + else if (document.location.pathname.includes('/settings')) { + presenceData.details = 'Browsing settings' + } + else if (document.location.pathname.includes('search/')) { + presenceData.details = 'Searching for podcast' + presenceData.state = document.location.pathname.replace('/search/', '') + } - if (presenceData.details) presence.setActivity(presenceData); - else presence.setActivity(); -}); + if (presenceData.details) + presence.setActivity(presenceData) + else presence.setActivity() +}) // Function that convert lengths like 01:13 to seconds like 73 function parseLength(length: string) { - let result = 0; - for (const [i, element] of length.split(":").reverse().entries()) - if (!isNaN(Number(element))) result += Number(element) * Math.pow(60, i); + let result = 0 + for (const [i, element] of length.split(':').reverse().entries()) { + if (!Number.isNaN(Number(element))) + result += Number(element) * 60 ** i + } - return result; + return result } diff --git a/websites/G/Google Translate/metadata.json b/websites/G/Google Translate/metadata.json index c1c6dd5287d7..086fca61cf01 100644 --- a/websites/G/Google Translate/metadata.json +++ b/websites/G/Google Translate/metadata.json @@ -1,63 +1,63 @@ { - "$schema": "https://schemas.premid.app/metadata/1.12", - "apiVersion": 1, - "author": { - "name": "Bas950", - "id": "241278257335500811" - }, - "contributors": [ - { - "name": "Callum", - "id": "506899274748133376" - }, - { - "name": "Striker", - "id": "215509157837537280" - }, - { - "name": "Vasilis", - "id": "241929388403195914" - } - ], - "service": "Google Translate", - "description": { - "en": "Google's free service instantly translates words, phrases, and web pages between English and over 100 other languages.", - "nl": "De gratis service van Google kan woorden, zinnen en webpagina's onmiddellijk vertalen tussen het Engels en meer dan 100 andere talen.", - "ga_IE": "Aistríonn seirbhís saor in aisce Google focail, frásaí agus leathanaigh ghréasáin go tapa idir an Béarla agus níos mó ná 100 teanga eile.", - "vi_VN": "Dịch vụ miễn phí của Google phiên dịch ngay lập tức các từ ngữ, cụm từ, và trang web từ Tiếng Anh và hơn 100 ngôn ngữ khác." - }, - "url": "translate.google.com", - "regExp": "translate.google([.][a-z]+)+[/]", - "version": "3.0.17", - "logo": "https://cdn.rcd.gg/PreMiD/websites/G/Google%20Translate/assets/logo.png", - "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/Google%20Translate/assets/thumbnail.png", - "color": "#4c8bf5", - "category": "other", - "tags": [ - "translate", - "google", - "utility" - ], - "settings": [ - { - "id": "tDetail", - "title": "Translation Details row 1", - "icon": "fas fa-comment-alt-edit", - "value": "Translating", - "placeholder": "Use %from% or %to%" - }, - { - "id": "tState", - "title": "Translation State row 2", - "icon": "fas fa-comment-alt-edit", - "value": "From %from% to %to%", - "placeholder": "Use %from%, %to% or {0} to delete the row completely" - }, - { - "id": "stamp", - "title": "Show time elapsed", - "icon": "fas fa-stopwatch", - "value": true - } - ] -} \ No newline at end of file + "$schema": "https://schemas.premid.app/metadata/1.12", + "apiVersion": 1, + "author": { + "name": "Bas950", + "id": "241278257335500811" + }, + "contributors": [ + { + "name": "Callum", + "id": "506899274748133376" + }, + { + "name": "Striker", + "id": "215509157837537280" + }, + { + "name": "Vasilis", + "id": "241929388403195914" + } + ], + "service": "Google Translate", + "description": { + "en": "Google's free service instantly translates words, phrases, and web pages between English and over 100 other languages.", + "nl": "De gratis service van Google kan woorden, zinnen en webpagina's onmiddellijk vertalen tussen het Engels en meer dan 100 andere talen.", + "ga_IE": "Aistríonn seirbhís saor in aisce Google focail, frásaí agus leathanaigh ghréasáin go tapa idir an Béarla agus níos mó ná 100 teanga eile.", + "vi_VN": "Dịch vụ miễn phí của Google phiên dịch ngay lập tức các từ ngữ, cụm từ, và trang web từ Tiếng Anh và hơn 100 ngôn ngữ khác." + }, + "url": "translate.google.com", + "regExp": "translate.google([.][a-z]+)+[/]", + "version": "3.0.17", + "logo": "https://cdn.rcd.gg/PreMiD/websites/G/Google%20Translate/assets/logo.png", + "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/Google%20Translate/assets/thumbnail.png", + "color": "#4c8bf5", + "category": "other", + "tags": [ + "translate", + "google", + "utility" + ], + "settings": [ + { + "id": "tDetail", + "title": "Translation Details row 1", + "icon": "fas fa-comment-alt-edit", + "value": "Translating", + "placeholder": "Use %from% or %to%" + }, + { + "id": "tState", + "title": "Translation State row 2", + "icon": "fas fa-comment-alt-edit", + "value": "From %from% to %to%", + "placeholder": "Use %from%, %to% or {0} to delete the row completely" + }, + { + "id": "stamp", + "title": "Show time elapsed", + "icon": "fas fa-stopwatch", + "value": true + } + ] +} diff --git a/websites/G/Google Translate/presence.ts b/websites/G/Google Translate/presence.ts index 923c75c2fd9b..fa217697b11e 100644 --- a/websites/G/Google Translate/presence.ts +++ b/websites/G/Google Translate/presence.ts @@ -1,549 +1,553 @@ const presence = new Presence({ - clientId: "705033229719175179", -}); + clientId: '705033229719175179', +}) function languageCode(language: string): string { - switch (language) { - case "auto": - return "Auto Detect"; - case "ace": - return "Achinese"; - case "ady": - return "Adyghe"; - case "aa": - return "Afar"; - case "af": - return "Afrikaans"; - case "ahr": - return "Ahirani"; - case "sq": - return "Albanian"; - case "am": - return "Amharic"; - case "ar": - return "Arabic"; - case "an": - return "Aragonese"; - case "hy": - return "Armenian"; - case "as": - return "Assamese"; - case "av": - return "Avaric"; - case "ay": - return "Aymara"; - case "az": - return "Azerbaijani"; - case "bfy": - return "Bagheli"; - case "bal": - return "Baluchi"; - case "bm": - return "Bambara"; - case "bxg": - return "Bangala"; - case "bci": - return "Baoulé"; - case "ba": - return "Bashkir"; - case "eu": - return "Basque"; - case "bbc": - return "Batak Toba"; - case "be": - return "Belarussian"; - case "bn": - return "Bengali"; - case "bew": - return "Betawi"; - case "bho": - return "Bhojpuri"; - case "brx": - return "Bodo"; - case "bs": - return "Bosnian"; - case "br": - return "Breton"; - case "bg": - return "Bulgarian"; - case "yue": - return "Cantonese"; - case "ca": - return "Catalan"; - case "ceb": - return "Cebuano"; - case "ce": - return "Chechen"; - case "chr": - return "Cherokee"; - case "hne": - return "Chhattisgarhi"; - case "ny": - return "Chichewa"; - case "zh-CH": - return "Chinese (Simplified)"; - case "zh-TW": - return "Chinese (Traditional)"; - case "zh": - return "Chinese"; - case "toi": - return "Chitonga"; - case "ctg": - return "Chittagonian"; - case "cv": - return "Chuvash"; - case "co": - return "Corsican"; - case "hr": - return "Croatin"; - case "cs": - return "Czech"; - case "da": - return "Danish"; - case "dcc": - return "Deccani"; - case "luo": - return "Dholuo"; - case "dv": - return "Divehi"; - case "doi": - return "Dorgi"; - case "nl": - return "Dutch"; - case "dyu": - return "Dyula"; - case "dz": - return "Dzongkha"; - case "bin": - return "Edo"; - case "efi": - return "Efik"; - case "en": - return "English"; - case "ish": - return "Esan"; - case "eo": - return "Esperanto"; - case "et": - return "Estonian"; - case "ee": - return "Ewe"; - case "tl": - return "Filipino"; - case "fi": - return "Finnish"; - case "fon": - return "Fon"; - case "fr": - return "French"; - case "fy": - return "Frisian"; - case "ff": - return "Fulah"; - case "gag": - return "Gagauz"; - case "gl": - return "Galician"; - case "gbm": - return "Garhwali"; - case "ka": - return "Georgian"; - case "de": - return "German"; - case "el": - return "Greek"; - case "gn": - return "Guarani"; - case "gu": - return "Gujarati"; - case "ht": - return "Haitian Creole"; - case "bgc": - return "Haryanvi"; - case "ha": - return "Hausa"; - case "haw": - return "Hawaiian"; - case "iw": - return "Hebrew"; - case "hil": - return "Hiligaynon"; - case "hi": - return "Hindi"; - case "hmn": - return "Hmong"; - case "hu": - return "Hungarian"; - case "is": - return "Icelandic"; - case "ig": - return "Igbo"; - case "ilo": - return "Iloko"; - case "id": - return "Indonesian"; - case "iu": - return "Inuktitut"; - case "ga": - return "Irish"; - case "iso": - return "Isoko"; - case "it": - return "Italian"; - case "jp": - return "Japanese"; - case "jw": - return "Javanese"; - case "kl": - return "Kalaallisut"; - case "kam": - return "Kamba"; - case "kn": - return "Kannada"; - case "kr": - return "Kanuri"; - case "kaa": - return "Kara-Kalpak"; - case "krc": - return "Karachay-Balkar"; - case "ks": - return "Kashmiri"; - case "kk": - return "Kazakh"; - case "meo": - return "Kedah Malay"; - case "kjh": - return "Khakas"; - case "km": - return "Khmer"; - case "kmz": - return "Khorasani Turkic"; - case "ki": - return "Kikuyu"; - case "rw": - return "Kinyarwanda"; - case "trp": - return "Kokborok"; - case "ko": - return "Korean"; - case "kri": - return "Krio"; - case "kum": - return "Kumyk"; - case "ku": - return "Kurdish (Kurmanji)"; - case "ckb": - return "Kurdish (Sorani)"; - case "ky": - return "Kyrgyz"; - case "quc": - return "Kʼicheʼ"; - case "lkt": - return "Lakota"; - case "lo": - return "Lao"; - case "la": - return "Latin"; - case "lv": - return "Latvian"; - case "ln": - return "Lingala"; - case "lt": - return "Lithuanian"; - case "lu": - return "Luba"; - case "lg": - return "Luganda"; - case "lb": - return "Luxembourgish"; - case "mk": - return "Macedonian"; - case "mad": - return "Madurese"; - case "mag": - return "Magahi"; - case "mai": - return "Maithili"; - case "mg": - return "Malagasy"; - case "ms": - return "Malay"; - case "ml": - return "Malayalam"; - case "mt": - return "Maltese"; - case "mi": - return "Maori"; - case "mr": - return "Marathi"; - case "rwr": - return "Marwari"; - case "mzn": - return "Mazanderani"; - case "min": - return "Minangkabau"; - case "lus": - return "Mizo"; - case "mn": - return "Mongolian"; - case "sr-ME": - return "Montenegrin"; - case "mos": - return "Mossi"; - case "my": - return "Myanmar (Burmese)"; - case "nv": - return "Navajo"; - case "new": - return "Nepalbhasa"; - case "ne": - return "Nepali"; - case "pcm": - return "Nigerian Pidgin"; - case "se": - return "Northern Sami"; - case "nso": - return "Northern Sotho"; - case "no": - return "Norwegian"; - case "oc": - return "Occitan"; - case "or": - return "Odia (Oriya)"; - case "om": - return "Oromo"; - case "pam": - return "Pampanga"; - case "ps": - return "Pashto"; - case "mfa": - return "Pattani Malay"; - case "fa": - return "Persian"; - case "pl": - return "Polish"; - case "pt": - return "Portuguese"; - case "pa": - return "Punjabi"; - case "qxq": - return "Qashqai"; - case "qu": - return "Quechua"; - case "raj": - return "Rajasthani"; - case "rkt": - return "Rangpuri"; - case "rhg": - return "Rohigya"; - case "ro": - return "Romanian"; - case "rm": - return "Romansh"; - case "ru": - return "Russian"; - case "sck": - return "Sadri"; - case "slr": - return "Salar"; - case "sm": - return "Samoan"; - case "sgs": - return "Samogitian"; - case "sg": - return "Sango"; - case "sa": - return "Sanskrit"; - case "sat": - return "Santali"; - case "skr": - return "Saraiki"; - case "gd": - return "Scots Gaelic"; - case "sr": - return "Serbian"; - case "ser": - return "Serrano"; - case "st": - return "Sesotho"; - case "tn": - return "Setswana"; - case "sn": - return "Shona"; - case "cjs": - return "Shor"; - case "sty": - return "Siberian Tatar"; - case "scn": - return "Sicilian"; - case "sd": - return "Sindhi"; - case "si": - return "Sinhala"; - case "sk": - return "Slovak"; - case "sl": - return "Slovenian"; - case "so": - return "Somali"; - case "alt": - return "Southern Altai"; - case "nr": - return "Southern Ndebele"; - case "es": - return "Spanish"; - case "su": - return "Sundanese"; - case "sjp": - return "Surjapuri"; - case "sw": - return "Swahili"; - case "swc": - return "Swahili Congo"; - case "sv": - return "Swedish"; - case "syl": - return "Sylheti"; - case "tg": - return "Tajik"; - case "ber": - return "Tamazight"; - case "ta": - return "Tamil"; - case "tt": - return "Tatar"; - case "te": - return "Telugu"; - case "th": - return "Thai"; - case "bo": - return "Tibetan"; - case "ti": - return "Tigrinya"; - case "tiv": - return "Tiv"; - case "tpi": - return "Tok Pisin"; - case "lua": - return "Tshiluba"; - case "ve": - return "Tshivenda"; - case "tsc": - return "Tswa"; - case "tr": - return "Turkish"; - case "tk": - return "Turkmen"; - case "tyv": - return "Tuvinian"; - case "ak": - return "Twi"; - case "uk": - return "Ukrainian"; - case "ur": - return "Urdu"; - case "urh": - return "Urhobo"; - case "uum": - return "Urum"; - case "ug": - return "Uyghur"; - case "uz": - return "Uzbek"; - case "vah": - return "Varhadi-Nagpuri"; - case "vi": - return "Vietnamese"; - case "cy": - return "Welsh"; - case "wo": - return "Wolof"; - case "xh": - return "Xhosa"; - case "ts": - return "Xitsonga"; - case "sah": - return "Yakut"; - case "yi": - return "Yiddish"; - case "yo": - return "Yoruba"; - case "yua": - return "Yucateco"; - case "zza": - return "Zaza"; - case "za": - return "Zhuang"; - case "zu": - return "Zulu"; - default: - return "Unknown"; - } + switch (language) { + case 'auto': + return 'Auto Detect' + case 'ace': + return 'Achinese' + case 'ady': + return 'Adyghe' + case 'aa': + return 'Afar' + case 'af': + return 'Afrikaans' + case 'ahr': + return 'Ahirani' + case 'sq': + return 'Albanian' + case 'am': + return 'Amharic' + case 'ar': + return 'Arabic' + case 'an': + return 'Aragonese' + case 'hy': + return 'Armenian' + case 'as': + return 'Assamese' + case 'av': + return 'Avaric' + case 'ay': + return 'Aymara' + case 'az': + return 'Azerbaijani' + case 'bfy': + return 'Bagheli' + case 'bal': + return 'Baluchi' + case 'bm': + return 'Bambara' + case 'bxg': + return 'Bangala' + case 'bci': + return 'Baoulé' + case 'ba': + return 'Bashkir' + case 'eu': + return 'Basque' + case 'bbc': + return 'Batak Toba' + case 'be': + return 'Belarussian' + case 'bn': + return 'Bengali' + case 'bew': + return 'Betawi' + case 'bho': + return 'Bhojpuri' + case 'brx': + return 'Bodo' + case 'bs': + return 'Bosnian' + case 'br': + return 'Breton' + case 'bg': + return 'Bulgarian' + case 'yue': + return 'Cantonese' + case 'ca': + return 'Catalan' + case 'ceb': + return 'Cebuano' + case 'ce': + return 'Chechen' + case 'chr': + return 'Cherokee' + case 'hne': + return 'Chhattisgarhi' + case 'ny': + return 'Chichewa' + case 'zh-CH': + return 'Chinese (Simplified)' + case 'zh-TW': + return 'Chinese (Traditional)' + case 'zh': + return 'Chinese' + case 'toi': + return 'Chitonga' + case 'ctg': + return 'Chittagonian' + case 'cv': + return 'Chuvash' + case 'co': + return 'Corsican' + case 'hr': + return 'Croatin' + case 'cs': + return 'Czech' + case 'da': + return 'Danish' + case 'dcc': + return 'Deccani' + case 'luo': + return 'Dholuo' + case 'dv': + return 'Divehi' + case 'doi': + return 'Dorgi' + case 'nl': + return 'Dutch' + case 'dyu': + return 'Dyula' + case 'dz': + return 'Dzongkha' + case 'bin': + return 'Edo' + case 'efi': + return 'Efik' + case 'en': + return 'English' + case 'ish': + return 'Esan' + case 'eo': + return 'Esperanto' + case 'et': + return 'Estonian' + case 'ee': + return 'Ewe' + case 'tl': + return 'Filipino' + case 'fi': + return 'Finnish' + case 'fon': + return 'Fon' + case 'fr': + return 'French' + case 'fy': + return 'Frisian' + case 'ff': + return 'Fulah' + case 'gag': + return 'Gagauz' + case 'gl': + return 'Galician' + case 'gbm': + return 'Garhwali' + case 'ka': + return 'Georgian' + case 'de': + return 'German' + case 'el': + return 'Greek' + case 'gn': + return 'Guarani' + case 'gu': + return 'Gujarati' + case 'ht': + return 'Haitian Creole' + case 'bgc': + return 'Haryanvi' + case 'ha': + return 'Hausa' + case 'haw': + return 'Hawaiian' + case 'iw': + return 'Hebrew' + case 'hil': + return 'Hiligaynon' + case 'hi': + return 'Hindi' + case 'hmn': + return 'Hmong' + case 'hu': + return 'Hungarian' + case 'is': + return 'Icelandic' + case 'ig': + return 'Igbo' + case 'ilo': + return 'Iloko' + case 'id': + return 'Indonesian' + case 'iu': + return 'Inuktitut' + case 'ga': + return 'Irish' + case 'iso': + return 'Isoko' + case 'it': + return 'Italian' + case 'jp': + return 'Japanese' + case 'jw': + return 'Javanese' + case 'kl': + return 'Kalaallisut' + case 'kam': + return 'Kamba' + case 'kn': + return 'Kannada' + case 'kr': + return 'Kanuri' + case 'kaa': + return 'Kara-Kalpak' + case 'krc': + return 'Karachay-Balkar' + case 'ks': + return 'Kashmiri' + case 'kk': + return 'Kazakh' + case 'meo': + return 'Kedah Malay' + case 'kjh': + return 'Khakas' + case 'km': + return 'Khmer' + case 'kmz': + return 'Khorasani Turkic' + case 'ki': + return 'Kikuyu' + case 'rw': + return 'Kinyarwanda' + case 'trp': + return 'Kokborok' + case 'ko': + return 'Korean' + case 'kri': + return 'Krio' + case 'kum': + return 'Kumyk' + case 'ku': + return 'Kurdish (Kurmanji)' + case 'ckb': + return 'Kurdish (Sorani)' + case 'ky': + return 'Kyrgyz' + case 'quc': + return 'Kʼicheʼ' + case 'lkt': + return 'Lakota' + case 'lo': + return 'Lao' + case 'la': + return 'Latin' + case 'lv': + return 'Latvian' + case 'ln': + return 'Lingala' + case 'lt': + return 'Lithuanian' + case 'lu': + return 'Luba' + case 'lg': + return 'Luganda' + case 'lb': + return 'Luxembourgish' + case 'mk': + return 'Macedonian' + case 'mad': + return 'Madurese' + case 'mag': + return 'Magahi' + case 'mai': + return 'Maithili' + case 'mg': + return 'Malagasy' + case 'ms': + return 'Malay' + case 'ml': + return 'Malayalam' + case 'mt': + return 'Maltese' + case 'mi': + return 'Maori' + case 'mr': + return 'Marathi' + case 'rwr': + return 'Marwari' + case 'mzn': + return 'Mazanderani' + case 'min': + return 'Minangkabau' + case 'lus': + return 'Mizo' + case 'mn': + return 'Mongolian' + case 'sr-ME': + return 'Montenegrin' + case 'mos': + return 'Mossi' + case 'my': + return 'Myanmar (Burmese)' + case 'nv': + return 'Navajo' + case 'new': + return 'Nepalbhasa' + case 'ne': + return 'Nepali' + case 'pcm': + return 'Nigerian Pidgin' + case 'se': + return 'Northern Sami' + case 'nso': + return 'Northern Sotho' + case 'no': + return 'Norwegian' + case 'oc': + return 'Occitan' + case 'or': + return 'Odia (Oriya)' + case 'om': + return 'Oromo' + case 'pam': + return 'Pampanga' + case 'ps': + return 'Pashto' + case 'mfa': + return 'Pattani Malay' + case 'fa': + return 'Persian' + case 'pl': + return 'Polish' + case 'pt': + return 'Portuguese' + case 'pa': + return 'Punjabi' + case 'qxq': + return 'Qashqai' + case 'qu': + return 'Quechua' + case 'raj': + return 'Rajasthani' + case 'rkt': + return 'Rangpuri' + case 'rhg': + return 'Rohigya' + case 'ro': + return 'Romanian' + case 'rm': + return 'Romansh' + case 'ru': + return 'Russian' + case 'sck': + return 'Sadri' + case 'slr': + return 'Salar' + case 'sm': + return 'Samoan' + case 'sgs': + return 'Samogitian' + case 'sg': + return 'Sango' + case 'sa': + return 'Sanskrit' + case 'sat': + return 'Santali' + case 'skr': + return 'Saraiki' + case 'gd': + return 'Scots Gaelic' + case 'sr': + return 'Serbian' + case 'ser': + return 'Serrano' + case 'st': + return 'Sesotho' + case 'tn': + return 'Setswana' + case 'sn': + return 'Shona' + case 'cjs': + return 'Shor' + case 'sty': + return 'Siberian Tatar' + case 'scn': + return 'Sicilian' + case 'sd': + return 'Sindhi' + case 'si': + return 'Sinhala' + case 'sk': + return 'Slovak' + case 'sl': + return 'Slovenian' + case 'so': + return 'Somali' + case 'alt': + return 'Southern Altai' + case 'nr': + return 'Southern Ndebele' + case 'es': + return 'Spanish' + case 'su': + return 'Sundanese' + case 'sjp': + return 'Surjapuri' + case 'sw': + return 'Swahili' + case 'swc': + return 'Swahili Congo' + case 'sv': + return 'Swedish' + case 'syl': + return 'Sylheti' + case 'tg': + return 'Tajik' + case 'ber': + return 'Tamazight' + case 'ta': + return 'Tamil' + case 'tt': + return 'Tatar' + case 'te': + return 'Telugu' + case 'th': + return 'Thai' + case 'bo': + return 'Tibetan' + case 'ti': + return 'Tigrinya' + case 'tiv': + return 'Tiv' + case 'tpi': + return 'Tok Pisin' + case 'lua': + return 'Tshiluba' + case 've': + return 'Tshivenda' + case 'tsc': + return 'Tswa' + case 'tr': + return 'Turkish' + case 'tk': + return 'Turkmen' + case 'tyv': + return 'Tuvinian' + case 'ak': + return 'Twi' + case 'uk': + return 'Ukrainian' + case 'ur': + return 'Urdu' + case 'urh': + return 'Urhobo' + case 'uum': + return 'Urum' + case 'ug': + return 'Uyghur' + case 'uz': + return 'Uzbek' + case 'vah': + return 'Varhadi-Nagpuri' + case 'vi': + return 'Vietnamese' + case 'cy': + return 'Welsh' + case 'wo': + return 'Wolof' + case 'xh': + return 'Xhosa' + case 'ts': + return 'Xitsonga' + case 'sah': + return 'Yakut' + case 'yi': + return 'Yiddish' + case 'yo': + return 'Yoruba' + case 'yua': + return 'Yucateco' + case 'zza': + return 'Zaza' + case 'za': + return 'Zhuang' + case 'zu': + return 'Zulu' + default: + return 'Unknown' + } } -const browsingTimestamp: number = Math.floor(Date.now() / 1000); -let from: string, to: string; +const browsingTimestamp: number = Math.floor(Date.now() / 1000) +let from: string, to: string -presence.on("UpdateData", async () => { - const showTime = await presence.getSetting("stamp"), - tDetail = await presence.getSetting("tDetail"), - tState = await presence.getSetting("tState"), - presenceData: PresenceData = { - largeImageKey: - "https://cdn.rcd.gg/PreMiD/websites/G/Google%20Translate/assets/logo.png", - }; +presence.on('UpdateData', async () => { + const showTime = await presence.getSetting('stamp') + const tDetail = await presence.getSetting('tDetail') + const tState = await presence.getSetting('tState') + const presenceData: PresenceData = { + largeImageKey: 'https://cdn.rcd.gg/PreMiD/websites/G/Google%20Translate/assets/logo.png', + } - if (document.location.href.includes("about")) { - presenceData.details = "About Google Translate"; - if (document.location.href.includes("languages")) - presenceData.state = "Languages"; - if (document.location.href.includes("contribute")) - presenceData.state = "Contribute"; - if (document.location.href.includes("forbusiness")) - presenceData.state = "Tools"; - } else if (document.location.href.includes("contribute")) { - const contr = document.querySelector("div.Xxlgbc > span[role=img]"); - presenceData.details = "Contribute"; - if (contr) { - const langs = document - .querySelector("c-wiz[jsrenderer=TxVJMc]") - .getAttribute("data-p") - .split(","); + if (document.location.href.includes('about')) { + presenceData.details = 'About Google Translate' + if (document.location.href.includes('languages')) + presenceData.state = 'Languages' + if (document.location.href.includes('contribute')) + presenceData.state = 'Contribute' + if (document.location.href.includes('forbusiness')) + presenceData.state = 'Tools' + } + else if (document.location.href.includes('contribute')) { + const contr = document.querySelector('div.Xxlgbc > span[role=img]') + presenceData.details = 'Contribute' + if (contr) { + const langs = document + .querySelector('c-wiz[jsrenderer=TxVJMc]') + ?.getAttribute('data-p') + ?.split(',') - presenceData.details = "Contributing"; - presenceData.state = `${languageCode( - langs[1].replaceAll('"', "") - )} → ${languageCode(langs[2].replaceAll('"', ""))}: ${contr.textContent}`; - } - } else { - from = document - .querySelectorAll("span.VfPpkd-AznF2e-LUERP-bN97Pc")[0] - .querySelector("button[aria-selected=true]") - .getAttribute("data-language-code") - .replaceAll('"', ""); - to = document - .querySelectorAll("span.VfPpkd-AznF2e-LUERP-bN97Pc")[1] - .querySelector("button[aria-selected=true]") - .getAttribute("data-language-code") - .replaceAll('"', ""); - } + presenceData.details = 'Contributing' + presenceData.state = `${languageCode( + langs?.[1].replaceAll('"', '') ?? '', + )} → ${languageCode(langs?.[2].replaceAll('"', '') ?? '')}: ${contr?.textContent ?? ''}` + } + } + else { + from = document + .querySelectorAll('span.VfPpkd-AznF2e-LUERP-bN97Pc')[0] + ?.querySelector('button[aria-selected=true]') + ?.getAttribute('data-language-code') + ?.replaceAll('"', '') ?? '' + to = document + .querySelectorAll('span.VfPpkd-AznF2e-LUERP-bN97Pc')[1] + ?.querySelector('button[aria-selected=true]') + ?.getAttribute('data-language-code') + ?.replaceAll('"', '') ?? '' + } - presenceData.startTimestamp = showTime ? browsingTimestamp : null; - if (presenceData.startTimestamp === null) delete presenceData.startTimestamp; + presenceData.startTimestamp = showTime ? browsingTimestamp : null + if (presenceData.startTimestamp === null) + delete presenceData.startTimestamp - if ( - !document.location.href.includes("about") && - !document.location.href.includes("contribute") - ) { - presenceData.details = tDetail - .replace("%from%", languageCode(from)) - .replace("%to%", languageCode(to)); - presenceData.state = tState - .replace("%from%", languageCode(from)) - .replace("%to%", languageCode(to)); - if (tState.includes("{0}")) delete presenceData.state; - } + if ( + !document.location.href.includes('about') + && !document.location.href.includes('contribute') + ) { + presenceData.details = tDetail + .replace('%from%', languageCode(from)) + .replace('%to%', languageCode(to)) + presenceData.state = tState + .replace('%from%', languageCode(from)) + .replace('%to%', languageCode(to)) + if (tState.includes('{0}')) + delete presenceData.state + } - if (presenceData.details) presence.setActivity(presenceData); - else presence.setActivity(); -}); + if (presenceData.details) + presence.setActivity(presenceData) + else presence.setActivity() +}) diff --git a/websites/G/Google's Coding Competitions/metadata.json b/websites/G/Google's Coding Competitions/metadata.json index 2345d95bea6d..7343fd15e0ed 100644 --- a/websites/G/Google's Coding Competitions/metadata.json +++ b/websites/G/Google's Coding Competitions/metadata.json @@ -1,25 +1,25 @@ { - "$schema": "https://schemas.premid.app/metadata/1.12", - "apiVersion": 1, - "author": { - "name": "Palskie", - "id": "90431685472038912" - }, - "service": "Google's Coding Competitions", - "description": { - "en": "Google's Coding Competitions (Code Jam, Hash Code, and Kick Start) enthrall, challenge, and test coders around the world. Try your hand at one, or all three.", - "vi_VN": "Google's Coding Competitions (Code Jam, Hash Code, and Kick Start) cuốn hút, thử thách lập trình viên khắp thế giới. Hãy thử một, hoặc có thể cả ba." - }, - "url": "codingcompetitions.withgoogle.com", - "version": "1.0.21", - "logo": "https://cdn.rcd.gg/PreMiD/websites/G/Google's%20Coding%20Competitions/assets/logo.png", - "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/Google's%20Coding%20Competitions/assets/thumbnail.png", - "color": "#ffffff", - "category": "other", - "tags": [ - "competition", - "coding", - "education", - "programming" - ] -} \ No newline at end of file + "$schema": "https://schemas.premid.app/metadata/1.12", + "apiVersion": 1, + "author": { + "name": "Palskie", + "id": "90431685472038912" + }, + "service": "Google's Coding Competitions", + "description": { + "en": "Google's Coding Competitions (Code Jam, Hash Code, and Kick Start) enthrall, challenge, and test coders around the world. Try your hand at one, or all three.", + "vi_VN": "Google's Coding Competitions (Code Jam, Hash Code, and Kick Start) cuốn hút, thử thách lập trình viên khắp thế giới. Hãy thử một, hoặc có thể cả ba." + }, + "url": "codingcompetitions.withgoogle.com", + "version": "1.0.21", + "logo": "https://cdn.rcd.gg/PreMiD/websites/G/Google's%20Coding%20Competitions/assets/logo.png", + "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/Google's%20Coding%20Competitions/assets/thumbnail.png", + "color": "#ffffff", + "category": "other", + "tags": [ + "competition", + "coding", + "education", + "programming" + ] +} diff --git a/websites/G/Google's Coding Competitions/presence.ts b/websites/G/Google's Coding Competitions/presence.ts index dc99bc51f2cd..39c9d3355989 100644 --- a/websites/G/Google's Coding Competitions/presence.ts +++ b/websites/G/Google's Coding Competitions/presence.ts @@ -3,247 +3,251 @@ * Google Kick Start = 848588920437604382 * Google Code Jam = 848588299147935744 * Google Hash Code = 848588586524868701 - * */ + */ -let presence: Presence; +let presence: Presence | undefined function setPresence(): void { - if (location.pathname.includes("kickstart")) - presence = new Presence({ clientId: "848588920437604382" }); - else if (location.pathname.includes("codejam")) - presence = new Presence({ clientId: "848588299147935744" }); - else if (location.pathname.includes("hashcode")) - presence = new Presence({ clientId: "848588586524868701" }); - else presence = new Presence({ clientId: "848587645760176148" }); + if (location.pathname.includes('kickstart')) + presence = new Presence({ clientId: '848588920437604382' }) + else if (location.pathname.includes('codejam')) + presence = new Presence({ clientId: '848588299147935744' }) + else if (location.pathname.includes('hashcode')) + presence = new Presence({ clientId: '848588586524868701' }) + else presence = new Presence({ clientId: '848587645760176148' }) } -const timeElapsed: number = ~~(Date.now() / 1000); +const timeElapsed: number = ~~(Date.now() / 1000) -setPresence(); +setPresence() const enum Assets { - Kickstart = "https://cdn.rcd.gg/PreMiD/websites/G/Google's%20Coding%20Competitions/assets/0.png", - Codejam = "https://cdn.rcd.gg/PreMiD/websites/G/Google's%20Coding%20Competitions/assets/1.png", - Hashcode = "https://cdn.rcd.gg/PreMiD/websites/G/Google's%20Coding%20Competitions/assets/2.png", + Kickstart = 'https://cdn.rcd.gg/PreMiD/websites/G/Google\'s%20Coding%20Competitions/assets/0.png', + Codejam = 'https://cdn.rcd.gg/PreMiD/websites/G/Google\'s%20Coding%20Competitions/assets/1.png', + Hashcode = 'https://cdn.rcd.gg/PreMiD/websites/G/Google\'s%20Coding%20Competitions/assets/2.png', } -presence.on("UpdateData", async () => { - const presenceData: PresenceData = { - largeImageKey: - "https://cdn.rcd.gg/PreMiD/websites/G/Google's%20Coding%20Competitions/assets/logo.png", - details: "Home page", - startTimestamp: timeElapsed, - }; - - switch (location.pathname.split("/")[1]) { - case "kickstart": { - presenceData.largeImageKey = Assets.Kickstart; - - switch (location.pathname.split("/")[2]) { - case "about": { - presenceData.details = "Reading about Kick Start"; - presenceData.smallImageKey = Assets.Reading; - break; - } - - case "schedule": { - presenceData.details = "Viewing Schedule"; - break; - } - - case "faq": { - presenceData.details = "Reading FAQ"; - presenceData.smallImageKey = Assets.Reading; - break; - } - - case "rulesandterms": { - presenceData.details = "Reading Rules and Terms"; - presenceData.smallImageKey = Assets.Reading; - break; - } - - case "archive": { - if (!location.pathname.split("/")[3]) - presenceData.details = "Viewing Competition archive"; - else { - presenceData.details = "Viewing Competition archive"; - presenceData.state = - document.querySelector(".headline-2").textContent; - } - break; - } - - case "round": { - if (!location.pathname.split("/")[4]) { - presenceData.details = `Viewing ${ - document.querySelector(".headline-2").textContent - }`; - } else { - const [round] = document - .querySelector(".headline-5") - .textContent.split("-"), - problem = document.querySelector( - "#problem-select-selected-text" - ).textContent; - - if (!location.hash || location.hash.includes("#problem")) { - presenceData.details = `Solving: ${round}`; - presenceData.state = problem; - } else { - presenceData.details = `Reading Analysis: ${round}`; - presenceData.state = problem; - presenceData.smallImageKey = Assets.Reading; - } - } - break; - } - - case "submissions": { - presenceData.details = `Viewing submissions for ${ - document.querySelector(".rounds-header__container > p > b") - .textContent - }`; - presenceData.state = - document.querySelector(".headline-2").textContent; - break; - } - } - break; - } - - case "codejam": { - presenceData.largeImageKey = Assets.Codejam; - - switch (location.pathname.split("/")[2]) { - case "about": { - presenceData.details = "Reading about Code Jam"; - presenceData.smallImageKey = Assets.Reading; - break; - } - - case "schedule": { - presenceData.details = "Viewing Schedule"; - break; - } - - case "faq": { - presenceData.details = "Reading FAQ"; - presenceData.smallImageKey = Assets.Reading; - break; - } - - case "rulesandterms": { - presenceData.details = "Reading Rules and Terms"; - presenceData.smallImageKey = Assets.Reading; - break; - } - - case "archive": { - if (!location.pathname.split("/")[3]) - presenceData.details = "Viewing Competition archive"; - else { - presenceData.details = "Viewing Competition archive"; - presenceData.state = - document.querySelector(".headline-2").textContent; - } - break; - } - - case "round": { - if (!location.pathname.split("/")[4]) { - presenceData.details = `Viewing ${ - document.querySelector(".headline-2").textContent - }`; - } else { - const [round] = document - .querySelector(".headline-5") - .textContent.split("-"), - problem = document.querySelector( - "#problem-select-selected-text" - ).textContent; - - if (!location.hash || location.hash.includes("#problem")) { - presenceData.details = `Solving: ${round}`; - presenceData.state = problem; - } else { - presenceData.details = `Reading Analysis: ${round}`; - presenceData.state = problem; - presenceData.smallImageKey = Assets.Reading; - } - } - break; - } - - case "submissions": { - presenceData.details = `Viewing submissions for ${ - document.querySelector(".rounds-header__container > p > b") - .textContent - }`; - presenceData.state = - document.querySelector(".headline-2").textContent; - break; - } - } - break; - } - - case "hashcode": { - presenceData.largeImageKey = Assets.Hashcode; - - switch (location.pathname.split("/")[2]) { - case "about": { - presenceData.details = "Reading about Hash Code"; - presenceData.smallImageKey = Assets.Reading; - break; - } - - case "schedule": { - presenceData.details = "Viewing Schedule"; - break; - } - - case "hubs": { - presenceData.details = "Viewing Hubs"; - break; - } - - case "rulesandterms": { - presenceData.details = "Reading Rules and Terms"; - presenceData.smallImageKey = Assets.Reading; - break; - } - - case "faq": { - presenceData.details = "Reading FAQ"; - presenceData.smallImageKey = Assets.Reading; - break; - } - - case "archive": { - if (!location.pathname.split("/")[3]) - presenceData.details = "Viewing Competition archive"; - else { - presenceData.details = "Viewing Scoreboard"; - presenceData.state = - document.querySelector(".headline-2").textContent; - } - break; - } - } - break; - } - - default: { - delete presenceData.startTimestamp; - - if (location.pathname.includes("profile")) - presenceData.details = "Viewing their profile"; - else if (location.pathname.includes("past-competitions")) - presenceData.details = "Viewing past competitions"; - } - } - - if (presenceData.details) presence.setActivity(presenceData); - else presence.setActivity(); -}); +presence?.on('UpdateData', async () => { + const presenceData: PresenceData = { + largeImageKey: 'https://cdn.rcd.gg/PreMiD/websites/G/Google\'s%20Coding%20Competitions/assets/logo.png', + details: 'Home page', + startTimestamp: timeElapsed, + } + + switch (location.pathname.split('/')[1]) { + case 'kickstart': { + presenceData.largeImageKey = Assets.Kickstart + + switch (location.pathname.split('/')[2]) { + case 'about': { + presenceData.details = 'Reading about Kick Start' + presenceData.smallImageKey = Assets.Reading + break + } + + case 'schedule': { + presenceData.details = 'Viewing Schedule' + break + } + + case 'faq': { + presenceData.details = 'Reading FAQ' + presenceData.smallImageKey = Assets.Reading + break + } + + case 'rulesandterms': { + presenceData.details = 'Reading Rules and Terms' + presenceData.smallImageKey = Assets.Reading + break + } + + case 'archive': { + if (!location.pathname.split('/')[3]) { + presenceData.details = 'Viewing Competition archive' + } + else { + presenceData.details = 'Viewing Competition archive' + presenceData.state = document.querySelector('.headline-2')?.textContent + } + break + } + + case 'round': { + if (!location.pathname.split('/')[4]) { + presenceData.details = `Viewing ${ + document.querySelector('.headline-2')?.textContent + }` + } + else { + const [round] = document + .querySelector('.headline-5') + ?.textContent + ?.split('-') ?? [] + const problem = document.querySelector( + '#problem-select-selected-text', + )?.textContent + + if (!location.hash || location.hash.includes('#problem')) { + presenceData.details = `Solving: ${round}` + presenceData.state = problem + } + else { + presenceData.details = `Reading Analysis: ${round}` + presenceData.state = problem + presenceData.smallImageKey = Assets.Reading + } + } + break + } + + case 'submissions': { + presenceData.details = `Viewing submissions for ${ + document.querySelector('.rounds-header__container > p > b') + ?.textContent + }` + presenceData.state = document.querySelector('.headline-2')?.textContent + break + } + } + break + } + + case 'codejam': { + presenceData.largeImageKey = Assets.Codejam + + switch (location.pathname.split('/')[2]) { + case 'about': { + presenceData.details = 'Reading about Code Jam' + presenceData.smallImageKey = Assets.Reading + break + } + + case 'schedule': { + presenceData.details = 'Viewing Schedule' + break + } + + case 'faq': { + presenceData.details = 'Reading FAQ' + presenceData.smallImageKey = Assets.Reading + break + } + + case 'rulesandterms': { + presenceData.details = 'Reading Rules and Terms' + presenceData.smallImageKey = Assets.Reading + break + } + + case 'archive': { + if (!location.pathname.split('/')[3]) { + presenceData.details = 'Viewing Competition archive' + } + else { + presenceData.details = 'Viewing Competition archive' + presenceData.state = document.querySelector('.headline-2')?.textContent + } + break + } + + case 'round': { + if (!location.pathname.split('/')[4]) { + presenceData.details = `Viewing ${ + document.querySelector('.headline-2')?.textContent + }` + } + else { + const [round] = document + .querySelector('.headline-5') + ?.textContent + ?.split('-') ?? [] + const problem = document.querySelector( + '#problem-select-selected-text', + )?.textContent + + if (!location.hash || location.hash.includes('#problem')) { + presenceData.details = `Solving: ${round}` + presenceData.state = problem + } + else { + presenceData.details = `Reading Analysis: ${round}` + presenceData.state = problem + presenceData.smallImageKey = Assets.Reading + } + } + break + } + + case 'submissions': { + presenceData.details = `Viewing submissions for ${ + document.querySelector('.rounds-header__container > p > b') + ?.textContent + }` + presenceData.state = document.querySelector('.headline-2')?.textContent + break + } + } + break + } + + case 'hashcode': { + presenceData.largeImageKey = Assets.Hashcode + + switch (location.pathname.split('/')[2]) { + case 'about': { + presenceData.details = 'Reading about Hash Code' + presenceData.smallImageKey = Assets.Reading + break + } + + case 'schedule': { + presenceData.details = 'Viewing Schedule' + break + } + + case 'hubs': { + presenceData.details = 'Viewing Hubs' + break + } + + case 'rulesandterms': { + presenceData.details = 'Reading Rules and Terms' + presenceData.smallImageKey = Assets.Reading + break + } + + case 'faq': { + presenceData.details = 'Reading FAQ' + presenceData.smallImageKey = Assets.Reading + break + } + + case 'archive': { + if (!location.pathname.split('/')[3]) { + presenceData.details = 'Viewing Competition archive' + } + else { + presenceData.details = 'Viewing Scoreboard' + presenceData.state = document.querySelector('.headline-2')?.textContent + } + break + } + } + break + } + + default: { + delete presenceData.startTimestamp + + if (location.pathname.includes('profile')) + presenceData.details = 'Viewing their profile' + else if (location.pathname.includes('past-competitions')) + presenceData.details = 'Viewing past competitions' + } + } + + if (presenceData.details) + presence?.setActivity(presenceData) + else presence?.setActivity() +}) diff --git a/websites/G/Google/metadata.json b/websites/G/Google/metadata.json index 2632d80e4ed3..3fb021f41564 100644 --- a/websites/G/Google/metadata.json +++ b/websites/G/Google/metadata.json @@ -1,35 +1,35 @@ { - "$schema": "https://schemas.premid.app/metadata/1.12", - "apiVersion": 1, - "author": { - "name": "TheDrop.", - "id": "293828021134295040" - }, - "service": "Google", - "description": { - "en": "Google is a search engine that can be employed to find a variety of information such as websites, pictures, maps.", - "ro": "Google este un motor de căutare care poate fi folosit pentru a găsi o varietate de informații precum site-uri web, imagini și hărți.", - "zh_CN": "Google是一个搜索引擎,可用于查找各种信息,例如网站,图片,地图。", - "nl": "Google is een zoekmachine waarmee gebruikers een breed scala aan informatie zoals websites, afbeeldingen en kaarten kunnen vinden.", - "vi_VN": "Google là công cụ tìm kiếm có thể được sử dụng để tìm vô vàn thông tin như các trang web, bức ảnh, bản đồ." - }, - "url": "www.google.com", - "regExp": "www[.]google([.][a-z]+)+[/]", - "version": "2.4.10", - "logo": "https://cdn.rcd.gg/PreMiD/websites/G/Google/assets/logo.png", - "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/Google/assets/thumbnail.png", - "color": "#ffffff", - "category": "other", - "tags": [ - "search", - "popular" - ], - "settings": [ - { - "id": "privacy", - "title": "Privacy Mode", - "icon": "fad fa-user-secret", - "value": false - } - ] -} \ No newline at end of file + "$schema": "https://schemas.premid.app/metadata/1.12", + "apiVersion": 1, + "author": { + "name": "TheDrop.", + "id": "293828021134295040" + }, + "service": "Google", + "description": { + "en": "Google is a search engine that can be employed to find a variety of information such as websites, pictures, maps.", + "ro": "Google este un motor de căutare care poate fi folosit pentru a găsi o varietate de informații precum site-uri web, imagini și hărți.", + "zh_CN": "Google是一个搜索引擎,可用于查找各种信息,例如网站,图片,地图。", + "nl": "Google is een zoekmachine waarmee gebruikers een breed scala aan informatie zoals websites, afbeeldingen en kaarten kunnen vinden.", + "vi_VN": "Google là công cụ tìm kiếm có thể được sử dụng để tìm vô vàn thông tin như các trang web, bức ảnh, bản đồ." + }, + "url": "www.google.com", + "regExp": "www[.]google([.][a-z]+)+[/]", + "version": "2.4.10", + "logo": "https://cdn.rcd.gg/PreMiD/websites/G/Google/assets/logo.png", + "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/Google/assets/thumbnail.png", + "color": "#ffffff", + "category": "other", + "tags": [ + "search", + "popular" + ], + "settings": [ + { + "id": "privacy", + "title": "Privacy Mode", + "icon": "fad fa-user-secret", + "value": false + } + ] +} diff --git a/websites/G/Google/presence.ts b/websites/G/Google/presence.ts index d4c757561c04..49d4d6ff90cf 100644 --- a/websites/G/Google/presence.ts +++ b/websites/G/Google/presence.ts @@ -1,98 +1,103 @@ const presence = new Presence({ - clientId: "612704158826496028", - }), - browsingTimestamp = Math.floor(Date.now() / 1000), - pageInput: HTMLInputElement = document.querySelector("#lst-ib"), - homepageInput: HTMLInputElement = document.querySelector('input[name="q"]'), - homepageImage: HTMLElement = document.querySelector("#hplogo"), - imgInput: HTMLInputElement = document.querySelector("#REsRA"); + clientId: '612704158826496028', +}) +const browsingTimestamp = Math.floor(Date.now() / 1000) +const pageInput = document.querySelector('#lst-ib') +const homepageInput = document.querySelector('input[name="q"]') +const homepageImage = document.querySelector('#hplogo') +const imgInput = document.querySelector('#REsRA') -presence.on("UpdateData", async () => { - const presenceData: PresenceData = { - largeImageKey: - "https://cdn.rcd.gg/PreMiD/websites/G/Google/assets/logo.png", - startTimestamp: browsingTimestamp, - }, - privacy = await presence.getSetting("privacy"); +presence.on('UpdateData', async () => { + const presenceData: PresenceData = { + largeImageKey: 'https://cdn.rcd.gg/PreMiD/websites/G/Google/assets/logo.png', + startTimestamp: browsingTimestamp, + } + const privacy = await presence.getSetting('privacy') - if ((homepageInput && homepageImage) || !document.location.pathname) - presenceData.details = "Home"; - else if (document.location.pathname.startsWith("/doodles/")) { - const doodleResult = new URL(document.location.href).searchParams.get("q"), - doodleTitle: HTMLElement = document.querySelector( - "#title-card > div > h2" - ); + if ((homepageInput && homepageImage) || !document.location.pathname) { + presenceData.details = 'Home' + } + else if (document.location.pathname.startsWith('/doodles/')) { + const doodleResult = new URL(document.location.href).searchParams.get('q') + const doodleTitle = document.querySelector( + '#title-card > div > h2', + ) - if (document.location.pathname.includes("/about")) { - presenceData.details = "Doodles"; - presenceData.state = "About"; - } else if (doodleTitle) { - presenceData.details = "Viewing a doodle:"; - presenceData.state = doodleTitle.textContent; - } else if (doodleResult && document.location.pathname === "/doodles/") { - presenceData.details = "Searching for a doodle:"; - presenceData.state = doodleResult; - presenceData.smallImageKey = Assets.Search; - } else { - presenceData.details = "Current page:"; - presenceData.state = "Doodles"; - } - } else if (document.location.pathname.startsWith("/search")) { - const searchTab = new URL(document.location.href).searchParams.get("tbm"); - presenceData.smallImageKey = Assets.Search; + if (document.location.pathname.includes('/about')) { + presenceData.details = 'Doodles' + presenceData.state = 'About' + } + else if (doodleTitle) { + presenceData.details = 'Viewing a doodle:' + presenceData.state = doodleTitle.textContent + } + else if (doodleResult && document.location.pathname === '/doodles/') { + presenceData.details = 'Searching for a doodle:' + presenceData.state = doodleResult + presenceData.smallImageKey = Assets.Search + } + else { + presenceData.details = 'Current page:' + presenceData.state = 'Doodles' + } + } + else if (document.location.pathname.startsWith('/search')) { + const searchTab = new URL(document.location.href).searchParams.get('tbm') + presenceData.smallImageKey = Assets.Search - if (!searchTab) { - presenceData.details = `Searching for ${homepageInput.value}`; - presenceData.state = document.querySelector("#result-stats").textContent; - } else { - switch (searchTab) { - case "isch": { - presenceData.details = "Google Images"; - presenceData.state = `Searching for ${imgInput.value}`; + if (!searchTab) { + presenceData.details = `Searching for ${homepageInput?.value}` + presenceData.state = document.querySelector('#result-stats')?.textContent + } + else { + switch (searchTab) { + case 'isch': { + presenceData.details = 'Google Images' + presenceData.state = `Searching for ${imgInput?.value}` - break; - } - case "vid": { - presenceData.details = "Google Videos"; - presenceData.state = `Searching for ${pageInput.value}`; + break + } + case 'vid': { + presenceData.details = 'Google Videos' + presenceData.state = `Searching for ${pageInput?.value}` - break; - } - case "nws": { - presenceData.details = "Google News"; - presenceData.state = `Searching for ${pageInput.value}`; + break + } + case 'nws': { + presenceData.details = 'Google News' + presenceData.state = `Searching for ${pageInput?.value}` - break; - } - case "bks": { - presenceData.details = "Google Books"; - presenceData.state = `Searching for ${pageInput.value}`; + break + } + case 'bks': { + presenceData.details = 'Google Books' + presenceData.state = `Searching for ${pageInput?.value}` - break; - } - case "fin": { - presenceData.details = "Google Finance"; - presenceData.state = `Searching for ${pageInput.value}`; + break + } + case 'fin': { + presenceData.details = 'Google Finance' + presenceData.state = `Searching for ${pageInput?.value}` - break; - } - case "pers": { - presenceData.details = "Google Personal"; - presenceData.state = `Searching for ${pageInput.value}`; + break + } + case 'pers': { + presenceData.details = 'Google Personal' + presenceData.state = `Searching for ${pageInput?.value}` - break; - } - // No default - } - } - if (privacy) { - delete presenceData.state; - if ( - typeof presenceData.details === "string" && - presenceData.details.includes("Searching for") - ) - presenceData.details = "Searching"; - } - } - presence.setActivity(presenceData); -}); + break + } + } + } + if (privacy) { + delete presenceData.state + if ( + typeof presenceData.details === 'string' + && presenceData.details.includes('Searching for') + ) { + presenceData.details = 'Searching' + } + } + } + presence.setActivity(presenceData) +}) diff --git a/websites/G/Grailed/metadata.json b/websites/G/Grailed/metadata.json index eb3c22e9d8c4..9b56394c3978 100644 --- a/websites/G/Grailed/metadata.json +++ b/websites/G/Grailed/metadata.json @@ -1,23 +1,23 @@ { - "$schema": "https://schemas.premid.app/metadata/1.12", - "apiVersion": 1, - "author": { - "name": "Kazaii", - "id": "308054416538206217" - }, - "service": "Grailed", - "description": { - "en": "Grailed is the one-stop destination for buying, selling and exploring menswear.", - "nl": "Grailed is de one-stop-bestemming voor het kopen, verkopen en ontdekken van herenkleding." - }, - "url": "www.grailed.com", - "version": "1.0.23", - "logo": "https://cdn.rcd.gg/PreMiD/websites/G/Grailed/assets/logo.png", - "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/Grailed/assets/thumbnail.jpg", - "color": "#666666", - "category": "other", - "tags": [ - "shopping", - "clothing" - ] -} \ No newline at end of file + "$schema": "https://schemas.premid.app/metadata/1.12", + "apiVersion": 1, + "author": { + "name": "Kazaii", + "id": "308054416538206217" + }, + "service": "Grailed", + "description": { + "en": "Grailed is the one-stop destination for buying, selling and exploring menswear.", + "nl": "Grailed is de one-stop-bestemming voor het kopen, verkopen en ontdekken van herenkleding." + }, + "url": "www.grailed.com", + "version": "1.0.23", + "logo": "https://cdn.rcd.gg/PreMiD/websites/G/Grailed/assets/logo.png", + "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/Grailed/assets/thumbnail.jpg", + "color": "#666666", + "category": "other", + "tags": [ + "shopping", + "clothing" + ] +} diff --git a/websites/G/Grailed/presence.ts b/websites/G/Grailed/presence.ts index 28379fecda80..88d40b949b65 100644 --- a/websites/G/Grailed/presence.ts +++ b/websites/G/Grailed/presence.ts @@ -1,216 +1,264 @@ const presence = new Presence({ - clientId: "786739998011293717", - }), - browsingTimestamp = Math.floor(Date.now() / 1000), - userName = document.querySelector( - "#wardrobe > div > div.UserInfo > div.--header > div.--info > div.--user-container > div.--user-info > div.--username-container > span" - ); + clientId: '786739998011293717', +}) +const browsingTimestamp = Math.floor(Date.now() / 1000) +const userName = document.querySelector( + '#wardrobe > div > div.UserInfo > div.--header > div.--info > div.--user-container > div.--user-info > div.--username-container > span', +) -let item: HTMLElement, item2: HTMLElement; +presence.on('UpdateData', async () => { + const presenceData: PresenceData = { + largeImageKey: 'https://cdn.rcd.gg/PreMiD/websites/G/Grailed/assets/logo.png', + } -presence.on("UpdateData", async () => { - const presenceData: PresenceData = { - largeImageKey: - "https://cdn.rcd.gg/PreMiD/websites/G/Grailed/assets/logo.png", - }; + presenceData.startTimestamp = browsingTimestamp - presenceData.startTimestamp = browsingTimestamp; + if (document.location.hostname === 'www.grailed.com') { + if (document.location.href.includes('www.grailed.com/listings/')) { + const item = document.querySelector( + 'body > div.container > div > div.show-listing > div.listing-details-wrapper > div.-listing-details-and-likes-wrapper > div.-listing-designer-title-size > h1', + ) + presenceData.details = 'Viewing a listing:' + if (item?.textContent && item.textContent.length > 128) { + presenceData.state = `${item.textContent + .replaceAll('amp;', '') + .substring(0, 125)}...` + } + else { + presenceData.state = item?.textContent?.replaceAll('amp;', '') + } - if (document.location.hostname === "www.grailed.com") { - if (document.location.href.includes("www.grailed.com/listings/")) { - item = document.querySelector( - "body > div.container > div > div.show-listing > div.listing-details-wrapper > div.-listing-details-and-likes-wrapper > div.-listing-designer-title-size > h1" - ); - presenceData.details = "Viewing a listing:"; - if (item.textContent.length > 128) { - presenceData.state = `${item.textContent - .replaceAll("amp;", "") - .substring(0, 125)}...`; - } else presenceData.state = item.textContent.replaceAll("amp;", ""); + presence.setActivity(presenceData) + } + else if (document.location.href.includes('www.grailed.com/mygrails/')) { + presenceData.details = 'Browsing:' + presenceData.state = 'My Grails' + presence.setActivity(presenceData) + } + else if (document.location.href.endsWith('www.grailed.com/foryou')) { + presenceData.details = 'Viewing:' + presenceData.state = 'For You' + presence.setActivity(presenceData) + } + else if ( + document.location.href.includes('www.grailed.com/collaborations/') + ) { + const item = document.querySelector( + '#designer-collaboration > div.designer-profile-container > div.designer-profile-info-container > div > h1', + ) + presenceData.details = 'Viewing a collaboration:' + if (item?.textContent && item.textContent.length > 128) { + presenceData.state = `${item.textContent + .replaceAll('amp;', '') + .substring(0, 125)}...` + } + else { + presenceData.state = item?.textContent?.replaceAll('amp;', '') + } - presence.setActivity(presenceData); - } else if (document.location.href.includes("www.grailed.com/mygrails/")) { - presenceData.details = "Browsing:"; - presenceData.state = "My Grails"; - presence.setActivity(presenceData); - } else if (document.location.href.endsWith("www.grailed.com/foryou")) { - presenceData.details = "Viewing:"; - presenceData.state = "For You"; - presence.setActivity(presenceData); - } else if ( - document.location.href.includes("www.grailed.com/collaborations/") - ) { - item = document.querySelector( - "#designer-collaboration > div.designer-profile-container > div.designer-profile-info-container > div > h1" - ); - presenceData.details = "Viewing a collaboration:"; - if (item.textContent.length > 128) { - presenceData.state = `${item.textContent - .replaceAll("amp;", "") - .substring(0, 125)}...`; - } else presenceData.state = item.textContent.replaceAll("amp;", ""); + presence.setActivity(presenceData) + } + else if ( + document.location.href.includes('www.grailed.com/collections/') + ) { + presenceData.details = 'Browsing a Collection:' + const item = document.querySelector( + '#CapsulePage > div.CapsuleHeader > div.-container._has-hero > div > div.-name-container > h1', + ) + if (item?.textContent && item.textContent.length > 128) { + presenceData.state = `${item.textContent + .replaceAll('amp;', '') + .substring(0, 125)}...` + } + else { + presenceData.state = item?.textContent?.replaceAll('amp;', '') + } - presence.setActivity(presenceData); - } else if ( - document.location.href.includes("www.grailed.com/collections/") - ) { - presenceData.details = "Browsing a Collection:"; - item = document.querySelector( - "#CapsulePage > div.CapsuleHeader > div.-container._has-hero > div > div.-name-container > h1" - ); - if (item.textContent.length > 128) { - presenceData.state = `${item.textContent - .replaceAll("amp;", "") - .substring(0, 125)}...`; - } else presenceData.state = item.textContent.replaceAll("amp;", ""); + presence.setActivity(presenceData) + } + else if (document.location.href.includes('www.grailed.com/collections')) { + presenceData.details = 'Browsing:' + presenceData.state = 'Collections' + presence.setActivity(presenceData) + } + else if (document.location.href.includes('www.grailed.com/designers')) { + if (document.location.href.includes('www.grailed.com/designers/')) { + if (document.location.pathname.lastIndexOf('/') < 11) { + presenceData.details = 'Browsing a Designer:' + const item = document.querySelector( + '#__next > div > main > div:nth-child(2) > div.ProfileWrapper > div > div.DetailPageProfile-Info > div > h1', + ) + if (item?.textContent && item.textContent.length > 128) { + presenceData.state = `${item.textContent + .replaceAll('amp;', '') + .substring(0, 125)}...` + } + else { + presenceData.state = item?.textContent?.replaceAll('amp;', '') + } + } + else { + const item = document.querySelector( + '#designer-category > div.FiltersInstantSearch > div.feed-and-filters > div.right > h2', + ) + presenceData.details = 'Browsing:' + if (item?.textContent && item.textContent.length > 128) { + presenceData.state = `${item.textContent + .replaceAll('amp;', '') + .substring(29, 125)}...` + } + else { + presenceData.state = item?.textContent + ?.replaceAll('amp;', '') + .substring(29, item.textContent.length) + } + } + } + else if (document.location.href.endsWith('www.grailed.com/designers')) { + presenceData.details = 'Browsing:' + presenceData.state = 'Designers' + } + presence.setActivity(presenceData) + } + else if (document.location.href.includes('www.grailed.com/categories/')) { + presenceData.details = 'Browsing:' + const item = document.querySelector( + '#CategoryPage > div.-pageHeader > div > div.DetailPage--Header > div.-details > h1', + ) + if (item?.textContent && item.textContent.length > 128) { + presenceData.state = `${item.textContent + .replaceAll('amp;', '') + .substring(0, 125)}...` + } + else { + presenceData.state = item?.textContent?.replaceAll('amp;', '') + } - presence.setActivity(presenceData); - } else if (document.location.href.includes("www.grailed.com/collections")) { - presenceData.details = "Browsing:"; - presenceData.state = "Collections"; - presence.setActivity(presenceData); - } else if (document.location.href.includes("www.grailed.com/designers")) { - if (document.location.href.includes("www.grailed.com/designers/")) { - if (document.location.pathname.lastIndexOf("/") < 11) { - presenceData.details = "Browsing a Designer:"; - item = document.querySelector( - "#__next > div > main > div:nth-child(2) > div.ProfileWrapper > div > div.DetailPageProfile-Info > div > h1" - ); - if (item.textContent.length > 128) { - presenceData.state = `${item.textContent - .replaceAll("amp;", "") - .substring(0, 125)}...`; - } else presenceData.state = item.textContent.replaceAll("amp;", ""); - } else { - item = document.querySelector( - "#designer-category > div.FiltersInstantSearch > div.feed-and-filters > div.right > h2" - ); - presenceData.details = "Browsing:"; - if (item.textContent.length > 128) { - presenceData.state = `${item.textContent - .replaceAll("amp;", "") - .substring(29, 125)}...`; - } else { - presenceData.state = item.textContent - .replaceAll("amp;", "") - .substring(29, item.textContent.length); - } - } - } else if (document.location.href.endsWith("www.grailed.com/designers")) { - presenceData.details = "Browsing:"; - presenceData.state = "Designers"; - } - presence.setActivity(presenceData); - } else if (document.location.href.includes("www.grailed.com/categories/")) { - presenceData.details = "Browsing:"; - item = document.querySelector( - "#CategoryPage > div.-pageHeader > div > div.DetailPage--Header > div.-details > h1" - ); - if (item.textContent.length > 128) { - presenceData.state = `${item.textContent - .replaceAll("amp;", "") - .substring(0, 125)}...`; - } else presenceData.state = item.textContent.replaceAll("amp;", ""); + presence.setActivity(presenceData) + } + else if ( + document.location.href.includes( + 'www.grailed.com/drycleanonly/categories/', + ) + ) { + presenceData.details = 'Reading:' + const item = document.querySelector( + '#blog > div.container.tagged-articles > div.filtered-articles-wrapper > h1', + ) + if (item?.textContent && item.textContent.length > 128) { + presenceData.state = `${item.textContent + .replaceAll('amp;', '') + .substring(0, 125)}...` + } + else { + presenceData.state = item?.textContent?.replaceAll('amp;', '') + } - presence.setActivity(presenceData); - } else if ( - document.location.href.includes( - "www.grailed.com/drycleanonly/categories/" - ) - ) { - presenceData.details = "Reading:"; - item = document.querySelector( - "#blog > div.container.tagged-articles > div.filtered-articles-wrapper > h1" - ); - if (item.textContent.length > 128) { - presenceData.state = `${item.textContent - .replaceAll("amp;", "") - .substring(0, 125)}...`; - } else presenceData.state = item.textContent.replaceAll("amp;", ""); + presence.setActivity(presenceData) + } + else if (document.location.href.includes('www.grailed.com/products/')) { + presenceData.details = 'Browsing a Product:' + const item = document.querySelector( + '#ProductPage > div.ProductPageHeader > div.-info > h1.-product-name', + ) + const item2 = document.querySelector( + '#ProductPage > div.ProductPageHeader > div.-info > h1.-designers-names', + ) + if (item?.textContent && item.textContent.length > 108) { + presenceData.state = `${item2?.textContent?.replaceAll( + 'amp;', + '', + )}: ${item?.textContent?.replaceAll('amp;', '').substring(0, 105)}...` + } + else { + presenceData.state = `${item2?.textContent?.replaceAll( + 'amp;', + '', + )}: ${item?.textContent?.replaceAll('amp;', '')}` + } + presence.setActivity(presenceData) + } + else if ( + document.location.href.includes('www.grailed.com/drycleanonly') + ) { + if (document.location.href.includes('www.grailed.com/drycleanonly/')) { + const item = document.querySelector( + '#blog > div.article-wrapper > div > div.article-top-section > h1 > p', + ) + const item2 = document.querySelector( + 'div.heatwave-app > div.Heatwave--Page > div.Editorial--CampaignPageHeroModule._Heatwave > div > div.--title', + ) + presenceData.details = 'Reading:' + if (item) { + if (item.textContent && item.textContent.length > 128) { + presenceData.state = `${item.textContent + .replaceAll('amp;', '') + .substring(0, 125)}...` + } + else { + presenceData.state = item?.textContent?.replaceAll('amp;', '') + } + } + else if (item2) { + if (item2?.textContent && item2.textContent.length > 128) { + presenceData.state = `${item2.textContent + .replaceAll('amp;', '') + .substring(0, 125)}...` + } + else { + presenceData.state = item2?.textContent?.replaceAll('amp;', '') + } + } + } + else { + presenceData.details = 'Reading:' + presenceData.state = 'Dry Clean Only' + } + presence.setActivity(presenceData) + } + else if (document.location.href.includes('www.grailed.com/shop')) { + if (document.location.href.includes('grailed.com/shop/staff-picks')) { + presenceData.details = 'Browsing:' + presenceData.state = 'Staff Picks' + } + else { + const item = document.querySelector( + '#shop > div > div > div.feed-and-filters > div.right > h2', + ) + if (item?.textContent?.includes('Available listings related to')) { + presenceData.details = 'Searching for:' + presenceData.state = item?.textContent + ?.replaceAll('amp;', '') + .substring(29, 125) + } + else if (item?.textContent?.endsWith('Listings')) { + presenceData.details = 'Searching for:' + presenceData.state = item?.textContent + ?.replaceAll('amp;', '') + .replaceAll('|Listings', '') + } + else { + presenceData.details = 'Browsing:' + presenceData.state = 'The Feed' + } + } + presence.setActivity(presenceData) + } + else if (document.location.href.endsWith('grailed.com/')) { + presenceData.details = 'Viewing:' + presenceData.state = 'The Main Page' + presence.setActivity(presenceData) + } + else if (userName) { + presenceData.details = 'Viewing a User:' + if (userName?.textContent && userName.textContent.length > 128) + presenceData.state = `${userName.textContent.substring(0, 125)}...` + else presenceData.state = userName.textContent - presence.setActivity(presenceData); - } else if (document.location.href.includes("www.grailed.com/products/")) { - presenceData.details = "Browsing a Product:"; - item = document.querySelector( - "#ProductPage > div.ProductPageHeader > div.-info > h1.-product-name" - ); - item2 = document.querySelector( - "#ProductPage > div.ProductPageHeader > div.-info > h1.-designers-names" - ); - if (item.textContent.length > 108) { - presenceData.state = `${item2.textContent.replaceAll( - "amp;", - "" - )}: ${item.textContent.replaceAll("amp;", "").substring(0, 105)}...`; - } else { - presenceData.state = `${item2.textContent.replaceAll( - "amp;", - "" - )}: ${item.textContent.replaceAll("amp;", "")}`; - } - presence.setActivity(presenceData); - } else if ( - document.location.href.includes("www.grailed.com/drycleanonly") - ) { - if (document.location.href.includes("www.grailed.com/drycleanonly/")) { - item = document.querySelector( - "#blog > div.article-wrapper > div > div.article-top-section > h1 > p" - ); - item2 = document.querySelector( - "div.heatwave-app > div.Heatwave--Page > div.Editorial--CampaignPageHeroModule._Heatwave > div > div.--title" - ); - presenceData.details = "Reading:"; - if (item) { - if (item.textContent.length > 128) { - presenceData.state = `${item.textContent - .replaceAll("amp;", "") - .substring(0, 125)}...`; - } else presenceData.state = item.textContent.replaceAll("amp;", ""); - } else if (item2) { - if (item2.textContent.length > 128) { - presenceData.state = `${item2.textContent - .replaceAll("amp;", "") - .substring(0, 125)}...`; - } else presenceData.state = item2.textContent.replaceAll("amp;", ""); - } - } else { - presenceData.details = "Reading:"; - presenceData.state = "Dry Clean Only"; - } - presence.setActivity(presenceData); - } else if (document.location.href.includes("www.grailed.com/shop")) { - if (document.location.href.includes("grailed.com/shop/staff-picks")) { - presenceData.details = "Browsing:"; - presenceData.state = "Staff Picks"; - } else { - item = document.querySelector( - "#shop > div > div > div.feed-and-filters > div.right > h2" - ); - if (item.textContent.includes("Available listings related to")) { - presenceData.details = "Searching for:"; - presenceData.state = item.textContent - .replaceAll("amp;", "") - .substring(29, 125); - } else if (item.textContent.endsWith("Listings")) { - presenceData.details = "Searching for:"; - presenceData.state = item.textContent.replaceAll("amp;|Listings", ""); - } else { - presenceData.details = "Browsing:"; - presenceData.state = "The Feed"; - } - } - presence.setActivity(presenceData); - } else if (document.location.href.endsWith("grailed.com/")) { - presenceData.details = "Viewing:"; - presenceData.state = "The Main Page"; - presence.setActivity(presenceData); - } else if (userName) { - presenceData.details = "Viewing a User:"; - if (userName.textContent.length > 128) - presenceData.state = `${userName.textContent.substring(0, 125)}...`; - else presenceData.state = userName.textContent; - - presence.setActivity(presenceData); - } else presence.setActivity(); - } -}); + presence.setActivity(presenceData) + } + else { + presence.setActivity() + } + } +}) diff --git a/websites/G/Granblue Fantasy Wiki/metadata.json b/websites/G/Granblue Fantasy Wiki/metadata.json index 658817308a18..78420f428a28 100644 --- a/websites/G/Granblue Fantasy Wiki/metadata.json +++ b/websites/G/Granblue Fantasy Wiki/metadata.json @@ -1,25 +1,25 @@ { - "$schema": "https://schemas.premid.app/metadata/1.12", - "apiVersion": 1, - "author": { - "name": "Kyrie", - "id": "368399721494216706" - }, - "service": "Granblue Fantasy Wiki", - "description": { - "en": "Granblue Fantasy Wiki", - "vi_VN": "Granblue Fantasy Wiki" - }, - "url": "gbf.wiki", - "version": "1.0.20", - "logo": "https://cdn.rcd.gg/PreMiD/websites/G/Granblue%20Fantasy%20Wiki/assets/logo.png", - "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/Granblue%20Fantasy%20Wiki/assets/thumbnail.png", - "color": "#2F4F7A", - "category": "games", - "tags": [ - "granblue", - "fantasy", - "gbf", - "wiki" - ] -} \ No newline at end of file + "$schema": "https://schemas.premid.app/metadata/1.12", + "apiVersion": 1, + "author": { + "name": "Kyrie", + "id": "368399721494216706" + }, + "service": "Granblue Fantasy Wiki", + "description": { + "en": "Granblue Fantasy Wiki", + "vi_VN": "Granblue Fantasy Wiki" + }, + "url": "gbf.wiki", + "version": "1.0.20", + "logo": "https://cdn.rcd.gg/PreMiD/websites/G/Granblue%20Fantasy%20Wiki/assets/logo.png", + "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/Granblue%20Fantasy%20Wiki/assets/thumbnail.png", + "color": "#2F4F7A", + "category": "games", + "tags": [ + "granblue", + "fantasy", + "gbf", + "wiki" + ] +} diff --git a/websites/G/Granblue Fantasy Wiki/presence.ts b/websites/G/Granblue Fantasy Wiki/presence.ts index 1bb68e64f171..f8aca589e5ae 100644 --- a/websites/G/Granblue Fantasy Wiki/presence.ts +++ b/websites/G/Granblue Fantasy Wiki/presence.ts @@ -1,66 +1,78 @@ const presence = new Presence({ - clientId: "914354609370329098", - }), - browsingTimestamp = Math.floor(Date.now() / 1000); + clientId: '914354609370329098', +}) +const browsingTimestamp = Math.floor(Date.now() / 1000) const enum Assets { - Logo = "https://cdn.rcd.gg/PreMiD/websites/G/Granblue%20Fantasy%20Wiki/assets/logo.png", - Tierlist = "https://cdn.rcd.gg/PreMiD/websites/G/Granblue%20Fantasy%20Wiki/assets/0.png", - Login = "https://cdn.rcd.gg/PreMiD/websites/G/Granblue%20Fantasy%20Wiki/assets/1.png", - Newaccount = "https://cdn.rcd.gg/PreMiD/websites/G/Granblue%20Fantasy%20Wiki/assets/2.png", + Logo = 'https://cdn.rcd.gg/PreMiD/websites/G/Granblue%20Fantasy%20Wiki/assets/logo.png', + Tierlist = 'https://cdn.rcd.gg/PreMiD/websites/G/Granblue%20Fantasy%20Wiki/assets/0.png', + Login = 'https://cdn.rcd.gg/PreMiD/websites/G/Granblue%20Fantasy%20Wiki/assets/1.png', + Newaccount = 'https://cdn.rcd.gg/PreMiD/websites/G/Granblue%20Fantasy%20Wiki/assets/2.png', } -presence.on("UpdateData", () => { - const presenceData: PresenceData = { - largeImageKey: Assets.Logo, - startTimestamp: browsingTimestamp, - }; +presence.on('UpdateData', () => { + const presenceData: PresenceData = { + largeImageKey: Assets.Logo, + startTimestamp: browsingTimestamp, + } - if (document.location.pathname === "/Main_Page") - presenceData.details = "Viewing Wiki home page"; - else if (document.querySelector("#wpLoginAttempt")) { - presenceData.details = "Logging in"; - presenceData.smallImageKey = Assets.Login; - presenceData.smallImageText = "Logging in"; - } else if (document.querySelector("#wpCreateaccount")) { - presenceData.details = "Creating an account"; - presenceData.smallImageKey = Assets.Newaccount; - presenceData.smallImageText = "Creating an account"; - } else if (document.location.pathname.startsWith("/Character_Tier_List")) { - presenceData.details = "Viewing the character tier list"; - presenceData.smallImageKey = Assets.Tierlist; - presenceData.smallImageText = "Viewing tier list"; - } else if (document.location.pathname === "/Collection_Tracker") - presenceData.details = "Making a collection tracker"; - else if (document.location.pathname.startsWith("/search")) - presenceData.details = "Making a collection tracker"; - else if (document.querySelector(".searchresults")) { - presenceData.details = "Searching for:"; - presenceData.state = ( - document.querySelector("input[type=search]") as HTMLInputElement - ).value; - presenceData.smallImageKey = Assets.Search; - presenceData.smallImageText = "Searching"; - } else if (document.location.href.includes("Special:Preferences")) - presenceData.details = "Editing preferences"; - else if (document.location.href.includes("Special:Watchlist")) - presenceData.details = "Viewing watchlist"; - else if (document.location.href.includes("Special:Contributions")) - presenceData.details = "Looking up contributions"; - else if (document.location.href.includes("history")) { - presenceData.details = "Viewing revision history of:"; - presenceData.state = document.querySelector(".firstHeading").textContent; - } else if (document.location.href.includes("edit")) { - presenceData.details = "Editing:"; - presenceData.state = document.querySelector(".firstHeading").textContent; - presenceData.smallImageKey = Assets.Writing; - presenceData.smallImageText = "Editing"; - } else if (document.querySelector(".firstHeading")) { - presenceData.details = "Viewing page:"; - presenceData.state = document.querySelector(".firstHeading").textContent; - presenceData.smallImageKey = Assets.Reading; - presenceData.smallImageText = "Reading"; - } + if (document.location.pathname === '/Main_Page') { + presenceData.details = 'Viewing Wiki home page' + } + else if (document.querySelector('#wpLoginAttempt')) { + presenceData.details = 'Logging in' + presenceData.smallImageKey = Assets.Login + presenceData.smallImageText = 'Logging in' + } + else if (document.querySelector('#wpCreateaccount')) { + presenceData.details = 'Creating an account' + presenceData.smallImageKey = Assets.Newaccount + presenceData.smallImageText = 'Creating an account' + } + else if (document.location.pathname.startsWith('/Character_Tier_List')) { + presenceData.details = 'Viewing the character tier list' + presenceData.smallImageKey = Assets.Tierlist + presenceData.smallImageText = 'Viewing tier list' + } + else if (document.location.pathname === '/Collection_Tracker') { + presenceData.details = 'Making a collection tracker' + } + else if (document.location.pathname.startsWith('/search')) { + presenceData.details = 'Making a collection tracker' + } + else if (document.querySelector('.searchresults')) { + presenceData.details = 'Searching for:' + presenceData.state = ( + document.querySelector('input[type=search]') as HTMLInputElement + ).value + presenceData.smallImageKey = Assets.Search + presenceData.smallImageText = 'Searching' + } + else if (document.location.href.includes('Special:Preferences')) { + presenceData.details = 'Editing preferences' + } + else if (document.location.href.includes('Special:Watchlist')) { + presenceData.details = 'Viewing watchlist' + } + else if (document.location.href.includes('Special:Contributions')) { + presenceData.details = 'Looking up contributions' + } + else if (document.location.href.includes('history')) { + presenceData.details = 'Viewing revision history of:' + presenceData.state = document.querySelector('.firstHeading')?.textContent + } + else if (document.location.href.includes('edit')) { + presenceData.details = 'Editing:' + presenceData.state = document.querySelector('.firstHeading')?.textContent + presenceData.smallImageKey = Assets.Writing + presenceData.smallImageText = 'Editing' + } + else if (document.querySelector('.firstHeading')) { + presenceData.details = 'Viewing page:' + presenceData.state = document.querySelector('.firstHeading')?.textContent + presenceData.smallImageKey = Assets.Reading + presenceData.smallImageText = 'Reading' + } - presence.setActivity(presenceData); -}); + presence.setActivity(presenceData) +}) diff --git a/websites/G/Granblue Fantasy/metadata.json b/websites/G/Granblue Fantasy/metadata.json index b0b1134ac46a..3dfb4fa1e21f 100644 --- a/websites/G/Granblue Fantasy/metadata.json +++ b/websites/G/Granblue Fantasy/metadata.json @@ -1,65 +1,65 @@ { - "$schema": "https://schemas.premid.app/metadata/1.12", - "apiVersion": 1, - "author": { - "name": "Morrays", - "id": "156190372354064384" - }, - "contributors": [ - { - "name": "Kyrie", - "id": "368399721494216706" - }, - { - "name": "Slowlife", - "id": "374905512661221377" - } - ], - "service": "Granblue Fantasy", - "description": { - "en": "Japanese role playing game", - "nl": "Japans rollenspel", - "vi_VN": "Trò chơi đóng vai Nhật Bản" - }, - "url": "game.granbluefantasy.jp", - "version": "1.5.4", - "logo": "https://cdn.rcd.gg/PreMiD/websites/G/Granblue%20Fantasy/assets/logo.png", - "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/Granblue%20Fantasy/assets/thumbnail.jpg", - "color": "#2F4F7A", - "category": "games", - "tags": [ - "grandblue-fanstasy", - "game", - "jrpg" - ], - "settings": [ - { - "id": "health", - "title": "Health points", - "icon": "fad fa-heart", - "value": 0, - "values": [ - "Simple", - "Detailed" - ] - }, - { - "id": "turn", - "title": "Show turn counter", - "icon": "fad fa-redo", - "value": false - }, - { - "id": "djeeta", - "title": "Show MC portrait/element", - "icon": "fas fa-image", - "value": false - }, - { - "id": "button", - "title": "Show profile button", - "icon": "fad fa-link", - "value": false - } - ] -} \ No newline at end of file + "$schema": "https://schemas.premid.app/metadata/1.12", + "apiVersion": 1, + "author": { + "name": "Morrays", + "id": "156190372354064384" + }, + "contributors": [ + { + "name": "Kyrie", + "id": "368399721494216706" + }, + { + "name": "Slowlife", + "id": "374905512661221377" + } + ], + "service": "Granblue Fantasy", + "description": { + "en": "Japanese role playing game", + "nl": "Japans rollenspel", + "vi_VN": "Trò chơi đóng vai Nhật Bản" + }, + "url": "game.granbluefantasy.jp", + "version": "1.5.4", + "logo": "https://cdn.rcd.gg/PreMiD/websites/G/Granblue%20Fantasy/assets/logo.png", + "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/Granblue%20Fantasy/assets/thumbnail.jpg", + "color": "#2F4F7A", + "category": "games", + "tags": [ + "grandblue-fanstasy", + "game", + "jrpg" + ], + "settings": [ + { + "id": "health", + "title": "Health points", + "icon": "fad fa-heart", + "value": 0, + "values": [ + "Simple", + "Detailed" + ] + }, + { + "id": "turn", + "title": "Show turn counter", + "icon": "fad fa-redo", + "value": false + }, + { + "id": "djeeta", + "title": "Show MC portrait/element", + "icon": "fas fa-image", + "value": false + }, + { + "id": "button", + "title": "Show profile button", + "icon": "fad fa-link", + "value": false + } + ] +} diff --git a/websites/G/Granblue Fantasy/presence.ts b/websites/G/Granblue Fantasy/presence.ts index d5bbf1869e03..aff16f306b29 100644 --- a/websites/G/Granblue Fantasy/presence.ts +++ b/websites/G/Granblue Fantasy/presence.ts @@ -1,403 +1,467 @@ -/* eslint-disable camelcase */ -// Hack to resolve Deepscan -const no_op = (a: number) => a + 1; -no_op(0); - const presence = new Presence({ - clientId: "632983924414349333", - }), - browsingTimestamp = Math.floor(Date.now() / 1000), - djeetas: Record = {}, - gameIcon = - "https://cdn.rcd.gg/PreMiD/websites/G/Granblue%20Fantasy/assets/logo.png"; + clientId: '632983924414349333', +}) +const browsingTimestamp = Math.floor(Date.now() / 1000) +const djeetas: Record = {} +const gameIcon = 'https://cdn.rcd.gg/PreMiD/websites/G/Granblue%20Fantasy/assets/logo.png' enum Elements { - Plain, - Fire, - Water, - Earth, - Wind, - Light, - Dark, + Plain, + Fire, + Water, + Earth, + Wind, + Light, + Dark, } const ElementIcons = { - // Plain element isn't really a thing for characters, but it's here for the sake of completion - [Elements.Plain]: gameIcon, - [Elements.Fire]: - "https://cdn.rcd.gg/PreMiD/websites/G/Granblue%20Fantasy/assets/0.png", - [Elements.Water]: - "https://cdn.rcd.gg/PreMiD/websites/G/Granblue%20Fantasy/assets/1.png", - [Elements.Earth]: - "https://cdn.rcd.gg/PreMiD/websites/G/Granblue%20Fantasy/assets/2.png", - [Elements.Wind]: - "https://cdn.rcd.gg/PreMiD/websites/G/Granblue%20Fantasy/assets/3.png", - [Elements.Light]: - "https://cdn.rcd.gg/PreMiD/websites/G/Granblue%20Fantasy/assets/4.png", - [Elements.Dark]: - "https://cdn.rcd.gg/PreMiD/websites/G/Granblue%20Fantasy/assets/5.png", - }, - ElementsNames = { - [Elements.Plain]: "Plain", - [Elements.Fire]: "Fire", - [Elements.Water]: "Water", - [Elements.Earth]: "Earth", - [Elements.Wind]: "Wind", - [Elements.Light]: "Light", - [Elements.Dark]: "Dark", - }; + // Plain element isn't really a thing for characters, but it's here for the sake of completion + [Elements.Plain]: gameIcon, + [Elements.Fire]: 'https://cdn.rcd.gg/PreMiD/websites/G/Granblue%20Fantasy/assets/0.png', + [Elements.Water]: 'https://cdn.rcd.gg/PreMiD/websites/G/Granblue%20Fantasy/assets/1.png', + [Elements.Earth]: 'https://cdn.rcd.gg/PreMiD/websites/G/Granblue%20Fantasy/assets/2.png', + [Elements.Wind]: 'https://cdn.rcd.gg/PreMiD/websites/G/Granblue%20Fantasy/assets/3.png', + [Elements.Light]: 'https://cdn.rcd.gg/PreMiD/websites/G/Granblue%20Fantasy/assets/4.png', + [Elements.Dark]: 'https://cdn.rcd.gg/PreMiD/websites/G/Granblue%20Fantasy/assets/5.png', +} +const ElementsNames = { + [Elements.Plain]: 'Plain', + [Elements.Fire]: 'Fire', + [Elements.Water]: 'Water', + [Elements.Earth]: 'Earth', + [Elements.Wind]: 'Wind', + [Elements.Light]: 'Light', + [Elements.Dark]: 'Dark', +} interface GameStatus { - turn: number; - battle: { - count: number; - total: number; - }; - boss: { - param: { - hp: string; - hpmax: string; - alive: 1 | 0; - name: { - ja: string; - en: string; - }; - }[]; - }; - player: { - param: { - attr: Elements; - alive: 1 | 0; - leader: 1 | 0; - name: string; - hp: number; - hpmax: number; - pid: string; - }[]; - }; - dungeonInfo: { - name: string; - }; - stageInfo: { - serial_floor_no: number; - stage_id: number; - }; - areaInfo: { - name: string; - }; - [key: string]: unknown; + turn: number + battle: { + count: number + total: number + } + boss: { + param: { + hp: string + hpmax: string + alive: 1 | 0 + name: { + ja: string + en: string + } + }[] + } + player: { + param: { + attr: Elements + alive: 1 | 0 + leader: 1 | 0 + name: string + hp: number + hpmax: number + pid: string + }[] + } + dungeonInfo: { + name: string + } + stageInfo: { + serial_floor_no: number + stage_id: number + } + areaInfo: { + name: string + } + [key: string]: unknown } interface UserData { - baseUri: string; - imgUri: string; - userRank: number; - userId: number; - [key: string]: unknown; + baseUri: string + imgUri: string + userRank: number + userId: number + [key: string]: unknown } function simplifyKey(obj: T): T { - // stage.gGameStatus.boss => boss - const kv = Object.entries(obj as Record); - for (const [key, value] of kv) { - const i = key.lastIndexOf("."); - if (i === -1) continue; - (obj as Record)[key.slice(i + 1)] = value; - delete (obj as Record)[key]; - } + // stage.gGameStatus.boss => boss + const kv = Object.entries(obj as Record) + for (const [key, value] of kv) { + const i = key.lastIndexOf('.') + if (i === -1) + continue; + (obj as Record)[key.slice(i + 1)] = value + delete (obj as Record)[key] + } - return obj; + return obj } function getDjeeta(imgUri: string, uri: string): Promise { - return new Promise(resolve => { - if (djeetas[uri]) return resolve(djeetas[uri]); + return new Promise((resolve) => { + if (djeetas[uri]) + return resolve(djeetas[uri]) - const img = new Image(); - img.crossOrigin = "anonymous"; - img.src = `${imgUri}/sp/assets/leader/raid_normal/${uri}.jpg`; + const img = new Image() + img.crossOrigin = 'anonymous' + img.src = `${imgUri}/sp/assets/leader/raid_normal/${uri}.jpg` - img.onload = function () { - const tempCanvas = document.createElement("canvas"); - tempCanvas.width = img.width; - tempCanvas.height = img.width; + img.onload = function () { + const tempCanvas = document.createElement('canvas') + tempCanvas.width = img.width + tempCanvas.height = img.width - const tempCtx = tempCanvas.getContext("2d"); + const tempCtx = tempCanvas.getContext('2d')! - // Draw the first 3 pixel rows of the image to the canvas (top border) - tempCtx.drawImage(img, 0, 0, img.width, 3, 0, 0, img.width, 3); + // Draw the first 3 pixel rows of the image to the canvas (top border) + tempCtx.drawImage(img, 0, 0, img.width, 3, 0, 0, img.width, 3) - // Then the rest of the image and leaving 3 pixels at the bottom - tempCtx.drawImage( - img, - 0, - 35, - img.width, - img.width - 3, - 0, - 3, - img.width, - img.width - 3 - ); + // Then the rest of the image and leaving 3 pixels at the bottom + tempCtx.drawImage( + img, + 0, + 35, + img.width, + img.width - 3, + 0, + 3, + img.width, + img.width - 3, + ) - // Then the last 3 pixel rows of the image to the canvas (bottom border) - tempCtx.drawImage( - img, - 0, - img.height - 3, - img.width, - 3, - 0, - img.width - 3, - img.width, - 3 - ); + // Then the last 3 pixel rows of the image to the canvas (bottom border) + tempCtx.drawImage( + img, + 0, + img.height - 3, + img.width, + 3, + 0, + img.width - 3, + img.width, + 3, + ) - djeetas[uri] = tempCanvas.toDataURL("image/png"); - resolve(tempCanvas.toDataURL("image/png")); - }; + djeetas[uri] = tempCanvas.toDataURL('image/png') + resolve(tempCanvas.toDataURL('image/png')) + } - img.onerror = function () { - resolve(gameIcon); - }; - }); + img.onerror = function () { + resolve(gameIcon) + } + }) } -presence.on("UpdateData", async () => { - const presenceData: PresenceData = { - largeImageKey: gameIcon, - startTimestamp: browsingTimestamp, - }, - { href } = document.location, - [health, turn, djeeta, button] = await Promise.all([ - presence.getSetting("health"), - presence.getSetting("turn"), - presence.getSetting("djeeta"), - presence.getSetting("button"), - ]); - let userData = await presence.getPageVariable( - "Game.userRank", - "Game.userId", - "Game.baseUri", - "Game.imgUri" - ), - gameStatus = await presence.getPageVariable( - "stage.gGameStatus.turn", - "stage.pJsnData.battle", - "stage.gGameStatus.boss", - "stage.pJsnData.player", - "Game.view.dungeonInfo", - "Game.view.stageInfo", - "Game.view.areaInfo" - ); +presence.on('UpdateData', async () => { + const presenceData: PresenceData = { + largeImageKey: gameIcon, + startTimestamp: browsingTimestamp, + } + const { href } = document.location + const [health, turn, djeeta, button] = await Promise.all([ + presence.getSetting('health'), + presence.getSetting('turn'), + presence.getSetting('djeeta'), + presence.getSetting('button'), + ]) + let userData = await presence.getPageVariable( + 'Game.userRank', + 'Game.userId', + 'Game.baseUri', + 'Game.imgUri', + ) + let gameStatus = await presence.getPageVariable( + 'stage.gGameStatus.turn', + 'stage.pJsnData.battle', + 'stage.gGameStatus.boss', + 'stage.pJsnData.player', + 'Game.view.dungeonInfo', + 'Game.view.stageInfo', + 'Game.view.areaInfo', + ) - if (gameStatus) gameStatus = simplifyKey(gameStatus); - if (userData) userData = simplifyKey(userData); + if (gameStatus) + gameStatus = simplifyKey(gameStatus) + if (userData) + userData = simplifyKey(userData) - if (href.includes("/#mypage")) presenceData.details = "Home page"; - else if (href.includes("/#quest")) { - presenceData.details = "Selecting a quest"; - if (href.includes("extra")) - presenceData.state = "Treasure Quests / Event Quest"; - else if (href.includes("assist")) presenceData.state = "Joining a raid"; - else if (href.includes("supporter")) - presenceData.state = "Choosing a summon"; - else if (href.includes("fate")) - presenceData.state = "Choosing a fate quest"; - else if (href.includes("scene")) presenceData.state = "In a story scene"; - } else if (href.includes("/#result")) - presenceData.details = "In a Quest result screen"; - else if (href.includes("/#raid") || href.includes("/#raid_multi")) { - const bosses = gameStatus?.boss?.param.sort( - (a, b) => parseInt(b.hpmax) - parseInt(a.hpmax) - ), - boss = bosses?.find(x => x.alive) || bosses?.[0]; + if (href.includes('/#mypage')) { + presenceData.details = 'Home page' + } + else if (href.includes('/#quest')) { + presenceData.details = 'Selecting a quest' + if (href.includes('extra')) + presenceData.state = 'Treasure Quests / Event Quest' + else if (href.includes('assist')) + presenceData.state = 'Joining a raid' + else if (href.includes('supporter')) + presenceData.state = 'Choosing a summon' + else if (href.includes('fate')) + presenceData.state = 'Choosing a fate quest' + else if (href.includes('scene')) + presenceData.state = 'In a story scene' + } + else if (href.includes('/#result')) { + presenceData.details = 'In a Quest result screen' + } + else if (href.includes('/#raid') || href.includes('/#raid_multi')) { + const bosses = gameStatus?.boss?.param.sort( + (a, b) => Number.parseInt(b.hpmax) - Number.parseInt(a.hpmax), + ) + const boss = bosses?.find(x => x.alive) || bosses?.[0] - if (boss) { - if (boss.name.ja !== boss.name.en) - presenceData.details = `${boss.name.en} (${boss.name.ja})`; - else presenceData.details = boss.name.en; + if (boss) { + if (boss.name.ja !== boss.name.en) + presenceData.details = `${boss.name.en} (${boss.name.ja})` + else presenceData.details = boss.name.en - if (gameStatus.battle?.total && gameStatus.battle?.total > 1) - presenceData.details += ` (Wave ${gameStatus.battle.count}/${gameStatus.battle.total})`; - } else { - presenceData.details = - document.querySelectorAll(".name")[0]?.textContent || - "Starting battle..."; - } + if (gameStatus.battle?.total && gameStatus.battle?.total > 1) + presenceData.details += ` (Wave ${gameStatus.battle.count}/${gameStatus.battle.total})` + } + else { + presenceData.details = document.querySelectorAll('.name')[0]?.textContent + || 'Starting battle...' + } - if (boss) { - const hp = parseInt(boss.hp), - percentage = (hp * 100) / parseInt(boss.hpmax); - if (health === 0) presenceData.state = `At ${Math.ceil(percentage)}%`; - else if (health === 1) { - presenceData.state = `${hp.toLocaleString()} [${percentage.toFixed( - 2 - )}%]`; - } - } + if (boss) { + const hp = Number.parseInt(boss.hp) + const percentage = (hp * 100) / Number.parseInt(boss.hpmax) + if (health === 0) { + presenceData.state = `At ${Math.ceil(percentage)}%` + } + else if (health === 1) { + presenceData.state = `${hp.toLocaleString()} [${percentage.toFixed( + 2, + )}%]` + } + } - if (turn && gameStatus?.turn) { - if (!presenceData.state) presenceData.state = `Turn ${gameStatus.turn}`; - else presenceData.state += ` | Turn ${gameStatus.turn}`; - } + if (turn && gameStatus?.turn) { + if (!presenceData.state) + presenceData.state = `Turn ${gameStatus.turn}` + else presenceData.state += ` | Turn ${gameStatus.turn}` + } - if (djeeta && gameStatus?.player) { - const charaAlive = gameStatus.player.param.find(x => x.leader); - if (charaAlive) { - presenceData.smallImageKey = ElementIcons[charaAlive.attr]; - presenceData.smallImageText = ElementsNames[charaAlive.attr]; - presenceData.largeImageKey = await getDjeeta( - userData.imgUri, - charaAlive.pid - ); - } - } - } else if (href.includes("/#party/index/0/npc/0")) - presenceData.details = "Viewing party"; - else if (href.includes("/#enhancement")) { - presenceData.details = "Upgrading:"; - if (href.includes("npc")) presenceData.state = "Characters"; - else if (href.includes("weapon")) presenceData.state = "Weapons"; - else if (href.includes("summon")) presenceData.state = "Summons"; - } else if (href.includes("/#evolution")) { - presenceData.details = "Uncapping:"; + if (djeeta && gameStatus?.player) { + const charaAlive = gameStatus.player.param.find(x => x.leader) + if (charaAlive) { + presenceData.smallImageKey = ElementIcons[charaAlive.attr] + presenceData.smallImageText = ElementsNames[charaAlive.attr] + presenceData.largeImageKey = await getDjeeta( + userData.imgUri, + charaAlive.pid, + ) + } + } + } + else if (href.includes('/#party/index/0/npc/0')) { + presenceData.details = 'Viewing party' + } + else if (href.includes('/#enhancement')) { + presenceData.details = 'Upgrading:' + if (href.includes('npc')) + presenceData.state = 'Characters' + else if (href.includes('weapon')) + presenceData.state = 'Weapons' + else if (href.includes('summon')) + presenceData.state = 'Summons' + } + else if (href.includes('/#evolution')) { + presenceData.details = 'Uncapping:' - if (href.includes("npc")) presenceData.state = "Characters"; - else if (href.includes("weapon")) presenceData.state = "Weapons"; - else if (href.includes("summon")) presenceData.state = "Summons"; - } else if (href.includes("/#coopraid")) { - presenceData.details = "Co-op:"; + if (href.includes('npc')) + presenceData.state = 'Characters' + else if (href.includes('weapon')) + presenceData.state = 'Weapons' + else if (href.includes('summon')) + presenceData.state = 'Summons' + } + else if (href.includes('/#coopraid')) { + presenceData.details = 'Co-op:' - if (href.includes("offer")) - presenceData.state = "Searching a raid co-op room"; - else if (href.includes("room")) presenceData.state = "In a co-op room"; - } else if (href.includes("/#lobby/room")) { - presenceData.details = "Co-op:"; - presenceData.state = "In a raid co-op room"; - } else if (href.includes("/#casino")) { - presenceData.details = "Casino:"; - presenceData.state = "Main menu"; - if (href.includes("list/poker")) presenceData.state = "Choosing poker bet"; - else if (href.includes("game/poker")) presenceData.state = "Playing poker"; - else if (href.includes("#casino/list/slot")) - presenceData.state = "Choosing slots bet"; - else if (href.includes("game/slot")) presenceData.state = "Playing slots"; - else if (href.includes("list/bingo")) - presenceData.state = "Choosing bingo bet"; - else if (href.includes("game/bingo")) presenceData.state = "Playing bingo"; - else if (href.includes("exchange")) - presenceData.state = "In the casino cage"; - else if (href.includes("rule/casino")) - presenceData.state = "Viewing casino rules"; - } else if (href.includes("/#gacha")) - presenceData.details = "In the Draw menu"; - else if (href.includes("/#profile")) - presenceData.details = "Viewing profile page"; - else if (href.includes("/#archive")) presenceData.details = "Viewing journal"; - else if (href.includes("/#title")) presenceData.details = "Viewing trophies"; - else if (href.includes("/#guild")) presenceData.details = "Viewing crew"; - else if (href.includes("/#shop")) { - presenceData.details = "Shop:"; - presenceData.state = "Main menu"; + if (href.includes('offer')) + presenceData.state = 'Searching a raid co-op room' + else if (href.includes('room')) + presenceData.state = 'In a co-op room' + } + else if (href.includes('/#lobby/room')) { + presenceData.details = 'Co-op:' + presenceData.state = 'In a raid co-op room' + } + else if (href.includes('/#casino')) { + presenceData.details = 'Casino:' + presenceData.state = 'Main menu' + if (href.includes('list/poker')) + presenceData.state = 'Choosing poker bet' + else if (href.includes('game/poker')) + presenceData.state = 'Playing poker' + else if (href.includes('#casino/list/slot')) + presenceData.state = 'Choosing slots bet' + else if (href.includes('game/slot')) + presenceData.state = 'Playing slots' + else if (href.includes('list/bingo')) + presenceData.state = 'Choosing bingo bet' + else if (href.includes('game/bingo')) + presenceData.state = 'Playing bingo' + else if (href.includes('exchange')) + presenceData.state = 'In the casino cage' + else if (href.includes('rule/casino')) + presenceData.state = 'Viewing casino rules' + } + else if (href.includes('/#gacha')) { + presenceData.details = 'In the Draw menu' + } + else if (href.includes('/#profile')) { + presenceData.details = 'Viewing profile page' + } + else if (href.includes('/#archive')) { + presenceData.details = 'Viewing journal' + } + else if (href.includes('/#title')) { + presenceData.details = 'Viewing trophies' + } + else if (href.includes('/#guild')) { + presenceData.details = 'Viewing crew' + } + else if (href.includes('/#shop')) { + presenceData.details = 'Shop:' + presenceData.state = 'Main menu' - if (href.includes("exchange/points")) presenceData.state = "Pendants shop"; - else if (href.includes("exchange/fp")) presenceData.state = "Trading FP"; - else if (href.includes("exchange/login_point")) - presenceData.state = "Trading Daily Points"; - else if (href.includes("exchange/special_ticket")) - presenceData.state = "Redeeming Siero's Special Pick Ticket"; - else if (href.includes("exchange/moon")) - presenceData.state = "Trading moons"; - else if (href.includes("exchange/trajectory")) - presenceData.state = "Journey drops"; - else if (href.includes("exchange/ceiling")) - presenceData.state = "Trading ceruleans stones"; - else if (href.includes("exchange/job_equipment")) - presenceData.state = "Crafting Class-specific equipments"; - else if (href.includes("skin/top")) presenceData.state = "Outfit shop"; - else if (href.includes("skycompass/points")) - presenceData.state = "SkyCompass points exchange"; - else if (href.includes("lupi/0")) presenceData.state = "Crystal shop"; - else if (href.includes("exchange/list")) - presenceData.state = "Treasure trading"; - else if (href.includes("passport")) - presenceData.state = "View Premium Pass"; - } else if (href.includes("/#archaic")) { - presenceData.details = "Shop:"; - presenceData.state = "Weapons Crafting"; - if (href.includes("job")) - presenceData.state = "Crafting Class Champion weapons"; - else if (href.includes("numbers")) - presenceData.state = "Crafting Revenant weapons"; - else if (href.includes("seraphic")) - presenceData.state = "Crafting Seraphic weapons"; - else if (href.includes("xeno/list")) - presenceData.state = "Crafting Xeno weapons"; - else if (href.includes("bahamut")) - presenceData.state = "Crafting Bahamut weapons"; - else if (href.includes("omega")) - presenceData.state = "Crafting Ultima weapons"; - else if (href.includes("draconic")) - presenceData.state = "Restoring Draconic weapons"; - else if (href.includes("revans")) - presenceData.state = "Rebuilding Revans weapons"; - } else if (href.includes("#arcarum2")) { - presenceData.details = "In Arcarum: The World Beyond"; - if (href.includes("enhancement")) { - presenceData.details = " Shop:"; - presenceData.state = "Crafting Arcarum summons"; - } else if (href.includes("stage") && gameStatus?.dungeonInfo) - presenceData.state = `${gameStatus.dungeonInfo.name} ${gameStatus.stageInfo.serial_floor_no}-${gameStatus.stageInfo.stage_id}`; - else if (href.includes("supporter")) - presenceData.state = "Starting a battle"; - else if (href.includes("skip")) - presenceData.state = "Undergoing a Fast Expedition"; - } else if (href.includes("/#replicard")) { - presenceData.details = "In Replicard Sandbox"; - if (gameStatus?.areaInfo) presenceData.state = gameStatus.areaInfo.name; - } else if (href.includes("/#item")) presenceData.details = "Viewing supplies"; - else if (href.includes("/#present")) presenceData.details = "Viewing Crate"; - else if (href.includes("/#list")) presenceData.details = "Viewing inventory"; - else if (href.includes("/#container")) presenceData.details = "Viewing stash"; - else if (href.includes("/#friend")) - presenceData.details = "Viewing friends list"; - else if (href.includes("/#event")) { - presenceData.details = "In event menu"; - presenceData.state = - document.querySelector("#prt-head-current")?.textContent; - } else if (href.includes("/#setting")) - presenceData.details = "Changing settings"; - else if (href.includes("/#teaser")) - presenceData.details = "Viewing event preview"; - else if (href.includes("/#sell")) - presenceData.details = "Selling weapons/summons"; - else if (href.includes("/#decompose")) - presenceData.details = "Reducing weapons/summons"; - else if (href.includes("/#recycle")) - presenceData.details = "Reserve weapons/summons"; - else if (href.includes("/#help")) presenceData.details = "Viewing help"; - else if (href.includes("/#sidestory")) - presenceData.details = "Viewing side stories"; - else if (href.includes("/#trial_battle")) - presenceData.details = "Viewing trial battles"; - else if (href.includes("/#campaign/panel")) - presenceData.details = "Viewing pinboard missions"; - else if (href.includes("/#beginnercomic")) - presenceData.details = "Reading This is Granblue Fantasy"; - else if (href.includes("/#news")) presenceData.details = "Viewing the news"; - else if (href.includes("/#comic")) - presenceData.details = "Reading Grand Blues"; - else if (href.includes("#frontier/alchemy")) - presenceData.details = "In Alchemy Lab"; + if (href.includes('exchange/points')) + presenceData.state = 'Pendants shop' + else if (href.includes('exchange/fp')) + presenceData.state = 'Trading FP' + else if (href.includes('exchange/login_point')) + presenceData.state = 'Trading Daily Points' + else if (href.includes('exchange/special_ticket')) + presenceData.state = 'Redeeming Siero\'s Special Pick Ticket' + else if (href.includes('exchange/moon')) + presenceData.state = 'Trading moons' + else if (href.includes('exchange/trajectory')) + presenceData.state = 'Journey drops' + else if (href.includes('exchange/ceiling')) + presenceData.state = 'Trading ceruleans stones' + else if (href.includes('exchange/job_equipment')) + presenceData.state = 'Crafting Class-specific equipments' + else if (href.includes('skin/top')) + presenceData.state = 'Outfit shop' + else if (href.includes('skycompass/points')) + presenceData.state = 'SkyCompass points exchange' + else if (href.includes('lupi/0')) + presenceData.state = 'Crystal shop' + else if (href.includes('exchange/list')) + presenceData.state = 'Treasure trading' + else if (href.includes('passport')) + presenceData.state = 'View Premium Pass' + } + else if (href.includes('/#archaic')) { + presenceData.details = 'Shop:' + presenceData.state = 'Weapons Crafting' + if (href.includes('job')) + presenceData.state = 'Crafting Class Champion weapons' + else if (href.includes('numbers')) + presenceData.state = 'Crafting Revenant weapons' + else if (href.includes('seraphic')) + presenceData.state = 'Crafting Seraphic weapons' + else if (href.includes('xeno/list')) + presenceData.state = 'Crafting Xeno weapons' + else if (href.includes('bahamut')) + presenceData.state = 'Crafting Bahamut weapons' + else if (href.includes('omega')) + presenceData.state = 'Crafting Ultima weapons' + else if (href.includes('draconic')) + presenceData.state = 'Restoring Draconic weapons' + else if (href.includes('revans')) + presenceData.state = 'Rebuilding Revans weapons' + } + else if (href.includes('#arcarum2')) { + presenceData.details = 'In Arcarum: The World Beyond' + if (href.includes('enhancement')) { + presenceData.details = ' Shop:' + presenceData.state = 'Crafting Arcarum summons' + } + else if (href.includes('stage') && gameStatus?.dungeonInfo) { + presenceData.state = `${gameStatus.dungeonInfo.name} ${gameStatus.stageInfo.serial_floor_no}-${gameStatus.stageInfo.stage_id}` + } + else if (href.includes('supporter')) { + presenceData.state = 'Starting a battle' + } + else if (href.includes('skip')) { + presenceData.state = 'Undergoing a Fast Expedition' + } + } + else if (href.includes('/#replicard')) { + presenceData.details = 'In Replicard Sandbox' + if (gameStatus?.areaInfo) + presenceData.state = gameStatus.areaInfo.name + } + else if (href.includes('/#item')) { + presenceData.details = 'Viewing supplies' + } + else if (href.includes('/#present')) { + presenceData.details = 'Viewing Crate' + } + else if (href.includes('/#list')) { + presenceData.details = 'Viewing inventory' + } + else if (href.includes('/#container')) { + presenceData.details = 'Viewing stash' + } + else if (href.includes('/#friend')) { + presenceData.details = 'Viewing friends list' + } + else if (href.includes('/#event')) { + presenceData.details = 'In event menu' + presenceData.state = document.querySelector('#prt-head-current')?.textContent + } + else if (href.includes('/#setting')) { + presenceData.details = 'Changing settings' + } + else if (href.includes('/#teaser')) { + presenceData.details = 'Viewing event preview' + } + else if (href.includes('/#sell')) { + presenceData.details = 'Selling weapons/summons' + } + else if (href.includes('/#decompose')) { + presenceData.details = 'Reducing weapons/summons' + } + else if (href.includes('/#recycle')) { + presenceData.details = 'Reserve weapons/summons' + } + else if (href.includes('/#help')) { + presenceData.details = 'Viewing help' + } + else if (href.includes('/#sidestory')) { + presenceData.details = 'Viewing side stories' + } + else if (href.includes('/#trial_battle')) { + presenceData.details = 'Viewing trial battles' + } + else if (href.includes('/#campaign/panel')) { + presenceData.details = 'Viewing pinboard missions' + } + else if (href.includes('/#beginnercomic')) { + presenceData.details = 'Reading This is Granblue Fantasy' + } + else if (href.includes('/#news')) { + presenceData.details = 'Viewing the news' + } + else if (href.includes('/#comic')) { + presenceData.details = 'Reading Grand Blues' + } + else if (href.includes('#frontier/alchemy')) { + presenceData.details = 'In Alchemy Lab' + } - if (userData?.userId && button) { - presenceData.buttons = [ - { - label: "Profile", - url: `${userData.baseUri}/#profile/${userData.userId}`, - }, - ]; - } + if (userData?.userId && button) { + presenceData.buttons = [ + { + label: 'Profile', + url: `${userData.baseUri}/#profile/${userData.userId}`, + }, + ] + } - presence.setActivity(presenceData); -}); + presence.setActivity(presenceData) +}) diff --git a/websites/G/Guilded.gg/metadata.json b/websites/G/Guilded.gg/metadata.json index 66eb62aeb08d..986100714679 100644 --- a/websites/G/Guilded.gg/metadata.json +++ b/websites/G/Guilded.gg/metadata.json @@ -1,24 +1,24 @@ { - "$schema": "https://schemas.premid.app/metadata/1.12", - "apiVersion": 1, - "author": { - "name": "Dominik", - "id": "594491170248458250" - }, - "service": "Guilded.gg", - "description": { - "en": "Guilded is the new standard in gaming team management. With Discord bots, Overwatch stats, Fortnite scrims, CS:GO team finder, Destiny 2 LFG, and more.", - "nl": "Guilded is de nieuwe standaard in gamingteammanagement. Met Discord-bots, Overwatch-statistieken, Fortnite-scrims, CS: GO-teamzoeker, Destiny 2 LFG en meer." - }, - "url": "www.guilded.gg", - "version": "1.3.22", - "logo": "https://cdn.rcd.gg/PreMiD/websites/G/Guilded.gg/assets/logo.png", - "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/Guilded.gg/assets/thumbnail.jpg", - "color": "#ffff00", - "category": "socials", - "tags": [ - "chat", - "guilded", - "games" - ] -} \ No newline at end of file + "$schema": "https://schemas.premid.app/metadata/1.12", + "apiVersion": 1, + "author": { + "name": "Dominik", + "id": "594491170248458250" + }, + "service": "Guilded.gg", + "description": { + "en": "Guilded is the new standard in gaming team management. With Discord bots, Overwatch stats, Fortnite scrims, CS:GO team finder, Destiny 2 LFG, and more.", + "nl": "Guilded is de nieuwe standaard in gamingteammanagement. Met Discord-bots, Overwatch-statistieken, Fortnite-scrims, CS: GO-teamzoeker, Destiny 2 LFG en meer." + }, + "url": "www.guilded.gg", + "version": "1.3.22", + "logo": "https://cdn.rcd.gg/PreMiD/websites/G/Guilded.gg/assets/logo.png", + "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/Guilded.gg/assets/thumbnail.jpg", + "color": "#ffff00", + "category": "socials", + "tags": [ + "chat", + "guilded", + "games" + ] +} diff --git a/websites/G/Guilded.gg/presence.ts b/websites/G/Guilded.gg/presence.ts index 75f8b2ed2d57..b040f5f2fe63 100644 --- a/websites/G/Guilded.gg/presence.ts +++ b/websites/G/Guilded.gg/presence.ts @@ -1,140 +1,157 @@ const presence = new Presence({ - clientId: "662634921914925056", -}); + clientId: '662634921914925056', +}) -let login; +let login -presence.on("UpdateData", () => { - const presenceData: PresenceData = { - largeImageKey: - "https://cdn.rcd.gg/PreMiD/websites/G/Guilded.gg/assets/logo.png", - }; +presence.on('UpdateData', () => { + const presenceData: PresenceData = { + largeImageKey: 'https://cdn.rcd.gg/PreMiD/websites/G/Guilded.gg/assets/logo.png', + } - if (document.location.pathname === "/") { - login = - document.querySelector( - ".GuildedText-container.GuildedText-container-type-heading1" - ) !== null; - if (login) { - presenceData.details = "Logging in to"; - presenceData.state = "Guilded.gg"; - } else { - presenceData.details = "Viewing Page:"; - presenceData.state = "Guilded Main Page"; - } - } - if (document.location.pathname.includes("/chat/")) { - presenceData.details = "Chating With"; - presenceData.state = document.querySelector( - "#app > div > div.ReorderPortalContext-container > div.GameContext-container.GameContext-container-no-game.AppV2-game-context > div.StatusContext-container.AppV2-container > div > div.LayerContext-container > div.LayerContext-layer-item-wrapper > div > div > div.LayerContext-layer-item-wrapper > div > div.ScreenHeader-container.ScreenHeader-container-desktop.ChannelHeader-container > div.SkeletonPlaceholder-container.ScreenHeader-name" - ).textContent; - } else if (document.location.pathname.includes("/teams")) { - presenceData.details = "Viewing Page:"; - presenceData.state = "Guilded Teams"; - } else if (document.location.pathname.includes("/matchmaking")) { - login = - document.querySelector( - ".MultiStageFlow-progress-bar.MultiStageProgressBar-container" - ) !== null; - if (login) { - presenceData.details = "Making A Scrim For"; - presenceData.state = document.querySelector( - "#app > div > div.ReorderPortalContext-container > div.GameContext-container.GameContext-container-no-game.AppV2-game-context > div.StatusContext-container.AppV2-container > div > div.LayerContext-container > div > div > div.MatchmakingPageV2-scrim-content > div > div > div > div.ScrimFinderTeamLabel-container.ScrimFinderTeamLabel-container-sm.FindScrimFlow-team-label > div > h1" - ).textContent; - } else { - presenceData.details = "Viewing Page:"; - presenceData.state = "Guilded Scrims"; - } - } else if (document.location.pathname.includes("/find/team")) { - presenceData.details = "Finding Team"; - presenceData.state = `Looking At ${ - document.querySelector( - "#app > div > div.ReorderPortalContext-container > div.GameContext-container.GameContext-container-no-game.AppV2-game-context > div.StatusContext-container.AppV2-container > div > div.LayerContext-container > div > div > div.IconNavMenu-container.PlayerLfgPortal-menu > div.TeamFinder-container > div > div.VoteSwiperList-container.VoteSwiperList-container-type-lfg.VoteSwiperList-container-desktop > div.VoteSwiperItem-container.VoteSwiperList-item-wrapper.VoteSwiperList-item-0.ClickAndDragControl-container.ClickAndDragControl-container-grab > div > div > div.TeamCardV2-container.TeamCardV2-container-layout-horizontal.TeamCardV2-container-no-interact.TeamCardV2-container-with-games.TeamListingCard-alias-card > div.TeamCardV2-content > div.TeamCardV2-header.TeamCardHeader-container.TeamCardHeader-container-layout-horizontal > div.TeamCardHeader-team-name-wrapper > h2" - ).textContent - }`; - } else if (document.location.pathname.includes("/find/team/status")) { - presenceData.details = "Viewing Page:"; - presenceData.state = "Teams Status"; - } else if (document.location.pathname.includes("/explore/players/")) { - presenceData.details = "Viewing Page:"; - presenceData.state = "Guilded Find Players"; - } else if (document.location.pathname.includes("/groups/")) { - if ( - document.querySelector( - ".InputControllerWrapper-container.InputControllerWrapper-container-grid.InputControllerWrapper-container-2-columns.RadiosField-panel-inputs.RadiosField-layout-horizontal" - ) !== null - ) { - presenceData.details = "Creating Channel In"; - presenceData.state = document.querySelector( - "#app > div > div.ReorderPortalContext-container > div.GameContext-container.GameContext-container-no-game.AppV2-game-context > div.StatusContext-container.AppV2-container > div > div.WebAppSidebar-container.WebAppV2-sidebar > div > div > div.TeamNavHeaderV3-container.TeamPageNavV3-header > div.TeamNavHeaderV3-content > div > div.SkeletonPlaceholder-container.TeamNavHeaderV3-team-name > h2" - ).textContent; - } else if ( - document.querySelector( - ".StatusContext-container.OptionsMenu-option-content" - ) !== null - ) { - presenceData.details = "Editing"; - presenceData.state = document.querySelector( - "#app > div > div.ReorderPortalContext-container > div.GameContext-container.GameContext-container-no-game.AppV2-game-context > div.OverlayStackProvider-container > div.PortalTarget-container.OverlayStackProvider-portal-target > span > div.StatusContext-container.Overlay-status-context > div > div.StatusContext-container.ModalV2-modal-content.ModalV2-modal-content-scrollable > div > div > div > div.OptionsMenu-options-control > div.DesktopOptionsControl-container.OptionsMenu-desktop-options-control > div > div > div.DesktopOptionsControlOptionHeader-container > div" - ).textContent; - } else if ( - document.querySelector( - ".StatusContext-container.ModalV2-modal-content.ModalV2-modal-content-scrollable" - ) !== null - ) { - presenceData.details = "Editing Status To"; - presenceData.state = document.querySelector( - "#app > div > div.ReorderPortalContext-container > div.GameContext-container.GameContext-container-no-game.AppV2-game-context > div.OverlayStackProvider-container > div.PortalTarget-container.OverlayStackProvider-portal-target > span > div.StatusContext-container.Overlay-status-context > div > div.StatusContext-container.ModalV2-modal-content.ModalV2-modal-content-scrollable > div > div > div.Editor-container.Editor-container-type-reaction.UserStatusOverlay-editor > div > div.needsclick.SlateEditor-editor.SlateEditor-editor-has-max-height > div > span > span > span" - ).textContent; - } else { - presenceData.details = "Viewing Group:"; - presenceData.state = document.querySelector( - "#app > div > div.ReorderPortalContext-container > div.GameContext-container.GameContext-container-no-game.AppV2-game-context > div.StatusContext-container.AppV2-container > div > div.WebAppSidebar-container.WebAppV2-sidebar > div > div > div.TeamNavHeaderV3-container.TeamPageNavV3-header > div.TeamNavHeaderV3-content > div > div.SkeletonPlaceholder-container.TeamNavHeaderV3-team-name > h2" - ).textContent; - } - } else if (document.location.pathname.includes("/profile/")) { - const priceEls = document.querySelectorAll( - ".GH1-container.UserProfileName-name" - ); - for (const priceEl of priceEls) { - presenceData.details = "Viewing a profile:"; - presenceData.state = priceEl.textContent; - } - } else if (document.location.pathname.includes("/games")) { - presenceData.details = "Viewing Page:"; - presenceData.state = "Game Directory"; - } else if (document.location.pathname.includes("/overview")) { - presenceData.details = "Overviewing"; - presenceData.state = document.querySelector( - "#app > div > div.ReorderPortalContext-container > div.GameContext-container.GameContext-container-no-game.AppV2-game-context > div.StatusContext-container.AppV2-container > div > div.LayerContext-container > div.LayerContext-layer-item-wrapper > div > div > div.LayerContext-container > div > div > div.TeamPageContent-content > div.TeamPlaqueV2-container.TeamPlaqueV2-container-desktop.TeamPageContent-team-plaque > div.SkeletonPlaceholder-container.TeamPlaqueV2-name-placeholder > h1" - ).textContent; - } else if (document.location.pathname.includes("/members")) { - presenceData.details = "Viewing Members In"; - presenceData.state = document.querySelector( - "#app > div > div.ReorderPortalContext-container > div.GameContext-container.GameContext-container-no-game.AppV2-game-context > div.StatusContext-container.AppV2-container > div > div.WebAppSidebar-container.WebAppV2-sidebar > div > div > div.TeamNavHeaderV3-container.TeamPageNavV3-header > div.TeamNavHeaderV3-content > div > div.SkeletonPlaceholder-container.TeamNavHeaderV3-team-name > h2" - ).textContent; - } else if (document.location.pathname.includes("/recruitment")) { - presenceData.details = "Viewing Team Aplications In"; - presenceData.state = document.querySelector( - "#app > div > div.ReorderPortalContext-container > div.GameContext-container.GameContext-container-no-game.AppV2-game-context > div.StatusContext-container.AppV2-container > div > div.WebAppSidebar-container.WebAppV2-sidebar > div > div > div.TeamNavHeaderV3-container.TeamPageNavV3-header > div.TeamNavHeaderV3-content > div > div.SkeletonPlaceholder-container.TeamNavHeaderV3-team-name > h2" - ).textContent; - } else if (document.location.pathname.includes("/audit")) { - presenceData.details = "Viewing Audit Logs In"; - presenceData.state = document.querySelector( - "#app > div > div.ReorderPortalContext-container > div.GameContext-container.GameContext-container-no-game.AppV2-game-context > div.StatusContext-container.AppV2-container > div > div.WebAppSidebar-container.WebAppV2-sidebar > div > div > div.TeamNavHeaderV3-container.TeamPageNavV3-header > div.TeamNavHeaderV3-content > div > div.SkeletonPlaceholder-container.TeamNavHeaderV3-team-name > h2" - ).textContent; - } else if (document.location.pathname.includes("/matches")) { - presenceData.details = "Viewing Matches In"; - presenceData.state = document.querySelector( - "#app > div > div.ReorderPortalContext-container > div.GameContext-container.GameContext-container-no-game.AppV2-game-context > div.StatusContext-container.AppV2-container > div > div.WebAppSidebar-container.WebAppV2-sidebar > div > div > div.TeamNavHeaderV3-container.TeamPageNavV3-header > div.TeamNavHeaderV3-content > div > div.SkeletonPlaceholder-container.TeamNavHeaderV3-team-name > h2" - ).textContent; - } else if (document.location.pathname.includes("/insights")) { - presenceData.details = "Viewing Team Stats In"; - presenceData.state = document.querySelector( - "#app > div > div.ReorderPortalContext-container > div.GameContext-container.GameContext-container-no-game.AppV2-game-context > div.StatusContext-container.AppV2-container > div > div.WebAppSidebar-container.WebAppV2-sidebar > div > div > div.TeamNavHeaderV3-container.TeamPageNavV3-header > div.TeamNavHeaderV3-content > div > div.SkeletonPlaceholder-container.TeamNavHeaderV3-team-name > h2" - ).textContent; - } + if (document.location.pathname === '/') { + login = document.querySelector( + '.GuildedText-container.GuildedText-container-type-heading1', + ) !== null + if (login) { + presenceData.details = 'Logging in to' + presenceData.state = 'Guilded.gg' + } + else { + presenceData.details = 'Viewing Page:' + presenceData.state = 'Guilded Main Page' + } + } + if (document.location.pathname.includes('/chat/')) { + presenceData.details = 'Chating With' + presenceData.state = document.querySelector( + '#app > div > div.ReorderPortalContext-container > div.GameContext-container.GameContext-container-no-game.AppV2-game-context > div.StatusContext-container.AppV2-container > div > div.LayerContext-container > div.LayerContext-layer-item-wrapper > div > div > div.LayerContext-layer-item-wrapper > div > div.ScreenHeader-container.ScreenHeader-container-desktop.ChannelHeader-container > div.SkeletonPlaceholder-container.ScreenHeader-name', + )?.textContent + } + else if (document.location.pathname.includes('/teams')) { + presenceData.details = 'Viewing Page:' + presenceData.state = 'Guilded Teams' + } + else if (document.location.pathname.includes('/matchmaking')) { + login = document.querySelector( + '.MultiStageFlow-progress-bar.MultiStageProgressBar-container', + ) !== null + if (login) { + presenceData.details = 'Making A Scrim For' + presenceData.state = document.querySelector( + '#app > div > div.ReorderPortalContext-container > div.GameContext-container.GameContext-container-no-game.AppV2-game-context > div.StatusContext-container.AppV2-container > div > div.LayerContext-container > div > div > div.MatchmakingPageV2-scrim-content > div > div > div > div.ScrimFinderTeamLabel-container.ScrimFinderTeamLabel-container-sm.FindScrimFlow-team-label > div > h1', + )?.textContent + } + else { + presenceData.details = 'Viewing Page:' + presenceData.state = 'Guilded Scrims' + } + } + else if (document.location.pathname.includes('/find/team')) { + presenceData.details = 'Finding Team' + presenceData.state = `Looking At ${ + document.querySelector( + '#app > div > div.ReorderPortalContext-container > div.GameContext-container.GameContext-container-no-game.AppV2-game-context > div.StatusContext-container.AppV2-container > div > div.LayerContext-container > div > div > div.IconNavMenu-container.PlayerLfgPortal-menu > div.TeamFinder-container > div > div.VoteSwiperList-container.VoteSwiperList-container-type-lfg.VoteSwiperList-container-desktop > div.VoteSwiperItem-container.VoteSwiperList-item-wrapper.VoteSwiperList-item-0.ClickAndDragControl-container.ClickAndDragControl-container-grab > div > div > div.TeamCardV2-container.TeamCardV2-container-layout-horizontal.TeamCardV2-container-no-interact.TeamCardV2-container-with-games.TeamListingCard-alias-card > div.TeamCardV2-content > div.TeamCardV2-header.TeamCardHeader-container.TeamCardHeader-container-layout-horizontal > div.TeamCardHeader-team-name-wrapper > h2', + )?.textContent + }` + } + else if (document.location.pathname.includes('/find/team/status')) { + presenceData.details = 'Viewing Page:' + presenceData.state = 'Teams Status' + } + else if (document.location.pathname.includes('/explore/players/')) { + presenceData.details = 'Viewing Page:' + presenceData.state = 'Guilded Find Players' + } + else if (document.location.pathname.includes('/groups/')) { + if ( + document.querySelector( + '.InputControllerWrapper-container.InputControllerWrapper-container-grid.InputControllerWrapper-container-2-columns.RadiosField-panel-inputs.RadiosField-layout-horizontal', + ) !== null + ) { + presenceData.details = 'Creating Channel In' + presenceData.state = document.querySelector( + '#app > div > div.ReorderPortalContext-container > div.GameContext-container.GameContext-container-no-game.AppV2-game-context > div.StatusContext-container.AppV2-container > div > div.WebAppSidebar-container.WebAppV2-sidebar > div > div > div.TeamNavHeaderV3-container.TeamPageNavV3-header > div.TeamNavHeaderV3-content > div > div.SkeletonPlaceholder-container.TeamNavHeaderV3-team-name > h2', + )?.textContent + } + else if ( + document.querySelector( + '.StatusContext-container.OptionsMenu-option-content', + ) !== null + ) { + presenceData.details = 'Editing' + presenceData.state = document.querySelector( + '#app > div > div.ReorderPortalContext-container > div.GameContext-container.GameContext-container-no-game.AppV2-game-context > div.OverlayStackProvider-container > div.PortalTarget-container.OverlayStackProvider-portal-target > span > div.StatusContext-container.Overlay-status-context > div > div.StatusContext-container.ModalV2-modal-content.ModalV2-modal-content-scrollable > div > div > div > div.OptionsMenu-options-control > div.DesktopOptionsControl-container.OptionsMenu-desktop-options-control > div > div > div.DesktopOptionsControlOptionHeader-container > div', + )?.textContent + } + else if ( + document.querySelector( + '.StatusContext-container.ModalV2-modal-content.ModalV2-modal-content-scrollable', + ) !== null + ) { + presenceData.details = 'Editing Status To' + presenceData.state = document.querySelector( + '#app > div > div.ReorderPortalContext-container > div.GameContext-container.GameContext-container-no-game.AppV2-game-context > div.OverlayStackProvider-container > div.PortalTarget-container.OverlayStackProvider-portal-target > span > div.StatusContext-container.Overlay-status-context > div > div.StatusContext-container.ModalV2-modal-content.ModalV2-modal-content-scrollable > div > div > div.Editor-container.Editor-container-type-reaction.UserStatusOverlay-editor > div > div.needsclick.SlateEditor-editor.SlateEditor-editor-has-max-height > div > span > span > span', + )?.textContent + } + else { + presenceData.details = 'Viewing Group:' + presenceData.state = document.querySelector( + '#app > div > div.ReorderPortalContext-container > div.GameContext-container.GameContext-container-no-game.AppV2-game-context > div.StatusContext-container.AppV2-container > div > div.WebAppSidebar-container.WebAppV2-sidebar > div > div > div.TeamNavHeaderV3-container.TeamPageNavV3-header > div.TeamNavHeaderV3-content > div > div.SkeletonPlaceholder-container.TeamNavHeaderV3-team-name > h2', + )?.textContent + } + } + else if (document.location.pathname.includes('/profile/')) { + const priceEls = document.querySelectorAll( + '.GH1-container.UserProfileName-name', + ) + for (const priceEl of priceEls) { + presenceData.details = 'Viewing a profile:' + presenceData.state = priceEl.textContent + } + } + else if (document.location.pathname.includes('/games')) { + presenceData.details = 'Viewing Page:' + presenceData.state = 'Game Directory' + } + else if (document.location.pathname.includes('/overview')) { + presenceData.details = 'Overviewing' + presenceData.state = document.querySelector( + '#app > div > div.ReorderPortalContext-container > div.GameContext-container.GameContext-container-no-game.AppV2-game-context > div.StatusContext-container.AppV2-container > div > div.LayerContext-container > div.LayerContext-layer-item-wrapper > div > div > div.LayerContext-container > div > div > div.TeamPageContent-content > div.TeamPlaqueV2-container.TeamPlaqueV2-container-desktop.TeamPageContent-team-plaque > div.SkeletonPlaceholder-container.TeamPlaqueV2-name-placeholder > h1', + )?.textContent + } + else if (document.location.pathname.includes('/members')) { + presenceData.details = 'Viewing Members In' + presenceData.state = document.querySelector( + '#app > div > div.ReorderPortalContext-container > div.GameContext-container.GameContext-container-no-game.AppV2-game-context > div.StatusContext-container.AppV2-container > div > div.WebAppSidebar-container.WebAppV2-sidebar > div > div > div.TeamNavHeaderV3-container.TeamPageNavV3-header > div.TeamNavHeaderV3-content > div > div.SkeletonPlaceholder-container.TeamNavHeaderV3-team-name > h2', + )?.textContent + } + else if (document.location.pathname.includes('/recruitment')) { + presenceData.details = 'Viewing Team Aplications In' + presenceData.state = document.querySelector( + '#app > div > div.ReorderPortalContext-container > div.GameContext-container.GameContext-container-no-game.AppV2-game-context > div.StatusContext-container.AppV2-container > div > div.WebAppSidebar-container.WebAppV2-sidebar > div > div > div.TeamNavHeaderV3-container.TeamPageNavV3-header > div.TeamNavHeaderV3-content > div > div.SkeletonPlaceholder-container.TeamNavHeaderV3-team-name > h2', + )?.textContent + } + else if (document.location.pathname.includes('/audit')) { + presenceData.details = 'Viewing Audit Logs In' + presenceData.state = document.querySelector( + '#app > div > div.ReorderPortalContext-container > div.GameContext-container.GameContext-container-no-game.AppV2-game-context > div.StatusContext-container.AppV2-container > div > div.WebAppSidebar-container.WebAppV2-sidebar > div > div > div.TeamNavHeaderV3-container.TeamPageNavV3-header > div.TeamNavHeaderV3-content > div > div.SkeletonPlaceholder-container.TeamNavHeaderV3-team-name > h2', + )?.textContent + } + else if (document.location.pathname.includes('/matches')) { + presenceData.details = 'Viewing Matches In' + presenceData.state = document.querySelector( + '#app > div > div.ReorderPortalContext-container > div.GameContext-container.GameContext-container-no-game.AppV2-game-context > div.StatusContext-container.AppV2-container > div > div.WebAppSidebar-container.WebAppV2-sidebar > div > div > div.TeamNavHeaderV3-container.TeamPageNavV3-header > div.TeamNavHeaderV3-content > div > div.SkeletonPlaceholder-container.TeamNavHeaderV3-team-name > h2', + )?.textContent + } + else if (document.location.pathname.includes('/insights')) { + presenceData.details = 'Viewing Team Stats In' + presenceData.state = document.querySelector( + '#app > div > div.ReorderPortalContext-container > div.GameContext-container.GameContext-container-no-game.AppV2-game-context > div.StatusContext-container.AppV2-container > div > div.WebAppSidebar-container.WebAppV2-sidebar > div > div > div.TeamNavHeaderV3-container.TeamPageNavV3-header > div.TeamNavHeaderV3-content > div > div.SkeletonPlaceholder-container.TeamNavHeaderV3-team-name > h2', + )?.textContent + } - if (presenceData.details) presence.setActivity(presenceData); - else presence.setActivity(); -}); + if (presenceData.details) + presence.setActivity(presenceData) + else presence.setActivity() +}) diff --git a/websites/G/Gunivers/metadata.json b/websites/G/Gunivers/metadata.json index ffd829326187..050edf3fb92a 100644 --- a/websites/G/Gunivers/metadata.json +++ b/websites/G/Gunivers/metadata.json @@ -1,45 +1,45 @@ { - "$schema": "https://schemas.premid.app/metadata/1.12", - "apiVersion": 1, - "author": { - "name": "fantomitechno 🦊", - "id": "563749920683720709" - }, - "service": "Gunivers", - "description": { - "fr": "Gunivers est une communauté autour de minecraft d'origine française, mais à destination d'un public français ou international selon les projets.", - "en": "Gunivers is a minecraft community of French origin, but intended for a french or international audience depending of the project.", - "nl": "Gunivers is een communautair autour de minecraft d'origine française, met een bestemming van een openbare français of internationale selon les projets." - }, - "url": [ - "gunivers.net", - "project.gunivers.net" - ], - "version": "1.2.22", - "logo": "https://cdn.rcd.gg/PreMiD/websites/G/Gunivers/assets/logo.png", - "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/Gunivers/assets/thumbnail.png", - "color": "#FF8C39", - "category": "games", - "tags": [ - "community", - "gunivers", - "minecraft" - ], - "settings": [ - { - "id": "privacy", - "title": "Privacy Mode", - "icon": "fad fa-user-secret", - "value": false - }, - { - "id": "button", - "if": { - "privacy": false - }, - "title": "Add Button", - "icon": "fas fa-compress-arrows-alt", - "value": true - } - ] -} \ No newline at end of file + "$schema": "https://schemas.premid.app/metadata/1.12", + "apiVersion": 1, + "author": { + "name": "fantomitechno 🦊", + "id": "563749920683720709" + }, + "service": "Gunivers", + "description": { + "fr": "Gunivers est une communauté autour de minecraft d'origine française, mais à destination d'un public français ou international selon les projets.", + "en": "Gunivers is a minecraft community of French origin, but intended for a french or international audience depending of the project.", + "nl": "Gunivers is een communautair autour de minecraft d'origine française, met een bestemming van een openbare français of internationale selon les projets." + }, + "url": [ + "gunivers.net", + "project.gunivers.net" + ], + "version": "1.2.22", + "logo": "https://cdn.rcd.gg/PreMiD/websites/G/Gunivers/assets/logo.png", + "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/Gunivers/assets/thumbnail.png", + "color": "#FF8C39", + "category": "games", + "tags": [ + "community", + "gunivers", + "minecraft" + ], + "settings": [ + { + "id": "privacy", + "title": "Privacy Mode", + "icon": "fad fa-user-secret", + "value": false + }, + { + "id": "button", + "if": { + "privacy": false + }, + "title": "Add Button", + "icon": "fas fa-compress-arrows-alt", + "value": true + } + ] +} diff --git a/websites/G/Gunivers/presence.ts b/websites/G/Gunivers/presence.ts index 59d098bb3e4b..ca18b5a34035 100644 --- a/websites/G/Gunivers/presence.ts +++ b/websites/G/Gunivers/presence.ts @@ -1,148 +1,162 @@ const presence = new Presence({ - clientId: "723474173208297532", - }), - browsingTimestamp = Math.floor(Date.now() / 1000); + clientId: '723474173208297532', +}) +const browsingTimestamp = Math.floor(Date.now() / 1000) -presence.on("UpdateData", async () => { - const presenceData: PresenceData = { - largeImageKey: - "https://cdn.rcd.gg/PreMiD/websites/G/Gunivers/assets/logo.png", - startTimestamp: browsingTimestamp, - }, - privacy = await presence.getSetting("privacy"), - button = await presence.getSetting("button"); +presence.on('UpdateData', async () => { + const presenceData: PresenceData = { + largeImageKey: 'https://cdn.rcd.gg/PreMiD/websites/G/Gunivers/assets/logo.png', + startTimestamp: browsingTimestamp, + } + const privacy = await presence.getSetting('privacy') + const button = await presence.getSetting('button') - if (privacy) presenceData.details = "Browsing"; - else if (document.location.hostname === "gunivers.net") { - if (window.location.pathname.startsWith("/articles")) { - presenceData.details = "Viewing a page:"; - presenceData.state = "Activities"; - } else if (window.location.pathname.startsWith("/category/")) { - presenceData.details = "Searching an article:"; - presenceData.state = `in category ${document.title.replace( - " | Gunivers", - "" - )}`; - if (window.location.pathname.endsWith("category/chronique/")) { - presenceData.details = "Viewing a page:"; - presenceData.state = "Chronicles"; - } - } else if (window.location.pathname.startsWith("/chronique-mensuelle-")) { - presenceData.details = "Reading a chronicle"; - presenceData.state = document.title - .replace(" | Gunivers", "") - .replace("Chronique Mensuelle - ", ""); - if (button) { - presenceData.buttons = [ - { - label: "View chronicle", - url: document.URL, - }, - ]; - } - } else if ( - window.location.pathname.endsWith("/a-propos/") || - window.location.pathname.endsWith("/about-us/") - ) { - presenceData.details = "Viewing a page:"; - presenceData.state = "About us"; - } else if ( - window.location.pathname.endsWith("/contact-us/") || - window.location.pathname.endsWith("/contactez-nous/") - ) { - presenceData.details = "Viewing a page:"; - presenceData.state = "Contact us"; - } else if ( - window.location.pathname.endsWith("/histoire/") || - window.location.pathname.endsWith("/history/") - ) { - presenceData.details = "Viewing a page:"; - presenceData.state = "Contact us"; - } else if ( - window.location.pathname.endsWith("/affiliation-program/") || - window.location.pathname.endsWith("/programme-daffiliation/") - ) { - presenceData.details = "Viewing a page:"; - presenceData.state = "Affiliation program"; - } else if ( - window.location.pathname.endsWith("/equipes/") || - window.location.pathname.endsWith("/teams/") - ) { - presenceData.details = "Viewing a page:"; - presenceData.state = "Affiliated teams"; - } else if ( - window.location.pathname.endsWith("/partners/") || - window.location.pathname.endsWith("/partenaires/") - ) { - presenceData.details = "Viewing a page:"; - presenceData.state = "Our partners"; - } else if ( - window.location.pathname.startsWith("/") && - window.location.pathname.length !== 1 && - !window.location.pathname.startsWith("/home") - ) { - presenceData.details = "Reading an article:"; - presenceData.state = document.title.replace(" | Gunivers", ""); - if (button) { - presenceData.buttons = [ - { - label: "View article", - url: document.URL, - }, - ]; - } - if (window.location.pathname.includes("/author/")) { - presenceData.details = "Looking for an user:"; - presenceData.state = document.title.replace(" | Gunivers", ""); - if (button) { - presenceData.buttons = [ - { - label: "View user", - url: document.URL, - }, - ]; - } - } - } else if ( - window.location.pathname.length === 1 || - window.location.pathname.startsWith("/home") - ) { - presenceData.details = "Viewing a page:"; - presenceData.state = "Home"; - } - } else if (document.location.hostname === "project.gunivers.net") { - presenceData.smallImageKey = - "https://cdn.rcd.gg/PreMiD/websites/G/Gunivers/assets/0.png"; - presenceData.details = "Viewing a page:"; - presenceData.state = "Gunivers Workspace"; - if (window.location.pathname.endsWith("/projects")) { - presenceData.details = "Searching a project:"; - presenceData.state = "on Gunivers Workspace"; - } else if (window.location.pathname.startsWith("/projects/")) { - presenceData.details = "Reading a project:"; - [, presenceData.state] = document.title.split(" - "); - if (button) { - presenceData.buttons = [ - { - label: "View project", - url: document.URL, - }, - ]; - } - } else if (window.location.pathname.startsWith("/users/")) { - presenceData.details = "Looking for an user:"; - presenceData.state = document.querySelector("#content > h2").textContent; - if (button) { - presenceData.buttons = [ - { - label: "View user", - url: document.URL, - }, - ]; - } - } - } + if (privacy) { + presenceData.details = 'Browsing' + } + else if (document.location.hostname === 'gunivers.net') { + if (window.location.pathname.startsWith('/articles')) { + presenceData.details = 'Viewing a page:' + presenceData.state = 'Activities' + } + else if (window.location.pathname.startsWith('/category/')) { + presenceData.details = 'Searching an article:' + presenceData.state = `in category ${document.title.replace( + ' | Gunivers', + '', + )}` + if (window.location.pathname.endsWith('category/chronique/')) { + presenceData.details = 'Viewing a page:' + presenceData.state = 'Chronicles' + } + } + else if (window.location.pathname.startsWith('/chronique-mensuelle-')) { + presenceData.details = 'Reading a chronicle' + presenceData.state = document.title + .replace(' | Gunivers', '') + .replace('Chronique Mensuelle - ', '') + if (button) { + presenceData.buttons = [ + { + label: 'View chronicle', + url: document.URL, + }, + ] + } + } + else if ( + window.location.pathname.endsWith('/a-propos/') + || window.location.pathname.endsWith('/about-us/') + ) { + presenceData.details = 'Viewing a page:' + presenceData.state = 'About us' + } + else if ( + window.location.pathname.endsWith('/contact-us/') + || window.location.pathname.endsWith('/contactez-nous/') + ) { + presenceData.details = 'Viewing a page:' + presenceData.state = 'Contact us' + } + else if ( + window.location.pathname.endsWith('/histoire/') + || window.location.pathname.endsWith('/history/') + ) { + presenceData.details = 'Viewing a page:' + presenceData.state = 'Contact us' + } + else if ( + window.location.pathname.endsWith('/affiliation-program/') + || window.location.pathname.endsWith('/programme-daffiliation/') + ) { + presenceData.details = 'Viewing a page:' + presenceData.state = 'Affiliation program' + } + else if ( + window.location.pathname.endsWith('/equipes/') + || window.location.pathname.endsWith('/teams/') + ) { + presenceData.details = 'Viewing a page:' + presenceData.state = 'Affiliated teams' + } + else if ( + window.location.pathname.endsWith('/partners/') + || window.location.pathname.endsWith('/partenaires/') + ) { + presenceData.details = 'Viewing a page:' + presenceData.state = 'Our partners' + } + else if ( + window.location.pathname.startsWith('/') + && window.location.pathname.length !== 1 + && !window.location.pathname.startsWith('/home') + ) { + presenceData.details = 'Reading an article:' + presenceData.state = document.title.replace(' | Gunivers', '') + if (button) { + presenceData.buttons = [ + { + label: 'View article', + url: document.URL, + }, + ] + } + if (window.location.pathname.includes('/author/')) { + presenceData.details = 'Looking for an user:' + presenceData.state = document.title.replace(' | Gunivers', '') + if (button) { + presenceData.buttons = [ + { + label: 'View user', + url: document.URL, + }, + ] + } + } + } + else if ( + window.location.pathname.length === 1 + || window.location.pathname.startsWith('/home') + ) { + presenceData.details = 'Viewing a page:' + presenceData.state = 'Home' + } + } + else if (document.location.hostname === 'project.gunivers.net') { + presenceData.smallImageKey = 'https://cdn.rcd.gg/PreMiD/websites/G/Gunivers/assets/0.png' + presenceData.details = 'Viewing a page:' + presenceData.state = 'Gunivers Workspace' + if (window.location.pathname.endsWith('/projects')) { + presenceData.details = 'Searching a project:' + presenceData.state = 'on Gunivers Workspace' + } + else if (window.location.pathname.startsWith('/projects/')) { + presenceData.details = 'Reading a project:'; + [, presenceData.state] = document.title.split(' - ') + if (button) { + presenceData.buttons = [ + { + label: 'View project', + url: document.URL, + }, + ] + } + } + else if (window.location.pathname.startsWith('/users/')) { + presenceData.details = 'Looking for an user:' + presenceData.state = document.querySelector('#content > h2')?.textContent + if (button) { + presenceData.buttons = [ + { + label: 'View user', + url: document.URL, + }, + ] + } + } + } - if (presenceData.details) presence.setActivity(presenceData); - else presence.setActivity(); -}); + if (presenceData.details) + presence.setActivity(presenceData) + else presence.setActivity() +}) diff --git a/websites/G/galaxy/metadata.json b/websites/G/galaxy/metadata.json index 03471a0f9009..b4bcb6e40661 100644 --- a/websites/G/galaxy/metadata.json +++ b/websites/G/galaxy/metadata.json @@ -1,39 +1,39 @@ { - "$schema": "https://schemas.premid.app/metadata/1.12", - "apiVersion": 1, - "author": { - "id": "259840591393718274", - "name": "wackbyte" - }, - "service": "galaxy", - "description": { - "en": "Galaxy is a free and open source website for finding and playing incremental games, although not exclusively. It has social features such as chatting, private messaging, and forums. It has no forced ads, no trackers, no paywalls, and it never will." - }, - "url": "galaxy.click", - "version": "1.0.4", - "logo": "https://cdn.rcd.gg/PreMiD/websites/G/galaxy/assets/logo.png", - "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/galaxy/assets/thumbnail.png", - "color": "#481148", - "category": "games", - "tags": [ - "chat", - "community", - "forums", - "games", - "incremental" - ], - "settings": [ - { - "id": "timestamp", - "title": "Show elapsed time", - "icon": "fad fa-hourglass-half", - "value": true - }, - { - "id": "buttons", - "title": "Show buttons", - "icon": "fas fa-compress-arrows-alt", - "value": true - } - ] -} \ No newline at end of file + "$schema": "https://schemas.premid.app/metadata/1.12", + "apiVersion": 1, + "author": { + "id": "259840591393718274", + "name": "wackbyte" + }, + "service": "galaxy", + "description": { + "en": "Galaxy is a free and open source website for finding and playing incremental games, although not exclusively. It has social features such as chatting, private messaging, and forums. It has no forced ads, no trackers, no paywalls, and it never will." + }, + "url": "galaxy.click", + "version": "1.0.4", + "logo": "https://cdn.rcd.gg/PreMiD/websites/G/galaxy/assets/logo.png", + "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/galaxy/assets/thumbnail.png", + "color": "#481148", + "category": "games", + "tags": [ + "chat", + "community", + "forums", + "games", + "incremental" + ], + "settings": [ + { + "id": "timestamp", + "title": "Show elapsed time", + "icon": "fad fa-hourglass-half", + "value": true + }, + { + "id": "buttons", + "title": "Show buttons", + "icon": "fas fa-compress-arrows-alt", + "value": true + } + ] +} diff --git a/websites/G/galaxy/presence.ts b/websites/G/galaxy/presence.ts index e5f8390efdff..2c0df6be88c2 100644 --- a/websites/G/galaxy/presence.ts +++ b/websites/G/galaxy/presence.ts @@ -1,433 +1,427 @@ const presence = new Presence({ - clientId: "1122404044829380739", - }), - browsingTimestamp = Math.floor(Date.now() / 1000); + clientId: '1122404044829380739', +}) +const browsingTimestamp = Math.floor(Date.now() / 1000) -presence.on("UpdateData", async () => { - const presenceData: PresenceData = { - largeImageKey: - "https://cdn.rcd.gg/PreMiD/websites/G/galaxy/assets/logo.png", - startTimestamp: browsingTimestamp, - }, - { href, pathname } = document.location, - path = pathname.slice(1).split("/"), - [showTimestamp, showButtons] = await Promise.all([ - presence.getSetting("timestamp"), - presence.getSetting("buttons"), - ]); +presence.on('UpdateData', async () => { + const presenceData: PresenceData = { + largeImageKey: 'https://cdn.rcd.gg/PreMiD/websites/G/galaxy/assets/logo.png', + startTimestamp: browsingTimestamp, + } + const { href, pathname } = document.location + const path = pathname.slice(1).split('/') + const [showTimestamp, showButtons] = await Promise.all([ + presence.getSetting('timestamp'), + presence.getSetting('buttons'), + ]) - switch (path[0]) { - case "": { - presenceData.details = "Viewing the front page"; - break; - } - // Game pages - case "play": { - if (path[1]) { - const gameName = - document.querySelector( - "#game-title" - )?.textContent, - currentLevel = document.querySelector( - "#progress > .level > span" - )?.textContent, - // "N / D" - xpRatio = document.querySelector( - "#progress > .xp > span" - )?.textContent; + switch (path[0]) { + case '': { + presenceData.details = 'Viewing the front page' + break + } + // Game pages + case 'play': { + if (path[1]) { + const gameName = document.querySelector( + '#game-title', + )?.textContent + const currentLevel = document.querySelector( + '#progress > .level > span', + )?.textContent + // "N / D" + const xpRatio = document.querySelector( + '#progress > .xp > span', + )?.textContent - presenceData.details = gameName - ? `Playing ${gameName}` - : "Playing a game"; - if (currentLevel && xpRatio) { - const [currentXP, neededXP] = xpRatio.split("/").map(n => n.trim()); + presenceData.details = gameName + ? `Playing ${gameName}` + : 'Playing a game' + if (currentLevel && xpRatio) { + const [currentXP, neededXP] = xpRatio.split('/').map(n => n.trim()) - presenceData.state = `Level ${currentLevel} | ${currentXP}/${neededXP} XP`; - } - presenceData.buttons = [ - { - label: "Play Game", - url: href, - }, - ]; - } - break; - } - case "edit": { - if (path[1]) { - const gameName = document.querySelector( - "#container > h1 > a" - )?.textContent; + presenceData.state = `Level ${currentLevel} | ${currentXP}/${neededXP} XP` + } + presenceData.buttons = [ + { + label: 'Play Game', + url: href, + }, + ] + } + break + } + case 'edit': { + if (path[1]) { + const gameName = document.querySelector( + '#container > h1 > a', + )?.textContent - presenceData.details = gameName - ? `Editing ${gameName}` - : "Editing a game"; - presenceData.buttons = [ - { - label: "Play Game", - url: href, - }, - ]; - } - break; - } - case "publish": { - const gameName = document.querySelector( - 'div[data-label="game name"] > input' - )?.value; + presenceData.details = gameName + ? `Editing ${gameName}` + : 'Editing a game' + presenceData.buttons = [ + { + label: 'Play Game', + url: href, + }, + ] + } + break + } + case 'publish': { + const gameName = document.querySelector( + 'div[data-label="game name"] > input', + )?.value - presenceData.details = "Publishing a new game"; - if (gameName) presenceData.state = `"${gameName}"`; - break; - } - case "manage": { - presenceData.details = "Managing their games"; - break; - } - case "comments": { - if (path[1]) { - presenceData.details = "Reading game comments"; - presenceData.buttons = [ - { - label: "Read Comments", - url: href, - }, - ]; - } - break; - } - case "updates": { - if (path[1]) { - presenceData.details = "Reading game updates"; - presenceData.buttons = [ - { - label: "Read Updates", - url: href, - }, - ]; - } - break; - } - // User pages - case "user": { - if (path[1]) { - const username = - document.querySelector( - "#big-username" - )?.textContent; + presenceData.details = 'Publishing a new game' + if (gameName) + presenceData.state = `"${gameName}"` + break + } + case 'manage': { + presenceData.details = 'Managing their games' + break + } + case 'comments': { + if (path[1]) { + presenceData.details = 'Reading game comments' + presenceData.buttons = [ + { + label: 'Read Comments', + url: href, + }, + ] + } + break + } + case 'updates': { + if (path[1]) { + presenceData.details = 'Reading game updates' + presenceData.buttons = [ + { + label: 'Read Updates', + url: href, + }, + ] + } + break + } + // User pages + case 'user': { + if (path[1]) { + const username = document.querySelector( + '#big-username', + )?.textContent - presenceData.details = username - ? `Viewing ${username}'s profile` - : "Viewing a profile"; - presenceData.buttons = [ - { - label: "View Profile", - url: href, - }, - ]; - } - break; - } - case "you": { - presenceData.details = "Editing their profile"; - break; - } - case "themes": { - const lightTheme = document.querySelector( - '#t-light > button[disabled=""]' - )?.textContent, - darkTheme = document.querySelector( - '#t-dark > button[disabled=""]' - )?.textContent; + presenceData.details = username + ? `Viewing ${username}'s profile` + : 'Viewing a profile' + presenceData.buttons = [ + { + label: 'View Profile', + url: href, + }, + ] + } + break + } + case 'you': { + presenceData.details = 'Editing their profile' + break + } + case 'themes': { + const lightTheme = document.querySelector( + '#t-light > button[disabled=""]', + )?.textContent + const darkTheme = document.querySelector( + '#t-dark > button[disabled=""]', + )?.textContent - presenceData.details = "Choosing themes"; - if (lightTheme && darkTheme) - presenceData.state = `☀️ ${lightTheme} 🌙 ${darkTheme}`; - break; - } - case "theme-preview": { - presenceData.details = "Previewing a theme"; - break; - } - case "filters": { - presenceData.details = "Choosing site-wide filters"; - break; - } - case "level": { - // NOTE: The level and XP counters are animated to rise to their actual values once the page is opened. - // which doesn't look good when shown in the presence. + presenceData.details = 'Choosing themes' + if (lightTheme && darkTheme) + presenceData.state = `☀️ ${lightTheme} 🌙 ${darkTheme}` + break + } + case 'theme-preview': { + presenceData.details = 'Previewing a theme' + break + } + case 'filters': { + presenceData.details = 'Choosing site-wide filters' + break + } + case 'level': { + // NOTE: The level and XP counters are animated to rise to their actual values once the page is opened. + // which doesn't look good when shown in the presence. - presenceData.details = "Viewing their level progression"; - break; - } - case "playtime": { - presenceData.details = "Viewing their total playtime"; - break; - } - case "favorites": { - presenceData.details = "Viewing their favorite games"; - break; - } - case "inbox": { - const unreadMessageCount = - document.querySelectorAll("#sidebar > .unread").length; + presenceData.details = 'Viewing their level progression' + break + } + case 'playtime': { + presenceData.details = 'Viewing their total playtime' + break + } + case 'favorites': { + presenceData.details = 'Viewing their favorite games' + break + } + case 'inbox': { + const unreadMessageCount = document.querySelectorAll('#sidebar > .unread').length - presenceData.details = "Checking their inbox"; - presenceData.state = `${unreadMessageCount} unread message${ - unreadMessageCount === 1 ? "" : "s" - }`; - break; - } - // Chat & forums - case "chat": { - const channel = path[1]; + presenceData.details = 'Checking their inbox' + presenceData.state = `${unreadMessageCount} unread message${ + unreadMessageCount === 1 ? '' : 's' + }` + break + } + // Chat & forums + case 'chat': { + const channel = path[1] - if (channel) { - const onlineAnonsElem = - document.querySelector("#anon-count"); + if (channel) { + const onlineAnonsElem = document.querySelector('#anon-count') - presenceData.details = `Chatting in #${channel}`; - presenceData.state = `${ - // Online user count - document.querySelectorAll("#rightbar > div > a") - .length + - // Online anon count - (onlineAnonsElem - ? parseInt(onlineAnonsElem.textContent.split(" ")[0].trim()) - : 0) - } online`; - presenceData.buttons = [ - { - label: "Join Chat", - url: href, - }, - ]; - } else presenceData.details = "Finding a channel to chat in"; - break; - } - case "forum": { - presenceData.details = "Browsing the forums"; + presenceData.details = `Chatting in #${channel}` + presenceData.state = `${ + // Online user count + document.querySelectorAll('#rightbar > div > a') + .length + // Online anon count + + (onlineAnonsElem + ? Number.parseInt(onlineAnonsElem.textContent?.split(' ')[0].trim() ?? '0') + : 0) + } online` + presenceData.buttons = [ + { + label: 'Join Chat', + url: href, + }, + ] + } + else { + presenceData.details = 'Finding a channel to chat in' + } + break + } + case 'forum': { + presenceData.details = 'Browsing the forums' - switch (path[1]) { - case "category": { - const categorySlug = path[2]; - if (categorySlug) { - presenceData.details = `Browsing #${categorySlug}`; - presenceData.buttons = [ - { - label: "View Category", - url: href, - }, - ]; - } - break; - } - case "thread": { - if (path[2]) { - const threadName = - document.querySelector( - ".thread-title" - )?.textContent, - currentlyReplying = - document.querySelector( - ".add-post textarea" - )?.textLength > 0, - currentlyEditing = - document.querySelectorAll( - ".post-info > .post-composer" - ).length > 0; + switch (path[1]) { + case 'category': { + const categorySlug = path[2] + if (categorySlug) { + presenceData.details = `Browsing #${categorySlug}` + presenceData.buttons = [ + { + label: 'View Category', + url: href, + }, + ] + } + break + } + case 'thread': { + if (path[2]) { + const threadName = document.querySelector('.thread-title')?.textContent + const currentlyReplying = document.querySelector('.add-post textarea')!.textLength > 0 + const currentlyEditing = document.querySelectorAll('.post-info > .post-composer').length > 0 - presenceData.details = threadName - ? `Reading a thread: "${threadName}"` - : "Reading a thread"; - if (currentlyReplying) presenceData.state = "Writing a reply"; - else if (currentlyEditing) - presenceData.state = "Editing their post"; - presenceData.buttons = [ - { - label: "Read Thread", - url: href, - }, - ]; - } - break; - } - case "compose": { - const categorySlug = path[2]; - if (categorySlug) { - const threadName = - document.querySelector("#input-title")?.value; + presenceData.details = threadName + ? `Reading a thread: "${threadName}"` + : 'Reading a thread' + if (currentlyReplying) + presenceData.state = 'Writing a reply' + else if (currentlyEditing) + presenceData.state = 'Editing their post' + presenceData.buttons = [ + { + label: 'Read Thread', + url: href, + }, + ] + } + break + } + case 'compose': { + const categorySlug = path[2] + if (categorySlug) { + const threadName = document.querySelector('#input-title')?.value - presenceData.details = `Making a thread in #${categorySlug}`; - if (threadName) presenceData.state = `"${threadName}"`; - presenceData.buttons = [ - { - label: "View Category", - url: href, - }, - ]; - } - break; - } - } - break; - } - // Search & explore - case "search": { - const query = document.querySelector( - '#container input[type="search"]' - )?.value; + presenceData.details = `Making a thread in #${categorySlug}` + if (threadName) + presenceData.state = `"${threadName}"` + presenceData.buttons = [ + { + label: 'View Category', + url: href, + }, + ] + } + break + } + } + break + } + // Search & explore + case 'search': { + const query = document.querySelector( + '#container input[type="search"]', + )?.value - presenceData.details = "Searching for games"; - if (query) presenceData.state = `"${query}"`; - presenceData.buttons = [ - { - label: "Search Games", - url: href, - }, - ]; - break; - } - case "explore": { - const categories: Record = { - top: "Browsing the top-rated games", - faves: "Browsing the most favorited games", - recent: "Browsing the most recently updated games", - playtime: "Browsing the most grinded games", - new: "Browsing the newest games", - random: "Browsing random games", - }; - presenceData.details = categories[path[1]] || "Browsing for games"; - presenceData.buttons = [ - { - label: "Explore Games", - url: href, - }, - ]; - break; - } - // Other pages - case "signup": { - presenceData.details = "Signing up"; - break; - } - case "request": { - const gameName = document.querySelector( - 'div[data-label="game name"] > input' - )?.value; + presenceData.details = 'Searching for games' + if (query) + presenceData.state = `"${query}"` + presenceData.buttons = [ + { + label: 'Search Games', + url: href, + }, + ] + break + } + case 'explore': { + const categories: Record = { + top: 'Browsing the top-rated games', + faves: 'Browsing the most favorited games', + recent: 'Browsing the most recently updated games', + playtime: 'Browsing the most grinded games', + new: 'Browsing the newest games', + random: 'Browsing random games', + } + presenceData.details = categories[path[1]] || 'Browsing for games' + presenceData.buttons = [ + { + label: 'Explore Games', + url: href, + }, + ] + break + } + // Other pages + case 'signup': { + presenceData.details = 'Signing up' + break + } + case 'request': { + const gameName = document.querySelector( + 'div[data-label="game name"] > input', + )?.value - presenceData.details = "Requesting a game"; - if (gameName) presenceData.state = `"${gameName}"`; - presenceData.buttons = [ - { - label: "Request Game", - url: href, - }, - ]; - break; - } - case "stats": { - presenceData.details = "Viewing site statistics"; - presenceData.buttons = [ - { - label: "View Stats", - url: href, - }, - ]; - break; - } - case "cluster": { - presenceData.details = "Trying out galaxy cluster"; - presenceData.buttons = [ - { - label: "Galaxy Cluster", - url: href, - }, - ]; - break; - } - case "dev": { - presenceData.details = "Becoming a developer"; - presenceData.buttons = [ - { - label: "View Page", - url: href, - }, - ]; - break; - } - case "docs": { - presenceData.details = "Reading the documentation"; - presenceData.buttons = [ - { - label: "Read Docs", - url: href, - }, - ]; - break; - } - case "about": { - presenceData.details = "Reading about galaxy"; - presenceData.buttons = [ - { - label: "View Page", - url: href, - }, - ]; - break; - } - case "rules": { - presenceData.details = "Reviewing the site rules"; - presenceData.buttons = [ - { - label: "View Page", - url: href, - }, - ]; - break; - } - case "terms": { - presenceData.details = "Reading the terms of service"; - presenceData.buttons = [ - { - label: "View Page", - url: href, - }, - ]; - break; - } - case "privacy": { - presenceData.details = "Reading the privacy policy"; - presenceData.buttons = [ - { - label: "View Page", - url: href, - }, - ]; - break; - } - case "cookies": { - presenceData.details = "Reading the cookie policy"; - presenceData.buttons = [ - { - label: "View Page", - url: href, - }, - ]; - break; - } - case "banned": { - presenceData.details = "Banned"; - break; - } - } + presenceData.details = 'Requesting a game' + if (gameName) + presenceData.state = `"${gameName}"` + presenceData.buttons = [ + { + label: 'Request Game', + url: href, + }, + ] + break + } + case 'stats': { + presenceData.details = 'Viewing site statistics' + presenceData.buttons = [ + { + label: 'View Stats', + url: href, + }, + ] + break + } + case 'cluster': { + presenceData.details = 'Trying out galaxy cluster' + presenceData.buttons = [ + { + label: 'Galaxy Cluster', + url: href, + }, + ] + break + } + case 'dev': { + presenceData.details = 'Becoming a developer' + presenceData.buttons = [ + { + label: 'View Page', + url: href, + }, + ] + break + } + case 'docs': { + presenceData.details = 'Reading the documentation' + presenceData.buttons = [ + { + label: 'Read Docs', + url: href, + }, + ] + break + } + case 'about': { + presenceData.details = 'Reading about galaxy' + presenceData.buttons = [ + { + label: 'View Page', + url: href, + }, + ] + break + } + case 'rules': { + presenceData.details = 'Reviewing the site rules' + presenceData.buttons = [ + { + label: 'View Page', + url: href, + }, + ] + break + } + case 'terms': { + presenceData.details = 'Reading the terms of service' + presenceData.buttons = [ + { + label: 'View Page', + url: href, + }, + ] + break + } + case 'privacy': { + presenceData.details = 'Reading the privacy policy' + presenceData.buttons = [ + { + label: 'View Page', + url: href, + }, + ] + break + } + case 'cookies': { + presenceData.details = 'Reading the cookie policy' + presenceData.buttons = [ + { + label: 'View Page', + url: href, + }, + ] + break + } + case 'banned': { + presenceData.details = 'Banned' + break + } + } - if (!showTimestamp) { - delete presenceData.startTimestamp; - delete presenceData.endTimestamp; - } + if (!showTimestamp) { + delete presenceData.startTimestamp + delete presenceData.endTimestamp + } - if (!showButtons) delete presenceData.buttons; + if (!showButtons) + delete presenceData.buttons - presence.setActivity(presenceData); -}); + presence.setActivity(presenceData) +}) diff --git a/websites/G/globoplay/metadata.json b/websites/G/globoplay/metadata.json index 6e38baef25e7..561f319f8ee2 100644 --- a/websites/G/globoplay/metadata.json +++ b/websites/G/globoplay/metadata.json @@ -1,42 +1,42 @@ { - "$schema": "https://schemas.premid.app/metadata/1.12", - "apiVersion": 1, - "author": { - "name": "fror", - "id": "515668127829458945" - }, - "contributors": [ - { - "name": "Bas950", - "id": "241278257335500811" - }, - { - "name": "Kyrie", - "id": "368399721494216706" - } - ], - "service": "globoplay", - "description": { - "en": "Watch the best entertainment videos, live sports, journalism, and more whenever and wherever you want.", - "nl": "Bekijk de beste entertainmentvideo's, live sport, journalistiek en meer wanneer en waar u maar wilt.", - "pt_BR": "Assista aos melhores vídeos de entretenimento, esportes ao vivo, jornalismo e muito mais quando e onde quiser." - }, - "url": "globoplay.globo.com", - "version": "2.2.12", - "logo": "https://cdn.rcd.gg/PreMiD/websites/G/globoplay/assets/logo.png", - "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/globoplay/assets/thumbnail.png", - "color": "#ED1A37", - "category": "videos", - "tags": [ - "shows", - "movies", - "radio", - "soap-opera", - "sports", - "music", - "news", - "anime", - "podcast", - "animation" - ] -} \ No newline at end of file + "$schema": "https://schemas.premid.app/metadata/1.12", + "apiVersion": 1, + "author": { + "name": "fror", + "id": "515668127829458945" + }, + "contributors": [ + { + "name": "Bas950", + "id": "241278257335500811" + }, + { + "name": "Kyrie", + "id": "368399721494216706" + } + ], + "service": "globoplay", + "description": { + "en": "Watch the best entertainment videos, live sports, journalism, and more whenever and wherever you want.", + "nl": "Bekijk de beste entertainmentvideo's, live sport, journalistiek en meer wanneer en waar u maar wilt.", + "pt_BR": "Assista aos melhores vídeos de entretenimento, esportes ao vivo, jornalismo e muito mais quando e onde quiser." + }, + "url": "globoplay.globo.com", + "version": "2.2.12", + "logo": "https://cdn.rcd.gg/PreMiD/websites/G/globoplay/assets/logo.png", + "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/globoplay/assets/thumbnail.png", + "color": "#ED1A37", + "category": "videos", + "tags": [ + "shows", + "movies", + "radio", + "soap-opera", + "sports", + "music", + "news", + "anime", + "podcast", + "animation" + ] +} diff --git a/websites/G/globoplay/presence.ts b/websites/G/globoplay/presence.ts index 6022222bea11..18a37d6a182f 100644 --- a/websites/G/globoplay/presence.ts +++ b/websites/G/globoplay/presence.ts @@ -1,473 +1,536 @@ const presence = new Presence({ - clientId: "641394369651277834", - }), - strings = presence.getStrings({ - play: "general.playing", - pause: "general.paused", - }), - browsingTimestamp = Math.floor(Date.now() / 1000); - -let user: HTMLElement, title: HTMLElement | string, search: HTMLInputElement; + clientId: '641394369651277834', +}) +const strings = presence.getStrings({ + play: 'general.playing', + pause: 'general.paused', +}) +const browsingTimestamp = Math.floor(Date.now() / 1000) const enum Assets { - Vcall = "https://cdn.rcd.gg/PreMiD/websites/G/globoplay/assets/0.png", - Logo = "https://cdn.rcd.gg/PreMiD/websites/G/globoplay/assets/logo.png", - Gnt = "https://cdn.rcd.gg/PreMiD/websites/G/globoplay/assets/1.png", - Viva = "https://cdn.rcd.gg/PreMiD/websites/G/globoplay/assets/2.png", - Gloobinho = "https://cdn.rcd.gg/PreMiD/websites/G/globoplay/assets/3.png", - Megapix = "https://cdn.rcd.gg/PreMiD/websites/G/globoplay/assets/4.png", - Universalplus = "https://cdn.rcd.gg/PreMiD/websites/G/globoplay/assets/5.png", - Universaltv = "https://cdn.rcd.gg/PreMiD/websites/G/globoplay/assets/6.png", - Syfy = "https://cdn.rcd.gg/PreMiD/websites/G/globoplay/assets/7.png", - Studiouniversal = "https://cdn.rcd.gg/PreMiD/websites/G/globoplay/assets/8.png", - Bis = "https://cdn.rcd.gg/PreMiD/websites/G/globoplay/assets/9.png", - Canalbrasil = "https://cdn.rcd.gg/PreMiD/websites/G/globoplay/assets/10.png", - Canaloff = "https://cdn.rcd.gg/PreMiD/websites/G/globoplay/assets/11.png", - Maisnatela = "https://cdn.rcd.gg/PreMiD/websites/G/globoplay/assets/12.png", - Combate = "https://cdn.rcd.gg/PreMiD/websites/G/globoplay/assets/13.png", - Cbn = "https://cdn.rcd.gg/PreMiD/websites/G/globoplay/assets/14.png", - Bbb = "https://cdn.rcd.gg/PreMiD/websites/G/globoplay/assets/15.png", - Modoviagem = "https://cdn.rcd.gg/PreMiD/websites/G/globoplay/assets/16.png", - TVGlobo = "https://cdn.rcd.gg/PreMiD/websites/G/globoplay/assets/17.png", - Sportv2 = "https://cdn.rcd.gg/PreMiD/websites/G/globoplay/assets/18.png", - Sportv = "https://cdn.rcd.gg/PreMiD/websites/G/globoplay/assets/19.png", - Sportv3 = "https://cdn.rcd.gg/PreMiD/websites/G/globoplay/assets/20.png", - Telecine = "https://cdn.rcd.gg/PreMiD/websites/G/globoplay/assets/21.png", - Tcpremium = "https://cdn.rcd.gg/PreMiD/websites/G/globoplay/assets/22.png", - Tcaction = "https://cdn.rcd.gg/PreMiD/websites/G/globoplay/assets/23.png", - Tctouch = "https://cdn.rcd.gg/PreMiD/websites/G/globoplay/assets/24.png", - Tcfun = "https://cdn.rcd.gg/PreMiD/websites/G/globoplay/assets/25.png", - Tcpipoca = "https://cdn.rcd.gg/PreMiD/websites/G/globoplay/assets/26.png", - Tccult = "https://cdn.rcd.gg/PreMiD/websites/G/globoplay/assets/27.png", - Starzplay = "https://cdn.rcd.gg/PreMiD/websites/G/globoplay/assets/28.png", - Gloob = "https://cdn.rcd.gg/PreMiD/websites/G/globoplay/assets/29.png", - Futura = "https://cdn.rcd.gg/PreMiD/websites/G/globoplay/assets/30.png", - Multishow = "https://cdn.rcd.gg/PreMiD/websites/G/globoplay/assets/31.png", - Globonews = "https://cdn.rcd.gg/PreMiD/websites/G/globoplay/assets/32.png", + Vcall = 'https://cdn.rcd.gg/PreMiD/websites/G/globoplay/assets/0.png', + Logo = 'https://cdn.rcd.gg/PreMiD/websites/G/globoplay/assets/logo.png', + Gnt = 'https://cdn.rcd.gg/PreMiD/websites/G/globoplay/assets/1.png', + Viva = 'https://cdn.rcd.gg/PreMiD/websites/G/globoplay/assets/2.png', + Gloobinho = 'https://cdn.rcd.gg/PreMiD/websites/G/globoplay/assets/3.png', + Megapix = 'https://cdn.rcd.gg/PreMiD/websites/G/globoplay/assets/4.png', + Universalplus = 'https://cdn.rcd.gg/PreMiD/websites/G/globoplay/assets/5.png', + Universaltv = 'https://cdn.rcd.gg/PreMiD/websites/G/globoplay/assets/6.png', + Syfy = 'https://cdn.rcd.gg/PreMiD/websites/G/globoplay/assets/7.png', + Studiouniversal = 'https://cdn.rcd.gg/PreMiD/websites/G/globoplay/assets/8.png', + Bis = 'https://cdn.rcd.gg/PreMiD/websites/G/globoplay/assets/9.png', + Canalbrasil = 'https://cdn.rcd.gg/PreMiD/websites/G/globoplay/assets/10.png', + Canaloff = 'https://cdn.rcd.gg/PreMiD/websites/G/globoplay/assets/11.png', + Maisnatela = 'https://cdn.rcd.gg/PreMiD/websites/G/globoplay/assets/12.png', + Combate = 'https://cdn.rcd.gg/PreMiD/websites/G/globoplay/assets/13.png', + Cbn = 'https://cdn.rcd.gg/PreMiD/websites/G/globoplay/assets/14.png', + Bbb = 'https://cdn.rcd.gg/PreMiD/websites/G/globoplay/assets/15.png', + Modoviagem = 'https://cdn.rcd.gg/PreMiD/websites/G/globoplay/assets/16.png', + TVGlobo = 'https://cdn.rcd.gg/PreMiD/websites/G/globoplay/assets/17.png', + Sportv2 = 'https://cdn.rcd.gg/PreMiD/websites/G/globoplay/assets/18.png', + Sportv = 'https://cdn.rcd.gg/PreMiD/websites/G/globoplay/assets/19.png', + Sportv3 = 'https://cdn.rcd.gg/PreMiD/websites/G/globoplay/assets/20.png', + Telecine = 'https://cdn.rcd.gg/PreMiD/websites/G/globoplay/assets/21.png', + Tcpremium = 'https://cdn.rcd.gg/PreMiD/websites/G/globoplay/assets/22.png', + Tcaction = 'https://cdn.rcd.gg/PreMiD/websites/G/globoplay/assets/23.png', + Tctouch = 'https://cdn.rcd.gg/PreMiD/websites/G/globoplay/assets/24.png', + Tcfun = 'https://cdn.rcd.gg/PreMiD/websites/G/globoplay/assets/25.png', + Tcpipoca = 'https://cdn.rcd.gg/PreMiD/websites/G/globoplay/assets/26.png', + Tccult = 'https://cdn.rcd.gg/PreMiD/websites/G/globoplay/assets/27.png', + Starzplay = 'https://cdn.rcd.gg/PreMiD/websites/G/globoplay/assets/28.png', + Gloob = 'https://cdn.rcd.gg/PreMiD/websites/G/globoplay/assets/29.png', + Futura = 'https://cdn.rcd.gg/PreMiD/websites/G/globoplay/assets/30.png', + Multishow = 'https://cdn.rcd.gg/PreMiD/websites/G/globoplay/assets/31.png', + Globonews = 'https://cdn.rcd.gg/PreMiD/websites/G/globoplay/assets/32.png', } -presence.on("UpdateData", async () => { - const presenceData: PresenceData = { - largeImageKey: Assets.Logo, - startTimestamp: browsingTimestamp, - }; +presence.on('UpdateData', async () => { + const presenceData: PresenceData = { + largeImageKey: Assets.Logo, + startTimestamp: browsingTimestamp, + } - if (document.location.hostname === "globoplay.globo.com") { - if (document.location.pathname === "/") - presenceData.details = "Página inicial"; - else if (document.location.pathname.includes("/categorias/")) { - const categoryName = document.title.match( - new RegExp("Assistir (.+) online no Globoplay") - )[1], - categoryNamealt = document.querySelector( - "div.application-controller__view > span > div > div > div > h1" - ); - if (categoryName) { - presenceData.details = "Vendo a categoria:"; - presenceData.state = categoryName; - presenceData.smallImageKey = Assets.Reading; - } else if (categoryNamealt) { - presenceData.details = "Vendo a categoria:"; - presenceData.state = categoryNamealt.textContent; - presenceData.smallImageKey = Assets.Reading; - } else presenceData.details = "Categorias"; - } else if (document.location.pathname.includes("/busca/")) { - presenceData.details = "Se preparando para"; - presenceData.state = "pesquisar algo..."; - search = document.querySelector("#search-bar-input"); - if (search.value.length > 2) { - presenceData.details = "Pesquisando por:"; - presenceData.state = search.value; - presenceData.smallImageKey = Assets.Search; - } - } else if (document.location.pathname.includes("/programacao")) - presenceData.details = "Programação"; - else if (document.location.pathname.includes("/programas-locais")) - presenceData.details = "Programas Locais"; - else if (document.location.pathname.includes("/regiao/")) { - user = document.querySelector("h1.view-title"); - presenceData.details = `Vendo programas locais de ${user.textContent}`; - } else if (document.location.pathname.includes("/configuracoes")) - presenceData.details = "Configurações"; - else if (document.location.pathname.includes("/minha-lista")) - presenceData.details = "Minha Lista"; - else if (document.location.pathname.includes("/t/")) { - user = document.querySelector(".media-cover__header-text"); - presenceData.details = "Vendo o programa/filme:"; - presenceData.state = user.textContent; - presenceData.smallImageKey = Assets.Reading; - } else if (document.location.pathname.includes("/v/")) { - const video = document.querySelector( - ".id-playback > video" - ), - episodeTitle = document.querySelector( - ":is(.video-info__data-program, .playkit-video-info__link-text)" - )?.textContent; - if ( - episodeTitle && - episodeTitle !== - document.querySelector(".video-info__data-title")?.textContent - ) { - title = episodeTitle; - presenceData.state = document.querySelector( - ".video-info__data-title" - ).textContent; - } else if (episodeTitle) title = episodeTitle; + if (document.location.hostname === 'globoplay.globo.com') { + if (document.location.pathname === '/') { + presenceData.details = 'Página inicial' + } + else if (document.location.pathname.includes('/categorias/')) { + const categoryName = document.title.match( + /Assistir (.+) online no Globoplay/, + )?.[1] + const categoryNamealt = document.querySelector( + 'div.application-controller__view > span > div > div > div > h1', + ) + if (categoryName) { + presenceData.details = 'Vendo a categoria:' + presenceData.state = categoryName + presenceData.smallImageKey = Assets.Reading + } + else if (categoryNamealt) { + presenceData.details = 'Vendo a categoria:' + presenceData.state = categoryNamealt.textContent + presenceData.smallImageKey = Assets.Reading + } + else { + presenceData.details = 'Categorias' + } + } + else if (document.location.pathname.includes('/busca/')) { + presenceData.details = 'Se preparando para' + presenceData.state = 'pesquisar algo...' + const search = document.querySelector('#search-bar-input') + if (search && search.value.length > 2) { + presenceData.details = 'Pesquisando por:' + presenceData.state = search.value + presenceData.smallImageKey = Assets.Search + } + } + else if (document.location.pathname.includes('/programacao')) { + presenceData.details = 'Programação' + } + else if (document.location.pathname.includes('/programas-locais')) { + presenceData.details = 'Programas Locais' + } + else if (document.location.pathname.includes('/regiao/')) { + const user = document.querySelector('h1.view-title') + presenceData.details = `Vendo programas locais de ${user?.textContent}` + } + else if (document.location.pathname.includes('/configuracoes')) { + presenceData.details = 'Configurações' + } + else if (document.location.pathname.includes('/minha-lista')) { + presenceData.details = 'Minha Lista' + } + else if (document.location.pathname.includes('/t/')) { + const user = document.querySelector('.media-cover__header-text') + presenceData.details = 'Vendo o programa/filme:' + presenceData.state = user?.textContent + presenceData.smallImageKey = Assets.Reading + } + else if (document.location.pathname.includes('/v/')) { + const video = document.querySelector( + '.id-playback > video', + ) + const episodeTitle = document.querySelector( + ':is(.video-info__data-program, .playkit-video-info__link-text)', + )?.textContent + if ( + episodeTitle + && episodeTitle + !== document.querySelector('.video-info__data-title')?.textContent + ) { + presenceData.state = document.querySelector( + '.video-info__data-title', + )?.textContent + } - if (!isNaN(video.duration)) { - [presenceData.startTimestamp, presenceData.endTimestamp] = - presence.getTimestamps( - Math.floor(video.currentTime), - Math.floor(video.duration) - ); - presenceData.smallImageKey = video.paused ? Assets.Pause : Assets.Play; - presenceData.smallImageText = video.paused - ? (await strings).pause - : (await strings).play; + if (video && !Number.isNaN(video.duration)) { + [presenceData.startTimestamp, presenceData.endTimestamp] = presence.getTimestamps( + Math.floor(video.currentTime), + Math.floor(video.duration), + ) + presenceData.smallImageKey = video.paused ? Assets.Pause : Assets.Play + presenceData.smallImageText = video.paused + ? (await strings).pause + : (await strings).play - presenceData.details = title as string; + presenceData.details = episodeTitle - if (video.paused) { - delete presenceData.startTimestamp; - delete presenceData.endTimestamp; - } - } else if (isNaN(video.duration)) { - presenceData.details = "Olhando para:"; - presenceData.state = title as string; - } - } else if (document.location.pathname.includes("/podcasts/")) { - const podcastTitle = document.querySelector( - "div > div.podcast-view__header-info > h1" - )?.textContent, - podcastTitlealt = document.querySelector( - "div.podcast-episode-view__header-info > div:nth-child(1) > a" - )?.textContent, - podcastCover = (( - document.querySelector("div.podcast-view__podcast-thumb > div > img") - ))?.srcset.match(new RegExp("(https.+[.](png|jpg)) 360w"))[1], - podcastCoveralt = (( - document.querySelector("div.podcast-episode-view__thumb > div > img") - ))?.src, - playingPodcast = Array.from( - document.querySelectorAll(".episode-card") - ).find(element => element.querySelector("button[aria-label=Pausar]")); - if (document.location.pathname.includes("/episode/")) { - const playingPodcastalt = Array.from( - document.querySelectorAll(".podcast-episode-view__header") - ).find(element => element.querySelector("button[aria-label=Pausar]")); - presenceData.details = `Vendo o episódio do podcast ${podcastTitlealt}`; - presenceData.state = document.querySelector( - "div.podcast-episode-view__header-info > h1" - ).textContent; - presenceData.largeImageKey = podcastCoveralt; - if (playingPodcastalt instanceof HTMLElement) { - presenceData.largeImageKey = playingPodcastalt - .querySelector("img") - ?.srcset.match(new RegExp("(https.+[.](png|jpg)) 360w"))[1]; + if (video.paused) { + delete presenceData.startTimestamp + delete presenceData.endTimestamp + } + } + else if (video && Number.isNaN(video.duration)) { + presenceData.details = 'Olhando para:' + presenceData.state = episodeTitle + } + } + else if (document.location.pathname.includes('/podcasts/')) { + const podcastTitle = document.querySelector( + 'div > div.podcast-view__header-info > h1', + )?.textContent + const podcastTitlealt = document.querySelector( + 'div.podcast-episode-view__header-info > div:nth-child(1) > a', + )?.textContent + const podcastCover = document.querySelector( + 'div.podcast-view__podcast-thumb > div > img', + )?.srcset.match(/(https.+\.(png|jpg)) 360w/)?.[1] + const podcastCoveralt = document.querySelector( + 'div.podcast-episode-view__thumb > div > img', + )?.src + const playingPodcast = Array.from( + document.querySelectorAll('.episode-card'), + ).find(element => element.querySelector('button[aria-label=Pausar]')) + if (document.location.pathname.includes('/episode/')) { + const playingPodcastalt = Array.from( + document.querySelectorAll('.podcast-episode-view__header'), + ).find(element => element.querySelector('button[aria-label=Pausar]')) + presenceData.details = `Vendo o episódio do podcast ${podcastTitlealt}` + presenceData.state = document.querySelector( + 'div.podcast-episode-view__header-info > h1', + )?.textContent + presenceData.largeImageKey = podcastCoveralt + if (playingPodcastalt instanceof HTMLElement) { + presenceData.largeImageKey = playingPodcastalt + .querySelector('img') + ?.srcset + .match(/(https.+\.(png|jpg)) 360w/)?.[1] - presenceData.details = podcastTitlealt; + presenceData.details = podcastTitlealt - // Podcast name - presenceData.state = document.querySelector( - "div.podcast-episode-view__header-info > h1" - ).textContent; + // Podcast name + presenceData.state = document.querySelector( + 'div.podcast-episode-view__header-info > h1', + )?.textContent - // Boolean if podcast is playing or paused - const playing = - playingPodcastalt.querySelector( - "button[aria-label=Pausar]" - )?.style.display !== "none"; + // Boolean if podcast is playing or paused + const playing = playingPodcastalt.querySelector( + 'button[aria-label=Pausar]', + )?.style.display !== 'none' - delete presenceData.startTimestamp; + delete presenceData.startTimestamp - if (playing) { - const currentTime = - playingPodcastalt.querySelector( - "[data-testid='current-time'" - )?.textContent, - totalTime = playingPodcastalt.querySelector( - "[data-testid='total-time'" - )?.textContent; + if (playing) { + const currentTime = playingPodcastalt.querySelector('[data-testid=\'current-time\'')?.textContent + const totalTime = playingPodcastalt.querySelector( + '[data-testid=\'total-time\'', + )?.textContent - if (currentTime && totalTime) { - [presenceData.startTimestamp, presenceData.endTimestamp] = - presence.getTimestamps( - presence.timestampFromFormat(currentTime), - presence.timestampFromFormat(totalTime) - ); - } - } + if (currentTime && totalTime) { + [presenceData.startTimestamp, presenceData.endTimestamp] = presence.getTimestamps( + presence.timestampFromFormat(currentTime), + presence.timestampFromFormat(totalTime), + ) + } + } - presenceData.smallImageKey = playing ? Assets.Play : Assets.Pause; - presenceData.smallImageText = playing ? "Playing" : "Paused"; - } - } else if (playingPodcast instanceof HTMLElement) { - // Podcast image - presenceData.largeImageKey = playingPodcast - .querySelector("img") - ?.srcset.match(new RegExp("(https.+[.](png|jpg)) 360w"))[1]; + presenceData.smallImageKey = playing ? Assets.Play : Assets.Pause + presenceData.smallImageText = playing ? 'Playing' : 'Paused' + } + } + else if (playingPodcast instanceof HTMLElement) { + // Podcast image + presenceData.largeImageKey = playingPodcast + .querySelector('img') + ?.srcset + .match(/(https.+\.(png|jpg)) 360w/)?.[1] - presenceData.details = podcastTitle; + presenceData.details = podcastTitle - // Podcast name - presenceData.state = playingPodcast.querySelector( - ".episode-card__headline" - )?.textContent; + // Podcast name + presenceData.state = playingPodcast.querySelector( + '.episode-card__headline', + )?.textContent - // Boolean if podcast is playing or paused - const playing = - playingPodcast.querySelector( - "button[aria-label=Pausar]" - )?.style.display !== "none"; + // Boolean if podcast is playing or paused + const playing = playingPodcast.querySelector('button[aria-label=Pausar]')?.style.display !== 'none' - delete presenceData.startTimestamp; + delete presenceData.startTimestamp - if (playing) { - const currentTime = playingPodcast.querySelector( - "[data-testid='current-time'" - )?.textContent, - totalTime = playingPodcast.querySelector( - "[data-testid='total-time'" - )?.textContent; + if (playing) { + const currentTime = playingPodcast.querySelector( + '[data-testid=\'current-time\'', + )?.textContent + const totalTime = playingPodcast.querySelector( + '[data-testid=\'total-time\'', + )?.textContent - if (currentTime && totalTime) { - [presenceData.startTimestamp, presenceData.endTimestamp] = - presence.getTimestamps( - presence.timestampFromFormat(currentTime), - presence.timestampFromFormat(totalTime) - ); - } - } + if (currentTime && totalTime) { + [presenceData.startTimestamp, presenceData.endTimestamp] = presence.getTimestamps( + presence.timestampFromFormat(currentTime), + presence.timestampFromFormat(totalTime), + ) + } + } - presenceData.smallImageKey = playing ? Assets.Play : Assets.Pause; - presenceData.smallImageText = playing ? "Playing" : "Paused"; - } else if (podcastTitle) { - presenceData.details = "Vendo o podcast:"; - presenceData.state = podcastTitle; - presenceData.largeImageKey = podcastCover; - } else presenceData.details = "Podcasts"; - } else if (document.location.pathname.includes("/ao-vivo/")) { - const programTitle = document.querySelector( - "span.playkit-channels-navigation__program-name" - ), - programMetadata = document.querySelector( - "div.playkit-channels-navigation__program-metadata__text" - ); + presenceData.smallImageKey = playing ? Assets.Play : Assets.Pause + presenceData.smallImageText = playing ? 'Playing' : 'Paused' + } + else if (podcastTitle) { + presenceData.details = 'Vendo o podcast:' + presenceData.state = podcastTitle + presenceData.largeImageKey = podcastCover + } + else { + presenceData.details = 'Podcasts' + } + } + else if (document.location.pathname.includes('/ao-vivo/')) { + const programTitle = document.querySelector( + 'span.playkit-channels-navigation__program-name', + ) + const programMetadata = document.querySelector( + 'div.playkit-channels-navigation__program-metadata__text', + ) - if (document.location.pathname.includes("/6120663/")) { - presenceData.details = `TV Globo - ${programTitle.textContent}`; - presenceData.state = programMetadata.textContent; - presenceData.smallImageKey = Assets.Live; - presenceData.largeImageKey = Assets.TVGlobo; - } else if (document.location.pathname.includes("/7339131/")) { - presenceData.details = `Multishow - ${programTitle.textContent}`; - presenceData.state = programMetadata.textContent; - presenceData.smallImageKey = Assets.Live; - presenceData.largeImageKey = Assets.Multishow; - } else if (document.location.pathname.includes("/7339101/")) { - presenceData.details = `GloboNews - ${programTitle.textContent}`; - presenceData.state = programMetadata.textContent; - presenceData.smallImageKey = Assets.Live; - presenceData.largeImageKey = Assets.Globonews; - } else if (document.location.pathname.includes("/7339108/")) { - presenceData.details = `sportv - ${programTitle.textContent}`; - presenceData.state = programMetadata.textContent; - presenceData.smallImageKey = Assets.Live; - presenceData.largeImageKey = Assets.Sportv; - } else if (document.location.pathname.includes("/7339117/")) { - presenceData.details = `sportv2 - ${programTitle.textContent}`; - presenceData.state = programMetadata.textContent; - presenceData.smallImageKey = Assets.Live; - presenceData.largeImageKey = Assets.Sportv2; - } else if (document.location.pathname.includes("/7339123/")) { - presenceData.details = `sportv3 - ${programTitle.textContent}`; - presenceData.state = programMetadata.textContent; - presenceData.smallImageKey = Assets.Live; - presenceData.largeImageKey = Assets.Sportv3; - } else if (document.location.pathname.includes("/7339128/")) { - presenceData.details = `GNT - ${programTitle.textContent}`; - presenceData.state = programMetadata.textContent; - presenceData.smallImageKey = Assets.Live; - presenceData.largeImageKey = Assets.Gnt; - } else if (document.location.pathname.includes("/7339091/")) { - presenceData.details = `Viva - ${programTitle.textContent}`; - presenceData.state = programMetadata.textContent; - presenceData.smallImageKey = Assets.Live; - presenceData.largeImageKey = Assets.Viva; - } else if (document.location.pathname.includes("/7339146/")) { - presenceData.details = `Gloob - ${programTitle.textContent}`; - presenceData.state = programMetadata.textContent; - presenceData.smallImageKey = Assets.Live; - presenceData.largeImageKey = Assets.Gloob; - } else if (document.location.pathname.includes("/7339323/")) { - presenceData.details = `Gloobinho - ${programTitle.textContent}`; - presenceData.state = programMetadata.textContent; - presenceData.smallImageKey = Assets.Live; - presenceData.largeImageKey = Assets.Gloobinho; - } else if (document.location.pathname.includes("/7339152/")) { - presenceData.details = `Megapix - ${programTitle.textContent}`; - presenceData.state = programMetadata.textContent; - presenceData.smallImageKey = Assets.Live; - presenceData.largeImageKey = Assets.Megapix; - } else if (document.location.pathname.includes("/7339279/")) { - presenceData.details = `Universal TV - ${programTitle.textContent}`; - presenceData.state = programMetadata.textContent; - presenceData.smallImageKey = Assets.Live; - presenceData.largeImageKey = Assets.Universalplus; - } else if (document.location.pathname.includes("/7339326/")) { - presenceData.details = `Studio Universal - ${programTitle.textContent}`; - presenceData.state = programMetadata.textContent; - presenceData.smallImageKey = Assets.Live; - presenceData.largeImageKey = Assets.Studiouniversal; - } else if (document.location.pathname.includes("/7339224/")) { - presenceData.details = `SYFY - ${programTitle.textContent}`; - presenceData.state = programMetadata.textContent; - presenceData.smallImageKey = Assets.Live; - presenceData.largeImageKey = Assets.Syfy; - } else if (document.location.pathname.includes("/7339060/")) { - presenceData.details = `Canal Brasil - ${programTitle.textContent}`; - presenceData.state = programMetadata.textContent; - presenceData.smallImageKey = Assets.Live; - presenceData.largeImageKey = Assets.Canalbrasil; - } else if (document.location.pathname.includes("/7339078/")) { - presenceData.details = `Canal OFF - ${programTitle.textContent}`; - presenceData.state = programMetadata.textContent; - presenceData.smallImageKey = Assets.Live; - presenceData.largeImageKey = Assets.Canaloff; - } else if (document.location.pathname.includes("/7339140/")) { - presenceData.details = `BIS - ${programTitle.textContent}`; - presenceData.state = programMetadata.textContent; - presenceData.smallImageKey = Assets.Live; - presenceData.largeImageKey = Assets.Bis; - } else if (document.location.pathname.includes("/7339135/")) { - presenceData.details = `Modo Viagem - ${programTitle.textContent}`; - presenceData.state = programMetadata.textContent; - presenceData.smallImageKey = Assets.Live; - presenceData.largeImageKey = Assets.Modoviagem; - } else if (document.location.pathname.includes("/7420604/")) { - presenceData.details = `Futura - ${programTitle.textContent}`; - presenceData.state = programMetadata.textContent; - presenceData.smallImageKey = Assets.Live; - presenceData.largeImageKey = Assets.Futura; - } else if (document.location.pathname.includes("/8223631/")) { - presenceData.details = `Premiere - ${programTitle.textContent}`; - presenceData.state = programMetadata.textContent; - presenceData.smallImageKey = Assets.Live; - presenceData.largeImageKey = Assets.Premiere; - } else if (document.location.pathname.includes("/8221785/")) { - presenceData.details = `Premiere 2 - ${programTitle.textContent}`; - presenceData.state = programMetadata.textContent; - presenceData.smallImageKey = Assets.Live; - presenceData.largeImageKey = Assets.Premiere; - } else if (document.location.pathname.includes("/8221838/")) { - presenceData.details = "Mosaico Premiere"; - presenceData.smallImageKey = Assets.Live; - presenceData.largeImageKey = Assets.Premiere; - } else if (document.location.pathname.includes("/8310612/")) { - presenceData.details = `Combate - ${programTitle.textContent}`; - presenceData.state = programMetadata.textContent; - presenceData.smallImageKey = Assets.Live; - presenceData.largeImageKey = Assets.Combate; - } else if (document.location.pathname.includes("/10221110/")) { - presenceData.details = `Telecine Premium - ${programTitle.textContent}`; - presenceData.state = programMetadata.textContent; - presenceData.smallImageKey = Assets.Live; - presenceData.largeImageKey = Assets.Tcpremium; - } else if (document.location.pathname.includes("/10221184/")) { - presenceData.details = `Telecine Action - ${programTitle.textContent}`; - presenceData.state = programMetadata.textContent; - presenceData.smallImageKey = Assets.Live; - presenceData.largeImageKey = Assets.Tcaction; - } else if (document.location.pathname.includes("/10221239/")) { - presenceData.details = `Telecine Touch - ${programTitle.textContent}`; - presenceData.state = programMetadata.textContent; - presenceData.smallImageKey = Assets.Live; - presenceData.largeImageKey = Assets.Tctouch; - } else if (document.location.pathname.includes("/10223522/")) { - presenceData.details = `Telecine Fun - ${programTitle.textContent}`; - presenceData.state = programMetadata.textContent; - presenceData.smallImageKey = Assets.Live; - presenceData.largeImageKey = Assets.Tcfun; - } else if (document.location.pathname.includes("/10221225/")) { - presenceData.details = `Telecine Pipoca - ${programTitle.textContent}`; - presenceData.state = programMetadata.textContent; - presenceData.smallImageKey = Assets.Live; - presenceData.largeImageKey = Assets.Tcpipoca; - } else if (document.location.pathname.includes("/10221109/")) { - presenceData.details = `Telecine Cult - ${programTitle.textContent}`; - presenceData.state = programMetadata.textContent; - presenceData.smallImageKey = Assets.Live; - presenceData.largeImageKey = Assets.Tccult; - } else if (document.location.pathname.includes("/9182156/")) { - presenceData.details = "CBN São Paulo"; - presenceData.smallImageKey = Assets.Live; - presenceData.largeImageKey = Assets.Cbn; - } else if (document.location.pathname.includes("/9182126/")) { - presenceData.details = "CBN Rio de Janeiro"; - presenceData.smallImageKey = Assets.Live; - presenceData.largeImageKey = Assets.Cbn; - } - } else if (document.location.pathname.includes("/canais/")) { - if (document.location.pathname.includes("/globo/")) { - presenceData.details = "TV Globo"; - presenceData.largeImageKey = Assets.TVGlobo; - } else if (document.location.pathname.includes("/multishow/")) { - presenceData.details = "Multishow"; - presenceData.largeImageKey = Assets.Multishow; - } else if (document.location.pathname.includes("/globonews/")) { - presenceData.details = "GloboNews"; - presenceData.largeImageKey = Assets.Globonews; - } else if (document.location.pathname.includes("/sportv/")) { - presenceData.details = "sportv"; - presenceData.largeImageKey = Assets.Sportv; - } else if (document.location.pathname.includes("/gnt/")) { - presenceData.details = "GNT"; - presenceData.largeImageKey = Assets.Gnt; - } else if (document.location.pathname.includes("/viva/")) { - presenceData.details = "Viva"; - presenceData.largeImageKey = Assets.Viva; - } else if (document.location.pathname.includes("/gloob/")) { - presenceData.details = "Gloob"; - presenceData.largeImageKey = Assets.Gloob; - } else if (document.location.pathname.includes("/gloobinho/")) { - presenceData.details = "Gloobinho"; - presenceData.largeImageKey = Assets.Gloobinho; - } else if (document.location.pathname.includes("/megapix/")) { - presenceData.details = "Megapix"; - presenceData.largeImageKey = Assets.Megapix; - } else if (document.location.pathname.includes("/universal/")) { - presenceData.details = "Universal+"; - presenceData.largeImageKey = Assets.Universalplus; - } else if (document.location.pathname.includes("/canal-brasil/")) { - presenceData.details = "Canal Brasil"; - presenceData.largeImageKey = Assets.Canalbrasil; - } else if (document.location.pathname.includes("/canal-off/")) { - presenceData.details = "Canal OFF"; - presenceData.largeImageKey = Assets.Canaloff; - } else if (document.location.pathname.includes("/bis/")) { - presenceData.details = "BIS"; - presenceData.largeImageKey = Assets.Bis; - } else if (document.location.pathname.includes("/modo-viagem/")) { - presenceData.details = "Modo Viagem"; - presenceData.largeImageKey = Assets.Modoviagem; - } else if (document.location.pathname.includes("/futura/")) { - presenceData.details = "Futura"; - presenceData.largeImageKey = Assets.Futura; - } else if (document.location.pathname.includes("/premiere/")) { - presenceData.details = Assets.Premiere; - presenceData.largeImageKey = Assets.Premiere; - } else if (document.location.pathname.includes("/combate/")) { - presenceData.details = "Combate"; - presenceData.largeImageKey = Assets.Combate; - } else if (document.location.pathname.includes("/telecine/")) { - presenceData.details = "Telecine"; - presenceData.largeImageKey = Assets.Telecine; - } else if (document.location.pathname.includes("/starzplay/")) { - presenceData.details = "STARZPLAY"; - presenceData.largeImageKey = Assets.Starzplay; - } else presenceData.details = "Canais"; - } - } - if (presenceData.details) presence.setActivity(presenceData); - else presence.setActivity(); -}); + if (document.location.pathname.includes('/6120663/')) { + presenceData.details = `TV Globo - ${programTitle?.textContent}` + presenceData.state = programMetadata?.textContent + presenceData.smallImageKey = Assets.Live + presenceData.largeImageKey = Assets.TVGlobo + } + else if (document.location.pathname.includes('/7339131/')) { + presenceData.details = `Multishow - ${programTitle?.textContent}` + presenceData.state = programMetadata?.textContent + presenceData.smallImageKey = Assets.Live + presenceData.largeImageKey = Assets.Multishow + } + else if (document.location.pathname.includes('/7339101/')) { + presenceData.details = `GloboNews - ${programTitle?.textContent}` + presenceData.state = programMetadata?.textContent + presenceData.smallImageKey = Assets.Live + presenceData.largeImageKey = Assets.Globonews + } + else if (document.location.pathname.includes('/7339108/')) { + presenceData.details = `sportv - ${programTitle?.textContent}` + presenceData.state = programMetadata?.textContent + presenceData.smallImageKey = Assets.Live + presenceData.largeImageKey = Assets.Sportv + } + else if (document.location.pathname.includes('/7339117/')) { + presenceData.details = `sportv2 - ${programTitle?.textContent}` + presenceData.state = programMetadata?.textContent + presenceData.smallImageKey = Assets.Live + presenceData.largeImageKey = Assets.Sportv2 + } + else if (document.location.pathname.includes('/7339123/')) { + presenceData.details = `sportv3 - ${programTitle?.textContent}` + presenceData.state = programMetadata?.textContent + presenceData.smallImageKey = Assets.Live + presenceData.largeImageKey = Assets.Sportv3 + } + else if (document.location.pathname.includes('/7339128/')) { + presenceData.details = `GNT - ${programTitle?.textContent}` + presenceData.state = programMetadata?.textContent + presenceData.smallImageKey = Assets.Live + presenceData.largeImageKey = Assets.Gnt + } + else if (document.location.pathname.includes('/7339091/')) { + presenceData.details = `Viva - ${programTitle?.textContent}` + presenceData.state = programMetadata?.textContent + presenceData.smallImageKey = Assets.Live + presenceData.largeImageKey = Assets.Viva + } + else if (document.location.pathname.includes('/7339146/')) { + presenceData.details = `Gloob - ${programTitle?.textContent}` + presenceData.state = programMetadata?.textContent + presenceData.smallImageKey = Assets.Live + presenceData.largeImageKey = Assets.Gloob + } + else if (document.location.pathname.includes('/7339323/')) { + presenceData.details = `Gloobinho - ${programTitle?.textContent}` + presenceData.state = programMetadata?.textContent + presenceData.smallImageKey = Assets.Live + presenceData.largeImageKey = Assets.Gloobinho + } + else if (document.location.pathname.includes('/7339152/')) { + presenceData.details = `Megapix - ${programTitle?.textContent}` + presenceData.state = programMetadata?.textContent + presenceData.smallImageKey = Assets.Live + presenceData.largeImageKey = Assets.Megapix + } + else if (document.location.pathname.includes('/7339279/')) { + presenceData.details = `Universal TV - ${programTitle?.textContent}` + presenceData.state = programMetadata?.textContent + presenceData.smallImageKey = Assets.Live + presenceData.largeImageKey = Assets.Universalplus + } + else if (document.location.pathname.includes('/7339326/')) { + presenceData.details = `Studio Universal - ${programTitle?.textContent}` + presenceData.state = programMetadata?.textContent + presenceData.smallImageKey = Assets.Live + presenceData.largeImageKey = Assets.Studiouniversal + } + else if (document.location.pathname.includes('/7339224/')) { + presenceData.details = `SYFY - ${programTitle?.textContent}` + presenceData.state = programMetadata?.textContent + presenceData.smallImageKey = Assets.Live + presenceData.largeImageKey = Assets.Syfy + } + else if (document.location.pathname.includes('/7339060/')) { + presenceData.details = `Canal Brasil - ${programTitle?.textContent}` + presenceData.state = programMetadata?.textContent + presenceData.smallImageKey = Assets.Live + presenceData.largeImageKey = Assets.Canalbrasil + } + else if (document.location.pathname.includes('/7339078/')) { + presenceData.details = `Canal OFF - ${programTitle?.textContent}` + presenceData.state = programMetadata?.textContent + presenceData.smallImageKey = Assets.Live + presenceData.largeImageKey = Assets.Canaloff + } + else if (document.location.pathname.includes('/7339140/')) { + presenceData.details = `BIS - ${programTitle?.textContent}` + presenceData.state = programMetadata?.textContent + presenceData.smallImageKey = Assets.Live + presenceData.largeImageKey = Assets.Bis + } + else if (document.location.pathname.includes('/7339135/')) { + presenceData.details = `Modo Viagem - ${programTitle?.textContent}` + presenceData.state = programMetadata?.textContent + presenceData.smallImageKey = Assets.Live + presenceData.largeImageKey = Assets.Modoviagem + } + else if (document.location.pathname.includes('/7420604/')) { + presenceData.details = `Futura - ${programTitle?.textContent}` + presenceData.state = programMetadata?.textContent + presenceData.smallImageKey = Assets.Live + presenceData.largeImageKey = Assets.Futura + } + else if (document.location.pathname.includes('/8223631/')) { + presenceData.details = `Premiere - ${programTitle?.textContent}` + presenceData.state = programMetadata?.textContent + presenceData.smallImageKey = Assets.Live + presenceData.largeImageKey = Assets.Premiere + } + else if (document.location.pathname.includes('/8221785/')) { + presenceData.details = `Premiere 2 - ${programTitle?.textContent}` + presenceData.state = programMetadata?.textContent + presenceData.smallImageKey = Assets.Live + presenceData.largeImageKey = Assets.Premiere + } + else if (document.location.pathname.includes('/8221838/')) { + presenceData.details = 'Mosaico Premiere' + presenceData.smallImageKey = Assets.Live + presenceData.largeImageKey = Assets.Premiere + } + else if (document.location.pathname.includes('/8310612/')) { + presenceData.details = `Combate - ${programTitle?.textContent}` + presenceData.state = programMetadata?.textContent + presenceData.smallImageKey = Assets.Live + presenceData.largeImageKey = Assets.Combate + } + else if (document.location.pathname.includes('/10221110/')) { + presenceData.details = `Telecine Premium - ${programTitle?.textContent}` + presenceData.state = programMetadata?.textContent + presenceData.smallImageKey = Assets.Live + presenceData.largeImageKey = Assets.Tcpremium + } + else if (document.location.pathname.includes('/10221184/')) { + presenceData.details = `Telecine Action - ${programTitle?.textContent}` + presenceData.state = programMetadata?.textContent + presenceData.smallImageKey = Assets.Live + presenceData.largeImageKey = Assets.Tcaction + } + else if (document.location.pathname.includes('/10221239/')) { + presenceData.details = `Telecine Touch - ${programTitle?.textContent}` + presenceData.state = programMetadata?.textContent + presenceData.smallImageKey = Assets.Live + presenceData.largeImageKey = Assets.Tctouch + } + else if (document.location.pathname.includes('/10223522/')) { + presenceData.details = `Telecine Fun - ${programTitle?.textContent}` + presenceData.state = programMetadata?.textContent + presenceData.smallImageKey = Assets.Live + presenceData.largeImageKey = Assets.Tcfun + } + else if (document.location.pathname.includes('/10221225/')) { + presenceData.details = `Telecine Pipoca - ${programTitle?.textContent}` + presenceData.state = programMetadata?.textContent + presenceData.smallImageKey = Assets.Live + presenceData.largeImageKey = Assets.Tcpipoca + } + else if (document.location.pathname.includes('/10221109/')) { + presenceData.details = `Telecine Cult - ${programTitle?.textContent}` + presenceData.state = programMetadata?.textContent + presenceData.smallImageKey = Assets.Live + presenceData.largeImageKey = Assets.Tccult + } + else if (document.location.pathname.includes('/9182156/')) { + presenceData.details = 'CBN São Paulo' + presenceData.smallImageKey = Assets.Live + presenceData.largeImageKey = Assets.Cbn + } + else if (document.location.pathname.includes('/9182126/')) { + presenceData.details = 'CBN Rio de Janeiro' + presenceData.smallImageKey = Assets.Live + presenceData.largeImageKey = Assets.Cbn + } + } + else if (document.location.pathname.includes('/canais/')) { + if (document.location.pathname.includes('/globo/')) { + presenceData.details = 'TV Globo' + presenceData.largeImageKey = Assets.TVGlobo + } + else if (document.location.pathname.includes('/multishow/')) { + presenceData.details = 'Multishow' + presenceData.largeImageKey = Assets.Multishow + } + else if (document.location.pathname.includes('/globonews/')) { + presenceData.details = 'GloboNews' + presenceData.largeImageKey = Assets.Globonews + } + else if (document.location.pathname.includes('/sportv/')) { + presenceData.details = 'sportv' + presenceData.largeImageKey = Assets.Sportv + } + else if (document.location.pathname.includes('/gnt/')) { + presenceData.details = 'GNT' + presenceData.largeImageKey = Assets.Gnt + } + else if (document.location.pathname.includes('/viva/')) { + presenceData.details = 'Viva' + presenceData.largeImageKey = Assets.Viva + } + else if (document.location.pathname.includes('/gloob/')) { + presenceData.details = 'Gloob' + presenceData.largeImageKey = Assets.Gloob + } + else if (document.location.pathname.includes('/gloobinho/')) { + presenceData.details = 'Gloobinho' + presenceData.largeImageKey = Assets.Gloobinho + } + else if (document.location.pathname.includes('/megapix/')) { + presenceData.details = 'Megapix' + presenceData.largeImageKey = Assets.Megapix + } + else if (document.location.pathname.includes('/universal/')) { + presenceData.details = 'Universal+' + presenceData.largeImageKey = Assets.Universalplus + } + else if (document.location.pathname.includes('/canal-brasil/')) { + presenceData.details = 'Canal Brasil' + presenceData.largeImageKey = Assets.Canalbrasil + } + else if (document.location.pathname.includes('/canal-off/')) { + presenceData.details = 'Canal OFF' + presenceData.largeImageKey = Assets.Canaloff + } + else if (document.location.pathname.includes('/bis/')) { + presenceData.details = 'BIS' + presenceData.largeImageKey = Assets.Bis + } + else if (document.location.pathname.includes('/modo-viagem/')) { + presenceData.details = 'Modo Viagem' + presenceData.largeImageKey = Assets.Modoviagem + } + else if (document.location.pathname.includes('/futura/')) { + presenceData.details = 'Futura' + presenceData.largeImageKey = Assets.Futura + } + else if (document.location.pathname.includes('/premiere/')) { + presenceData.details = Assets.Premiere + presenceData.largeImageKey = Assets.Premiere + } + else if (document.location.pathname.includes('/combate/')) { + presenceData.details = 'Combate' + presenceData.largeImageKey = Assets.Combate + } + else if (document.location.pathname.includes('/telecine/')) { + presenceData.details = 'Telecine' + presenceData.largeImageKey = Assets.Telecine + } + else if (document.location.pathname.includes('/starzplay/')) { + presenceData.details = 'STARZPLAY' + presenceData.largeImageKey = Assets.Starzplay + } + else { + presenceData.details = 'Canais' + } + } + } + if (presenceData.details) + presence.setActivity(presenceData) + else presence.setActivity() +})