diff options
| author | outtime <i@timewk.cn> | 2019-12-19 13:48:42 +0800 |
|---|---|---|
| committer | outtime <i@timewk.cn> | 2019-12-19 13:48:42 +0800 |
| commit | 467366b3788943eefbbd0c18fabbe23ac5692376 (patch) | |
| tree | e6690c99c293961fd25305891754a89de12e7813 | |
| parent | 71ff6eadc03c481acf0088b61eb14b79160e7d37 (diff) | |
🍭Add:添加蹦跶的颜文字与建站时间项,同时优化了部分代码
| -rw-r--r-- | assets/css/main/special.css | 249 | ||||
| -rw-r--r-- | assets/js/miracles.min.js | 28 | ||||
| -rw-r--r-- | functions.php | 14 | ||||
| -rw-r--r-- | includes/footer.php | 46 | ||||
| -rw-r--r-- | includes/head.php | 17 | ||||
| -rw-r--r-- | libs/Options.php | 13 |
6 files changed, 325 insertions, 42 deletions
diff --git a/assets/css/main/special.css b/assets/css/main/special.css index 6b3c342..1ae2867 100644 --- a/assets/css/main/special.css +++ b/assets/css/main/special.css @@ -243,4 +243,253 @@ iframe[src*="//player.bilibili.com/player.html"] { }
.fadein {
opacity: 1;
+}
+/*底部动画字符*/
+.anime-face {
+ animation: anime-face 5s infinite ease-in-out;
+ display: inline-block;
+ margin: 0 5px;
+}
+@-webkit-keyframes anime-face {
+ 2%,24%,80% {
+ -webkit-transform: translate(0,1.5px) rotate(1.5deg);
+ transform: translate(0,1.5px) rotate(1.5deg)
+ }
+
+ 4%,68%,98% {
+ -webkit-transform: translate(0,-1.5px) rotate(-.5deg);
+ transform: translate(0,-1.5px) rotate(-.5deg)
+ }
+
+ 38%,6% {
+ -webkit-transform: translate(0,1.5px) rotate(-1.5deg);
+ transform: translate(0,1.5px) rotate(-1.5deg)
+ }
+
+ 8%,86% {
+ -webkit-transform: translate(0,-1.5px) rotate(-1.5deg);
+ transform: translate(0,-1.5px) rotate(-1.5deg)
+ }
+
+ 10%,72% {
+ -webkit-transform: translate(0,2.5px) rotate(1.5deg);
+ transform: translate(0,2.5px) rotate(1.5deg)
+ }
+
+ 12%,64%,78%,96% {
+ -webkit-transform: translate(0,-.5px) rotate(1.5deg);
+ transform: translate(0,-.5px) rotate(1.5deg)
+ }
+
+ 14%,54% {
+ -webkit-transform: translate(0,-1.5px) rotate(1.5deg);
+ transform: translate(0,-1.5px) rotate(1.5deg)
+ }
+
+ 16% {
+ -webkit-transform: translate(0,-.5px) rotate(-1.5deg);
+ transform: translate(0,-.5px) rotate(-1.5deg)
+ }
+
+ 18%,22% {
+ -webkit-transform: translate(0,.5px) rotate(-1.5deg);
+ transform: translate(0,.5px) rotate(-1.5deg)
+ }
+
+ 20%,36%,46% {
+ -webkit-transform: translate(0,-1.5px) rotate(2.5deg);
+ transform: translate(0,-1.5px) rotate(2.5deg)
+ }
+
+ 26%,50% {
+ -webkit-transform: translate(0,.5px) rotate(.5deg);
+ transform: translate(0,.5px) rotate(.5deg)
+ }
+
+ 28% {
+ -webkit-transform: translate(0,.5px) rotate(1.5deg);
+ transform: translate(0,.5px) rotate(1.5deg)
+ }
+
+ 30%,40%,62%,76%,88% {
+ -webkit-transform: translate(0,-.5px) rotate(2.5deg);
+ transform: translate(0,-.5px) rotate(2.5deg)
+ }
+
+ 32%,34%,66% {
+ -webkit-transform: translate(0,1.5px) rotate(-.5deg);
+ transform: translate(0,1.5px) rotate(-.5deg)
+ }
+
+ 42% {
+ -webkit-transform: translate(0,2.5px) rotate(-1.5deg);
+ transform: translate(0,2.5px) rotate(-1.5deg)
+ }
+
+ 44%,70% {
+ -webkit-transform: translate(0,1.5px) rotate(.5deg);
+ transform: translate(0,1.5px) rotate(.5deg)
+ }
+
+ 48%,74%,82% {
+ -webkit-transform: translate(0,-.5px) rotate(.5deg);
+ transform: translate(0,-.5px) rotate(.5deg)
+ }
+
+ 52%,56%,60% {
+ -webkit-transform: translate(0,2.5px) rotate(2.5deg);
+ transform: translate(0,2.5px) rotate(2.5deg)
+ }
+
+ 58% {
+ -webkit-transform: translate(0,.5px) rotate(2.5deg);
+ transform: translate(0,.5px) rotate(2.5deg)
+ }
+
+ 84% {
+ -webkit-transform: translate(0,1.5px) rotate(2.5deg);
+ transform: translate(0,1.5px) rotate(2.5deg)
+ }
+
+ 90% {
+ -webkit-transform: translate(0,2.5px) rotate(-.5deg);
+ transform: translate(0,2.5px) rotate(-.5deg)
+ }
+
+ 92% {
+ -webkit-transform: translate(0,.5px) rotate(-.5deg);
+ transform: translate(0,.5px) rotate(-.5deg)
+ }
+
+ 94% {
+ -webkit-transform: translate(0,2.5px) rotate(.5deg);
+ transform: translate(0,2.5px) rotate(.5deg)
+ }
+
+ 0%,100% {
+ -webkit-transform: translate(0,0) rotate(0);
+ transform: translate(0,0) rotate(0)
+ }
+}
+
+@keyframes anime-face {
+ 2%,24%,80% {
+ -webkit-transform: translate(0,1.5px) rotate(1.5deg);
+ transform: translate(0,1.5px) rotate(1.5deg)
+ }
+
+ 4%,68%,98% {
+ -webkit-transform: translate(0,-1.5px) rotate(-.5deg);
+ transform: translate(0,-1.5px) rotate(-.5deg)
+ }
+
+ 38%,6% {
+ -webkit-transform: translate(0,1.5px) rotate(-1.5deg);
+ transform: translate(0,1.5px) rotate(-1.5deg)
+ }
+
+ 8%,86% {
+ -webkit-transform: translate(0,-1.5px) rotate(-1.5deg);
+ transform: translate(0,-1.5px) rotate(-1.5deg)
+ }
+
+ 10%,72% {
+ -webkit-transform: translate(0,2.5px) rotate(1.5deg);
+ transform: translate(0,2.5px) rotate(1.5deg)
+ }
+
+ 12%,64%,78%,96% {
+ -webkit-transform: translate(0,-.5px) rotate(1.5deg);
+ transform: translate(0,-.5px) rotate(1.5deg)
+ }
+
+ 14%,54% {
+ -webkit-transform: translate(0,-1.5px) rotate(1.5deg);
+ transform: translate(0,-1.5px) rotate(1.5deg)
+ }
+
+ 16% {
+ -webkit-transform: translate(0,-.5px) rotate(-1.5deg);
+ transform: translate(0,-.5px) rotate(-1.5deg)
+ }
+
+ 18%,22% {
+ -webkit-transform: translate(0,.5px) rotate(-1.5deg);
+ transform: translate(0,.5px) rotate(-1.5deg)
+ }
+
+ 20%,36%,46% {
+ -webkit-transform: translate(0,-1.5px) rotate(2.5deg);
+ transform: translate(0,-1.5px) rotate(2.5deg)
+ }
+
+ 26%,50% {
+ -webkit-transform: translate(0,.5px) rotate(.5deg);
+ transform: translate(0,.5px) rotate(.5deg)
+ }
+
+ 28% {
+ -webkit-transform: translate(0,.5px) rotate(1.5deg);
+ transform: translate(0,.5px) rotate(1.5deg)
+ }
+
+ 30%,40%,62%,76%,88% {
+ -webkit-transform: translate(0,-.5px) rotate(2.5deg);
+ transform: translate(0,-.5px) rotate(2.5deg)
+ }
+
+ 32%,34%,66% {
+ -webkit-transform: translate(0,1.5px) rotate(-.5deg);
+ transform: translate(0,1.5px) rotate(-.5deg)
+ }
+
+ 42% {
+ -webkit-transform: translate(0,2.5px) rotate(-1.5deg);
+ transform: translate(0,2.5px) rotate(-1.5deg)
+ }
+
+ 44%,70% {
+ -webkit-transform: translate(0,1.5px) rotate(.5deg);
+ transform: translate(0,1.5px) rotate(.5deg)
+ }
+
+ 48%,74%,82% {
+ -webkit-transform: translate(0,-.5px) rotate(.5deg);
+ transform: translate(0,-.5px) rotate(.5deg)
+ }
+
+ 52%,56%,60% {
+ -webkit-transform: translate(0,2.5px) rotate(2.5deg);
+ transform: translate(0,2.5px) rotate(2.5deg)
+ }
+
+ 58% {
+ -webkit-transform: translate(0,.5px) rotate(2.5deg);
+ transform: translate(0,.5px) rotate(2.5deg)
+ }
+
+ 84% {
+ -webkit-transform: translate(0,1.5px) rotate(2.5deg);
+ transform: translate(0,1.5px) rotate(2.5deg)
+ }
+
+ 90% {
+ -webkit-transform: translate(0,2.5px) rotate(-.5deg);
+ transform: translate(0,2.5px) rotate(-.5deg)
+ }
+
+ 92% {
+ -webkit-transform: translate(0,.5px) rotate(-.5deg);
+ transform: translate(0,.5px) rotate(-.5deg)
+ }
+
+ 94% {
+ -webkit-transform: translate(0,2.5px) rotate(.5deg);
+ transform: translate(0,2.5px) rotate(.5deg)
+ }
+
+ 0%,100% {
+ -webkit-transform: translate(0,0) rotate(0);
+ transform: translate(0,0) rotate(0)
+ }
}
\ No newline at end of file diff --git a/assets/js/miracles.min.js b/assets/js/miracles.min.js index 567b192..b1488eb 100644 --- a/assets/js/miracles.min.js +++ b/assets/js/miracles.min.js @@ -469,6 +469,34 @@ function getWordsNum() { idGetEl("readTip").innerHTML = "本文约 " + sLen + "字 阅读大概需要 " + time + " 分钟";
}
/**
+ * Build Time Echo
+ */
+function startTime(time = '2010-01-01') {
+ startTimeV = time;
+ var $time = new Date().getTime() - new Date(startTimeV);
+ if ($time < 0) return '0秒';
+ let result = '';
+ if ($time >= 365 * 86400000) {
+ result += parseInt($time / (365 * 86400000)) + ' 年 ';
+ $time = ($time % (365 * 86400000));
+ }
+ if ($time >= 86400000) {
+ result += parseInt($time / 86400000) + ' 天 ';
+ $time = ($time % 86400000);
+ }
+ if ($time >= 3600000) {
+ result += parseInt($time / 3600000) + ' 小时 ';
+ $time = ($time % 3600000);
+ }
+ if ($time >= 60000) {
+ result += parseInt($time / 60000) + ' 分 ';
+ $time = ($time % 60000);
+ }
+ result += parseInt($time / 1000) + ' 秒 ';
+ $('#build-time').html(result);
+ buildTimeout = setTimeout('startTime(startTimeV)', 1000)
+}
+/**
* Copyright
*/
console.log("%c 🎉 Theme Miracles %c by Eltrac %c 仓库: https://github.com/BigCoke233/miracles %c 演示:https://guhub.cn", "color: #fff; margin: 1em 0; padding: 5px 0; background: #29c75f;", "margin: 1em 0; padding: 5px 0; background: #efefef;", "display: block;margin-left:-0.5em;", "display: block;margin-left:-0.5em;margin-bottom:1em");
diff --git a/functions.php b/functions.php index 9490c0d..85b0afc 100644 --- a/functions.php +++ b/functions.php @@ -75,3 +75,17 @@ array_push($views, $cid); } echo $row['views']; } +/** + * 自动生成引用 + */ +function generate_require($files,$type,$cdn = NULL) { + if ($cdn) + $path = $cdn.themeVersion()."/"; + else $path = Helper::options()->themeUrl("","Miracles"); + foreach ($files as $file) { + if ($type == "js") + echo "<script src=".$path."assets/".$type."/".$file.".".$type."></script>"; + elseif ($type == "css") + echo "<link rel=\"stylesheet\" href=".$path."assets/".$type."/".$file.".".$type." />"; + } +}
\ No newline at end of file diff --git a/includes/footer.php b/includes/footer.php index 66d4702..6b9b26e 100644 --- a/includes/footer.php +++ b/includes/footer.php @@ -3,9 +3,16 @@ <!-- Footer Information --> <footer> <div class="footer-info footer-dark"> + <?php + echo $this->options->build_time?"记录已延续了 <span id=\"build-time\"></span>":""; + if($faces=$this->options->anime_face)$faces = "<span class=\"anime-face\">".$faces[rand(0,count($faces))]."</span>"; + if($faces && $this->options->build_time)echo $faces; + ?>; <p class="copyright">© <?php echo date('Y'); ?> <a href="<?php $this->options->SiteUrl(); ?>"><?php $this->options->title(); ?></a> All rights reserved.<br /> + <?php + if($faces && !$this->options->build_time)echo $faces; + $this->options->footerEcho(); ?> Powered by <a href="http://typecho.org">Typecho</a> | Theme <a href="https://guhub.cn/p/miracles.html">Miracles</a> by <a href="https://guhub.cn">Eltrac</a></p> - <?php $this->options->footerEcho(); ?> </div> </footer> <!-- Raised Buttons --> @@ -13,35 +20,22 @@ <button title="返回顶部" class="fixed-button gotop-button" id="gotop" style="color:white;"><i class="iconfont icon-chevron-up"></i></button> </div> <!-- JavaScript --> - <?php if($this->options->CDN && $this->options->CDN=1): ?> - <script src="https://cdn.jsdelivr.net/gh/BigCoke233/miracles@<?php echo themeVersion(); ?>/assets/js/jquery.js"></script> - <script src="https://cdn.jsdelivr.net/gh/BigCoke233/miracles@<?php echo themeVersion(); ?>/assets/js/pjax.jquery.js"></script> - <script src="https://cdn.jsdelivr.net/gh/BigCoke233/miracles@<?php echo themeVersion(); ?>/assets/js/jquery.fancybox.js"></script> - <script src="https://cdn.jsdelivr.net/gh/BigCoke233/miracles@<?php echo themeVersion(); ?>/assets/js/jquery.lazyload.min.js"></script> - <script src="https://cdn.jsdelivr.net/gh/BigCoke233/miracles@<?php echo themeVersion(); ?>/assets/js/nprogress.js"></script> - <script src="https://cdn.jsdelivr.net/gh/BigCoke233/miracles@<?php echo themeVersion(); ?>/assets/js/OwO.min.js"></script> - <script src="https://cdn.jsdelivr.net/gh/BigCoke233/miracles@<?php echo themeVersion(); ?>/assets/js/highlight.js"></script> - <script src="https://cdn.jsdelivr.net/gh/BigCoke233/miracles@<?php echo themeVersion(); ?>/assets/js/highlight-line-number.js"></script> - <script src="https://cdn.jsdelivr.net/gh/BigCoke233/miracles@<?php echo themeVersion(); ?>/assets/js/pangu.js"></script> - <?php if($this->options->cat!=0 || $this->options->customModel!=''): ?><script src="https://cdn.jsdelivr.net/gh/BigCoke233/miracles@<?php echo themeVersion(); ?>/assets/js/l2dwidget.min.js"></script><?php endif; ?> - <?php else: ?> - <script src="<?php Utils::indexTheme('assets/js/jquery.js'); ?>"></script> - <script src="<?php Utils::indexTheme('assets/js/pjax.jquery.js'); ?>"></script> - <script src="<?php Utils::indexTheme('assets/js/jquery.fancybox.js'); ?>"></script> - <script src="<?php Utils::indexTheme('assets/js/jquery.lazyload.min.js'); ?>"></script> - <script src="<?php Utils::indexTheme('assets/js/nprogress.js'); ?>"></script> - <script src="<?php Utils::indexTheme('assets/js/OwO.min.js'); ?>"></script> - <script src="<?php Utils::indexTheme('assets/js/highlight.js'); ?>"></script> - <script src="<?php Utils::indexTheme('assets/js/highlight-line-number.js'); ?>"></script> - <script src="<?php Utils::indexTheme('assets/js/pangu.js'); ?>"></script> - <?php endif; ?> + <?php + $js_files=array("jquery","pjax.jquery","jquery.fancybox","jquery.lazyload.min","nprogress","OwO.min","highlight","highlight-line-number","pangu"); + generate_require($js_files,"js",$this->options->CDN?"https://cdn.jsdelivr.net/gh/BigCoke233/miracles@":""); + ?> <!-- Varribles and Functions --> - <script>var allowNavAero=<?php if($this->options->navAero==0):?>true<?php else:?>false<?php endif;?>;var siteurl = '<?php $this->options->SiteUrl() ;?>';var owoJson = '<?php Utils::indexTheme('assets/OwO.json'); ?>'; + <script> + var allowNavAero = <?php if($this->options->navAero):?>false<?php else:?>true<?php endif;?>; + var siteurl = '<?php $this->options->SiteUrl() ;?>'; + var owoJson = '<?php Utils::indexTheme('assets/OwO.json'); ?>'; <?php if($this->options->pjax && $this->options->pjax!=0) :?>var loadPjax = true; beforePjax = function() {NProgress.start();}; afterPjax = function() {owoLoad();<?php $this->options->pjax_complete(); ?>};<?php endif; ?></script> - <!-- Script that must be after --> - <script src="<?php Utils::indexTheme('assets/js/miracles.min.js'); ?>"></script> + <!-- Script that must be after and BuildTime--> + <script src="<?php Utils::indexTheme('assets/js/miracles.min.js'); ?>"> + <?php if($this->options->build_time)echo "buildTime(".$this->options->build_time.");" ?> + </script> <!-- Send News and Loaders --> <script><?php if($this->is('index')): ?><?php if($this->options->news==!''): ?>alertSend('公告:<?php echo $this->options->news(); ?>');<?php endif; ?><?php endif; ?><?php if($this->is('post') || $this->is('page')): ?>owoLoad();<?php endif; ?><?php $this->options->jsEcho(); ?></script> <!-- Others --> diff --git a/includes/head.php b/includes/head.php index cf25c22..03f982c 100644 --- a/includes/head.php +++ b/includes/head.php @@ -38,19 +38,10 @@ <?php $this->header('description=&'); ?> <?php $this->options->headerEcho(); ?> <!-- css --> - <?php if($this->options->CDN && $this->options->CDN=1): ?> - <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/BigCoke233/miracles@<?php echo themeVersion(); ?>/assets/css/codestyle.css" /> - <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/BigCoke233/miracles@<?php echo themeVersion(); ?>/assets/css/owo.min.css" /> - <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/BigCoke233/miracles@<?php echo themeVersion(); ?>/assets/css/fancybox.css" /> - <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/BigCoke233/miracles@<?php echo themeVersion(); ?>/assets/css/prism.css" /> - <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/BigCoke233/miracles@<?php echo themeVersion(); ?>/assets/css/main/miracles.min.css" /> - <?php else: ?> - <link rel="stylesheet" href="<?php Utils::indexTheme('assets/css/codestyle.css'); ?>" /> - <link rel="stylesheet" href="<?php Utils::indexTheme('assets/css/owo.min.css'); ?>" /> - <link rel="stylesheet" href="<?php Utils::indexTheme('assets/css/nprogress.css'); ?>" /> - <link rel="stylesheet" href="<?php Utils::indexTheme('assets/css/fancybox.css'); ?>" /> - <link rel="stylesheet" href="<?php Utils::indexTheme('assets/css/main/miracles.min.css'); ?>" /> - <?php endif; ?> + <?php + $css_files=array("codestyle","owo.min","nprogress","fancybox","main/miracles.min"); + generate_require($css_files,"css",$this->options->CDN?"https://cdn.jsdelivr.net/gh/BigCoke233/miracles@":""); + ?> <!-- icon font --> <link rel="stylesheet" href="//at.alicdn.com/t/font_1165190_t5sh6mq8n6i.css" /> <!-- Google Fonts --> diff --git a/libs/Options.php b/libs/Options.php index a94d509..cc305df 100644 --- a/libs/Options.php +++ b/libs/Options.php @@ -127,11 +127,18 @@ function themeConfig($form) { ];
$LoadingImage = new Typecho_Widget_Helper_Form_Element_Radio('loading_image', $LoadingOptions, 'block', _t('选择图片加载动画'),_t("<hr>"));
$form->addInput($LoadingImage);
-
+
+ //SiteBuildTime
+ $buildTime = new Typecho_Widget_Helper_Form_Element_Text('build_time', NULL, NULL, _t('在页脚输出建站至今时间'), _t('填写格式如2020-01-01的时间,将输出在站点信息之前,不想开启请留空。'));
+ $form->addInput($buildTime);
+ //AnimeFace
+ $AnimeFace = new Typecho_Widget_Helper_Form_Element_Text('anime_face', NULL, NULL, _t('在其之后输出一个蹦跶的颜文字'), _t('如果开启了建站时间将会输出在其之后,反之会输出在站点信息之后。在此写上你想展示的颜文字,多个颜文字用"&&"分割,每次刷新更换。如不想开启请留空。'));
+ $form->addInput($AnimeFace);
+
//developer
- $headerEcho = new Typecho_Widget_Helper_Form_Element_Textarea('headerEcho', NULL, NULL, _t('<h2>开发者设置</h2>自定义头部信息'), _t('填写 html 代码,将输出在 <head> 标签中'));
+ $headerEcho = new Typecho_Widget_Helper_Form_Element_Textarea('headerEcho', NULL, NULL, _t('<h2>开发者设置</h2>自定义头部信息'), _t('填写 html 代码,将输出在 <head> 标签中,可以在这里写上统计代码'));
$form->addInput($headerEcho);
- $footerEcho = new Typecho_Widget_Helper_Form_Element_Textarea('footerEcho', NULL, NULL, _t('自定义页脚部信息'), _t('填写 html 代码,将输出在页脚的版权信息后'));
+ $footerEcho = new Typecho_Widget_Helper_Form_Element_Textarea('footerEcho', NULL, NULL, _t('自定义页脚部信息'), _t('填写 html 代码,将输出在页脚的版权信息之前'));
$form->addInput($footerEcho);
$cssEcho = new Typecho_Widget_Helper_Form_Element_Textarea('cssEcho', NULL, NULL, _t('自定义 CSS'), _t('填写 CSS 代码,输出在 head 标签结束之前的 style 标签内'));
$form->addInput($cssEcho);
|
