-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
feat(YummyAnime): add activity #10356
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
base: main
Are you sure you want to change the base?
Changes from 4 commits
084da7f
89ddd56
e0e3d3a
f032bce
45c1711
663a614
8be87a3
a7afa4c
231a01a
9646c29
80408ad
35e578b
6848173
225657c
128bf3d
76bdd76
bef1b56
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| const iframe = new iFrame(); | ||
Check failureCode scanning / ESLint Require or disallow semicolons instead of ASI Error
Extra semicolon.
|
||
|
|
||
| iframe.on("UpdateData", async () => { | ||
Check failureCode scanning / ESLint Enforce the consistent use of either backticks, double, or single quotes Error
Strings must use singlequote.
|
||
| const video = document.querySelector("video"); | ||
Check failureCode scanning / ESLint Enforce the consistent use of either backticks, double, or single quotes Error
Strings must use singlequote.
Check failureCode scanning / ESLint Require or disallow semicolons instead of ASI Error
Extra semicolon.
|
||
|
|
||
| if (video && !Number.isNaN(video.duration)) { | ||
| iframe.send({ | ||
| duration: video.duration, | ||
| currentTime: video.currentTime, | ||
| paused: video.paused, | ||
| }); | ||
Check failureCode scanning / ESLint Require or disallow semicolons instead of ASI Error
Extra semicolon.
|
||
| } | ||
| }); | ||
Check failureCode scanning / ESLint Require or disallow semicolons instead of ASI Error
Extra semicolon.
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| { | ||
| "$schema": "https://schemas.premid.app/metadata/1.16", | ||
| "apiVersion": 2, | ||
harryys-dev marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| "author": { | ||
| "id": "1045800378228281345", | ||
| "name": "harryys" | ||
| }, | ||
| "service": "YummyAnime", | ||
| "description": { | ||
| "en": "Displays anime you are watching on YummyAnime." | ||
| }, | ||
| "url": "yummyani.me", | ||
| "regExp": "^https?://(www\\.)?(site\\.)?(en\\.)?yummyani\\.me/.*", | ||
| "version": "1.0.0", | ||
| "logo": "https://i.imgur.com/6XnAGga.jpeg", | ||
| "thumbnail": "https://i.imgur.com/6XnAGga.jpeg", | ||
harryys-dev marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| "color": "#FF5722", | ||
| "category": "anime", | ||
| "tags": ["anime", "video"], | ||
| "iframe": true, | ||
| "iFrameRegExp": "kodik" | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,125 @@ | ||
| const presence = new Presence({ | ||
| clientId: "1045800378228281345", | ||
Check failureCode scanning / ESLint Enforce the consistent use of either backticks, double, or single quotes Error
Strings must use singlequote.
|
||
| }); | ||
Check failureCode scanning / ESLint Require or disallow semicolons instead of ASI Error
Extra semicolon.
|
||
|
|
||
| let videoData = { | ||
| duration: 0, | ||
| currentTime: 0, | ||
| paused: true, | ||
| hasData: false, | ||
| }; | ||
Check failureCode scanning / ESLint Require or disallow semicolons instead of ASI Error
Extra semicolon.
|
||
|
|
||
| presence.on("iFrameData", (data: any) => { | ||
Check failureCode scanning / ESLint Enforce the consistent use of either backticks, double, or single quotes Error
Strings must use singlequote.
|
||
| videoData = { ...data, hasData: true }; | ||
Check failureCode scanning / ESLint Require or disallow semicolons instead of ASI Error
Extra semicolon.
|
||
| }); | ||
Check failureCode scanning / ESLint Require or disallow semicolons instead of ASI Error
Extra semicolon.
|
||
|
|
||
| presence.on("UpdateData", async () => { | ||
Check failureCode scanning / ESLint Enforce the consistent use of either backticks, double, or single quotes Error
Strings must use singlequote.
|
||
| const { pathname } = document.location; | ||
Check failureCode scanning / ESLint Require or disallow semicolons instead of ASI Error
Extra semicolon.
|
||
|
|
||
| const presenceData: any = { | ||
| largeImageKey: "https://i.imgur.com/6XnAGga.jpeg", | ||
Check failureCode scanning / ESLint Enforce the consistent use of either backticks, double, or single quotes Error
Strings must use singlequote.
|
||
| largeImageText: "YummyAnime", | ||
Check failureCode scanning / ESLint Enforce the consistent use of either backticks, double, or single quotes Error
Strings must use singlequote.
|
||
| type: 3, | ||
harryys-dev marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| }; | ||
Check failureCode scanning / ESLint Require or disallow semicolons instead of ASI Error
Extra semicolon.
|
||
|
|
||
| if (pathname === "/" || pathname === "/index.html") { | ||
Check failureCode scanning / ESLint Enforce the consistent use of either backticks, double, or single quotes Error
Strings must use singlequote.
Check failureCode scanning / ESLint Enforce the consistent use of either backticks, double, or single quotes Error
Strings must use singlequote.
|
||
| presenceData.details = "На главной странице"; | ||
Check failureCode scanning / ESLint Enforce the consistent use of either backticks, double, or single quotes Error
Strings must use singlequote.
Check failureCode scanning / ESLint Require or disallow semicolons instead of ASI Error
Extra semicolon.
|
||
| presenceData.state = "Выбирает аниме"; | ||
Check failureCode scanning / ESLint Enforce the consistent use of either backticks, double, or single quotes Error
Strings must use singlequote.
Check failureCode scanning / ESLint Require or disallow semicolons instead of ASI Error
Extra semicolon.
|
||
| presence.setActivity(presenceData); | ||
Check failureCode scanning / ESLint Require or disallow semicolons instead of ASI Error
Extra semicolon.
|
||
| return; | ||
Check failureCode scanning / ESLint Require or disallow semicolons instead of ASI Error
Extra semicolon.
|
||
| } | ||
|
|
||
| const isAnimePage = document.querySelector(".poster-block"); | ||
Check failureCode scanning / ESLint Enforce the consistent use of either backticks, double, or single quotes Error
Strings must use singlequote.
Check failureCode scanning / ESLint Require or disallow semicolons instead of ASI Error
Extra semicolon.
|
||
|
|
||
| if (!isAnimePage) { | ||
| presenceData.details = "На сайте YummyAnime"; | ||
Check failureCode scanning / ESLint Enforce the consistent use of either backticks, double, or single quotes Error
Strings must use singlequote.
Check failureCode scanning / ESLint Require or disallow semicolons instead of ASI Error
Extra semicolon.
|
||
|
|
||
| const pageTitle = document.querySelector("h1")?.textContent?.trim(); | ||
Check failureCode scanning / ESLint Enforce the consistent use of either backticks, double, or single quotes Error
Strings must use singlequote.
Check failureCode scanning / ESLint Require or disallow semicolons instead of ASI Error
Extra semicolon.
|
||
|
|
||
| if (pageTitle) { | ||
| presenceData.state = pageTitle; | ||
Check failureCode scanning / ESLint Require or disallow semicolons instead of ASI Error
Extra semicolon.
|
||
| } else { | ||
Check failureCode scanning / ESLint Enforce consistent brace style for blocks Error
Closing curly brace appears on the same line as the subsequent block.
|
||
| delete presenceData.state; | ||
Check failureCode scanning / ESLint Require or disallow semicolons instead of ASI Error
Extra semicolon.
|
||
| } | ||
|
|
||
| delete presenceData.startTimestamp; | ||
Check failureCode scanning / ESLint Require or disallow semicolons instead of ASI Error
Extra semicolon.
|
||
| delete presenceData.endTimestamp; | ||
Check failureCode scanning / ESLint Require or disallow semicolons instead of ASI Error
Extra semicolon.
|
||
|
|
||
| presence.setActivity(presenceData); | ||
Check failureCode scanning / ESLint Require or disallow semicolons instead of ASI Error
Extra semicolon.
|
||
| return; | ||
Check failureCode scanning / ESLint Require or disallow semicolons instead of ASI Error
Extra semicolon.
|
||
| } | ||
|
|
||
| const titleHeader = document.querySelector("h1"); | ||
Check failureCode scanning / ESLint Enforce the consistent use of either backticks, double, or single quotes Error
Strings must use singlequote.
Check failureCode scanning / ESLint Require or disallow semicolons instead of ASI Error
Extra semicolon.
|
||
| if (titleHeader) { | ||
| presenceData.details = titleHeader.textContent?.trim(); | ||
Check failureCode scanning / ESLint Require or disallow semicolons instead of ASI Error
Extra semicolon.
|
||
| } else { | ||
Check failureCode scanning / ESLint Enforce consistent brace style for blocks Error
Closing curly brace appears on the same line as the subsequent block.
|
||
| presenceData.details = "Смотрит аниме"; | ||
Check failureCode scanning / ESLint Enforce the consistent use of either backticks, double, or single quotes Error
Strings must use singlequote.
Check failureCode scanning / ESLint Require or disallow semicolons instead of ASI Error
Extra semicolon.
|
||
| } | ||
|
|
||
| const posterImg = document.querySelector( | ||
| "div.poster-block img", | ||
Check failureCode scanning / ESLint Enforce the consistent use of either backticks, double, or single quotes Error
Strings must use singlequote.
|
||
| ) as HTMLImageElement; | ||
Check failureCode scanning / ESLint Require or disallow semicolons instead of ASI Error
Extra semicolon.
|
||
| if (posterImg && posterImg.src) { | ||
| if (posterImg.src.startsWith("//")) { | ||
Check failureCode scanning / ESLint Enforce the consistent use of either backticks, double, or single quotes Error
Strings must use singlequote.
|
||
| presenceData.largeImageKey = `https:${posterImg.getAttribute("src")}`; | ||
Check failureCode scanning / ESLint Enforce the consistent use of either backticks, double, or single quotes Error
Strings must use singlequote.
Check failureCode scanning / ESLint Require or disallow semicolons instead of ASI Error
Extra semicolon.
|
||
| } else if (posterImg.src.startsWith("/")) { | ||
Check failureCode scanning / ESLint Enforce consistent brace style for blocks Error
Closing curly brace appears on the same line as the subsequent block.
Check failureCode scanning / ESLint Enforce the consistent use of either backticks, double, or single quotes Error
Strings must use singlequote.
|
||
| presenceData.largeImageKey = `https://site.yummyani.me${posterImg.getAttribute("src")}`; | ||
Check failureCode scanning / ESLint Enforce the consistent use of either backticks, double, or single quotes Error
Strings must use singlequote.
Check failureCode scanning / ESLint Require or disallow semicolons instead of ASI Error
Extra semicolon.
|
||
| } else { | ||
Check failureCode scanning / ESLint Enforce consistent brace style for blocks Error
Closing curly brace appears on the same line as the subsequent block.
|
||
| presenceData.largeImageKey = posterImg.src; | ||
Check failureCode scanning / ESLint Require or disallow semicolons instead of ASI Error
Extra semicolon.
|
||
| } | ||
| } | ||
|
|
||
| const activeBtn = document.querySelector('div[class*="pQCG"]'); | ||
Check failureCode scanning / ESLint Require or disallow semicolons instead of ASI Error
Extra semicolon.
|
||
| let currentEpisode = ""; | ||
Check failureCode scanning / ESLint Enforce the consistent use of either backticks, double, or single quotes Error
Strings must use singlequote.
Check failureCode scanning / ESLint Require or disallow semicolons instead of ASI Error
Extra semicolon.
|
||
| if (activeBtn) { | ||
| const text = activeBtn.textContent?.trim(); | ||
Check failureCode scanning / ESLint Require or disallow semicolons instead of ASI Error
Extra semicolon.
|
||
| if (text && !Number.isNaN(Number(text))) currentEpisode = text; | ||
Check failureCode scanning / ESLint Newline after if Error
Expect newline after if
Check failureCode scanning / ESLint Require or disallow semicolons instead of ASI Error
Extra semicolon.
|
||
| } | ||
|
|
||
| if (videoData.hasData) { | ||
| if (!videoData.paused) { | ||
| // === PLAY === | ||
| presenceData.state = currentEpisode | ||
| ? `Смотрит серию: ${currentEpisode}` | ||
| : "Смотрит видео"; | ||
Check failureCode scanning / ESLint Enforce the consistent use of either backticks, double, or single quotes Error
Strings must use singlequote.
Check failureCode scanning / ESLint Require or disallow semicolons instead of ASI Error
Extra semicolon.
|
||
|
|
||
| const now = Date.now(); | ||
Check failureCode scanning / ESLint Require or disallow semicolons instead of ASI Error
Extra semicolon.
|
||
| const remainingMs = (videoData.duration - videoData.currentTime) * 1000; | ||
Check failureCode scanning / ESLint Require or disallow semicolons instead of ASI Error
Extra semicolon.
|
||
|
|
||
| presenceData.endTimestamp = now + remainingMs; | ||
Check failureCode scanning / ESLint Require or disallow semicolons instead of ASI Error
Extra semicolon.
|
||
|
|
||
| delete presenceData.startTimestamp; | ||
Check failureCode scanning / ESLint Require or disallow semicolons instead of ASI Error
Extra semicolon.
|
||
| } else { | ||
Check failureCode scanning / ESLint Enforce consistent brace style for blocks Error
Closing curly brace appears on the same line as the subsequent block.
|
||
| presenceData.state = currentEpisode | ||
| ? `Серия ${currentEpisode} (Пауза)` | ||
| : "На паузе"; | ||
Check failureCode scanning / ESLint Enforce the consistent use of either backticks, double, or single quotes Error
Strings must use singlequote.
Check failureCode scanning / ESLint Require or disallow semicolons instead of ASI Error
Extra semicolon.
|
||
|
|
||
| delete presenceData.startTimestamp; | ||
Check failureCode scanning / ESLint Require or disallow semicolons instead of ASI Error
Extra semicolon.
|
||
| delete presenceData.endTimestamp; | ||
Check failureCode scanning / ESLint Require or disallow semicolons instead of ASI Error
Extra semicolon.
|
||
| } | ||
| } else { | ||
Check failureCode scanning / ESLint Enforce consistent brace style for blocks Error
Closing curly brace appears on the same line as the subsequent block.
|
||
| const videoElement = document.querySelector("#video"); | ||
Check failureCode scanning / ESLint Enforce the consistent use of either backticks, double, or single quotes Error
Strings must use singlequote.
Check failureCode scanning / ESLint Require or disallow semicolons instead of ASI Error
Extra semicolon.
|
||
| let isWatchingBlock = false; | ||
Check failureCode scanning / ESLint Require or disallow semicolons instead of ASI Error
Extra semicolon.
|
||
|
|
||
| if (videoElement) { | ||
| const rect = videoElement.getBoundingClientRect(); | ||
Check failureCode scanning / ESLint Require or disallow semicolons instead of ASI Error
Extra semicolon.
|
||
| const viewHeight = Math.max( | ||
| document.documentElement.clientHeight, | ||
| window.innerHeight, | ||
| ); | ||
Check failureCode scanning / ESLint Require or disallow semicolons instead of ASI Error
Extra semicolon.
|
||
| if (!(rect.bottom < 0 || rect.top - viewHeight >= 0)) | ||
| isWatchingBlock = true; | ||
Check failureCode scanning / ESLint Require or disallow semicolons instead of ASI Error
Extra semicolon.
|
||
| } | ||
|
|
||
| if (currentEpisode && isWatchingBlock) { | ||
| presenceData.state = `Готовится к просмотру: ${currentEpisode}`; | ||
Check failureCode scanning / ESLint Require or disallow semicolons instead of ASI Error
Extra semicolon.
|
||
| } else { | ||
Check failureCode scanning / ESLint Enforce consistent brace style for blocks Error
Closing curly brace appears on the same line as the subsequent block.
|
||
| presenceData.state = "Читает описание"; | ||
Check failureCode scanning / ESLint Enforce the consistent use of either backticks, double, or single quotes Error
Strings must use singlequote.
Check failureCode scanning / ESLint Require or disallow semicolons instead of ASI Error
Extra semicolon.
|
||
| } | ||
|
|
||
| delete presenceData.startTimestamp; | ||
Check failureCode scanning / ESLint Require or disallow semicolons instead of ASI Error
Extra semicolon.
|
||
| delete presenceData.endTimestamp; | ||
Check failureCode scanning / ESLint Require or disallow semicolons instead of ASI Error
Extra semicolon.
|
||
| } | ||
|
|
||
| presence.setActivity(presenceData); | ||
Check failureCode scanning / ESLint Require or disallow semicolons instead of ASI Error
Extra semicolon.
|
||
| }); | ||
Check failureCode scanning / ESLint Require or disallow semicolons instead of ASI Error
Extra semicolon.
|
||
Uh oh!
There was an error while loading. Please reload this page.