Monster Twitch

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

目前为 2014-04-16 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name Monster Twitch
  3. // @namespace http://enut.co/dev
  4. // @author Tracerman
  5. // @version 2.70
  6. // @description Streches stream to max width and hides left navigation bar with an 'M' toggle on the bottom right
  7. // @include http://*.twitch.tv/*
  8. // @include http://twitch.tv/*
  9. // @exclude http://www.twitch.tv/directory*
  10. // @exclude http://www.twitch.tv/*/dashboard
  11. // @exclude http://www.twitch.tv/inbox*
  12. // @exclude http://www.twitch.tv/subscriptions*
  13. // @exclude http://store.twitch.tv
  14. // @exclude http://api.twitch.tv/*
  15. // @exclude https://api.twitch.tv/*
  16. // @require http://ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js
  17. // @grant GM_addStyle
  18. // @copyright 2013+, tracerman
  19. // ==/UserScript==
  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, "important");
  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.primary_button").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. //--- Chat Bottom
  166. $(".chat-messages").css("bottom", "");
  167. $(".chat-buttons-container").css("top", "");
  168. //--- Old Buttons Border
  169. $(".dropdown_glyph").css("border", "", "important").css("box-shadow", "", "important");
  170. //--- New Buttons Border
  171. $("button.settings").css("margin-right", "").css("border", "", "important").css("box-shadow", "", "important");
  172. $("button.viewers").css("margin-right", "").css("border", "", "important").css("box-shadow", "", "important");
  173. $("button.emotemenu").css("margin-right", "").css("margin-left", "").css("border", "", "important").css("box-shadow", "", "important");
  174. //--- Chat Background
  175. $(".chat-messages").css("background", "");
  176. //--- New Chat Interface Features
  177. $(".chat-interface").css("background", "").css("height", "").css("border", "", "important").css("box-shadow", "", "!important");
  178. $(".textarea-contain").css("border", "");
  179. $(".segmented_tabs").css({"visibility":"visible"});
  180. showCheck3 = 2;
  181. }
  182. else if(showCheck3 == 0) {
  183. pHeight = $(".dynamic-player").css("height");
  184. bHeight = $('#left_col').css("width");
  185. cHeight = $('#right_col').css("width");
  186. conWidth = $('#content').css("width");
  187. tHeight = $('#main_col').css("margin-left");
  188. zHeight = $('#main_col').css("margin-right");
  189. chatHeight = $('#chat').css("width");
  190. chatLHeight = $('#chat_line').css("width");
  191. chatLLHeight = $('#chat_line_list').css("width");
  192. chatLLPadding = $('#chat_line_list').css("padding");
  193. cDisp = $('#right_col').css("display");
  194. zWidth = $('#main_col').css("width");
  195. $("#channel").each(function () {
  196. this.style.setProperty("padding", "0 0 0 0", "important");
  197. });
  198. $("#chat_line_list").each(function () {
  199. this.style.setProperty("padding", "0 0 0", "important");
  200. });
  201. $(".editable").hide();
  202. $("#left_col").hide();
  203. $(".resizer").hide();
  204. $("#channel_panels_contain").hide();
  205. $(".stats-and-actions").hide();
  206. $(".dynamic-player, .dynamic-player object, .dynamic-player video").each(function () {
  207. this.style.setProperty("height", "100%", "important");
  208. this.style.setProperty("width", "100%", "important");
  209. });
  210. $(".dynamic-player").each(function () {
  211. this.style.setProperty("height", "100%", "important");
  212. this.style.setProperty("width", "100%", "important");
  213. });
  214. $("#player").each(function () {
  215. this.style.setProperty("position", "absolute");
  216. });
  217. if (cDisp == "block") {
  218. $("#content").each(function () {
  219. this.style.setProperty("width", "275px", "important");
  220. });
  221. $("#right_col").each(function () {
  222. this.style.setProperty("width", "275px", "important");
  223. });
  224. $("#chat").animate({"width":"275px"}, "fast");
  225. $("#chat_line_list").css({"width":""});
  226. $("#chat_line").animate({"width":"272px"}, "fast");
  227.  
  228. $("#main_col").each(function () {
  229. this.style.setProperty("margin-right", "275px", "important");
  230. this.style.setProperty("width", "");
  231. });
  232. $(".segmented_tabs").css({"visibility":"hidden"});
  233. $("#twitch_chat").css({"top":"0px"});
  234. $("#chat").each(function () {
  235. this.style.setProperty("top", "0px", "important");
  236. });
  237. $("#archives").animate({"top":"0px"}, "fast");
  238. //--- Old Chat Button
  239. $("#chat_speak").animate({"width":"84px"}, "fast");
  240. //--- New Chat Button
  241. $(".send-chat-button").css("width", "120px").css("left", "auto");
  242. $("button.primary_button").css("background", "black");
  243. //--- Chat Background
  244. $(".chat-messages").css("background", "white");
  245. //--- Chat Bottom
  246. $(".chat-messages").css("bottom", "110px");
  247. $(".chat-buttons-container").css("top", "70px");
  248. //--- New Chat Interface Features
  249. $(".chat-interface").css("background", "white").css("height", "110px").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");
  250. $(".textarea-contain").css("border", "2px solid rgb(100, 65, 165)");
  251. }
  252. else {
  253. $("#content").each(function () {
  254. this.style.setProperty("width", "0px", "important");
  255. });
  256. $("#right_col").each(function () {
  257. this.style.setProperty("width", "0px", "important");
  258. });
  259. $("#main_col").each(function () {
  260. this.style.setProperty("margin-right", "0px", "important");
  261. this.style.setProperty("width", "100%", "important");
  262. });
  263. }
  264. if (zWidth > 0) {
  265. $("#main_col").each(function () {
  266. this.style.setProperty("width", "100%", "important");
  267. });
  268. }
  269. else {
  270. this.style.setProperty("width", "", "important");
  271. }
  272. $("#main_col").each(function () {
  273. this.style.setProperty("margin-left", "0px", "important");
  274. });
  275. $("#right_close").hide();
  276. /* zHeight = $('#main_col').css("margin-right"); */
  277. //--- Old Buttons Border
  278. $(".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");
  279. //--- New Buttons Border
  280. $("button.settings").css("margin-right", "2px").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");
  281. $("button.viewers").css("margin-right", "2px").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");
  282. $("button.emotemenu").css("margin-right", "2px").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");
  283. $("button.emotemenu").each(function () {
  284. this.style.setProperty("margin-left", "0px", "important");
  285. });
  286. $("#myButton3").fadeTo("fast", 0.5).delay(300).css({"color":"yellow"});
  287. showCheck3 = 1;
  288. }
  289. else if(showCheck3 == 2) {
  290. if (cDisp == "block") {
  291. $("#main_col").each(function () {
  292. this.style.setProperty("margin-right", zHeight);
  293. /* this.style.setProperty("width", zWidth); */
  294. });
  295. }
  296. else {
  297. $("#main_col").each(function () {
  298. this.style.setProperty("margin-right", "0px");
  299. this.style.setProperty("width", "");
  300. });
  301. }
  302. $("#main_col").each(function () {
  303. this.style.setProperty("margin-left", tHeight);
  304. /* this.style.setProperty("width", zWidth); */
  305. });
  306. $("#main_col").css("width", "");
  307. if (cDisp == "block") {
  308. $("#main_col").each(function () {
  309. this.style.setProperty("margin-right", "340px");
  310. });
  311. }
  312. else {
  313. $("#main_col").css("margin-right", "0", "important");
  314. }
  315. $("#myButton3").fadeTo("fast", 1).delay(300).css({"color":"blue"});
  316. showCheck3 = 0;
  317. }
  318. else if(showCheck3 == 3) {
  319. }
  320. }
  321.  
  322. //--- Style our newly added elements using CSS.
  323. GM_addStyle ( multilineStr ( function () {/*!
  324. #myContainer3 {
  325. position: absolute;
  326. bottom: 0;
  327. left: 0;
  328. font-size: 10px;
  329. border: 0px outset black;
  330. margin: 0px;
  331. opacity: 10.0;
  332. z-index: 250;
  333. padding: 0px 1px;
  334. }
  335. #myButton3 {
  336. cursor: pointer;
  337. background: transparent;
  338. border: none !important;
  339. color: purple;
  340. font-weight: bold;
  341. }
  342. #myContainer3 p {
  343. color: purple;
  344. background: transparent;
  345. }
  346. */} ) );
  347.  
  348. function multilineStr (dummyFunc) {
  349. var str = dummyFunc.toString ();
  350. str = str.replace (/^[^\/]+\/\*!?/, '') // Strip function () { /*!
  351. .replace (/\s*\*\/\s*\}\s*$/, '') // Strip */ }
  352. .replace (/\/\/.+$/gm, '') // Double-slash comments wreck CSS. Strip them.
  353. ;
  354. return str;
  355. }