Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
bugzilla
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
bugzilla
Commits
272fa8ca
Commit
272fa8ca
authored
6 months ago
by
Ivan Ivlev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
timer.js: add confirmation window on page refresh or close (eterbug #17736)
Signed-off-by:
Ivan Ivlev
<
iviv@etersoft.ru
>
parent
b2184482
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
0 deletions
+11
-0
timer.js
js/etersoft/timer.js
+11
-0
No files found.
js/etersoft/timer.js
View file @
272fa8ca
...
...
@@ -227,6 +227,17 @@ function validateComment(comment, workTimeValue, productiveTimeValue, validation
return
errorObj
;
}
//вывод окна с подтверждением при перезагрузке или закрытии страницы в случае, если поле комментария не пусто
window
.
addEventListener
(
'beforeunload'
,
function
(
event
)
{
// Cancel the event
if
(
document
.
getElementById
(
"comment"
).
value
.
length
!=
0
){
// If you prevent default behavior in Mozilla Firefox prompt will always be shown
event
.
preventDefault
();
// Chrome requires returnValue to be set
event
.
returnValue
=
''
;
}
});
window
.
addEventListener
(
"load"
,
function
()
{
// работа с модальным окном
const
openButton
=
document
.
querySelector
(
"#commit"
);
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment