summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorBernhard Posselt <dev@bernhard-posselt.com>2014-05-24 14:23:44 +0200
committerBernhard Posselt <dev@bernhard-posselt.com>2014-05-24 14:23:44 +0200
commit11c5ded96c52ec909f7324df46f29f25b5bea9ad (patch)
treece36cfde4e517ecb3f4450a57d815c5491713bfa /core
parent41b7e4b8b86efa0692291a2b98f82979774a6773 (diff)
downloadnextcloud-server-11c5ded96c52ec909f7324df46f29f25b5bea9ad.tar.gz
nextcloud-server-11c5ded96c52ec909f7324df46f29f25b5bea9ad.zip
allow apps to add buttons on runtime without negatively impacting performance
Diffstat (limited to 'core')
-rw-r--r--core/js/app.js21
1 files changed, 17 insertions, 4 deletions
diff --git a/core/js/app.js b/core/js/app.js
index 59b5d144199..6592ea93b29 100644
--- a/core/js/app.js
+++ b/core/js/app.js
@@ -7,11 +7,24 @@
* @author Bernhard Posselt <dev@bernhard-posselt.com>
* @copyright Bernhard Posselt 2014
*/
-
-(function (document, $) {
+(function (document, $, exports) {
'use strict';
+ var buttons = $();
+
+ /**
+ * Allow apps to register buttons at runtime to not impact performance
+ * negatively on document click
+ * @param $ button wrapped in jquery result
+ */
+ exports.Apps = {
+ registerSlideToggleButton: function (button) {
+ buttons = buttons.add(button);
+ }
+ };
+
+
/**
* Provides a way to slide down a target area through a button and slide it
* up if the user clicks somewhere else. Used for the news app settings and
@@ -23,7 +36,7 @@
*/
var registerAppsSlideToggle = function () {
// use only buttons that are already in the dom
- var buttons = $('[data-apps-slide-toggle]');
+ buttons = buttons.add($('[data-apps-slide-toggle]'));
$(document).click(function (event) {
@@ -62,4 +75,4 @@
registerAppsSlideToggle();
});
-}(document, jQuery)); \ No newline at end of file
+}(document, jQuery, OC)); \ No newline at end of file