1 Star 0 Fork 39

魏玉新/baye-alpha

forked from BGWP/baye-alpha 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
load.html 3.86 KB
一键复制 编辑 原始数据 按行查看 历史
Kevin 提交于 2022-08-25 17:31 . Move css/js in CDN into repo
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>载入存档</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=no" id="viewport" name="viewport">
<link rel="stylesheet" type="text/css" href="css/baye.css" />
<script src="js/lzma_worker-min.js"></script>
<script src="js/base64.js"></script>
<script src="js/jquery.min.js"></script>
<script src="js/spin.min.js"></script>
</head>
<body>
<script>
var opts = {
lines: 13 // The number of lines to draw
, length: 28 // The length of each line
, width: 14 // The line thickness
, radius: 42 // The radius of the inner circle
, scale: 1 // Scales overall size of the spinner
, corners: 1 // Corner roundness (0..1)
, color: '#000' // #rgb or #rrggbb or array of colors
, opacity: 0.25 // Opacity of the lines
, rotate: 0 // The rotation offset
, direction: 1 // 1: clockwise, -1: counterclockwise
, speed: 1 // Rounds per second
, trail: 60 // Afterglow percentage
, fps: 20 // Frames per second when using setTimeout() as a fallback for CSS
, zIndex: 2e9 // The z-index (defaults to 2000000000)
, className: 'spinner' // The CSS class to assign to the spinner
, top: '50%' // Top position relative to parent
, left: '50%' // Left position relative to parent
, shadow: true // Whether to render a shadow
, hwaccel: true // Whether to use hardware acceleration
, position: 'absolute' // Element positioning
};
var spinner = new Spinner(opts);
function loadSav(data) {
function filename(n) {
return "baye//data//sango" + n + ".sav";
}
function load(data) {
var tuple = data.split("/");
var len = tuple[0];
var hex = tuple[1];
if (!len || !hex || hex.length != len) {
throw "存档已损坏";
} else {
var tuple = hex.split("_");
localStorage[filename(6)] = tuple[0];
localStorage[filename(6+1)] = tuple[1];
}
}
function loadOrErr(data) {
try {
load(data);
$("#tip").html("存档已载入到第4个存档位");
} catch(e) {
$("#tip").html("<div style='color: red;'>载入失败: " + e + "</div>");
}
}
if (data) {
if (data.length < 100 && data.includes('-')) {
spinner.spin(document.body);
$.get("https://store.kvin.wang/kvstore/" + data, function(resp) {
spinner.stop();
loadOrErr(resp.data);
$("#sav-url").val(resp.data);
}).fail(function(x) {
spinner.stop();
$("#tip").html("<div style='color: red;'>载入失败 Error:" + x.statusCode().status + "</div>");
});
} else {
loadOrErr(data);
}
} else {
$("#tip").html("<div style='color: red;'>载入失败</div>");
}
}
function loadInput() {
var url = $("#sav-url").val();
if (url && url.length) {
loadSav(url);
}
}
</script>
<div class="container" style="margin-top:2px">
<textarea id="sav-url" rows="10" style="width: 100%" placeholder="贴入存档代码或云端码"></textarea>
</div>
<div class="container" style="margin-top:2px">
<button class="btn menu" type="button" onclick="loadInput()">导入存档</button>
</div>
<div class="container" style="margin-top:2px">
<button class="btn menu" type="button" onclick="location='index.html';">返回游戏</button>
</div>
<div id="tip"></div>
</body>
</html>
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/wyx_develop/baye-alpha.git
git@gitee.com:wyx_develop/baye-alpha.git
wyx_develop
baye-alpha
baye-alpha
s2

搜索帮助