Youtube entancer of mine

Some of youtube entancer of mine

目前为 2020-05-15 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name Youtube entancer of mine
  3. // @namespace http://www.chaochaogege.com
  4. // @version 0.5
  5. // @description Some of youtube entancer of mine
  6. // @author You
  7. // @match https://www.youtube.com/watch?*
  8. // @grant none
  9. // @require https://greasyfork.org/scripts/402597-monitor-dom-change/code/monitor%20dom%20change.js?version=801281
  10. // ==/UserScript==
  11.  
  12. !function () {
  13. const over = document.querySelector('body')
  14. const container = document.querySelector('.html5-video-player')
  15. let right = ''
  16. let left = ''
  17. let top = ''
  18. let bottom = ''
  19. // const subtitlesdiv = document.querySelector('.caption-window')
  20. function addMultipleListener(target, events, fn,useCapture) {
  21. for (const e of events) {
  22. target.addEventListener(e, fn,useCapture)
  23. }
  24. }
  25. addMultipleListener(container,['click','touchstart','mouseout','mousedown','mousemove'],e =>{
  26. console.log(e)
  27. if (e.target.className.includes('ytp-caption-segment')) {
  28. e.stopPropagation()
  29. }
  30. },true)
  31. monitordom(over, (lists) => {
  32. if (lists.addedNodes.length > 0) {
  33. const n = lists.addedNodes[0]
  34. if (typeof n.className == 'string') {
  35. if (n.className.includes('ytp-caption-segment')) {
  36. let stylelists = n.style
  37. stylelists['user-select'] = 'text'
  38. }
  39. }
  40. }
  41. }, { attributes: true, childList: true, subtree: true })
  42. }()