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-18 提交的版本,查看 最新版本

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