Greasy Fork 还支持 简体中文。

invidio.us auto-dash

Automatically appends "quality=dash" to an invidio.us URL if "the media could not be loaded"

目前為 2020-08-02 提交的版本,檢視 最新版本

  1. // ==UserScript==
  2. // @name invidio.us auto-dash
  3. // @description Automatically appends "quality=dash" to an invidio.us URL if "the media could not be loaded"
  4. // @author nullgemm
  5. // @version 0.1.3
  6. // @grant none
  7. // @match https://invidio.?us.*/watch?v=*
  8. // @run-at document-idle
  9. // @namespace https://greasyfork.org/en/users/322108-nullgemm
  10. // ==/UserScript==
  11.  
  12. var elem = document.getElementsByClassName("vjs-modal-dialog-content")[0];
  13. var url = new URL(window.location);
  14.  
  15. function mutation_callback(mutations) {
  16. if (elem.childNodes.length == 1) {
  17. url.searchParams.set("quality", "dash")
  18. window.location.replace(url);
  19. }
  20. }
  21.  
  22. function mutation_caller(mutations, observer) {
  23. mutation_callback(mutations);
  24. }
  25.  
  26. var obs = new window.MutationObserver(mutation_caller);
  27. obs.observe(elem, {childList:true, subtree:true});