abstracted elems definitions
This commit is contained in:
22
dist/twitch-clickable-video.user.js
vendored
22
dist/twitch-clickable-video.user.js
vendored
@@ -2,22 +2,22 @@
|
||||
// @name Twitch Clickable Video
|
||||
// @namespace zomo.dev
|
||||
// @match https://www.twitch.tv/*
|
||||
// @version 1.0
|
||||
// @version 1.1
|
||||
// @description hold Control key to be able to right click the video element
|
||||
// @downloadURL https://git.zomo.dev/zomo/browser-scripts/raw/branch/main/dist/twitch-clickable-video.user.js
|
||||
// @supportURL https://git.zomo.dev/zomo/browser-scripts/issues
|
||||
// @homepageURL https://git.zomo.dev/zomo/browser-scripts
|
||||
// ==/UserScript==
|
||||
var getElems = () => [
|
||||
document.querySelector('.video-player__overlay'),
|
||||
document.querySelector(
|
||||
'.video-player__overlay:nth-child(1) > div:nth-child(1)'
|
||||
),
|
||||
document.querySelector(
|
||||
'.video-player__overlay:nth-child(1) > div:nth-child(1) > div:nth-child(1)'
|
||||
),
|
||||
document.querySelector('.click-handler'),
|
||||
]
|
||||
var Elems = `
|
||||
.video-player__overlay,
|
||||
.video-player__overlay:nth-child(1) > div:nth-child(1),
|
||||
.video-player__overlay:nth-child(1) > div:nth-child(1) > div:nth-child(1),
|
||||
.click-handler
|
||||
`
|
||||
var getElems = () => {
|
||||
const elems = Elems.split(',').filter(l => l.trim().length)
|
||||
return elems.map(elem => document.querySelector(elem.trim()))
|
||||
}
|
||||
var elemsSet = () =>
|
||||
getElems().forEach(elem => elem && (elem.style.pointerEvents = 'none'))
|
||||
var elemsClear = () =>
|
||||
|
||||
@@ -9,6 +9,6 @@ Requires Violentmonkey (or Tampermonkey etc): [Chrome](https://chrome.google.com
|
||||
- zomo.dev 1.0
|
||||
- automatically grab optifine links through the ads
|
||||
- [Twitch Clickable Video](https://git.zomo.dev/zomo/browser-scripts/raw/branch/main/dist/twitch-clickable-video.user.js)
|
||||
- zomo.dev 1.0
|
||||
- zomo.dev 1.1
|
||||
- hold Control key to be able to right click the video element
|
||||
<!-- END INSTALL LINKS -->
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
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 Elems = `
|
||||
.video-player__overlay,
|
||||
.video-player__overlay:nth-child(1) > div:nth-child(1),
|
||||
.video-player__overlay:nth-child(1) > div:nth-child(1) > div:nth-child(1),
|
||||
.click-handler
|
||||
`
|
||||
|
||||
const getElems = () => {
|
||||
const elems = Elems.split(',').filter(l => l.trim().length)
|
||||
return elems.map(elem => document.querySelector<HTMLElement>(elem.trim()))
|
||||
}
|
||||
|
||||
const elemsSet = () =>
|
||||
getElems().forEach(elem => elem && (elem.style.pointerEvents = 'none'))
|
||||
|
||||
@@ -3,6 +3,6 @@
|
||||
"name": "Twitch Clickable Video",
|
||||
"namespace": "zomo.dev",
|
||||
"match": "https://www.twitch.tv/*",
|
||||
"version": "1.0",
|
||||
"version": "1.1",
|
||||
"description": "hold Control key to be able to right click the video element"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user