diff options
| author | Callum Macrae <callum@lynxphp.com> | 2011-10-22 17:18:09 +0100 |
|---|---|---|
| committer | Igor Wiedler <igor@wiedler.ch> | 2012-03-31 02:09:21 +0200 |
| commit | 03d4ae20d1fc98b43edfdf26ae2a2379e52b3182 (patch) | |
| tree | b5ce17b71441dc59faefda217a36655c48babf39 /phpBB/styles/prosilver/template | |
| parent | e0d6814772ce8f7d7f27ecaba66b5ee15b8f9e29 (diff) | |
| download | forums-03d4ae20d1fc98b43edfdf26ae2a2379e52b3182.tar forums-03d4ae20d1fc98b43edfdf26ae2a2379e52b3182.tar.gz forums-03d4ae20d1fc98b43edfdf26ae2a2379e52b3182.tar.bz2 forums-03d4ae20d1fc98b43edfdf26ae2a2379e52b3182.tar.xz forums-03d4ae20d1fc98b43edfdf26ae2a2379e52b3182.zip | |
[ticket/10271] Started using .call for javascript callbacks.
Previously, they were just being called by appending parentheses and
functions. Now, they're being called and the element is being set as the
context instead of a parameter. It's a lot cleaner.
PHPBB3-10271
Diffstat (limited to 'phpBB/styles/prosilver/template')
| -rw-r--r-- | phpBB/styles/prosilver/template/ajax.js | 28 |
1 files changed, 14 insertions, 14 deletions
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') { |
