Under iOS (currently 7.0), it looks like alert()
and confirm()
are not working when our web app is pinned to the home screen (aka using the meta tag
I think that a bug related to the smooth hiding selection boxes animation. I do not like hacks, but this method works. Confirming called after 100 ms (this is enough for the time until the selection window closes)
var object;
$('form select').change(function()
{
object = $(this);
timer = setTimeout(confirmation, 100);
});
function confirmation()
{
switch(object.val())
{
case 'post_approved':
case 'post_delete':
case 'thread_delete': object.parent('form').find('input[name=id]').val(object.parent('form').find('input[name=post_id]').val()); break;
case 'user_delete_all': object.parent('form').find('input[name=id]').val(object.parent('form').find('input[name=user_id]').val()); break;
default: return false; break;
}
if(object.parent('form').find('input[name=act]').val() === 'post_approved' || (object.parent('form').find('input[name=act]').val() != '' && confirm('Вы уверены?')))
object.parent('form').submit();
else
return false;
}