// ==UserScript== // @icon http://cdn.kesci.com/favicon.ico // @name 科赛个人提交排行 // @namespace [url=mailto:modai_zhan@qq.com]modai_zhan@qq.com[/url] // @version 0.2 // @author modai // @match https://www.kesci.com/home/competition/*/submit // @description 简单的给自己成绩排名 // @require http://code.jquery.com/jquery-latest.js // @run-at document-idle // @downloadURL none // ==/UserScript==ccc (function() { 'use strict'; function show(){ var trlist = document.querySelectorAll('#app-root > div.container.root-router-view.with-sticky-nav > div > div:nth-child(1) > section.tab-content-view.block-bg > div > div.competition-submit-history-section > table>tr'); //alert(trlist.length); var scores= new Array(); scores[0]=-1; //添加”排名“ // trlist[0].querySelector('th:nth-child(6)').innerText='排名'; for(var i=1;i div > div').innerText; try{ scores[i] = eval(score);} catch(err){ scores[i] = -1; } } var raw_scores = $.extend(true,[],scores); var up_down = scores.sort().reverse(); var colors = ['#006400','#228B22','rgb(80, 202, 32)','#98FB98']; for(var j = 0;j<4;j++){ var index = raw_scores.indexOf(up_down[j]); // var index = j; //trlist[index].css('color','white'); trlist[index].style.backgroundColor = colors[j]; trlist[index].style.color ='white'; trlist[index].querySelector('td:nth-child(6)').innerText = j+1; } } setTimeout(show,2000); })();