Disable leave confirm when voting for map or server

This commit is contained in:
jamal 2014-10-11 10:04:16 -04:00
parent 3589e226d3
commit 450f821232

View file

@ -1,7 +1,7 @@
<div id="jplayer"></div>
<script type="text/javascript">
var played = false;
var leaving = false;
var leave_confirm = true;
<% if @gatherer and @gatherer.can_destroy? cuser %>
var gatherer_id = <%= @gatherer.id %>;
<% else %>
@ -59,20 +59,23 @@
});
$(window).bind('beforeunload', function(e) {
if (gatherer_id > 0 && !leaving) {
if (gatherer_id > 0 && leave_confirm) {
return "You will be removed from the Gather if you leave this page.";
}
});
$(window).bind('unload', function() {
if (gatherer_id > 0 && !leaving) {
if (gatherer_id > 0 && leave_confirm) {
updateGathererStatus('leaving');
}
});
$('.leave-gather').click(function() {
leaving = true;
});
var disable_leave_confirm = function() {
leave_confirm = false;
}
$('.leave-gather').click(disable_leave_confirm);
$('#gather-area a').click(disable_leave_confirm);
var afk = false;
var afk_timeout;