New chess.

This commit is contained in:
AnduinXue
2024-01-01 07:31:24 +00:00
parent 7747e2814a
commit 0105d7079a
3 changed files with 49 additions and 39 deletions
@@ -1,19 +1,24 @@
<!DOCTYPE html>
<!DOCTYPE HTML>
<html lang="en" class="h-100">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>@ViewData["Title"] - Aiursoft Chess Server</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0">
<meta name="apple-mobile-web-app-capable" content="yes">
<link rel="icon" type="image/x-icon" href="~/favicon.ico" />
<title>Game - Aiursoft Chess Server</title>
<link rel="stylesheet" href="~/node_modules/@@aiursoft/autodark.js/dist/css/autodark.min.css" />
<link rel="stylesheet" href="~/node_modules/@@chrisoakman/chessboardjs/dist/chessboard-1.0.0.min.css" />
</head>
<body class="d-flex flex-column h-100">
<header>
<nav class="navbar navbar-expand-sm navbar-toggleable-sm border-bottom box-shadow mb-3">
<nav class="navbar fixed-top navbar-expand-md">
<div class="container">
<a class="navbar-brand" asp-controller="Home" asp-action="Index">Aiursoft Chess Server</a>
<a class="navbar-brand" href="https://www.aiursoft.cn">
Aiursoft
</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsExampleDefault"
aria-controls="navbarsExampleDefault" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
@@ -21,13 +26,16 @@
<div class="collapse navbar-collapse" id="navbarsExampleDefault">
<ul class="navbar-nav mr-auto">
<li class="nav-item active">
<a class="nav-link" href="/">关于</a>
<a class="nav-link" asp-controller="Home" asp-action="Index">Chess</a>
</li>
</ul>
<div class="form-inline">
<ul class="navbar-nav mr-auto">
<li class="nav-item">
<a title="Manage" id="player-nick-name" class="nav-link" href="#">未登录</a>
<a class="nav-link" href="https://gitlab.aiursoft.cn/aiursoft/chessserver">
<i class="fab fa-gitlab"></i>
View on GitLab
</a>
</li>
</ul>
</div>
@@ -43,32 +51,16 @@
<footer class="footer mt-auto py-3">
<div class="container">
&copy; @DateTime.UtcNow.Year - Aiursoft.ChessServer
&copy; @DateTime.UtcNow.Year - Aiursoft.ChessServer - <a
href="https://gitlab.aiursoft.cn/aiursoft/chessserver">GitLab</a>
</div>
</footer>
<script type="module" src="~/node_modules/jquery/dist/jquery.min.js" defer></script>
<script type="module" src="~/node_modules/bootstrap/dist/js/bootstrap.bundle.min.js" defer></script>
<script type="module" src="~/node_modules/@@chrisoakman/chessboardjs/dist/chessboard-1.0.0.min.js" defer></script>
<script type="module">
import { autoTheme } from '/node_modules/@@aiursoft/autodark.js/dist/esm/autodark.js';
import { getUserName, changeName } from "/scripts/player.js";
autoTheme()
async function loadName() {
document.getElementById("player-nick-name").innerText = await getUserName();
}
async function promptChangeName() {
const newName = prompt("Please enter your new name:");
if (newName) {
await changeName(newName);
await loadName();
}
}
await loadName();
document.getElementById("player-nick-name").addEventListener("click", promptChangeName);
</script>
<script type="module" src="~/scripts/layout.js" defer></script>
@(await RenderSectionAsync("scripts", false))
</body>
</html>
</html>
+8 -10
View File
@@ -1,16 +1,14 @@
{
"name": "wwwroot",
"version": "1.0.0",
"description": "",
"main": "chess.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"description": "This is a server side application. This package is used to host the static files.",
"author": "Anduin Xue",
"license": "MIT",
"dependencies": {
"@aiursoft/autodark.js": "^1.0.3",
"@aiursoft/autodark.js": "^1.0.4",
"@chrisoakman/chessboardjs": "^1.0.0",
"chess.js": "^1.0.0-beta.6"
"chess.js": "^1.0.0-beta.6",
"jquery-validation": "^1.19.5",
"jquery-validation-unobtrusive": "^3.2.12"
}
}
}
@@ -0,0 +1,20 @@
import { autoTheme } from "/node_modules/@aiursoft/autodark.js/dist/esm/autodark.js";
import { getUserName, changeName } from "/scripts/player.js";
autoTheme();
async function loadName() {
document.getElementById("player-nick-name").innerText = await getUserName();
}
async function promptChangeName() {
const newName = prompt("Please enter your new name:");
if (newName) {
await changeName(newName);
await loadName();
}
}
await loadName();
document
.getElementById("player-nick-name")
.addEventListener("click", promptChangeName);