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/adm/style/ajax.js | |
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/adm/style/ajax.js')
-rw-r--r-- | phpBB/adm/style/ajax.js | 17 |
1 files changed, 8 insertions, 9 deletions
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('<a href="' + tr.data('down') + '"><img src="./images/icon_down.gif" alt="Move down" title="Move down" /></a>'); 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(); }); |