-
Notifications
You must be signed in to change notification settings - Fork 5
/
Multiverse.php
169 lines (165 loc) · 5.7 KB
/
Multiverse.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
<?php if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
<?php
/**
* Multiverse风格照片集
*
* @package custom
*/
?>
<!-- jsdelivr公共CDN -->
<?php
function usePublicCdn()
{
echo "https://fastly.jsdelivr.net/gh/zzd/photo-page-for-typecho@master";
}
?>
<!-- 公共CDN结束 -->
<!-- 相册图片对象存储供应商,用以加载缩略图 -->
<?php
function storage($storage)
{
if ($storage == "UPYUN") {
echo "!/fw/640/quality/85";
} elseif ($storage == "OSS") {
echo "?x-oss-process=image/resize,w_640/quality,q_85";
} elseif ($storage == "KODO") {
echo "?imageView2/2/w/640/q/85";
} elseif ($storage == "COS") {
echo "?imageView2/2/w/640/q/85";
} else
echo "";
}
?>
<!-- 自动缩略图结束 -->
<!DOCTYPE HTML>
<html>
<head>
<title><?php $this->title() ?> - <?php $this->options->title() ?></title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" />
<link rel="stylesheet" href="<?php usePublicCdn(); ?>/Multiverse/css/main.css" />
<link rel="shortcut icon" href="<?php $this->options->siteUrl(); ?>/favicon.ico">
<noscript>
<link rel="stylesheet" href="<?php usePublicCdn(); ?>/Multiverse/css/noscript.css" /></noscript>
<!-- 百度统计 -->
<script>
var _hmt = _hmt || [];
(function() {
var hm = document.createElement("script");
hm.src = "https://hm.baidu.com/hm.js?76bfe89d3948e8de81935a6a232b2d8c";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();
</script>
<!-- 字体设置 -->
<style>
::-webkit-scrollbar{width:12px;height:12px}
::-webkit-scrollbar-thumb{background:#4a4a4a}
</style>
</head>
<body class="is-preload">
<!-- Wrapper -->
<div id="wrapper">
<!-- Header -->
<header id="header">
<h1><a href="<?php $this->permalink() ?>"><strong><?php $this->title() ?></strong> Powerd by 荒野孤灯</a></h1>
<nav>
<ul>
<li><a href="#footer" class="icon solid fa-info-circle">关于</a></li>
</ul>
</nav>
</header>
<!-- Main -->
<div id="main">
</div>
<!-- Footer -->
<footer id="footer" class="panel">
<div class="inner split">
<div>
<section>
<h2>控制台</h2>
<p>本系统共有<span id="count_CN"></span>张图片,前端样式Multiverse由HTML5UP设计。</p>
<h2>Console</h2>
<p>The system has a total of <span id="count_EN"></span> pictures, style Multiverse is designed by HTML5UP.</p>
</section>
<section>
<ul class="icons">
<?php if ($this->fields->Twitter) : ?>
<li><a href="<?php echo $this->fields->Twitter; ?>" class="icon brands fa-twitter" target="_blank"><span class="label">Twitter</span></a></li>
<?php endif ?>
<?php if ($this->fields->Facebook) : ?>
<li><a href="<?php echo $this->fields->Facebook; ?>" class="icon brands fa-facebook-f" target="_blank"><span class="label">Facebook</span></a></li>
<?php endif ?>
<?php if ($this->fields->Instagram) : ?>
<li><a href="<?php echo $this->fields->Instagram; ?>" class="icon brands fa-instagram" target="_blank"><span class="label">Instagram</span></a></li>
<?php endif ?>
<?php if ($this->fields->GitHub) : ?>
<li><a href="<?php echo $this->fields->GitHub; ?>" class="icon brands fa-github" target="_blank"><span class="label">GitHub</span></a></li>
<?php endif ?>
</ul>
</section>
<p class="copyright">
<!-- 虽说本页面制作容易,但也需要一点点时间编辑,请保留版权信息。 -->
© <?php echo date("Y")?> <a href="<?php $this->options->siteUrl(); ?>"><?php $this->options->title() ?></a> Theme by <a href="https://github.com/zzd/photo-page-for-typecho" rel="nofollow">ZDSR</a> Based HTML5UP</a>.
</p>
</div>
<div>
<section>
<h2>关于<?php $this->title() ?></h2>
<?php if ($this->fields->about) : ?>
<p><?php echo $this->fields->about; ?></p>
<?php else : ?>
<p>在自定义字段内添加about字段,即可编辑此内容,现有内容将自动替换。</p>
<?php endif ?>
</section>
</div>
</div>
</footer>
</div>
<!--
动态读取数据 by ZhangDi
https://github.com/zzd/photo-page-for-typecho
-->
<script type="text/javascript">
var datas =
`<?php
$html = $this->row['text'];
echo $html;
?>`;
datas = datas.split("\n");
for (var i = 0; i < datas.length; i++) {
datas[i] = datas[i].split(",");
}
function creatArticle(datas) {
var parent = document.getElementById("main");
for (var i = 0; i < datas.length; i++) {
var article = document.createElement("article");
article.className = "thumb";
parent.appendChild(article);
var a = document.createElement("a");
a.className = "image";
a.href = datas[i][2];
article.appendChild(a);
var img = document.createElement("img");
img.src = datas[i][2] + "<?php storage($this->fields->CDN); ?>";
a.appendChild(img);
var h2 = document.createElement("h2");
h2.innerHTML = datas[i][0];
article.appendChild(h2);
var p = document.createElement("p");
p.innerHTML = datas[i][1];
article.appendChild(p);
}
}
creatArticle(datas);
document.getElementById("count_EN").innerHTML = document.getElementById("count_CN").innerHTML = datas.length;
</script>
<!-- Scripts -->
<script src="<?php usePublicCdn(); ?>/Multiverse/js/jquery.min.js"></script>
<script src="<?php usePublicCdn(); ?>/Multiverse/js/jquery.poptrox.min.js"></script>
<script src="<?php usePublicCdn(); ?>/Multiverse/js/browser.min.js"></script>
<script src="<?php usePublicCdn(); ?>/Multiverse/js/breakpoints.min.js"></script>
<script src="<?php usePublicCdn(); ?>/Multiverse/js/util.js"></script>
<script src="<?php usePublicCdn(); ?>/Multiverse/js/main.js"></script>
</body>
</html>