Skip to content

Commit

Permalink
chore: lint G folder
Browse files Browse the repository at this point in the history
  • Loading branch information
Bas950 committed Jan 19, 2025
1 parent b392ffa commit c72e0bf
Show file tree
Hide file tree
Showing 143 changed files with 13,133 additions and 12,450 deletions.
46 changes: 23 additions & 23 deletions websites/G/G2A/metadata.json
Original file line number Diff line number Diff line change
@@ -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"
]
}
"$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"
]
}
193 changes: 94 additions & 99 deletions websites/G/G2A/presence.ts
Original file line number Diff line number Diff line change
@@ -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()
})
44 changes: 22 additions & 22 deletions websites/G/G2G/metadata.json
Original file line number Diff line number Diff line change
@@ -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"
]
}
"$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"
]
}
Loading

0 comments on commit c72e0bf

Please sign in to comment.