diff options
author | Callum Macrae <callum@lynxphp.com> | 2011-10-22 16:16:15 +0100 |
---|---|---|
committer | Igor Wiedler <igor@wiedler.ch> | 2012-03-31 02:09:19 +0200 |
commit | 1c5b1ede1c35d57e9abfb62bdee145828011b1b0 (patch) | |
tree | b91c2c5c57a4ecc0057cdd67f9d909a08bbf10f4 /phpBB/adm/style/ajax.js | |
parent | 7f338971542424a85242287758f752f4f873e7f3 (diff) | |
download | forums-1c5b1ede1c35d57e9abfb62bdee145828011b1b0.tar forums-1c5b1ede1c35d57e9abfb62bdee145828011b1b0.tar.gz forums-1c5b1ede1c35d57e9abfb62bdee145828011b1b0.tar.bz2 forums-1c5b1ede1c35d57e9abfb62bdee145828011b1b0.tar.xz forums-1c5b1ede1c35d57e9abfb62bdee145828011b1b0.zip |
[ticket/10271] Added comments to AJAX callbacks.
PHPBB3-10271
Diffstat (limited to 'phpBB/adm/style/ajax.js')
-rw-r--r-- | phpBB/adm/style/ajax.js | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/phpBB/adm/style/ajax.js b/phpBB/adm/style/ajax.js index 407ef92110..1c315eeeff 100644 --- a/phpBB/adm/style/ajax.js +++ b/phpBB/adm/style/ajax.js @@ -1,7 +1,12 @@ (function($) { // Avoid conflicts with other libraries - +/** + * The following callbacks are for reording forums in acp_forums. forum_down + * is triggered when a forum is moved down, and forum_up is triggered when + * 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) { var tr = $(el).parents('tr'); if (tr.is(':first-child')) @@ -32,7 +37,14 @@ phpbb.add_ajax_callback('forum_down', function(el) { tr.next().find('.up').html('<a href="' + tr.data('up') + '"><img src="./images/icon_up.gif" alt="Move up" title="Move up" /></a>'); phpbb.ajaxify({selector: tr.next().find('.up').children('a')}, false, 'forum_up'); } -}).add_ajax_callback('act_deact', function(el, res) { +}); + +/** + * This callback replaces activate links with deactivate links and vice versa. + * 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).text(res.text); var new_href = $(el).attr('href'); if (new_href.indexOf('deactivate') !== -1) @@ -44,7 +56,13 @@ phpbb.add_ajax_callback('forum_down', function(el) { new_href = new_href.replace('activate', 'deactivate') } $(el).attr('href', new_href); -}).add_ajax_callback('row_delete', function(el) { +}); + +/** + * 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(); }); |