Advertisement
Guest User

Untitled

a guest
May 23rd, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.56 KB | None | 0 0
  1. // ==UserScript==
  2. // @name FixSteamChat
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.11
  5. // @description "Fixes" Steam "Chat"
  6. // @author :^)
  7. // @match https://steamcommunity.com/chat/
  8. // @grant GM_addStyle
  9. // @require http://code.jquery.com/jquery-3.3.1.min.js
  10. // ==/UserScript==
  11.  
  12. var colorDefault = '#FFFFFF';
  13. var colorOffline = '#999999';
  14. var colorOnline = '#6dcff6';
  15. var colorOnlineAway = '#4E93AD';
  16. var colorInGame = '#90C546';
  17. var colorInGameAway = '#75A039';
  18. var colorWatching = '#c9bdf7';
  19. var colorTime = '#666666';
  20. var colorGolden = '#e4ca63';
  21. var colorGoldenAway = '#e4ca63';
  22. var colorError = '#FF68B4';
  23.  
  24. // Color resets for Baz
  25. colorGolden = colorOnline;
  26.  
  27. /* // Color resets for Anyn
  28. colorDefault = colorOnline;
  29. colorOffline = colorOnlineAway;
  30. colorInGame = colorOnline;
  31. colorInGameAway = colorOnlineAway;
  32. colorWatching = colorOnline;
  33. colorGolden = colorOnline;
  34. colorGoldenAway = colorOnlineAway;
  35. */ // End resets
  36.  
  37. var statusOffline = "speaker offline ";
  38. var statusOnline = "speaker online ";
  39. var statusOnlineAway = "speaker online away";
  40. var statusInGame = "speaker ingame ";
  41. var statusInGameAway = "speaker ingame away";
  42. var statusWatching = "speaker watching ";
  43. var statusGolden = "speaker golden ";
  44. var statusGoldenAway = "speaker golden away ";
  45.  
  46. // hide the .ChatSpeaker via css so it never pops up while loading
  47. // .ChatSpeaker .speaker
  48. // .msgText first
  49. // display: none;
  50.  
  51. // ========== ========== ========== ========== ========== ========== ========== ========== ========== ==========
  52.  
  53. (function() {
  54. 'use strict';
  55.  
  56. // ========== ========== ========== ========== ========== ========== ========== ========== ========== ==========
  57.  
  58. function init() {
  59. editCSS();
  60. $('.ChatRoomGroupHeader').hide();
  61. }; // init
  62.  
  63. // ========== ========== ========== ========== ========== ========== ========== ========== ========== ==========
  64.  
  65. function main() {
  66. blocked();
  67. //embeds();
  68. $('.ChatSpeaker').hide(); // replace this with CSS edit
  69. compact();
  70. }; // main
  71.  
  72. // ========== ========== ========== ========== ========== ========== ========== ========== ========== ==========
  73.  
  74. function editCSS() {
  75. /*
  76. //alert(document.getElementsByClassName('.msgText').style.backgroundColor);
  77. var colsi = document.getElementsByClassName('ChatSpeaker');
  78. for(var i=0; i<colsi.length; i++) {
  79. colsi[i].style.display = 'none';
  80. } // for
  81. */
  82. var colsj = document.getElementsByClassName('chatImageFullBBCodeResizableElement'); // chatImageContainer
  83. for(var j=0; j<colsj.length; j++) {
  84. colsj[j].style.maxWidth = '200px';
  85. } // for
  86.  
  87. }; // editCSS - FIX THIS
  88.  
  89. // ========== ========== ========== ========== ========== ========== ========== ========== ========== ==========
  90.  
  91. function blocked() {
  92. $(".MessageFromBlockedUser").not(".edited").each(function(){
  93. $(this).parent().parent().hide();
  94.  
  95. this.classList.add("edited");
  96. }); // .MessageFromBlockedUser not .edited
  97. }; // blocked
  98.  
  99. // ========== ========== ========== ========== ========== ========== ========== ========== ========== ==========
  100.  
  101. function embeds() {
  102. //$(".BBCodeResizeableComponent.chatImageContainer").not(".edited").each(function(){
  103. $(".chatImageFull.BBCodeResizableElement").not(".edited").each(function(){
  104.  
  105. //alert(this.html());
  106.  
  107. //var userNameImage = $(this).parent().parent().children('.ChatSpeaker').children('.speaker').children('.speakerHoverArea').children('.speakerName').html();
  108. var userNameImage = $(this).parent().parent().parent().children('.ChatSpeaker').children('.speaker').children('.speakerHoverArea').children('.speakerName').html();
  109.  
  110. document.title=userNameImage;
  111.  
  112.  
  113. //if(userNameImage != "TestName") {
  114. //alert(this.html());
  115. this.parent().classList.add("Minimized");
  116. //} // if Cactus
  117.  
  118.  
  119. this.classList.add("edited");
  120. }); // .BBCodeResizableComponentchatImageContainer not .edited
  121. }; // embeds FIX THIS
  122.  
  123. // ========== ========== ========== ========== ========== ========== ========== ========== ========== ==========
  124.  
  125. function compact() {
  126. $(".msgText").not(".edited").each(function(){
  127.  
  128. if(1 == 1) {
  129. var timeStamp = $(this).parent().parent().children('.ChatSpeaker').children('.speaker').children('.speakerTimeStamp').html();
  130. var userName = $(this).parent().parent().children('.ChatSpeaker').children('.speaker').children('.speakerHoverArea').children('.speakerName').html();
  131. var status = $(this).parent().parent().children('.ChatSpeaker').children('.speaker').attr('class');
  132. var color = colorDefault;
  133.  
  134. if(status != status) { color = colorError; }
  135. //else if(userName == 'Khrizto2') { color = colorError; }
  136. else if(status == statusOffline) { color = colorOffline; }
  137. else if(status == statusOnline) { color = colorOnline; }
  138. else if(status == statusOnlineAway) { color = colorOnlineAway; }
  139. else if(status == statusInGame) { color = colorInGame; }
  140. else if(status == statusInGameAway) { color = colorInGameAway; }
  141. else if(status == statusWatching) { color = colorWatching; }
  142. else if(status == statusGolden) { color = colorGolden; }
  143. else if(status == statusGoldenAway) { color = colorGoldenAway; }
  144. else { color = colorDefault; };
  145.  
  146. $("<font color='"+colorTime+"'>"+timeStamp+" </font><font color='"+color+"'>"+userName+"</font><font color='"+colorDefault+"'>: </font>").prependTo($(this));
  147. } // if
  148.  
  149. this.classList.add("edited");
  150. }); // .msgText not .edited
  151.  
  152. }; // compact
  153.  
  154. // ========== ========== ========== ========== ========== ========== ========== ========== ========== ==========
  155.  
  156. $(document).ready(function() { //When document has loaded
  157. setTimeout(function() {init();}, 5000); // time to elapse and Code will execute.
  158. //setTimeout(function() {main();}, 10000); // time to elapse and Code will execute.
  159. }); // run code after timer
  160.  
  161. setInterval(function () {main();}, 100); // run once a second (1000 = 1s)
  162.  
  163. // ========== ========== ========== ========== ========== ========== ========== ========== ========== ==========
  164.  
  165. })(); // END OF FUNCTION
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement