From be1d1c7d05a0b0dec259da967e2ed277fb8f632f Mon Sep 17 00:00:00 2001 From: Callum Macrae Date: Thu, 28 May 2015 18:05:07 +0200 Subject: [ticket/13882] Lazy load the notification avatars. This moves them further down the waterfall, making the page load quicker. PHPBB3-13882 --- phpBB/assets/javascript/core.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'phpBB/assets/javascript') diff --git a/phpBB/assets/javascript/core.js b/phpBB/assets/javascript/core.js index 9eb931270a..819e9329a4 100644 --- a/phpBB/assets/javascript/core.js +++ b/phpBB/assets/javascript/core.js @@ -1612,6 +1612,18 @@ phpbb.registerPageDropdowns = function() { }); }; +phpbb.lazyLoadAvatars = function loadAvatars() { + $('.avatar[data-src]').each(function () { + var $avatar = $(this); + + $avatar + .attr('src', $avatar.data('src')) + .removeAttr('data-src'); + }); +}; + +$(window).load(phpbb.lazyLoadAvatars); + /** * Apply code editor to all textarea elements with data-bbcode attribute */ -- cgit v1.2.1