]> source.dussan.org Git - nextcloud-server.git/commitdiff
Fixed missing jQuery event object - expire interface now works with Firefox
authorSam Tuke <samtuke@owncloud.com>
Thu, 21 Jun 2012 13:53:58 +0000 (14:53 +0100)
committerSam Tuke <samtuke@owncloud.com>
Thu, 21 Jun 2012 13:54:24 +0000 (14:54 +0100)
apps/files_versions/js/settings-personal.js

index d9456f3f2af06c7dec5cf7fcc07b4e1a2a8ae081..6ea8c1a950ffb1f75f37a9207636b824ae50914a 100644 (file)
@@ -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')+'<img style="display: none;" class="loading" src="'+OC.filePath('core','img','loading.gif')+'" />'); 
-                                               }
-                                               
-                                       );
-                                       
-                               }
-                       }
+                       // 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')+'<img style="display: none;" class="loading" src="'+OC.filePath('core','img','loading.gif')+'" />'); 
+                                                       }       
+                                               );              
+                                       }
+                               }       
+                       );
+               }
+       );
 });
\ No newline at end of file