From 25d6fc635b046df7ed297ca07eddd1a2bdba1388 Mon Sep 17 00:00:00 2001 From: Yiming Zhang Date: Wed, 10 Nov 2021 18:35:15 +0800 Subject: [PATCH 1/4] fix: update path name --- .github/workflows/build_test.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build_test.yml b/.github/workflows/build_test.yml index e9247eb..3a31c3a 100644 --- a/.github/workflows/build_test.yml +++ b/.github/workflows/build_test.yml @@ -21,11 +21,11 @@ jobs: - name: Pack run: | - zip -r CCHv2.alpha.${{ github.run_id }}.win32.zip . -i "build/CodeForces Contest Helper/win32/*" - zip -r CCHv2.alpha.${{ github.run_id }}.win64.zip . -i "build/CodeForces Contest Helper/win64/*" - zip -r CCHv2.alpha.${{ github.run_id }}.osx64.zip . -i "build/CodeForces Contest Helper/osx64/*" - zip -r CCHv2.alpha.${{ github.run_id }}.linux32.zip . -i "build/CodeForces Contest Helper/linux32/*" - zip -r CCHv2.alpha.${{ github.run_id }}.linux64.zip . -i "build/CodeForces Contest Helper/linux64/*" + zip -r CCHv2.alpha.${{ github.run_id }}.win32.zip . -i "build/CodeForces Contest Helper v2/win32/*" + zip -r CCHv2.alpha.${{ github.run_id }}.win64.zip . -i "build/CodeForces Contest Helper v2/win64/*" + zip -r CCHv2.alpha.${{ github.run_id }}.osx64.zip . -i "build/CodeForces Contest Helper v2/osx64/*" + zip -r CCHv2.alpha.${{ github.run_id }}.linux32.zip . -i "build/CodeForces Contest Helper v2/linux32/*" + zip -r CCHv2.alpha.${{ github.run_id }}.linux64.zip . -i "build/CodeForces Contest Helper v2/linux64/*" - uses: actions/upload-artifact@v2 with: @@ -46,4 +46,4 @@ jobs: - uses: actions/upload-artifact@v2 with: name: CCHv2.alpha.${{ github.run_id }}.linux64.zip - path: CCHv2.alpha.${{ github.run_id }}.linux64.zip \ No newline at end of file + path: CCHv2.alpha.${{ github.run_id }}.linux64.zip From cbfac6fd9fdc27c7bf65147dbfdcbf5fe94c5d22 Mon Sep 17 00:00:00 2001 From: Yiming Zhang Date: Wed, 10 Nov 2021 18:36:29 +0800 Subject: [PATCH 2/4] fix: update path name for release --- .github/workflows/release.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 18168ff..b91eb43 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -31,11 +31,11 @@ jobs: - name: Pack run: | - zip -r CCHv2.${{ steps.get_version.outputs.VERSION }}.win32.zip . -i "build/CodeForces Contest Helper/win32/*" - zip -r CCHv2.${{ steps.get_version.outputs.VERSION }}.win64.zip . -i "build/CodeForces Contest Helper/win64/*" - zip -r CCHv2.${{ steps.get_version.outputs.VERSION }}.osx64.zip . -i "build/CodeForces Contest Helper/osx64/*" - zip -r CCHv2.${{ steps.get_version.outputs.VERSION }}.linux32.zip . -i "build/CodeForces Contest Helper/linux32/*" - zip -r CCHv2.${{ steps.get_version.outputs.VERSION }}.linux64.zip . -i "build/CodeForces Contest Helper/linux64/*" + zip -r CCHv2.${{ steps.get_version.outputs.VERSION }}.win32.zip . -i "build/CodeForces Contest Helper v2/win32/*" + zip -r CCHv2.${{ steps.get_version.outputs.VERSION }}.win64.zip . -i "build/CodeForces Contest Helper v2/win64/*" + zip -r CCHv2.${{ steps.get_version.outputs.VERSION }}.osx64.zip . -i "build/CodeForces Contest Helper v2/osx64/*" + zip -r CCHv2.${{ steps.get_version.outputs.VERSION }}.linux32.zip . -i "build/CodeForces Contest Helper v2/linux32/*" + zip -r CCHv2.${{ steps.get_version.outputs.VERSION }}.linux64.zip . -i "build/CodeForces Contest Helper v2/linux64/*" - name: Create Release uses: softprops/action-gh-release@v1 @@ -51,4 +51,4 @@ jobs: name: CCHv2 ${{ steps.get_version.outputs.VERSION }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - \ No newline at end of file + From beb8e6ce25e0883b02f749bdd20b1fd78f05e34d Mon Sep 17 00:00:00 2001 From: tiger2005 <41613797+tiger2005@users.noreply.github.com> Date: Wed, 10 Nov 2021 20:34:45 +0800 Subject: [PATCH 3/4] [!] Bug Fix: Cannot transfer data correctly --- js/problem.js | 1 + 1 file changed, 1 insertion(+) diff --git a/js/problem.js b/js/problem.js index b1fb585..b9a0bbf 100644 --- a/js/problem.js +++ b/js/problem.js @@ -168,6 +168,7 @@ function loadProblem(x, info){ }) if(info != undefined){ problemCurrentPageList[p][2] = 0; + problemCurrentPageList[p][4].contestName = "Codeforces"; initProblemPageInfo(problemNewWinJQ.find(`.innerContent > [problem-id=${x}]`), $(info).find(`.problemindexholder[problemindex=${getProblemIndexes(x)[1]}] .problem-statement`), p); return; } From 218418295ad546550f7e882523da1e22a49dccc0 Mon Sep 17 00:00:00 2001 From: tiger2005 <41613797+tiger2005@users.noreply.github.com> Date: Fri, 12 Nov 2021 12:16:44 +0800 Subject: [PATCH 4/4] Bug fix & Improve UI --- css/client.css | 3 +-- js/client.js | 27 ++++++++++++++------------- js/locale.js | 4 ++-- js/problem.js | 29 +++++++++++++++-------------- 4 files changed, 32 insertions(+), 31 deletions(-) diff --git a/css/client.css b/css/client.css index 30d3cea..91cf979 100644 --- a/css/client.css +++ b/css/client.css @@ -327,7 +327,7 @@ body{ font-size: 16px; } .singleHeadBack{ - width: 220px; + width: 300px; cursor: pointer; left: 10px; } @@ -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; diff --git a/js/client.js b/js/client.js index b3a3e6a..3c63fb2 100644 --- a/js/client.js +++ b/js/client.js @@ -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") == "
") - alt += '\n'; - else - alt += $(this).text(); - }); - q = $('
' + alt + '
').text(); - problemNewWinJQ.append(``); - 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") == "
") + alt += '\n'; + else + alt += $(this).text(); + }); + t = $('
' + alt + '
').text(); + problemNewWinJQ.append(``); + if(settings.openNotification) + new Notification(`Notification of CF #${ci}`, {body: t, icon: '../favicon.png'}); } + singleAnnouncementLength = q.length; } } }) diff --git a/js/locale.js b/js/locale.js index 9a96935..462a626 100644 --- a/js/locale.js +++ b/js/locale.js @@ -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!", @@ -291,7 +291,7 @@ var lang_zh = { singleContestantButton: "获取信息", singleVirtualButton: "获取信息", singleCheckExist: "检查合法性...", - singleHeadBack: "返回选择界面", + singleHeadBack: "返回选择界面(长按)", singleSmallWindow: "打开小窗口", singleSmallWindowClose: "关闭小窗口", alertLoadSuccess: "加载成功!", diff --git a/js/problem.js b/js/problem.js index b9a0bbf..2704486 100644 --- a/js/problem.js +++ b/js/problem.js @@ -168,11 +168,11 @@ function loadProblem(x, info){ }) if(info != undefined){ problemCurrentPageList[p][2] = 0; - problemCurrentPageList[p][4].contestName = "Codeforces"; + 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){ @@ -355,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; } @@ -364,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(); @@ -604,16 +605,16 @@ function initProblemNewWin(){ for(var i=0; i= 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;