perf(feed): lazy load

This commit is contained in:
Anonymous 2024-01-06 21:30:59 +03:00 committed by GitHub
parent d60df69825
commit 64827402ee
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 38 additions and 38 deletions

View file

@ -17,7 +17,7 @@
{/block} {/block}
{block preview} {block preview}
<img src="{$x->getThumbnailURL()}" width="75" alt="{$x->getName(tr('__lang'))}" /> <img src="{$x->getThumbnailURL()}" width="75" alt="{$x->getName(tr('__lang'))}" loading=lazy />
{/block} {/block}
{block name} {block name}
@ -26,4 +26,4 @@
{block description} {block description}
{$x->getDescription(tr("__lang"))} {$x->getDescription(tr("__lang"))}
{/block} {/block}

View file

@ -14,8 +14,8 @@
{block content} {block content}
<div class="gift_grid"> <div class="gift_grid">
<div n:foreach="$gifts as $gift" n:class="gift_sel, !$gift->canUse($thisUser) ? disabled" data-gift="{$gift->getId()}"> <div n:foreach="$gifts as $gift" n:class="gift_sel, !$gift->canUse($thisUser) ? disabled" data-gift="{$gift->getId()}">
<img class="gift_pic" src="{$gift->getImage(2)}" alt="{_gift}" /> <img class="gift_pic" src="{$gift->getImage(2)}" alt="{_gift}" loading=lazy />
<strong class="gift_price"> <strong class="gift_price">
{if $gift->isFree()} {if $gift->isFree()}
{_free_gift} {_free_gift}
@ -23,7 +23,7 @@
{tr('coins', $gift->getPrice())} {tr('coins', $gift->getPrice())}
{/if} {/if}
</strong> </strong>
<strong class="gift_limit"> <strong class="gift_limit">
{if $gift->getUsagesLeft($thisUser) !== INF} {if $gift->getUsagesLeft($thisUser) !== INF}
{tr("gifts_left", $gift->getUsagesLeft($thisUser))} {tr("gifts_left", $gift->getUsagesLeft($thisUser))}
@ -31,7 +31,7 @@
</strong> </strong>
</div> </div>
</div> </div>
<div style="padding: 8px;"> <div style="padding: 8px;">
{include "../components/paginator.xml", conf => (object) [ {include "../components/paginator.xml", conf => (object) [
"page" => $page, "page" => $page,
@ -48,11 +48,11 @@
let el = $(this); let el = $(this);
if(el.hasClass("disabled")) if(el.hasClass("disabled"))
return false; return false;
let link = "/gifts?act=confirm&user={$user->getId()}&pack={$cat->getId()}&elid="; let link = "/gifts?act=confirm&user={$user->getId()}&pack={$cat->getId()}&elid=";
let gift = el.data("gift"); let gift = el.data("gift");
window.location.assign(link + gift); window.location.assign(link + gift);
}); });
</script> </script>
{/block} {/block}

View file

@ -16,7 +16,7 @@
{/block} {/block}
{block preview} {block preview}
<img src="{$x->gift->getImage(2)}" width="75" alt="{_gift}" /> <img src="{$x->gift->getImage(2)}" width="75" alt="{_gift}" loading=lazy />
{/block} {/block}
{block name} {block name}
@ -40,4 +40,4 @@
</tr> </tr>
</tbody> </tbody>
</table> </table>
{/block} {/block}

View file

@ -289,7 +289,7 @@
<img <img
src="{is_null($cover)?'/assets/packages/static/openvk/img/camera_200.png':$cover->getURL()}" src="{is_null($cover)?'/assets/packages/static/openvk/img/camera_200.png':$cover->getURL()}"
style="max-width: 80px; max-height: 54pt;" /> style="max-width: 80px; max-height: 54pt;" loading=lazy />
</div> </div>
<div> <div>
<b><a href="/album{$album->getPrettyId()}">{$album->getName()}</a></b><br> <b><a href="/album{$album->getPrettyId()}">{$album->getName()}</a></b><br>

View file

