diff --git a/phpBB/adm/style/ajax.js b/phpBB/adm/style/ajax.js index 9b73b618d6..b4385b2740 100644 --- a/phpBB/adm/style/ajax.js +++ b/phpBB/adm/style/ajax.js @@ -16,14 +16,20 @@ phpbb.add_ajax_callback('forum_down', function() { { el.parents('span').siblings('.up').html('Move up'); tr.next().find('.up').html('Move up'); - phpbb.ajaxify({selector: el.parents('span').siblings('.up').children('a')}, false, 'forum_up'); + phpbb.ajaxify({ + selector: el.parents('span').siblings('.up').children('a'), + callback: 'forum_up' + }); } tr.insertAfter(tr.next()); if (tr.is(':last-child')) { el.html('Move down'); tr.prev().find('.down').html('Move down'); - phpbb.ajaxify({selector: tr.prev().find('.down').children('a')}, false, 'forum_down'); + phpbb.ajaxify({ + selector: tr.prev().find('.down').children('a'), + callback: 'forum_down' + }); } }); @@ -35,14 +41,20 @@ phpbb.add_ajax_callback('forum_up', function() { { el.parents('span').siblings('.down').html('Move down'); tr.prev().find('.down').html('Move down'); - phpbb.ajaxify({selector: el.parents('span').siblings('.down').children('a')}, false, 'forum_down'); + phpbb.ajaxify({ + selector: el.parents('span').siblings('.down').children('a'), + callback: 'forum_down' + }); } tr.insertBefore(tr.prev()); if (tr.is(':first-child')) { el.html('Move up'); tr.next().find('.up').html('Move up'); - phpbb.ajaxify({selector: tr.next().find('.up').children('a')}, false, 'forum_up'); + phpbb.ajaxify({ + selector: tr.next().find('.up').children('a'), + callback: 'forum_up' + }); } }); @@ -84,7 +96,11 @@ $('[data-ajax]').each(function() { if (ajax !== 'false') { fn = (ajax !== 'true') ? ajax : null; - phpbb.ajaxify({selector: this}, $this.attr('data-refresh') !== undefined, fn); + phpbb.ajaxify({ + selector: this, + refresh: $this.attr('data-refresh') !== undefined, + callback: fn + }); } }); diff --git a/phpBB/assets/javascript/core.js b/phpBB/assets/javascript/core.js index 6318fa2f17..22865e744d 100644 --- a/phpBB/assets/javascript/core.js +++ b/phpBB/assets/javascript/core.js @@ -241,9 +241,12 @@ phpbb.parse_querystring = function(string) { * three parameters: the element that the event was evoked from, the JSON * that was returned and (if it is a form) the form action. */ -phpbb.ajaxify = function(options, refresh, callback) { - var elements = $(options.selector); - var is_form = elements.is('form'); +phpbb.ajaxify = function(options) { + var elements = $(options.selector), + refresh = options.refresh, + callback = options.callback, + is_form = elements.is('form'); + if (is_form) { elements = elements.find('input:submit'); diff --git a/phpBB/styles/prosilver/template/ajax.js b/phpBB/styles/prosilver/template/ajax.js index 53dc8e1124..739648200b 100644 --- a/phpBB/styles/prosilver/template/ajax.js +++ b/phpBB/styles/prosilver/template/ajax.js @@ -56,7 +56,11 @@ $('[data-ajax]').each(function() { if (ajax !== 'false') { fn = (ajax !== 'true') ? ajax : null; - phpbb.ajaxify({selector: this}, $this.attr('data-refresh') !== undefined, fn); + phpbb.ajaxify({ + selector: this, + refresh: $this.attr('data-refresh') !== undefined, + callback: fn + }); } }); @@ -86,8 +90,9 @@ phpbb.ajaxify({ } return true; - } -}, true); + }, + refresh: true +});