Fast-Codeforces

使您更方便地使用Codeforces

当前为 2020-01-06 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Fast-Codeforces
  3. // @namespace xcxxcx
  4. // @version 0.3.2
  5. // @match *://codeforces.com/*
  6. // @match *://codeforc.es/*
  7. // @match *://codeforces.ml/*
  8. // @description 使您更方便地使用Codeforces
  9. // @require https://code.jquery.com/jquery-3.4.1.min.js
  10. // @author xcxxcx
  11. // ==/UserScript==
  12. let $=window.$,math=unsafeWindow.MathJax.Hub;
  13. String.prototype.frl=function(c){
  14. if(this.indexOf(c)===-1)return this;
  15. return this.substr(0,this.indexOf(c));
  16. };
  17. String.prototype.frr=function(c){
  18. if(this.indexOf(c)===-1)return this;
  19. return this.substr(this.indexOf(c)+c.length);
  20. };
  21. function gets(dir){
  22. if(("fc-"+dir)in localStorage===false||localStorage["fc-"+dir]==="undefined")return void 0;
  23. return JSON.parse(localStorage["fc-"+dir]);
  24. }
  25. function puts(dir,val){
  26. if(val!==void 0)localStorage["fc-"+dir]=JSON.stringify(val);
  27. else localStorage["fc-"+dir]="undefined";
  28. }
  29. let user=$(".lang-chooser>div:eq(1)>a:eq(0)").html(),user_csrf=$("[name=X-Csrf-Token]").attr("content"),tcount=[],tsum=0;
  30. function Ajax(url,data={},type="GET"){
  31. let tmp=++tsum;
  32. $.ajax({type:type,url:url,data:data,success:function(e){tcount[tmp]=e;},error:function(e){tcount[tmp]="Err";}});
  33. return tmp;
  34. }
  35. function Get(url){
  36. return $.ajax({async:false,type:"GET",url:url,data:{},success:function(e){return e;},error:function(e){return e;}}).responseText;
  37. }
  38. function show_pre(){$("#pageContent,#pre-bar").show();}
  39. function hide_pre(){$("#pageContent,#pre-bar").hide();}
  40.  
  41. let menu;
  42. function default_set(){for(let i in localStorage)if(i.substr(0,3)==="fc-"&&i!=="fc-using"&&i!=="fc-version")delete localStorage[i];}
  43. function add_menu(ele){
  44. $("#fc-setting-menu-add").append(`<li><a id="fc-setting-menu-`+ele+`">`+eles[ele].name+`</a></li>`);
  45. $("#fc-setting-menu-"+ele).click(function(){let ID=this.id.substr(16);$(this).parent().remove();menu.splice(menu.indexOf(ID),1);sub_menu(ID);});
  46. }
  47. function sub_menu(ele){
  48. $("#fc-setting-menu-sub").append(`<li><a id="fc-setting-menu-`+ele+`">`+eles[ele].name+`</a></li>`);
  49. $("#fc-setting-menu-"+ele).click(function(){let ID=this.id.substr(16);$(this).parent().remove();menu.push(ID);add_menu(ID);});
  50. }
  51. function set_menu(){
  52. menu=list.slice();
  53. $("#fc-setting-default").before($(`<div><div class="section-title">目录设置<span class="fc-care">*</span></div><br/><h6>当前目录</h6>
  54. <ul id="fc-setting-menu-add"></ul><h6>剩余目录</h6><ul id="fc-setting-menu-sub"></ul><button id="fc-setting-menu-end">修改</button><hr/></div>`));
  55. for(let i=0;i<len;++i)add_menu(list[i]);
  56. for(let i in eles)if(list.indexOf(i)===-1)sub_menu(i);
  57. $("#fc-setting-menu-end").click(function(){Clear();puts("list",menu);showMain();alert("修改成功");});
  58. }
  59. function show_set(){$("#fc-setting").show();$("#fc-menu-setting").css("background-color","#AAAAAA");}
  60. function hide_set(){$("#fc-setting").hide();$("#fc-menu-setting").css("background-color","white");}
  61. function init_set(){
  62. $("#pageContent").after($(`<div id="fc-setting" class="fc-main problem-statement" style="display:none">
  63. <div class="header"><div class="title">设置</div><div>带有<span class="fc-care">*</span>的选项在修改后,需要重新加载才能生效。</div>
  64. </div><button type="button" class="fc-care" id="fc-setting-default">恢复默认设置</button></div>`));
  65. for(let i=0;i<len;++i)eles[list[i]].set();
  66. $("#fc-setting-default").click(function(){
  67. if(confirm("您确定要恢复默认设置?请先保存好您的文件")===false)return;
  68. Clear();default_set();showMain();alert("恢复默认设置成功");
  69. });
  70. }
  71. function remove_set(){$("#fc-setting").remove();}
  72.  
  73. let sta_default={auto_open:true,interval:10000},sta_user,sta_t=0,sta_now;
  74. function get_sta(user,page=1,show=true){
  75. let tmp={csrf_token:user_csrf,action:"toggleShowUnofficial"},load=$("#fc-status-load"),loadstr="";
  76. clearInterval(sta_t);load.html("");
  77. if(sta_now.user!==user||sta_now.page!==page||sta_now.show!==show)return;
  78. if(show)tmp.showUnofficial="on";tmp=Ajax("/submissions/"+user+"/page/"+page,tmp,"POST");
  79. sta_t=setInterval(function(){
  80. loadstr=loadstr.length===2?"":loadstr+".";$("#fc-status-load").html("Loading"+loadstr);
  81. if(tcount[tmp]===void 0)return;
  82. clearInterval(sta_t);load.html("");
  83. if(tcount[tmp]===void 0){alert("出错了");return;}
  84. let val=$(tcount[tmp]),tpage=val.find(".active").attr("pageindex");
  85. if(val.find(".second-level-menu-list a:eq(0)").html().toLowerCase()!==user.toLowerCase()){alert("该用户不存在");return;}
  86. if(tpage!=page&&(tpage!==void 0||page!=1)){alert("该记录不存在");return;}
  87. val=val.find("#pageContent");val.children(":eq(0)").remove();val.children(":eq(0)").remove();val.find(".pagination").remove();
  88. $("#fc-status-main").html(val.html());
  89. if(sta_user.interval>=0)setTimeout(function(){get_sta(user,page,show);},sta_user.interval);
  90. },400);
  91. }
  92. function set_sta(){
  93. $("#fc-setting-default").before(`<div><div class="section-title">提交记录设置</div><br/>
  94. <input type="checkbox" id="fc-setting-status-auto_open"><span>是否自动打开自己的提交记录</span><br/><br/>
  95. 自动刷新间隔(不刷新为-1):<input type="number" min="-1" value="`+sta_user.interval+`" id="fc-setting-status-interval"/>毫秒<br/><br/>
  96. <button type="button" id="fc-setting-status-end">修改</button><hr/></div>`);
  97. if(sta_user.auto_open)$("#fc-setting-status-auto_open").attr("checked","checked");
  98. $("#fc-setting-status-end").click(function(){
  99. let interval=parseInt($("#fc-setting-status-interval").val());
  100. if(typeof interval!=="number"||interval!==interval){alert("自动刷新间隔应为大于等于-1的整数");return;}
  101. if(interval<0)interval=1;$("#fc-setting-status-interval").val(interval);
  102. sta_user={auto_open:$("#fc-setting-status-auto_open:checked").length===1,interval:interval};
  103. puts("sta-user",sta_user);alert("修改成功");
  104. });
  105. }
  106. function show_sta(){$("#fc-status").show();$("#fc-menu-status").css("background-color","#AAAAAA");}
  107. function hide_sta(){$("#fc-status").hide();$("#fc-menu-status").css("background-color","white");}
  108. function init_sta(){
  109. sta_user=gets("sta-user");
  110. if(sta_user===void 0)sta_user={};
  111. for(let i in sta_default)if(!(i in sta_user))sta_user[i]=sta_default[i];
  112. puts("sta-user",sta_user);
  113. $("#pageContent").after($(`<div id="fc-status" class="fc-main" style="display:none"><div id="fc-status-head">
  114. 用户:<input type="text" id="fc-status-user"value="`+user+`"/>&nbsp;&nbsp;&nbsp;页码:<input type="text" id="fc-status-page" value="1"/>&nbsp;&nbsp;&nbsp;
  115. <input type="checkbox" id="fc-status-show"/ checked>show unofficial&nbsp;&nbsp;&nbsp;<button type="button" id="fc-status-see">查看</button>
  116. &nbsp;&nbsp;&nbsp;<button type="button" id="fc-status-stop">停止本次自动刷新</button>
  117. <a id="fc-status-load"></a></div><div id="fc-status-main"></div></div>`));
  118. $("#fc-status-stop").click(function(){sta_now={};clearInterval(sta_t);$("#fc-status-load").html("");});
  119. $("#fc-status-see").click(function(){
  120. sta_now={user:$("#fc-status-user").val(),page:$("#fc-status-page").val(),show:$("#fc-status-show:checked").length===1};
  121. get_sta(sta_now.user,sta_now.page,sta_now.show);
  122. });
  123. if(sta_user.auto_open){sta_now={user:user,page:1,show:true};get_sta(user);}
  124. }
  125. function remove_sta(){$("#fc-status").remove();}
  126.  
  127. let sub_default={auto_open:true},sub_user;
  128. function set_sub(){
  129. $("#fc-setting-default").before(`<div><div class="section-title">提交设置</div><br/>
  130. <span>点击提交时:</span><select name="auto_open" id="fc-setting-submit-auto_open">
  131. <option value="true">若开启了“查看状态”,则进行跳转</option><option value="false">打开“status”窗口</option>
  132. </select><span class="fc-care">*</span><br/><br/><button type="button" id="fc-setting-submit-end">修改</button><hr/></div>`);
  133. $("#fc-setting-submit-auto_open>option:eq("+(sub_user.auto_open===true?0:1)+")").attr("selected","selected");
  134. $("#fc-setting-submit-end").click(function(){
  135. sub_user={auto_open:$("#fc-setting-submit-auto_open>option:selected").val()==="true"};
  136. puts("sub-user",sub_user);
  137. });
  138. }
  139. function show_sub(){$("#fc-submit").show();$("#fc-menu-submit").css("background-color","#AAAAAA");}
  140. function hide_sub(){$("#fc-submit").hide();$("#fc-menu-submit").css("background-color","white");}
  141. function getsub(){
  142. let sub=gets("sub");
  143. if(sub!==void 0){$("#fc-submit-form").html(sub);return;}
  144. sub=$(Get("/problemset/submit")).find(".submit-form");sub.find("tr:nth-child(5)").remove();
  145. sub.find(".submit").attr("id","fc-submit-button");
  146. sub.find(".aceEditorTd").html(`<textarea style="width:600px;height:300px;resize:none" name="source"></textarea><br/>`);
  147. sub=sub.html();puts("sub",sub);$("#fc-submit-form").html(sub);
  148. }
  149. function init_sub(){
  150. sub_user=gets("sub-user");
  151. if(sub_user===void 0)sub_user={};
  152. for(let i in sub_default)if(!(i in sub_user))sub_user[i]=sub_default[i];
  153. puts("sub-user",sub_user);
  154. $("#pageContent").after($(`<div id="fc-submit" class="fc-main" style="display:none">
  155. <div id="fc-submit-form" method="post" action="/problemset/submit?csrf_token=`+user_csrf+`" enctype="multipart/form-data" target="_blank">
  156. </div></div>`));
  157. getsub();
  158. $("#fc-submit-button").click(function(){
  159. $("#fc-submit .fc-care").remove();
  160. if($("#fc-submit [name=submittedProblemCode]").val()===""){
  161. $("#fc-submit .error__submittedProblemIndex").html(`<span class="fc-care">Choose the problem</span>`);return false;}
  162. if($("#fc-submit [name=source]").val()===""){
  163. $("#fc-submit .aceEditorTd").append(`<span class="fc-care">Put you source into the textarea</span>`);return false;}
  164. if(!sub_user.auto_open)return true;
  165. Ajax(`/problemset/submit?csrf_token=`+user_csrf,{
  166. csrf_token:user_csrf,action:"submitSolutionFormSubmitted",submittedProblemCode:$("#fc-submit [name=submittedProblemCode]").val(),
  167. programTypeId:$("#fc-submit [name=programTypeId]>option:selected").val(),source:$("#fc-submit [name=source]").val()},"POST");
  168. Change("status");$("#fc-status-user").val(user);$("#fc-status-page").val(1);$("#fc-status-show").attr("checked","checked");
  169. $("#fc-status-see").click();document.documentElement.scrollTop=0;return false;
  170. });
  171. }
  172. function remove_sub(){$("#fc-submit").remove();}
  173.  
  174. let pro_default={mem:0,auto_open:false},pro_user,prepro,prolist,focpro,promap={};
  175. function set_pro(){
  176. $("#fc-setting-default").before($(`<div><div class="section-title">题目设置</div><br/>
  177. <p><span>上一次未关闭的题目是否打开:</span><select id="fc-setting-problem-memory">
  178. <option value="0">否</option><option value="1">我自己决定是否打开</option><option value="2">自动打开</option>
  179. </select></p><input type="checkbox" id="fc-setting-problem-auto_open"/><span>点击题目链接时在"查看题目"中将其打开<span class="fc-care">*</span></span>
  180. <br/><br/><button type="button" id="fc-setting-problem-end">修改</button><hr/></div>`));
  181. if(pro_user.auto_open)$("#fc-setting-problem-auto_open").attr("checked","checked");
  182. $("#fc-setting-problem-end").click(function(){
  183. pro_user={mem:$("#fc-setting-problem-memory>option:selected").val(),auto_open:$("#fc-setting-problem-auto_open:checked").length===1};
  184. puts("pro-user",pro_user);alert("修改成功");
  185. });
  186. $("#fc-setting-problem-memory>option:eq("+pro_user.mem+")").attr("selected","selected");
  187. }
  188. function showpro(ID){$("#fc-problem-menu-"+ID).addClass("focpro");$("#fc-problem-"+ID+",#fc-bar-problem-"+ID).show();}
  189. function hidepro(ID){$("#fc-problem-menu-"+ID).removeClass("focpro");$("#fc-problem-"+ID+",#fc-bar-problem-"+ID).hide();}
  190. function show_pro(){$("#fc-problem,#fc-bar-problem").show();$("#fc-menu-problem").css("background-color","#AAAAAA");}
  191. function hide_pro(){$("#fc-problem,#fc-bar-problem").hide();$("#fc-menu-problem").css("background-color","white");}
  192. function addpro(x,y){
  193. let tmp=Ajax("/problemset/problem/"+x+"/"+y),load=$(`<li id="fc-problem-memu-add-`+x+y+`"><a></a></li>`),loadstr="";
  194. x+=y;promap[x]=1;$("#fc-problem-menu").append(load);prolist=[];promap={};
  195. let t=setInterval(function(){
  196. loadstr=loadstr.length===2?"":loadstr+".";load.find("a").html("Loading "+x+loadstr);
  197. if(tcount[tmp]===void 0)return;
  198. clearInterval(t);load.remove();
  199. if(tcount[tmp]==="Err"){delete promap[x];alert("出错了!");return;}
  200. let pro=$(tcount[tmp]),len=pro.length,title;
  201. for(let i=0;i<len;++i)if(pro[i].tagName==="TITLE"){title=pro[i].innerHTML;break;}
  202. if(title!=="Problem - "+x+" - Codeforces"&&title!=="Problem - "+x+
  203. " - Codeforces (Unofficial mirror site by GGAutomaton, accelerated for Chinese users)"){delete promap[x];alert("题目"+x+"不存在");return;}
  204. pro=[pro.find(`.problem-statement`),pro.find(`#sidebar`)];tcount[tmp]=void 0;promap[x]=0;
  205. $("#fc-problem-menu-add").before(`<li id="fc-problem-menu-`+x+`"><a>`+x+`</a><a>X</a></li>`);
  206. let node=$("#fc-problem-menu-"+x).children();
  207. $(node[0]).click(function(){if(focpro!==void 0)hidepro(focpro);showpro(this.innerHTML);focpro=this.innerHTML;});
  208. $(node[1]).click(function(){
  209. let fa=$(this).parent(),ID=fa.children()[0].innerHTML,pos=prolist.indexOf(ID);delete promap[prolist[pos]];prolist.splice(pos,1);
  210. if(focpro===ID){
  211. prolist.splice(pos,1);
  212. if(pos===prolist.length)--pos;
  213. if(pos!==-1){focpro=prolist[pos];showpro(focpro);}
  214. else focpro=void 0;
  215. }
  216. fa.remove();$("#fc-problem-"+ID).remove();puts("pro-list",prolist);
  217. });
  218. $("#fc-problem-contain").append(pro[0].attr("id","fc-problem-"+x));$("#fc-bar-problem").append(pro[1].attr("id","fc-bar-problem-"+x));
  219. if(focpro!==void 0)hidepro(focpro);
  220. showpro(x);prolist.push(focpro=x);math.Queue(["Typeset",math,"fc-problem-"+x]);puts("pro-list",prolist);
  221. },400);
  222. }
  223. function newpro(ID){
  224. if(ID===""||ID===null)return;
  225. if(typeof ID!=="string"){alert("请输入正确的题号");return;}
  226. if(promap[ID]===0){alert("该题目已在序列中");return;}
  227. if(promap[ID]===1){alert("该题目已在添加队列中");return;}
  228. let pnum=ID.substr(ID.length-1),pl=parseFloat(ID.substr(0,ID.length-1));
  229. if(parseInt(pl)!==pl){alert("请输入正确的题号");return;}
  230. addpro(pl,pnum);
  231. }
  232. function init_pro(){
  233. pro_user=gets("pro-user");
  234. if(pro_user===void 0)pro_user={};
  235. for(let i in pro_default)if(!(i in pro_user))pro_user[i]=pro_default[i];
  236. puts("pro-user",pro_user);prepro=gets("pro-list");
  237. $("#pageContent").after($(`<div id="fc-problem" class="fc-main" style="display:none"><div class="second-level-menu">
  238. <ul class="second-level-menu-list" id="fc-problem-menu">
  239. <li id="fc-problem-menu-add"><a>+add problem</a></li><li id="fc-problem-menu-close"><a>-hide window</a></li>
  240. </ul></div><div class="problemindexholder">
  241. <a href="javascript:;" id="fc-problem-submit" style="float:right">提交</a><div class="ttypography" id="fc-problem-contain"></div></div></div>`));
  242. $("#fc-problem-submit").click(function(){
  243. Change("submit");$("#fc-submit [name=source]").focus();
  244. if(focpro!==void 0)$("#fc-submit [name=submittedProblemCode]").val(focpro);
  245. });
  246. $("#fc-problem-menu-close").click(function(){Change("problem");});$("#fc-problem-menu-add").click(function(){newpro(prompt());});
  247. $("#fc-problem-menu-add").hover(function(){let x=$("#fc-problem-menu>.backLava");if(x.length>0)x.remove();});
  248. $("#fc-bar-menu").after(`<div id="fc-bar-problem" style="display:none"></div>`);
  249. if(pro_user.mem==2||pro_user.mem==1&&prepro.length>0&&confirm("您上次浏览的题目未关闭,要重新加载吗?"))for(let i=0;i<prepro.length;++i)newpro(prepro[i]);
  250. else puts("pro-list",[]);
  251. if(pro_user.auto_open){$("a").click(function(){
  252. let url=$(this).attr("href");
  253. if(url==null)return true;
  254. let protrol=url.frl("://");url=url.frr("://");let domain=url.frl("/");url=url.frr("/");
  255. if(protrol!==url&&protrol!=="http"&&protrol!=="https")return true;
  256. if(!url.match(/^problemset\/problem\/[1-9][0-9]*\/[A-Z]$/)&&!url.match(/^contest\/[1-9][0-9]*\/problem\/[A-Z]$/))return true;
  257. if(domain!==""&&domain!=="codeforces.com"&&domain!=="codeforc.es"&&domain!=="codeforces.ml")return true;
  258. Change("problem");newpro(url.match(/[1-9][0-9]*/)[0]+"/"+url.match(/[A-Z]/)[0]);return false;
  259. });}
  260. }
  261. function remove_pro(){$("#fc-problem").remove();$("#fc-bar-problem").remove();}
  262.  
  263. let eles={
  264. "problem":{name:"查看题目",init:init_pro,remove:remove_pro,hide:hide_pro,show:show_pro,set:set_pro,js:[],css:["sidebar-menu","status"]},
  265. "submit":{name:"提交代码",init:init_sub,remove:remove_sub,hide:hide_sub,show:show_sub,set:set_sub,js:[],css:[]},
  266. "status":{name:"查看状态",init:init_sta,remove:remove_sta,hide:hide_sta,show:show_sta,set:set_sta,js:["facebox"],css:["status","facebox"]},
  267. "setting":{name:"设置",init:init_set,remove:remove_set,hide:hide_set,show:show_set,set:set_menu,js:[],css:[]},
  268. },list,len,ele="pre",css_ready=[],js_ready=[],day;
  269. function Change(ID){
  270. if(ele===ID){eles[ID].hide();show_pre();ele="pre";}
  271. else if(ele==="pre"){hide_pre();eles[ID].show();ele=ID;}
  272. else{eles[ele].hide();eles[ID].show();ele=ID;}
  273. }
  274. function CreateEle(id){
  275. let obj=eles[id],js=obj.js,css=obj.css;obj.init();
  276. for(let i=0;i<js.length;++i){if(js_ready.indexOf(js[i])==-1){
  277. $("head").append($(`<script src="//sta.codeforces.com/s/`+day+`/js/`+js[i]+`.js"></script>`));js_ready.push(js[i]);
  278. }}
  279. for(let i=0;i<css.length;++i){if(css_ready.indexOf(css[i])==-1){
  280. $("head").append($(`<link rel="stylesheet" href="//sta.codeforces.com/s/`+day+`/css/`+css[i]+`.css"/>`));css_ready.push(css[i]);
  281. }}
  282. $("#fc-stop").before($(`<a style="border-radius:3px">&nbsp;&nbsp;<span id="fc-menu-`+id+`">`+obj.name+`</span>
  283. <span style="float:right">&#8635;</span></a><br/>`));
  284. $("#fc-menu-"+id).click(function(){Change(this.id.substr(8));});
  285. $("#fc-menu-"+id).siblings().click(function(){
  286. if(ele===id)Change(id);
  287. obj.remove();obj.init();alert("加载成功!");
  288. });
  289. }
  290. function Clear(id){
  291. if(ele!=="pre")Change(ele);
  292. for(let i=0;i<len;++i)eles[list[i]].remove();
  293. }
  294. function showLogin(){
  295. Clear();
  296. $("#fc-menu").html(`<a href="javascript:;" id="fc-start">开始使用Fast Codeforces</a>`);
  297. $("#fc-start").click(function(){
  298. if(confirm("Fast Codeforces需要使用您的CSRF-token,您确定要授权吗?")===false)return;
  299. puts("using",true);alert("授权成功");showMain();
  300. });
  301. }
  302. function showMain(){
  303. list=gets("list");
  304. if(list===void 0)list=["problem","submit","status","setting"];
  305. if(list.indexOf("setting")===-1)list.push("setting");
  306. puts("list",list);len=list.length;ele="pre";$("#fc-menu").html(`<a href="javascript:;" id="fc-stop">停止使用Fast Codeforces</a>`);
  307. $("#fc-stop").click(function(){
  308. if(confirm("您确认要停止使用Fast Codeforces?")===false)return;
  309. puts("using",false);alert("Fast Codeforces已停止");showLogin();
  310. });
  311. for(let i=0;i<len;++i)if(list[i]!=="setting")CreateEle(list[i]);
  312. if(list.indexOf("setting"))CreateEle("setting");
  313. }
  314.  
  315. $(document).ready(function(){
  316. if($("#sidebar").length===0)return;
  317. let sidebar=$("#sidebar").html();
  318. $("#sidebar").html(`<div id="fc-bar">
  319. <style>
  320. .fc-main{margin-right:22em !important;margin:1em;padding-top:1em;min-height:20em;}#fc-menu>a>span{cursor:pointer}
  321. .focpro{background-color:grey;}#fc-problem-menu>li{border-radius:12px;}.fc-care{color:red}
  322. </style>
  323. <div class="roundbox sidebox" id="fc-bar-menu">
  324. <div class="roundbox-lt">&nbsp;</div><div class="roundbox-rt">&nbsp;</div>
  325. <div class="caption titled">&rarr; Fast Codeforces<div class="top-links"><a href="https://github.com/xcx-xcx/fast-codeforces">帮助</a></div></div>
  326. <div style="padding:0.5em">
  327. <div id="fc-menu" style="text-align:center;border-bottom:1px solid rgb(185,185,185);margin:0 -0.5em 0.5em -0.5em;padding:0 1em 0.5em 1em"></div>
  328. </div></div></div><div id="pre-bar">`+sidebar+`</div>`);
  329. let js=$("script"),css=$("link"),tmp;
  330. for(let i=0;i<js.length;++i){
  331. tmp=$(js[i]).attr("src");
  332. if(tmp!==void 0&&tmp.match(/\/\/sta.codeforces.com\/s\/[0-9]{5}\/js\//))js_ready.push(tmp.substr(0,tmp.length-3).substr(32));
  333. }
  334. for(let i=0;i<css.length;++i){
  335. tmp=$(css[i]).attr("href");
  336. if(tmp.match(/\/\/sta.codeforces.com\/s\/[0-9]{5}\/css\//)){day=tmp.substr(23,5);css_ready.push(tmp.substr(0,tmp.length-4).substr(33));}
  337. }
  338. if($(".header-bell").length===0)$("#fc-menu").html(`<span>请登录(不可用)后再使用!</span>`);
  339. else if(gets("using"))showMain();
  340. else showLogin();
  341. });
  342. let version="0.3.2";
  343. if(gets("version")!==version){setTimeout(function(){alert("Fast Codeforces的版本已经更新了,赶快去设置看看呗");},100);puts("version",version);}

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址