@ -9,13 +9,13 @@
<a id="act_tab_a" href="javascript:false">{_all_messages}</a> <a id="act_tab_a" href="javascript:false">{_all_messages}</a>
</div> </div>
</div> </div>
<div class="container_gray"> <div class="container_gray">
<form action="/im/search" method="POST" style="margin: 0;"> <form action="/im/search" method="POST" style="margin: 0;">
<input type="text" name="pattern" placeholder="{_search_messages}" required /> <input type="text" name="pattern" placeholder="{_search_messages}" required />
</form> </form>
</div> </div>
{if sizeof($corresps) > 0} {if sizeof($corresps) > 0}
<div class="crp-list"> <div class="crp-list">
<div n:foreach="$corresps as $coresp" <div n:foreach="$corresps as $coresp"
@ -23,10 +23,10 @@
onmousedown="window.location.href = {$coresp->getURL()};" > onmousedown="window.location.href = {$coresp->getURL()};" >
{var $recipient = $coresp->getCorrespondents()[1]} {var $recipient = $coresp->getCorrespondents()[1]}
{var $lastMsg = $coresp->getPreviewMessage()} {var $lastMsg = $coresp->getPreviewMessage()}
<div class="crp-entry--image"> <div class="crp-entry--image">
<img src="{$recipient->getAvatarURL('miniscule')}" <img src="{$recipient->getAvatarURL('miniscule')}"
alt="Фотография пользователя" /> alt="Фотография пользователя" loading=lazy />
</div> </div>
<div class="crp-entry--info"> <div class="crp-entry--info">
<a href="{$recipient->getURL()}">{$recipient->getCanonicalName()}</a><br/> <a href="{$recipient->getURL()}">{$recipient->getCanonicalName()}</a><br/>
@ -34,7 +34,7 @@
</div> </div>
<div n:class="crp-entry--message, $lastMsg->getUnreadState() ? unread"> <div n:class="crp-entry--message, $lastMsg->getUnreadState() ? unread">
{var $_author = $lastMsg->getSender()} {var $_author = $lastMsg->getSender()}
<div class="crp-entry--message---av" n:if="$_author->getId() === $thisUser->getId()"> <div class="crp-entry--message---av" n:if="$_author->getId() === $thisUser->getId()">
<img src="{$_author->getAvatarURL('miniscule')}" <img src="{$_author->getAvatarURL('miniscule')}"
alt="Фотография пользователя" /> alt="Фотография пользователя" />
@ -53,4 +53,4 @@
<br/> <br/>
<center>{_no_messages}</center> <center>{_no_messages}</center>
{/if} {/if}
{/block} {/block}

View file

@ -41,7 +41,7 @@
</a> </a>
<a href="/photo{$photo->getPrettyId()}?from=album{$album->getId()}"> <a href="/photo{$photo->getPrettyId()}?from=album{$album->getId()}">
<img class="album-photo--image" src="{$photo->getURLBySizeId('tinier')}" alt="{$photo->getDescription()}" /> <img class="album-photo--image" src="{$photo->getURLBySizeId('tinier')}" alt="{$photo->getDescription()}" loading=lazy />
</a> </a>
</div> </div>
{/foreach} {/foreach}
@ -50,4 +50,4 @@
{else} {else}
{include "../components/nothing.xml"} {include "../components/nothing.xml"}
{/if} {/if}
{/block} {/block}

View file

@ -23,7 +23,7 @@
{else} {else}
{tr("albums", $count)} {tr("albums", $count)}
{/if} {/if}
<span n:if="$canEdit" style="float: right;"> <span n:if="$canEdit" style="float: right;">
&nbsp;|&nbsp; &nbsp;|&nbsp;
{var $isClub = ($owner instanceof \openvk\Web\Models\Entities\Club)} {var $isClub = ($owner instanceof \openvk\Web\Models\Entities\Club)}
@ -34,7 +34,7 @@
{/block} {/block}
{block actions} {block actions}
{/block} {/block}
{* BEGIN ELEMENTS DESCRIPTION *} {* BEGIN ELEMENTS DESCRIPTION *}
@ -46,9 +46,9 @@
{block preview} {block preview}
{var $cover = $x->getCoverPhoto()} {var $cover = $x->getCoverPhoto()}
{var $preview = is_null($cover) ? "/assets/packages/static/openvk/img/camera_200.png" : $cover->getURLBySizeId("normal")} {var $preview = is_null($cover) ? "/assets/packages/static/openvk/img/camera_200.png" : $cover->getURLBySizeId("normal")}
<a href="/album{$x->getPrettyId()}"> <a href="/album{$x->getPrettyId()}">
<img src="{$preview}" alt="{$x->getName()}" style="height: 130px; width: 170px; object-fit: cover" /> <img src="{$preview}" alt="{$x->getName()}" style="height: 130px; width: 170px; object-fit: cover" loading=lazy />
</a> </a>
{/block} {/block}
@ -61,4 +61,4 @@
<span style="color: grey;">{$x->getPhotosCount()} {_photos}</span><br /> <span style="color: grey;">{$x->getPhotosCount()} {_photos}</span><br />
<span style="color: grey;">{tr("updated_at", $x->getEditTime() ?? $x->getCreationTime())}</span><br /> <span style="color: grey;">{tr("updated_at", $x->getEditTime() ?? $x->getCreationTime())}</span><br />
<span style="color: grey;">{_created} {$x->getCreationTime()}</span><br /> <span style="color: grey;">{_created} {$x->getCreationTime()}</span><br />
{/block} {/block}

View file

@ -22,7 +22,7 @@
{/block} {/block}
{block preview} {block preview}
<img src="{$x->getAvatarUrl('miniscule')}" width="75" alt="Фотография пользователя" /> <img src="{$x->getAvatarUrl('miniscule')}" width="75" alt="Фотография пользователя" loading=lazy />
{/block} {/block}
{block name} {block name}
@ -37,4 +37,4 @@
{/block} {/block}
{block actions} {block actions}
{/block} {/block}

View file

@ -23,7 +23,7 @@
{/block} {/block}
{block preview} {block preview}
<img src="{$x->getAvatarUrl('miniscule')}" width="75" alt="{_photo}" /> <img src="{$x->getAvatarUrl('miniscule')}" width="75" alt="{_photo}" loading=lazy />
{/block} {/block}
{block name} {block name}

