override-missav-css

override missav css

  1. // ==UserScript==
  2. // @name override-missav-css
  3. // @namespace https://missav.com
  4. // @version v0.0.5
  5. // @description override missav css
  6. // @author You
  7. // @match https://missav.com/*
  8. // @exclude /^https:\/\/missav\.com\/.*-\d+.*$/
  9. // @icon https://www.google.com/s2/favicons?sz=64&domain=missav.com
  10. // @grant none
  11. // ==/UserScript==
  12.  
  13. // 注入 css
  14. const injectTruncateCss = () => {
  15. const css = `
  16. /* 你的全局CSS */
  17. .truncate {
  18. overflow: auto;
  19. text-overflow: auto;
  20. white-space: inherit;
  21. }
  22. `;
  23.  
  24. const style = document.createElement("style");
  25. style.type = "text/css";
  26. style.appendChild(document.createTextNode(css));
  27. document.head.appendChild(style);
  28. };
  29.  
  30. const injectVideoCss = () => {
  31. const css = `
  32. /* 你的全局CSS */
  33. .thumbnail > div:first-child > a:first-child > video.hidden {
  34. display: block !important;
  35. }
  36. `;
  37.  
  38. const style = document.createElement("style");
  39. style.type = "text/css";
  40. style.appendChild(document.createTextNode(css));
  41. document.head.appendChild(style);
  42. };
  43.  
  44. (function () {
  45. "use strict";
  46. injectTruncateCss();
  47. setInterval(() => {
  48. if (window.player != null) {
  49. return;
  50. }
  51.  
  52. const autoPlay = localStorage.getItem("autoPlay");
  53.  
  54. if (autoPlay === "1") {
  55. injectVideoCss();
  56. }
  57. }, 1000);
  58. })();