diff options
author | Igor Wiedler <igor@wiedler.ch> | 2012-02-08 19:02:16 +0100 |
---|---|---|
committer | Igor Wiedler <igor@wiedler.ch> | 2012-03-31 02:09:24 +0200 |
commit | 628074bf7057ad5f9aff929d7c8cd85171ce60b8 (patch) | |
tree | e597dc84afc1a5ce6ac412b7a981f4f9df5dd0d6 /phpBB/adm/style | |
parent | b100bb9a69982221e7244ac74dd1de421b6344bc (diff) | |
download | forums-628074bf7057ad5f9aff929d7c8cd85171ce60b8.tar forums-628074bf7057ad5f9aff929d7c8cd85171ce60b8.tar.gz forums-628074bf7057ad5f9aff929d7c8cd85171ce60b8.tar.bz2 forums-628074bf7057ad5f9aff929d7c8cd85171ce60b8.tar.xz forums-628074bf7057ad5f9aff929d7c8cd85171ce60b8.zip |
[feature/ajax] Stylistic JavaScript adjustments
PHPBB3-10270
Diffstat (limited to 'phpBB/adm/style')
-rw-r--r-- | phpBB/adm/style/ajax.js | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/phpBB/adm/style/ajax.js b/phpBB/adm/style/ajax.js index 50477eef90..2725d9fa0a 100644 --- a/phpBB/adm/style/ajax.js +++ b/phpBB/adm/style/ajax.js @@ -8,8 +8,9 @@ * activates any up / down icons that require it (the ones at the top or bottom). */ phpbb.add_ajax_callback('forum_down', function() { - el = $(this); - var tr = el.parents('tr'); + var el = $(this), + tr = el.parents('tr'); + if (tr.is(':first-child')) { el.parents('span').siblings('.up').html('<a href="' + tr.attr('data-up') + '"><img src="./images/icon_up.gif" alt="Move up" title="Move up" /></a>'); @@ -23,9 +24,12 @@ phpbb.add_ajax_callback('forum_down', function() { tr.prev().find('.down').html('<a href="' + tr.attr('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 = $(this); - var tr = el.parents('tr'); +}); + +phpbb.add_ajax_callback('forum_up', function() { + var el = $(this), + tr = el.parents('tr'); + if (tr.is(':last-child')) { el.parents('span').siblings('.down').html('<a href="' + tr.attr('data-down') + '"><img src="./images/icon_down.gif" alt="Move down" title="Move down" /></a>'); @@ -47,9 +51,9 @@ phpbb.add_ajax_callback('forum_down', function() { * in the href with "deactivate", and vice versa. */ phpbb.add_ajax_callback('activate_deactivate', function(res) { - el = $(this); + var el = $(this), + new_href = el.attr('href'); el.text(res.text); - var new_href = el.attr('href'); if (new_href.indexOf('deactivate') !== -1) { new_href = new_href.replace('deactivate', 'activate') @@ -72,10 +76,13 @@ phpbb.add_ajax_callback('row_delete', function() { $('[data-ajax]').each(function() { - var $this = $(this), ajax = $this.attr('data-ajax'); + var $this = $(this), + ajax = $this.attr('data-ajax'), + fn; + if (ajax !== 'false') { - var fn = (ajax !== 'true') ? ajax : null; + fn = (ajax !== 'true') ? ajax : null; phpbb.ajaxify({selector: this}, $this.attr('data-refresh') !== undefined, fn); } }); |