added lazy image loading for search page

This commit is contained in:
2026-05-22 04:12:48 -05:00
parent 9c2921c7fa
commit 05acab174f
2 changed files with 14 additions and 14 deletions
+10 -10
View File
@@ -276,7 +276,7 @@ class frontend{
$payload .= $payload .=
'">' . '">' .
'<img class="thumb" src="' . $this->htmlimage($site["thumb"]["url"], $size) . '" alt="thumb">'; '<img loading="lazy" class="thumb" src="' . $this->htmlimage($site["thumb"]["url"], $size) . '" alt="thumb">';
if($duration !== null){ if($duration !== null){
@@ -499,7 +499,7 @@ class frontend{
$payload = $payload =
'<div class="url">' . '<div class="url">' .
'<button class="favicon" tabindex="-1">' . '<button class="favicon" tabindex="-1">' .
'<img src="/favicon?s=404" alt="xx">' . '<img loading="lazy" src="/favicon?s=404" alt="xx">' .
'</button>'; '</button>';
}else{ }else{
@@ -528,18 +528,18 @@ class frontend{
$payload = $payload =
'<div class="url">' . '<div class="url">' .
'<button class="favicon" tabindex="-1">' . '<button class="favicon" tabindex="-1">' .
'<img src="/favicon?s=' . htmlspecialchars($host["scheme"] . "://" . $host["host"]) . '" alt="' . htmlspecialchars($esc) . '">' . '<img loading="lazy" src="/favicon?s=' . htmlspecialchars($host["scheme"] . "://" . $host["host"]) . '" alt="' . htmlspecialchars($esc) . '">' .
//'<img src="/404.php" alt="' . htmlspecialchars($esc) . '">' . //'<img loading="lazy" src="/404.php" alt="' . htmlspecialchars($esc) . '">' .
'</button>' . '</button>' .
'<div class="favicon-dropdown">'; '<div class="favicon-dropdown">';
$payload .= $payload .=
'<a href="https://web.archive.org/web/' . $urlencode . '" class="list" target="_BLANK"><img src="/favicon?s=https://archive.org" alt="ar">Archive.org</a>' . '<a href="https://web.archive.org/web/' . $urlencode . '" class="list" target="_BLANK"><img loading="lazy" src="/favicon?s=https://archive.org" alt="ar">Archive.org</a>' .
'<a href="https://archive.ph/newest/' . htmlspecialchars($link) . '" class="list" target="_BLANK"><img src="/favicon?s=https://archive.is" alt="ar">Archive.is</a>' . '<a href="https://archive.ph/newest/' . htmlspecialchars($link) . '" class="list" target="_BLANK"><img loading="lazy" src="/favicon?s=https://archive.is" alt="ar">Archive.is</a>' .
'<a href="https://ghostarchive.org/search?term=' . $urlencode . '" class="list" target="_BLANK"><img src="/favicon?s=https://ghostarchive.org" alt="gh">Ghostarchive</a>' . '<a href="https://ghostarchive.org/search?term=' . $urlencode . '" class="list" target="_BLANK"><img loading="lazy" src="/favicon?s=https://ghostarchive.org" alt="gh">Ghostarchive</a>' .
'<a href="https://arquivo.pt/wayback/' . htmlspecialchars($link) . '" class="list" target="_BLANK"><img src="/favicon?s=https://arquivo.pt" alt="ar">Arquivo.pt</a>' . '<a href="https://arquivo.pt/wayback/' . htmlspecialchars($link) . '" class="list" target="_BLANK"><img loading="lazy" src="/favicon?s=https://arquivo.pt" alt="ar">Arquivo.pt</a>' .
'<a href="https://www.bing.com/search?q=url%3A' . $urlencode . '" class="list" target="_BLANK"><img src="/favicon?s=https://bing.com" alt="bi">Bing cache</a>' . '<a href="https://www.bing.com/search?q=url%3A' . $urlencode . '" class="list" target="_BLANK"><img loading="lazy" src="/favicon?s=https://bing.com" alt="bi">Bing cache</a>' .
'<a href="https://megalodon.jp/?url=' . $urlencode . '" class="list" target="_BLANK"><img src="/favicon?s=https://megalodon.jp" alt="me">Megalodon</a>' . '<a href="https://megalodon.jp/?url=' . $urlencode . '" class="list" target="_BLANK"><img loading="lazy" src="/favicon?s=https://megalodon.jp" alt="me">Megalodon</a>' .
'</div>'; '</div>';
} }
+4 -4
View File
@@ -147,7 +147,7 @@ if(count($results["image"]) !== 0){
$right["image"] .= $right["image"] .=
'<a class="image" href="' . htmlspecialchars($image["url"]) . '" rel="noreferrer nofollow" title="' . htmlspecialchars($image["title"]) . '" data-json="' . htmlspecialchars(json_encode($image["source"])) . '" tabindex="-1">' . '<a class="image" href="' . htmlspecialchars($image["url"]) . '" rel="noreferrer nofollow" title="' . htmlspecialchars($image["title"]) . '" data-json="' . htmlspecialchars(json_encode($image["source"])) . '" tabindex="-1">' .
'<img src="' . $frontend->htmlimage($image["source"][count($image["source"]) - 1]["url"], "square") . '" alt="thumb">'; '<img loading="lazy" src="' . $frontend->htmlimage($image["source"][count($image["source"]) - 1]["url"], "square") . '" alt="thumb">';
if( if(
$image["source"][0]["width"] !== null && $image["source"][0]["width"] !== null &&
@@ -301,7 +301,7 @@ if(count($results["answer"]) !== 0){
$right["answer"] .= $right["answer"] .=
'<a href="' . htmlspecialchars($answer["thumb"]) . '" rel="noreferrer nofollow" class="photo">' . '<a href="' . htmlspecialchars($answer["thumb"]) . '" rel="noreferrer nofollow" class="photo">' .
'<img src="' . $frontend->htmlimage($answer["thumb"], "cover") . '" alt="thumb" class="openimg">' . '<img loading="lazy" src="' . $frontend->htmlimage($answer["thumb"], "cover") . '" alt="thumb" class="openimg">' .
'</a>'; '</a>';
} }
@@ -355,7 +355,7 @@ if(count($results["answer"]) !== 0){
case "image": case "image":
$right["answer"] .= $right["answer"] .=
'<a href="' . htmlspecialchars($description["url"]) . '" rel="noreferrer nofollow" tabindex="-1"><img src="' . $frontend->htmlimage($description["url"], "thumb") . '" alt="image" class="fullimg openimg"></a>'; '<a href="' . htmlspecialchars($description["url"]) . '" rel="noreferrer nofollow" tabindex="-1"><img loading="lazy" src="' . $frontend->htmlimage($description["url"], "thumb") . '" alt="image" class="fullimg openimg"></a>';
break; break;
case "audio": case "audio":
@@ -410,7 +410,7 @@ if(count($results["answer"]) !== 0){
$right["answer"] .= $right["answer"] .=
'<a href="' . htmlspecialchars($url) . '" rel="noreferrer nofollow" tabindex="-1">' . '<a href="' . htmlspecialchars($url) . '" rel="noreferrer nofollow" tabindex="-1">' .
'<div class="center">' . '<div class="center">' .
'<img src="/static/icon/' . $icon . '.png" alt="icon">' . '<img loading="lazy" src="/static/icon/' . $icon . '.png" alt="icon">' .
'<div class="title">' . $website . '</div>' . '<div class="title">' . $website . '</div>' .
'</div>' . '</div>' .
'</a>'; '</a>';