Steam-Community-Suite
Steam-Community-Suite copied to clipboard
Userscript version?
I want to use this in the official steam client so i need userscript like you had before:
https://web.archive.org/web/20150509061214/https://jes.re/suite
https://web.archive.org/web//https://jes.re/suite.user.js https://web.archive.org/web//http://jes.re/steam.css
// ==UserScript==
// @name Steam Community Suite
// @namespace http://jes.re/
// @version 2.3.3
// @description Making the Steam Community better and safer for everyone!
// @updateURL http://jes.re/suite.meta.js
// @downloadURL http://jes.re/suite.user.js
// @match http://*/*
// @match https://*/*
// @grant GM_addStyle
// @grant GM_getResourceText
// @copyright 2014 Jessecar
// @run-at document-end
// ==/UserScript==
// @resource steamCSS http://jes.re/steam.css
/* SteamID Converter by xPaw - http://xpaw.ru - https://github.com/xPaw/SteamID */
(function () {"use strict"; var a = function (a) {return a !== void 0 ? null!==this.IsCommunityID(a)?this.SetCommunityID(a):null!==this.IsSteam2(a)?this.SetSteam2(a):this.SetAccountID(a):this};a.prototype={AccountID:0,IsCommunityID:function(a){return"string"!=typeof a?null:a.match(/^7656119([0-9]{10})$/)},IsSteam2:function(a){return"string"!=typeof a?null:a.match(/^STEAM_0:([0-1]):([0-9]+)$/)},SetAccountID:function(a){if("number"==typeof a)this.AccountID=a;else{if("string"!=typeof a||isNaN(a))return!1;this.AccountID=parseInt(a,10)}return this},SetCommunityID:function(a){if(a=this.IsCommunityID(a),null===a)return!1;a=a[0].substring(7);var b=a%2;return a=(a-b-7960265728)/2,this.AccountID=a<<1|b,this},SetSteam2:function(a){return a=this.IsSteam2(a),null===a?!1:(this.AccountID=a[2]<<1|a[1],this)},GetCommunityID:function(){return"7656119"+(7960265728+this.AccountID)},GetSteam2:function(){return"STEAM_0:"+(1&this.AccountID)+":"+(this.AccountID>>1)},GetSteam3:function(){return"[U:1:"+this.AccountID+"]"},GetAccountID:function(){return this.AccountID}},"object"==typeof module&&module&&"object"==typeof module.exports?module.exports=a:window.SteamID=a})();
var SteamCommunitySuite = {
SafeDomains: [
"scrap.tf",
"steamrep.com",
"sourceop.com",
"bazaar.tf",
"scrapbank.me",
"backpack.tf",
"wiki.tf",
"teamfortress.com",
"tf2b.com",
"tf2items.com",
"teamfortress.tv",
"reddit.com",
"valvesoftware.com",
"ppm.tf",
"tf2wh.com",
"tf2tp.com",
"trade.tf",
"tf2tp.com",
"jessecar96.net",
"xpaw.ru",
"reddit.com",
"tf2-trader.com",
"tf2r.com",
"tf2shop.com",
"csgolounge.com",
"dota2lounge.com",
"marktplace.tf",
"manncotrading.com",
"imgur.com",
"jes.re",
"steamgaug.es",
"steamstat.us",
"steamdb.info",
"marketplace.tf",
"tipofthehats.org",
"twitch.tv",
"rep.tf",
"dispenser.tf"
],
BadDomains: [
"steam-cards.com",
"steamwalletcodes.com",
"free-steam-rebel.com",
"steam-hacks.com",
"getsteamcodes.com",
"steam-wallet.com",
"steampowers.net",
"steam-wallet.steam-key-giveaway.com",
"giftcodesgen.com",
"dota2-cheats.net",
"freesteamwalletcodes.com",
"steam-wallet-cards.com",
"steamwalletgiftcards.com",
"steamwalletcodes.online-cheats.com",
"free-steam-cards.com",
"newsteamcodes.com",
"share4steam.com",
"freesteamwalletcodes.info",
"freesteamwalletcodes.org",
"free-steam-wallet-codes.com",
"steamcodegenerator.com",
"free-steamwalletcodes.com",
"steamwallethack.net"
],
RememberedDomains: [
],
Messages:{
good: "border-color:green;background:rgba(0,255,0,.3);",
warn: "border-color:rgb(201, 129, 0);background:rgba(201, 129, 0, 0.3);",
bad: "border-color:red;background:rgba(255,0,0,.3);"
},
ValveSiteTest: false,
RValidSteamSite: /(?:http|https):\/\/(?:store.|support.|forums.|api.|media.|www.|)(?:steamcommunity|steampowered|dota2|steamgames|valvesoftware)\.com/,
RPhishingSite: /(https?:\/\/|\/\/|www?.\.)\S*?[sz][tf][ea].?[mnru]..?.?[mnruv][mnruv]?..?.?[jiltf][jiltf][yi]\.\S+/i,
Log: function(txt){
console.log('%cSCS%c'+txt, 'background: #222; color: #bada55;padding:2px;', "background:transparent;color:black;");
},
getElementByXpath: function(path){
return document.evaluate(path, document, null, 9, null).singleNodeValue;
},
ParseUrl: function(url)
{
var parser = document.createElement('a');
parser.href = url;
return parser;
},
OpenInNewTab: function(url)
{
var win=window.open(url, '_blank');
win.focus();
},
OpenURLCopy: function(sid){
unsafeWindow.ShowAlertDialog( 'Static Profile URL', "<b>Press Ctrl + C</b><br/><br/><div class='gray_bevel for_text_input'><input class='dynInput copythistext' type='text' size='70' value='https://web.archive.org/web/20141010155000/http://steamcommunity.com/profiles/"+sid+"/' ></div>");
document.getElementsByClassName("copythistext")[0].focus();
document.getElementsByClassName("copythistext")[0].select();
},
Load: function (){
// Update & Add more safe domains
if(unsafeWindow.g_whiteListedDomains != undefined){
var SteamSafeDomains = unsafeWindow.g_whiteListedDomains;
unsafeWindow.g_whiteListedDomains = SteamSafeDomains.concat(this.SafeDomains);
this.SafeDomains.concat(SteamSafeDomains);
}
// Check Footer Elements
if(document.getElementById("footer_spacer") != null && this.getElementByXpath('//*[@id="footer"]/div') != null && document.getElementsByClassName("valve_links").length > 0){
this.ValveSiteTest = true;
}
// Check for links to styles
var ValveStyles = document.getElementsByTagName("link");
for (var i = ValveStyles.length - 1; i >= 0; i--) {
if(ValveStyles[i].href.match(/http(s|):\/\/(?:cdn.|)steamcommunity.com\/public\/(shared)?/)){
this.ValveSiteTest = true;
}
};
// Check for links to JavaScript
var ValveScripts = document.getElementsByTagName("script");
for (var i = ValveScripts.length - 1; i >= 0; i--) {
if(ValveScripts[i].src.match(/http(?:s|):\/\/(?:support.|cdn.|)(?:steamcommunity|steampowered).com(?:\/public\/(shared)|includes)?/)){
this.ValveSiteTest = true;
}
};
// Check for images (old phishing sites)
var ValveImages = document.getElementsByTagName("img");
for (var i = ValveImages.length - 1; i >= 0; i--) {
if(ValveImages[i].src.match(/http(?:s|):\/\/(?:steamcommunity|steampowered).com\/public\/images\/trans/)){
this.ValveSiteTest = true;
}
};
// Load remembered domains
if(window.localStorage){
if(window.localStorage['rememberedDomains']){
SteamCommunitySuite.RememberedDomains = JSON.parse(window.localStorage['rememberedDomains']);
}
}
var parsed = "http://"+SteamCommunitySuite.ParseUrl(window.location.href).hostname,
frag = parsed.replace(/[^.]*\.(?=\w+\.\w+$)/, '').replace("http://","");
if(this.ValveSiteTest || SteamCommunitySuite.BadDomains.indexOf(frag) != -1){
if(window.location.href.match(this.RValidSteamSite)){
// On Real Domain
if(document.body.innerHTML.indexOf("Error 503 Service Unavailable") != -1){
document.body.innerHTML = "<h1>503 Service unavailable. Reloading...</h1>";
document.location.reload();
}else{
// External styles
var jqUI_CssSrc = GM_getResourceText ("steamCSS");
GM_addStyle (jqUI_CssSrc);
// Green top bar
if(document.getElementById("global_header") != null)
document.getElementById("global_header").style.borderBottom = "2px solid green";
// Functions that need to be delayed for some odd reason
setTimeout(function (){
// Remove ugly link hosts
var elements = document.getElementsByClassName("bb_link_host");
for (var i = elements.length - 1; i >= 0; i--) {
elements[i].parentNode.removeChild(elements[i]);
};
// Ugly fix for comments not being initalized
var scripts = document.getElementsByTagName("script");
for (var i = scripts.length - 1; i >= 0; i--) {
if(scripts[i].innerHTML.indexOf("InitializeCommentThread(") != -1){
var scr = scripts[i].innerHTML;
scr = scr.replace(/\r?\n|\r/g,"");
scr = scr.substr(19);
scr = scr.replace("})();","");
scr = scr.replace(" };","");
scr = scr.substr(0,scr.length - 5);
eval(scr); // Never do this :(
}else if(scripts[i].innerHTML.indexOf("new CEmoticonPopup(") != -1){
var scr = scripts[i].innerHTML;
eval(scr); // Baaaaah
}
};
// OnClick of links in Steam
var CommunityLinks = document.querySelectorAll("a.bb_link");
for (var i = CommunityLinks.length - 1; i >= 0; i--) {
CommunityLinks[i].addEventListener("click", function(event){
event.preventDefault();
// This is so stupid
var base_url = event.target.href;
console.log(base_url);
if(base_url == undefined){
base_url = event.target.parentNode.href;
if(base_url == undefined){
base_url = event.target.parentNode.parentNode.href;
if(base_url == undefined){
base_url = event.target.parentNode.parentNode.parentNode.href;
// Just give up after this...
}
}
}
var url = base_url.replace("https://web.archive.org/web/20141010155000/https://steamcommunity.com/linkfilter/","").replace("?url=",""),
parsed = "http://"+SteamCommunitySuite.ParseUrl(url).hostname,
frag = parsed.replace("http://","").replace("https://","").replace("www.","").replace(/[^.]*\.(?=\w+\.\w+$)/, ''),
steam_phish_msg = "Unverified link. Take caution.",
LinkColor = SteamCommunitySuite.Messages.warn,
block_follow = false;
if(frag == "steamcommunity.com") {
window.location.href = url;
}else{
if(SteamCommunitySuite.SafeDomains.indexOf(frag) != -1){
LinkColor = SteamCommunitySuite.Messages.good;
steam_phish_msg = "Trusted community website.";
}else if(SteamCommunitySuite.RPhishingSite.test(url)){
LinkColor = SteamCommunitySuite.Messages.bad;
steam_phish_msg = "Phishing Website! <b>Do not follow!</b>";
}
unsafeWindow.ShowConfirmDialog("Unverified Link","<div style='text-align:center;font-size:14px;'><div style='border-style:solid;border-width:3px;"+LinkColor+"color:#FFF;border-radius:6px;padding:8px;margin-bottom:5px;font-size:15px;text-align:center;'>"+url+"</div>"+steam_phish_msg+"<br/><br/><b>Make sure this is where you want to go before following it!</b></div>","Follow Link","Cancel").done(function(){
SteamCommunitySuite.OpenInNewTab(url);
});
return false;
}
});
};
},100);
// Profiles
if(unsafeWindow.g_rgProfileData != undefined){
var UserSID = new SteamID(unsafeWindow.g_rgProfileData['steamid']),
SteamID64 = UserSID.GetCommunityID();
// Remove "show more" button
if(document.getElementsByClassName("profile_summary").length > 0)
document.getElementsByClassName("profile_summary")[0].innerHTML = unsafeWindow.g_rgProfileData['summary'];
// SteamIDs below name
var ProfileSteamIDS = document.createElement("div");
ProfileSteamIDS.innerHTML = "<b>Community ID:</b> <a style='color:#898989;text-decoration:underline;' href='javascript:void(0);' onclick=\"SteamCommunitySuite.OpenURLCopy('"+UserSID.GetCommunityID()+"')\" >"+UserSID.GetCommunityID()+"</a><br/><b>Steam 2:</b> "+UserSID.GetSteam2()+"<br/><b>Steam 3:</b> "+UserSID.GetSteam3()+"<br/><br/>";
document.body.appendChild(ProfileSteamIDS);
var ProfileName = document.getElementsByClassName("header_real_name")[0];
if(ProfileName != undefined){
ProfileName.insertBefore(ProfileSteamIDS, ProfileName.firstChild);
}else{
var ProfileHeaderSummary = document.getElementsByClassName("profile_header_summary")[0];
var PrivateProfileInfo = document.getElementsByClassName("profile_private_info")[0];
ProfileHeaderSummary.insertBefore(ProfileSteamIDS, PrivateProfileInfo);
}
// SteamRep & Notes
var SRBox = "";
SRBox += '<div class="community-links"><div class="profile_recentgame_header profile_leftcol_header links-header"><h2>Community Links</h2><div class="links-container"></div></div></div>';
SRBox += '<div class="extra-notes-container"><div class="profile_recentgame_header profile_leftcol_header links-header notes-header"><h2>Extra Notes</h2><div class="extra-notes"><img src="https://web.archive.org/web/20141010155000/http://i.imgur.com/rSFZZgI.gif" alt="Loading"/> Loading Notes...</div></div></div>';
SRBox += '<div class="sr-status"><div class="profile_recentgame_header profile_leftcol_header links-header rep-header"><h2><a target="_blank" href="https://web.archive.org/web/20141010155000/http://steamrep.com/profiles/'+SteamID64+'" >SteamRep Status</a></h2><div class="reputation-content"><img src="https://web.archive.org/web/20141010155000/http://i.imgur.com/rSFZZgI.gif" alt="Loading"/> Loading Rep...</div></div></div>';
// Prepend boxes to profile
document.getElementsByClassName("profile_leftcol")[0].innerHTML = SRBox + document.getElementsByClassName("profile_leftcol")[0].innerHTML;
// Community Links
var LinksContainer = document.getElementsByClassName("links-container")[0];
LinksContainer.style.fontSize = "14px";
LinksContainer.innerHTML = "";
LinksContainer.innerHTML += "Backpack: <a target='_blank' href='https://web.archive.org/web/20141010155000/http://tf2b.com/tf2/"+SteamID64+"'>TF2B</a> | <a target='_blank' href='https://web.archive.org/web/20141010155000/http://backpack.tf/profiles/"+SteamID64+"'>backpack.tf</a> | <a target='_blank' href='https://web.archive.org/web/20141010155000/http://tf2items.com/profiles/"+SteamID64+"'>TF2Items</a> | <a target='_blank' href='https://web.archive.org/web/20141010155000/http://optf2.com/tf2/user/"+SteamID64+"'>OPTF2</a><br/>";
LinksContainer.innerHTML += "Trading: <a target='_blank' href='https://web.archive.org/web/20141010155000/http://bazaar.tf/profiles/"+SteamID64+"'>bazaar.tf</a> | <a target='_blank' href='https://web.archive.org/web/20141010155000/http://www.tf2outpost.com/user/"+SteamID64+"'>TF2 Outpost</a> | <a target='_blank' href='https://web.archive.org/web/20141010155000/http://scrap.tf/profile/"+SteamID64+"'>Scrap.TF</a> | <a target='_blank' href='https://web.archive.org/web/20141010155000/http://dispenser.tf/id/"+SteamID64+"'>dispenser.tf</a><br/>";
LinksContainer.innerHTML += "Misc: <a target='_blank' href='https://web.archive.org/web/20141010155000/http://rep.tf/"+SteamID64+"'>Rep.TF</a> | <a target='_blank' href='https://web.archive.org/web/20141010155000/http://tf2r.com/user/"+SteamID64+".html'>TF2R</a> | <a target='_blank' href='https://web.archive.org/web/20141010155000/http://dota2lounge.com/profile?id="+SteamID64+"'>Dota 2 Lounge</a> | <a target='_blank' href='https://web.archive.org/web/20141010155000/http://csgolounge.com/profile?id="+SteamID64+"'>CS:GO Lounge</a><br/>";
// Extra Notes
var user = "";
if(unsafeWindow.g_steamID != false) user = unsafeWindow.g_steamID;
var extrarequest = new XMLHttpRequest();
extrarequest.open('GET', "https://web.archive.org/web/20141010155000/http://scrap.tf/profile.php?steamid=" + SteamID64 + "&user="+user, true);
extrarequest.onload = function() {
document.getElementsByClassName("extra-notes")[0].innerHTML = extrarequest.responseText;
};
extrarequest.send();
// SteamRep
var srequest = new XMLHttpRequest();
srequest.open('GET', "https://web.archive.org/web/20141010155000/https://steamrep.com/api/beta3/reputation/" + SteamID64 + "?json=1", true);
srequest.onload = function () {
var steamrep = JSON.parse(srequest.responseText);
steamrep = steamrep.steamrep;
var fullrep = (steamrep.reputation.full=="") ? "No special reputation." : steamrep.reputation.full;
document.getElementsByClassName("reputation-content")[0].innerHTML = fullrep;
if(steamrep.reputation.full.indexOf("SCAMMER") != -1){
document.getElementsByClassName("rep-header")[0].style.backgroundColor = "rgba(255, 0, 0, 0.25)";
document.getElementsByClassName("rep-header")[0].style.border = "2px solid red";
document.getElementsByClassName("profile_header_bg_texture")[0].style.border = "2px solid red";
document.getElementsByClassName("profile_content")[0].style.border = "2px solid red";
document.getElementsByClassName("profile_content")[0].style.borderTop = "none";
}else if(steamrep.reputation.full.indexOf("CAUTION") != -1){
document.getElementsByClassName("rep-header")[0].style.backgroundColor = "rgba(201, 129, 0, 0.25)";
}else if(steamrep.reputation.full.indexOf("ADMIN") != -1){
document.getElementsByClassName("rep-header")[0].style.backgroundColor = "rgba(0, 201, 40, 0.25)";
document.getElementsByClassName("rep-header")[0].style.border = "2px solid green";
document.getElementsByClassName("profile_header_bg_texture")[0].style.border = "2px solid green";
document.getElementsByClassName("profile_content")[0].style.border = "2px solid green";
document.getElementsByClassName("profile_content")[0].style.borderTop = "none";
}else if(steamrep.reputation.full.indexOf("TRUSTED") != -1){
document.getElementsByClassName("rep-header")[0].style.backgroundColor = "rgba(0, 201, 177, 0.25)";
}else if(steamrep.reputation.full.indexOf("MIDDLEMAN") != -1){
document.getElementsByClassName("rep-header")[0].style.backgroundColor = "rgba(0, 201, 177, 0.25)";
}else if(steamrep.reputation.full.indexOf("DONATOR") != -1){
document.getElementsByClassName("rep-header")[0].style.backgroundColor = "rgba(0, 105, 201, 0.25)";
}
};
srequest.send();
}else if(window.location.href.indexOf("/linkfilter/?url=") != -1){
// Link filter
var url = document.getElementsByClassName("url")[0].innerText;
var parsed = "http://"+SteamCommunitySuite.ParseUrl(url).hostname,
frag = parsed.replace(/[^.]*\.(?=\w+\.\w+$)/, '').replace("http://","").replace("https://","");
var container = document.getElementsByClassName("warningExplanation")[0];
if(window.localStorage['neverAskAgain'] && document.querySelectorAll(".friendlyInterstital > .warningSign").length >= 1){
container.innerHTML = "<div style='font-size:26px;text-align:center;'>Redirecting...</div>";
window.location = url;
}else if(SteamCommunitySuite.RememberedDomains.indexOf(frag) != -1){
// Go!
container.innerHTML = "<div style='font-size:26px;text-align:center;'>Site already remembered.<br/><br/>Redirecting...</div>";
window.location = url;
}else{
if(document.querySelectorAll(".friendlyInterstital > .warningSign").length >= 1){
var ButtonContainer = document.getElementById("warningActions");
ButtonContainer.innerHTML += "<a style=\"margin-top:8px;\" onclick=\"SteamCommunitySuite.RememberSite('"+url+"')\" id=\"rememberButton\" href=\"javascript:void(0);\" class=\"btn_grey_white_innerfade btn_medium\"><span>Continue & Never ask me again for this domain</span></a>";
ButtonContainer.innerHTML += "<a style=\"margin-top:8px;\" onclick=\"SteamCommunitySuite.NeverAskAgain('"+url+"')\" id=\"rememberButton2\" href=\"javascript:void(0);\" class=\"btn_grey_white_innerfade btn_medium\"><span>Continue & Never ask again for any domain</span></a><br/><small>Phishing sites will always be blocked no matter what option you use.</small>";
}
}
}
}
if(document.getElementById("market_buynow_dialog_accept_ssa") != undefined){
document.getElementById("market_buynow_dialog_accept_ssa").checked = true;
}
this.Log("Verified Valve Site <3");
}else{
if(window.location.href.indexOf("https://web.archive.org/web/20141010155000/http://forums.sourceop.com/") != 0){ // Stupid SourceOP Forums using Steam's CDN
// Fake!!!!
this.Log("Fake valve site!");
var ValveFakeSiteBox = "";
ValveFakeSiteBox += "<div id=\"steam_blocked_modal\" style=\"font-family:Arial,sans-serif !important;display:block;opacity:1 !important;background:rgba(0,0,0,.8);z-index:999999;position:fixed;top:0px;left:0px;width:100%;height:100%;\">";
ValveFakeSiteBox += " <div style=\"display:block;opacity:1 !important;box-shadow: 0px 0px 6px #000 inset;z-index:99999;width:600px;margin:auto;margin-top:300px;text-align:center;color:#FFF;border:5px solid #000;border-color:red;background:rgba(255,0,0,.4);padding:30px;font-size:16px;border-radius:12px;\">";
ValveFakeSiteBox += " <h1 style='font-family:Arial,sans-serif !important;color:#FFF !important;font-size:30px !important;font-weight:bold !important;'>DANGER!</h1>This is <b>NOT</b> an official Valve website!<br/>";
ValveFakeSiteBox += " This is most likely a phishing attempt and you should get out NOW!<br/><br/>";
ValveFakeSiteBox += " <span style=\"font-size:12px;\">Alternatively, If you <i>really</i> want to see this site <a href=\"#\" onclick=\"document.getElementById('steam_blocked_modal').style.display='none';\" >click here.</a><br/>If you this this is incorrect <a href='mailto:[email protected]?Subject=Steam%20Community%20Suite%20Report'>report it to me here</a></span>";
ValveFakeSiteBox += " </div>";
ValveFakeSiteBox += "</div>";
document.body.innerHTML += ValveFakeSiteBox;
}
}
} // end ValveSite
// Steam Trades & Offers
if(window.location.href.indexOf("steamcommunity.com/tradeoffer/new/") != -1 || window.location.href.indexOf("steamcommunity.com/trade/") != -1){
// Dump page button
document.getElementById("inventory_box").getElementsByClassName("trade_box_contents")[0].getElementsByClassName("trade_rule")[0].insertAdjacentHTML('beforebegin',"<a style='position: relative;left: 299px;top: 7px;' class='pagecontrol_element pagebtn' href='javascript:SteamCommunitySuite.DumpPageToTrade();' >Dump page</a>");
}
this.Log("Load Successful.");
},
NeverAskAgain: function(url){
if(window.localStorage){
window.localStorage['neverAskAgain'] = true;
}
window.location = url;
},
RememberSite: function(url) {
var parsed = "http://"+SteamCommunitySuite.ParseUrl(url).hostname,
frag = parsed.replace(/[^.]*\.(?=\w+\.\w+$)/, '').replace("http://","").replace("https://","");
SteamCommunitySuite.RememberedDomains.push(frag);
if(window.localStorage){
window.localStorage['rememberedDomains'] = JSON.stringify(SteamCommunitySuite.RememberedDomains);
}
window.location = url;
},
DumpPageToTrade: function() {
var InvPage = document.getElementById("inventory_"+unsafeWindow.g_steamID+"_"+unsafeWindow.g_ActiveInventory.appid+"_2").getElementsByClassName("inventory_page")[parseInt(document.getElementById('pagecontrol_cur').innerHTML - 1)];
InvPage = InvPage.children;
for (var i = InvPage.length - 1; i >= 0; i--) {
if(InvPage[i].style.display != "none"){
var x = InvPage[i].querySelectorAll("a");
for (var f = x.length - 1; f >= 0; f--) {
if(x[f].href != undefined && x[f].href.indexOf("steamcommunity.com") == -1) continue;
unsafeWindow.MoveItemToTrade(InvPage[i]);
};
}
};
}
}
// Load Script
unsafeWindow.SteamCommunitySuite = SteamCommunitySuite || {};
unsafeWindow.SteamCommunitySuite.Load();