From a12b7a5c64ba68bf98a161c41520546abce9fc81 Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Wed, 8 Feb 2012 19:38:21 +0100 Subject: [feature/ajax] Fix alt_text and overlay closing PHPBB3-10270 --- phpBB/assets/javascript/core.js | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'phpBB/assets/javascript/core.js') diff --git a/phpBB/assets/javascript/core.js b/phpBB/assets/javascript/core.js index 742aa05115..5088da65db 100644 --- a/phpBB/assets/javascript/core.js +++ b/phpBB/assets/javascript/core.js @@ -84,8 +84,10 @@ phpbb.alert = function(title, msg, fadedark) { } }); - div.find('.alert_close').one('click', function() { + div.find('.alert_close').one('click', function(e) { dark.trigger('click'); + + e.preventDefault(); }); if (loading_alert.is(':visible')) @@ -170,12 +172,14 @@ phpbb.confirm = function(msg, callback, fadedark) { } }); - div.find('.alert_close').one('click', function() { + div.find('.alert_close').one('click', function(e) { var fade = (typeof fadedark !== 'undefined' && fadedark) ? div : dark; fade.fadeOut(phpbb.alert_time, function() { div.hide(); }); callback(false); + + e.preventDefault(); }); if (loading_alert.is(':visible')) @@ -397,9 +401,12 @@ phpbb.add_ajax_callback = function(id, callback) * the alt-text data attribute, and replaces the text in the attribute with the * current text so that the process can be repeated. */ -phpbb.add_ajax_callback('alt_text', function(el) { - el = $(el); - var alt_text = el.attr('data-alt-text'); +phpbb.add_ajax_callback('alt_text', function(data) { + var el = $(this), + alt_text; + + alt_text = el.attr('data-alt-text'); + el.text(); el.attr('data-alt-text', el.text()); el.text(el[0].title = alt_text); }); -- cgit v1.2.1