// ==UserScript== // @name AtCoder Fav Rating // @name:ja AtCoder Fav Rating // @namespace https://github.com/Coki628/ac-fav-rating // @version 1.1.5 // @description You can check your fav's rating for AtCoder! // @description:ja AtCoderのお気に入り管理ページでレート等の情報を確認できます。 // @author Coki628 // @license MIT // @match https://atcoder.jp/settings/fav* // @grant GM_addStyle // @grant GM_getResourceText // @resource CSS1 https://cdnjs.cloudflare.com/ajax/libs/datatables/1.10.12/css/dataTables.bootstrap.min.css // @require https://cdnjs.cloudflare.com/ajax/libs/datatables/1.10.12/js/jquery.dataTables.min.js // @require https://cdnjs.cloudflare.com/ajax/libs/datatables/1.10.12/js/dataTables.bootstrap.min.js // @downloadURL https://update.greasyfork.org/scripts/406745/AtCoder%20Fav%20Rating.user.js // @updateURL https://update.greasyfork.org/scripts/406745/AtCoder%20Fav%20Rating.meta.js // ==/UserScript== GM_addStyle(GM_getResourceText('CSS1')); (function() { 'use strict'; // 色のクラス名を取得 const getColorType = function(x) { if (x >= 2800) { return 'user-red'; } else if (2800 > x && x >= 2400) { return 'user-orange'; } else if (2400 > x && x >= 2000) { return 'user-yellow'; } else if (2000 > x && x >= 1600) { return 'user-blue'; } else if (1600 > x && x >= 1200) { return 'user-cyan'; } else if (1200 > x && x >= 800) { return 'user-green'; } else if (800 > x && x >= 400) { return 'user-brown'; } else { return 'user-gray'; } } let total = 0; const getInfo = function(userName, $tr) { $.ajax({ // url: 'https://atcoder.jp/users/' + userName + '/history/json', url: 'https://atcoder.jp/users/' + userName, type: 'GET', // dataType: 'json', dataType: 'html', }) .done(function(data) { // ユーザーページから必要な項目を取得 let rank = 9999999; let rating = 0; let highest = 0; let count = 0; let lastCompeted = ''; $($($.parseHTML(data)).find('table.dl-table')[1]).find('tbody>tr').each(function() { if ($(this).find('th').text() === '順位') { rank = Number($(this).find('td').text().slice(0, -2)); } else if ($(this).find('th').text() === 'Rating') { rating = Number($($(this).find('td>span')[0]).text()); } else if ($(this).find('th').text() === 'Rating最高値') { highest = Number($($(this).find('td>span')[0]).text()); } else if ($(this).find('th').text() === 'コンテスト参加回数 ') { count = Number($(this).find('td').text()); } else if ($(this).find('th').text() === '最後に参加した日') { lastCompeted = $(this).find('td').text(); } }); // 列追加 $tr.prepend('