Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EDIT* [Suggestion] Backend: Show a timer #13

Open
be9904 opened this issue May 22, 2021 · 5 comments
Open

EDIT* [Suggestion] Backend: Show a timer #13

be9904 opened this issue May 22, 2021 · 5 comments

Comments

@be9904
Copy link
Owner

be9904 commented May 22, 2021

Show a timer at the bottom of the page to show how much time the user has spent on the website.

HTML
You spent <label id="minutes">00</label>:<label id="seconds">00</label> on this page!

JS

            var minutesLabel = document.getElementById("minutes");
            var secondsLabel = document.getElementById("seconds");
            var totalSeconds = 0;
            setInterval(setTime, 1000);

            function setTime() {
                ++totalSeconds;
                secondsLabel.innerHTML = pad(totalSeconds % 60);
                minutesLabel.innerHTML = pad(parseInt(totalSeconds / 60));
            }

            function pad(val) {
                var valString = val + "";
                if (valString.length < 2) {
                    return "0" + valString;
                } else {
                    return valString;
                }
            }

snippet here

Current Problems:

  • Minutes go up infinitely (Solved: Added Hours Label)
  • Timer resets when page refreshes (UNSOLVED)

초반에 얘기가 좀 있기도 했고 갑자기 생각나서 올려봤습니다
굳이 필요한게 아니라면 내리겠습니다

스샷입니다
스크린샷 2021-05-22 오후 2 40 49

@ChanuYu
Copy link
Collaborator

ChanuYu commented May 22, 2021

저희 프로젝트 취지에 부합하는 기능인 거 같아요 바로 merge 하셔도 될 거 같은데요?

@be9904
Copy link
Owner Author

be9904 commented May 22, 2021

그럼 자잘한 오류 좀 처리하고 바로 merge 하겠습니다

@ChanuYu
Copy link
Collaborator

ChanuYu commented May 22, 2021

저희 이거 시간 제한 걸어서 윈도우창 닫게 만드는 건 어떨까요? window.close()참고
여기 보면 window.close()함수로 보고 있는 현재 창을 닫을 수 있던데 일정 시간이 지나면 경고 창 띄우고 제한 시간이 지났을 때 창이 닫히게 하는 거죠. 경고창 참고

@be9904
Copy link
Owner Author

be9904 commented May 22, 2021

바로 확인해보겠습니다

@be9904 be9904 changed the title [Suggestion] Backend: Show a timer EDIT* [Suggestion] Backend: Show a timer May 22, 2021
@be9904
Copy link
Owner Author

be9904 commented May 22, 2021

이용 2시간 후에 경고 메시지가 뜨고 창이 강제로 종료되게 하는 기능 추가했습니다. #14 참고해주세요

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants