diff --git a/phpBB/adm/style/ajax.js b/phpBB/adm/style/ajax.js index cb3289b936..869126ab76 100644 --- a/phpBB/adm/style/ajax.js +++ b/phpBB/adm/style/ajax.js @@ -7,8 +7,8 @@ * a forum is moved up. It moves the row up or down, and deactivates / * activates any up / down icons that require it (the ones at the top or bottom). */ -phpbb.add_ajax_callback('forum_down', function(el) { - el = $(el); +phpbb.add_ajax_callback('forum_down', function() { + el = $(this); var tr = el.parents('tr'); if (tr.is(':first-child')) { @@ -23,8 +23,8 @@ phpbb.add_ajax_callback('forum_down', function(el) { tr.prev().find('.down').html('Move down'); phpbb.ajaxify({selector: tr.prev().find('.down').children('a')}, false, 'forum_down'); } -}).add_ajax_callback('forum_up', function(el) { - el = $(el); +}).add_ajax_callback('forum_up', function() { + el = $(this); var tr = el.parents('tr'); if (tr.is(':last-child')) { @@ -46,8 +46,8 @@ phpbb.add_ajax_callback('forum_down', function(el) { * It does this by replacing the text, and replacing all instances of "activate" * in the href with "deactivate", and vice versa. */ -phpbb.add_ajax_callback('act_deact', function(el, res) { - el = $(el); +phpbb.add_ajax_callback('act_deact', function(res) { + el = $(this); el.text(res.text); var new_href = el.attr('href'); if (new_href.indexOf('deactivate') !== -1) @@ -65,9 +65,8 @@ phpbb.add_ajax_callback('act_deact', function(el, res) { * The removes the parent row of the link or form that triggered the callback, * and is good for stuff like the removal of forums. */ -phpbb.add_ajax_callback('row_delete', function(el) { - var tr = $(el).parents('tr'); - tr.remove(); +phpbb.add_ajax_callback('row_delete', function() { + $(this).parents('tr').remove(); }); diff --git a/phpBB/assets/javascript/core.js b/phpBB/assets/javascript/core.js index a1447af491..a8ccad863f 100644 --- a/phpBB/assets/javascript/core.js +++ b/phpBB/assets/javascript/core.js @@ -265,7 +265,7 @@ phpbb.ajaxify = function(options, refresh, callback) { if (typeof phpbb.ajax_callbacks[callback] === 'function') { - phpbb.ajax_callbacks[callback](that, res, (is_form) ? act : null); + phpbb.ajax_callbacks[callback].call(that, res, (is_form) ? act : null); } if (res.REFRESH_DATA) @@ -322,7 +322,7 @@ phpbb.ajaxify = function(options, refresh, callback) { data += '&' + this.name + '=' + this.value; } - if (run_exception && options.exception($this.parents('form'), action, data)) + if (run_exception && options.exception.call($this.parents('form')[0], action, data)) { return true; } @@ -331,7 +331,7 @@ phpbb.ajaxify = function(options, refresh, callback) { } else { - if (run_exception && options.exception($this)) + if (run_exception && options.exception.call(this)) { return true; } diff --git a/phpBB/styles/prosilver/template/ajax.js b/phpBB/styles/prosilver/template/ajax.js index b24ab6d4d7..67feaa90b1 100644 --- a/phpBB/styles/prosilver/template/ajax.js +++ b/phpBB/styles/prosilver/template/ajax.js @@ -2,38 +2,38 @@ //This callback finds the post from the delete link, and removes it. -phpbb.add_ajax_callback('post_delete', function(el) { - if ($(this).data('refresh') === undefined) +phpbb.add_ajax_callback('post_delete', function() { + var el = $(this); + if (el.data('refresh') === undefined) { - var pid = el.href.split('&p=')[1]; - $(el).parents('div #p' + pid).fadeOut(function() { + var pid = el[0].href.split('&p=')[1]; + el.parents('div #p' + pid).fadeOut(function() { $(this).remove(); }); } }); // This callback removes the approve / disapprove div or link. -phpbb.add_ajax_callback('post_approve', function(el, res, act) { - $(el).parents((act === 'approve') ? '.rules' : '.post').fadeOut(function() { +phpbb.add_ajax_callback('post_approve', function(res, act) { + $(this).parents((act === 'approve') ? '.rules' : '.post').fadeOut(function() { $(this).remove(); }); }); // This callback handles the removal of the quick reply form. -phpbb.add_ajax_callback('qr-submit', function(el) { - $(el).parents('form').fadeOut(function() { +phpbb.add_ajax_callback('qr-submit', function() { + $(this).parents('form').fadeOut(function() { $(this).remove(); }); }); // This removes the parent row of the link or form that fired the callback. -phpbb.add_ajax_callback('row_delete', function(el) { - var tr = $(el).parents('tr'); - tr.remove(); +phpbb.add_ajax_callback('row_delete', function() { + $(this).parents('tr').remove(); }); // This handles friend / foe additions removals. -phpbb.add_ajax_callback('zebra', function(el, res) { +phpbb.add_ajax_callback('zebra', function(res) { if (res.success) { var zebra = $('.zebra'); zebra.html(res.MESSAGE_TEXT); @@ -61,11 +61,11 @@ $('[data-ajax]').each(function() { */ phpbb.ajaxify({ selector: '#quickmodform', - exception: function(el, act, data) { + exception: function(act, data) { var action = phpbb.parse_querystring(data).action; if (action === 'make_normal') { - return !(el.find('select option[value="make_global"]').length); + return !($(this).find('select option[value="make_global"]').length); } else if (action.slice(-4) === 'lock') {