Skip to content

Commit

Permalink
优化天气插件
Browse files Browse the repository at this point in the history
  • Loading branch information
5iux committed Nov 18, 2020
1 parent dba3bcb commit 58d6db8
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 75 deletions.
Binary file added icon/280.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified icon/32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
59 changes: 24 additions & 35 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
<meta http-equiv="Cache-Control" content="no-siteapp">
<meta name="referrer" content="no-referrer" />
<meta name="theme-color" content="#ffffff">
<link rel="icon" href="icon/f.png" sizes="192x192" />
<link rel="apple-touch-icon-precomposed" href="icon/f.png" />
<meta name="msapplication-TileImage" content="icon/f.png" />
<link rel="shortcut icon" href="icon/f.png"/>
<link rel="icon" href="icon/280.png?v=1.0.1" sizes="280x280" />
<link rel="apple-touch-icon-precomposed" href="icon/280.png?v=1.0.1" />
<meta name="msapplication-TileImage" content="icon/280.png?v=1.0.1" />
<link rel="shortcut icon" href="icon/32.png?v=1.0.1"/>
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-touch-fullscreen" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
Expand All @@ -39,6 +39,7 @@
<script src="//at.alicdn.com/t/font_400990_j21lstb4wx.js"></script>
<script src="sou.js?t=<?php echo date("ymdhi"); ?>"></script>
<script src="wea.js?t=<?php echo date("ymdhi"); ?>"></script>

<style>
</style>
</head>
Expand All @@ -57,6 +58,11 @@
<li><a rel="nofollow" href="http://www.zmz2019.com/" target="_blank"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-zimu"></use></svg>字幕组</a></li>
<li><a rel="nofollow" href="http://www.acfun.cn/index.html" target="_blank"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-acfun"></use></svg>ACFUN</a></li>
<li><a rel="nofollow" href="https://www.bilibili.com/" target="_blank"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-bili"></use></svg>哔哩哔哩</a></li>
<li><a rel="nofollow" href="https://www.nfmovies.com/" target="_blank"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-netflix"></use></svg>奈非影视</a></li>
<li><a rel="nofollow" href="https://k1080.net/" target="_blank"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-yingshi"></use></svg>K1080</a></li>
<li><a rel="nofollow" href="https://www.yunbtv.com/" target="_blank"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-yunbo"></use></svg>云播TV</a></li>
<li><a rel="nofollow" href="https://lm.didibib.ml/" target="_blank"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-yingshi06"></use></svg>菲菲影视</a></li>
<li><a rel="nofollow" href="https://yingshi.ml/" target="_blank"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-syys"></use></svg>影视搜索</a></li>
<!------>
<li class="title"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-youxiang"></use></svg> 邮箱</li>
<li><a rel="nofollow" href="https://mail.google.com/mail/u/0/#inbox" target="_blank"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-gmail"></use></svg>Gmail</a></li>
Expand Down Expand Up @@ -89,7 +95,7 @@
<li><a rel="nofollow" href="https://wat.dyartstyle.com/" target="_blank"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-wat"></use></svg>吾爱淘</a></li>
<!------>
<li class="title"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-sheji"></use></svg> 设计视觉</li>
<li><a rel="nofollow" href="https://web.yyv.me/" target="_blank"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-daohang1"></use></svg>设计导航</a></li>
<li><a rel="nofollow" href="https://hao.5iux.cn/" target="_blank"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-daohang1"></use></svg>设计导航</a></li>
<li><a rel="nofollow" href="https://www.pinterest.com/" target="_blank"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-pinterest"></use></svg>Pinterest</a></li>
<li><a rel="nofollow" href="https://www.behance.net/" target="_blank"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-behance"></use></svg>Behance</a></li>
<li><a rel="nofollow" href="https://www.dribbble.com/" target="_blank"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-dribbble"></use></svg>Dribbble</a></li>
Expand Down Expand Up @@ -139,6 +145,7 @@
<li><a rel="nofollow" href="https://www.swiper.com.cn/" target="_blank"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-S"></use></svg>Swiper</a></li>
</ul>
</div>
<!--天气-->
<div class="mywth">
<div class="wea_hover">
<div class="wea_in wea_top"></div>
Expand All @@ -149,34 +156,10 @@
<ul></ul>
</div>
</div>
<!--天气插件,基于www.tianqiapi.com 天气接口制作-->
<!--天气插件,基于和风天气接口制作-->
</div>
<!--div class="mywth" style="width: 320px;">
<div id="he-plugin-simple"></div>
<script>
WIDGET = {
CONFIG: {
"modules": "01234",
"background": 5,
"tmpColor": "4A4A4A",
"tmpSize": "12",
"cityColor": "4A4A4A",
"citySize": "12",
"aqiSize": "12",
"weatherIconSize": "16",
"alertIconSize": "14",
"padding": "0px 5px 0px 5px",
"shadow": "1",
"language": "auto",
"fixed": "false",
"vertical": "middle",
"horizontal": "left",
"key": "自己的key"
}
/*天气key自己去官方申请吧大佬们!https://dev.heweather.com/widget/simple*/
}
</script>
<script src="https://widget.heweather.net/simple/static/js/he-simple-common.js?v=1.1"></script>
<!--div class="mywth" style="width: 200px;">
<div id="he-plugin-simple"></div> <script>WIDGET = {CONFIG:{"modules":"10234","background":5,"tmpColor":"4A4A4A","tmpSize":"14","cityColor":"4A4A4A","citySize":"14","aqiSize":"14","weatherIconSize":"20","alertIconSize":"16","padding":"0px","shadow":"0","language":"auto","borderRadius":5,"fixed":"false","vertical":"middle","horizontal":"left","key":"f60588bd99d94495b907562a23e05666"}}</script> <script src="https://widget.heweather.net/simple/static/js/he-simple-common.js?v=1.1"></script>
</div-->
<div id="content">
<div class="con">
Expand All @@ -187,7 +170,7 @@
if ($t=="b"){
echo'<div class="lg" style="background: url(icon/baidu.svg) no-repeat center/cover;" onclick="window.location.href=\'?t=\';"></div>';
}else{
//都能搭建服务器了,这里不知道改吗大佬们?问的不止一个了 -_-!
//上面知道把默认谷歌改成百度,这里不知道改吗大佬们?。。
echo'<div class="lg" style="background: url(icon/g.svg) no-repeat center/cover;" onclick="window.location.href=\'?t=b\';"></div>';
}

Expand All @@ -203,13 +186,19 @@
</ul-->
</div>
</div>
<div class="foot">© 2016-<?php echo date("Y") ?> by <a href="https://blog.5iux.cn/">5iux</a> . All rights reserved.</div>
<div class="foot" style="height: 40px;">
<a href="https://blog.5iux.cn/" style="color: #777;">博客</a> |
<a href="https://hao.5iux.cn/" style="color: #777;">设计导航</a> |
<a href="https://dyartstyle.com/" style="color: #777;">设计资讯</a> |
<a href="https://wat.dyartstyle.com/" style="color: #777;">吾爱淘</a> |
<a href="https://github.com/5iux/sou/" style="color: #777;">Github</a><br>
© 2016-<?php echo date("Y") ?> by <a href="https://blog.5iux.cn/">5iux</a> . All rights reserved.</div>
</div>
<!--
作者:D.Young
主页:https://blog.5iux.cn/
github:https://github.com/5iux/sou
日期:2020-05-19
日期:2020-11-18
版权所有,请勿删除
-->
</body>
Expand Down
4 changes: 2 additions & 2 deletions sou.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/*
作者:D.Young
主页:https://blog.5iux.cn/
主页:https://yyv.me/
github:https://github.com/5iux/sou
日期:2020-05-19
日期:2020/11/18
版权所有,请勿删除
*/

Expand Down
8 changes: 2 additions & 6 deletions style.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

/*
作者:D.Young
主页:https://blog.5iux.cn/
主页:https://yyv.me/
github:https://github.com/5iux/sou
日期:2020-05-19
日期:2019-07-11
版权所有,请勿删除
*/

Expand Down Expand Up @@ -177,7 +177,6 @@ a {
.foot {
position: absolute;
bottom: 10px;
z-index: 1000;
text-align: center;
width: 100%;
color: #999;
Expand Down Expand Up @@ -416,9 +415,6 @@ svg.icon {
.mywth {
color: #777;
left: 10px;
top: 20px;
overflow: hidden;

}

.mywth.hidden {
Expand Down
6 changes: 3 additions & 3 deletions wea.css
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
@charset "utf-8";
/*
作者:D.Young
主页:https://blog.5iux.cn/
主页:https://yyv.me/
github:https://github.com/5iux/sou
日期:2020-06-28
日期:2019-07-11
版权所有,请勿删除
*/

Expand Down Expand Up @@ -50,7 +50,7 @@ github:https://github.com/5iux/sou
visibility: hidden;
opacity: 0;
transition: 0.3s all;
animation:bgmove 6s linear infinite;
animation:bgmove 16s linear infinite;
}

.mywth:hover .wea_hover {
Expand Down
56 changes: 27 additions & 29 deletions wea.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,14 @@

/*
作者:D.Young
主页:https://blog.5iux.cn/
github:https://github.com/5iux/sou
日期:2020-05-19
版权所有,请勿删除
天气插件开始
/*天气插件开始
天气插件api请在wea目录中index.php修改
申请地址:和风天气-https://dev.heweather.com/
*/
//菜单点击
$("#menu").click(function(event) {
$(".mywth").toggleClass('hidden');
});
$("#content").click(function(event) {
$(".mywth").removeClass('hidden');
});
//菜单点击
$("#menu").click(function(event) {
$(".mywth").toggleClass('hidden');
});
$("#content").click(function(event) {
$(".mywth").removeClass('hidden');
});

$.ajax({
url: '/wea/',
Expand All @@ -36,21 +28,27 @@ $.ajax({
//今日天气
$('.wea_top').append('<span class="city"><b>' + res.HeWeather6[0].basic.location + '</b> ' + res.HeWeather6[0].update.loc + ' 更新</span><span class="img" style="background:url(https://cdn.heweather.com/img/plugin/190516/icon/c/' + res.HeWeather6[0].now.cond_code + myday + '.png) no-repeat center/contain;"></span> <span class="tem"><b>' + res.HeWeather6[0].now.tmp + '℃</b>' + res.HeWeather6[0].now.cond_txt + '</span><span class="air">紫外线指数:' + res.HeWeather6[0].lifestyle[5].brf + '<br>相对湿度:' + res.HeWeather6[0].now.hum + '%<br>' + res.HeWeather6[0].now.wind_dir + ':' + res.HeWeather6[0].now.wind_sc + '级</span><span class="air_tips">' + res.HeWeather6[0].lifestyle[3].txt + '</span>');
//今日指数
$('.wea_con ul').append('<li>舒适度指数<br><b>' + res.HeWeather6[0].lifestyle[0].brf + '</b></li>');
$('.wea_con ul').append('<li>穿衣指数<br><b>' + res.HeWeather6[0].lifestyle[1].brf + '</b></li>');
$('.wea_con ul').append('<li>感冒指数<br><b>' + res.HeWeather6[0].lifestyle[2].brf + '</b></li>');
$('.wea_con ul').append('<li>运动指数<br><b>' + res.HeWeather6[0].lifestyle[3].brf + '</b></li>');
$('.wea_con ul').append('<li>旅游指数<br><b>' + res.HeWeather6[0].lifestyle[4].brf + '</b></li>');
$('.wea_con ul').append('<li>紫外线指数<br><b>' + res.HeWeather6[0].lifestyle[5].brf + '</b></li>');
$('.wea_con ul').append('<li>洗车指数<br><b>' + res.HeWeather6[0].lifestyle[6].brf + '</b></li>');
$('.wea_con ul').append('<li>空气指数<br><b>' + res.HeWeather6[0].lifestyle[7].brf + '</b></li>');
var wea_con;
for (var x = 0; x < 8; x++) {
wea_con = '<li class="wea_' + res.HeWeather6[0].lifestyle[x].type + '"><span></span>指数<br><b>' + res.HeWeather6[0].lifestyle[x].brf + '</b></li>';
$(".wea_con ul").append(wea_con);
}
$('.wea_comf span').text('舒适度');
$('.wea_drsg span').text('穿衣');
$('.wea_flu span').text('感冒');
$('.wea_sport span').text('运动');
$('.wea_trav span').text('旅游');
$('.wea_uv span').text('紫外线');
$('.wea_cw span').text('洗车');
$('.wea_air span').text('空气');

//未来3天天气
$('.wea_foot ul').append('<li>' + res.HeWeather6[0].daily_forecast[0].date + '<br><img src="https://cdn.heweather.com/img/plugin/190516/icon/c/' + res.HeWeather6[0].daily_forecast[0].cond_code_d + myday + '.png"><br><b>' + res.HeWeather6[0].daily_forecast[0].cond_txt_d + '</b><br><i>' + res.HeWeather6[0].daily_forecast[0].tmp_min + '°/' + res.HeWeather6[0].daily_forecast[0].tmp_max + '°' + '</i></li>');

$('.wea_foot ul').append('<li>' + res.HeWeather6[0].daily_forecast[1].date + '<br><img src="https://cdn.heweather.com/img/plugin/190516/icon/c/' + res.HeWeather6[0].daily_forecast[1].cond_code_d + myday + '.png"><br><b>' + res.HeWeather6[0].daily_forecast[1].cond_txt_d + '</b><br><i>' + res.HeWeather6[0].daily_forecast[1].tmp_min + '°/' + res.HeWeather6[0].daily_forecast[1].tmp_max + '°' + '</i></li>');

$('.wea_foot ul').append('<li>' + res.HeWeather6[0].daily_forecast[2].date + '<br><img src="https://cdn.heweather.com/img/plugin/190516/icon/c/' + res.HeWeather6[0].daily_forecast[2].cond_code_d + myday + '.png"><br><b>' + res.HeWeather6[0].daily_forecast[2].cond_txt_d + '</b><br><i>' + res.HeWeather6[0].daily_forecast[2].tmp_min + '°/' + res.HeWeather6[0].daily_forecast[2].tmp_max + '°' + '</i></li>');
//未来3天天气
var wea_foot;
for (var i = 0; i < 3; i++) {
wea_foot = '<li>' + res.HeWeather6[0].daily_forecast[i].date + '<br><img src="https://cdn.heweather.com/img/plugin/190516/icon/c/' + res.HeWeather6[0].daily_forecast[i].cond_code_d + myday + '.png"><br><b>' + res.HeWeather6[0].daily_forecast[i].cond_txt_d + '</b><br><i>' + res.HeWeather6[0].daily_forecast[i].tmp_min + '°/' + res.HeWeather6[0].daily_forecast[i].tmp_max + '°' + '</i></li>';
$(".wea_foot ul").append(wea_foot);
}
}
});

Expand Down

0 comments on commit 58d6db8

Please sign in to comment.