-
Notifications
You must be signed in to change notification settings - Fork 62
Expand file tree
/
Copy pathindex.php
More file actions
executable file
·145 lines (133 loc) · 5.75 KB
/
Copy pathindex.php
File metadata and controls
executable file
·145 lines (133 loc) · 5.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
<?php
/**
*
* 一款简约文艺的文字博客主题,主题事宜请先仔细查阅官方文档,无法解决的优先提issue或在<a href="https://litebbs.com/">轻论坛</a>搜索教程、寻求帮助,论坛邀请码可以找群主获取,QQ交流群:939170079。
* 文档:<a href="https://docs.onenote.io">docs.onenote.io</a>
* 论坛:<a href="https://litebbs.com/">litebbs.com</a>
* 主题效果:<a href="https://onenote.io">onenote.io</a>
*
* @package OneBlog
* @author 彼岸临窗
* @version 3.7.1
* @link https://onenote.io
*/
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
$this->need('header.php'); ?>
<div class="main">
<?php $this->need('module/head.php');
if ($this->is('index')){
//首页显示banner
if ($this->options->switch == 'on') {
$defaultThumb = Helper::options()->themeUrl . '/static/img/bg.jpg';
$defaultPost = [
'link' => 'https://onenote.io',
'title' => '请填写文章cid',
'thumb' => $defaultThumb,
];
$posts = [];
$rawData = get_banner_data($this->options);
foreach ($rawData as $row) {
$post = Typecho_Widget::widget('Widget_Abstract_Contents');
$post->push($row);
$thumbnailRaw = showThumbnail($post) ?: $defaultThumb;
// 如果有缩略图处理参数
if ($thumbnailRaw !== $defaultThumb && $this->options->imgSmall) {
$thumbnail = $thumbnailRaw . $this->options->imgSmall;
} else {
$thumbnail = $thumbnailRaw;
}
$posts[] = [
'link' => $post->permalink,
'title' => $post->hidden ? '密码保护:' . $post->row['title'] : $post->row['title'],
'thumb' => $thumbnail,
];
}
// 如果数量不足3,用默认占位
for ($i = count($posts); $i < 3; $i++) {
$posts[] = $defaultPost;
}?>
<!-- 骨架屏 -->
<div id="banner-skeleton">
<!-- 移动端骨架屏 -->
<div class="banner-skeleton-mobile m">
<div class="skeleton-banner-thumb-mobile skeleton-thumb-relative">
<div class="skeleton-banner-indicator">
<span class="skeleton-dot"></span>
<span class="skeleton-dot"></span>
<span class="skeleton-dot"></span>
</div>
</div>
</div>
<!-- PC端骨架屏 -->
<div class="banner-skeleton-pc">
<div class="skeleton-banner-item-main">
<div class="skeleton-banner-thumb-main"></div>
</div>
<div class="skeleton-banner-item-side">
<div class="skeleton-banner-thumb-side"></div>
<div class="skeleton-banner-thumb-side"></div>
</div>
</div>
</div>
<!-- 根据设备类型自动生成banner内容 -->
<div class="banner-container blur"></div>
<script id="banner-json" type="application/json">
<?= json_encode($posts, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES); ?>
</script>
<?php }
}elseif($this->is('tag')){ ?>
<div class="category-header m blur" style="background-image: url('<?php $this->options->Tagbg();?>');">
<div class="category-info">
<h1># <?php $this->archiveTitle('%s', '', ''); ?></h1>
</div>
</div>
<?php }elseif($this->is('category')){?>
<div class="category-header m blur" style="background-image: url('<?php $info = CatInfo($this->getDescription()); echo $info['img']; ?>');">
<div class="category-info">
<h1><?php $this->archiveTitle('%s', '', ''); ?></h1>
<span><?php echo $info['info']; ?></span>
</div>
</div>
<?php }elseif($this->is('search') and $this->have()){?>
<div class="search-title m blur">
<span>「<?php $this->archiveTitle('%s', '', ''); ?>」</span>相关的<?php echo $this->getTotal().'篇文章';?>
</div>
<?php }?>
<?php if ($this->have()): ?>
<!--文章列表-->
<div id="posts" class="blur">
<?php while($this->next()): ?>
<a href="<?php $this->permalink() ?>" class="post" >
<h1 class="animate__animated animate__fadeInUp">
<?php echo $this->hidden ? '密码保护:' . $this->row['title'] : $this->row['title'];?>
</h1>
<div class="post_preview animate__animated animate__fadeInUp">
<p><?php $this->excerpt(80,'...'); ?></p>
<?php if(showThumbnail($this)):?>
<div class="post_img lazy-load" data-src="<?php echo showThumbnail($this) . ($this->options->imgSmall ?: ''); ?>">
</div>
<?php endif;?>
</div>
<div class="post_meta animate__animated animate__fadeInUp">
<span><?php echo time_ago($this->date); ?></span>
<span><?php get_post_view($this) ?> 阅读</span>
<span><?php $this->commentsNum('0 评论', '1 评论', '%d 评论'); ?></span>
</div>
</a>
<?php endwhile; ?>
</div>
<!--点击无限加载-->
<div class="load blur" id="loadmore">
<?php $this->pageLink('点击查看更多','next'); ?>
</div>
<?php else: ?>
<div class="nodata blur">
<img src='<?php $this->options->themeUrl('static/img/nodata.svg'); ?>'></img>
<span>暂无相关内容</span>
<a href="<?php $this->options->siteUrl(); ?>">返回首页</a>
</div>
<?php endif; ?>
</div>
<!--返回顶部-->
<a id="gototop" class="hidden pc"><i class="iconfont icon-up"></i></a>
<?php $this->need('footer.php'); ?>