From f1e6f17282150d041e2a5d65a6c40cd3dc5c7049 Mon Sep 17 00:00:00 2001 From: Ere Maijala <ere.maijala@helsinki.fi> Date: Tue, 15 Mar 2016 09:19:39 +0200 Subject: [PATCH] Fixed lightbox login event handling. --- themes/bootstrap3/js/lightbox.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/themes/bootstrap3/js/lightbox.js b/themes/bootstrap3/js/lightbox.js index f5565d025dd..2adda39c26c 100644 --- a/themes/bootstrap3/js/lightbox.js +++ b/themes/bootstrap3/js/lightbox.js @@ -18,7 +18,7 @@ VuFind.lightbox = (function() { if ('undefined' == typeof details) { details = {}; } - document.dispatchEvent( + return document.dispatchEvent( new CustomEvent(msg, { detail: details, bubbles: true, @@ -132,15 +132,17 @@ VuFind.lightbox = (function() { || obj.url.match(/catalogLogin/)) // or catalog login for holds && $('<div/>').html(html).find('.flash-message.alert-danger').length == 0 // skip failed logins ) { + var eventResult = _emit('VuFind.lightbox.login', { + originalUrl: _originalUrl, + formUrl: obj.url + }); if (_originalUrl.match(/UserLogin/) || obj.url.match(/catalogLogin/)) { - _refreshPage(); + if (eventResult) { + _refreshPage(); + } return false; } else { VuFind.lightbox.refreshOnClose = true; - _emit('VuFind.lightbox.login', { - originalUrl: _originalUrl, - formUrl: obj.url - }); } } _update(html); -- GitLab