]> source.dussan.org Git - nextcloud-server.git/commitdiff
Trigger events when app-settings visibility changes
authorVincent Petry <pvince81@owncloud.com>
Mon, 11 Aug 2014 14:29:15 +0000 (16:29 +0200)
committerVincent Petry <pvince81@owncloud.com>
Tue, 12 Aug 2014 10:00:34 +0000 (12:00 +0200)
core/js/apps.js

index 5f221bb9826a045b294741ffa057ddc7d1bb15f2..d874f8598fa3481e21e13a274e7fbab1114d857a 100644 (file)
                 var areaSelector = $(button).data('apps-slide-toggle');
                 var area = $(areaSelector);
 
+                               function hideArea() {
+                                       area.slideUp(function() {
+                                               area.trigger(new $.Event('hide'));
+                                       });
+                               }
+                               function showArea() {
+                                       area.slideDown(function() {
+                                               area.trigger(new $.Event('show'));
+                                       });
+                               }
+
                 // do nothing if the area is animated
                 if (!area.is(':animated')) {
 
                     // button toggles the area
                     if (button === event.target) {
                         if (area.is(':visible')) {
-                            area.slideUp();
+                            hideArea();
                         } else {
-                            area.slideDown();
+                            showArea();
                         }
 
                     // all other areas that have not been clicked but are open
@@ -59,7 +70,7 @@
                     } else {
                         var closest = $(event.target).closest(areaSelector);
                         if (area.is(':visible') && closest[0] !== area[0]) {
-                            area.slideUp();
+                            hideArea();
                         }
                     }
                 }
@@ -73,4 +84,4 @@
         registerAppsSlideToggle();
     });
 
-}(document, jQuery, OC));
\ No newline at end of file
+}(document, jQuery, OC));