Twitch Chroma Chat

Chroma Key Style Background for Twitch Chat

  1. // ==UserScript==
  2. // @name Twitch Chroma Chat
  3. // @author TraCeRMan
  4. // @version 0.4
  5. // @description Chroma Key Style Background for Twitch Chat
  6. // @include http://*.twitch.tv/*
  7. // @include http://twitch.tv/*
  8. // @exclude http://www.twitch.tv/*/dashboard
  9. // @exclude http://www.twitch.tv/inbox*
  10. // @exclude http://www.twitch.tv/subscriptions*
  11. // @exclude http://store.twitch.tv
  12. // @exclude http://api.twitch.tv/*
  13. // @exclude https://api.twitch.tv/*
  14. // @require http://ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js
  15. // @grant GM_addStyle
  16. // @copyright 2013+, tracerman
  17. // @run-at document-end
  18. // @namespace https://gf.qytechs.cn/users/59
  19. // ==/UserScript==
  20.  
  21. var chatInt = $(".chat-interface").css("background-color");
  22. var showCheck72 = 0;
  23. var zNode14 = document.createElement ('div');
  24.  
  25. zNode14.innerHTML = '<button id="myButton14" type="button">'
  26. + 'C</button>';
  27.  
  28. zNode14.setAttribute ('id', 'myContainer14');
  29. document.body.appendChild (zNode14);
  30.  
  31. //--- New Features
  32.  
  33. //--- Activate the newly added button.
  34. document.getElementById ("myButton14").addEventListener (
  35. "click", ButtonClickAction, false
  36. );
  37.  
  38. function ButtonClickAction (zEvent) {
  39. if(showCheck72 == 1) {
  40. chatInt = $(".chat-interface").css("background-color");
  41. if (chatInt == "rgb(220, 220, 220)"){
  42. $(".chat-messages").each(function () {
  43. this.style.setProperty("background", "#dcdcdc", "important");
  44. });
  45. }
  46. else if (chatInt == "rgb(255, 255, 255)"){
  47. $(".chat-messages").each(function () {
  48. this.style.setProperty("background", "white", "important");
  49. });
  50. }
  51. else
  52. {
  53. $(".chat-messages").each(function () {
  54. this.style.setProperty("background", "rgb(30, 30, 30)", "important");
  55. });
  56. }
  57. $(".chat-messages").each(function () {
  58. //--- this.style.setProperty("background", chatBack, "important");
  59. this.style.setProperty("font-weight", "");
  60. });
  61. $(".chat-messages").each(function () {
  62. this.style.setProperty("background", "");
  63. });
  64. //--- Style our newly added elements using CSS.
  65. GM_addStyle ( multilineStr ( function () {/*!
  66. .chat-messages {
  67. font-size: 13.33333px !important;
  68. }
  69. .message {
  70. text-shadow: none;
  71. }
  72. .from {
  73. text-shadow: none;
  74. }
  75. */} ) );
  76. $("#myButton14").fadeTo("fast", 1).delay(200).css({"color":"green"});
  77. showCheck72 = 0;
  78. }
  79. else if(showCheck72 == 0) {
  80. $(".chat-messages").each(function () {
  81. this.style.setProperty("background", "#00ff00", "important");
  82. this.style.setProperty("font-weight", "bold");
  83. });
  84. //--- Style our newly added elements using CSS.
  85. GM_addStyle ( multilineStr ( function () {/*!
  86. .chat-messages {
  87. font-size: 14.5px !important;
  88. }
  89. .message {
  90. text-shadow: -1px 1px 10px white, 1px -1px 10px #fff;
  91. }
  92. .from {
  93. text-shadow: -1px 1px 8px yellow, 1px -1px 8px #fff;
  94. }
  95. */} ) );
  96. $("#myButton14").fadeTo("fast", 0.5).delay(200).css({"color":"red"});
  97. showCheck72 = 1;
  98. }
  99. else {
  100. }
  101. }
  102.  
  103. //--- Style our newly added elements using CSS.
  104. GM_addStyle ( multilineStr ( function () {/*!
  105. #myContainer14 {
  106. position: absolute;
  107. bottom: 0;
  108. right: 0;
  109. font-size: 10px;
  110. border: 0px outset black;
  111. margin: 0px;
  112. opacity: 10.0;
  113. z-index: 255;
  114. padding: 0px 1px;
  115. }
  116.  
  117. #myButton14 {
  118. cursor: pointer;
  119. background: transparent;
  120. border: none !important;
  121. color: green;
  122. font-weight: bold;
  123. }
  124.  
  125. */} ) );
  126.  
  127. function multilineStr (dummyFunc) {
  128. var str = dummyFunc.toString ();
  129. str = str.replace (/^[^\/]+\/\*!?/, '') // Strip function () { /*!
  130. .replace (/\s*\*\/\s*\}\s*$/, '') // Strip */ }
  131. .replace (/\/\/.+$/gm, '') // Double-slash comments wreck CSS. Strip them.
  132. ;
  133. return str;
  134. }

QingJ © 2025

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