Skip to content

Commit

Permalink
♻️ Refactoring (#4174)
Browse files Browse the repository at this point in the history
Signed-off-by: SeMiD <contact@premid.app>

Co-authored-by: SeMiD <contact@premid.app>
  • Loading branch information
SeMiD and SeMiD authored Aug 1, 2021
1 parent e881bea commit 576b85d
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 54 deletions.
2 changes: 1 addition & 1 deletion websites/A/AnizmTV/dist/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"www.anizm.tv",
"anizm.tv"
],
"version": "1.0.4",
"version": "1.0.5",
"logo": "https://i.imgur.com/TZZcyOQ.png",
"thumbnail": "https://i.imgur.com/o4P1a0J.png",
"color": "#fc9003",
Expand Down
18 changes: 8 additions & 10 deletions websites/A/AnizmTV/presence.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,7 @@ presence.on("UpdateData", async () => {
.querySelector("#pageContent > div > h2 > a")
?.getAttribute("href") || document.URL;

if (!title || !episode)
video = null;

if (!title || !episode) video = null;

if (
document.location.pathname.includes("/SeriEkle") ||
Expand Down Expand Up @@ -71,17 +69,17 @@ presence.on("UpdateData", async () => {
"#pageContent > div > div.profileCoverArea.autoPosterSize.anizm_round > div.info.pfull > div > div > div:nth-child(1) > div.profileNickname"
);
data.state = tags.innerText.split("@").slice(1).join(" ");
} else if (document.location.pathname.includes("/ayarlar"))
} else if (document.location.pathname.includes("/ayarlar"))
data.details = "Ayarlara Göz atıyor...";
else if (document.location.pathname.includes("/ara")) {
else if (document.location.pathname.includes("/ara")) {
data.details = "Aranıyor: ";
tags = document.querySelector("#pageContent > div > h2 > span");
data.state = tags.innerText.split("Aranan: ").slice(1).join(" ");
} else if (document.location.pathname.includes("/girisyap"))
} else if (document.location.pathname.includes("/girisyap"))
data.details = "Giriş yapıyor...";
else if (document.location.pathname.includes("/uyeol"))
else if (document.location.pathname.includes("/uyeol"))
data.details = "Üye oluyor...";
else if (window.location.href.indexOf("?sayfa=") > 1) {
else if (window.location.href.indexOf("?sayfa=") > 1) {
const pageNum = document.URL.split("?sayfa=")[1]
.split("#episodes")
.slice(0)
Expand Down Expand Up @@ -133,9 +131,9 @@ presence.on("UpdateData", async () => {
document.location.pathname.includes("/girisyap") ||
document.location.pathname.includes("/uyeol") ||
window.location.href.indexOf("?sayfa=") > 1
)
)
data.startTimestamp = startTimestamp;
else {
else {
data.details = (await strings).browsing;
data.startTimestamp = startTimestamp;
}
Expand Down
44 changes: 22 additions & 22 deletions websites/K/Ko-Fi/dist/metadata.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
{
"$schema": "https://schemas.premid.app/metadata/1.3",
"service": "Ko-Fi",
"author": {
"name": "Dzlandis",
"id": "259708781166985217"
},
"category": "other",
"logo": "https://i.imgur.com/EzWg3eE.png",
"thumbnail": "https://i.imgur.com/fa1gCIG.png",
"version": "1.0.0",
"color": "#28AAE0",
"tags": [
"kofi",
"donation",
"support",
"coffee"
],
"url": "ko-fi.com",
"description": {
"en": "Ko-fi lets creators receive support from fans of their content for the price of a coffee!"
}
}
"$schema": "https://schemas.premid.app/metadata/1.3",
"service": "Ko-Fi",
"author": {
"name": "Dzlandis",
"id": "259708781166985217"
},
"category": "other",
"logo": "https://i.imgur.com/EzWg3eE.png",
"thumbnail": "https://i.imgur.com/fa1gCIG.png",
"version": "1.0.1",
"color": "#28AAE0",
"tags": [
"kofi",
"donation",
"support",
"coffee"
],
"url": "ko-fi.com",
"description": {
"en": "Ko-fi lets creators receive support from fans of their content for the price of a coffee!"
}
}
22 changes: 8 additions & 14 deletions websites/K/Ko-Fi/presence.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ presence.on("UpdateData", () => {
.querySelector(
"body > div.app > header > ul.navbar-nav.ml-auto.d-none.d-sm-inline-block > div > div"
)
.textContent
.trim();
.textContent.trim();
presenceData.details = "Managing the settings of:";
presenceData.state = title;
} else if (
Expand Down Expand Up @@ -70,15 +69,13 @@ presence.on("UpdateData", () => {
.querySelector(
"#shop-item-detail > div > div.kfds-lyt-between-algn-top-row-to-col.kfds-c-sticky > div.sidebar.kfds-c-sticky-wrapper.kfds-c-order-2.kfds-c-shop-detail-wrapper > div.kfds-lyt-width-100.kfds-c-lyt-pdg-16-24.kfds-c-shop-detail-column-control > span"
)
.textContent
.trim(),
.textContent.trim(),
shopOwner = document
.querySelector(
"#shop-item-detail > div > div.kfds-lyt-between-algn-top-row-to-col.kfds-c-sticky > div.sidebar.kfds-c-sticky-wrapper.kfds-c-order-2.kfds-c-shop-detail-wrapper > div.kfds-lyt-width-100.kfds-c-lyt-pdg-16-24.kfds-c-shop-detail-column-control > div > a > div > span:nth-child(1)"
)
.textContent
.trim(),
[, , URLSplit ] = document.location.pathname.split("/"),
.textContent.trim(),
[, , URLSplit] = document.location.pathname.split("/"),
URL = `https://ko-fi.com/s/${URLSplit}?ref=premid_discord_presence`;
presenceData.details = `Viewing ${shopItem}`;
presenceData.state = `By ${shopOwner}`;
Expand All @@ -103,9 +100,8 @@ presence.on("UpdateData", () => {
.querySelector(
"#body-content > div > div.wrapper.wrapper-content.article > div > div > div > div > div:nth-child(4) > div > h1"
)
.textContent
.trim(),
[, , URLSplit ] = document.location.pathname.split("/"),
.textContent.trim(),
[, , URLSplit] = document.location.pathname.split("/"),
URL = `https://ko-fi.com/post/${URLSplit}?ref=premid_discord_presence`;
presenceData.details = "Viewing a post:";
presenceData.state = postName;
Expand All @@ -119,8 +115,7 @@ presence.on("UpdateData", () => {
.querySelector(
"#body-content > div > div > div:nth-child(2) > div > a > name"
)
.textContent
.trim();
.textContent.trim();
presenceData.details = "Viewing an album.";
if (user !== "undefined") {
presenceData.details = "Viewing a users album:";
Expand All @@ -137,8 +132,7 @@ presence.on("UpdateData", () => {
.querySelector(
"#profile-header-v2 > div > div.kfds-lyt-column.kfds-lyt-width-100.kfds-c-header-showmobile-at-736 > div.kfds-lyt-row-start.kfds-lyt-width-100 > div > div.kfds-font-size-22.kfds-font-bold > span"
)
.textContent
.trim(),
.textContent.trim(),
userSplit = document.location.pathname.split("/");
// userFixed = user.toLowerCase().split(" ").join("");
// console.log(userFixed)
Expand Down
2 changes: 1 addition & 1 deletion websites/S/Subso/dist/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"www.sub.so",
"creators.sub.so"
],
"version": "1.0.0",
"version": "1.0.1",
"logo": "https://i.imgur.com/4b8AEvp.png",
"thumbnail": "https://i.imgur.com/rbbMigG.jpg",
"color": "#32a852",
Expand Down
18 changes: 12 additions & 6 deletions websites/S/Subso/presence.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,20 @@ presence.on("UpdateData", async () => {
presenceData.state = "Creator not found";
} else {
presenceData.details = "Viewing a creator:";
[presenceData.state] = document.title.split(" — All their content in one place on Subso");
presenceData.buttons = [{
label: "View Creator",
url: window.location.href
}];
[presenceData.state] = document.title.split(
" — All their content in one place on Subso"
);
presenceData.buttons = [
{
label: "View Creator",
url: window.location.href
}
];
}
} else if (window.location.pathname.startsWith("/settings/")) {
const tab = window.location.pathname.split("/settings/")[1].replace("watchlater", "Watch Later");
const tab = window.location.pathname
.split("/settings/")[1]
.replace("watchlater", "Watch Later");
presenceData.details = "Settings:";
presenceData.state = tab.charAt(0).toUpperCase() + tab.slice(1);
}
Expand Down

0 comments on commit 576b85d

Please sign in to comment.