This commit is contained in:
hehh
2024-08-14 16:53:07 +08:00
parent e6f8c4daa7
commit d1962cb90f
12 changed files with 216 additions and 229 deletions

View File

@@ -30,56 +30,41 @@ var iUp = (function () {
$(document).ready(function () {
// 获取一言数据
fetch('https://v1.hitokoto.cn').then(function (res) {
fetch('https://v1.hitokoto.cn?c=c&c=d&c=h&c=i&c=k&c=h').then(function (res) {
return res.json();
}).then(function (e) {
$('#description').html(e.hitokoto + "<br/> -「<strong>" + e.from + "</strong>」")
}).catch(function (err) {
console.error(err);
})
// var url = 'https://query.yahooapis.com/v1/public/yql' +
// '?q=' + encodeURIComponent('select * from json where url=@url') +
// '&url=' + encodeURIComponent('https://www.bing.com/HPImageArchive.aspx?format=js&idx=0&n=8') +
// '&format=json&callback=?';
/**
* 获取Bing壁纸
* 原先 YQL 已经无法提供服务了
* 改用 JsonBirdhttps://bird.ioliu.cn/
*
* 自定义壁纸
*/
var url = '';
var imgUrls = JSON.parse(sessionStorage.getItem("imgUrls"));
var index = sessionStorage.getItem("index");
var $panel = $('#panel');
if (imgUrls == null) {
imgUrls = new Array();
index = 0;
$.get(url, function (result) {
images = result.images;
for (let i = 0; i < images.length; i++) {
const item = images[i];
imgUrls.push(item.url);
}
var imgUrl = imgUrls[index];
var url = "https://www.bing.com" + imgUrl;
$panel.css("background", "url('" + url + "') center center no-repeat #666");
$panel.css("background-size", "cover");
sessionStorage.setItem("imgUrls", JSON.stringify(imgUrls));
sessionStorage.setItem("index", index);
});
for (let i = 1; i < 8; i++) {
imgUrls.push("https://cdn.jsdelivr.net/gh/listener-He/Home/images/bj/"+i+".jpg");
}
sessionStorage.setItem("imgUrls", JSON.stringify(imgUrls));
sessionStorage.setItem("index", index);
} else {
if (index == 7)
index = 0;
else
index++;
var imgUrl = imgUrls[index];
var url = "https://www.bing.com" + imgUrl;
$panel.css("background", "url('" + url + "') center center no-repeat #666");
$panel.css("background-size", "cover");
sessionStorage.setItem("index", index);
}
var imgUrl = imgUrls[index];
var url = "https://www.bing.com" + imgUrl;
$panel.css("background", "url('" + url + "') center center no-repeat #666");
$panel.css("background-size", "cover");
$(".iUp").each(function (i, e) {
iUp.up(e);
});