From 59029512d62f0ab14a2d9615497556e6f80fa133 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Sun, 17 Jul 2016 15:22:18 +0200 Subject: [PATCH] Blocking clicks on user panel items when it has just opened --- wcfsetup/install/files/js/WCF.User.js | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/wcfsetup/install/files/js/WCF.User.js b/wcfsetup/install/files/js/WCF.User.js index 080c56bec4..97dc371dc3 100644 --- a/wcfsetup/install/files/js/WCF.User.js +++ b/wcfsetup/install/files/js/WCF.User.js @@ -182,13 +182,31 @@ WCF.User.Panel.Abstract = Class.extend({ success: $.proxy(this._success, this) }); - this._triggerElement.click($.proxy(this.toggle, this)); + var timerBlockClick = null; + this._triggerElement[0].addEventListener(WCF_CLICK_EVENT, (function(event) { + event.preventDefault(); + + if ($.browser.mobile) { + this.toggle(); + } + else if (this._dropdown.isOpen() && timerBlockClick === null) { + this.toggle(); + } + }).bind(this)); + + //this._triggerElement.click($.proxy(this.toggle, this)); var timer = null; this._triggerElement.hover( (function() { if (this._dropdown === null || !this._dropdown.isOpen()) { - timer = window.setTimeout(this.toggle.bind(this, undefined, true), 300); + timer = window.setTimeout((function() { + timerBlockClick = window.setTimeout(function() { + timerBlockClick = null; + }, 300); + + this.toggle(undefined, true); + }).bind(this), 300); } }).bind(this), function() { -- 2.20.1