// ==UserScript== // @name Steam Extra Profile Links // @namespace http://greasyfork.org/users/2240-doodles // @author Doodles // @version 2 // @description Adds extra links to Steam Profile pages. // @icon http://i.imgur.com/9RyxVXP.png // @icon64 http://i.imgur.com/d3fMq5W.png // @include *://steamcommunity.com/id/* // @include *://steamcommunity.com/profiles/* // @grant none // @updateVersion 2 // @downloadURL none // ==/UserScript== var $, jQuery; $ = jQuery = window.jQuery; $.extend({ getSteamId: function(steamXmlUrl) { var theResponse = null; $.ajax({ url: steamXmlUrl, type: "GET", dataType: "xml", async: false, success: function(respText) { theResponse = respText; }, error: function(xhr, status, error) { console.log(xhr.responseText); } }); return theResponse; } }); function urlContains(urlfragment) { return document.URL.indexOf(urlfragment) != -1; } function getSteamProfileXmlUrl(url) { return "http://steamcommunity.com/id/" + url.split("/id/")[1].split("/")[0].split("?")[0] + "?xml=1"; } function getSteamProfileXmlUrl2(url) { return "http://steamcommunity.com/profiles/" + url.split("/profiles/")[1].split("/")[0].split("?")[0] + "?xml=1"; } function getSteamIdFromUrl(url) { return url.split("/profiles/")[1].split("/")[0].split("?")[0]; } function isLoggedIn() { return $("#account_pulldown").length != 0; } function isPrivateProfile() { return $(".profile_private_info").length != 0; } function convertToAccount(s64) { return "[U:1:" + (s64.substring(5) - 197960265728) + "]"; } function convertTo32(s64) { var num = s64.substring(5) - 197960265728; //76561197960265728; return "STEAM_0:" + num%2 + ":" +(num - num%2) / 2; } if (urlContains("steamcommunity.com/id/") || urlContains("steamcommunity.com/profiles/")) { var profileBox = $(".profile_rightcol:first"); if (profileBox.length != 0) { // Box Styles ---------------------------------------------border:solid 1px #1d3147; $("").prop("type", "text/css").html("\ div.sel_links {background-color:#05090c;padding:2px 5px 2px 5px;margin-bottom:10px;font-size:10px;}\ div.sel_links ul {list-style-type:none;margin:0;padding:0;}\ div.sel_links ul li {font-size:10px;color:#999999;}\ div.sel_links a, div.sel_links a:link {color:#5491cf;text-decoration:none;}\ div.sel_links a:visited {color:#5491cf;}\ div.sel_links a:hover {color:#5491cf;text-decoration:underline;}\ div.sel_links a:active {color:#5491cf;}\ div.sel_links hr {border:0;height:1px;background:#1d3147;margin-top:2px;margin-bottom:2px;}\ div.sel_foot {margin:0;padding:0;text-align:center;font-size:10px;color:#444444;}\ div.sel_foot a, div.sel_foot a:link {color:#444444;text-decoration:none;}\ div.sel_foot a:visited {color:#444444;}\ div.sel_foot a:hover {color:#999999;text-decoration:underline;}\ div.sel_foot a:active {color:#444444;}\ span.selG {color:#016401;}\ span.selY {color:#e1bf00;}\ span.selR {color:#611515;}").appendTo("head"); // Prepare Box --------------------------------------------- var linksDiv = $("
").addClass("sel_links"); var badgeDiv = $(".profile_badges:first"); if (badgeDiv.length != 0) { $(linksDiv).insertBefore(badgeDiv); var onlineStatus = $(".profile_in_game").first(); if (onlineStatus.length != 0) { onlineStatus.css("margin-bottom", "10px"); } var banStatus = $(".profile_ban_status").first(); if (banStatus.length != 0) { banStatus.css("margin-bottom", "10px"); } } else { profileBox.prepend(linksDiv); } // Create Links --------------------------------------------- var s64id = ""; var xmlPage; if(urlContains("steamcommunity.com/id/")) { xmlPage = $.getSteamId(getSteamProfileXmlUrl(document.URL)); s64id = $(xmlPage).find("steamID64").first().text(); } else { s64id = getSteamIdFromUrl(document.URL); xmlPage = $.getSteamId(getSteamProfileXmlUrl2(document.URL)); } var link_01_01 = "SteamRep"; var link_01_02 = "SteamDB"; var link_01_03 = "Steam Trades"; var link_01_04 = "Steam Gifts"; var link_02_01 = "Backpack"; var link_02_02 = "Profile"; var link_02_03 = "Backpack"; var link_02_04 = "Profile"; var link_02_05 = "Backpack"; var link_02_06 = "Profile"; var link_02_07 = "TF2 Trading Post Profile"; var link_02_08 = "TF2 Backpack Examiner"; var link_02_09 = "TF2"; var link_02_10 = "DOTA2"; var link_02_11 = "CSGO"; var link_02_12 = "Portal 2"; var link_03_01 = "Achievement Stats"; var link_03_02 = "astats.nl"; var link_03_03 = "Wasted on Steam"; var link_04_01 = "Games"; var link_04_02 = "All Games"; var link_04_03 = "Screenshots"; var link_04_04 = "Videos"; var link_04_05 = "Artwork"; var link_04_06 = "Reviews"; var link_04_07 = "Guides"; var link_04_08 = "Workshop Items"; var link_04_09 = "Greenlight Items"; var link_04_10 = "Friends"; var link_04_11 = "Groups"; var link_04_12 = "TF2"; var link_04_13 = "Dota2"; var link_04_14 = "Steam"; var link_04_15 = "CSGO"; var link_04_16 = "All Comments"; var link_04_17 = "Name History"; var link_04_18 = "Friends in Common"; var link_04_19 = "Groups in Common"; var link_04_20 = "Badges"; var link_05_01 = "CSGO Lounge"; // Alter Profile Links --------------------------------------------- var gotProfileLinks = false; var invCount = "Inventory: "; //profile_item_links var normalLinks = $(".profile_item_links").first(); if(normalLinks.length != 0) { gotProfileLinks = true; var c = $(normalLinks).find("a"); for (i = 0; i < c.length; i++) { var spanCount = $(c[i]).find(".profile_count_link_total").first(); if(spanCount.length != 0) { var cv = $(spanCount).text().trim(); if(cv.length != 0) { if (c[i].href.indexOf("/games/") != -1) { link_04_01 = link_04_01.replace("", " (" + cv + ")"); } else if (c[i].href.indexOf("/screenshots/") != -1) { link_04_03 = link_04_03.replace("", " (" + cv + ")"); } else if (c[i].href.indexOf("/videos/") != -1) { link_04_04 = link_04_04.replace("", " (" + cv + ")"); } else if (c[i].href.indexOf("/inventory/") != -1) { invCount = "Inventory (" + cv + "): "; } else if (c[i].href.indexOf("/myworkshopfiles/?section=greenlight") != -1) { link_04_09 = link_04_09.replace("", " (" + cv + ")"); } else if (c[i].href.indexOf("/images/") != -1) { link_04_05 = link_04_05.replace("", " (" + cv + ")"); } else if (c[i].href.indexOf("/myworkshopfiles/?section=guides") != -1) { link_04_07 = link_04_07.replace("", " (" + cv + ")"); } else if (c[i].href.indexOf("/recommended/") != -1) { link_04_06 = link_04_06.replace("", " (" + cv + ")"); } else if (c[i].href.indexOf("/myworkshopfiles/") != -1) { link_04_08 = link_04_08.replace("", " (" + cv + ")"); } } } } } // Add Links --------------------------------------------- var linkList = $(""); linksDiv.append(linkList); linkList.append($("
  • " + link_01_01 + " | " + link_01_02 + "
  • ")); var vac = $(xmlPage).find("vacBanned").first().text(); if(vac == "1") { vac = "VAC Banned"; } else if(vac == "0") { vac = "None"; } else { vac = "" + vac + ""; } linkList.append($("
  • VAC Ban: " + vac + "
  • ")); var trade = $(xmlPage).find("tradeBanState").first().text(); if(trade == "None") { trade = "None"; } else { trade = "" + trade + ""; } linkList.append($("
  • Trade Ban: " + trade + "
  • ")); /*var privacy = $(xmlPage).find("privacyState").first().text(); if(privacy == "private") { privacy = "Private"; } else if(privacy == "friendsonly") { privacy = "Friends Only"; } else if(privacy == "public") { privacy = "Public"; } linkList.append($("
  • Profile Privacy: " + privacy + "
  • "));*/ var memberSince = $(xmlPage).find("memberSince").first(); if(memberSince.length != 0) { linkList.append($("
  • Joined: " + $(memberSince).text() + "
  • ")); } linkList.append($("
  • " + s64id + "
  • ")); linkList.append($("
  • " + convertToAccount(s64id) + "
  • ")); linkList.append($("
  • " + convertTo32(s64id) + "
  • ")); linksDiv.append($("
    ")); linkList = $(""); linksDiv.append(linkList); linkList.append($("
  • backpack.tf: " + link_02_01 + " | " + link_02_02 +"
  • ")); linkList.append($("
  • TF2Outpost: " + link_02_03 + " | " + link_02_04 + "
  • ")); linkList.append($("
  • bazaar.tf: " + link_02_05 + " | " + link_02_06 + "
  • ")); linkList.append($("
  • " + link_02_07 + "
  • ")); linkList.append($("
  • " + link_02_08 + "
  • ")); linkList.append($("
  • TF2B: " + link_02_09 + " | " + link_02_10 + " | " + link_02_11 + " | " + link_02_12 + "
  • ")); linkList.append($("
  • " + link_01_03 + " | " + link_01_04 + "
  • ")); linkList.append($("
  • " + link_05_01 + "
  • ")); linksDiv.append($("
    ")); linkList = $(""); linksDiv.append(linkList); linkList.append($("
  • " + link_03_01 + " | " + link_03_02 + " | " + link_03_03 + "
  • ")); linksDiv.append($("
    ")); linkList = $(""); linksDiv.append(linkList); if(!isPrivateProfile() && gotProfileLinks) { normalLinks.remove(); linkList.append($("
  • " + link_04_01 + " | " + link_04_02 + "
  • ")); linkList.append($("
  • " + link_04_03 + " | " + link_04_04 + " | " + link_04_05 + "
  • ")); linkList.append($("
  • " + link_04_06 + " | " + link_04_07 + "
  • ")); linkList.append($("
  • " + link_04_08 + " | " + link_04_09 + "
  • ")); linkList.append($("
  • " + link_04_10 + " | " + link_04_11 + " | " + link_04_20 + "
  • ")); linkList.append($("
  • " + invCount + link_04_12 + " | " + link_04_13 + " | " + link_04_14 + " | " + link_04_15 + "
  • ")); linkList.append($("
  • " + link_04_16 + " | " + link_04_17 + "
  • ")); if(isLoggedIn()) { linkList.append($("
  • " + link_04_18 + " | " + link_04_19 + "
  • ")); } linksDiv.append($("
    ")); } var footDiv = $("
    ").addClass("sel_foot"); footDiv.append("Steam Extra Links: "); footDiv.append("GreasyFork"); footDiv.append(" | "); footDiv.append("DoodlesStuff"); linksDiv.append(footDiv); } }