Exit confirmation tweaks in post upload

Confirmation is disabled after user removes last file from the upload queue.
It's enabled again whenever user adds something.
This commit is contained in:
Marcin Kurczewski 2014-02-20 21:30:30 +01:00
parent 4b08686393
commit 0b6a0337fe

View file

@ -224,7 +224,6 @@ $(function()
{ {
for (var i = 0; i < inputs.length; i ++) for (var i = 0; i < inputs.length; i ++)
{ {
enableExitConfirmation();
var input = inputs[i]; var input = inputs[i];
var postDom = $('#post-template').clone(true); var postDom = $('#post-template').clone(true);
postDom.find('form').submit(false); postDom.find('form').submit(false);
@ -238,10 +237,16 @@ $(function()
callback(postDom, input); callback(postDom, input);
} }
if ($('.posts .post').length == 0) if ($('.posts .post').length == 0)
{
disableExitConfirmation();
$('#upload-step2').fadeOut(); $('#upload-step2').fadeOut();
}
else else
{
enableExitConfirmation();
$('#upload-step2').fadeIn(); $('#upload-step2').fadeIn();
} }
}
$('.post img').mouseenter(function(e) $('.post img').mouseenter(function(e)
{ {