From 7c3f6f61db5b93c3393ab4b3b99c3e6906ed27be Mon Sep 17 00:00:00 2001 From: Sam Tuke Date: Thu, 21 Jun 2012 14:53:58 +0100 Subject: [PATCH] Fixed missing jQuery event object - expire interface now works with Firefox --- apps/files_versions/js/settings-personal.js | 78 +++++++++------------ 1 file changed, 33 insertions(+), 45 deletions(-) diff --git a/apps/files_versions/js/settings-personal.js b/apps/files_versions/js/settings-personal.js index d9456f3f2af..6ea8c1a950f 100644 --- a/apps/files_versions/js/settings-personal.js +++ b/apps/files_versions/js/settings-personal.js @@ -1,51 +1,39 @@ -// $(document).ready(function(){ -// $('#versions').change( function(){ -// OC.msg.startSaving('#calendar .msg') -// // Serialize the data -// var post = $( '#timezone' ).serialize(); -// $.post( OC.filePath('calendar', 'ajax/settings', 'settimezone.php'), post, function(data){ -// //OC.msg.finishedSaving('#calendar .msg', data); -// }); -// return false; -// }); -// }); +// TODO: allow the button to be clicked only once -$(document).ready(function(){ +$( document ).ready(function(){ // - $('#expireAllBtn').click(function(){ + $( '#expireAllBtn' ).click( - // Prevent page from reloading - event.preventDefault(); + function( event ) { - // Show loading gif - $('.expireAllLoading').show(); - - $.getJSON( - OC.filePath('files_versions','ajax','expireAll.php'), - function(result){ - if (result.status == 'success') { - $('.expireAllLoading').hide(); - $('#expireAllBtn').html('Expiration successful'); - } else { - - // Cancel loading - $('#expireAllBtn').html('Expiration failed'); - - // Show Dialog - OC.dialogs.alert( - 'Something went wrong, your files may not have been expired', - 'An error has occurred', - function(){ - $('#expireAllBtn').html(t('files_versions', 'Expire all versions')+''); - } - - ); - - } - } + // Prevent page from reloading + event.preventDefault(); - ); - - }); - + // Show loading gif + $('.expireAllLoading').show(); + + $.getJSON( + OC.filePath('files_versions','ajax','expireAll.php'), + function(result){ + if (result.status == 'success') { + $('.expireAllLoading').hide(); + $('#expireAllBtn').html('Expiration successful'); + } else { + + // Cancel loading + $('#expireAllBtn').html('Expiration failed'); + + // Show Dialog + OC.dialogs.alert( + 'Something went wrong, your files may not have been expired', + 'An error has occurred', + function(){ + $('#expireAllBtn').html(t('files_versions', 'Expire all versions')+''); + } + ); + } + } + ); + } + ); }); \ No newline at end of file -- 2.39.5