twitch clickable video

This commit is contained in:
2023-04-09 22:21:14 -05:00
parent 1e616dd256
commit 3ae471de0f
7 changed files with 183 additions and 196 deletions

View 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()))

View 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"
}

View 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"
]
}
}