Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
fuzui
tiangou
提交
4686bcc2
tiangou
项目概览
fuzui
/
tiangou
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
tiangou
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
4686bcc2
编写于
3月 26, 2020
作者:
X
xiongbao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Update
上级
8c9ac526
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
29 addition
and
13 deletion
+29
-13
.gitignore
.gitignore
+1
-0
assets/js/index.js
assets/js/index.js
+1
-0
index.html
index.html
+27
-13
未找到文件。
.gitignore
0 → 100644
浏览文件 @
4686bcc2
.DS_Store
assets/js/index.js
浏览文件 @
4686bcc2
...
...
@@ -53,5 +53,6 @@ let soul = [
function
randomSoul
(){
document
.
getElementsByTagName
(
'
article
'
)[
0
].
innerHTML
=
soul
[
Math
.
floor
(
Math
.
random
()
*
soul
.
length
)].
replace
(
/
\*\*(
.*
?)\*\*
/g
,
'
<mark>$1</mark>
'
);
document
.
getElementsByTagName
(
'
section
'
)[
0
].
className
=
'
border-
'
+
randomNumBoth
(
1
,
6
);
}
index.html
浏览文件 @
4686bcc2
...
...
@@ -162,25 +162,39 @@
var
num
=
min
+
Math
.
round
(
rand
*
range
);
return
num
;
}
document
.
getElementsByTagName
(
'
section
'
)[
0
].
className
=
'
border-
'
+
randomNumBoth
(
1
,
6
);
$
(
function
(){
/* 获取天气 */
var
date
=
new
Date
();
var
year
=
date
.
getFullYear
().
toString
();
var
month
=
(
date
.
getMonth
()
+
1
).
toString
();
var
day
=
date
.
getDate
().
toString
();
var
city
=
localStorage
.
getItem
(
'
city
'
)
||
''
;
var
cloud
=
localStorage
.
getItem
(
'
cloud
'
)
||
''
;
var
cond
=
localStorage
.
getItem
(
'
cond
'
)
||
''
;
var
dateStart
=
new
Date
(
localStorage
.
getItem
(
'
date
'
)
||
new
Date
());
var
dayDiff
=
date
.
getDate
()
-
dateStart
.
getDate
();
if
(
city
==
''
)
{
$
.
post
(
'
https://free-api.heweather.net/s6/weather/now?location=auto_ip&key=2a0c9b13dec6442887f73698a9be5f4b
'
,
function
(
data
){
var
weather
=
data
.
HeWeather6
[
0
]
||
{};
var
city
=
weather
.
basic
.
parent_city
||
''
;
var
cloud
=
weather
.
now
.
fl
||
''
var
cond
=
weather
.
now
.
cond_txt
||
''
var
date
=
new
Date
();
var
year
=
date
.
getFullYear
().
toString
();
var
month
=
(
date
.
getMonth
()
+
1
).
toString
();
var
day
=
date
.
getDate
().
toString
();
var
weatherHTML
=
'
<time>
'
+
year
+
'
-
'
+
month
+
'
-
'
+
day
+
'
</time><span>
'
+
city
+
'
·
'
+
cond
+
'
·
'
+
cloud
+
'
℃</span>
'
$
(
'
address
'
).
html
(
weatherHTML
);
city
=
weather
.
basic
.
parent_city
||
''
;
cloud
=
weather
.
now
.
fl
||
''
cond
=
weather
.
now
.
cond_txt
||
''
localStorage
.
setItem
(
'
city
'
,
city
);
localStorage
.
setItem
(
'
cloud
'
,
cloud
);
localStorage
.
setItem
(
'
cond
'
,
cond
);
localStorage
.
setItem
(
'
date
'
,
new
Date
());
renderWeather
();
},
'
json
'
)
// 天气结束
})
}
else
{
renderWeather
();
}
function
renderWeather
(){
var
weatherHTML
=
'
<time>
'
+
year
+
'
-
'
+
month
+
'
-
'
+
day
+
'
</time><span>
'
+
city
+
'
·
'
+
cond
+
'
·
'
+
cloud
+
'
℃</span>
'
$
(
'
address
'
).
html
(
weatherHTML
);
}
</script>
<script>
var
_hmt
=
_hmt
||
[];
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录