twitch clickable video
This commit is contained in:
19
scripts/twitch-clickable-video/main.ts
Normal file
19
scripts/twitch-clickable-video/main.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
const getElems = () => [
|
||||
document.querySelector<HTMLDivElement>('.video-player__overlay'),
|
||||
document.querySelector<HTMLDivElement>(
|
||||
'.video-player__overlay:nth-child(1) > div:nth-child(1)'
|
||||
),
|
||||
document.querySelector<HTMLDivElement>(
|
||||
'.video-player__overlay:nth-child(1) > div:nth-child(1) > div:nth-child(1)'
|
||||
),
|
||||
document.querySelector<HTMLDivElement>('.click-handler'),
|
||||
]
|
||||
|
||||
const elemsSet = () =>
|
||||
getElems().forEach(elem => elem && (elem.style.pointerEvents = 'none'))
|
||||
const elemsClear = () =>
|
||||
getElems().forEach(elem => elem && (elem.style.pointerEvents = ''))
|
||||
|
||||
addEventListener('keydown', e => e.key === 'Control' && elemsSet())
|
||||
addEventListener('keyup', e => e.key === 'Control' && elemsClear())
|
||||
addEventListener('click', e => (e.ctrlKey ? elemsSet() : elemsClear()))
|
||||
8
scripts/twitch-clickable-video/meta.json
Normal file
8
scripts/twitch-clickable-video/meta.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"$schema": "https://git.zomo.dev/zomo/browser-scripts-builder/raw/branch/main/meta.schema.json",
|
||||
"name": "Twitch Clickable Video",
|
||||
"namespace": "zomo.dev",
|
||||
"match": "https://twitch.tv/*",
|
||||
"version": "1.0",
|
||||
"description": "hold Control key to be able to right click the video element"
|
||||
}
|
||||
17
scripts/twitch-clickable-video/tsconfig.json
Normal file
17
scripts/twitch-clickable-video/tsconfig.json
Normal file
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "es2020",
|
||||
"module": "commonjs",
|
||||
"esModuleInterop": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"skipLibCheck": true,
|
||||
"strict": true,
|
||||
"noImplicitReturns": true,
|
||||
"noUnusedLocals": true,
|
||||
"noUnusedParameters": true,
|
||||
"types": [
|
||||
"../../node_modules/@types/greasemonkey",
|
||||
"../../node_modules/browser-scripts-builder"
|
||||
]
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user