Skip to content

Commit

Permalink
feat: update config
Browse files Browse the repository at this point in the history
  • Loading branch information
kaygb committed Sep 4, 2024
1 parent 5a03614 commit 709f4bc
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 65 deletions.
20 changes: 15 additions & 5 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,22 @@
<style>
body {
/*背景图片URL 可使用随机图片API */
background-image: url("https://bu.dusays.com/2022/06/04/629b0a2a89425.png");
background-image: url("./static/images/bg.jpeg");
}

.photo-bg {
/* 卡片左侧图片 */
background-image: url("https://bu.dusays.com/2022/06/04/629b0a2750921.jpg");
background-image: url("./static/images/fbg.jpg");
}

.kz-video {
/* 背景视频,none: 不显示 unset 显示 */
display: none;
}
</style>
<script>
// 音乐设置
let meting_music_api = "https://meting.170601.xyz";// meting api
let meting_music_api = "https://www.kezez.com/api/meting-api/";// meting api
let music_server = "netease"; // 音乐服务:网易云 netease 参见 meting api支持的服务
let music_type = "playlist"; // 歌曲类型:歌单playlist 单首歌曲 song 专辑 album
let music_id = "8362718673"; // 歌单ID或歌曲ID或者专辑ID 20173709 29732992
Expand All @@ -42,7 +47,9 @@
let music_volume = 0.7; // 默认音量
let music_autoplay = false; // 自动播放
let music_loop = "all"; // 音频循环播放, 可选值: 'all', 'one', 'none' ,分别为全部循环,单曲循环,不循环
// TODO 一言设置

// 一言设置
let hitokoto_api = "https://v1.hitokoto.cn"; // 一言API
</script>
<!-- end 自定义设置 -->
</head>
Expand Down Expand Up @@ -96,8 +103,11 @@ <h1>KZHomePage</h1>
<footer>
<p>Copyright 2018 - Now <a href="https://www.170601.xyz/" target="_blank">七六零一</a>
<a href="http://beian.miit.gov.cn/" target="_blank">豫ICP备00000000号-1</a>
<br>Mod by
<br>
<a href="https://github.com/kaygb/KZHomePage" target="_blank" rel="">KZHomePage</a>
Mod by
<a href="https://github.com/kaygb" target="_blank" rel="">kaygb</a>
<br>
<a href="https://console.upyun.com/register/?invite=r1FdZxBoH" target="_blank"
rel="nofollow"><img src="https://bu.dusays.com/2021/12/15/9991d2344d2ca.png"
style="width:50px;"></a>
Expand Down
Binary file added static/images/bg.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/images/fbg.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
114 changes: 54 additions & 60 deletions static/main.js
Original file line number Diff line number Diff line change
@@ -1,90 +1,84 @@
var windowWidth = $(window).width();
layer.config({
extend: 'kzhomepage/style.css', //加载扩展样式
skin: 'layer-ext-kzhomepage'
extend: "kzhomepage/style.css", //加载扩展样式
skin: "layer-ext-kzhomepage",
});

// Nav buttons
$('.kz-nav-btn').on('click', function() {
$(".kz-nav-btn").on("click", function () {
let btn = $(this);
let type = btn.data('window') // pop current newtab
let content = btn.data('href')
let type = btn.data("window"); // pop current newtab
let content = btn.data("href");
switch (type) {
case 'pop':
let title = btn.data('title')
let shadeClose = btn.data('shade') === 'true' ? false : true
let anim = btn.data('anim') ? btn.data('anim')*1 : 4
let area_w = btn.data('area-w') ? btn.data('area-w') : '80%'
let area_h = btn.data('area-h') ? btn.data('area-h') : '90%'
case "pop":
let title = btn.data("title");
let shadeClose = btn.data("shade") === "true" ? false : true;
let anim = btn.data("anim") ? btn.data("anim") * 1 : 4;
let area_w = btn.data("area-w") ? btn.data("area-w") : "80%";
let area_h = btn.data("area-h") ? btn.data("area-h") : "90%";
layer.open({
type: 2,
title: title,
shadeClose: shadeClose,
anim:anim,
closeBtn: 2,
isOutAnim: false,
area: [area_w, area_h],
content: content
type: 2,
title: title,
shadeClose: shadeClose,
anim: anim,
closeBtn: 2,
isOutAnim: false,
area: [area_w, area_h],
content: content,
});
break;
case 'current':
window.location = content
case "current":
window.location = content;
break;
case 'newtab':
window.open('_blank').location = content
case "newtab":
window.open("_blank").location = content;
break;
}
});

console.log(
"\n" +
" %c KZHomePage v1.2.0 by kaygb " +
" %c https://blog.170601.xyz/archives/25.html " +
"\n" +
" %c KZHomePage v1.2.0 by kaygb " +
" %c https://blog.170601.xyz/archives/25.html " +
"\n" +
"\n",
"color: #fff; background: #fd79a8; padding:5px 0;",
"background: #FFF; padding:5px 0;"
);
// 兼容旧版
if(meting_music_api===""){
meting_api = "https://api.mizore.cn/meting/api.php";
}
var meting_api =
"https://api.mizore.cn/meting/api.php?server=:server&type=:type&id=:id";
"\n",
"color: #fff; background: #fd79a8; padding:5px 0;",
"background: #FFF; padding:5px 0;"
);

$.ajax({
// url: "https://api.mizore.cn/meting/api.php?server=netease&type=playlist&id=20173709",
url: meting_music_api,
data:{
data: {
server: music_server,
type: music_type,
id: music_id
id: music_id,
},
dataType: "json",
success: function (audio) {
const ap = new APlayer({
container: music_fixed === false ? document.getElementById('aplayer-inner') : document.getElementById('aplayer-fixed') ,
audio: audio,
fixed: music_fixed === false ? false : true,
autoplay: music_autoplay,
order: music_order,
listFolded :true,
volum: music_volume,
mini: music_fixed === true ? true:music_mini,
lrcType: 3,
preload:"auto",
loop: music_loop


container:
music_fixed === false
? document.getElementById("aplayer-inner")
: document.getElementById("aplayer-fixed"),
audio: audio,
fixed: music_fixed === false ? false : true,
autoplay: music_autoplay,
order: music_order,
listFolded: true,
volum: music_volume,
mini: music_fixed === true ? true : music_mini,
lrcType: 3,
preload: "auto",
loop: music_loop,
});
},
});

fetch('https://v1.hitokoto.cn')
.then(response => response.json())
.then(data => {
const hitokoto = document.getElementById('hitokoto_text')
hitokoto.href = 'https://hitokoto.cn/?uuid=' + data.uuid
hitokoto.innerText = data.hitokoto
})
.catch(console.error)
fetch(hitokoto_api)
.then((response) => response.json())
.then((data) => {
const hitokoto = document.getElementById("hitokoto_text");
hitokoto.href = "https://hitokoto.cn/?uuid=" + data.uuid;
hitokoto.innerText = data.hitokoto;
})
.catch(console.error);
1 change: 1 addition & 0 deletions static/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ h4 {

/* 视频背景 */
.kz-video {
display: none;
position: fixed;
width: 100%;
height: 100%;
Expand Down

0 comments on commit 709f4bc

Please sign in to comment.