From 5b5ad8dd42836ae844e033f4a84bd8a46f99f6b4 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Thu, 25 Dec 2014 03:00:58 +0100 Subject: [PATCH] Improved behavior for popovers on navigation --- wcfsetup/install/files/js/WCF.js | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/wcfsetup/install/files/js/WCF.js b/wcfsetup/install/files/js/WCF.js index c6b3b060af..7f7832d3e5 100755 --- a/wcfsetup/install/files/js/WCF.js +++ b/wcfsetup/install/files/js/WCF.js @@ -9658,6 +9658,11 @@ WCF.Popover = Class.extend({ this._initContainers(); WCF.DOMNodeInsertedHandler.addCallback('WCF.Popover.'+selector, $.proxy(this._initContainers, this)); + + $(window).on('beforeunload', (function() { + this._cancelPopover = true; + this._hide(true); + }).bind(this)); }, /** @@ -9684,20 +9689,14 @@ WCF.Popover = Class.extend({ $element.hover($.proxy(this._overElement, this), $.proxy(this._out, this)); if ($element.is('a') && $element.attr('href')) { - $element.click($.proxy(this._cancel, this)); + $element.click((function() { + this._hide(true); + }).bind(this)); } } }, this)); }, - /** - * Cancels popovers if link is being clicked - */ - _cancel: function(event) { - this._cancelPopover = true; - this._hide(true); - }, - /** * Triggered once an element is being hovered. * -- 2.20.1