-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(AnimeciX): Add new presence #9272
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: iSwesia <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ESLint found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.
websites/A/AnimeciX/metadata.json
Outdated
}, | ||
"url": "animecix.net", | ||
"version": "1.0.0", | ||
"logo": "https://discord.do/wp-content/uploads/2023/08/AnimeciX.jpg", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Logo should be 512x512. Use waifu2x if you need to upscale.
websites/A/AnimeciX/metadata.json
Outdated
"url": "animecix.net", | ||
"version": "1.0.0", | ||
"logo": "https://discord.do/wp-content/uploads/2023/08/AnimeciX.jpg", | ||
"thumbnail": "https://discord.do/wp-content/uploads/2023/08/AnimeciX.jpg", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use a screenshot or a promotional image/banner.
websites/A/AnimeciX/presence.ts
Outdated
}); | ||
|
||
const browsingTimestamp = Math.floor(Date.now() / 1000); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
}); | |
const browsingTimestamp = Math.floor(Date.now() / 1000); | |
}), | |
browsingTimestamp = Math.floor(Date.now() / 1000); |
websites/A/AnimeciX/presence.ts
Outdated
}; | ||
|
||
const updatePresence = () => { | ||
let presenceData: PresenceData = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let presenceData: PresenceData = { | |
const presenceData: PresenceData = { |
websites/A/AnimeciX/presence.ts
Outdated
const observer = new MutationObserver(() => { | ||
callback(); | ||
}); | ||
|
||
observer.observe(document.body, { childList: true, subtree: true }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const observer = new MutationObserver(() => { | |
callback(); | |
}); | |
observer.observe(document.body, { childList: true, subtree: true }); | |
new MutationObserver(() => { | |
callback(); | |
}).observe(document.body, { childList: true, subtree: true }); |
websites/A/AnimeciX/presence.ts
Outdated
const episodeTitle = document.querySelectorAll(".t-title > .ng-star-inserted")[1]?.textContent; | ||
const SEInfo = document.querySelector(".episode-number")?.textContent; | ||
// Thumbnail | ||
// const animeImgElement = document.querySelector("img.media-image-el"); | ||
const animeImg = document.querySelector<HTMLElement>("media-item-header")?.style.backgroundImage.match(/url\(["']?(.*?)["']?\)/)?.[1] | ||
|
||
presenceData.largeImageKey = animeImg; | ||
presenceData.details = episodeTitle || "Loading"; | ||
presenceData.state = SEInfo || "Loading"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const episodeTitle = document.querySelectorAll(".t-title > .ng-star-inserted")[1]?.textContent; | |
const SEInfo = document.querySelector(".episode-number")?.textContent; | |
// Thumbnail | |
// const animeImgElement = document.querySelector("img.media-image-el"); | |
const animeImg = document.querySelector<HTMLElement>("media-item-header")?.style.backgroundImage.match(/url\(["']?(.*?)["']?\)/)?.[1] | |
presenceData.largeImageKey = animeImg; | |
presenceData.details = episodeTitle || "Loading"; | |
presenceData.state = SEInfo || "Loading"; | |
presenceData.largeImageKey = document.querySelector<HTMLElement>("media-item-header")?.style.backgroundImage.match(/url\(["']?(.*?)["']?\)/)?.[1]; | |
presenceData.details = document.querySelectorAll(".t-title > .ng-star-inserted")[1]?.textContent || "Loading"; | |
presenceData.state = document.querySelector(".episode-number")?.textContent || "Loading"; |
websites/A/AnimeciX/presence.ts
Outdated
const animeTitle = document.querySelector(".t-title a")?.textContent; | ||
// Thumbnail | ||
// const animeImgElement = document.querySelector("img.media-image-el"); | ||
const animeImg = document.querySelector<HTMLElement>("media-item-header")?.style.backgroundImage.match(/url\(["']?(.*?)["']?\)/)?.[1] | ||
|
||
presenceData.largeImageKey = animeImg; | ||
presenceData.details = animeTitle || "Loading"; | ||
presenceData.state = "Bölümler görüntüleniyor"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const animeTitle = document.querySelector(".t-title a")?.textContent; | |
// Thumbnail | |
// const animeImgElement = document.querySelector("img.media-image-el"); | |
const animeImg = document.querySelector<HTMLElement>("media-item-header")?.style.backgroundImage.match(/url\(["']?(.*?)["']?\)/)?.[1] | |
presenceData.largeImageKey = animeImg; | |
presenceData.details = animeTitle || "Loading"; | |
presenceData.state = "Bölümler görüntüleniyor"; | |
presenceData.largeImageKey = document.querySelector<HTMLElement>("media-item-header")?.style.backgroundImage.match(/url\(["']?(.*?)["']?\)/)?.[1]; | |
presenceData.details = document.querySelector(".t-title a")?.textContent || "Loading"; | |
presenceData.state = "Bölümler görüntüleniyor"; |
websites/A/AnimeciX/presence.ts
Outdated
const userImg = document.querySelector<HTMLImageElement>(".header > .user-avatar.real")?.src; | ||
const userName = document.querySelector(".header > h1.name")?.textContent; | ||
presenceData.largeImageKey = Assets.Logo; | ||
presenceData.smallImageKey = userImg; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const userImg = document.querySelector<HTMLImageElement>(".header > .user-avatar.real")?.src; | |
const userName = document.querySelector(".header > h1.name")?.textContent; | |
presenceData.largeImageKey = Assets.Logo; | |
presenceData.smallImageKey = userImg; | |
const userName = document.querySelector(".header > h1.name")?.textContent; | |
presenceData.largeImageKey = Assets.Logo; | |
presenceData.smallImageKey = document.querySelector<HTMLImageElement>(".header > .user-avatar.real")?.src; |
websites/A/AnimeciX/presence.ts
Outdated
presenceData.smallImageText = userName; | ||
presenceData.details = "Kullanıcı görüntüleniyor:"; | ||
presenceData.state = userName || "Loading.."; | ||
} else if (document.location.pathname === "/watchlist") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer switch instead of else if...
switch (document.location) {
case "watchlist": {
// ... code
break;
}
};
websites/A/AnimeciX/presence.ts
Outdated
const keyword = document.querySelector(".query")?.textContent; | ||
presenceData.largeImageKey = Assets.Logo; | ||
presenceData.smallImageKey = Assets.Search; | ||
presenceData.smallImageText = "Aranıyor" | ||
presenceData.details = "Aranıyor:"; | ||
presenceData.state = keyword; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Format with prettier to fix semicolons
const keyword = document.querySelector(".query")?.textContent; | |
presenceData.largeImageKey = Assets.Logo; | |
presenceData.smallImageKey = Assets.Search; | |
presenceData.smallImageText = "Aranıyor" | |
presenceData.details = "Aranıyor:"; | |
presenceData.state = keyword; | |
presenceData.largeImageKey = Assets.Logo; | |
presenceData.smallImageKey = Assets.Search; | |
presenceData.smallImageText = "Aranıyor"; | |
presenceData.details = "Aranıyor:"; | |
presenceData.state = document.querySelector(".query")?.textContent; |
Signed-off-by: iSwesia <[email protected]>
Signed-off-by: iSwesia <[email protected]>
Signed-off-by: iSwesia <[email protected]>
Signed-off-by: iSwesia <[email protected]>
Signed-off-by: iSwesia <[email protected]>
Signed-off-by: iSwesia <[email protected]>
Signed-off-by: iSwesia <[email protected]>
Signed-off-by: iSwesia <[email protected]>
Signed-off-by: iSwesia <[email protected]>
Signed-off-by: iSwesia <[email protected]>
|
||
enum Images { | ||
Logo = 'https://i.imgur.com/ExLxNbB.png', | ||
SettingsICO = 'https://i.imgur.com/pUucFeP.png', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Asset should be 512x512px
&& document.location.pathname.includes('/episode/') | ||
) { | ||
// Thumbnail | ||
// const animeImgElement = document.querySelector("img.media-image-el"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// const animeImgElement = document.querySelector("img.media-image-el"); |
function updatePresence() { | ||
const presenceData: PresenceData = { | ||
largeImageKey: Images.Logo, | ||
} as PresenceData |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the type cast needed here?
&& !document.location.pathname.includes('/episode/') | ||
) { | ||
// Thumbnail | ||
// const animeImgElement = document.querySelector("img.media-image-el"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// const animeImgElement = document.querySelector("img.media-image-el"); |
break | ||
} | ||
case '/gw-rooms': { | ||
presenceData.largeImageKey = Images.Logo | ||
presenceData.smallImageKey = Assets.Premiere | ||
presenceData.smallImageText = 'Group Watch' | ||
presenceData.details = 'AnimeciX' | ||
presenceData.state = 'İzleme odaları görüntüleniyor..' | ||
|
||
break | ||
} | ||
case '/search': { | ||
presenceData.largeImageKey = Images.Logo | ||
presenceData.smallImageKey = Assets.Search | ||
presenceData.smallImageText = 'Aranıyor' | ||
presenceData.details = 'Aranıyor:' | ||
presenceData.state = document.querySelector('.query')?.textContent | ||
|
||
break | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove extra newline between break
and code
|
||
enum Images { | ||
Logo = 'https://i.imgur.com/ExLxNbB.png', | ||
SettingsICO = 'https://i.imgur.com/pUucFeP.png', |
Check failure
Code scanning / PMD
Makes sure all images (logo and URLs) are exactly 512x512 pixels Error
Description
Feature: Added Premid presences integration for the Animecix website.
Changes Made:
-Integrated Premid presences to fetch data from the Animecix website's page titles and content.
-Implemented dynamic updates to display the correct anime title and episode information as users watch.
-Provided real-time updates for current page content and the specific episodes being watched.
Additional Information:
-This change aims to enhance the user experience by providing more accurate and personalized information while watching anime.
-The Premid presences feature displays relevant title, episode name, and other related details based on the anime being watched.
Testing:
-Tested with several anime titles and episodes on the Animecix website. Presences are updated correctly.
-Each page has been tested one by one, no issues found.
Acknowledgements
yarn format
Screenshots
Proof showing the creation/modification is working as expected