Skip to content

Commit

Permalink
Merge pull request #34 from CodeforcesContestHelper/dev
Browse files Browse the repository at this point in the history
Add origin display for problem & Improve "ranks" function
  • Loading branch information
tiger2005 authored Nov 15, 2021
2 parents 62c6716 + dad3225 commit 21c66e2
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 4 deletions.
5 changes: 5 additions & 0 deletions css/problem/client.css
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,11 @@ body{
.problemTitle{
font-size: 24px;
text-align: center;
margin-bottom: 5px;
}
.problemOrigin{
font-size: 13px;
text-align: center;
margin-bottom: 10px;
}
.problemTags{
Expand Down
4 changes: 4 additions & 0 deletions js/authorize.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,10 @@ function submitSolution(ci, idx, code, lang, S, E){
E('errorLoginFailed', languageOption.error.errorLoginFailed);
return;
}
if(d.indexOf("You have submitted exactly the same code before") != -1){
E('errorSameCode', languageOption.error.errorSameCode);
return;
}
if(d.indexOf("submitted successfully") == -1){
E('errorSubmitFailed', languageOption.error.errorSubmitFailed);
return;
Expand Down
20 changes: 19 additions & 1 deletion js/locale.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ var lang_en = {
multiApiError: "API Key Required!",
multiNoUsers: "Empty List",
multiUser: "User",
origin: "Origin",
},
input: {
singleContestantUsername: "Username",
Expand Down Expand Up @@ -142,6 +143,7 @@ var lang_en = {
errorLoadFailed: "<span class='fas fa-exclamation-triangle red'></span> Load Failed",
errorCsrfLoadFailed: "<span class='fas fa-exclamation-triangle red'></span> 'csrf_token' Load Failed",
errorSubmitFailed: "Submit Failed",
errorSameCode: "Same Code Sent Before",
errorRegisterFailed: "Register contest failed!",
},
tip: {
Expand Down Expand Up @@ -294,6 +296,13 @@ var lang_en = {
SKIPPED: "Skipped",
TESTING: "Testing",
REJECTED: "Rejected",
},
phase: {
BEFORE: "Before start",
CODING: "Running",
PENDING_SYSTEM_TEST: "Pending ST",
SYSTEM_TEST: "System testing",
FINISHED: "Finished"
}
};
var lang_zh = {
Expand Down Expand Up @@ -409,6 +418,7 @@ var lang_zh = {
multiApiError: "API Key 未配置!",
multiNoUsers: "列表为空",
multiUser: "用户",
origin: "来源",
},
input: {
singleContestantUsername: "用户名",
Expand Down Expand Up @@ -443,7 +453,8 @@ var lang_zh = {
errorCsrfLoadFailed: "<span class='fas fa-exclamation-triangle red'></span> 'csrf_token' 加载失败",
sendAnswer: "提交答案",
errorSubmitFailed: "提交失败",
errorRegisterFailed: "报名比赛失败!"
errorSameCode: "代码重复",
errorRegisterFailed: "报名比赛失败!",
},
tip: {
tipInitializing: "初始化中...",
Expand Down Expand Up @@ -616,6 +627,13 @@ var lang_zh = {
SKIPPED: "Skipped",
TESTING: "Testing",
REJECTED: "Rejected",
},
phase: {
BEFORE: "未开始",
CODING: "进行中",
PENDING_SYSTEM_TEST: "等待系统评测",
SYSTEM_TEST: "系统评测中",
FINISHED: "已结束"
}
};
var lang_list = ["English", "简体中文"];
Expand Down
8 changes: 5 additions & 3 deletions js/multi.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ function multiRenderList(data){
return getTimeLength(len * 1000);
return '#';
}
flushMultiStatusBar(localize("ok"), false);
flushMultiStatusBar(localize("ok") + " | " + `<span info="${data.contest.phase}">${languageOption.phase[data.contest.phase]}</span>`, false);
$(".multiMask").css("display", "none");
$(".multiInfoTable").css("display", "table");
var hd = $(".multiInfoThead");
Expand All @@ -150,7 +150,7 @@ function multiRenderList(data){
else
p += `<th style='width: 2em'>=</th><th style='width: 5em'>*</th>`;
for(var i=0; i<data.problems.length; i++)
p += `<th style='width: 4em'>${data.problems[i].index}${data.contest.type == "CF" ? `<span class='multiSmall'>${data.problems[i].points}</span>` : ""}`
p += `<th style='width: 4em'><span onclick="openProblemWin(['${data.contest.id}${data.problems[i].index}'])" style="text-decoration: underline; cursor: pointer">${data.problems[i].index}</span>${data.contest.type == "CF" ? `<span class='multiSmall'>${data.problems[i].points}</span>` : ""}`
hd.append("<tr>" + p + "</th>");
var bd = $(".multiInfoTbody");
bd.html("");
Expand Down Expand Up @@ -258,8 +258,10 @@ function multiRenderList(data){
// toDetailedInfo
if(curr.verdict == "OK")
vid = `<span class="green" style="font-weight: bold">${toDetailedInfo(curr.verdict, curr.testset)}</span>`
else if(curr.verdict == "PARTIAL")
else if(curr.verdict == "PARTIAL" || curr.verdict == "COMPILATION_ERROR" || curr.verdict == "SKIPPED" || curr.verdict == "REJECTED")
vid = `<span class="red">${toDetailedInfo(curr.verdict, curr.testset)}</span>`
else if(curr.verdict == "CHALLENGED")
vid = `<span class="red" style="font-weight: bold">${toDetailedInfo(curr.verdict, curr.testset)}</span>`
else
vid = `<span class="red">${toDetailedInfo(curr.verdict, curr.testset)} on test ${curr.passedTestCount + 1}</span>`
vid = $(vid);
Expand Down
1 change: 1 addition & 0 deletions js/problem.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ function initProblemPageInfo(page, data, id){
page.html("");
page.append(`<div class="problemTitle">${data.find(".title").html()}</div>`);
problemCurrentPageList[id][4].title = data.find(".title").html();
page.append(`<div class="problemOrigin">${localize("origin")}${problemCurrentPageList[id][4].contestName}</div>`)
var tg = $(`<div class="problemTags"></div>`);
if(data.find(".time-limit").length != 0)
tg.append(`<div class='problemTag primaryColor'><i class='fas fa-clock'></i>${getRealTimeLimit(data.find(".time-limit").contents().eq(1).text())}</div>`),
Expand Down
8 changes: 8 additions & 0 deletions js/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,14 @@ function initLanguage(){
})
else $(`[info=${name}]`).html(languageOption.error[name]);
}
for(var name in languageOption.phase)
if(languageOption.phase.hasOwnProperty(name)){
if(languageOption.phase[name].format(["", "", ""]) != languageOption.phase[name] && $(`[info=${name}]`).attr("argv") != undefined)
$(`[info=${name}]`).each(function(){
$(this).html(languageOption.phase[name].format(JSON.parse($(this).attr("argv"))));
})
else $(`[info=${name}]`).html(languageOption.phase[name]);
}
for(var name in languageOption.input)
if(languageOption.input.hasOwnProperty(name))
$(`[info=${name}]`).attr("placeholder", languageOption.input[name]);
Expand Down

0 comments on commit 21c66e2

Please sign in to comment.