您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Greasy Fork is available in English.
显示某人Codeforces每个难度过了多少题
当前为
// ==UserScript== // @name CF解题难度数据可视化 // @name:en codeforces analytics // @namespace https://codeforces.com/profile/tongwentao // @version 1.0.0 // @description 显示某人Codeforces每个难度过了多少题 // @description:en Analyse Codeforces profiles // @author tongwentao // @match https://codeforces.com/profile/* // @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw== // @grant none // @require https://cdn.jsdelivr.net/npm/[email protected]/dist/echarts.min.js // @license MIT // ==/UserScript== (function() { 'use strict'; function drawChart(res){ var div='<div class="roundbox userActivityRoundBox borderTopRound borderBottomRound" id="twtschart" style="height:400px;"></div>'; document.getElementById('pageContent').insertAdjacentHTML('beforeend',div); var chartDom = document.getElementById('twtschart'); var myChart = echarts.init(chartDom); var option; var xData=[]; var yData=[]; xData=Object.keys(res); for(var key in xData){ yData.push(res[xData[key]]); } option = { tooltip: { trigger: 'axis', axisPointer: { type: 'shadow' } }, grid: { left: '3%', right: '4%', bottom: '3%', containLabel: true }, xAxis: [ { type: 'category', data: xData, axisTick: { alignWithLabel: true } } ], yAxis: [ { type: 'value' } ], series: [ { name: 'solved', type: 'bar', barWidth: '60%', data: yData } ] }; option && myChart.setOption(option); } var pathname = window.location.pathname; var handle = pathname.substring(pathname.lastIndexOf('/') + 1, pathname.length); var httpRequest = new XMLHttpRequest(); httpRequest.open('GET', 'https://codeforces.com/api/user.status?handle='+handle, true); httpRequest.send(); httpRequest.onreadystatechange = function () { if (httpRequest.readyState == 4 && httpRequest.status == 200) { var json=JSON.parse(httpRequest.responseText); var result=[]; result=json.result;; var res={}; for(var key in result){ if(result[key].verdict==="OK"){ var rating=result[key].problem.rating; if(rating in res) res[rating]++; else res[rating]=1; } } console.log(res); drawChart(res); } }; })();