File tree Expand file tree Collapse file tree 3 files changed +45
-3
lines changed
Expand file tree Collapse file tree 3 files changed +45
-3
lines changed Original file line number Diff line number Diff line change 1+ const iframe = new iFrame ( )
2+
3+ iframe . on ( 'UpdateData' , async ( ) => {
4+ const video = document . querySelector ( 'video' )
5+
6+ if ( video ) {
7+ const data = {
8+ currentTime : video . currentTime ,
9+ paused : video . paused ,
10+ duration : video . duration ,
11+ }
12+ iframe . send ( data )
13+ }
14+ } )
Original file line number Diff line number Diff line change 2020 " animecix.net" ,
2121 " anm.cx"
2222 ],
23- "version" : " 1.0.2 " ,
23+ "version" : " 1.0.3 " ,
2424 "logo" : " https://cdn.rcd.gg/PreMiD/websites/A/AnimeciX/assets/logo.png" ,
2525 "thumbnail" : " https://cdn.rcd.gg/PreMiD/websites/A/AnimeciX/assets/thumbnail.jpeg" ,
2626 "color" : " #b6eafd" ,
3030 " dizi" ,
3131 " turkish" ,
3232 " movie"
33- ]
33+ ],
34+ "iframe" : true ,
35+ "iFrameRegExp" : " https?:\\ /\\ /anm\\ .cx\\ /secure\\ /best-video\\ ?.*|https?:\\ /\\ /tau-video\\ .xyz\\ /embed\\ /.*|https?:\\ /\\ /ok\\ .ru\\ /videoembed\\ /.*|https?:\\ /\\ /drive\\ .google\\ .com\\ /file\\ /d\\ /.*|https?:\\ /\\ /uqload\\ .io\\ /.*|https?:\\ /\\ /doodstream\\ .com\\ /e\\ /.*"
3436}
Original file line number Diff line number Diff line change 1- import { ActivityType , Assets } from 'premid'
1+ import { ActivityType , Assets , getTimestamps } from 'premid'
22
33const presence = new Presence ( {
44 clientId : '1336362292622655569' ,
@@ -10,6 +10,20 @@ enum Images {
1010 SettingsICO = 'https://cdn.rcd.gg/PreMiD/websites/A/AnimeciX/assets/0.png' ,
1111}
1212
13+ interface iframeData {
14+ duration : number
15+ currentTime : number
16+ paused : boolean
17+ }
18+ let video : iframeData | null = null
19+
20+ presence . on ( 'iFrameData' , ( data : unknown ) => {
21+ if ( data ) {
22+ video = data as iframeData
23+ updatePresence ( )
24+ }
25+ } )
26+
1327function observeDOMChanges ( callback : ( ) => void ) {
1428 new MutationObserver ( ( ) => {
1529 callback ( )
@@ -44,6 +58,18 @@ function updatePresence() {
4458 ?. textContent || 'Loading'
4559 presenceData . state = document . querySelector ( '.episode-number' ) ?. textContent || 'Loading'
4660
61+ if ( video ) {
62+ presenceData . smallImageKey = video . paused
63+ ? Assets . Pause
64+ : Assets . Play
65+ presenceData . smallImageText = video . paused ? 'Duraklatıldı' : 'Oynatılıyor' ;
66+
67+ [ presenceData . startTimestamp , presenceData . endTimestamp ] = getTimestamps ( video . currentTime , video . duration )
68+
69+ if ( video . paused )
70+ delete presenceData . endTimestamp
71+ }
72+
4773 // EPİSODES PAGE
4874 }
4975 else if (
You can’t perform that action at this time.
0 commit comments