From: Alexander Ebert Date: Sun, 17 Jul 2016 13:22:18 +0000 (+0200) Subject: Blocking clicks on user panel items when it has just opened X-Git-Tag: 3.0.0_Beta_1~1071 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=59029512d62f0ab14a2d9615497556e6f80fa133;p=GitHub%2FWoltLab%2FWCF.git Blocking clicks on user panel items when it has just opened --- 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() {