1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-30 21:40:43 +02:00

[feature/ajax] Stylistic JavaScript adjustments

PHPBB3-10270
This commit is contained in:
Igor Wiedler
2012-02-08 19:02:16 +01:00
parent b100bb9a69
commit 628074bf70
3 changed files with 35 additions and 17 deletions

View File

@@ -3,10 +3,12 @@
// This callback finds the post from the delete link, and removes it.
phpbb.add_ajax_callback('post_delete', function() {
var el = $(this);
var el = $(this),
post_id;
if (el.attr('data-refresh') === undefined)
{
var post_id = el[0].href.split('&p=')[1];
post_id = el[0].href.split('&p=')[1];
el.parents('#p' + post_id).fadeOut(function() {
$(this).remove();
});
@@ -34,20 +36,25 @@ phpbb.add_ajax_callback('row_delete', function() {
// This handles friend / foe additions removals.
phpbb.add_ajax_callback('zebra', function(res) {
var zebra;
if (res.success) {
var zebra = $('.zebra');
zebra = $('.zebra');
zebra.html(res.MESSAGE_TEXT);
$(zebra.get(1)).remove();
}
});;
});
$('[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);
}
});