Fix Twitch

Undo the nasty parts of the new twitch layout

  1. // ==UserScript==
  2. // @name Fix Twitch
  3. // @namespace 323851-gjwse90gj98we
  4. // @version 0.9
  5. // @description Undo the nasty parts of the new twitch layout
  6. // @author Viper-7, anon
  7. // @match https://www.twitch.tv/*
  8. // @noframes
  9. // @grant none
  10. // ==/UserScript==
  11.  
  12. function addGlobalStyle(css) {
  13. var head, style;
  14. head = document.getElementsByTagName('head')[0];
  15. if (!head) { return; }
  16. style = document.createElement('style');
  17. style.type = 'text/css';
  18. style.innerHTML = css;
  19. head.appendChild(style);
  20. }
  21.  
  22. (function() {
  23. 'use strict';
  24.  
  25. var e = document.getElementsByTagName( 'html' )[0];
  26. //e.setAttribute( 'class', 'tw-root--theme-dark' );
  27. if (e.classList.contains('tw-root--theme-dark')) {
  28. addGlobalStyle('html .tw-c-text-alt-2 { color: #898395 !important; }');
  29. addGlobalStyle('html .tw-semibold { font-weight: 400 !important; }');
  30. addGlobalStyle('html .tw-c-text-alt { color: #b8b5c0 !important; }');
  31. addGlobalStyle('html section.chat-room { background-color: rgb(15,14,17) !important; }');
  32. addGlobalStyle('html div.channel-root__right-column { background-color: #232127 !important; }');
  33. addGlobalStyle('html .tw-c-text-base { color: #dad8de !important; }');
  34. addGlobalStyle('html .top-nav__menu { background-color: #4b367c !important; }');
  35. addGlobalStyle('html .tw-root--theme-dark body { background-color: #0f0e11 !important; }');
  36. addGlobalStyle('a, abbr, acronym, address, applet, article, aside, audio, b, big, blockquote, body, canvas, caption, center, cite, code, dd, del, details, dfn, div, dl, dt, em, embed, fieldset, figcaption, figure, footer, form, h1, h2, h3, h4, h5, h6, header, hgroup, html, i, iframe, img, ins, kbd, label, legend, li, mark, menu, nav, object, ol, output, p, pre, q, ruby, s, samp, section, small, span, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, time, tr, tt, u, ul, var, video { font-family: "Helvetica Neue", Helvetica, Arial, sans-serif !important; }');
  37. addGlobalStyle('html .tw-font-size-4 { font-size: 1.4rem !important; font-weight: 400 !important; color: #b19dd8 !important; }');
  38. addGlobalStyle('html .tw-input { background-color: #232127 !important; }');
  39. addGlobalStyle('body { background-color: #18181b !important; }');
  40. }
  41. var observer = new MutationObserver(function (event) {
  42. console.log(event);
  43.  
  44. if (localStorage.getItem("twilight.theme") == "1") {
  45. console.log('yes');
  46. addGlobalStyle('html .tw-c-text-alt-2 { color: #898395 !important; }');
  47. addGlobalStyle('html .tw-semibold { font-weight: 400 !important; }');
  48. addGlobalStyle('html .tw-c-text-alt { color: #b8b5c0 !important; }');
  49. addGlobalStyle('html section.chat-room { background-color: rgb(15,14,17) !important; }');
  50. addGlobalStyle('html div.channel-root__right-column { background-color: #232127 !important; }');
  51. addGlobalStyle('html .tw-c-text-base { color: #dad8de !important; }');
  52. addGlobalStyle('html .top-nav__menu { background-color: #4b367c !important; }');
  53. addGlobalStyle('html .tw-root--theme-dark body { background-color: #0f0e11 !important; }');
  54. addGlobalStyle('a, abbr, acronym, address, applet, article, aside, audio, b, big, blockquote, body, canvas, caption, center, cite, code, dd, del, details, dfn, div, dl, dt, em, embed, fieldset, figcaption, figure, footer, form, h1, h2, h3, h4, h5, h6, header, hgroup, html, i, iframe, img, ins, kbd, label, legend, li, mark, menu, nav, object, ol, output, p, pre, q, ruby, s, samp, section, small, span, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, time, tr, tt, u, ul, var, video { font-family: "Helvetica Neue", Helvetica, Arial, sans-serif !important; }');
  55. addGlobalStyle('html .tw-font-size-4 { font-size: 1.4rem !important; font-weight: 400 !important; color: #b19dd8 !important; }');
  56. addGlobalStyle('html .tw-input { background-color: #232127 !important; }');
  57. addGlobalStyle('body { background-color: #18181b !important; }');
  58. addGlobalStyle('html .side-nav { background-color: #212126 !important; }');
  59. addGlobalStyle('html .side-nav .tw-svg__asset, html .side-nav .tw-icon__svg { fill: rgb(137, 131, 149) !important; }');
  60.  
  61. //addGlobalStyle('html .side-nav .upsell-center-text__header { color: #19171c !important; }');
  62. //addGlobalStyle('html .side-nav .side-nav-card__link:hover { background: #2f2f37 !important; }');
  63. //addGlobalStyle('html .side-nav .side-nav-header { color: #fff !important; }');
  64. //addGlobalStyle('html .side-nav .tw-link { color: #772ce8 !important; }');
  65. } else {
  66. console.log('no');
  67. addGlobalStyle('html .tw-c-text-alt-2 { color: #898395 !important; }');
  68. addGlobalStyle('html .tw-semibold { font-weight: 400 !important; }');
  69. addGlobalStyle('html .tw-c-text-alt { color: #b8b5c0 !important; }');
  70. addGlobalStyle('html section.chat-room { background-color: #EFEEF1 !important; }');
  71. addGlobalStyle('html div.channel-root__right-column { background-color: #EFEEF1 !important; }');
  72. addGlobalStyle('html .tw-c-text-base { color: #dad8de !important; }');
  73. addGlobalStyle('html .top-nav__menu { background-color: #4b367c !important; }');
  74. addGlobalStyle('html .top-nav__menu .tw-font-size-4 { color: #fff !important; }');
  75. //.tw-input
  76. addGlobalStyle('html .tw-root--theme-dark body { background-color: #0f0e11 !important; }');
  77. addGlobalStyle('a, abbr, acronym, address, applet, article, aside, audio, b, big, blockquote, body, canvas, caption, center, cite, code, dd, del, details, dfn, div, dl, dt, em, embed, fieldset, figcaption, figure, footer, form, h1, h2, h3, h4, h5, h6, header, hgroup, html, i, iframe, img, ins, kbd, label, legend, li, mark, menu, nav, object, ol, output, p, pre, q, ruby, s, samp, section, small, span, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, time, tr, tt, u, ul, var, video { font-family: "Helvetica Neue", Helvetica, Arial, sans-serif !important; }');
  78. addGlobalStyle('html .tw-font-size-4 { font-size: 1.4rem !important; font-weight: 400 !important; color: #19171c !important; }');
  79. addGlobalStyle('html .tw-input { background-color: #fff !important; }');
  80. addGlobalStyle('body { background-color: #FAF9FA !important; }');
  81. addGlobalStyle('html .side-nav { background-color: #17141F !important; }');
  82. addGlobalStyle('html .side-nav .tw-svg__asset, html .side-nav .tw-icon__svg, html .top-nav__menu .tw-icon__svg { fill: rgb(137, 131, 149) !important; }');
  83. addGlobalStyle('html .side-nav .upsell-center-text__header { color: #19171c !important; }');
  84. addGlobalStyle('html .side-nav .side-nav-card__link:hover { background: #2f2f37 !important; }');
  85. addGlobalStyle('html .side-nav .side-nav-header { color: #fff !important; }');
  86. addGlobalStyle('html .side-nav .tw-link { color: rgb(191, 148, 255) !important; }');
  87.  
  88. }
  89.  
  90.  
  91. })
  92.  
  93. observer.observe(e, {
  94. attributes: true,
  95. attributeFilter: ['class'],
  96. childList: false,
  97. characterData: false
  98. })
  99.  
  100. })();
  101.  

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址