Greasy Fork

osu! Profile Detail

Show some API stats in profile page

当前为 2014-08-11 提交的版本,查看 最新版本

// ==UserScript==
// @name           osu! Profile Detail
// @description    Show some API stats in profile page
// @author         JebwizOscar
// @icon           http://osu.ppy.sh/favicon.ico
// @include        http://osu.ppy.sh/u/*
// @include        https://osu.ppy.sh/u/*
// @grant          GM_xmlhttpRequest
// @grant          GM_openInTab
// @grant          GM_setValue
// @grant          GM_getValue
// @version        1.6.0.0055
// @require        http://code.jquery.com/ui/1.10.4/jquery-ui.js
// @namespace      https://greasyfork.org/users/3079
// ==/UserScript==
var ver = 55;
var pz = document.getElementsByClassName("prof-right")[0];
var code = document.documentElement.innerHTML;
var udt = code.match("var localUserId = ([0-9]+)");
var uid = code.match("var userId = ([0-9]+)")[1];
var e = code.match("var activeGameMode = ([0-9])")[1];
if (null !== udt) {
	ud = udt[1];
	udstr = "&ud=" + ud;
} else {
	ud = "0";
	udstr = "";
}
var prefix = "http://osupd.ml/";

function main() {
	qstr = "sv=" + ver + udstr;
	var a, b;
	a = document.getElementsByTagName("head")[0];
	b = document.createElement("style");
	b.type = "text/css";
	b.innerHTML = ".unexpanded { display:none; }";
	a.appendChild(b);
	GM_xmlhttpRequest({
		method: "GET",
		url: prefix + "pf_det.php?" + qstr + "&u=" + uid + "&m=" + e,
		headers: {
			Referer: location.href
		},
		onload: function(a) {
			var c, b = a.responseText;
			pz.innerHTML += '<table class="beatmapListing" id="api" cellspacing="0" >' + b + '</table>';
			script = document.createElement("script");
			script.innerHTML = 'var sv=' + ver;
			document.body.appendChild(script);
			GM_xmlhttpRequest({
				method: "GET",
				url: prefix + "pf_det.js",
				headers: {
					Referer: location.href
				},
				onload: function(a) {
					var b = a.responseText;
					script = document.createElement("script");
					script.innerHTML = b;
					document.body.appendChild(script);
				}
			});
		}
	});

}
main();