-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
348e051
commit 3303e6e
Showing
5 changed files
with
103 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
.cycanime.widescreen { | ||
.header_nav0, | ||
.top-back.hoa, | ||
.fixedGroup { | ||
visibility: hidden; | ||
pointer-events: none; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { runtime } from '../../runtime' | ||
import { iframePlayer, runInTop, parser } from './play' | ||
import './index.scss' | ||
|
||
runtime.register({ | ||
domains: ['.cycanime.'], | ||
opts: [ | ||
{ test: '/watch', run: runInTop }, | ||
{ test: '/watch', run: iframePlayer.runInIframe, runInIframe: true }, | ||
{ | ||
test: () => location.hostname.includes('player.cycanime'), | ||
run: parser, | ||
runInIframe: true, | ||
}, | ||
], | ||
search: { | ||
name: '次元城', | ||
search: (name) => `https://www.cycanime.com/search.html?wd=${name}`, | ||
getSearchName: () => { | ||
return new Promise((resolve) => { | ||
const fn = (e: MessageEvent<any>) => { | ||
if (e.data.key === 'getSearchName') { | ||
resolve(e.data.name) | ||
window.removeEventListener('message', fn) | ||
} | ||
} | ||
window.addEventListener('message', fn) | ||
parent.postMessage({ key: 'getSearchName' }, '*') | ||
}) | ||
}, | ||
getEpisode: () => { | ||
return new Promise((resolve) => { | ||
const fn = (e: MessageEvent<any>) => { | ||
if (e.data.key === 'getEpisode') { | ||
resolve(e.data.name) | ||
window.removeEventListener('message', fn) | ||
} | ||
} | ||
window.addEventListener('message', fn) | ||
parent.postMessage({ key: 'getEpisode' }, '*') | ||
}) | ||
}, | ||
}, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import { KPlayer } from '../../player' | ||
import { queryDom } from '../../utils/queryDom' | ||
import { wait } from '../../utils/wait' | ||
import { defineIframePlayer } from '../common/defineIframePlayer' | ||
function getActive() { | ||
return $<HTMLAnchorElement>('.anthology-list-play li.on > a') | ||
} | ||
function switchPart(next: boolean) { | ||
return getActive().parent()[next ? 'next' : 'prev']().find('a')[0]?.href | ||
} | ||
|
||
export function runInTop() { | ||
$('body').addClass('cycanime') | ||
iframePlayer.runInTop() | ||
} | ||
|
||
export const iframePlayer = defineIframePlayer({ | ||
iframeSelector: '#playleft iframe', | ||
getActive, | ||
setActive: (href) => { | ||
$<HTMLAnchorElement>('.anthology-list-play li a').each((_, el) => { | ||
if (el.href === href) { | ||
el.parentElement!.classList.add('ecnav-dt', 'on') | ||
$('.play-on').insertAfter($(el).find('span')) | ||
} else { | ||
el.parentElement!.classList.remove('ecnav-dt', 'on') | ||
} | ||
}) | ||
}, | ||
search: { | ||
getSearchName: () => $('.player-title-link').text(), | ||
getEpisode: () => getActive().text(), | ||
}, | ||
getEpisodeList: () => $('.anthology-list-play li a'), | ||
switchEpisode: (next) => switchPart(next), | ||
}) | ||
|
||
export async function parser() { | ||
const video = await queryDom<HTMLVideoElement>('video') | ||
|
||
await wait(() => !!video.currentSrc) | ||
let url = video.currentSrc | ||
video.src = '' | ||
const player = new KPlayer('#mui-player', { | ||
eventToParentWindow: true, | ||
}) | ||
player.src = url | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,4 @@ import './agefans' | |
import './ntdm9' | ||
import './bimiacg' | ||
import './mutean' | ||
import './cycanime' |