-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(webpage): generic website support
- Loading branch information
Showing
5 changed files
with
143 additions
and
80 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 |
---|---|---|
@@ -1,10 +1,11 @@ | ||
import BilibiliPlugin from "inline:./userscript/bilibili"; | ||
import VimeoPlugin from "inline:./userscript/vimeo"; | ||
import YouTubePlugin from "inline:./userscript/youtube"; | ||
import type { SupportedMediaHost } from "./url-match/supported"; | ||
|
||
export const plugins = { | ||
bilibili: BilibiliPlugin, | ||
youtube: YouTubePlugin, | ||
vimeo: undefined, | ||
vimeo: VimeoPlugin, | ||
generic: undefined, | ||
} satisfies Record<SupportedMediaHost, string | undefined>; |
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,31 @@ | ||
// hugely inspired by https://greasyfork.org/zh-CN/scripts/4870-maximize-video | ||
|
||
const css = ` | ||
.vp-player-ui-overlays { | ||
opacity: 0 !important; | ||
} | ||
.mx-show-controls .vp-player-ui-overlays { | ||
opacity: 100 !important; | ||
} | ||
`; | ||
|
||
/* eslint-disable @typescript-eslint/naming-convention */ | ||
import { requireMx } from "./_require"; | ||
|
||
const { waitForSelector, MediaPlugin } = requireMx(); | ||
|
||
export default class VimeoPlugin extends MediaPlugin { | ||
findMedia(): Promise<HTMLMediaElement> { | ||
return waitForSelector<HTMLMediaElement>( | ||
"#main [data-player] .vp-video video", | ||
); | ||
} | ||
|
||
getStyle() { | ||
const base = super.getStyle(); | ||
return base + "\n" + css; | ||
} | ||
// async onload(): Promise<void> { | ||
// await super.onload(); | ||
// } | ||
} |
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