Typecho添加恋爱计时小组件-星泽V社

介绍

1.一个可以让你网站侧栏不在那么孤单的代码.可以加入你那 可爱 ,漂亮的女朋友表情还有 屌丝 的你 2.支持修改代码中的qq号即可更改头像图片,自定义恋爱计时 3.孤零零的我也只能静静的把好东西分享跟你们了!

教程

1.复制以下代码进入到问价header.php文件里面,找到这一行(注意看图)大概在个279行左右,找到这个位置把代码复制粘贴进去即可! 2.代码前后需要添加 和 ,不过我乐于助人已经把这个给你加好了,直接复制代码到指定位置,复制粘贴即可

代码路径: /wwwroot/网址/usr/themes/Joe/public

bOJJ54.png
代码
代码语言:javascript
复制
        <ul class="joe_header__slideout-count">
        <div id="lovexhj" style="width: 100%; height: 100%; text-align: center; font-size: 1rem;">
        <div id="lovexhjImage" style="width: 220px; margin: 0 auto;">
    &lt;img src=&#34;https://q1.qlogo.cn/g?b=qq&amp;nk=2904838175&amp;s=640&#34; alt=&#34;love&#34;
        style=&#34;width: 60px; border-radius: 50%;&#34;&gt;
    
    &lt;img src=&#34;https://cdn.jsdelivr.net/gh/aill66/cdn/love.gif&#34; alt=&#34;love&#34;
        style=&#34;width: 60px; border-radius: 50%;&#34;&gt;
    
    &lt;img src=&#34;https://q1.qlogo.cn/g?b=qq&amp;nk=1592964442&amp;s=640&#34; alt=&#34;love&#34;
        style=&#34;width: 60px; border-radius: 50%;&#34;&gt;
    div&gt;
    &lt;p id=&#34;loveSitetime&#34; style=&#34;font-size: 1.0rem;&#34;&gt;p&gt;
    &lt;script language=javascript&gt;
    function loveSitetime() {
        window.setTimeout(&#34;loveSitetime()&#34;, 1000);
        var seconds = 1000
        var minutes = seconds * 60
        var hours = minutes * 60
        var days = hours * 24
        var years = days * 365
        var today = new Date()
        var todayYear = today.getFullYear()
        var todayMonth = today.getMonth() + 1
        var todayDate = today.getDate()
        var todayHour = today.getHours()
        var todayMinute = today.getMinutes()
        var todaySecond = today.getSeconds()
        // 时间设置
        var t1 = Date.UTC(2019, 10, 19, 00, 00, 00)
        var t2 = Date.UTC(todayYear, todayMonth, todayDate, todayHour, todayMinute, todaySecond)
        var diff = t2 - t1
        var diffYears = Math.floor(diff / years)
        var diffDays = Math.floor((diff / days) - diffYears * 365)
        var diffHours = Math.floor((diff - (diffYears * 365 + diffDays) * days) / hours)
        var diffMinutes = Math.floor((diff - (diffYears * 365 + diffDays) * days - diffHours * hours) / minutes)
        var diffSeconds = Math.floor((diff - (diffYears * 365 + diffDays) * days - diffHours * hours -
            diffMinutes * minutes) / seconds)
        document.getElementById(&#34;loveSitetime&#34;).innerHTML = &#34;我们相恋了:

" + diffYears + "年" + diffDays + "天" +
diffHours + "时" + diffMinutes + "分" + diffSeconds + "秒啦
"
}
loveSitetime()
script>
div>
ul>

本文共 243 个字数,平均阅读时长 ≈ 1分钟