Show confirmation dialog when navigating away from UI window
This commit is contained in:
parent
cdf052cd03
commit
54a587d6a3
|
@ -3653,6 +3653,7 @@ def checkworldinfo(txt, allowed_entries=None, allowed_folders=None, force_use_tx
|
|||
# Commit changes to Memory storage
|
||||
#==================================================================#
|
||||
def memsubmit(data):
|
||||
emit('from_server', {'cmd': 'setinputtext', 'data': data}, broadcast=True)
|
||||
# Maybe check for length at some point
|
||||
# For now just send it to storage
|
||||
vars.memory = data
|
||||
|
@ -3676,6 +3677,9 @@ def anotesubmit(data, template=""):
|
|||
settingschanged()
|
||||
vars.authornotetemplate = template
|
||||
|
||||
emit('from_server', {'cmd': 'setanote', 'data': vars.authornote}, broadcast=True)
|
||||
emit('from_server', {'cmd': 'setanotetemplate', 'data': vars.authornotetemplate}, broadcast=True)
|
||||
|
||||
#==================================================================#
|
||||
# Assembles game data into a request to InferKit API
|
||||
#==================================================================#
|
||||
|
|
|
@ -806,9 +806,6 @@ function dosubmit(disallow_abort) {
|
|||
hideMessage();
|
||||
hidegenseqs();
|
||||
socket.send({'cmd': 'submit', 'allowabort': !disallow_abort, 'actionmode': adventure ? action_mode : 0, 'chatname': chatmode ? chat_name.val() : undefined, 'data': txt});
|
||||
if(memorymode) {
|
||||
memorytext = input_text.val();
|
||||
}
|
||||
}
|
||||
|
||||
function changemode() {
|
||||
|
@ -1772,7 +1769,7 @@ $(document).ready(function(){
|
|||
seqselcontents = $("#seqselcontents");
|
||||
|
||||
// Connect to SocketIO server
|
||||
socket = io.connect(window.document.origin, {transports: ['polling', 'websocket']});
|
||||
socket = io.connect(window.document.origin, {transports: ['polling', 'websocket'], closeOnBeforeunload: false});
|
||||
|
||||
socket.on('from_server', function(msg) {
|
||||
if(msg.cmd == "connected") {
|
||||
|
@ -2536,5 +2533,10 @@ $(document).ready(function(){
|
|||
sendSaveAsRequest();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$(window).on("beforeunload", function() {
|
||||
if(gamestarted || memorytext.length > 0 || $("#anoteinput").val().length > 0 || $(".wilistitem").length > 1) {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
<script src="static/bootstrap.min.js"></script>
|
||||
<script src="static/bootstrap-toggle.min.js"></script>
|
||||
<script src="static/rangy-core.min.js"></script>
|
||||
<script src="static/application.js?ver=1.16.4z"></script>
|
||||
<script src="static/application.js?ver=1.16.4aa"></script>
|
||||
</head>
|
||||
<body>
|
||||
<input type="file" id="remote-save-select" accept="application/json" style="display:none">
|
||||
|
|
Loading…
Reference in New Issue