Skip to content

Commit

Permalink
Merge pull request #30 from CodeforcesContestHelper/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
tiger2005 authored Nov 12, 2021
2 parents 95c46f0 + 2184182 commit d1c5796
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 30 deletions.
3 changes: 1 addition & 2 deletions css/client.css
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ body{
font-size: 16px;
}
.singleHeadBack{
width: 220px;
width: 300px;
cursor: pointer;
left: 10px;
}
Expand Down Expand Up @@ -771,7 +771,6 @@ img[src=""],img:not([src]){opacity:0;}
padding: 5px;
width: calc(100% - 10px);
height: calc(100% - 10px);
overflow-y: scroll;
}
.submissionDisplayer > div:first-child{
padding: 5px 10px;
Expand Down
27 changes: 14 additions & 13 deletions js/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -580,20 +580,21 @@ function getSingleRatingChanges(currSingleLastTimeUpdate, un, ci){
if(singleAnnouncementLength == -1)
singleAnnouncementLength = q.length;
if(singleAnnouncementLength != q.length && q.length != 0){
singleAnnouncementLength = q.length;
q = q.eq(0);
var alt = "";
q.contents().each(function(){
if($(this).prop("outerHTML") == "<br>")
alt += '\n';
else
alt += $(this).text();
});
q = $('<div>' + alt + '</div>').text();
problemNewWinJQ.append(`<script>announcementDisplay(\`${q}\`)</script>`);
if(settings.openNotification){
new Notification(`Notification of CF #${ci}`, {body: q, icon: '../favicon.png'});
for(var dis = q.length - singleAnnouncementLength - 1; dis >= 0; dis --){
var t = q.eq(dis);
var alt = "";
t.contents().each(function(){
if($(this).prop("outerHTML") == "<br>")
alt += '\n';
else
alt += $(this).text();
});
t = $('<div>' + alt + '</div>').text();
problemNewWinJQ.append(`<script>announcementDisplay(\`${t}\`)</script>`);
if(settings.openNotification)
new Notification(`Notification of CF #${ci}`, {body: t, icon: '../favicon.png'});
}
singleAnnouncementLength = q.length;
}
}
})
Expand Down
4 changes: 2 additions & 2 deletions js/locale.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ var lang_en = {
singleContestantButton: "Fetch Information",
singleVirtualButton: "Fetch Information",
singleCheckExist: "Checking Existance...",
singleHeadBack: "Back to select page",
singleHeadBack: "Go back (Long press)",
singleSmallWindow: "Open small window",
singleSmallWindowClose: "Close small window",
alertLoadSuccess: "Load Success!",
Expand Down Expand Up @@ -291,7 +291,7 @@ var lang_zh = {
singleContestantButton: "获取信息",
singleVirtualButton: "获取信息",
singleCheckExist: "检查合法性...",
singleHeadBack: "返回选择界面",
singleHeadBack: "返回选择界面(长按)",
singleSmallWindow: "打开小窗口",
singleSmallWindowClose: "关闭小窗口",
alertLoadSuccess: "加载成功!",
Expand Down
28 changes: 15 additions & 13 deletions js/problem.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,11 @@ function loadProblem(x, info){
})
if(info != undefined){
problemCurrentPageList[p][2] = 0;
problemCurrentPageList[p][4].contestName = $(info).find(".caption").html();
initProblemPageInfo(problemNewWinJQ.find(`.innerContent > [problem-id=${x}]`), $(info).find(`.problemindexholder[problemindex=${getProblemIndexes(x)[1]}] .problem-statement`), p);
return;
}
problemCurrentPageList[p][1] =$.ajax({
problemCurrentPageList[p][1] = $.ajax({
url: settings.mainURL + `/${getProblemIndexes(x)[0] >= 100000 ? "gym" : "contest"}/` + getProblemIndexes(x)[0] + '/problem/' + getProblemIndexes(x)[1] + '?locale=en',
success: function(data){
if(data.indexOf(`data-entityId="${getProblemIndexes(x)[0]}"`) == -1){
Expand Down Expand Up @@ -354,7 +355,8 @@ function loadContestProblemset(cid, S, E){
cid = Number(cid);
$.ajax({
url: settings.mainURL + `/${cid >= 100000 ? "gym" : "contest"}/` + cid + '/problems',
success: function(data){
success: function(data, status, xhr){
console.log(status, xhr);
if(data.indexOf(`class="problem-statement"`) == -1){
E(); return;
}
Expand All @@ -363,7 +365,7 @@ function loadContestProblemset(cid, S, E){
q.find(".problemindexholder").each(function(){
ret.push(String(cid) + $.trim($(this).attr("problemindex")));
})
S(ret, q);
S(ret, data);
},
error: function(){
E();
Expand Down Expand Up @@ -603,16 +605,16 @@ function initProblemNewWin(){
for(var i=0; i<problemCurrentPageList.length; i++){
if(problemCurrentPageList[i][2] != 0) continue;
var info = JSON.stringify({
"name": problemCurrentPageList[i][4].title,
"group": problemCurrentPageList[i][4].contestName,
"url": `https://codeforces.com/${getProblemIndexes(problemCurrentPageList[i][0])[0] >= 100000 ? "gym" : "contest"}/${getProblemIndexes(problemCurrentPageList[i][0])[0]}/problem/${getProblemIndexes(problemCurrentPageList[i][0])[1]}`,
"interactive": false,
"memoryLimit": problemCurrentPageList[i][4].memoryLimit,
"timeLimit": problemCurrentPageList[i][4].timelimit,
"tests": sampleWrapper(problemCurrentPageList[i][3][0], problemCurrentPageList[i][3][1]),
"input": problemCurrentPageList[i][4].input,
"output": problemCurrentPageList[i][4].output,
});
"name": problemCurrentPageList[i][4].title,
"group": problemCurrentPageList[i][4].contestName,
"url": `https://codeforces.com/${getProblemIndexes(problemCurrentPageList[i][0])[0] >= 100000 ? "gym" : "contest"}/${getProblemIndexes(problemCurrentPageList[i][0])[0]}/problem/${getProblemIndexes(problemCurrentPageList[i][0])[1]}`,
"interactive": false,
"memoryLimit": problemCurrentPageList[i][4].memoryLimit,
"timeLimit": problemCurrentPageList[i][4].timelimit,
"tests": sampleWrapper(problemCurrentPageList[i][3][0], problemCurrentPageList[i][3][1]),
"input": problemCurrentPageList[i][4].input,
"output": problemCurrentPageList[i][4].output,
});
for(var pr in CompetitiveCompanionPort)
sender(info, pr, curr * 1000);
++curr;
Expand Down

0 comments on commit d1c5796

Please sign in to comment.