前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >文章notice与毫秒级建站时间

文章notice与毫秒级建站时间

作者头像
溪初桾
发布2020-03-11 14:30:57
1.7K0
发布2020-03-11 14:30:57
举报

首先,将以下js添加到主题,你可以添加到自己的js文件,也可以添加到footer.php文件中。添加的js文件中,直接添加即可。添加到footer.php,需要用<script></script>包括js代码。如果你觉得毫秒太快,请自行删除下方代码中关于ms的相关代码,再引入即可。

setInterval(function() {
    var start_timestamp = 1528560000000;
    var times = new Date().getTime() - new Date(start_timestamp).getTime();
    times = Math.floor(times);
    var days = Math.floor(times / 1000 / (60 * 60 * 24));
    times %= 60 * 60 * 24000;
    var hours = Math.floor(times / 1000 / (60 * 60));
    times %= 60 * 60000;
    var minutes = Math.floor(times / 60 / 1000);
    times %= 60000;
    var seconds = Math.floor(times / 1000);
    times %= 1000;
    var ms = Math.floor(times);
    if (String(ms).length == 1) {
        ms = "00" + String(ms)
    };
    if (String(ms).length == 2) {
        ms = "0" + String(ms)
    };
    $("#uptime>div").html(days + " 天 " + hours + " 小时 " + minutes + " 分 " + seconds + " 秒 " + ms + " 毫 ")
}, 1);

调用

<div id="uptime" class="nav-left-panel" style="animation-delay:0.2s">
    <span class="hidden-xs"><i class="fa fa-heart"></i> 感谢陪伴</span>
    <div style="padding:0.5rem 0.3em;text-align: center;line-height: 1.5;">
        <div class="idot"></div><div class="idot"></div><div class="idot"></div>
    </div>
</div>

首先,打开主题目录下post.php文件,在适当位置添加如下代码,一般添加在post-content后面(表示文章正文开始的地方)

<p class="notice">
最后更新于<?php echo date('Y年m月d日' , $this->modified);?>;
如遇到问题,请留言及时通知站长;
欢迎加入<i class="iconfont icon-qq"></i>&nbsp;<a href="https:////jq.qq.com//?_wv=1027&k=5oqGJo0" target="_blank">|尘埃</a>,讨论各种问题!
</p>

主题css添加

p.notice{position:relative;padding:.5rem;border:1px dashed #b00;background:#eee}
p.notice::before{position:absolute;top:-.5rem;left:.5rem;z-index:1;padding:0 .3rem;content:"Notice";font-size:.8rem;line-height:1}
p.notice::after{position:absolute;top:-1px;left:.5rem;z-index:0;width:50px;height:6.4px;background:#eee;content:""}
!!!
<p class="notice">
你可以直接在文章中自定义notice <br/>
要知道,许多在眼前看来天大的事,都不是人生一战,而只是人生一站。我知道高考让你很辛苦,坚持了这么久,就已经是胜利。<br/>漫长的夏天和宽广的人生还在等着你,迈过去,你就看到了。
</p>
!!!

你可以直接在文章中自定义notice

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2019-06-09,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档