Skip to content

Commit

Permalink
Fix the problem of the Uploader and Comment Action.
Browse files Browse the repository at this point in the history
  • Loading branch information
WeepingDogel committed Jan 29, 2023
1 parent 5d9871b commit b771349
Showing 1 changed file with 22 additions and 3 deletions.
25 changes: 22 additions & 3 deletions flaskr/static/js/Main.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,32 @@ function avatarChecking(){
}
}

var winX = null;
var winY = null;
window.addEventListener('scroll',
function () {
if (winX !== null && winY !== null) {
window.scrollTo(winX, winY);
}
});

function disableWindowScroll() {
winX = window.scrollX; winY = window.scrollY;
}

function enableWindowScroll() {
winX = null; winY = null;
}


function displayUploader(){
var uploader = document.getElementById('mask');
if(uploader.style.display == "block"){
uploader.style.display = "none";
enableWindowScroll();
}else{
uploader.style.display = "block";
disableWindowScroll();
}
}

Expand Down Expand Up @@ -112,13 +132,10 @@ function ReplyTo(numID){
scrollTo(0,0);
let ReplyTo = document.getElementsByClassName("Reply")[numID - 1];
let ReplyToUser = document.getElementsByClassName("ReplyToUser")[numID - 1];
let ReplyToDate = document.getElementsByClassName("ReplyToDate")[numID - 1];
let InputValueOfReplyTo = document.getElementById("ReplyTo");
let InputValueOfReplyToUser = document.getElementById("ReplyToUser");
let InputValueOfReplyToDate = document.getElementById("ReplyToDate");
InputValueOfReplyTo.value = ReplyTo.value;
InputValueOfReplyToUser.value = ReplyToUser.innerText;
InputValueOfReplyToDate.value = ReplyToDate.innerText;

SendComments();
}
Expand All @@ -128,8 +145,10 @@ function SendComments() {
var Commenter = document.getElementById('mask');
if(Commenter.style.display == "block"){
Commenter.style.display = "none";
enableWindowScroll();
}else{
Commenter.style.display = "block";
disableWindowScroll();
}
}

Expand Down

0 comments on commit b771349

Please sign in to comment.