您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Greasy Fork is available in English.
简单的给自己成绩排名
// ==UserScript== // @icon http://cdn.kesci.com/favicon.ico // @name 科赛kesci个人提交排行 // @namespace [url=mailto:[email protected]][email protected][/url] // @version 0.3 // @author modai // @match https://www.kesci.com/home/competition/*/submit // @description 简单的给自己成绩排名 // @require http://code.jquery.com/jquery-latest.js // @run-at document-idle // ==/UserScript==cc (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<trlist.length;i++){ var score = trlist[i].querySelector('td:nth-child(5) > 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); })();