-
Notifications
You must be signed in to change notification settings - Fork 128
/
Copy pathArchives.php
74 lines (69 loc) · 2.94 KB
/
Archives.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
<?php
/**
* Archives
*
* @package custom
*
* @author 熊猫小A
* @version 2019-01-17 0.1
*
*/
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
$setting = $GLOBALS['VOIDSetting'];
if(!Utils::isPjax()){
$this->need('includes/head.php');
$this->need('includes/header.php');
}
?>
<main id="pjax-container">
<title hidden>
<?php Contents::title($this); ?>
</title>
<?php $this->need('includes/ldjson.php'); ?>
<?php $this->need('includes/banner.php'); ?>
<div class="wrapper container narrow">
<div class="tag-cloud yue float-up">
<h2>Tags</h2>
<?php $this->widget('Widget_Metas_Tag_Cloud', 'sort=count&ignoreZeroCount=1&desc=1&limit=50')->to($tags); ?>
<?php if($tags->have()): ?>
<?php while ($tags->next()): ?>
<a href="<?php $tags->permalink(); ?>" rel="tag" class="tag-item" title="<?php $tags->count(); ?> 个话题"><?php $tags->name(); ?></a>
<?php endwhile; ?>
<?php else: ?>
<?php echo('还没有标签哦~'); ?>
<?php endif; ?>
</div>
<section id="archive-list" class="yue float-up">
<?php $archives = Contents::archives($this); $index = 0; foreach ($archives as $year => $posts): ?>
<h2><?php echo $year; ?>
<span class="num-posts"><?php $post_num = count($posts); echo $post_num; ?> 篇</span>
<a no-pjax target="_self" data-num="<?php echo $post_num; ?>"
data-year="<?php echo $year; ?>"
class="toggle-archive" href="javascript:void(0);"
onclick="VOID_Ui.toggleArchive(this); return false;"><?php if($index > 0) echo '+'; else echo '-'; ?>
</a>
</h2>
<section id="year-<?php echo $year; ?>"
class="year<?php if($index > 0) echo ' shrink'; ?>"
style="max-height: <?php if($index > 0) echo '0'; else echo $post_num*49; ?>px; transition-duration: <?php echo $post_num * 0.03 > 0.8 ? 0.8:$post_num * 0.03; ?>s">
<ul>
<?php foreach($posts as $created => $post): ?>
<li>
<a class="archive-title<?php if($setting['VOIDPlugin']) echo ' show-word-count'; ?>"
data-words="<?php if($setting['VOIDPlugin']) echo $post['words']; ?>"
href="<?php echo $post['permalink']; ?>">
<span class="date"><?php echo date('m-d', $created); ?></span><?php echo $post['title']; ?>
</a>
</li>
<?php endforeach; ?>
</ul>
</section>
<?php $index = $index + 1; endforeach; ?>
</section>
</div>
</main>
<?php
if(!Utils::isPjax()){
$this->need('includes/footer.php');
}
?>