added lazy image loading for search page
This commit is contained in:
+10
-10
@@ -276,7 +276,7 @@ class frontend{
|
||||
|
||||
$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){
|
||||
|
||||
@@ -499,7 +499,7 @@ class frontend{
|
||||
$payload =
|
||||
'<div class="url">' .
|
||||
'<button class="favicon" tabindex="-1">' .
|
||||
'<img src="/favicon?s=404" alt="xx">' .
|
||||
'<img loading="lazy" src="/favicon?s=404" alt="xx">' .
|
||||
'</button>';
|
||||
}else{
|
||||
|
||||
@@ -528,18 +528,18 @@ class frontend{
|
||||
$payload =
|
||||
'<div class="url">' .
|
||||
'<button class="favicon" tabindex="-1">' .
|
||||
'<img src="/favicon?s=' . htmlspecialchars($host["scheme"] . "://" . $host["host"]) . '" alt="' . htmlspecialchars($esc) . '">' .
|
||||
//'<img src="/404.php" alt="' . htmlspecialchars($esc) . '">' .
|
||||
'<img loading="lazy" src="/favicon?s=' . htmlspecialchars($host["scheme"] . "://" . $host["host"]) . '" alt="' . htmlspecialchars($esc) . '">' .
|
||||
//'<img loading="lazy" src="/404.php" alt="' . htmlspecialchars($esc) . '">' .
|
||||
'</button>' .
|
||||
'<div class="favicon-dropdown">';
|
||||
|
||||
$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://archive.ph/newest/' . htmlspecialchars($link) . '" class="list" target="_BLANK"><img 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://arquivo.pt/wayback/' . htmlspecialchars($link) . '" class="list" target="_BLANK"><img 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://megalodon.jp/?url=' . $urlencode . '" class="list" target="_BLANK"><img src="/favicon?s=https://megalodon.jp" alt="me">Megalodon</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 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 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 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 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 loading="lazy" src="/favicon?s=https://megalodon.jp" alt="me">Megalodon</a>' .
|
||||
'</div>';
|
||||
}
|
||||
|
||||
|
||||
@@ -147,7 +147,7 @@ if(count($results["image"]) !== 0){
|
||||
|
||||
$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">' .
|
||||
'<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(
|
||||
$image["source"][0]["width"] !== null &&
|
||||
@@ -301,7 +301,7 @@ if(count($results["answer"]) !== 0){
|
||||
|
||||
$right["answer"] .=
|
||||
'<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>';
|
||||
}
|
||||
|
||||
@@ -355,7 +355,7 @@ if(count($results["answer"]) !== 0){
|
||||
|
||||
case "image":
|
||||
$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;
|
||||
|
||||
case "audio":
|
||||
@@ -410,7 +410,7 @@ if(count($results["answer"]) !== 0){
|
||||
$right["answer"] .=
|
||||
'<a href="' . htmlspecialchars($url) . '" rel="noreferrer nofollow" tabindex="-1">' .
|
||||
'<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>' .
|
||||
'</a>';
|
||||
|
||||
Reference in New Issue
Block a user