Greasy Fork 支持简体中文。

Monster Twitch

Streches stream to max width and hides left navigation bar with an 'M' toggle on the bottom right

目前為 2014-03-10 提交的版本,檢視 最新版本

  1. // ==UserScript==
  2. // @name Monster Twitch
  3. // @namespace http://enut.co/dev
  4. // @version 2.59
  5. // @description Streches stream to max width and hides left navigation bar with an 'M' toggle on the bottom right
  6. // @include http://*.twitch.tv/*
  7. // @include http://twitch.tv/*
  8. // @exclude http://www.twitch.tv/directory*
  9. // @exclude http://www.twitch.tv/*/dashboard
  10. // @exclude http://www.twitch.tv/inbox*
  11. // @exclude http://www.twitch.tv/subscriptions*
  12. // @exclude http://store.twitch.tv
  13. // @exclude http://api.twitch.tv/*
  14. // @exclude https://api.twitch.tv/*
  15. // @require http://ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js
  16. // @grant GM_addStyle
  17. // @copyright 2013+, tracerman
  18. // ==/UserScript==
  19.  
  20.  
  21. var showCheck3 = 0;
  22. var zNode3 = document.createElement ('div');
  23. var pHeight = $(".dynamic-player").css("height");
  24. var bHeight = $('#left_col').css("width");
  25. var cHeight = $('#right_col').css("width");
  26. var cDisp = $('#right_col').css("display");
  27. var conWidth = $('#content').css("width");
  28. var tHeight = $('#main_col').css("margin-left");
  29. var zHeight = $('#main_col').css("margin-right");
  30. var mrCheck = $('#main_col').css("margin-right");
  31. var zWidth = $('#main_col').css("width");
  32. var ZWidthCheck = zWidth;
  33. var chatHeight = $('#chat').css("width");
  34. var chatLHeight = $('#chat_line').css("width");
  35. var chatLLHeight = $('#chat_line_list').css("width");
  36. var chatLLPadding = $('#chat_line_list').css("padding");
  37.  
  38.  
  39. zNode3.innerHTML = '<button id="myButton3" type="button">'
  40. + 'M</button>';
  41.  
  42. zNode3.setAttribute ('id', 'myContainer3');
  43. document.body.appendChild (zNode3);
  44.  
  45. //--- Activate the newly added button.
  46. document.getElementById ("myButton3").addEventListener (
  47. "click", ButtonClickAction, false
  48. );
  49.  
  50. function ButtonClickAction (zEvent) {
  51. if(showCheck3 == 1) {
  52. $("#channel").removeAttr('style');
  53. $("#chat_line_list").each(function () {
  54. this.style.setProperty("padding", chatLLPadding, "important");
  55. });
  56. $("#chat_line_list").each(function () {
  57. this.style.setProperty("padding", chatLLPadding);
  58. });
  59. $("#left_col").show();
  60. $(".editable").show();
  61. $("#channel_panels_contain").show();
  62. $(".stats-and-actions").show();
  63. $(".resizer").show();
  64. $("#right_close").show();
  65. $("#right_col").each(function () {
  66. this.style.setProperty("width", "", "important");
  67. });
  68. $("#right_col").each(function () {
  69. this.style.setProperty("width", cHeight);
  70. });
  71. $("#main_col").removeAttr('style');
  72. $("#main_col").each(function () {
  73. this.style.setProperty("margin-left", "", "important");
  74. });
  75. $("#main_col").css("margin-left","");
  76. /* $("#main_col").each(function () {
  77. this.style.setProperty("margin-left", tHeight);
  78. }); */
  79. $("#main_col").each(function () {
  80. /* this.style.setProperty("margin-right", "", "important"); */
  81. this.style.setProperty("width", "", "important");
  82. });
  83. if (cDisp == "block") {
  84. $("#main_col").each(function () {
  85. /* this.style.setProperty("margin-right", zHeight); */
  86. this.style.setProperty("margin-right", "");
  87. /* this.style.setProperty("width", zWidth); */
  88. });
  89. }
  90. else {
  91. $("#main_col").each(function () {
  92. /* this.style.setProperty("margin-right", "0px"); */
  93. this.style.setProperty("width", "");
  94. });
  95. }
  96. /* $("#main_col").each(function () {
  97. this.style.setProperty("margin-left", tHeight);
  98. /* this.style.setProperty("width", zWidth); */
  99. /* }); */
  100. if(zWidth >= 1) {
  101. $("#main_col").each(function () {
  102. this.style.setProperty("width", "");
  103. this.style.setProperty("margin-right", "");
  104. });
  105. }
  106. else {
  107. /* $("#main_col").css("width", zWidth); */
  108. $("#main_col").css("width", "");
  109. /* $("#main_col").css("margin-right", "", "important"); */
  110. }
  111. /* if (cDisp == "block") {
  112. $("#main_col").each(function () {
  113. this.style.setProperty("margin-right", "340px");
  114. });
  115. }
  116. else {
  117. $("#main_col").css("margin-right", "0", "important");
  118. } */
  119. $(".dynamic-player").each(function () {
  120. this.style.setProperty("height", "", "important");
  121. });
  122. /* $(".dynamic-player").each(function () {
  123. this.style.setProperty("height", pHeight);
  124. }); */
  125. $("#player").each(function () {
  126. this.style.setProperty("position", "relative");
  127. });
  128. $("#content").each(function () {
  129. this.style.setProperty("width", "", "important");
  130. });
  131. $("#content").each(function () {
  132. this.style.setProperty("width", conWidth);
  133. });
  134. $("#chat").each(function () {
  135. this.style.setProperty("width", "", "important");
  136. });
  137. $("#chat").each(function () {
  138. this.style.setProperty("width", chatHeight);
  139. });
  140. $("#chat_line").each(function () {
  141. this.style.setProperty("width", "", "important");
  142. });
  143. $("#chat_line").each(function () {
  144. this.style.setProperty("width", chatLHeight);
  145. });
  146. $("#chat_line_list").each(function () {
  147. this.style.setProperty("width", "", "important");
  148. });
  149. /* $("#chat_line_list").each(function () {
  150. this.style.setProperty("width", chatLLHeight);
  151. }); */
  152. $("#myButton3").fadeTo("fast", 1).delay(300).css({"color":"white"});
  153. /* $(".primary_button").animate({"width":"149px"}, "fast"); */
  154. //--- Old Chat Button
  155. $("#chat_speak").animate({"width":"149px"}, "fast");
  156. //--- New Chat Button
  157. $(".send-chat-button").css("width", "").css("left", "");
  158. $(".button-simple.primary").css("background", "");
  159. // Show the video bar
  160. $("#twitch_chat").animate({"top":"51px"}, "fast");
  161. $("#chat").each(function () {
  162. this.style.setProperty("top", "51px", "important");
  163. });
  164. $("#archives").animate({"top":"51px"}, "fast");
  165. //--- Old Buttons Border
  166. $(".dropdown_glyph").css("border", "", "important").css("box-shadow", "", "important");
  167. //--- New Buttons Border
  168. $("button.settings").css("border", "", "important").css("box-shadow", "", "important");
  169. $("button.viewers").css("border", "", "important").css("box-shadow", "", "important");
  170. //--- New Chat Interface Features
  171. $(".chat-interface").css("background", "").css("border", "", "important").css("box-shadow", "", "!important");
  172. $(".textarea-contain").css("border", "");
  173. $(".segmented_tabs").css({"visibility":"visible"});
  174. showCheck3 = 2;
  175. }
  176. else if(showCheck3 == 0) {
  177. pHeight = $(".dynamic-player").css("height");
  178. bHeight = $('#left_col').css("width");
  179. cHeight = $('#right_col').css("width");
  180. conWidth = $('#content').css("width");
  181. tHeight = $('#main_col').css("margin-left");
  182. zHeight = $('#main_col').css("margin-right");
  183. chatHeight = $('#chat').css("width");
  184. chatLHeight = $('#chat_line').css("width");
  185. chatLLHeight = $('#chat_line_list').css("width");
  186. chatLLPadding = $('#chat_line_list').css("padding");
  187. cDisp = $('#right_col').css("display");
  188. zWidth = $('#main_col').css("width");
  189. $("#channel").each(function () {
  190. this.style.setProperty("padding", "0 0 0 0", "important");
  191. });
  192. $("#chat_line_list").each(function () {
  193. this.style.setProperty("padding", "0 0 0", "important");
  194. });
  195. $(".editable").hide();
  196. $("#left_col").hide();
  197. $(".resizer").hide();
  198. $("#channel_panels_contain").hide();
  199. $(".stats-and-actions").hide();
  200. $(".dynamic-player, .dynamic-player object, .dynamic-player video").each(function () {
  201. this.style.setProperty("height", "100%", "important");
  202. this.style.setProperty("width", "100%", "important");
  203. });
  204. $(".dynamic-player").each(function () {
  205. this.style.setProperty("height", "100%", "important");
  206. this.style.setProperty("width", "100%", "important");
  207. });
  208. $("#player").each(function () {
  209. this.style.setProperty("position", "absolute");
  210. });
  211. if (cDisp == "block") {
  212. $("#content").each(function () {
  213. this.style.setProperty("width", "275px", "important");
  214. });
  215. $("#right_col").each(function () {
  216. this.style.setProperty("width", "275px", "important");
  217. });
  218. $("#chat").animate({"width":"275px"}, "fast");
  219. $("#chat_line_list").css({"width":""});
  220. $("#chat_line").animate({"width":"272px"}, "fast");
  221.  
  222. $("#main_col").each(function () {
  223. this.style.setProperty("margin-right", "275px", "important");
  224. this.style.setProperty("width", "");
  225. });
  226. $(".segmented_tabs").css({"visibility":"hidden"});
  227. $("#twitch_chat").css({"top":"0px"});
  228. $("#chat").each(function () {
  229. this.style.setProperty("top", "0px", "important");
  230. });
  231. $("#archives").animate({"top":"0px"}, "fast");
  232. //--- Old Chat Button
  233. $("#chat_speak").animate({"width":"84px"}, "fast");
  234. //--- New Chat Button
  235. $(".send-chat-button").css("width", "150px").css("left", "100px");
  236. $(".button-simple.primary").css("background", "black");
  237. //--- New Chat Interface Features
  238. $(".chat-interface").css("background", "white").css("border", "1px solid #6441a5", "important").css("box-shadow", "1px 1px 1px rgb(100, 65, 165), 0px 1px 0px rgba(0, 0, 0, 0.15) inset", "!important");
  239. $(".textarea-contain").css("border", "2px solid rgb(100, 65, 165)");
  240. }
  241. else {
  242. $("#content").each(function () {
  243. this.style.setProperty("width", "0px", "important");
  244. });
  245. $("#right_col").each(function () {
  246. this.style.setProperty("width", "0px", "important");
  247. });
  248. $("#main_col").each(function () {
  249. this.style.setProperty("margin-right", "0px", "important");
  250. this.style.setProperty("width", "100%", "important");
  251. });
  252. }
  253. if (zWidth > 0) {
  254. $("#main_col").each(function () {
  255. this.style.setProperty("width", "100%", "important");
  256. });
  257. }
  258. else {
  259. this.style.setProperty("width", "", "important");
  260. }
  261. $("#main_col").each(function () {
  262. this.style.setProperty("margin-left", "0px", "important");
  263. });
  264. $("#right_close").hide();
  265. /* zHeight = $('#main_col').css("margin-right"); */
  266. //--- Old Buttons Border
  267. $(".dropdown_glyph").css("border", "1px solid #6441a5", "important").css("box-shadow", "1px 1px 1px rgb(100, 65, 165), 0px 1px 0px rgba(0, 0, 0, 0.15) inset", "!important");
  268. //--- New Buttons Border
  269. $("button.settings").css("border", "1px solid #6441a5", "important").css("box-shadow", "1px 1px 1px rgb(100, 65, 165), 0px 1px 0px rgba(0, 0, 0, 0.15) inset", "!important");
  270. $("button.viewers").css("border", "1px solid #6441a5", "important").css("box-shadow", "1px 1px 1px rgb(100, 65, 165), 0px 1px 0px rgba(0, 0, 0, 0.15) inset", "!important");
  271. $("#myButton3").fadeTo("fast", 0.5).delay(300).css({"color":"yellow"});
  272. showCheck3 = 1;
  273. }
  274. else if(showCheck3 == 2) {
  275. if (cDisp == "block") {
  276. $("#main_col").each(function () {
  277. this.style.setProperty("margin-right", zHeight);
  278. /* this.style.setProperty("width", zWidth); */
  279. });
  280. }
  281. else {
  282. $("#main_col").each(function () {
  283. this.style.setProperty("margin-right", "0px");
  284. this.style.setProperty("width", "");
  285. });
  286. }
  287. $("#main_col").each(function () {
  288. this.style.setProperty("margin-left", tHeight);
  289. /* this.style.setProperty("width", zWidth); */
  290. });
  291. $("#main_col").css("width", "");
  292. if (cDisp == "block") {
  293. $("#main_col").each(function () {
  294. this.style.setProperty("margin-right", "340px");
  295. });
  296. }
  297. else {
  298. $("#main_col").css("margin-right", "0", "important");
  299. }
  300. $("#myButton3").fadeTo("fast", 1).delay(300).css({"color":"blue"});
  301. showCheck3 = 0;
  302. }
  303. else if(showCheck3 == 3) {
  304. }
  305. }
  306.  
  307. //--- Style our newly added elements using CSS.
  308. GM_addStyle ( multilineStr ( function () {/*!
  309. #myContainer3 {
  310. position: absolute;
  311. bottom: 0;
  312. left: 0;
  313. font-size: 10px;
  314. border: 0px outset black;
  315. margin: 0px;
  316. opacity: 10.0;
  317. z-index: 250;
  318. padding: 0px 1px;
  319. }
  320. #myButton3 {
  321. cursor: pointer;
  322. background: transparent;
  323. border: none !important;
  324. color: purple;
  325. font-weight: bold;
  326. }
  327. #myContainer3 p {
  328. color: purple;
  329. background: transparent;
  330. }
  331. */} ) );
  332.  
  333. function multilineStr (dummyFunc) {
  334. var str = dummyFunc.toString ();
  335. str = str.replace (/^[^\/]+\/\*!?/, '') // Strip function () { /*!
  336. .replace (/\s*\*\/\s*\}\s*$/, '') // Strip */ }
  337. .replace (/\/\/.+$/gm, '') // Double-slash comments wreck CSS. Strip them.
  338. ;
  339. return str;
  340. }