-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathindex.php
executable file
·243 lines (222 loc) · 10.1 KB
/
index.php
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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
<?php
/**
* 一款简约的相册主题
* @package 洪墨时光
* @author zhheo
* @version 2.13
* @link https://zhheo.com/
*/
?>
<!DOCTYPE html>
<html>
<head>
<title><?php $this->options->IndexName(); ?> - <?php $this->options->Indexdict() ?> </title>
<meta http-equiv="content-type" content="text/html; charset=<?php $this->options->charset(); ?>" />
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" />
<meta name="keywords" content="<?php $this->options->keywords(); ?>" />
<meta name="description" content="<?php $this->options->description(); ?>" />
<link rel="apple-touch-icon" href="<?php $this->options->AppleIcon(); ?>">
<meta name="apple-mobile-web-app-title" content="<?php $this->options->IndexName(); ?>">
<link rel="bookmark" href="<?php $this->options->AppleIcon(); ?>">
<link rel="apple-touch-icon-precomposed" sizes="180x180" href="<?php $this->options->AppleIcon(); ?>">
<link rel="icon" href="<?php $this->options->IconUrl() ?>">
<link rel="stylesheet" type="text/css" href="<?php $this->options->themeUrl('assets/css/main.css'); ?>" />
<link rel="stylesheet" type="text/css" href="<?php $this->options->themeUrl('assets/css/noscript.css'); ?>" />
<noscript>
<link rel="stylesheet" href="<?php $this->options->themeUrl('assets/css/noscript.css'); ?>" />
</noscript>
<link rel="stylesheet" href="<?php $this->options->themeUrl('assets/css/main.css'); ?>" />
<link rel="stylesheet" href="https://cdn3.codesign.qq.com/icons/dDyopjDLkGjVe1g/latest/iconfont.css">
</head>
<body class="is-preload">
<header id="header">
<a href="<?php $this->options->siteUrl(); ?>"><img class="site-logo" src="<?php $this->options->IconUrl(); ?>"></a>
<h1><a href="<?php $this->options->siteUrl(); ?>"><strong><?php $this->options->zmkiabout() ?></strong></h1></a>
<span class="discription"><?php $this->options->zmkiabouts() ?></span>
<nav>
<ul class="nav_links">
<li class='nav-item'>
<a class="icon solid fa-info-circle nav-item-name">分类</a>
<ul class="nav-item-child">
<?php
$categories = \Widget\Metas\Category\Rows::alloc()->listCategories();
echo '<li class="category-level-0 category-parent"><a style="cursor: pointer;" href="/">全部</a></li>';
if ($categories) {
foreach ($categories as $category) {
echo '<li class="category-level-0 category-parent"><a style="cursor: pointer;">' . $category . '</a></li>';
}
}
?>
</ul>
</li>
<li><a type="button" id="fullscreen" class="btn btn-default visible-lg visible-md" alt="切换全屏">
<i class="iconfont icon-quanping"></i>
<use xlink:href="#icon-zmki-ziyuan-copy"></use>
</svg></a></li>
<li><a href="#footer">关于</a></li>
</ul>
</nav>
</header>
<!-- Wrapper -->
<div id="wrapper">
<!-- Header -->
<!-- Main -->
<div id="main">
<?php while ($this->next()): ?>
<article class="thumb img-area">
<a class="image my-photo" alt="loading"
href="<?php echo $this->fields->img(); ?><?php $this->options->zmki_sy() ?>">
<img class="zmki_px my-photo"
onerror="this.src='<?php $this->options->themeUrl('assets/img/loading.gif'); ?>';this.onerror=null"
data-src="<?php echo $this->fields->img(); ?><?php $this->options->zmki_ys() ?>" />
</a>
<h2><?php $this->title() ?></h2>
<?php if($this->content): ?>
<div class="content-wrapper">
<p><?php $this->content('内容加载中...'); ?></p>
</div>
<?php endif; ?>
<li class="tag-info tag-info-bottom">
<?php if($this->fields->device): ?>
<span class="tag-device"><i class="iconfont icon-camera-lens-line"></i><?php echo $this->fields->device(); ?></span>
<?php endif; ?>
<?php if($this->fields->location): ?>
<span class="tag-location"><i class="iconfont icon-map-pin-2-line"></i><?php echo $this->fields->location(); ?></span>
<?php endif; ?>
<span class="tag-time"><i class="iconfont icon-time-line"></i><?php $this->date(); ?></span>
</li>
<li class="tag-info">
<span class="tag-categorys"><?php $this->category(''); ?></span>
<?php if($this->tags): ?>
<span class="tag-list"><?php $this->tags(); ?></span>
<?php endif; ?>
</li>
</article>
<?php endwhile; ?>
<!-- 分页导航 -->
<div class="pagination-container">
<?php
$total = ceil($this->getTotal() / $this->parameter->pageSize);
$current = $this->_currentPage;
$max_pages = 6; // 最多显示的页码数
// 计算显示的页码范围
$start = max(1, min($current - floor($max_pages/2), $total - $max_pages + 1));
$end = min($start + $max_pages - 1, $total);
// 上一页按钮
if ($current > 1):
$this->pageLink('<span class="page-btn prev-btn">上一页</span>', 'prev');
endif;
// 页码按钮
for ($i = $start; $i <= $end; $i++):
if ($i == $current): ?>
<span class="page-btn current"><?php echo $i; ?></span>
<?php else: ?>
<a href="<?php $this->options->siteUrl(); ?>index.php/page/<?php echo $i; ?>/" class="page-btn"><?php echo $i; ?></a>
<?php endif;
endfor;
// 下一页按钮
if ($current < $total):
$this->pageLink('<span class="page-btn next-btn">下一页</span>', 'next');
endif; ?>
</div>
<!-- 原有的 load-more div -->
<div id="load-more" data-page="1" data-total-pages="<?php echo $total; ?>"></div>
</div>
<body>
<!-- Footer -->
<footer id="footer" class="panel">
<div id="about">
<section>
<h2>关于<?php $this->options->IndexName() ?></h2>
<p><?php echo $this->options->Biglogo(); ?></p>
</section>
<section>
<h2>联系我</h2>
<ul class="icons">
<li><a class="contact_link" href="<?php $this->options->xxhome() ?>" target="_blank"
rel="noopener nofollow"><i class="iconfont icon-shouye"></i></a></li>
<li><a class="contact_link" href="<?php $this->options->xxweibo() ?>" target="_blank"
rel="noopener nofollow"><i class="iconfont icon-weibo"></i></a></li>
<li><a class="contact_link" href="<?php $this->options->xxgithub() ?> " target="_blank"
rel="noopener nofollow"><i class="iconfont icon-github"></i></a></li>
</ul>
</section>
<span style="color: #b5b5b5; font-size: 0.8em;">
<?php $this->options->cnzz() ?>
<div class="copyright-info">
<span class="copyright">© 设计 ZHHEO & ZMKI</span>
<span class="theme">主题:<a href="https://github.com/zhheo/TimePlus" target="_blank" rel="noopener nofollow">洪墨时光</a></span>
<?php if ($this->options->police): ?>
<span class="police">
<img src="<?php $this->options->themeUrl('assets/img/police.png'); ?>" alt="公安备案" style="vertical-align: middle; width: 14px;">
<a href="https://beian.mps.gov.cn/#/query/webSearch" target="_blank" rel="noopener nofollow"><?php $this->options->police(); ?></a>
</span>
<?php endif; ?>
<?php if ($this->options->icp): ?>
<span class="icp">
<a href="http://beian.miit.gov.cn/" target="_blank" rel="noopener nofollow"><?php $this->options->icp(); ?></a>
</span>
<?php endif; ?>
</div>
</footer>
<script type="text/javascript">
function isInSight(el) {
const bound = el.getBoundingClientRect();
const clientHeight = window.innerHeight;
//如果只考虑向下滚动加载
//const clientWidth=window.innerWeight;
return bound.top <= clientHeight + 100;
}
let index = 0;
function checkImgs() {
const imgs = document.querySelectorAll('.my-photo');
for (let i = index; i < imgs.length; i++) {
if (isInSight(imgs[i])) {
loadImg(imgs[i]);
index = i;
}
}
// Array.from(imgs).forEach(el => {
// if (isInSight(el)) {
// loadImg(el);
// }
// })
}
function loadImg(el) {
if (!el.src) {
const source = el.dataset.src;
el.src = source;
}
}
function throttle(fn, mustRun = 10) {
const timer = null;
let previous = null;
return function () {
const now = new Date();
const context = this;
const args = arguments;
if (!previous) {
previous = now;
}
const remaining = now - previous;
if (mustRun && remaining >= mustRun) {
fn.apply(context, args);
previous = now;
}
}
}
</script>
<script>
window.onload = checkImgs;
window.onscroll = throttle(checkImgs);
</script>
</div>
<!-- Scripts -->
<script src="https://lf26-cdn-tos.bytecdntp.com/cdn/expire-1-M/jquery/1.7.2/jquery.min.js"></script>
<script src="<?php $this->options->themeUrl('assets/js/jquery.poptrox.min.js'); ?>"></script>
<script src="<?php $this->options->themeUrl('assets/js/browser.min.js'); ?>"></script>
<script src="<?php $this->options->themeUrl('assets/js/breakpoints.min.js'); ?>"></script>
<script src="<?php $this->options->themeUrl('assets/js/util.js'); ?>"></script>
<script src="<?php $this->options->themeUrl('assets/js/main.js'); ?>"></script>
</body>
</html>