Skip to content

Commit

Permalink
✨ 增加众多页面模板的图片/头像懒加载
Browse files Browse the repository at this point in the history
  • Loading branch information
Licoy committed Jan 23, 2023
1 parent 51556b3 commit 30f2495
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion inc/fun/core.php
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ function pk_get_lazy_img_info($origin, $class = '', $width = null, $height = nul
$out .= "class='{$class}' ";
}
} else {
$out = "src='" . pk_get_lazy_pl_img() . "'";
$out = "src='" . pk_get_lazy_pl_img() . "' ";
$out .= "class='lazy " . $class . "' ";
if ($thumbnail) {
$out .= "data-src='" . pk_get_img_thumbnail_src($origin, $width, $height) . "'";
Expand Down
2 changes: 1 addition & 1 deletion pages/template-book.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<?php foreach ($books as $book): ?>
<li class="col-6 col-sm-4 col-md-3 col-lg-auto">
<a class="shadow" title="<?php echo $book->link_name ?>" data-bs-toggle="tooltip" href="<?php echo pk_go_link($book->link_url) ?>" target="_blank" rel="nofollow">
<img class="cover" src="<?php echo $book->link_description ?>" alt="<?php echo $book->link_name ?>">
<img <?php echo pk_get_lazy_img_info($book->link_description,'cover') ?> alt="<?php echo $book->link_name ?>">
<p class="puock-text text-nowrap text-truncate t-sm mt-1 w-100 mb-0"><?php echo $book->link_name ?></p>
</a>
</li>
Expand Down
2 changes: 1 addition & 1 deletion pages/template-links.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
rel="<?php echo $link->link_rel ?>" title="<?php echo empty($link->link_notes) ? $link->link_name : $link->link_notes ?>"
data-bs-toggle="tooltip">
<div class="clearfix puock-bg">
<img class="md-avatar" src="<?php echo pk_get_favicon_url($link->link_url) ?>" alt="<?php echo $link->link_name ?>">
<img <?php echo pk_get_lazy_img_info(pk_get_favicon_url($link->link_url),'md-avatar') ?> alt="<?php echo $link->link_name ?>">
<div class="info">
<p class="ml-1 text-nowrap text-truncate"><?php echo $link->link_name ?></p>
<p class="c-sub ml-1 text-nowrap text-truncate"><?php echo empty($link->link_notes) ? '暂无介绍' : $link->link_notes ?></p>
Expand Down
3 changes: 1 addition & 2 deletions pages/template-moments.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ class="col-lg-<?php pk_hide_sidebar_out('12', '8') ?> col-md-12 <?php pk_open_bo
<div class="mt20 p-block puock-text moments-item">
<div class="meta p-flex-sc">
<div class="avatar mr10">
<img class="md-avatar mt-1"
src="<?php echo pk_get_gravatar(get_the_author_meta('email')) ?>"
<img <?php echo pk_get_lazy_img_info(get_avatar_url(get_the_author_meta('email')),'md-avatar mt-1') ?>
alt="<?php the_author_meta('display_name') ?>"
title="<?php the_author_meta('display_name') ?>">
</div>
Expand Down
2 changes: 1 addition & 1 deletion pages/template-reads.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<div class="p-2 text-truncate text-nowrap">
<a href="<?php echo empty($read->url) ? 'javascript:void(0)':pk_go_link($read->url) ?>"
<?php echo empty($read->url) ? '':'target="_blank"' ?> rel="nofollow">
<img data-bs-toggle="tooltip" class="md-avatar" src="<?php echo get_avatar_url($read->mail) ?>"
<img data-bs-toggle="tooltip" <?php echo pk_get_lazy_img_info(get_avatar_url($read->mail),'md-avatar') ?>
title="<?php echo $read->name?>" alt="<?php echo $read->name?>">
<span class="t-sm"><span class="c-sub">+(<?php echo $read->num?>)&nbsp;</span><?php echo $read->name?></span>
</a>
Expand Down

0 comments on commit 30f2495

Please sign in to comment.