From 95659ba92c01a3cf4c654568e9a59ba554558a7e Mon Sep 17 00:00:00 2001 From: Callum Macrae Date: Sat, 22 Oct 2011 16:31:52 +0100 Subject: [ticket/10271] Reduced calls to $ in the AJAX JavaScript. PHPBB3-10271 --- phpBB/styles/prosilver/template/ajax.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'phpBB/styles/prosilver/template') diff --git a/phpBB/styles/prosilver/template/ajax.js b/phpBB/styles/prosilver/template/ajax.js index 66b34f7726..4fd4cd32f5 100644 --- a/phpBB/styles/prosilver/template/ajax.js +++ b/phpBB/styles/prosilver/template/ajax.js @@ -35,16 +35,18 @@ phpbb.add_ajax_callback('row_delete', function(el) { // This handles friend / foe additions removals. phpbb.add_ajax_callback('zebra', function(el, res) { if (res.success) { - $('.zebra').html(res.MESSAGE_TEXT); - $($('.zebra').get(1)).remove(); + var zebra = $('.zebra'); + zebra.html(res.MESSAGE_TEXT); + $(zebra.get(1)).remove(); } });; $('[data-ajax]').each(function() { - var fn = ($(this).data('ajax') !== 'true') ? $(this).data('ajax') : null; - phpbb.ajaxify({selector: this}, $(this).data('refresh') !== undefined, fn); + var $this = $(this); + var fn = ($this.data('ajax') !== 'true') ? $this.data('ajax') : null; + phpbb.ajaxify({selector: this}, $this.data('refresh') !== undefined, fn); }); -- cgit v1.2.1