Vjudge Code

加一些代码,让vjudge简洁

Stylus

@-moz-document url-prefix("https://cn.vjudge.net/"), url-prefix("https://vjudge.net/") {
dd {
    font-family: "Noto Serif", "Noto Serif CJK SC Medium", serif;
    background-color: rgba(255, 255, 255, 0.5) !important;
    box-shadow: none;
}

dd pre {
    font-family: "DejaVu Sans Mono", serif;
}
.fa-refresh.fa-spin {
    -webkit-animation: fa-spin 1s infinite;
    animation: fa-spin 1s infinite;
}
.fa-spin, .fa-pulse {
    animation: none;
}
.fa-2x, .fa-3x, .fa-4x, .fa-5x {
    font-size: 1em !important;
}
#problem_discuss {
    display: none;
}
.navbar{
    z-index: 999;
     100%;
    top: 0;
    box-shadow: 0 2px 10px 0 rgba(34,36,38,.15);
    border-radius: 0!important;
    background-color: white !important;
    padding: 0 2rem;
}
.navbar-brand{
    color: blue!important;
    margin: 0!important;
}
.nav-item {
    margin: 0!important;
}
.nav-item>a, .navbar-brand{
    color: black!important;
    padding: 1em 1em !important;
    font-size: 1rem;
}
.nav-item.active {
    background-color: rgba(0,0,0,0.05);
}
.nav-item:hover,.nav-item:hover>input{
    background-color: #f5f5f5;
}
.dropdown-menu {
    border-radius: 0;
    margin: 0;
}
.navbar-brand>img {
    position: absolute;
    left: 1em;
}
body {
    background: none;
}
#code-content, code.hljs {
    background: none!important;
    border: 1px black dotted!important;
}
.hljs, .hljs-section, .hljs-title {
    color:black;
}
}

 TamperMonkey

// ==UserScript==
// @name         vjudge jumper
// @namespace    none
// @version      0.1
// @description  jump
// @author       sahdsg
// @match        https://cn.vjudge.net/*
// @match        https://vjudge.net/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    function funcs() {
        var k =$("input.nav-item").val();
        if(k.indexOf("!")==0) {
            window.location.href='/problem#OJId=All&probNum=&title='+k.slice(1)+'&source=&category=all';
        } else {
            k = k.toLowerCase();
            var t={
                "HYSBZ":["bzoj","hysbz"],
                "CodeForces":["cf", "codeforces"],
                "Gym":["gym"],
                "51Nod":["51nod"],
                "ZOJ":["zoj"],
                "HDU":["hdu"],
                "UVALive":["uvalive", "la"],
                "UVA":["uva"],
                "51Nod":["51nod"],
                "HIT":["hit"],
                "SPOJ":["spoj"],
                "POJ":["poj"]
            };
            for(var o in t) {
                for(var z in t[o]) {
                    var prefix = t[o][z];
                    if(k.indexOf(prefix)==0) {
                        window.location.href='/problem/'+o+'-'+k.slice(prefix.length).replace(/-/g,"").toUpperCase();
                        return;
                    }
                }
            }
            alert("unknown");
        }
    }
    $(".nav.navbar-nav").append('<li class="nav-item" style="padding: .25em 1em !important;"><input class="nav-item" style="border: none;height: 3em;"></li>');
    if(window.location.href.indexOf("UVA-")>0) {
        var k=window.location.href.substr(window.location.href.indexOf("UVA-")+4);

        $("#prob-operation>.container").append('<div class="row"><div class="col-xs-12"><a href="https://uva.onlinejudge.org/external/'+k.slice(0,-2)+'/'+k+'.pdf" target="_blank" class="btn btn-secondary">PDF</a></div></div>');



    }
    $("input.nav-item").keypress(function (e) {if (e.which == 13) {funcs()}});
})();
// ==UserScript==
// @name         vjudge Timer
// @namespace    none
// @version      1.0
// @description  vjudge计时器
// @author       sahdsg
// @match        https://cn.vjudge.net/problem/*
// @match        https://vjudge.net/problem/*
// @grant        none
// ==/UserScript==

(function(){
var odate = new Date();
var timeron = true;

function getTime() {
    var date = new Date()-odate;
    var second = Math.floor(date/1000)%60;
    if(second<10) {
        second="0"+second;
    }
    var minute = Math.floor(date/60000)%60;
    if(minute<10) {
        minute="0"+minute;
    }
    var hour = Math.floor(date/3600000)%60;
    if(hour<10) {
        hour="0"+hour;
    }
    var str=hour+':'+minute+':'+second;
    var mtimer = document.getElementById("timerid");
    mtimer.innerHTML=str;
}


function changeTimer() {
    if(timeron) {
        getTime();
        clearInterval(terval);
        timeron = false;
        $("#timerop").html("continue");
        $("#problem_discuss").slideDown();
    } else {
        getTime();
        terval = setInterval(getTime,1000);
        timeron=true;
        $("#timerop").html("pause");
        $("#problem_discuss").slideUp();
    }
}
function resetTimer() {
    odate = new Date();var mtimer = document.getElementById("timerid");mtimer.innerHTML='00:00:00';
}
$("#prob-left-panel").prepend('<div class="alert row alert-danger"><table width="100%"><tbody><tr><td>Time used:</td><td style="text-align: right" width="50%" id="timerid">00:00:00</td></tr><tr><td><button class="btn-danger" id="timereset">reset</button></td><td style="text-align: right"><button class="btn-danger" id="timerop">pause</button></td></tr></tbody></table></div>');
$("#timerop").click(function(){changeTimer();});$("#timereset").click(function(){resetTimer();});
var terval = setInterval(getTime,1000);
$("#problem_discuss").hide();
timeron=true;
})();
原文地址:https://www.cnblogs.com/sahdsg/p/10659806.html