Steam Extra Game Links

Adds extra links to Steam Store and Game Hub pages.

目前為 2014-09-22 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name          Steam Extra Game Links
// @namespace     http://greasyfork.org/users/2240-doodles
// @author        Doodles
// @version       2
// @description   Adds extra links to Steam Store and Game Hub pages.
// @icon          http://i.imgur.com/SJczdF1.png
// @icon64        http://i.imgur.com/HmelVyp.png
// @include       *://steamcommunity.com/app/*
// @include       *://store.steampowered.com/app/*
// @grant         none
// @updateVersion 2
// ==/UserScript==

var $, jQuery;
$ = jQuery = window.jQuery;
function urlContains(urlfragment) { return document.URL.indexOf(urlfragment) != -1; }
$("<style></style>").prop("type", "text/css").html("\
div.sel_links {background-color:#252525;padding:2px 5px 2px 5px;margin-bottom:10px;font-size:10px;text-align:left;color:#888888;}\
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:#0a0a0a;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;}\
div.sel_float {float:right;display:block;width:200px;}").appendTo("head");

var gameId = document.URL.split("/app/")[1].split("/")[0].split("?")[0].split("#")[0];
var appName;
var appNameDiv = $(".apphub_AppName").first();
if(appNameDiv.length != 0) { appName = $(appNameDiv).text(); }

var link_01_01 = "<a title=\"Achievement Stats\" href=\"http://www.achievementstats.com/index.php?action=games&gameId=" + gameId + "\">AchievementStats.com</a>";
var link_01_02 = "<a title=\"AStats\" href=\"http://astats.astats.nl/astats/Steam_Game_Info.php?AppID=" + gameId + "\">AStats.nl</a>";
var link_01_03 = "<a title=\"How Long To Beat\" href=\"http://www.howlongtobeat.com/search.php?t=games&s=" + appName + "\">HowLongToBeat.com</a>";

var link_02_01 = "<a title=\"Steam Charts\" href=\"http://steamcharts.com/app/" + gameId + "\">SteamCharts.com</a>";
var link_02_02 = "<a title=\"Steam Graph\" href=\"http://steamgraph.net/index.php?action=graph&appid=" + gameId + "&from=0\">SteamGraph.net</a>";
var link_02_03 = "<a title=\"Steam DB\" href=\"http://steamdb.info/app/" + gameId + "/\">SteamDB.info</a>";
var link_02_04 = "<a title=\"PC Gaming Wiki\" href=\"http://pcgamingwiki.com/api/appid.php?appid=" + gameId + "\">PC Gaming Wiki</a>";

var link_03_01 = "<a title=\"Steam Stats\" href=\"http://steamcommunity.com/stats/" + gameId + "/\">Steam Stats and Achievements</a>";
var link_03_02 = "<a title=\"Official Steam Group\" href=\"http://steamcommunity.com/ogg/" + gameId + "\">Official Steam Group</a>";
var link_03_03 = "<a title=\"Steam Store\" href=\"http://store.steampowered.com/app/" + gameId + "\">Steam Store</a>";
var link_03_04 = "<a title=\"Steam Store DLC\" href=\"http://store.steampowered.com/dlc/" + gameId + "\">DLC (?)</a>";
var link_03_05 = "<a title=\"IsThereAnyDeal.com Search\" href=\"http://isthereanydeal.com/#/search:" + appName + ";/scroll:%23gamelist\">IsThereAnyDeal.com</a>";

var link_04_01 = "<a title=\"Steam Hub\" href=\"http://steamcommunity.com/app/" + gameId + "/\">Steam Hub</a>";
var link_04_02 = "<a title=\"Steam Hub Discussions\" href=\"http://steamcommunity.com/app/" + gameId + "/discussions/\">Discussions</a>";
var link_04_03 = "<a title=\"Steam Hub Screenshots\" href=\"http://steamcommunity.com/app/" + gameId + "/screenshots/\">Screenshots</a>";
var link_04_04 = "<a title=\"Steam Hub Artwork\" href=\"http://steamcommunity.com/app/" + gameId + "/images/\">Artwork</a>";
var link_04_05 = "<a title=\"Steam Hub Videos\" href=\"http://steamcommunity.com/app/" + gameId + "/videos\">Videos</a>";
var link_04_06 = "<a title=\"Steam Hub News\" href=\"http://steamcommunity.com/app/" + gameId + "/news\">News</a>";
var link_04_07 = "<a title=\"Steam Hub Announcements\" href=\"http://steamcommunity.com/app/" + gameId + "/announcements\">Announcements</a>";
var link_04_08 = "<a title=\"Steam Hub Guides\" href=\"http://steamcommunity.com/app/" + gameId + "/guides/\">Guides</a>";
var link_04_09 = "<a title=\"Steam Hub Reviews\" href=\"http://steamcommunity.com/app/" + gameId + "/reviews/\">Reviews</a>";

var link_foot_1 = "<a title=\"GreasyFork\" target\"_blank\" href=\"https://greasyfork.org/scripts/5174-steam-extra-game-links\">GreasyFork</a>";
var link_foot_2 = "<a title=\"DoodlesStuff\" target\"_blank\" href=\"http://doodlesstuff.com/?script=segl\">DoodlesStuff</a>";

if (urlContains("store.steampowered.com/app/")) {
// STORE PAGE - START
var linkDiv = $("<div></div>").addClass("sel_links");
var rightColBox = $("#my_activity");
if (rightColBox.length != 0) { $(linkDiv).insertBefore(rightColBox); }
else {
	var rightBox2 = $("#demo_block");
	if (rightBox2.length != 0) { $(linkDiv).insertBefore(rightBox2); }
}
var achDiv = $(".communitylink_achievement_inner").first();
if(achDiv.length != 0) { 
	var achLinkText = "Achievements";
	var achP = $(achDiv).find("p").first();
	if(achP.length != 0) {
		var numText = $(achP).text();
		var numBer = numText.split(" ");
		if(numBer.length > 1) {
			achLinkText = numBer[1] + " Achievements";
		}
	}
	linkDiv.append($("<div><a title=\"Steam Achievements\" href=\"http://steamcommunity.com/stats/" + gameId + "/achievements\">"+ achLinkText +"</a></div>")); 
} else { 
	linkDiv.append($("<div>No achievements</div>")); 
}
linkDiv.append($("<div>" + link_01_01 + " | " + link_01_02 + "</div><div>" + link_03_05 + " | " + link_01_03 + "</div>"));
var dlcBox = $(".game_area_dlc_section").first();
if (dlcBox.length != 0) {
	var dlcLab = "DLC (?)";
	
	var dlcSubBox = $(dlcBox).find(".tableView").first();
	if(dlcSubBox.length != 0) {
		var dlcA = $(dlcSubBox).find("a");
		if(dlcA.length > 1) { dlcLab = "DLC (" + (dlcA.length - 1) + ")"; }
	}
	linkDiv.append($("<a title=\"Steam Store DLC\" href=\"http://store.steampowered.com/dlc/" + gameId + "\">" + dlcLab + "</a>"));
}
linkDiv.append($("<hr>"));
linkDiv.append($("<div>" + link_02_01 + "</div><div>" + link_02_02 + "</div><div>" + link_02_03 + "</div><div>" + link_02_04 + "</div>"));
linkDiv.append($("<hr>"));
linkDiv.append($("<div>" + link_04_01 + ": " + link_04_02 + ", " + link_04_03 + ", " + link_04_04 + ", " + link_04_05 + ", " + link_04_06 + ", " + link_04_07 + ", " + link_04_08 + ", " + link_04_09 + "</div>"));
linkDiv.append($("<hr>"));
linkDiv.append($("<div>" + link_03_01 + "</div><div>" + link_03_02 + "</div>"));
linkDiv.append($("<hr>"));
linkDiv.append($("<div class=\"sel_foot\">Steam Extra Links: " + link_foot_1 + " | " + link_foot_2 + "</div>"));
// STORE PAGE - END
} else if (urlContains("steamcommunity.com/app/")) {
// HUB PAGE - START
var linkDiv = $("<div></div>").addClass("sel_links");
var topBox = $(".apphub_sectionTabsHR").first();
if (topBox.length != 0) {
	$(linkDiv).insertAfter(topBox);
	linkDiv.append($("<div class=\"sel_foot sel_float\">Steam Extra Links:<br>" + link_foot_1 + " | " + link_foot_2 + "</div>"));
	linkDiv.append($("<div>" + link_01_01 + " | " + link_01_02 + " | " + link_01_03 + " | " + link_02_01 + " | " + link_02_02 + " | " + link_02_03 + " | " + link_02_04 + "</div>"));
	linkDiv.append($("<hr>"));
	linkDiv.append($("<div>" + link_03_03 + " | " + link_03_04 + " | " + link_03_05 + " | " + link_03_01 + " | " + link_03_02 + "</div>"));
}
// HUB PAGE - END
}