Typecho handsome恋爱计时

在花
2021-04-19 / 0 评论 / 16 阅读 / 正在检测是否收录...

Typecho handsome恋爱计时

复制以下代码到开发者设置 -> 自定义JavaScript

function loveSitetime() {
            window.setTimeout("loveSitetime()", 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("loveSitetime").innerHTML = "我们相恋了:</br>" + diffYears + "年" + diffDays + "天" +
                diffHours + "时" + diffMinutes + "分" + diffSeconds + "秒啦</br>"
        }
        loveSitetime()

复制以下代码到开发者设置 -> 全局右侧边栏广告位

<aside class="widget_text sidebar-widget widget_custom_html fadeInUp">
<div class="textwidget custom-html-widget">
<div id="lovexhj" style="width: 100%; height: 100px; text-align: center; font-size: 1rem;">         
<div id="lovexhjImage" style="width: 220px; margin: 0 auto;">
        <!-- 左边的头像 -->
<img src="https://q1.qlogo.cn/g?b=qq&nk=2861099&s=640" alt="love" style="width: 60px; border-radius: 50%;">
        <!-- 中间的图片 -->
<img src="https://cdn.jsdelivr.net/gh/L-20021213/picture@latest/2020/09/18/lovelogo%20.gif" alt="love" style="width: 60px; border-radius: 50%;">
        <!-- 右边的头像 -->
<img src="https://q1.qlogo.cn/g?b=qq&nk=2810271999&s=640" alt="love" style="width: 60px; border-radius: 50%;">
        </div>
        <p id="loveSitetime" style="font-size: 0.8rem;    margin-top: 16px;  background: linear-gradient(to right, red, blue);-webkit-background-clip: text;color: transparent;"></p>
</aside>

展示标题

侧边广告栏展示名字在云空间的usr/themes/handsome/component/sidebar.php文件中修改。

参考:AomanHao

0

评论 (0)

取消