Update login.html

This commit is contained in:
Mimi 2020-07-21 23:37:27 +08:00
parent 59dbbf85e1
commit b6f9613eca

View File

@ -4,7 +4,7 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>看板娘登陆平台</title> <title>看板娘登陆平台</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap/dist/css/bootstrap.min.css"> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4/dist/css/bootstrap.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/font-awesome/css/font-awesome.min.css"> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/font-awesome/css/font-awesome.min.css">
<script src="../live2d.min.js"></script> <script src="../live2d.min.js"></script>
<style> <style>
@ -177,7 +177,7 @@ window.addEventListener("load", () => {
return; return;
} }
var apiPath = "https://live2d.fghrsh.net/api", state = 0, let apiPath = "https://live2d.fghrsh.net/api", state = 0,
modelId = localStorage.getItem("modelId"), modelId = localStorage.getItem("modelId"),
modelTexturesId = localStorage.getItem("modelTexturesId"); modelTexturesId = localStorage.getItem("modelTexturesId");
if (modelId === null) { if (modelId === null) {
@ -199,7 +199,7 @@ window.addEventListener("load", () => {
} }
function loadRandModel() { function loadRandModel() {
var modelId = localStorage.getItem("modelId"), const modelId = localStorage.getItem("modelId"),
modelTexturesId = localStorage.getItem("modelTexturesId"); modelTexturesId = localStorage.getItem("modelTexturesId");
fetch(`${apiPath}/rand_textures/?id=${modelId}-${modelTexturesId}`) fetch(`${apiPath}/rand_textures/?id=${modelId}-${modelTexturesId}`)
.then(response => response.json()) .then(response => response.json())
@ -214,7 +214,7 @@ window.addEventListener("load", () => {
} }
function loadOtherModel() { function loadOtherModel() {
var modelId = localStorage.getItem("modelId"); const modelId = localStorage.getItem("modelId");
fetch(`${apiPath}/switch/?id=${modelId}`) fetch(`${apiPath}/switch/?id=${modelId}`)
.then(response => response.json()) .then(response => response.json())
.then(result => { .then(result => {
@ -232,14 +232,14 @@ window.addEventListener("load", () => {
.then(result => { .then(result => {
alert("「" + result.hitokoto + "」——" + result.from); alert("「" + result.hitokoto + "」——" + result.from);
}); });
} };
window.refresh = function() { window.refresh = function() {
state = 0; state = 0;
coverPosition("10%"); coverPosition("10%");
document.getElementById("refresh").setAttribute("href", "javascript:void(0)"); document.getElementById("refresh").setAttribute("href", "javascript:void(0)");
setTimeout(loadRandModel, 1000); setTimeout(loadRandModel, 1000);
} };
document.getElementById("handle").addEventListener("click", () => { document.getElementById("handle").addEventListener("click", () => {
if (state === 1) { if (state === 1) {