Typecho添加恋爱计时小组件

图片[1]-Typecho添加恋爱计时小组件

介绍

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

教程

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

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

bOJJ54.png

代码

                     <span><!-- 恋爱计时 --></span>
        <span><span><span><</span>ul</span> <span>class</span><span><span>=</span><span>"</span>joe_header__slideout-count<span>"</span></span><span>></span></span>
        <span><span><span><</span>div</span> <span>id</span><span><span>=</span><span>"</span>lovexhj<span>"</span></span> <span><span>style</span><span><span>=</span><span>"</span><span><span>width</span><span>:</span> <span>100</span><span>%</span><span>;</span> <span>height</span><span>:</span> <span>100</span><span>%</span><span>;</span> <span>text-align</span><span>:</span> center<span>;</span> <span>font-size</span><span>:</span> <span>1</span><span>rem</span><span>;</span></span><span>"</span></span></span><span>></span></span>
        <span><span><span><</span>div</span> <span>id</span><span><span>=</span><span>"</span>lovexhjImage<span>"</span></span> <span><span>style</span><span><span>=</span><span>"</span><span><span>width</span><span>:</span> <span>220</span><span>px</span><span>;</span> <span>margin</span><span>:</span> <span>0</span> auto<span>;</span></span><span>"</span></span></span><span>></span></span>
        <span><!-- 左边的头像 --></span>
        <span><span><span><</span>img</span> <span>src</span><span><span>=</span><span>"</span>https://q1.qlogo.cn/g?b=qq&nk=2904838175&s=640<span>"</span></span> <span>alt</span><span><span>=</span><span>"</span>love<span>"</span></span>
            <span><span>style</span><span><span>=</span><span>"</span><span><span>width</span><span>:</span> <span>60</span><span>px</span><span>;</span> <span>border-radius</span><span>:</span> <span>50</span><span>%</span><span>;</span></span><span>"</span></span></span><span>></span></span>
        <span><!-- 中间的图片 --></span>
        <span><span><span><</span>img</span> <span>src</span><span><span>=</span><span>"</span>https://cdn.jsdelivr.net/gh/aill66/cdn/love.gif<span>"</span></span> <span>alt</span><span><span>=</span><span>"</span>love<span>"</span></span>
            <span><span>style</span><span><span>=</span><span>"</span><span><span>width</span><span>:</span> <span>60</span><span>px</span><span>;</span> <span>border-radius</span><span>:</span> <span>50</span><span>%</span><span>;</span></span><span>"</span></span></span><span>></span></span>
        <span><!-- 右边的头像 --></span>
        <span><span><span><</span>img</span> <span>src</span><span><span>=</span><span>"</span>https://q1.qlogo.cn/g?b=qq&nk=1592964442&s=640<span>"</span></span> <span>alt</span><span><span>=</span><span>"</span>love<span>"</span></span>
            <span><span>style</span><span><span>=</span><span>"</span><span><span>width</span><span>:</span> <span>60</span><span>px</span><span>;</span> <span>border-radius</span><span>:</span> <span>50</span><span>%</span><span>;</span></span><span>"</span></span></span><span>></span></span>
        <span><span><span></</span>div</span><span>></span></span>
        <span><span><span><</span>p</span> <span>id</span><span><span>=</span><span>"</span>loveSitetime<span>"</span></span> <span><span>style</span><span><span>=</span><span>"</span><span><span>font-size</span><span>:</span> <span>1.0</span><span>rem</span><span>;</span></span><span>"</span></span></span><span>></span></span><span><span><span></</span>p</span><span>></span></span>
        <span><span><span><</span>script</span> <span>language</span><span><span>=</span>javascript</span><span>></span></span><span><span>
        <span>function</span> <span>loveSitetime</span><span>(</span><span>)</span> <span>{</span>
            <span>window</span><span>.</span><span>setTimeout</span><span>(</span><span>"loveSitetime()"</span><span>,</span> <span>1000</span><span>)</span><span>;</span>
            <span>var</span> seconds <span>=</span> <span>1000</span>
            <span>var</span> minutes <span>=</span> seconds <span>*</span> <span>60</span>
            <span>var</span> hours <span>=</span> minutes <span>*</span> <span>60</span>
            <span>var</span> days <span>=</span> hours <span>*</span> <span>24</span>
            <span>var</span> years <span>=</span> days <span>*</span> <span>365</span>
            <span>var</span> today <span>=</span> <span>new</span> <span>Date</span><span>(</span><span>)</span>
            <span>var</span> todayYear <span>=</span> today<span>.</span><span>getFullYear</span><span>(</span><span>)</span>
            <span>var</span> todayMonth <span>=</span> today<span>.</span><span>getMonth</span><span>(</span><span>)</span> <span>+</span> <span>1</span>
            <span>var</span> todayDate <span>=</span> today<span>.</span><span>getDate</span><span>(</span><span>)</span>
            <span>var</span> todayHour <span>=</span> today<span>.</span><span>getHours</span><span>(</span><span>)</span>
            <span>var</span> todayMinute <span>=</span> today<span>.</span><span>getMinutes</span><span>(</span><span>)</span>
            <span>var</span> todaySecond <span>=</span> today<span>.</span><span>getSeconds</span><span>(</span><span>)</span>
            <span>// 时间设置</span>
            <span>var</span> t1 <span>=</span> <span>Date</span><span>.</span><span>UTC</span><span>(</span><span>2019</span><span>,</span> <span>10</span><span>,</span> <span>19</span><span>,</span> <span>00</span><span>,</span> <span>00</span><span>,</span> <span>00</span><span>)</span>
            <span>var</span> t2 <span>=</span> <span>Date</span><span>.</span><span>UTC</span><span>(</span>todayYear<span>,</span> todayMonth<span>,</span> todayDate<span>,</span> todayHour<span>,</span> todayMinute<span>,</span> todaySecond<span>)</span>
            <span>var</span> diff <span>=</span> t2 <span>-</span> t1
            <span>var</span> diffYears <span>=</span> <span>Math</span><span>.</span><span>floor</span><span>(</span>diff <span>/</span> years<span>)</span>
            <span>var</span> diffDays <span>=</span> <span>Math</span><span>.</span><span>floor</span><span>(</span><span>(</span>diff <span>/</span> days<span>)</span> <span>-</span> diffYears <span>*</span> <span>365</span><span>)</span>
            <span>var</span> diffHours <span>=</span> <span>Math</span><span>.</span><span>floor</span><span>(</span><span>(</span>diff <span>-</span> <span>(</span>diffYears <span>*</span> <span>365</span> <span>+</span> diffDays<span>)</span> <span>*</span> days<span>)</span> <span>/</span> hours<span>)</span>
            <span>var</span> diffMinutes <span>=</span> <span>Math</span><span>.</span><span>floor</span><span>(</span><span>(</span>diff <span>-</span> <span>(</span>diffYears <span>*</span> <span>365</span> <span>+</span> diffDays<span>)</span> <span>*</span> days <span>-</span> diffHours <span>*</span> hours<span>)</span> <span>/</span> minutes<span>)</span>
            <span>var</span> diffSeconds <span>=</span> <span>Math</span><span>.</span><span>floor</span><span>(</span><span>(</span>diff <span>-</span> <span>(</span>diffYears <span>*</span> <span>365</span> <span>+</span> diffDays<span>)</span> <span>*</span> days <span>-</span> diffHours <span>*</span> hours <span>-</span>
                diffMinutes <span>*</span> minutes<span>)</span> <span>/</span> seconds<span>)</span>
            <span>document</span><span>.</span><span>getElementById</span><span>(</span><span>"loveSitetime"</span><span>)</span><span>.</span><span>innerHTML</span> <span>=</span> <span>"我们相恋了:</br>"</span> <span>+</span> diffYears <span>+</span> <span>"年"</span> <span>+</span> diffDays <span>+</span> <span>"天"</span> <span>+</span>
                diffHours <span>+</span> <span>"时"</span> <span>+</span> diffMinutes <span>+</span> <span>"分"</span> <span>+</span> diffSeconds <span>+</span> <span>"秒啦</br>"</span>
        <span>}</span>
        <span>loveSitetime</span><span>(</span><span>)</span>
        </span></span><span><span><span></</span>script</span><span>></span></span>
        <span><span><span></</span>div</span><span>></span></span>
        <span><span><span></</span>ul</span><span>></span></span>

喜欢就点赞支持一下子表情

© 版权声明
THE END
喜欢就支持一下吧
点赞127 分享
评论 抢沙发
头像
欢迎您留下宝贵的见解!
提交
头像

昵称

取消
昵称表情代码图片