某神奇的cf跳转插件

// ==UserScript==
// @name         Codeforces快速跳转菜单
// @namespace    http://tampermonkey.net/
// @version      0.1
// @author       You
// @match        https://codeforc.es/problemset/problem/*/*
// @match        https://codeforces.com/problemset/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=ContID[ContID.length-1];
    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+"/";
    var content='';
    content+='<a href="'+src+'contest/'+ContID+'/standings/friends/true">Contest standings(friends only)</a>'+'<br/>';
    content+='<a href="'+src+'contest/'+ContID+'">Contest '+ContID+'</a>'+'<br/>';
    content+='<a href="'+src+'problemset/status?friends=on">Friends status</a>'+'<br/>';
    content+='<a href="'+src+'contest/'+ContID+'/status/'+ProbID+'">Problem status</a>'+'<br/>';
    console.log(content);
    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);
})();

猜你喜欢

转载自www.cnblogs.com/xzz_233/p/11783168.html