diff --git a/js/authorize.js b/js/authorize.js
index ee1cea2..272186a 100644
--- a/js/authorize.js
+++ b/js/authorize.js
@@ -347,6 +347,64 @@ function registerContest(ci, S, E){
});
}
+function registerVirtualRound(ci, tm, S, E){
+ var months = [
+ "January", "February", "March", "April", "May", "June",
+ "July", "August", "September", "October", "November", "December"
+ ];
+ var offsetTime = new Date(tm.getTime() + tm.getTimezoneOffset() * 60 * 1000);
+ $.ajax({
+ url: settings.mainURL,
+ success: function(data){
+ var csrf = queryCsrf.exec(data);
+ if(csrf == null){
+ E("fa-unlink");
+ return;
+ }
+ csrf = csrf[1];
+ $.ajax({
+ url: settings.mainURL + '/contestRegistration/' + ci + '/virtual/true',
+ type: "POST",
+ data: {
+ csrf_token: csrf,
+ action: "formSubmitted",
+ ftaa: getFtaa(),
+ bfaa: "f1b3f18c715565b589b7823cda7448ce",
+ _tta: 292,
+ virtual: "true",
+ backUrl: "",
+ takePartAs: "personal",
+ initialDatetime: `${months[offsetTime.getMonth()].substring(0, 3)}/${offsetTime.getDate()}/${offsetTime.getFullYear()} ${offsetTime.pattern("hh:mm")}`,
+ clientTimezoneOffset: (- tm.getTimezoneOffset()),
+ startDay: `${months[tm.getMonth()].substring(0, 3)}/${tm.getDate()}/${tm.getFullYear()}`,
+ startTime: tm.pattern("hh:mm"),
+ teamId: -1,
+ requiredConfirmation: "true"
+ },
+ success: function(d){
+ var q = $(d).find(".lang-chooser > div").eq(1);
+ if(q.children("a").eq(1).html() == "Register"){
+ currentLoginHandle = "";
+ getSolvedProblemsByContest = {problemCountsByContestId: {}, solvedProblemCountsByContestId: {}};
+ E("fa-unlink");
+ return;
+ }
+ if(d.indexOf("You have been successfully registered") == -1){
+ E("fa-exclamation-triangle"); return;
+ }
+ S();
+ },
+ error: function(){
+ E("fa-unlink");
+ }
+ })
+ },
+ error: function(){
+ E("fa-unlink");
+ }
+ });
+}
+
function generateAuthorizeURL(url, data){
function parseObject(x){
var ret = [];
diff --git a/js/contest.js b/js/contest.js
index c8717b5..f2fc8a0 100644
--- a/js/contest.js
+++ b/js/contest.js
@@ -88,6 +88,66 @@ function contestListSort(useTime, incIf){
contestListSortResult.sort(compareFunc);
}
+$(".contestInsertTimeInputArea > input").bind('keydown', function(event){
+ if(event.keyCode == "13")
+ $(".contestInsertTimeInputArea > button").click();
+})
+function contestStartVirtualIf(x){
+ $(".contestInsertTimeWindow").css("display", "grid");
+ setTimeout(function(){
+ $(".contestInsertTimeWindow").css("opacity", 1);
+ }, 50);
+ $(".contestInsertTimeInputArea > input").val("");
+ $(".contestInsertTimeInputArea > button").unbind("click").click(function(){
+ if(!$(this).find("i").hasClass("fa-paper-plane"))
+ return;
+ var q1 = $(".contestInsertTimeInputArea > input").val();
+ q1 = queryTime.exec(q1);
+ if(q1 == null){
+ $(".contestInsertTimeInputArea > button").html(`
`);
+ $(".contestInsertTimeInputArea > button").removeClass("primaryColor").addClass("dangerColor").attr("disabled", true);
+ setTimeout(function(){
+ $(".contestInsertTimeInputArea > button").html(`
`);
+ $(".contestInsertTimeInputArea > button").addClass("primaryColor").removeClass("dangerColor").attr("disabled", false);
+ }, 1000);
+ return;
+ }
+ var q = [parseInt(q1[1], 10), parseInt(q1[2], 10), parseInt(q1[3], 10), parseInt(q1[4], 10), parseInt(q1[5], 10)];
+ var d = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
+ if(isLoopYear(q[0])) ++d[2];
+ var flg = true;
+ if(q[1] < 1 || q[1] > 12 || d[q[1]] < q[2] || q[2] < 1)
+ flg = false;
+ if(q[3] == 24 && q[4] != 0) flg = false;
+ if(q[3] != 24 && (q[3] < 0 || q[4] < 0 || q[4] >= 60)) flg = false;
+ if(!flg){
+ $(".contestInsertTimeInputArea > button").html(`
`);
+ $(".contestInsertTimeInputArea > button").removeClass("primaryColor").addClass("dangerColor").attr("disabled", true);
+ setTimeout(function(){
+ $(".contestInsertTimeInputArea > button").html(`
`);
+ $(".contestInsertTimeInputArea > button").addClass("primaryColor").removeClass("dangerColor").attr("disabled", false);
+ }, 1000);
+ return;
+ }
+ $(".contestInsertTimeInputArea > button").html(`
`);
+ $(".contestInsertTimeInputArea > button").attr("disabled", true);
+ registerVirtualRound(x, new Date(q[0], q[1]-1, q[2], q[3], q[4]), function(){
+ $(".closeContestInsertTime").click();
+ $("[for=singleContent]").click();
+ loadSingleInformation(true, currentLoginHandle, x, new Date(q[0], q[1]-1, q[2], q[3], q[4]), (new Date(q[0], q[1]-1, q[2], q[3], q[4])).getTime() <= (new Date()).getTime());
+ $(".contestInsertTimeInputArea > button").html(`
`);
+ $(".contestInsertTimeInputArea > button").attr("disabled", false);
+ }, function(x){
+ $(".contestInsertTimeInputArea > button").html(`
`);
+ $(".contestInsertTimeInputArea > button").removeClass("primaryColor").addClass("dangerColor").attr("disabled", true);
+ setTimeout(function(){
+ $(".contestInsertTimeInputArea > button").html(`
`);
+ $(".contestInsertTimeInputArea > button").addClass("primaryColor").removeClass("dangerColor").attr("disabled", false);
+ }, 1000);
+ });
+ })
+}
+
function displayContestListPage(){
$(".contestListMatchedCount").html(String(contestListSortResult.length) + ' / ' + String(contestAllList.length));
if(contestListSortResult.length == 0){
@@ -130,7 +190,7 @@ function displayContestListPage(){
rep[5] = `
${(new Date(x[3] * 1000)).pattern("yyyy-MM-dd hh:mm")} >>> ${(new Date((x[3] + x[4]) * 1000)).pattern("yyyy-MM-dd hh:mm")}`;
var rtList = [`
${localize('contestListStart')}`
, `
${localize('contestListRun')}`
- , `
${localize('contestListEnd')}`];
+ , `
${localize('contestListEnd')} |
${localize('contestListVirtual')}`];
if((new Date()).getTime() <= x[3] * 1000)
rep[6] = 0, rep[5] += ` |
${localize('contestPageBeforeStart')}`;
else if((new Date()).getTime() <= (x[3] + x[4]) * 1000)
@@ -252,6 +312,12 @@ $(".contestSearch .searchPagesButton").eq(3).click(function(){
contestListCurrentPage = r;
displayContestListPage();
})
+$(".closeContestInsertTime").click(function(){
+ $(".contestInsertTimeWindow").css("opacity", 0);
+ setTimeout(function(){
+ $(".contestInsertTimeWindow").css("display", "none");
+ }, 500)
+})
function reloadContestPageCountdown(){
setTimeout(reloadContestPageCountdown, 500);
diff --git a/js/locale.js b/js/locale.js
index c274b73..940b20d 100644
--- a/js/locale.js
+++ b/js/locale.js
@@ -155,6 +155,16 @@ var lang_en = {
month9: "Oct",
month10: "Nov",
month11: "Dec",
+ contestListVirtual: "Virtual Participation",
+ contestInsertTime: "Insert Time",
+ showData: "Show Data",
+ showCode: "Show Code",
+ selectToShow: "Select a group of data.",
+ testcase: "Test",
+ allTestcase: "All Tests",
+ count: "Count",
+ answer: "Answer",
+ result: "Message",
},
input: {
singleContestantUsername: "Username",
@@ -162,6 +172,7 @@ var lang_en = {
singleVirtualUsername: "Username",
singleVirtualContestId: "Contest ID",
singleVirtualTime: "Time (YYYY/M/D HH:MM)",
+ contestTimeInput: "Time (YYYY/M/D HH:MM)",
search: "Search",
problemId: "Problem ID",
contestId: "Contest ID",
@@ -525,6 +536,16 @@ var lang_zh = {
month9: "十月",
month10: "十一月",
month11: "十二月",
+ contestListVirtual: "虚拟赛",
+ contestInsertTime: "输入时间",
+ showData: "显示数据",
+ showCode: "显示代码",
+ selectToShow: "选择一组数据查看",
+ testcase: "测试点",
+ allTestcase: "所有测试点",
+ count: "个数",
+ answer: "答案",
+ result: "信息",
},
input: {
singleContestantUsername: "用户名",
@@ -532,6 +553,7 @@ var lang_zh = {
singleVirtualUsername: "用户名",
singleVirtualContestId: "比赛 ID",
singleVirtualTime: "时间 (YYYY/M/D HH:MM)",
+ contestTimeInput: "时间 (YYYY/M/D HH:MM)",
search: "搜索",
problemId: "题目 ID",
contestId: "比赛 ID",
diff --git a/js/multi.js b/js/multi.js
index a2f264c..e00c12a 100644
--- a/js/multi.js
+++ b/js/multi.js
@@ -355,6 +355,7 @@ function multiRenderList(data){
setTimeout(calcStandingList, 2000);
})
}
+ delete(data);
calcStandingList();
}
diff --git a/js/profile.js b/js/profile.js
index 2ddaa65..347bd7e 100644
--- a/js/profile.js
+++ b/js/profile.js
@@ -749,9 +749,9 @@ function profileRefreshSubmissionListPages(){
var tm = new Date(t.creationTimeSeconds * 1000);
p.append(`
${tm.pattern("yyyy-MM-dd")}
${tm.pattern("hh:mm:ss")}
`);
p.append(`
${t.problem.contestId}${t.problem.index} - ${t.problem.name}
`)
- p.append(`
${getSubmissionIcon(t.verdict)}
${toColoredSubmissionInfo(t.verdict)}
`);
+ p.append(`
${getSubmissionIcon(t.verdict)}
${toColoredSubmissionInfo(t.verdict)}
`);
p.append(`
${toSmallTestset(t.testset)}${t.verdict == "OK" ? "" : `#${t.passedTestCount + 1}`}
`);
- p.append(`
${t.timeConsumedMillis}ms
${Math.floor(t.memoryConsumedBytes / 1000)}KB
`)
+ p.append(`
${t.timeConsumedMillis}ms
${Math.floor(t.memoryConsumedBytes / 1024)}KB
`)
$(".profileSubmissionsList").append(p);
}
}
diff --git a/js/submission.js b/js/submission.js
index f996310..a1adbd9 100644
--- a/js/submission.js
+++ b/js/submission.js
@@ -1,5 +1,6 @@
var submissionLastOperated = new Date(0);
+var submissionDataStorage = [];
function openSubmission(c, u){
if(!RunInNwjs){
openURL(settings.mainURL + `/${c >= 100000 ? "gym" : "contest"}/` + c + '/submission/' + u);
@@ -12,7 +13,7 @@ function openSubmission(c, u){
$(".submissionContainer > div:last-child").css("display", "none");
setTimeout(function(){$(".submissionContainer").css("opacity", 1);}, 100);
$(".submissionContainer > div:first-child > i").attr("class", 'fas fa-spin fa-sync-alt');
- var data;
+ var data, P;
var submissionAjax;
function loader(callback){
submissionAjax = $.ajax({
@@ -20,7 +21,7 @@ function openSubmission(c, u){
success: function(j){
submissionAjax = null;
if(T.getTime() != submissionLastOperated.getTime()) return;
- data = $(j);
+ data = $(j); P = j;
if(j.indexOf(`SubmissionDetailsFrameRoundBox-${u}"`) == -1)
data = $("");
setTimeout(callback, 100);
@@ -56,12 +57,20 @@ function openSubmission(c, u){
}
return 0;
}
+ var queryCsrf = new RegExp(`
div:last-child").css("display", "block");
$(".submissionContainer > div:first-child").css("display", "none");
+ $(".submissionDisplayer > div:first-child").css("display", "flex");
+ $(".submissionDisplayer > div:last-child").css("display", "none");
+
$(".submissionUsername").html();
$(".submissionProblem").html(ctL.children().eq(2).find("a").text());
$(".submissionLanguage").html(ctL.children().eq(3).text());
@@ -118,8 +127,10 @@ function openSubmission(c, u){
}
if(data.find("#program-source-text").length == 0){
$(".submissionCode").html(`
${languageOption.error.errorCannotGetCode}
`);
+ $(".submissionDataLister").css("display", "none");
}
else{
+ $(".submissionDataLister").css("display", "inline");
$(".submissionCode").html(`
${allHtmlSpecialChars(data.find("#program-source-text").text())}
`);
var q = data.find("#program-source-text").attr("class").split(" ");
var lang = "plaintext";
@@ -131,13 +142,93 @@ function openSubmission(c, u){
hljs.highlightElement($(".submissionCode > code")[0]);
hljs.lineNumbersBlock($(".submissionCode > code")[0]);
}
+ $(".submissionDataList").html("");
+ $(".submissionDataDetail").html("");
+ delete(data);
+ }
+ function submissionAddList(id){
+ var S = submissionDataStorage[id-1];
+ $(".submissionDataDetail").append(`
${localize("testcase")} #${id} / ${S[4]}ms / ${Math.floor(Number(S[5]) / 1024)}KB${getSubmissionIcon(S[6])} ${toColoredSubmissionInfo(S[6])}
`);
+ $(".submissionDataDetail").append(`
${localize("input")}
`);
+ if(S[0] != undefined)
+ $(".submissionDataDetail").append(`
${$.trim(S[0]).replace("\r\n", "
")}
`);
+ $(".submissionDataDetail").append(`
${localize("output")}
`);
+ if(S[1] != undefined)
+ $(".submissionDataDetail").append(`
${$.trim(S[1]).replace("\r\n", "
")}
`);
+ $(".submissionDataDetail").append(`
${localize("answer")}
`);
+ if(S[2] != undefined)
+ $(".submissionDataDetail").append(`
${$.trim(S[2]).replace("\r\n", "
")}
`);
+ $(".submissionDataDetail").append(`
${localize("result")}
`);
+ if(S[3] != undefined)
+ $(".submissionDataDetail").append(`
${$.trim(S[3]).replace("\r\n", "
")}
`);
+ }
+ function submissionInitData(){
+ $(".submissionDataDetail").html(`
`);
+ $.ajax({
+ url: settings.mainURL + "/data/submitSource",
+ type: "POST",
+ data: {
+ csrf_token: csrf,
+ submissionId: u,
+ },
+ success: function(d){
+ var l = Number(d.testCount);
+ submissionDataStorage = [];
+ var tl = 0, ml = 0;
+ for(var i=1; i<=l; i++)
+ tl = Math.max(tl, Number(d["timeConsumed#" + i])),
+ ml = Math.max(ml, Number(d["memoryConsumed#" + i]));
+ ml = Math.floor(ml / 1024);
+ $(".submissionDataList").append(`
${localize("allTestcase")}${tl}ms
${localize("count")}: ${l}${ml}KB
`);
+ for(var i=1; i<=l; i++){
+ $(".submissionDataList").append(`
${getSubmissionIcon(d["verdict#" + i])}
${localize("testcase")} #${i}${d["timeConsumed#" + i]}ms
${toColoredSubmissionInfo(d["verdict#" + i])}${Math.floor(Number(d["memoryConsumed#" + i]) / 1024)}KB
`);
+ submissionDataStorage.push([d["input#" + i], d["output#" + i], d["answer#" + i], d["checkerStdoutAndStderr#" + i], d["timeConsumed#" + i], d["memoryConsumed#" + i], d["verdict#" + i]]);
+ }
+ $(".submissionDataDetail").html(`
${localize("selectToShow")}
`);
+ $(".submissionDataListItem").unbind("click").click(function(){
+ $(".submissionDataListItem.selected").removeClass("selected");
+ $(this).addClass("selected");
+ var id = Number($(this).attr("id"));
+ $(".submissionDataDetail").html("");
+ if(id == 0){
+ for(var i=1; i<=l; i++)
+ submissionAddList(i);
+ return;
+ }
+ else
+ submissionAddList(id);
+ })
+ },
+ error: function(){
+ $(".submissionDataDetail").html(`
`)
+ }
+ });
}
$(".submissionCloser").unbind("click").click(function(){
+ delete(submissionDataStorage);
+ submissionDataStorage = [];
submissionLastOperated = new Date();
if(submissionAjax != null)
submissionAjax.abort();
$(".submissionContainer").css("opacity", 0);
- setTimeout(function(){$(".submissionContainer").css("display", "none");}, 500);
+ setTimeout(function(){
+ $(".submissionContainer").css("display", "none");
+ $(".submissionDataList").html("");
+ $(".submissionDataDetail").html("");
+ }, 500);
+ })
+ $(".submissionCodeLister").unbind("click").click(function(){
+ $(".submissionDisplayer > div:first-child").css("display", "flex");
+ $(".submissionDisplayer > div:last-child").css("display", "none");
+ })
+ var dataLoadingIf = false;
+ $(".submissionDataLister").unbind("click").click(function(){
+ $(".submissionDisplayer > div:first-child").css("display", "none");
+ $(".submissionDisplayer > div:last-child").css("display", "flex");
+ if(!dataLoadingIf){
+ dataLoadingIf = true;
+ submissionInitData();
+ }
})
loader(req);
}