Add an exit confirm dialog

This commit is contained in:
Florian Mounier
2015-10-07 16:38:24 +02:00
parent 0f7a51d451
commit 93ff8a3969
6 changed files with 16 additions and 5 deletions

View File

@@ -40,7 +40,7 @@ body
/* Pop ups */
.hidden
display: none
display: none !important
#popup
position: fixed

View File

@@ -77,6 +77,12 @@
return e.preventDefault();
});
addEventListener('beforeunload', function(e) {
if (!(butterfly.body.classList.contains('dead') || location.href.indexOf('session') > -1)) {
return e.returnValue = 'This terminal is active and not in session. Are you sure you want to kill it?';
}
});
Popup = (function() {
function Popup() {
this.el = document.getElementById('popup');
@@ -506,7 +512,7 @@
if (theme === 'default') {
url = "/static/main.css";
} else {
url = "theme/" + theme + "/style.css";
url = "/theme/" + theme + "/style.css";
}
inner += '<option ';
if (_theme === url) {

File diff suppressed because one or more lines are too long

View File

@@ -3058,7 +3058,7 @@ body {
body::-webkit-scrollbar-thumb:hover {
background: rgba(255, 255, 255, 0.15); }
body .hidden {
display: none; }
display: none !important; }
body #popup {
position: fixed;
display: flex;

View File

@@ -0,0 +1,5 @@
addEventListener 'beforeunload', (e) ->
unless (butterfly.body.classList.contains('dead') or
location.href.indexOf('session') > -1)
e.returnValue = 'This terminal is active and not in session.
Are you sure you want to kill it?'

View File

@@ -44,7 +44,7 @@ document.addEventListener 'keydown', (e) ->
if theme is 'default'
url = "/static/main.css"
else
url = "theme/#{theme}/style.css"
url = "/theme/#{theme}/style.css"
inner += '<option '
if _theme is url