Greasy Fork

Greasy Fork is available in English.

Steam Extra Profile Links

Adds extra links to Steam Profile pages.

目前为 2017-05-06 提交的版本。查看 最新版本

作者
Doodles
评分
0 0 0
版本
12
创建于
2014-09-19
更新于
2017-05-06
大小
15.1 KB
许可证
暂无
适用于

// ==UserScript==
// @name Steam Extra Profile Links
// @namespace http://greasyfork.org/users/2240-doodles
// @author Doodles
// @version 13
// @description Adds extra links to Steam Profile pages.
// @icon http://i.imgur.com/c4qvWvz.png
// @icon64 http://i.imgur.com/ZumqrhD.png
// @include *://steamcommunity.com/id/*
// @include *://steamcommunity.com/profiles/*
// @include *://steamcommunity.com//id/*
// @include *://steamcommunity.com//profiles/*
// @exclude *://steamcommunity.com/id/*/tradeoffers/*
// @exclude *://steamcommunity.com/profiles/*/tradeoffers/*
// @exclude *://steamcommunity.com//id/*/tradeoffers/*
// @exclude *://steamcommunity.com//profiles/*/tradeoffers/*
// @require http://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js
// @grant GM_xmlhttpRequest
// @updateVersion 13
// ==/UserScript==

$(document).ready(function () {
'use strict';
if ($(".profile_rightcol").length) {
$("

").prop("type", "text/css").html('div.sel_links {background-color:#202020;padding:2px 5px 2px 5px;margin-bottom:10px;margin-right:10px;font-size:10px;color:#999999;}div.sel_links a, di' +
'v.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:u' +
'nderline;}div.sel_links a:active {color:#5491cf;}div.sel_links hr {border:0;height:1px;background:#0a0a0a;margin-top:2px;margin-bottom:2px;}div.sel_fo' +
'ot {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.se' +
'l_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' +
':#2d8d2b;}span.selY {color:#e1bf00;}span.selR {color:#a94847;}').appendTo("head");
var steamXmlUrl;
if(document.URL.indexOf("steamcommunity.com/id/") != -1 || document.URL.indexOf("steamcommunity.com//id/") != -1) {
steamXmlUrl = "//steamcommunity.com/id/" + document.URL.split("/id/")[1].split("/")[0].split("?")[0] + "?xml=1";
} else {
steamXmlUrl = "//steamcommunity.com/profiles/" + document.URL.split("/profiles/")[1].split("/")[0].split("?")[0] + "?xml=1";
}
GM_xmlhttpRequest({
method: 'GET',
url: steamXmlUrl,
onload: function(responseDetails) {
extraProfileLinks(responseDetails.responseText);
},
onerror: function(responseDetails) {
console.log(responseDetails.responseText);
}
});
}
function extraProfileLinks(xmlPage) {
var selProfileSid64 = $(xmlPage).find("steamID64").first().text();
var selTempNum = selProfileSid64.substring(5) - 197960265728; //76561197960265728;
var selProfileSid32 = "STEAM_0:" + selTempNum%2 + ":" +(selTempNum - selTempNum%2) / 2;
var selProfileSidV3 = "[U:1:" + selTempNum + "]";

var linkDiv = $('

');
if ($(".profile_badges").length) {
$(linkDiv).insertBefore($(".profile_badges").first());
if ($(".profile_in_game").length) {
$(".profile_in_game").first().css("margin-bottom", "10px");
}
if ($(".profile_ban_status").length) {
$(".profile_ban_status").first().css("margin-bottom", "10px");
}
} else {
$(".profile_rightcol").first().prepend(linkDiv);
}

var link_01_01 = "SteamRep";
var link_01_02 = "SteamDB";
var link_01_03 = "Steam Trades";
var link_01_04 = "Steam Gifts";
var link_01_05 = "Vac-Ban.com";

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_02_13 = "TF2Center";

var link_03_01 = "Achievement Stats";
var link_03_02 = "astats.nl";
var link_03_03 = "Steam Ladder";

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_04_21 = "Wishlist";

var link_05_01 = "CSGO Lounge";

var link_foot_1 = "GreasyFork";
var link_foot_2 = "DoodlesStuff";

var invCount = "Inventory: ";
if($(".profile_item_links").length) {
$(".profile_item_links a").each(function(){
if($(this).find(".profile_count_link_total").length) {
var tempHref = $(this).attr('href');
var tempCount = $(this).find(".profile_count_link_total").text().trim();
if(tempCount.length) {
if (tempHref.indexOf("/games/") != -1) { link_04_01 = link_04_01.replace("", " (" + tempCount + ")"); }
else if (tempHref.indexOf("/screenshots/") != -1) { link_04_03 = link_04_03.replace("", " (" + tempCount + ")"); }
else if (tempHref.indexOf("/videos/") != -1) { link_04_04 = link_04_04.replace("", " (" + tempCount + ")"); }
else if (tempHref.indexOf("/inventory/") != -1) { invCount = "Inventory (" + tempCount + "): "; }
else if (tempHref.indexOf("/myworkshopfiles/?section=greenlight") != -1) { link_04_09 = link_04_09.replace("", " (" + tempCount + ")"); }
else if (tempHref.indexOf("/images/") != -1) { link_04_05 = link_04_05.replace("", " (" + tempCount + ")"); }
else if (tempHref.indexOf("/myworkshopfiles/?section=guides") != -1) { link_04_07 = link_04_07.replace("", " (" + tempCount + ")"); }
else if (tempHref.indexOf("/recommended/") != -1) { link_04_06 = link_04_06.replace("", " (" + tempCount + ")"); }
else if (tempHref.indexOf("/myworkshopfiles/") != -1) { link_04_08 = link_04_08.replace("", " (" + tempCount + ")"); }
}
}
});
$(".profile_item_links").first().empty();
}

linkDiv.append($("

" + link_01_01 + " | " + link_01_02 + " | " + link_01_05 + "

"));
var vac = $(xmlPage).find("vacBanned").first().text();
if(vac == "1") { vac = "VAC Banned"; }
else if(vac == "0") { vac = "None"; }
else { vac = "" + vac + ""; }
linkDiv.append($("

VAC Ban: " + vac + "

"));
var trade = $(xmlPage).find("tradeBanState").first().text();
if(trade == "None") { trade = "None"; }
else { trade = "" + trade + ""; }
linkDiv.append($("

Trade Ban: " + trade + "

"));
var memberSince = $(xmlPage).find("memberSince").first();
if(memberSince.length) { linkDiv.append($("

Joined: " + $(memberSince).text() + "

")); }
linkDiv.append($("

" + selProfileSid64 + "
" + selProfileSidV3 + "
" + selProfileSid32 + "

"));
linkDiv.append($("


"));
linkDiv.append($("

backpack.tf: " + link_02_01 + " | " + link_02_02 +"

"));
linkDiv.append($("

TF2Outpost: " + link_02_03 + " | " + link_02_04 + "

"));
linkDiv.append($("

bazaar.tf: " + link_02_05 + " | " + link_02_06 + "

"));
linkDiv.append($("

" + link_02_07 + "
" + link_02_08 + "

"));
linkDiv.append($("

TF2B: " + link_02_09 + " | " + link_02_10 + " | " + link_02_11 + " | " + link_02_12 + "

"));
linkDiv.append($("

" + link_01_03 + " | " + link_01_04 + "

"));
linkDiv.append($("

" + link_02_13 + " | " + link_05_01 + "

"));
linkDiv.append($("


"));
linkDiv.append($("

" + link_03_01 + " | " + link_03_02 + " | " + link_03_03 + "

"));
linkDiv.append($("


"));
if($(".profile_private_info").length == 0) { // display profile type links IF profile ISNT private
linkDiv.append($("

" + link_04_01 + " | " + link_04_02 + " | " + link_04_21 + "

"));
linkDiv.append($("

" + link_04_03 + " | " + link_04_04 + " | " + link_04_05 + "

"));
linkDiv.append($("

" + link_04_06 + " | " + link_04_07 + "

"));
linkDiv.append($("

" + link_04_08 + " | " + link_04_09 + "

"));
linkDiv.append($("

" + link_04_10 + " | " + link_04_11 + " | " + link_04_20 + "

"));
linkDiv.append($("

" + invCount + link_04_12 + " | " + link_04_13 + " | " + link_04_14 + " | " + link_04_15 + "

"));
linkDiv.append($("

" + link_04_16 + " | " + link_04_17 + "

"));
if($("#account_pulldown").length) { linkDiv.append($("

" + link_04_18 + " | " + link_04_19 + "

")); }
} else {
linkDiv.append($("

" + link_04_16 + " | " + link_04_17 + "

"));
}
linkDiv.append($("


"));
linkDiv.append($("

Steam Extra Links: " + link_foot_1 + " | " + link_foot_2 + "

"));

if($(".profile_in_game_name").length) {
var gameName = $(".profile_in_game_name").text().trim();
gameName = gameName.replace("=", "%3D").replace("=", "%3D").replace("=", "%3D");
gameName = gameName.replace("&", "%26").replace("&", "%26").replace("&", "%26");
var gameName2 = gameName;
while(gameName2.indexOf(" ") != -1){
gameName2 = gameName2.replace(" ", "+");
}
if(gameName.indexOf("Last Online") == -1) {
$(".profile_in_game_name").html($("" + gameName + ""));
}else{

}
}
}
});