Skip to content

Commit

Permalink
Merge pull request #35 from CodeforcesContestHelper/dev
Browse files Browse the repository at this point in the history
Improve UI & Function added
  • Loading branch information
tiger2005 authored Nov 26, 2021
2 parents 21c66e2 + ba4c4ec commit adf5a96
Show file tree
Hide file tree
Showing 18 changed files with 492 additions and 286 deletions.
26 changes: 16 additions & 10 deletions css/client.css
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ body{
}
.HtmlContainer{
width: 1000px;
height: 668px;
height: 658px;
overflow: hidden;
margin: 0px;
user-select:none;
Expand Down Expand Up @@ -70,19 +70,19 @@ body{
.ToolList{
-webkit-app-region: drag;
position: relative;
height: 38px;
height: 30px;
}
.ToolListTitle{
margin: 8px 12px;
font-size: 16px;
font-size: 14px;
}
.ToolListButton{
-webkit-app-region: no-drag;
cursor: pointer;
transition: 0.2s;
width: 55px;
height: 38px;
font-size: 16px;
width: 45px;
height: 30px;
font-size: 14px;
display: grid;
place-items: center;
}
Expand Down Expand Up @@ -116,7 +116,7 @@ body{
height: 80px;
}
.contentRowInfo{
height: 680px;
height: 630px;
display: flex;
flex-direction: row;
position: absolute;
Expand Down Expand Up @@ -738,7 +738,7 @@ img[src=""],img:not([src]){opacity:0;}
display: flex;
flex-direction: row;
padding: 3px 10px;
font-size: 16px;
font-size: 14px;
width: calc(100% - 20px);
text-align: center;
}
Expand Down Expand Up @@ -1281,8 +1281,14 @@ pre{





/* PROFILE */
.infoUserSelector{
width: calc(100% - 10px);
padding: 5px;
position: absolute;
top: 0px;
transition: 0.2s;
}



Expand Down
3 changes: 0 additions & 3 deletions css/dark.css
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ body{
.ToolListMinimize:hover{
background: #666;
}
.ToolList{
border-bottom: 2px solid #555;
}
.NavBarCurr{
background: #555;
}
Expand Down
3 changes: 0 additions & 3 deletions css/default.css
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ body{
.ToolListMinimize:hover{
background: #bbb;
}
.ToolList{
border-bottom: 2px solid #ccc;
}
.NavBarCurr{
background: #999;
}
Expand Down
19 changes: 10 additions & 9 deletions css/problem/client.css
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ body{
flex-direction: column;
font-family: var(--font-family);
position: relative;
overflow: hidden;
}
.HtmlContainer > div:last-child{
flex: 1;
Expand All @@ -53,12 +54,12 @@ body{
}
.sideBar > div{
overflow-x: hidden;
overflow-y: scroll;
width: 160px;
overflow-y: auto;
width: 175px;
height: 100%;
}
.sideBar:hover{
width: 160px;
width: 175px;
}
.sideBarGroupContents{
border-radius: 10px;
Expand All @@ -69,7 +70,7 @@ body{
font-size: 16px;
padding: 10px;
padding-left: 10px;
width: 135px;
width: calc(100% - 20px);
font-family: var(--font-family);
border-left: 0px solid rgb(255, 204, 102);
user-select: none;
Expand Down Expand Up @@ -109,20 +110,20 @@ body{
.ToolList{
-webkit-app-region: drag;
position: relative;
height: 36px;
height: 30px;
}
.ToolListTitle{
margin: 8px 12px;
font-size: 16px;
font-size: 14px;
user-select: none;
}
.ToolListButton{
-webkit-app-region: no-drag;
cursor: pointer;
transition: 0.2s;
width: 55px;
height: 38px;
font-size: 16px;
width: 45px;
height: 30px;
font-size: 14px;
display: grid;
place-items: center;
}
Expand Down
3 changes: 0 additions & 3 deletions css/problem/dark.css
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ body{
.sideBarItem:hover, .addProblemSidebar:hover{
background: #888;
}
.ToolList{
border-bottom: 2px solid #555;
}
.ToolListMinimize:hover, .ToolListMaximize:hover{
background: #666;
}
Expand Down
3 changes: 0 additions & 3 deletions css/problem/default.css
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ body{
.sideBarItem:hover, .addProblemSidebar:hover{
background: #eee;
}
.ToolList{
border-bottom: 2px solid #ccc;
}
.ToolListMinimize:hover, .ToolListMaximize:hover{
background: #bbb;
}
Expand Down
17 changes: 15 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
delimiters: [
{left: "$$", right: "$$", display: true},
{left: "$", right: "$", display: false}
]
],
colorIsTextColor: true,
};
</script>
<title>Codeforces Contest Helper</title>
Expand Down Expand Up @@ -542,7 +543,7 @@
</div>
</div>
<div class="contentWrapper infoContent">
<div class="contentRowInfo">
<div class="contentRowInfo" style="width: 920px;">

</div>
</div>
Expand Down Expand Up @@ -806,6 +807,17 @@
<div class="settingsSelectPartRight"><i class="fas fa-angle-right"></i></div>
</div>
</div>
<div class="settingsUI settingsSelect" for="headBackOption">
<div class="settingsSelectInfo">
<div class="settingsSelectInfoMain">Radio Name</div>
<div class="settingsSelectInfoAddition">Radio Addition</div>
</div>
<div class="settingsSelectPart">
<div class="settingsSelectPartLeft"><i class="fas fa-angle-left"></i></div>
<div class="settingsSelectPartContent"></div>
<div class="settingsSelectPartRight"><i class="fas fa-angle-right"></i></div>
</div>
</div>
<div class="settingsUI settingsRadio" for="openNotification">
<div class="settingsRadioInfo">
<div class="settingsRadioInfoMain">Radio Name</div>
Expand Down Expand Up @@ -950,6 +962,7 @@
<script src="./js/problem.js"></script>
<script src="./js/contest.js"></script>
<script src="./js/multi.js"></script>
<script src="./js/profile.js"></script>
<script>
$(".NavBarContent").click(function(){
$(".contentWrapperChosen").removeClass("contentWrapperChosen");
Expand Down
14 changes: 12 additions & 2 deletions js/authorize.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ function loadLoginType(){
})
}
var queryCsrf = new RegExp(`<meta name="X-Csrf-Token" content="([0-9a-f]*)"`);
var queryGlobalChannel = new RegExp(`<meta name="gc" content="([0-9a-f]*)"`);
var queryHandle = new RegExp(`handle = "([\s\S]+?)"`);
var queryHandle2 = new RegExp(`<title>([0-9a-zA-Z-_.]+?) - Codeforces</title>`);
function getFtaa(){
Expand Down Expand Up @@ -162,10 +163,14 @@ function submitSolution(ci, idx, code, lang, S, E){
"source": code,
"sourceFile": "",
"tabSize": "4",
"_tta": "493",
"_tta": "594",
"sourceCodeConfirmed": "true",
},
success: function(d){
if($(d).find(".lang-chooser > div").length == 0){
E('errorNetworkError', languageOption.error.errorNetworkError);
return;
}
var q = $(d).find(".lang-chooser > div").eq(1);
if(q.children("a").eq(1).html() == "Register"){
currentLoginHandle = "";
Expand All @@ -181,7 +186,12 @@ function submitSolution(ci, idx, code, lang, S, E){
E('errorSubmitFailed', languageOption.error.errorSubmitFailed);
return;
}
S($(d).find(`[data-submission-id]`).eq(0).attr("data-submission-id"), ci + idx);
var gc = queryGlobalChannel.exec(d);
if(gc != null)
gc = gc[1];
else
gc = "7bf17394dc32cc2d4d6234197d8d58178ed01ff7";
S($(d).find(`[data-submission-id]`).eq(0).attr("data-submission-id"), ci + idx, gc);
},
error: function(){
E('errorLoginFailed', languageOption.error.errorLoginFailed);
Expand Down
112 changes: 70 additions & 42 deletions js/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,7 @@ function getSingleRatingChanges(currSingleLastTimeUpdate, un, ci){
callbacks();
return;
}
for(var i=0; i<json.length; i++) if(json[i].handle == un){
for(var i=0; i<json.length; i++) if(json[i].handle.toLowerCase() == un.toLowerCase()){
$(".singleContestProgressRatingChangesDisplayer > span:last-child")
.html(`<span class="${ratingToClass(json[i].oldRating)}">${json[i].oldRating}</span> <span class="${json[i].newRating>=json[i].oldRating?"green":"red"}">${json[i].newRating>=json[i].oldRating?'+':'-'}${Math.abs(Number(json[i].newRating)-Number(json[i].oldRating))}</span> <i class="fas fa-angle-double-right"></i> <span class="${ratingToClass(json[i].newRating)}">${json[i].newRating}</span>`)
if(contestNewWinLoaded) contestNewWinJQ.find(".ratingChanges").html($(".singleContestProgressRatingChangesDisplayer > span:last-child").html());
Expand Down Expand Up @@ -1494,7 +1494,7 @@ function loadStandingsService(un, ci, forced){
if(settings.showProblemStatus){
contestProblemStatusBarInfo[0] = loadProblemStatusBar(false);
contestProblemStatusBarInfo[1] = loadProblemStatusBar(true);
setTimeout(function(){flushProblemStatusBar()}, 300);
setTimeout(function(){flushProblemStatusBar()}, 200);
}
}
function singleContestantSyncHacks(un, ci, json, p){
Expand Down Expand Up @@ -2416,46 +2416,7 @@ $(".searchArgumentsItem").click(function(){


var timeLoader, ifInObserve;
$(".singleHeadBack > span").mousedown(function(e){
$(".singleHeadBackProgress").addClass("selected");
timeStart = new Date();
ifInObserve = true;
var x = e.clientX;
var y = e.clientY;
$(".singleHeadBackProgress").css("top", y).css("left", x);
window.onmousemove = function(evt){
var x = evt.clientX;
var y = evt.clientY;
$(".singleHeadBackProgress").css("top", y).css("left", x);
}
timeLoader = setInterval(function(){
timeEnd = new Date();
if(timeEnd.getTime() - timeStart.getTime() > 600){
clearInterval(timeLoader);
$(".singleContent > div").css("left", "0px");
$(".singleHeadBackProgress").removeClass("selected");
$("body").attr("onmouseup", "");
ifInObserve = false;
contestEnterInPage = false;
singleLastTimeUpdate = new Date();
for(var i=0; i<bigIsComing.length; i++){
if(bigIsComing[i] != null) bigIsComing[i].abort();
bigIsComing[i] = null;
}
if(contestRatingChangesHook) contestRatingChangesHook.abort();
if(contestNewWinOpened){
contestNewWinOpened = contestNewWinLoaded = false;
contestNewWin.close();
$(".singleOpenSmallWindow").html(`<span info="singleSmallWindow">${languageOption.general.singleSmallWindow}</span> <i class="fas fa-angle-right"></i>`);
}
++ singleContestantTimeCountdownTimeCnt;
setTimeout(function(){
if(!ifInObserve) window.onmousemove = function(){}
}, 300);
}
},100);
$("body").attr("onmouseup", "singleButtonMouseUp()");
});
var singleHeadBackClkd = 0;
function singleButtonMouseUp(){
clearInterval(timeLoader);
ifInObserve = false;
Expand All @@ -2469,6 +2430,73 @@ function singleButtonMouseUp(){
}, 300);
}

function reinitSingleButton(){
if(settings.headBackOption == 0){
$(".singleHeadBack > span").mousedown(function(e){
$(".singleHeadBackProgress").addClass("selected");
timeStart = new Date();
ifInObserve = true;
var x = e.clientX;
var y = e.clientY;
$(".singleHeadBackProgress").css("top", y).css("left", x);
window.onmousemove = function(evt){
var x = evt.clientX;
var y = evt.clientY;
$(".singleHeadBackProgress").css("top", y).css("left", x);
}
timeLoader = setInterval(function(){
timeEnd = new Date();
if(timeEnd.getTime() - timeStart.getTime() > 600){
clearInterval(timeLoader);
$(".singleContent > div").css("left", "0px");
$(".singleHeadBackProgress").removeClass("selected");
$("body").attr("onmouseup", "");
ifInObserve = false;
contestEnterInPage = false;
singleLastTimeUpdate = new Date();
for(var i=0; i<bigIsComing.length; i++){
if(bigIsComing[i] != null) bigIsComing[i].abort();
bigIsComing[i] = null;
}
if(contestRatingChangesHook) contestRatingChangesHook.abort();
if(contestNewWinOpened){
contestNewWinOpened = contestNewWinLoaded = false;
contestNewWin.close();
$(".singleOpenSmallWindow").html(`<span info="singleSmallWindow">${languageOption.general.singleSmallWindow}</span> <i class="fas fa-angle-right"></i>`);
}
++ singleContestantTimeCountdownTimeCnt;
setTimeout(function(){
if(!ifInObserve) window.onmousemove = function(){}
}, 300);
}
},100);
$("body").attr("onmouseup", "singleButtonMouseUp()");
});
$(".singleHeadBack > span").unbind("click");
}
else{
$(".singleHeadBack > span").click(function(){
if(settings.headBackOption == 1){
console.log("!");
if(singleHeadBackClkd == 1){
singleHeadBackClkd = 0;
$(".singleHeadBack > span").css("font-weight", "normal");
$(".singleContent > div").css("left", "0px");
return;
}
singleHeadBackClkd = 1;
$(".singleHeadBack > span").css("font-weight", "bold");
setTimeout(function(){
$(".singleHeadBack > span").css("font-weight", "normal");
singleHeadBackClkd = 0;
}, 1000);
}
})
$(".singleHeadBack > span").unbind("mousedown");
}
}
reinitSingleButton();

$(".singleOpenSmallWindow").click(function(){
if(!RunInNwjs) return;
if(contestNewWinOpened && !contestNewWinLoaded)
Expand Down
Loading

0 comments on commit adf5a96

Please sign in to comment.