文章notice与毫秒级建站时间

  • 2020 年 3 月 11 日
  • 笔记

首先,将以下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