Lazy load images
This commit is contained in:
		
							parent
							
								
									6e53c7a8e9
								
							
						
					
					
						commit
						3d37733af9
					
				| 
						 | 
				
			
			@ -11,7 +11,7 @@ Element generate_user_header(const User& user, const Config& config) {
 | 
			
		|||
        std::string cover_original = proxy_image_url(config, user.cover_images->original_or_thumbnail());
 | 
			
		||||
        std::string cover_thumbnail = proxy_image_url(config, user.cover_images->thumbnail_or_original());
 | 
			
		||||
        header.nodes.push_back(Element("a", {{"href", std::move(cover_original)}}, {
 | 
			
		||||
            Element("img", {{"class", "cover"}, {"src", std::move(cover_thumbnail)}}, {})
 | 
			
		||||
            Element("img", {{"class", "cover"}, {"loading", "lazy"}, {"src", std::move(cover_thumbnail)}}, {})
 | 
			
		||||
        }));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -19,7 +19,7 @@ Element generate_user_header(const User& user, const Config& config) {
 | 
			
		|||
    std::string profile_picture_thumbnail = proxy_image_url(config, user.profile_pictures.thumbnail_or_original());
 | 
			
		||||
    header.nodes.push_back(Element("div", {{"class", "usermetadata"}}, {
 | 
			
		||||
        Element("a", {{"href", std::move(profile_picture_original)}}, {
 | 
			
		||||
            Element("img", {{"class", "profilepicture"}, {"src", std::move(profile_picture_thumbnail)}}, {})
 | 
			
		||||
            Element("img", {{"class", "profilepicture"}, {"loading", "lazy"}, {"src", std::move(profile_picture_thumbnail)}}, {})
 | 
			
		||||
        }),
 | 
			
		||||
        Element("div", {
 | 
			
		||||
            Element("p", {Element("b", {user.display_name}), " (@", user.username, ")"}),
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue