Last active
November 14, 2022 22:40
-
-
Save taikulawo/8bf9d1ea3aa38120a9ed07014cd5d73e to your computer and use it in GitHub Desktop.
youtube tempermonkey userscript
This file contains hidden or 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
// ==UserScript== | |
// @name Youtube entancer of mine | |
// @namespace http://www.chaochaogege.com | |
// @version 0.6 | |
// @description Some of youtube entancer of mine | |
// @author You | |
// @match https://www.youtube.com/watch?* | |
// @grant none | |
// @require https://greasyfork.org/scripts/402597-monitor-dom-change/code/monitor%20dom%20change.js?version=801281 | |
// ==/UserScript== | |
!function () { | |
const over = document.querySelector('body') | |
const container = document.querySelector('.html5-video-player') | |
// const subtitlesdiv = document.querySelector('.caption-window') | |
function addMultipleListener(target, events, fn, useCapture) { | |
for (const e of events) { | |
target.addEventListener(e, fn, useCapture) | |
} | |
} | |
addMultipleListener(container, ['click', 'touchstart', 'mouseout', 'mousedown', 'mousemove'], e => { | |
for (let idx = 0; idx < 5; idx++) { | |
if (e.path[idx].className.includes('caption-window')) { | |
e.stopPropagation() | |
return | |
} | |
} | |
}, true) | |
monitordom(over, (lists) => { | |
if (lists.addedNodes.length > 0) { | |
const n = lists.addedNodes[0] | |
if (typeof n.className == 'string') { | |
if (n.className.includes('ytp-caption-segment')) { | |
let stylelists = n.style | |
stylelists['user-select'] = 'text' | |
} | |
} | |
} | |
}, { attributes: true, childList: true, subtree: true }) | |
}() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, thanks for the script. It works fine, although I'd proposed one addition: it could change the cursor to the appropriate ("cursor: text").