Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name FixSteamChat
- // @namespace http://tampermonkey.net/
- // @version 0.11
- // @description "Fixes" Steam "Chat"
- // @author :^)
- // @match https://steamcommunity.com/chat/
- // @grant GM_addStyle
- // @require http://code.jquery.com/jquery-3.3.1.min.js
- // ==/UserScript==
- var colorDefault = '#FFFFFF';
- var colorOffline = '#999999';
- var colorOnline = '#6dcff6';
- var colorOnlineAway = '#4E93AD';
- var colorInGame = '#90C546';
- var colorInGameAway = '#75A039';
- var colorWatching = '#c9bdf7';
- var colorTime = '#666666';
- var colorGolden = '#e4ca63';
- var colorGoldenAway = '#e4ca63';
- var colorError = '#FF68B4';
- // Color resets for Baz
- colorGolden = colorOnline;
- /* // Color resets for Anyn
- colorDefault = colorOnline;
- colorOffline = colorOnlineAway;
- colorInGame = colorOnline;
- colorInGameAway = colorOnlineAway;
- colorWatching = colorOnline;
- colorGolden = colorOnline;
- colorGoldenAway = colorOnlineAway;
- */ // End resets
- var statusOffline = "speaker offline ";
- var statusOnline = "speaker online ";
- var statusOnlineAway = "speaker online away";
- var statusInGame = "speaker ingame ";
- var statusInGameAway = "speaker ingame away";
- var statusWatching = "speaker watching ";
- var statusGolden = "speaker golden ";
- var statusGoldenAway = "speaker golden away ";
- // hide the .ChatSpeaker via css so it never pops up while loading
- // .ChatSpeaker .speaker
- // .msgText first
- // display: none;
- // ========== ========== ========== ========== ========== ========== ========== ========== ========== ==========
- (function() {
- 'use strict';
- // ========== ========== ========== ========== ========== ========== ========== ========== ========== ==========
- function init() {
- editCSS();
- $('.ChatRoomGroupHeader').hide();
- }; // init
- // ========== ========== ========== ========== ========== ========== ========== ========== ========== ==========
- function main() {
- blocked();
- //embeds();
- $('.ChatSpeaker').hide(); // replace this with CSS edit
- compact();
- }; // main
- // ========== ========== ========== ========== ========== ========== ========== ========== ========== ==========
- function editCSS() {
- /*
- //alert(document.getElementsByClassName('.msgText').style.backgroundColor);
- var colsi = document.getElementsByClassName('ChatSpeaker');
- for(var i=0; i<colsi.length; i++) {
- colsi[i].style.display = 'none';
- } // for
- */
- var colsj = document.getElementsByClassName('chatImageFullBBCodeResizableElement'); // chatImageContainer
- for(var j=0; j<colsj.length; j++) {
- colsj[j].style.maxWidth = '200px';
- } // for
- }; // editCSS - FIX THIS
- // ========== ========== ========== ========== ========== ========== ========== ========== ========== ==========
- function blocked() {
- $(".MessageFromBlockedUser").not(".edited").each(function(){
- $(this).parent().parent().hide();
- this.classList.add("edited");
- }); // .MessageFromBlockedUser not .edited
- }; // blocked
- // ========== ========== ========== ========== ========== ========== ========== ========== ========== ==========
- function embeds() {
- //$(".BBCodeResizeableComponent.chatImageContainer").not(".edited").each(function(){
- $(".chatImageFull.BBCodeResizableElement").not(".edited").each(function(){
- //alert(this.html());
- //var userNameImage = $(this).parent().parent().children('.ChatSpeaker').children('.speaker').children('.speakerHoverArea').children('.speakerName').html();
- var userNameImage = $(this).parent().parent().parent().children('.ChatSpeaker').children('.speaker').children('.speakerHoverArea').children('.speakerName').html();
- document.title=userNameImage;
- //if(userNameImage != "TestName") {
- //alert(this.html());
- this.parent().classList.add("Minimized");
- //} // if Cactus
- this.classList.add("edited");
- }); // .BBCodeResizableComponentchatImageContainer not .edited
- }; // embeds FIX THIS
- // ========== ========== ========== ========== ========== ========== ========== ========== ========== ==========
- function compact() {
- $(".msgText").not(".edited").each(function(){
- if(1 == 1) {
- var timeStamp = $(this).parent().parent().children('.ChatSpeaker').children('.speaker').children('.speakerTimeStamp').html();
- var userName = $(this).parent().parent().children('.ChatSpeaker').children('.speaker').children('.speakerHoverArea').children('.speakerName').html();
- var status = $(this).parent().parent().children('.ChatSpeaker').children('.speaker').attr('class');
- var color = colorDefault;
- if(status != status) { color = colorError; }
- //else if(userName == 'Khrizto2') { color = colorError; }
- else if(status == statusOffline) { color = colorOffline; }
- else if(status == statusOnline) { color = colorOnline; }
- else if(status == statusOnlineAway) { color = colorOnlineAway; }
- else if(status == statusInGame) { color = colorInGame; }
- else if(status == statusInGameAway) { color = colorInGameAway; }
- else if(status == statusWatching) { color = colorWatching; }
- else if(status == statusGolden) { color = colorGolden; }
- else if(status == statusGoldenAway) { color = colorGoldenAway; }
- else { color = colorDefault; };
- $("<font color='"+colorTime+"'>"+timeStamp+" </font><font color='"+color+"'>"+userName+"</font><font color='"+colorDefault+"'>: </font>").prependTo($(this));
- } // if
- this.classList.add("edited");
- }); // .msgText not .edited
- }; // compact
- // ========== ========== ========== ========== ========== ========== ========== ========== ========== ==========
- $(document).ready(function() { //When document has loaded
- setTimeout(function() {init();}, 5000); // time to elapse and Code will execute.
- //setTimeout(function() {main();}, 10000); // time to elapse and Code will execute.
- }); // run code after timer
- setInterval(function () {main();}, 100); // run once a second (1000 = 1s)
- // ========== ========== ========== ========== ========== ========== ========== ========== ========== ==========
- })(); // END OF FUNCTION
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement