您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
shows pp data from osustats.ppy.sh on osu score pages.
当前为
// ==UserScript== // @name pp for osu score pages // @namespace http://osustats.ppy.sh // @description shows pp data from osustats.ppy.sh on osu score pages. // @include http*://osu.ppy.sh/b/* // @include http*://osu.ppy.sh/s/* // @include http*://osu.ppy.sh/p/beatmap?b=* // @grant GM_setValue // @grant GM_getValue // @grant GM_xmlhttpRequest // @version 1 // ==/UserScript== var requestingPage=false; var result=null; function ShowAlert() { var mapTab = document.getElementsByClassName("beatmapTab active"); if(mapTab.length==1) { var split = mapTab[0].href.split("/")[4]; mapID = split.split("&")[0]; GetPage(mapID,function(res){ result = JSON.parse(res); var rows,thisImg,username,score,row,pp; rows = document.evaluate('//div[@class=\'beatmapListing\']/table/tbody/tr', document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null); rows.snapshotItem(0).children[5].innerHTML="Combo / pp"; for (var i=1;i<rows.snapshotLength;i++) { row = rows.snapshotItem(i); username = row.children[4].children[1].innerHTML; score = row.children[2].innerHTML.replace(/,/g,'').replace(/<b>/g,'').replace(/<\/b>/g,''); pp = GetPpFromUsername(username,score); if(pp!=null) { if(pp!="s") row.children[5].innerHTML += " / "+(Math.round(pp * 100) / 100)+"pp"; else row.children[5].innerHTML += " / N/U"; } else row.children[5].innerHTML += " / N/D"; } }); } } function GetPpFromUsername(username,score) { for (var i=0;i<result.length;i++) { if(username == result[i].name) { if(score == result[i].score) { return result[i].pp; } return "s"; } } return null; } function GetPage(mapID,callback) { GM_xmlhttpRequest({ method: "GET", url: "http://osustats.ppy.sh/API/beatmap.php?mode=0&id=" + mapID, synchronous: true, headers: { Referer: location.href }, onload: function(resp) { callback(resp.responseText); } }); } window.addEventListener('load', function() { ShowAlert(); }, false);