WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content
This repository was archived by the owner on May 29, 2025. It is now read-only.

Commit d95b270

Browse files
author
底层用户
committed
去除配置文件 & 天气 API 更换
1 parent 0f71818 commit d95b270

File tree

7 files changed

+193
-129
lines changed

7 files changed

+193
-129
lines changed

README.md

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99

1010
>主页的 Logo 字体已经过压缩,若用本站 Logo 以外的字母会变回默认字体,这里是 [完整字体](https://file.imsyy.top/font/Pacifico-Regular.ttf)
1111
12-
>天气 API 每日限量100次,需 [自行申请](https://www.tianqiapi.com/),或更换其他 API
13-
1412
### Demo
1513
>由于 CDN 缓存原因,查看最新效果可能需要 `Ctrl` + `F5` 强制刷新浏览器缓存
1614
@@ -28,7 +26,17 @@
2826
- [x] 移动端适配
2927
* [ ] 还没想好呢
3028

31-
### 配置
29+
30+
### 天气
31+
32+
由于原天气 API 不稳定,已更换天气 API,现需要前往以下网站获取 key
33+
34+
- 前往 [ROLL](https://www.mxnzp.com/doc/list) 获取 app_id 和 app_secret,用于获取城市信息
35+
- 前往 [和风天气](https://dev.qweather.com/) 获取 key,用于获取天气信息
36+
37+
也可自行更换其他方式
38+
39+
<!-- ### 配置
3240
3341
本项目采用 `json` 文件来配置站点内容,该配置不受版本更新影响,可将自定义配置写入 `setting.json` 以更改页面内容
3442
@@ -79,7 +87,7 @@
7987
}
8088
```
8189
82-
</details>
90+
</details> -->
8391

8492
### 音乐
8593

@@ -137,7 +145,8 @@ make clean all
137145

138146
* [MetingAPI By 武恩赐](https://api.wuenci.com/meting/api/)
139147
* [小歪 API](https://api.ixiaowai.cn/)
140-
* [天气 API](https://www.tianqiapi.com/)
148+
* [和风天气](https://dev.qweather.com/)
149+
* [ROLL](https://www.mxnzp.com/doc/list)
141150
* [Hitokoto 一言](https://hitokoto.cn/)
142151

143152
<a title="SSL" target="_blank" href="https://myssl.com/seal/detail?domain=blog.imsyy.top"><img src="https://img.shields.io/badge/MySSL-安全认证-brightgreen"></a>&nbsp;<a title="CDN" target="_blank" href="https://cdnjs.com/"><img src="https://img.shields.io/badge/CDN-Cloudflare-blue"></a>&nbsp;<a title="Copyright" target="_blank" href="https://imsyy.top/"><img src="https://img.shields.io/badge/Copyright%20%C2%A9%202020--2022-%E7%84%A1%E5%90%8D-red"></a>

README_EN.md

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ Simple little homepage, had enough of the original one and made a new one
99

1010
>The logo font on the home page has been compressed, so if you use a font other than this logo, it will change back to the default font, Here is the [full font](https://file.imsyy.top/font/Pacifico-Regular.ttf)
1111
12-
>Weather API is limited to 100 times per day, must [Apply on your own](https://www.tianqiapi.com/), or change to another api
13-
1412
### Demo
1513
>Due to CDN caching, you may need `Ctrl` + `F5` to force a browser cache refresh to see the latest results
1614
@@ -28,7 +26,17 @@ Simple little homepage, had enough of the original one and made a new one
2826
- [x] Mobile adaptation
2927
* [ ] Haven't thought about it yet
3028

31-
### Configuration
29+
### Weather
30+
31+
Because the original weather API is unstable, the weather API has been replaced. Now you need to go to the following website to obtain the key
32+
33+
- to [ROLL] (https://www.mxnzp.com/doc/list) for app_id and app_secret, used to capture the city
34+
35+
- to [and wind weather] (https://dev.qweather.com/) to obtain the key, is used to get the weather information
36+
37+
It can also be replaced by other methods
38+
39+
<!-- ### Configuration
3240
3341
This project uses `json` file to configure the site content, the configuration is not affected by version updates, you can write custom configuration to `setting.json` to change the page content
3442
@@ -79,7 +87,7 @@ This project uses `json` file to configure the site content, the configuration i
7987
}
8088
```
8189
82-
</details>
90+
</details> -->
8391

8492
### Music
8593

@@ -137,7 +145,8 @@ make clean all
137145

138146
* [MetingAPI By wuenci](https://api.wuenci.com/meting/api/)
139147
* [小歪 API](https://api.ixiaowai.cn/)
140-
* [天气 API](https://www.tianqiapi.com/)
148+
* [和风天气](https://dev.qweather.com/)
149+
* [ROLL](https://www.mxnzp.com/doc/list)
141150
* [Hitokoto 一言](https://hitokoto.cn/)
142151

143152
<a title="SSL" target="_blank" href="https://myssl.com/seal/detail?domain=blog.imsyy.top"><img src="https://img.shields.io/badge/MySSL-安全认证-brightgreen"></a>&nbsp;<a title="CDN" target="_blank" href="https://cdnjs.com/"><img src="https://img.shields.io/badge/CDN-Cloudflare-blue"></a>&nbsp;<a title="Copyright" target="_blank" href="https://imsyy.top/"><img src="https://img.shields.io/badge/Copyright%20%C2%A9%202020--2022-%E7%84%A1%E5%90%8D-red"></a>

font/Pacifico-Regular.ttf

748 Bytes
Binary file not shown.

index.html

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -181,18 +181,17 @@
181181
</div>
182182
<div class="col times">
183183
<!--时间-->
184-
<div class="time cards">
184+
<div class="time cards" id="upWeather">
185185
<div class="timeshow" id="time">
186186
2000&nbsp;年&nbsp;0&nbsp;月&nbsp;00&nbsp;日&nbsp;<span
187187
class="weekday">星期一</span><br><span class="time-text">00:00:00</span>
188188
</div>
189189
<div class="weather">
190190
<span id="city_text">天气</span>&nbsp;
191191
<span id="wea_text">加载失败</span>&nbsp;
192-
<span id="tem_night"></span>°C~
193-
<span id="tem_day"></span>°C&nbsp;
192+
<span id="tem_text">*</span>°C&nbsp;
194193
<span id="win_text"></span>
195-
<span id="win_speed"></span>
194+
<span id="win_speed">*</span>
196195
</div>
197196
</div>
198197
</div>
@@ -370,7 +369,7 @@
370369
<div class="img-title">
371370
<span class="img-title-big" id="logo-title-other">imsyy</span>
372371
<span class="img-text" id="logo-title-other-small">.top</span><br />
373-
<span class="img-text">&nbsp;v&nbsp;3.2</span>
372+
<span class="img-text">&nbsp;v&nbsp;3.3</span>
374373
<a href="https://github.com/imsyy/home" target="_blank">
375374
<i class="fa-brands fa-github"></i>
376375
</a>
@@ -438,9 +437,14 @@ <h2 class="accordion-header" id="headingTwo">
438437
<i class="fa-solid fa-circle-plus"></i>&nbsp;音乐播放器支持音量控制
439438
</span>
440439
<span class="uptext">
441-
<i class="fa-solid fa-screwdriver-wrench"></i>&nbsp;时光胶囊显示错误</span>
440+
<i class="fa-solid fa-screwdriver-wrench"></i>&nbsp;修复天气 API
441+
</span>
442+
<span class="uptext">
443+
<i class="fa-solid fa-screwdriver-wrench"></i>&nbsp;时光胶囊显示错误
444+
</span>
442445
<span class="uptext">
443-
<i class="fa-solid fa-screwdriver-wrench"></i>&nbsp;移动端动画及细节</span>
446+
<i class="fa-solid fa-screwdriver-wrench"></i>&nbsp;移动端动画及细节
447+
</span>
444448
<span class="uptext">
445449
<i class="fa-solid fa-screwdriver-wrench"></i>&nbsp;图标更换为 Font
446450
Awesome</span>

js/main.js

Lines changed: 88 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ body.addEventListener('mousemove', (e) => {
4343
//移动端去除鼠标样式
4444
switch (true) {
4545
case navigator.userAgent.indexOf('Mobile') > 0:
46-
$('#g-pointer-2').css("display", "none");
46+
$('#g-pointer-2').css("display", "none");
4747
}
4848

4949
//加载完成后执行
@@ -146,27 +146,68 @@ $('#hitokoto').click(function () {
146146
.catch(console.error)
147147
} else {
148148
iziToast.show({
149-
timeout: 2000,
149+
timeout: 1000,
150150
icon: "fa-solid fa-circle-exclamation",
151151
message: '你点太快了吧'
152152
});
153153
}
154154
});
155155

156156
//获取天气
157-
//每日限量 100 次
158-
//请前往 https://www.tianqiapi.com/ 申请(免费)
159-
fetch(localStorage.getItem('weather_api'))
160-
.then(response => response.json())
161-
.then(data => {
162-
$('#wea_text').html(data.wea)
163-
$('#city_text').html(data.city)
164-
$('#tem_night').html(data.tem_night)
165-
$('#tem_day').html(data.tem_day)
166-
$('#win_text').html(data.win)
167-
$('#win_speed').html(data.win_speed)
168-
})
169-
.catch(console.error)
157+
//请前往 https://www.mxnzp.com/doc/list 申请 app_id 和 app_secret
158+
//请前往 https://dev.qweather.com/ 申请 key
159+
const add_id = "wrknltonr0foslhs"; // app_id
160+
const app_secret = "Nlh1c0F6d0ZDU2pDR0J3YVBVbkhudz09"; // app_secret
161+
const key = "433f0c48615a48dfaf2f2b2444297e79" // key
162+
function getWeather() {
163+
fetch("https://www.mxnzp.com/api/ip/self?app_id=" + add_id + "&app_secret=" + app_secret)
164+
.then(response => response.json())
165+
.then(data => {
166+
let str = data.data.city
167+
let city = str.replace(//g, '')
168+
$('#city_text').html(city);
169+
fetch("https://geoapi.qweather.com/v2/city/lookup?location=" + city + "&number=1&key=" + key)
170+
.then(response => response.json())
171+
.then(location => {
172+
let id = location.location[0].id
173+
fetch("https://devapi.qweather.com/v7/weather/now?location=" + id + "&key=" + key)
174+
.then(response => response.json())
175+
.then(weather => {
176+
$('#wea_text').html(weather.now.text)
177+
$('#tem_text').html(weather.now.temp)
178+
$('#win_text').html(weather.now.windDir)
179+
$('#win_speed').html(weather.now.windScale)
180+
})
181+
})
182+
})
183+
.catch(console.error);
184+
}
185+
186+
getWeather();
187+
188+
$('#upWeather').click(function () {
189+
if (times == 0) {
190+
times = 1;
191+
var index = setInterval(function () {
192+
times--;
193+
if (times == 0) {
194+
clearInterval(index);
195+
}
196+
}, 60000);
197+
getWeather();
198+
iziToast.show({
199+
timeout: 2000,
200+
icon: "fa-solid fa-cloud-sun",
201+
message: '实时天气已更新'
202+
});
203+
} else {
204+
iziToast.show({
205+
timeout: 1000,
206+
icon: "fa-solid fa-circle-exclamation",
207+
message: '请稍后再更新哦'
208+
});
209+
}
210+
});
170211

171212
//获取时间
172213
var t = null;
@@ -243,18 +284,41 @@ $("#twitter").mouseover(function () {
243284
$("#link-text").html("通过这里联系我");
244285
});
245286

287+
//自动变灰
288+
var myDate = new Date;
289+
var mon = myDate.getMonth() + 1;
290+
var date = myDate.getDate();
291+
var days = ['4.4', '5.12', '7.7', '9.9', '9.18', '12.13'];
292+
for (var day of days) {
293+
var d = day.split('.');
294+
if (mon == d[0] && date == d[1]) {
295+
document.write(
296+
'<style>html{-webkit-filter:grayscale(100%);-moz-filter:grayscale(100%);-ms-filter:grayscale(100%);-o-filter:grayscale(100%);filter:progid:DXImageTransform.Microsoft.BasicImage(grayscale=1);_filter:none}</style>'
297+
)
298+
$("#change").html("Silence&nbsp;in&nbsp;silence");
299+
$("#change1").html("今天是中国国家纪念日,全站已切换为黑白模式");
300+
window.addEventListener('load', function () {
301+
iziToast.show({
302+
timeout: 14000,
303+
icon: "fa-solid fa-clock",
304+
message: '今天是中国国家纪念日'
305+
});
306+
}, false);
307+
}
308+
}
309+
246310
//更多页面切换
247311
var shoemore = false;
248312
$('#switchmore').on('click', function () {
249313
shoemore = !shoemore;
250314
if (shoemore && $(document).width() >= 990) {
251315
$('#container').attr('class', 'container mores');
252-
$("#change").html(localStorage.getItem('des_tip_change'));
253-
$("#change1").html(localStorage.getItem('des_title_change'));
316+
$("#change").html("Oops&nbsp;!");
317+
$("#change1").html("哎呀,这都被你发现了( 再点击一次可关闭 )");
254318
} else {
255319
$('#container').attr('class', 'container');
256-
$("#change").html(localStorage.getItem('des_tip'));
257-
$("#change1").html(localStorage.getItem('des_title'));
320+
$("#change").html("Hello&nbsp;World&nbsp;!");
321+
$("#change1").html("一个建立于 21 世纪的小站,存活于互联网的边缘");
258322
}
259323
});
260324

@@ -302,8 +366,8 @@ window.addEventListener('load', function () {
302366
if (window.innerWidth <= 990) {
303367
//移动端隐藏更多页面
304368
$('#container').attr('class', 'container');
305-
$("#change").html(localStorage.getItem('des_tip'));
306-
$("#change1").html(localStorage.getItem('des_title'));
369+
$("#change").html("Hello&nbsp;World&nbsp;!");
370+
$("#change1").html("一个建立于 21 世纪的小站,存活于互联网的边缘");
307371

308372
//移动端隐藏弹窗页面
309373
$('#box').css("display", "none");
@@ -341,29 +405,6 @@ document.oncontextmenu = function () {
341405
return false;
342406
}
343407

344-
//自动变灰
345-
var myDate = new Date;
346-
var mon = myDate.getMonth() + 1;
347-
var date = myDate.getDate();
348-
var days = ['4.4', '5.12', '7.7', '9.9', '9.18', '12.13'];
349-
for (var day of days) {
350-
var d = day.split('.');
351-
if (mon == d[0] && date == d[1]) {
352-
document.write(
353-
'<style>html{-webkit-filter:grayscale(100%);-moz-filter:grayscale(100%);-ms-filter:grayscale(100%);-o-filter:grayscale(100%);filter:progid:DXImageTransform.Microsoft.BasicImage(grayscale=1);_filter:none}</style>'
354-
)
355-
$("#change").html("Silence&nbsp;in&nbsp;silence");
356-
$("#change1").html("今天是中国国家纪念日,全站已切换为黑白模式");
357-
window.addEventListener('load', function () {
358-
iziToast.show({
359-
timeout: 14000,
360-
icon: "fa-solid fa-candle-holder",
361-
message: '今天是中国国家纪念日'
362-
});
363-
}, false);
364-
}
365-
}
366-
367408
//控制台输出
368409
console.clear();
369410
var styleTitle1 = `
@@ -388,11 +429,11 @@ var title2 = `
388429
|_____|_| |_|_____/ |_| |_|
389430
`
390431
var content = `
391-
版 本 号:3.2
392-
更新日期:2022-06-28
432+
版 本 号:3.3
433+
更新日期:2022-07-06
393434
394435
主页: https://www.imsyy.top
395436
Github: https://github.com/imsyy/home
396437
`
397438
console.log(`%c${title1} %c${title2}
398-
%c${content}`, styleTitle1, styleTitle2, styleContent)
439+
%c${content}`, styleTitle1, styleTitle2, styleContent)

js/music.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ var type = "playlist"; //song: 单曲; playlist: 歌单; album: 唱片
1414
var id = "7452421335"; //封面 ID / 单曲 ID / 歌单 ID
1515

1616
$.ajax({
17-
url: "https://api.wuenci.com/meting/api/?server=" + server + "&type=" + type + "&id=" + id, //json文件位置,文件名
17+
url: "https://api.wuenci.com/meting/api/?server=" + server + "&type=" + type + "&id=" + id,
1818
type: "GET",
1919
dataType: "JSON",
2020
success: function (data) {

0 commit comments

Comments
 (0)