From 9112386cbf0eb1baf28aedd6fce07cef75fa1d68 Mon Sep 17 00:00:00 2001 From: Bernhard Posselt Date: Sat, 24 May 2014 14:28:24 +0200 Subject: [PATCH] query buttons on every click to not worry about weird edge case scenarios --- core/js/app.js | 24 +++++------------------- 1 file changed, 5 insertions(+), 19 deletions(-) diff --git a/core/js/app.js b/core/js/app.js index 17fc225089..0308d1fef0 100644 --- a/core/js/app.js +++ b/core/js/app.js @@ -7,24 +7,11 @@ * @author Bernhard Posselt * @copyright Bernhard Posselt 2014 */ -(function (document, $, exports) { + +(function (document, $) { '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.App = { - 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 @@ -35,11 +22,10 @@ *
I'm sliding up
*/ var registerAppsSlideToggle = function () { - // use only buttons that are already in the dom - buttons = buttons.add($('[data-apps-slide-toggle]')); - $(document).click(function (event) { + var buttons = $('[data-apps-slide-toggle]'); + buttons.each(function (index, button) { var areaSelector = $(button).data('apps-slide-toggle'); @@ -75,4 +61,4 @@ registerAppsSlideToggle(); }); -}(document, jQuery, OC)); \ No newline at end of file +}(document, jQuery)); \ No newline at end of file