View file

@ -97,7 +97,7 @@
{/block} {/block}
{block preview} {block preview}
<img src="{$x->getAvatarUrl('miniscule')}" width="75" alt="Фотография пользователя" /> <img src="{$x->getAvatarUrl('miniscule')}" width="75" alt="Фотография пользователя" loading=lazy />
{/block} {/block}
{block name} {block name}
@ -161,4 +161,4 @@
</form> </form>
{/if} {/if}
{/if} {/if}
{/block} {/block}

View file

@ -48,7 +48,7 @@
{/block} {/block}
{block preview} {block preview}
<img src="{$x->getAvatarUrl('miniscule')}" width="75" alt="Фотография группы" /> <img src="{$x->getAvatarUrl('miniscule')}" width="75" alt="Фотография группы" loading=lazy />
{/block} {/block}
{block name}{/block} {block name}{/block}
@ -128,4 +128,4 @@
</div> </div>
</div> </div>
{/if} {/if}
{/block} {/block}

View file

@ -304,7 +304,7 @@
<img <img
src="{is_null($cover)?'/assets/packages/static/openvk/img/camera_200.png':$cover->getURLBySizeId('small')}" src="{is_null($cover)?'/assets/packages/static/openvk/img/camera_200.png':$cover->getURLBySizeId('small')}"
style="max-width: 80px; max-height: 54pt;" /> style="max-width: 80px; max-height: 54pt;" loading=lazy />
</div> </div>
<div style="overflow: hidden; overflow-wrap: break-word;"> <div style="overflow: hidden; overflow-wrap: break-word;">
<b><a href="/album{$album->getPrettyId()}">{$album->getName()}</a></b><br> <b><a href="/album{$album->getPrettyId()}">{$album->getName()}</a></b><br>
@ -656,7 +656,7 @@
<img style="width: 70px; max-height: 70px;" <img style="width: 70px; max-height: 70px;"
src="{$giftDescriptor->gift->getImage(2)}" src="{$giftDescriptor->gift->getImage(2)}"
alt="{$hideInfo ? tr('gift') : ($giftDescriptor->caption ?? tr('gift'))}" alt="{$hideInfo ? tr('gift') : ($giftDescriptor->caption ?? tr('gift'))}"
title="{$hideInfo ? tr('gift') : ($giftDescriptor->caption ?? tr('gift'))}" /> title="{$hideInfo ? tr('gift') : ($giftDescriptor->caption ?? tr('gift'))}" loading=lazy />
</a> </a>
</div> </div>
</div> </div>

View file

@ -2,7 +2,7 @@
{if !$attachment->isDeleted()} {if !$attachment->isDeleted()}
{var $link = "/photo" . ($attachment->isAnonymous() ? ("s/" . base_convert((string) $attachment->getId(), 10, 32)) : $attachment->getPrettyId())} {var $link = "/photo" . ($attachment->isAnonymous() ? ("s/" . base_convert((string) $attachment->getId(), 10, 32)) : $attachment->getPrettyId())}
<a href="{$link}" onclick="OpenMiniature(event, {$attachment->getURLBySizeId('normal')}, {$parent->getPrettyId()}, {$attachment->getPrettyId()}, {$parentType})"> <a href="{$link}" onclick="OpenMiniature(event, {$attachment->getURLBySizeId('normal')}, {$parent->getPrettyId()}, {$attachment->getPrettyId()}, {$parentType})">
<img class="media media_makima" src="{$attachment->getURLBySizeId('normal')}" alt="{$attachment->getDescription()}" /> <img class="media media_makima" src="{$attachment->getURLBySizeId('normal')}" alt="{$attachment->getDescription()}" loading=lazy />
</a> </a>
{else} {else}
<a href="javascript:alert('{_attach_no_longer_available}');"> <a href="javascript:alert('{_attach_no_longer_available}');">
@ -58,4 +58,4 @@
<span style="color:red;">{_version_incompatibility}</span> <span style="color:red;">{_version_incompatibility}</span>
{/if} {/if}
{php $GLOBALS["_nesAttGloCou"] = NULL} {php $GLOBALS["_nesAttGloCou"] = NULL}

View file

@ -14,7 +14,7 @@
<tr> <tr>
<td width="54" valign="top"> <td width="54" valign="top">
<a href="{$author->getURL()}"> <a href="{$author->getURL()}">
<img src="{$author->getAvatarURL('miniscule')}" class="post-avatar" width="50" /> <img src="{$author->getAvatarURL('miniscule')}" class="post-avatar" width="50" loading=lazy />
<span n:if="!$post->isPostedOnBehalfOfGroup() && !($compact ?? false) && $author->isOnline()" class="post-online">{_online}</span> <span n:if="!$post->isPostedOnBehalfOfGroup() && !($compact ?? false) && $author->isOnline()" class="post-online">{_online}</span>
</a> </a>
</td> </td>
@ -165,4 +165,4 @@
</td> </td>
</tr> </tr>
</tbody> </tbody>
</table> </table>