Put Youtube subtitles on top of everything

Use this script if you want subtitles float on entire screen!

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

  1. // ==UserScript==
  2. // @name Put Youtube subtitles on top of everything
  3. // @namespace http://www.chaochaogege.com
  4. // @version 0.1
  5. // @description Use this script if you want subtitles float on entire screen!
  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('#primary-inner')
  14. // const subtitlesdiv = document.querySelector('.caption-window')
  15. monitordom(over,(lists) => {
  16. if (lists.addedNodes.length > 0){
  17. const n = lists.addedNodes[0]
  18. if (typeof n.className == 'string' && n.className.includes('caption-window')) {
  19. n.style.position = "fixed"
  20. }
  21. }
  22. },{attributes: true, childList: true, subtree: true})
  23. over.style['z-index'] = 4000
  24. over.style.position = 'relative'
  25. }()