某神奇的cf跳转插件

鬼知道这东西竟然更新了。。。

2020.1.27 增加gym支持,顺便删了codeforc.es

2020.1.30 上次改锅了。。。修锅

2020.3.20 又修了个锅

// ==UserScript==
// @name         Codeforces快速跳转菜单
// @namespace    http://tampermonkey.net/
// @version      2020.1.30
// @author       xzz
// @match        https://codeforces.com/problemset/problem/*/*
// @match        https://codeforces.com/contest/*/problem/*
// @match        https://codeforces.com/gym/*/problem/*
// @match        https://codeforces.ml/problemset/problem/*/*
// @match        https://codeforces.ml/contest/*/problem/*
// @match        https://codeforces.ml/gym/*/problem/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    document.contenthide=function(){
        if(document.getElementById("content").style.display=='none')document.getElementById("content").style.display='';
        else document.getElementById("content").style.display='none';
    }
    var ContID=window.location.pathname;
    var ProbID="";for(var i=ContID.length-1;ContID[i]!='/';--i)ProbID=ContID[i]+ProbID;
    var p=0;while(isNaN(ContID[p]))++p;
    var q=p;while(!isNaN(ContID[q]))++q;
    ContID=ContID.substring(p,q).toString();
    var src="https://"+window.location.host;
    if(window.location.pathname[1]!='g')src+="/contest/";
    else src+="/gym/";
    var content='';
    content+='<a href="'+src+ContID+'/standings/friends/true">Contest standings(friends only)</a>'+'<br/>';
    content+='<a href="'+src+ContID+'">Contest '+ContID+'</a>'+'<br/>';
    content+='<a href="'+src+'problemset/status?friends=on">Friends status</a>'+'<br/>';
    content+='<a href="'+src+ContID+'/status/'+ProbID+'">Problem status</a>'+'<br/>';
    content='<div id="content" style="background: white;padding:10px;">'+content+'</div>';// 目录的div
    content='<div style="width:330px;position: fixed;bottom: 0;height: min-content;right: 0;margin: 30px;padding: 10px;text-align:left;z-index:2147483647">'+content+'<button style="position: fixed" onclick="document.contenthide();">Show/Hide</button></div>'
    $("body").prepend(content);
})();
posted @ 2019-11-02 17:18  菜狗xzz  阅读(507)  评论(0编辑  收藏  举报