mirror of
https://github.com/hanxi/xiaomusic.git
synced 2025-12-18 16:53:33 +08:00
新增设置声音按钮
This commit is contained in:
@@ -6,18 +6,35 @@ $(function(){
|
||||
$container=$("#cmds");
|
||||
// 遍历数据
|
||||
for (const [key, value] of Object.entries(data)) {
|
||||
if (key != "分钟后关机" && key != "放歌曲") {
|
||||
append_op_button(key);
|
||||
if (key != "分钟后关机"
|
||||
&& key != "放歌曲"
|
||||
&& key != "停止播放"
|
||||
&& !key.includes("#")) {
|
||||
append_op_button_name(key);
|
||||
}
|
||||
}
|
||||
|
||||
append_op_button("5分钟后关机");
|
||||
append_op_button("10分钟后关机");
|
||||
append_op_button("30分钟后关机");
|
||||
append_op_button("60分钟后关机");
|
||||
$container.append($("<hr>"));
|
||||
append_op_button_name("10分钟后关机");
|
||||
append_op_button_name("30分钟后关机");
|
||||
append_op_button_name("60分钟后关机");
|
||||
|
||||
$container.append($("<hr>"));
|
||||
append_op_button_volume("声音设为5", 5);
|
||||
append_op_button_volume("声音设为10", 10);
|
||||
append_op_button_volume("声音设为30", 30);
|
||||
append_op_button_volume("声音设为50", 50);
|
||||
append_op_button_volume("声音设为80", 80);
|
||||
append_op_button_volume("声音设为100", 100);
|
||||
});
|
||||
|
||||
function append_op_button(name) {
|
||||
function append_op_button_volume(name, value) {
|
||||
append_op_button(name, "set_volume#"+value);
|
||||
}
|
||||
function append_op_button_name(name) {
|
||||
append_op_button(name, name);
|
||||
}
|
||||
function append_op_button(name, cmd) {
|
||||
// 创建按钮
|
||||
const $button = $("<button>");
|
||||
$button.text(name);
|
||||
@@ -30,7 +47,7 @@ $(function(){
|
||||
type: "POST",
|
||||
url: "/cmd",
|
||||
contentType: "application/json",
|
||||
data: JSON.stringify({cmd: name}),
|
||||
data: JSON.stringify({"cmd": cmd}),
|
||||
success: () => {
|
||||
// 请求成功时执行的操作
|
||||
},
|
||||
|
||||
@@ -10,8 +10,17 @@
|
||||
margin: 10px;
|
||||
width: 100px;
|
||||
height: 50px;
|
||||
border: none; /* 无边框 */
|
||||
color: white; /* 白色文字 */
|
||||
text-align: center; /* 文字居中 */
|
||||
text-decoration: none; /* 无下划线 */
|
||||
display: inline-block; /* 行内块元素 */
|
||||
border-radius: 10px; /* 圆角 */
|
||||
background-color: #008CBA; /* 蓝色 */
|
||||
}
|
||||
input {
|
||||
margin: 10px;
|
||||
width: 200px;
|
||||
height: 40px;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user