Skip to content

Commit

Permalink
Merge pull request PreMiD#3059 from Snazzah/update-batch/1
Browse files Browse the repository at this point in the history
Update 5 presences to use buttons
  • Loading branch information
mergify[bot] authored Feb 21, 2021
2 parents 226f3f8 + 594d653 commit ca3005e
Show file tree
Hide file tree
Showing 10 changed files with 125 additions and 20 deletions.
8 changes: 7 additions & 1 deletion websites/A/Agar.io/dist/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"en": "The smash hit game! Control your cell and eat other players to grow larger! Play with millions of players around the world and try to become the biggest cell of all!"
},
"service": "Agar.io",
"version": "1.1.1",
"version": "1.2.0",
"logo": "https://i.imgur.com/x2QZCXF.png",
"thumbnail": "https://i.imgur.com/R1Ytqci.png",
"color": "#ED1C24",
Expand All @@ -26,6 +26,12 @@
"title": "Show username",
"icon": "fas fa-user",
"value": true
},
{
"id": "buttons",
"title": "Show Presence Buttons",
"icon": "fas fa-th-large",
"value": true
}
]
}
11 changes: 10 additions & 1 deletion websites/A/Agar.io/presence.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ let gameStartTimestamp: number = null,
presence.on("UpdateData", async () => {
const data: PresenceData = {
largeImageKey: "agar"
};
},
buttons = await presence.getSetting("buttons");

if (agarData) {
if (agarData.connecting) {
Expand Down Expand Up @@ -56,6 +57,14 @@ presence.on("UpdateData", async () => {
}
data.state = gameModeMap[agarData.gameMode];
data.startTimestamp = gameStartTimestamp;

if (buttons) {
const code = document.querySelector(".partymode-info > #code");
if (code) data.buttons = [{
label: 'Join Party',
url: document.URL
}];
}
}
}

Expand Down
8 changes: 7 additions & 1 deletion websites/J/Jet Set Radio Live/dist/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"en": "Yo! You've heard about Jet Set Radio, right? It's only the hottest radio station straight outta Tokyo-to! Tune in. Turn on. Jet Set Radiooo!!!"
},
"url": "jetsetradio.live",
"version": "2.0.1",
"version": "2.1.0",
"logo": "https://i.imgur.com/ZiIN6t9.png",
"thumbnail": "https://i.imgur.com/TmgNbn4.jpeg",
"color": "#FFE222",
Expand All @@ -36,6 +36,12 @@
"title": "Show Timestamps",
"icon": "fas fa-clock",
"value": true
},
{
"id": "buttons",
"title": "Show Presence Buttons",
"icon": "fas fa-th-large",
"value": true
}
]
}
8 changes: 7 additions & 1 deletion websites/J/Jet Set Radio Live/presence.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ presence.on("UpdateData", async () => {
),
loadingSong = document.querySelector(
'#loadingTrackCircle:not([style*="hidden"])'
);
),
buttons = await presence.getSetting("buttons");

