// ==UserScript== // @name Fast-Codeforces-dev // @namespace xcxxcx // @version 0.3.1 // @match *://codeforces.com/* // @match *://codeforc.es/* // @match *://codeforces.ml/* // @description 使您更方便地使用Codeforces // @require https://code.jquery.com/jquery-3.4.1.min.js // @author xcxxcx // @downloadURL none // ==/UserScript== let $=window.$,math=unsafeWindow.MathJax; String.prototype.strfrl=function(c){ if(this.indexOf(c)===-1)return this; return this.substr(0,this.indexOf(c)); }; String.prototype.strfrr=function(c){ if(this.indexOf(c)===-1)return this; return this.substr(this.indexOf(c)+c.length); }; function gets(dir){ if(("fc-"+dir)in localStorage===false||localStorage["fc-"+dir]==="undefined")return void 0; return JSON.parse(localStorage["fc-"+dir]); } function puts(dir,val){ if(val!==void 0)localStorage["fc-"+dir]=JSON.stringify(val); else localStorage["fc-"+dir]="undefined"; } let user=$(".lang-chooser>div:eq(1)>a:eq(0)").html(),user_csrf=$("[name=X-Csrf-Token]").attr("content"),tcount=[],tsum=0; function Ajax(url,data={},type="GET"){ let tmp=++tsum; $.ajax({type:type,url:url,data:data,success:function(e){tcount[tmp]=e;},error:function(e){tcount[tmp]="Err";}}); return tmp; } function Get(url){ return $.ajax({async:false,type:"GET",url:url,data:{},success:function(e){return e;},error:function(e){return e;}}).responseText; } function show_pre(){$("#pageContent,#pre-bar").show();} function hide_pre(){$("#pageContent,#pre-bar").hide();} let menu; function default_set(){for(let i in localStorage)if(i.substr(0,3)==="fc-"&&i!=="fc-using"&&i!=="fc-version")delete localStorage[i];} function add_menu(ele){ $("#fc-setting-menu-add").append(`
  • `+eles[ele].name+`
  • `); $("#fc-setting-menu-"+ele).click(function(){let ID=this.id.substr(16);$(this).parent().remove();menu.splice(menu.indexOf(ID),1);sub_menu(ID);}); } function sub_menu(ele){ $("#fc-setting-menu-sub").append(`
  • `+eles[ele].name+`
  • `); $("#fc-setting-menu-"+ele).click(function(){let ID=this.id.substr(16);$(this).parent().remove();menu.push(ID);add_menu(ID);}); } function set_menu(){ menu=list.slice(); $("#fc-setting-default").before($(`
    目录设置

    当前目录
    剩余目录

    `)); for(let i=0;i