Plain old youtube.com (2019)

11/28/2019, 9:31:23 PM

  1. // ==UserScript==
  2. // @name Plain old youtube.com (2019)
  3. // @namespace tei.su
  4. // @match https://www.youtube.com/*
  5. // @grant none
  6. // @version 1.0
  7. // @author teidesu
  8. // @description 11/28/2019, 9:31:23 PM
  9. // @run-at document-start
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. function replace() {
  14. if (!location.search.match(/[?&]disable_polymer=/)) {
  15. var h = location.search.indexOf('?') > -1 ? '&' : '?'
  16. location.href += h + 'disable_polymer=1'
  17. }
  18. }
  19. replace()
  20. window.addEventListener('popstate', replace)
  21. document.addEventListener('DOMContentLoaded', () => {
  22. document.querySelectorAll('a[href]').forEach(it => {
  23. if (it.href.match(/^(https?:)?\/\/(?!(www\.)?youtube\.com)/)) return // external links
  24. var h = it.href.indexOf('?') > -1 ? '&' : '?'
  25. it.href += h + 'disable_polymer=1'
  26. })
  27. })
  28. })()
  29.