Monster Twitch

Stretches stream to max width and hides left navigation bar with an Monster toggle that's to the right of the volume rocker

当前为 2014-06-17 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Monster Twitch
  3. // @author Tracerman
  4. // @version 2.786
  5. // @description Stretches stream to max width and hides left navigation bar with an Monster toggle that's to the right of the volume rocker
  6. // @include http://*.twitch.tv/*
  7. // @include http://twitch.tv/*
  8. // @exclude http://www.twitch.tv/*/chat?popout=
  9. // @exclude http://www.twitch.tv/*/popout
  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 2014 tracerman
  19. // @icon https://monkeyguts.com//icon/104.png
  20. // @namespace http://enut.co/dev
  21. // ==/UserScript==
  22. /*--- Note, gmMain () will fire under all these conditions:
  23. 1) The page initially loads or does an HTML reload (F5, etc.).
  24. 2) The scheme, host, or port change. These all cause the browser to
  25. load a fresh page.
  26. 3) AJAX changes the URL (even if it does not trigger a new HTML load).
  27. */
  28. var fireOnHashChangesToo = false;
  29. var pageURLCheckTimer = setInterval (
  30. function () {
  31. if ( this.lastPathStr !== location.pathname
  32. || this.lastQueryStr !== location.search
  33. || (fireOnHashChangesToo && this.lastHashStr !== location.hash)
  34. ) {
  35. this.lastPathStr = location.pathname;
  36. this.lastQueryStr = location.search;
  37. this.lastHashStr = location.hash;
  38. gmMain ();
  39. }
  40. }
  41. , 1
  42. );
  43.  
  44. function gmMain () {
  45. console.log ('MT: A "New" page has loaded.');
  46. // DO WHATEVER YOU WANT HERE.
  47. function ChatWFix(){
  48. GM_addStyle ( multilineStr ( function () {/*!
  49. #right_col:before {
  50. left: 0px
  51. }
  52. */} ) );
  53. $(".segmented_tabs").css("z-index", "4");
  54. $("#right_col .top").css("z-index", "4");
  55. console.log("TM: Chat Left Position Fixed");
  56. }
  57.  
  58. setTimeout(function () {ChatWFix()}, 5000);
  59. $("#player").ready(function() {
  60. var showCheck3 = 0;
  61. var zNode3 = document.createElement ('div');
  62. var pHeight;
  63. var bHeight;
  64. var cHeight = "340px";
  65. var cDisp;
  66. var conWidth;
  67. var tHeight;
  68. var zHeight;
  69. var mrCheck;
  70. var mmLeft;
  71. var zWidth = $('#main_col').css("width");
  72. var ZWidthCheck = zWidth;
  73. var chatHeight = "340px";
  74. var chatLHeight;
  75. var chatLLHeight;
  76. var chatLLPadding;
  77. var chatLeft;
  78. var intHeight = $(".chat-interface").css("height");
  79.  
  80. zNode3.innerHTML = '<button id="myButton3" type="button">'
  81. + '</button>';
  82.  
  83. zNode3.setAttribute ('id', 'myContainer3');
  84.  
  85. $("#player").append(zNode3);
  86. $(document.body).on ("click", "#myButton3", ButtonClickAction);
  87. var rTest = 360;
  88. function bRotate() {
  89. setTimeout(function(){$("#myContainer3").css("transform", "rotate(" + rTest + "deg)")}, 500);
  90. }
  91. function ButtonClickAction (zEvent) {
  92. zWidth = $('#main_col').css("width");
  93. if(showCheck3 == 1) {
  94. $("#channel").removeAttr('style');
  95. $("#main_col").children(".tse-scroll-content").first().css("position", "");
  96. $("#chat_line_list").each(function () {
  97. this.style.setProperty("padding", chatLLPadding, "important");
  98. });
  99. $("#chat_line_list").each(function () {
  100. this.style.setProperty("padding", chatLLPadding);
  101. });
  102. $("#left_col").show(300, "swing");
  103. $(".editable").show(300, "swing");
  104. $("#new-user-prompt").show(300, "swing");
  105. //--- Old Panels Handler $("#channel_panels_contain").show(300, "swing");
  106. $(".stats-and-actions").show(300, "swing");
  107. $(".resizer").show(300, "swing");
  108. $("#right_close").show(300, "swing");
  109. $("#right_col").each(function () {
  110. this.style.setProperty("width", "", "important");
  111. });
  112. $("#right_col").each(function () {
  113. this.style.setProperty("width", "340px");
  114. });
  115. $("#main_col").removeAttr('style');
  116. $("#main_col").each(function () {
  117. this.style.setProperty("margin-left", "", "important");
  118. });
  119. $("#main_col").css("margin-left","").css("width", zWidth);
  120. $("#main_col").css("width", "");
  121. $("#main_col").each(function () {
  122. //--- this.style.setProperty("width", "", "important");
  123. });
  124. if (cDisp == "block") {
  125. $("#main_col").each(function () {
  126. //--- this.style.setProperty("margin-right", "0px");
  127. });
  128. }
  129. else {
  130. $("#main_col").each(function () {
  131. this.style.setProperty("width", "");
  132. this.style.setProperty("margin-right", "0px");
  133. });
  134. }
  135. if(zWidth >= 1) {
  136. $("#main_col").each(function () {
  137. //--- this.style.setProperty("width", "");
  138. this.style.setProperty("margin-right", "");
  139. });
  140. }
  141. else {
  142. //--- $("#main_col").css("width", "");
  143. }
  144. $(".dynamic-player").removeAttr("style");
  145. $("#player").each(function () {
  146. this.style.setProperty("position", "relative");
  147. });
  148. $("#content").each(function () {
  149. this.style.setProperty("width", "", "important");
  150. });
  151. $("#content").each(function () {
  152. this.style.setProperty("width", conWidth);
  153. });
  154. $("#chat").each(function () {
  155. this.style.setProperty("width", "", "important");
  156. });
  157. $("#chat").each(function () {
  158. this.style.setProperty("width", chatHeight);
  159. });
  160. $("#chat_line").each(function () {
  161. this.style.setProperty("width", "", "important");
  162. });
  163. $("#chat_line").each(function () {
  164. this.style.setProperty("width", chatLHeight);
  165. });
  166. $("#chat_line_list").each(function () {
  167. this.style.setProperty("width", "", "important");
  168. });
  169. $("#myContainer3").css({"opacity":"0.7"}).delay(300).css({"box-shadow":"inset 0 0 20px black"});
  170. //--- OLD BUTTON BACK .css({"box-shadow":"inset 0 0 20px rgb(138, 138, 138)"});
  171. //--- Old Chat Button
  172. $("#chat_speak").animate({"width":"149px"}, "fast");
  173. //--- New Chat Button
  174. $(".send-chat-button").css("right", "").css("width", "").css("margin-left", "").css("left", chatLeft);
  175. $("button.primary").css("background", "");
  176. $("button.primary").removeAttr("style");
  177. // Show the video bar
  178. $("#twitch_chat").animate({"top":"51px"}, "fast");
  179. $("#chat").removeAttr("style");
  180. $("#chat").each(function () {
  181. this.style.setProperty("top", "51px", "important");
  182. this.style.setProperty("bottom", "0");
  183. });
  184. $(".tse-content").removeAttr("style");
  185. $(".ember-chat .chat-messages .tse-content").css("padding", "");
  186. $("#archives").animate({"top":"51px"}, "fast");
  187. //--- Chat Bottom
  188. $(".chat-messages").removeAttr("style");
  189. $(".chat-buttons-container").css("top", "");
  190. //--- Old Buttons Border
  191. $(".dropdown_glyph").css("border", "", "important").css("box-shadow", "", "important");
  192. //--- New Buttons Border
  193. $(".button.glyph-only svg").css("margin-left", "");
  194. $(".button.glyph-only").css("padding", "");
  195. $(".chat-option-buttons .button").css("margin-right", "").css("border", "", "important").css("box-shadow", "", "important");
  196. $(".chat-option-buttons .button").removeAttr("style");
  197. $("button.viewers").css("margin-right", "").css("border", "", "important").css("box-shadow", "", "important");
  198. $("button.viewers").removeAttr("style");
  199. $("button.emotemenu").css("margin-right", "").css("margin-left", "").css("border", "", "important").css("box-shadow", "", "important");
  200. $("button.emotemenu").removeAttr("style");
  201. //--- Chat Background
  202. $(".chat-messages").css("background", "");
  203. //--- New Chat Interface Features
  204. $(".ember-chat .chat-interface").removeAttr("style");
  205. $(".chat-interface").css("background", "").css("border", "", "important").css("box-shadow", "", "!important");
  206. //--- $(".chat-interface").each(function () {
  207. //--- this.style.setProperty("height", "134", "!important");
  208. //---}) ;
  209. $(".textarea-contain").css("top", "").css("left", "").css("right", "");
  210. //--- $(".segmented_tabs").css({"visibility":"visible"}).css({"z-index":"4"});
  211. //--- $(".segmented_tabs").show(300, "swing");
  212. $(".segmented_tabs").slideDown(300);
  213. $("#right_col .top").css({"z-index":"4"});
  214. //--- showCheck3 = 2;
  215. bRotate();
  216. rTest = 0;
  217. showCheck3 = 0;
  218. }
  219. else if(showCheck3 == 0) {
  220. pHeight = $(".dynamic-player").css("height");
  221. bHeight = $('#left_col').css("width");
  222. cHeight = $('#right_col').css("width");
  223. conWidth = $('#content').css("width");
  224. tHeight = $('#main_col').css("margin-left");
  225. zHeight = $('#main_col').css("margin-right");
  226. chatHeight = $('#chat').css("width");
  227. chatLHeight = $('#chat_line').css("width");
  228. chatLLHeight = $('#chat_line_list').css("width");
  229. chatLLPadding = $('#chat_line_list').css("padding");
  230. cDisp = $('#right_col').css("display");
  231. localStorage.mmLeft = $('#main_col').css("margin-left");
  232. //--- zWidth = $('#main_col').css("width");
  233. chatLeft= $('.send-chat-button').css("left");
  234. //--- intHeight = $(".chat-interface").css("height");
  235. $("#channel").each(function () {
  236. this.style.setProperty("padding", "0 0 0 0", "important");
  237. });
  238. $("#chat_line_list").each(function () {
  239. this.style.setProperty("padding", "0 0 0", "important");
  240. });
  241. $(".editable").hide(300, "swing");
  242. $("#new-user-prompt").hide(300, "swing");
  243. $("#left_col").hide(300, "swing");
  244. $(".resizer").hide(300, "swing");
  245. $(".segmented_tabs").slideUp(300);
  246. //--- Old Panels Handler $("#channel_panels_contain").hide(300, "swing");
  247. $(".stats-and-actions").hide(300, "swing");
  248. $(".dynamic-player, .dynamic-player object, .dynamic-player video").each(function () {
  249. this.style.setProperty("height", "100%", "important");
  250. this.style.setProperty("width", "100%", "important");
  251. });
  252. $(".dynamic-player").each(function () {
  253. this.style.setProperty("height", "100%", "important");
  254. this.style.setProperty("width", "100%", "important");
  255. this.style.setProperty("z-index", "999");
  256. });
  257. $("#player").each(function () {
  258. this.style.setProperty("position", "absolute");
  259. });
  260. //--- Video Static
  261. $("#main_col").children(".tse-scroll-content").first().css("position", "static");
  262. //--- End
  263.  
  264. if (cDisp == "block") {
  265. $("#content").each(function () {
  266. this.style.setProperty("width", "275px", "important");
  267. });
  268. $("#right_col").each(function () {
  269. this.style.setProperty("width", "275px", "important");
  270. });
  271. $("#chat").animate({"width":"275px"}, "fast");
  272. $("#chat_line_list").css({"width":""});
  273. $("#chat_line").animate({"width":"272px"}, "fast");
  274.  
  275. $("#main_col").each(function () {
  276. this.style.setProperty("margin-right", "275px", "important");
  277. this.style.setProperty("width", "");
  278. });
  279. $("#right_col .top").css({"z-index":"inherit"});
  280. $("#twitch_chat").css({"top":"0px"});
  281. $("#chat").each(function () {
  282. this.style.setProperty("top", "0px", "important");
  283. });
  284. $(".tse-content").css("padding-bottom", "7px");
  285. $(".ember-chat .chat-messages .tse-content").css("padding", "0 10px");
  286. $("#archives").animate({"top":"0px"}, "100");
  287. //--- Old Chat Button
  288. $("#chat_speak").animate({"width":"84px"}, "100");
  289. //--- New Chat Button
  290. $(".send-chat-button").css("right", "5px").css("width", "120px").css("margin-left", "auto");
  291. $("button.primary").animate({"width": "120px"}, 100).css("height", "28px").css("left", "auto");
  292. // $("button.primary_button").css("background", "black");
  293. // $("button.primary_button").css("background","linear-gradient(black, rgb(100, 65, 165) 5%, black, rgb(100, 65, 165))");
  294. $("button.primary").each(function () {
  295. this.style.setProperty("border", "2px ridge #6441a5", "important");
  296. this.style.setProperty("background", "linear-gradient(black, rgb(100, 65, 165) 5%, black, rgb(100, 65, 165))", "important");
  297. });
  298. //--- Chat Background
  299. $(".chat-messages").css("background", "white").css("margin-bottom", "3px").css("overflow", "hidden");
  300. //--- Chat Bottom
  301. $(".chat-messages").each(function () {
  302. this.style.setProperty("bottom", "100px", "important");
  303. });
  304. $(".chat-buttons-container").css("top", "57px");
  305. //--- New Chat Interface Features
  306. $(".chat-interface").css("background", "white").css("left", "0").css("right", "0").css("box-shadow", "1px 1px 1px rgb(100, 65, 165), 0px 1px 0px rgba(0, 0, 0, 0.15) inset", "!important");
  307. $(".chat-interface").each(function () {
  308. this.style.setProperty("height", "100px", "important");
  309. });
  310. $(".textarea-contain").css("top", "0").css("left", "0").css("right", "0");
  311. }
  312. else {
  313. $("#content").each(function () {
  314. this.style.setProperty("width", "0px", "important");
  315. });
  316. $("#right_col").each(function () {
  317. this.style.setProperty("width", "0px", "important");
  318. });
  319. $("#main_col").each(function () {
  320. this.style.setProperty("margin-right", "0px");
  321. this.style.setProperty("width", "100%", "important");
  322. });
  323. }
  324. if (zWidth > 0) {
  325. $("#main_col").each(function () {
  326. this.style.setProperty("width", "100%", "important");
  327. });
  328. }
  329. else {
  330. this.style.setProperty("width", "", "important");
  331. }
  332. $("#main_col").each(function () {
  333. this.style.setProperty("margin-left", "0px", "important");
  334. });
  335. $("#right_close").hide(300, "swing");
  336. //--- Old Buttons Border
  337. $(".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");
  338. //--- New Buttons Border
  339. $(".button.glyph-only").css("padding-left", "4px").css("padding-right", "4px");
  340. $(".chat-option-buttons .button").css("margin-right", "2px").css("margin-left", "5px").css("height", "24px");
  341. $(".button.glyph-only svg").css("margin-top", "4px");
  342. $(".chat-option-buttons .button").each(function () {
  343. this.style.setProperty("border", "2px ridge #6441a5", "important");
  344. this.style.setProperty("box-shadow", "1px 1px 1px rgb(100, 65, 165), 0px 1px 0px rgba(0, 0, 0, 0.15) inset", "important");
  345. this.style.setProperty("background", 'linear-gradient(to top, white, rgba(100, 65, 165, 0.9))' , "important");
  346. });
  347. $("button.viewers").css("margin-right", "2px");
  348. $("button.viewers").each(function () {
  349. this.style.setProperty("border", "2px ridge #6441a5", "important");
  350. this.style.setProperty("box-shadow", "1px 1px 1px rgb(100, 65, 165), 0px 1px 0px rgba(0, 0, 0, 0.15) inset", "important");
  351. //this.style.setProperty("background", 'url("/images/xarth/button_glyphs.png") no-repeat 4px -21px, linear-gradient(to top,black, rgb(100, 65, 165))', "important");
  352. });
  353. $("button.emotemenu").css("margin-right", "2px").css("width", "40px").css("height", "34px");
  354. $("button.emotemenu").each(function () {
  355. this.style.setProperty("border", "2px ridge #6441a5", "important");
  356. this.style.setProperty("margin-left", "5px", "important");
  357. this.style.setProperty("box-shadow", "1px 1px 1px rgb(100, 65, 165), 0px 1px 0px rgba(0, 0, 0, 0.15) inset", "important");
  358. this.style.setProperty("background", 'url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAAQCAYAAAAbBi9cAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAKUSURBVDhPfZTNi1JRGMZvMIsWUZts5SIXFYK0CME/IGghxVC7WUoU1NBixI+mRSD4MQzmxziKO3XUBhRmUGZKdBG40XEGU6d0GFGZcT4qxW1hi7fzvNwZqKwDD5z7vs/vueeee+6VMJxO5wUhhdvtfuHz+T4tLS2NhegfGsMDLxiwHIIhLi57PJ75VCr1Y39/n4bDIY1Go4lCDx54wYCVYzjoVjQa/dxutyfCkwSvYJpgOSQf708tuBa1yWRy/L+V/Cl4wYBFhhTxfLhum/esiiJ1u12KRCJksVhofX2dTk5OzkHMUUMPHnjB2F55VpEhPde/Lbx8FqBEIkHpdJoMBgNptVrS6XRUqVTOg7a3t2lmZob0ej2p1Wr2ggGLDOnJ3QSZH4coHo/TysoKhygUCtJoNFQsFmkwGLAwR7hSqSSVSsVeMGCRIT29F6fXJi8Xy+Uymc1mmp6eJofDQfV6nU5PT1mY2+127uHxSqUSh4FFhhQLvrvtcrm+YpkHBwdUrVZpa2uLarUadTodOjw8ZGGOGnrwwAsGLDLw1i4uLrzRYeOOj49pb2+Pdnd3qdVq8StGAIQ5ao1Ggz3wggGLDD4C4izcEcWfR0dHbMrlcrSxscGbjVAIK8lms7S5ucmB/X6fXz9YDsEQFzdjsVit2Wzyqc1kMrwfVquVjEYjzc3NkclkIpvNRmtra+yBVzAfBXtDjuGgS8FgcFbc8QvuhjNSKBQoFAqR6LFEn/L5PPfggXd5eXkWrBzDQdC1QCBgFoeut7Ozw/tyBp2FQzhPwtOFFwzY34Yo4A9wRXzdD8LhcE48wncE9no9Fuaoid574bkPLxgZ/3uI5pTQVfFlP/L7/Wmhb7JSXq/3IXrwyHZ5SNIvGCnqyh+J7+gAAAAASUVORK5CYII=") no-repeat 50%, linear-gradient(to top, white, rgba(100, 65, 165, 0.9))', "important");
  359. });
  360. //--- $("#myContainer3").fadeTo("fast", 1.0).css({"background":"url('http://i61.tinypic.com/ri80w5.png')"}).delay(300).css({"box-shadow":"inset 0 0 20px black"});
  361. $("#myContainer3").css({"opacity":"1"}).delay(300).css({"box-shadow":"inset 0 0 20px black"});
  362. bRotate();
  363. rTest = 360;
  364. showCheck3 = 1;
  365. }
  366. //--- else if(showCheck3 == 2) {
  367. else if(showCheck3 == 5) {
  368. if (cDisp == "block") {
  369. $("#main_col").each(function () {
  370. this.style.setProperty("margin-right", zHeight);
  371. });
  372. }
  373. else {
  374. $("#main_col").each(function () {
  375. this.style.setProperty("margin-right", "0px");
  376. this.style.setProperty("width", "");
  377. });
  378. }
  379. $("#main_col").each(function () {
  380. this.style.setProperty("margin-left", tHeight);
  381. });
  382. $("#main_col").css("width", "");
  383. if (cDisp == "block") {
  384. $("#main_col").each(function () {
  385. this.style.setProperty("margin-right", "340px");
  386. });
  387. }
  388. else {
  389. $("#main_col").css("margin-right", "0", "important");
  390. }
  391. $("#myContainer3").fadeTo("fast", 0.5).delay(300).css({"box-shadow":"inset 0 0 20px navy"});
  392. showCheck3 = 0;
  393. }
  394. else if(showCheck3 == 3) {
  395. }
  396. //--- clearInterval(pageURLCheckTimer);
  397. return false;
  398. }
  399. });
  400. }
  401.  
  402.  
  403.  
  404.  
  405. //--- Style our newly added elements using CSS.
  406. GM_addStyle ( multilineStr ( function () {/*!
  407. #myContainer3 {
  408. position: absolute;
  409. border-radius: 25px;
  410. transition: 1s ease-in-out;
  411. background: url("http://i61.tinypic.com/ri80w5.png");
  412. opacity: 0.7;
  413. background-size: contain !important;
  414. box-shadow: inset 0 0 20px black;
  415. bottom: 0;
  416. left: 0;
  417. font-size: 13px;
  418. border: 0px outset black;
  419. margin-left: 160px;
  420. margin-bottom: 0px;
  421. opacity: 0.5;
  422. width: 27px !important;
  423. height: 27px !important;
  424. z-index: 999;
  425. padding: 0px 0px;
  426. }
  427. #myButton3 {
  428. cursor: pointer;
  429. background: transparent;
  430. border: none !important;
  431. width: 27px !important;
  432. height: 27px !important;
  433. color: purple;
  434. font-weight: bold;
  435. }
  436. #myContainer3 p {
  437. color: purple;
  438. background: transparent;
  439. }
  440. */} ) );
  441.  
  442. function multilineStr (dummyFunc) {
  443. var str = dummyFunc.toString ();
  444. str = str.replace (/^[^\/]+\/\*!?/, '') // Strip function () { /*!
  445. .replace (/\s*\*\/\s*\}\s*$/, '') // Strip */ }
  446. //--- .replace (/\/\/.+$/gm, '') // Double-slash comments wreck CSS. Strip them.
  447. ;
  448. return str;
  449. }