if (songName.textContent.length < 1 || !audio) {
presenceData.details = "Not tuned in.";
Expand Down Expand Up @@ -78,6 +79,11 @@ presence.on("UpdateData", async () => {
presenceData.smallImageKey = "pause";
presenceData.smallImageText = (await strings).pause;
}

if (buttons) presenceData.buttons = [{
label: 'Tune In',
url: document.URL
}];
}

if (presenceData.details == null && presenceData.state == null) {
Expand Down
10 changes: 8 additions & 2 deletions websites/N/Newgrounds/dist/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
"id": "158049329150427136"
},
"url": "newgrounds.com",
"regExp": "\\.newgrounds\\.com",
"regExp": "([a-z0-9]+)[.]newgrounds[.]com",
"description": {
"en": "A community of artists, game developers, musicians, voice actors and writers who create and share some of the best stuff on the web!"
},
"service": "Newgrounds",
"version": "1.0.1",
"version": "1.1.0",
"logo": "https://i.imgur.com/OfHFd5Q.jpeg",
"thumbnail": "https://i.imgur.com/xBnaql3.jpg",
"color": "#f58a2f",
Expand Down Expand Up @@ -51,6 +51,12 @@
"title": "Show Timestamps",
"icon": "fas fa-clock",
"value": true
},
{
"id": "buttons",
"title": "Show Presence Buttons",
"icon": "fas fa-th-large",
"value": true
}
]
}
61 changes: 52 additions & 9 deletions websites/N/Newgrounds/presence.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,23 @@ presence.on("UpdateData", async () => {
},
itemName = document.querySelector('[itemprop="name"]')
? document.querySelector('[itemprop="name"]').textContent
: null;
: null,
buttons = await presence.getSetting("buttons");

if (location.hostname !== "www.newgrounds.com") {
const userName = document.querySelector(".user-link").textContent;
presenceData.details = "Viewing a user's profile";
presenceData.smallImageKey = "user";
presenceData.smallImageText = "User Profile";
if (await presence.getSetting("showprofilename"))

if (await presence.getSetting("showprofilename")) {
presenceData.state = userName.length < 2 ? "User: " + userName : userName;
if (buttons) presenceData.buttons = [{
label: 'View Profile',
url: location.origin
}];
}

if (document.location.pathname.startsWith("/fans")) {
presenceData.details = "Viewing a user's fans";
} else if (document.location.pathname.startsWith("/news")) {
Expand Down Expand Up @@ -74,8 +82,13 @@ presence.on("UpdateData", async () => {
.querySelector(".item-details-main")
.textContent.trim();
presenceData.details = "Listening to audio";
if (await presence.getSetting("itemname"))
if (await presence.getSetting("itemname")){
presenceData.state = itemName + " by " + artist;
if (buttons) presenceData.buttons = [{
label: 'Listen',
url: document.URL
}];
}
presenceData.smallImageKey = "audio_pause";
presenceData.smallImageText = "Audio - Paused";
if (
Expand All @@ -99,9 +112,14 @@ presence.on("UpdateData", async () => {
presenceData.smallImageText = "Art";
if (document.location.pathname.startsWith("/art/view")) {
presenceData.details = "Viewing art";
if (await presence.getSetting("itemname"))
if (await presence.getSetting("itemname")) {
presenceData.state =
itemName.length < 2 ? "Art: " + itemName : itemName;
if (buttons) presenceData.buttons = [{
label: 'View',
url: document.URL
}];
}
}
} else if (document.location.pathname.startsWith("/portal")) {
presenceData.details = "Viewing the portal";
Expand All @@ -110,9 +128,14 @@ presence.on("UpdateData", async () => {
switch (metaType.getAttribute("content")) {
case "movie":
presenceData.details = "Watching a movie";
if (await presence.getSetting("itemname"))
if (await presence.getSetting("itemname")) {
presenceData.state =
itemName.length < 2 ? "Movie: " + itemName : itemName;
if (buttons) presenceData.buttons = [{
label: 'Watch',
url: document.URL
}];
}
// Some movies might not have the NG player
if (document.querySelector(".ng-video-player")) {
presenceData.smallImageKey = "movies_pause";
Expand Down Expand Up @@ -146,9 +169,14 @@ presence.on("UpdateData", async () => {
lastGameChange = Date.now();
}
presenceData.details = "Playing a game";
if (await presence.getSetting("itemname"))
if (await presence.getSetting("itemname")) {
presenceData.state =
itemName.length < 2 ? "Game: " + itemName : itemName;
if (buttons) presenceData.buttons = [{
label: 'Play',
url: document.URL
}];
}
presenceData.smallImageKey = "games_play";
presenceData.smallImageText = "Games - Playing";
if (await presence.getSetting("timestamp"))
Expand All @@ -173,9 +201,14 @@ presence.on("UpdateData", async () => {
} else if (document.location.pathname.startsWith("/bbs/topic/")) {
const itemName = document.querySelector(".pod-head h2").textContent;
presenceData.details = "Viewing a forum topic";
if (await presence.getSetting("topicname"))
if (await presence.getSetting("topicname")) {
presenceData.state =
itemName.length < 2 ? "Topic: " + itemName : itemName;
if (buttons) presenceData.buttons = [{
label: 'View Topic',
url: document.URL
}];
}
}
} else if (document.location.pathname.startsWith("/community")) {
presenceData.details = "Browsing the community";
Expand All @@ -185,9 +218,14 @@ presence.on("UpdateData", async () => {
const itemName = document.querySelector(".column.wide .pod-head h2")
.textContent;
presenceData.details = "Viewing a collection";
if (await presence.getSetting("itemname"))
if (await presence.getSetting("itemname")) {
presenceData.state =
itemName.length < 2 ? "Collection: " + itemName : itemName;
if (buttons) presenceData.buttons = [{
label: 'View Collection',
url: document.URL
}];
}
}
} else if (document.location.pathname.startsWith("/social")) {
presenceData.details = "Browsing their feed";
Expand All @@ -203,9 +241,14 @@ presence.on("UpdateData", async () => {
const itemName = document.querySelector(".column.wide .pod-head h2")
.textContent;
presenceData.details = "Viewing a playlist";
if (await presence.getSetting("itemname"))
if (await presence.getSetting("itemname")) {
presenceData.state =
itemName.length < 2 ? "Playlist: " + itemName : itemName;
if (buttons) presenceData.buttons = [{
label: 'View Playlist',
url: document.URL
}];
}
}
} else if (document.location.pathname.startsWith("/chat")) {
presenceData.details = "in Newgrounds Chat";
Expand Down
12 changes: 10 additions & 2 deletions websites/Q/Quizlet/dist/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"en": "Quizlet makes simple learning tools that let you study anything. Start learning today with flashcards, games and learning tools — all for free."
},
"service": "Quizlet",
"version": "1.0.2",
"version": "1.1.0",
"logo": "https://i.imgur.com/5K8iXcX.png",
"thumbnail": "https://i.imgur.com/Bnxt3z4.png",
"color": "#4257B2",
Expand All @@ -18,5 +18,13 @@
"study"
],
"category": "other",
"iframe": true
"iframe": true,
"settings": [
{
"id": "buttons",
"title": "Display Join Party Button",
"icon": "fas fa-plus-square",
"value": true
}
]
}
11 changes: 10 additions & 1 deletion websites/Q/Quizlet/presence.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ let actionTimestamp: number = null;
presence.on("UpdateData", async () => {
const data: PresenceData = {
largeImageKey: "quizlet"
};
},
buttons = await presence.getSetting("buttons");

if (qzData && qzData.layer) {
const pathSplits = qzData.layer.path.split("/");
Expand All @@ -39,6 +40,10 @@ presence.on("UpdateData", async () => {
data.state = document.querySelector(
".ProfileHeader-username"
).textContent;
if (buttons) data.buttons = [{
label: 'View Profile',
url: document.URL
}];
actionTimestamp = null;
break;
case "Topic":
Expand All @@ -59,6 +64,10 @@ presence.on("UpdateData", async () => {
if (!actionTimestamp) actionTimestamp = Date.now();
data.details = "Viewing a set";
data.state = qzData.layer.studyableTitle;
if (buttons) data.buttons = [{
label: 'View Set',
url: document.URL
}];
break;
case "new":
data.details = "Creating a set";
Expand Down
8 changes: 7 additions & 1 deletion websites/S/StoryFire/dist/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"en": "Join the StoryFire rebellion! Watch and create the stories and videos that you want while growing a massive fanbase!"
},
"service": "StoryFire",
"version": "1.0.1",
"version": "1.1.0",
"logo": "https://i.imgur.com/1RGQMmt.png",
"thumbnail": "https://i.imgur.com/voBWTFb.png",
"color": "#fc9000",
Expand All @@ -25,6 +25,12 @@
"title": "Show Search Query",
"icon": "fas fa-search",
"value": true
},
{
"id": "buttons",
"title": "Show Presence Buttons",
"icon": "fas fa-th-large",
"value": true
}
]
}
8 changes: 7 additions & 1 deletion websites/S/StoryFire/presence.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ presence.on("UpdateData", async () => {
},
video: HTMLVideoElement = document.querySelector(
"#storyfire-player_html5_api"
);
),
buttons = await presence.getSetting("buttons");

if (document.location.pathname.startsWith("/video-details")) {
const timestamps = getTimestamps(
Expand All @@ -39,6 +40,11 @@ presence.on("UpdateData", async () => {
presenceData.smallImageKey = "pause";
presenceData.smallImageText = (await strings).pause;
}

if (buttons) presenceData.buttons = [{
label: 'Watch',
url: document.URL
}];
} else if (document.location.pathname.startsWith("/forgot-password")) {
presenceData.details = "Forgot Password";
} else if (document.location.pathname.startsWith("/social")) {
Expand Down

0 comments on commit ca3005e

Please sign in to comment.