Move image anchors to the image itself instead of the link

This commit is contained in:
blankie 2023-06-11 11:53:51 +07:00
parent 50e20b2c43
commit d272caa8f2
Signed by: blankie
GPG Key ID: CC15FC822C7F61F5
2 changed files with 4 additions and 4 deletions

View File

@ -8,7 +8,7 @@
"connection": {
"type": "ip",
"address": "127.0.0.1",
"port": 6389,
"port": 6379,
"unix": "/path/to/redis.sock"
},
"username": null,

View File

@ -80,13 +80,13 @@ static inline Element generate_images(const httplib::Request& req, const Config&
const Images& images = illust.images[i];
const Image& thumbnail = images.thumbnail_or_original();
const Image& original = images.original_or_thumbnail();
std::string id = std::to_string(i + 1);
if (show_pages) {
std::string id = std::to_string(i + 1);
div.nodes.push_back(Element("a", {{"class", "landmark"}, {"id", id}, {"href", "#"s + id}}, {id, "/", std::to_string(illust.images.size())}));
div.nodes.push_back(Element("a", {{"class", "landmark"}, {"href", "#"s + id}}, {id, "/", std::to_string(illust.images.size())}));
}
Element img("img", {{"loading", "lazy"}, {"src", proxy_image_url(req, config, thumbnail.url)}}, {});
Element img("img", {{"loading", "lazy"}, {"id", std::move(id)}, {"src", proxy_image_url(req, config, thumbnail.url)}}, {});
if (thumbnail.size) {
img.attributes.push_back({"width", std::to_string(thumbnail.size->first)});
img.attributes.push_back({"height", std::to_string(thumbnail.size->second)});