Skip to content
This repository has been archived by the owner on May 2, 2023. It is now read-only.

Commit

Permalink
minor improvements and upgrade lazysizes
Browse files Browse the repository at this point in the history
  • Loading branch information
EAimTY committed Sep 4, 2020
1 parent 960cf7b commit 7b81a0a
Show file tree
Hide file tree
Showing 8 changed files with 45 additions and 16 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 4.3
- 更新 lazysizes 至 5.2.2,旧版本 lazysizes 存在跨站漏洞,请尽快更新本主题至 4.3 版本及以上
- 为图片懒加载(延迟加载)加入开关,并优化了 img 元素的处理过程
- 现在可以在主题设置中选择未设置 Gravatar 头像的评论者使用的默认头像
- 独立页面不再显示发布日期
## 4.2
- 更新 MDUI 至 v1.0.0
## 4.1.1
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ https://github.com/EAimTY/materiality-typecho-theme
- 严格遵循 Material Design
- 样式简洁,专注于显示文字内容
- Pjax 无刷新加载页面
- 图片懒加载
- 支持图片懒加载
- 可自由切换主题颜色
- 可手动或根据时间(20:00~7:00)自动切换暗色模式
- 可在中文、西文、数字间自动插入空格
Expand Down Expand Up @@ -42,7 +42,7 @@ https://github.com/EAimTY/materiality-typecho-theme
4. 清除浏览器缓存、CDN 缓存与网站 Cookies 以免与之前使用的主题发生冲突

# 版本
4.2
4.3

# 更新日志
[CHANGELOG](https://github.com/EAimTY/materiality-typecho-theme/blob/master/CHANGELOG.md)
Expand Down
4 changes: 2 additions & 2 deletions assets/js/lazysizes.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions comments.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
<div id="<?php $comments->theId(); ?>" class="mdui-card mdui-m-y-3<?php if ($comments->levels > 0) { echo ' comment-child'; $comments->levelsAlt(' comment-level-odd', ' comment-level-even'); } else { echo ' comment-parent'; } $comments->alt(' comment-odd', ' comment-even'); echo $commentClass; ?>">
<div id="<?php $comments->theId(); ?>-anchor" class="anchor"></div>
<div class="mdui-card-header">
<div class="mdui-card-header-avatar"><img class="avatar lazyload" data-src="https://gravatar.loli.net/avatar/<?php echo md5($comments->mail); ?>?s=40&d=monsterid" /></div>
<div class="mdui-card-header-avatar"><img class="avatar" src="https://gravatar.loli.net/avatar/<?php echo md5($comments->mail); ?>?s=40&d=__DEFAULT__GRAVATAR__"></div>
<div name="comment-author" class="mdui-card-header-title mdui-text-color-theme-accent"><?php $comments->author(); ?></div>
<div class="mdui-card-header-subtitle"><?php $comments->date(); ?></div>
</div>
<div class="mdui-card-content mdui-typo"><?php echo preg_replace('/<img src="(.*?)"(.*?)>/', '<img class="lazyload" data-src="$1"$2>', $comments->content); ?></div>
<div class="mdui-card-content mdui-typo"><?php $comments->content(); ?></div>
<?php $comments->reply('<div class="mdui-card-actions" id="reply-' . $comments->theId . '"><button class="mdui-btn mdui-ripple mdui-text-color-theme-accent" onclick="replyComment(\'' . $comments->theId . '\')">回复</button></div>'); ?>
<?php if ($comments->children): ?>
<div class="mdui-container">
Expand All @@ -30,7 +30,11 @@
<div class="mdui-hidden" id="respondid"><?php $this->respondId(); ?></div>
<?php $this->comments()->to($comments); ?>
<?php if ($comments->have()): ?>
<?php ob_start(); ?>
<?php $comments->listComments(['before' => '', 'after' => '']); ?>
<?php $commentsHTML = ob_get_contents(); ?>
<?php ob_end_clean(); ?>
<?php echo str_replace('__DEFAULT__GRAVATAR__', $this->options->defaultGravatar, $commentsHTML); ?>
<?php endif; ?>
<?php if($this->allow('comment')): ?>
<div id="<?php $this->respondId(); ?>">
Expand Down
2 changes: 1 addition & 1 deletion footer.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,4 @@
</body>
<?php $this->footer(); ?>
</html>
<?php outputEnd(in_array('pangu', $this->options->feature), in_array('compressHTML', $this->options->feature)); ?>
<?php outputEnd(in_array('pangu', $this->options->feature), in_array('compressHTML', $this->options->feature), in_array('lazyLoad', $this->options->feature)); ?>
Loading

0 comments on commit 7b81a0a

Please sign in to comment.