很早的时候就发现有些博客很漂亮,久而久之发觉其实都是源自同一个主题——Handsome,于是乎自己也捣鼓着上线了自己的blog.本文是基于Handsome主题,在顶部导航处添加天气元素的教程。具体是哪位大佬提供的源代码已经忘了,在此表示感谢并记录!


将以下代码手动添加到/www/wwwroot/www.moekid.com/usr/themes/handsome/component下的headnav.php文件中,大约86行左右的位置。

<!--天气开始-->
<div id="tp-weather-widget" class="navbar-form navbar-form-sm navbar-left shift">
</div><script>(function(T,h,i,n,k,P,a,g,e){g=function(){P=h.createElement(i);a=h.getElementsByTagName(i)[0];P.src=k;P.charset="utf8";P.async=1;a.parentNode.insertBefore(P,a)};T["ThinkPageWeatherWidgetObject"]=n;T[n]||(T[n]=function(){(T[n].q=T[n].q||[]).push(arguments)});T[n].l=+new Date();if(T.attachEvent){T.attachEvent("onload",g)}else{T.addEventListener("load",g,false)}}(window,document,"script","tpwidget","//widget.seniverse.com/widget/chameleon.js"))</script>
<script>tpwidget("init", {
"flavor": "slim",
"location": "WX4FBXXFKE4F",
"geolocation": "enabled",
"language": "auto",
"unit": "c",
"theme": "chameleon",
"container": "tp-weather-widget",
"bubble": "enabled",
"alarmType": "badge",
"color": "#ffffff",
"uid": "xxxxxxxx",
"hash": "xxxxxxxx"
});
tpwidget("show");</script>
<!--天气结束-->
Last modification:May 3rd, 2020 at 03:55 pm
如果觉得我的文章对你有用,请随意赞赏