Commit ba949157 authored by Pani's avatar Pani

add username

parents
srvpro.ygo233.com
\ No newline at end of file
## SRVPro-Dashboards
[http://srvpro.ygo233.com/](http://srvpro.ygo233.com/)
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>SRVPro Dashboard</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
<link href="/static/style.css" rel="stylesheet">
</head>
<body>
<header class="container">
<h1 class="title">SRVPro Dashboard</h1>
</header>
<div class="container">
<div class="row grid">
<div class="col-lg-1">
<input type="text" class="form-control" id="http" value="http" placeholder="http">
</div>
<div class="col-lg-2">
<input type="text" class="form-control" id="ip" value="" placeholder="IP">
</div>
<div class="col-lg-1">
<input type="text" class="form-control" id="port" value="" placeholder="port">
</div>
<div class="col-lg-2">
<input type="text" class="form-control" id="username" value="" placeholder="username">
</div>
<div class="col-lg-2">
<input type="password" class="form-control" id="password" value="" placeholder="password">
</div>
<div class="col-lg-4">
<button class="btn btn-default" id="open_button">Refresh</button>
<button class="btn btn-default" id="auto_button">Auto Refresh</button>
<span id="num">0</span> Rooms in total
</div>
</div>
<div class="row buttons">
<div class="col-lg-12">
<input type="text" class="form-control" id="shout" value="" placeholder="Message">
</div>
</div>
<div class="row buttons">
<div class="col-lg-12">
<button class="btn btn-default" id="shout_button" data-toggle="tooltip" title="Send public messages to the server.">Shout</button>
<button class="btn btn-default" id="stop_button" data-toggle="tooltip" title="Forbid creating new rooms, but not affecting the current rooms.">Stop Server</button>
<button class="btn btn-default" id="welcome_button" data-toggle="tooltip" title="Edit welcome Message.">Welcome</button>
<button class="btn btn-default" id="tips_button" data-toggle="tooltip" title="Refresh hints.">Hint</button>
<button class="btn btn-default" id="dialogues_button" data-toggle="tooltip" title="Refresh dialogues.">Dialogue</button>
<button class="btn btn-default" id="ban_button" data-toggle="tooltip" title="Ban player">Ban</button>
<button class="btn btn-default" id="kick_button" data-toggle="tooltip" title="Terminate a room. Input the room ID for a specific room, or 'all' for all rooms.">Terminate</button>
<button class="btn btn-default" id="death_button" data-toggle="tooltip" title="Start Extra Duel. Input the room ID for a specific room, or leave blank for all rooms.">Extra Duel</button>
<button class="btn btn-default" id="deathcancel_button" data-toggle="tooltip" title="Cancel Extra Duel. Input the room ID for a specific room, or leave blank for all rooms.">Cancel Extra Duel</button>
<span id="message_callback"></span>
</div>
</div>
</div>
<div class="container">
<hr>
<div class="row">
<div class="col-lg-12">
<table class="table table-striped" id="rooms">
<thead>
<th width="5%">ID</th>
<th width="10%">Name</th>
<th width="35%">Player 1</th>
<th width="35%">Player 2</th>
<th width="15%">Status</th>
</thead>
<tbody></tbody>
</table>
</div>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/jquery@2.2.4/dist//jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/js/bootstrap.min.js"></script>
<script src="/dashboard-script.js"></script>
<script src="http://s4.cnzz.com/z_stat.php?id=1255875151&web_id=1255875151"></script>
</body>
</html>
$(function(){
$("body").tooltip({selector: "[data-toggle='tooltip']", trigger: "hover"});
$("#open_button").click(loadrooms);
$("#auto_button").click(autoload);
$("#shout_button").click(shout);
$("#stop_button").click(stop);
$("#welcome_button").click(welcome);
$("#tips_button").click(load_tips);
$("#dialogues_button").click(load_dialogues);
$("#ban_button").click(ban_player);
$("#kick_button").click(kick_room);
$("#death_button").click(start_death);
$("#deathcancel_button").click(cancel_death);
var params=parseQueryString();
$("#ip").val(params["ip"]);
$("#port").val(params["port"]);
$("#password").val(params["password"]);
$("#username").val(params["username"]);
});
function parseQueryString() {
//http://stackoverflow.com/questions/523266/how-can-i-get-a-specific-parameter-from-location-search
var str = window.location.search;
var objURL = {};
str.replace(
new RegExp( "([^?=&]+)(=([^&]*))?", "g" ),
function( $0, $1, $2, $3 ){
objURL[ $1 ] = $3;
}
);
return objURL;
}
function loadrooms() {
var url=$("#http").val() + "://" + $("#ip").val() + ":" + $("#port").val() + "/api/getrooms?callback=?"+ ($("#username").val() ? "&username="+$("#username").val() : "") + ($("#password").val() ? "&pass="+$("#password").val() : "");
alert(url);
$.getJSON(url, listroom);
$("#open_button").removeClass("btn-success");
}
function autoload() {
if (window.autoLoad) {
window.clearInterval(window.autoLoad);
window.autoLoad=false;
$("#message_callback").text("OFF");
}
else {
/*if (!$("#password").val()) {
alert("请输入密码");
return;
}*/
$("#message_callback").text("ON");
window.autoLoad=window.setInterval(loadrooms,1000);
}
}
function playerinfo(player, mode) {
if (!player)
return "";
var info = player.name;
if (player.status) {
var status = "";
if (mode == 1)
status = status + "Score: " + player.status.score + " " ;
if (mode != 2 || player.pos % 2 == 0)
status = status + "LP: "+ player.status.lp;
if (mode != 2)
status = status + " Cards: "+ player.status.cards;
if (status != "")
info = info + " <em>(" + status + ")</em>";
}
if (player.ip)
info = info +"<br><code>IP: " + player.ip + "</code>";
return info;
}
function listroom(data) {
$("#open_button").addClass("btn-success");
$("#num").text(data.rooms.length);
var tbody=$("<tbody></tbody>");
for (i in data.rooms) {
var room=data.rooms[i];
var tr=$("<tr></tr>");
room.duelers=[];
room.watchers=[];
for (j in room.users) {
if (room.users[j].pos==7) {
room.watchers.push(room.users[j]);
}
else {
room.duelers.push(room.users[j]);
}
}
tr.append($("<td>"+room.roomid+"</td>"));
tr.append($("<td>"+ ((room.needpass == "true") ? "<span class='glyphicon glyphicon-lock'></span>" : "") + room.roomname+ "</td>"));
if (room.roommode != 2) {
tr.append($("<td>"+playerinfo(room.duelers[0], room.roommode)+"</td>"));
tr.append($("<td>"+playerinfo(room.duelers[1], room.roommode)+"</td>"));
}
else {
tr.append($("<td>"+playerinfo(room.duelers[0], 2)+"<br>"+playerinfo(room.duelers[1], 2)+"</td>"));
tr.append($("<td>"+playerinfo(room.duelers[2], 2)+"<br>"+playerinfo(room.duelers[3], 2)+"</td>"));
}
var watchlist="";
if (room.watchers.length) {
for (j in room.watchers) {
watchlist+=room.watchers[j].name+"\r\n";
}
}
tr.append($("<td>"+ (watchlist ? "<span class='glyphicon glyphicon-eye-open' data-toggle='tooltip' title='" + watchlist + "'></span>" : "") + room.istart +"</td>"));
tbody.append(tr);
}
$("#rooms tbody").remove();
$("#rooms").append(tbody);
}
function shout() {
$("#message_callback").text('...');
var url=$("#http").val() + "://" + $("#ip").val() + ":" + $("#port").val() + "/api/message?shout=" + $("#shout").val() + "&username="+$("#username").val()+"&pass=" + $("#password").val() + "&callback=?";
$.getJSON(url, shoutcallback);
}
function stop() {
if (confirm("Are you sure to stop the server?")) {
$("#message_callback").text('...');
var url=$("#http").val() + "://" + $("#ip").val() + ":" + $("#port").val() + "/api/message?stop=" + $("#shout").val() +"&username="+$("#username").val()+ "&pass=" + $("#password").val() + "&callback=?";
$.getJSON(url, shoutcallback);
}
}
function welcome() {
if ($("#shout").val().length) {
$("#message_callback").text('...');
var url=$("#http").val() + "://" + $("#ip").val() + ":" + $("#port").val() + "/api/message?welcome=" + $("#shout").val() + "&username="+$("#username").val()+"&pass=" + $("#password").val() + "&callback=?";
$.getJSON(url, shoutcallback);
}
else {
$("#message_callback").text('...');
var url=$("#http").val() + "://" + $("#ip").val() + ":" + $("#port").val() + "/api/message?getwelcome=1&pass=" + $("#password").val() + "&username="+$("#username").val()+ "&callback=?";
$.getJSON(url, shoutcallback);
}
}
function load_tips() {
$("#message_callback").text('...');
var url=$("#http").val() + "://" + $("#ip").val() + ":" + $("#port").val() + "/api/message?loadtips=1&pass=" + $("#password").val() + "&username="+$("#username").val() + "&callback=?";
$.getJSON(url, shoutcallback);
}
function load_dialogues() {
$("#message_callback").text('...');
var url=$("#http").val() + "://" + $("#ip").val() + ":" + $("#port").val() + "/api/message?loaddialogues=1&pass=" + $("#password").val() +"&username="+$("#username").val() +"&callback=?";
$.getJSON(url, shoutcallback);
}
function ban_player() {
if (confirm("Are you sure to ban this player?")) {
$("#message_callback").text('...');
var url=$("#http").val() + "://" + $("#ip").val() + ":" + $("#port").val() + "/api/message?ban=" + $("#shout").val() + "&pass=" + $("#password").val() +"&username="+$("#username").val() +"&callback=?";
$.getJSON(url, shoutcallback);
}
}
function kick_room() {
if (confirm("Are you sure to terminate this duel?")) {
$("#message_callback").text('...');
var url=$("#http").val() + "://" + $("#ip").val() + ":" + $("#port").val() + "/api/message?kick=" + $("#shout").val() + "&pass=" + $("#password").val() + "&username="+$("#username").val() +"&callback=?";
$.getJSON(url, shoutcallback);
}
}
function start_death() {
if (confirm("Are you sure to start Extra Duel?")) {
if ($("#shout").val().length) {
$("#message_callback").text('...');
var url=$("#http").val() + "://" + $("#ip").val() + ":" + $("#port").val() + "/api/message?death=" + $("#shout").val() + "&pass=" + $("#password").val() +"&username="+$("#username").val() +"&callback=?";
$.getJSON(url, shoutcallback);
}
else {
$("#message_callback").text('...');
var url=$("#http").val() + "://" + $("#ip").val() + ":" + $("#port").val() + "/api/message?death=all&pass=" + $("#password").val() + "&username="+$("#username").val() +"&callback=?";
$.getJSON(url, shoutcallback);
}
}
}
function cancel_death() {
if (confirm("Are you sure to cancel Extra Duel?")) {
if ($("#shout").val().length) {
$("#message_callback").text('...');
var url=$("#http").val() + "://" + $("#ip").val() + ":" + $("#port").val() + "/api/message?deathcancel=" + $("#shout").val() + "&pass=" + $("#password").val() + "&username="+$("#username").val() +"&callback=?";
$.getJSON(url, shoutcallback);
}
else {
$("#message_callback").text('...');
var url=$("#http").val() + "://" + $("#ip").val() + ":" + $("#port").val() + "/api/message?deathcancel=all&pass=" + $("#password").val() + "&username="+$("#username").val() +"&callback=?";
$.getJSON(url, shoutcallback);
}
}
}
function shoutcallback(data) {
$("#message_callback").text(data[0]);
if (data[1]) {
$("#shout").val(data[1]);
}
}
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>SRVPro Dashboard</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
<link href="/static/style.css" rel="stylesheet">
</head>
<body>
<header class="container">
<h1 class="title">SRVPro Dashboard</h1>
</header>
<div class="container">
<div class="row grid">
<div class="col-lg-1">
<input type="text" class="form-control" id="http" value="http" placeholder="http">
</div>
<div class="col-lg-2">
<input type="text" class="form-control" id="ip" value="" placeholder="IP">
</div>
<div class="col-lg-1">
<input type="text" class="form-control" id="port" value="" placeholder="port">
</div>
<div class="col-lg-2">
<input type="text" class="form-control" id="username" value="" placeholder="username">
</div>
<div class="col-lg-2">
<input type="password" class="form-control" id="password" value="" placeholder="password">
</div>
<div class="col-lg-4">
<button class="btn btn-default" id="open_button">刷新</button>
<button class="btn btn-default" id="auto_button">自动刷新</button>
共有<span id="num">0</span>个房间
</div>
</div>
<div class="row buttons">
<div class="col-lg-12">
<input type="text" class="form-control" id="shout" value="" placeholder="喊话">
</div>
</div>
<div class="row buttons">
<div class="col-lg-12">
<button class="btn btn-default" id="shout_button" data-toggle="tooltip" title="向全服所有房间喊话">喊话</button>
<button class="btn btn-default" id="stop_button" data-toggle="tooltip" title="停止新建房间,不影响现有的房间">停服</button>
<button class="btn btn-default" id="welcome_button" data-toggle="tooltip" title="更改欢迎信息">欢迎</button>
<button class="btn btn-default" id="tips_button" data-toggle="tooltip" title="刷新提示信息">提示</button>
<button class="btn btn-default" id="dialogues_button" data-toggle="tooltip" title="刷新台词信息">台词</button>
<button class="btn btn-default" id="ban_button" data-toggle="tooltip" title="封禁玩家">封禁</button>
<button class="btn btn-default" id="kick_button" data-toggle="tooltip" title="中止指定房间的决斗,输入房间号为指定房间,输入 all 为全部房间">中止</button>
<button class="btn btn-default" id="death_button" data-toggle="tooltip" title="开始加时赛,输入房间号为指定房间,不输入为全部房间">加时赛</button>
<button class="btn btn-default" id="deathcancel_button" data-toggle="tooltip" title="取消加时赛,输入房间号为指定房间,不输入为全部房间">取消加时赛</button>
<span id="message_callback"></span>
</div>
</div>
</div>
<div class="container">
<hr>
<div class="row">
<div class="col-lg-12">
<table class="table table-striped" id="rooms">
<thead>
<th width="5%">房号</th>
<th width="10%">房名</th>
<th width="35%">玩家</th>
<th width="35%">玩家</th>
<th width="15%">状态</th>
</thead>
<tbody></tbody>
</table>
</div>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/jquery@2.2.4/dist//jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/js/bootstrap.min.js"></script>
<script src="/dashboard-script.js"></script>
<script src="http://s4.cnzz.com/z_stat.php?id=1255875151&web_id=1255875151"></script>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>SRVPro Deck Dashboard</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
<link href="/static/style.css" rel="stylesheet">
</head>
<body class="deck">
<header class="container">
<h1 class="title">SRVPro 竞赛模式卡组管理</h1>
</header>
<div class="container">
<div class="row grid">
<div class="col-lg-2">
<input type="text" class="form-control" id="ip" value="" placeholder="IP">
</div>
<div class="col-lg-2">
<input type="text" class="form-control" id="port" value="" placeholder="Port">
</div>
<div class="col-lg-2">
<input type="text" class="form-control" id="username" value="" placeholder="Username">
</div>
<div class="col-lg-2">
<input type="password" class="form-control" id="password" value="" placeholder="Password">
</div>
<div class="col-lg-2">
<button class="btn btn-default" id="login_button">登陆</button>
<button class="btn btn-default" id="clear_button">清屏</button>
</div>
</div>
<div class="row buttons hidden">
<div class="col-lg-2">
<button class="btn btn-default" action="get_decks">共有<b id="deckcount">0</b>个卡组</button>
</div>
<div class="col-lg-2">
<button class="btn btn-default" action="get_decks">刷新卡组列表</button>
</div>
<div class="col-lg-2">
<button class="btn btn-default" action="get_bg">刷新卡组背景</button>
</div>
<div class="col-lg-2">
<form class="hidden" id="uploadform" enctype="multipart/form-data">
<input id="filesel" type="file" name="upload" multiple="multiple">
</form>
<button class="btn btn-default" action="upload_decks">上传卡组</button>
</div>
<div class="col-lg-2">
<button class="btn btn-default" action="clear_decks" confirm="此操作不可撤销,确实要删除全部卡组吗?">删除全部卡组</button>
</div>
<div class="col-lg-2">
<button class="btn btn-default" action="upload_to_challonge">上传至Challonge</button>
</div>
</div>
</div>
<div class="container">
<hr>
<div class="row">
<div class="col-lg-3">
<ul id="decklist" class="list-unstyled">
</ul>
</div>
<div class="col-lg-6">
<div id="deck">
<label>卡组</label>
</div>
</div>
<div class="col-lg-3">
<ul id="output" class="list-unstyled deck">
</ul>
</div>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/jquery@2.2.4/dist//jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/js/bootstrap.min.js"></script>
<script>
var ip, port, password;
var apis={}
$(function(){
$("body").tooltip({selector: "[data-toggle='tooltip']"});
$("#login_button").click(login);
$("#clear_button").click(clear);
$(".buttons button").click(function(){openapi($(this).attr("action"),null,$(this).attr("confirm"))});
var params=parseQueryString();
$("#ip").val(params["ip"]);
$("#port").val(params["port"]);
$("#password").val(params["password"]);
$("#username").val(params["username"]);
$("#filesel").change(function() {
upload_decks();
});
});
function parseQueryString() {
//http://stackoverflow.com/questions/523266/how-can-i-get-a-specific-parameter-from-location-search
var str = window.location.search;
var objURL = {};
str.replace(
new RegExp( "([^?=&]+)(=([^&]*))?", "g" ),
function( $0, $1, $2, $3 ){
objURL[ $1 ] = $3;
}
);
return objURL;
}
function output(data) {
var data_li = $('<li>'+ data +'</li>');
data_li.appendTo($("#output"));
data_li[0].scrollIntoView();
}
function clear() {
$("#output").html(" ");
}
function login() {
ip=$("#ip").val();
port=$("#port").val();
password=$("#password").val();
username=$("#username").val();
var es = new EventSource("http://"+ip+":"+port+"/api/msg?username="+username+"&password="+password);
es.onmessage = function(e) {
output(e.data);
if (e.data=="已连接。") {
$(".row.buttons").removeClass("hidden");
openapi("get_bg");
openapi("get_decks");
}
};
es.onerror = function(e) {
$(".row.buttons").addClass("hidden");
output("已断开");
//alert("连接断开!");
es.close();
};
}
apis["get_bg"] = { "tip":" 正在加载卡组背景..." }
apis["get_bg"].callback = function(data) {
$("#deck").css("background-image","url('"+data.url+"')");
output("已加载背景:"+data.desc);
}
apis["get_decks"] = { "tip":" 正在刷新卡组列表..." }
apis["get_decks"].callback = function(data) {
$("#decklist").html(" ");
for (var i in data) {
var deck = data[i];
var deck_li = $('<li data-deck=\''+JSON.stringify(deck)+'\'>'+ deck.name +'</li>');
var del_button = $('<button type="button" class="btn btn-default btn-xs pull-right">删除</button>');
del_button.appendTo(deck_li);
deck_li.appendTo($("#decklist"));
deck_li.click(function(){
apis["show_deck"].callback($(this).data("deck"));
});
del_button.click(function(){
var deck_name=$(this).parent().data("deck").name;
if (confirm("确实要删除"+deck_name+"")) {
openapi("del_deck", deck_name);
}
});
}
output("成功读取"+data.length+"个卡组。");
$("#deckcount").html(data.length);
}
apis["del_deck"] = { "tip":" 正在删除卡组..." }
apis["del_deck"].callback = function(data) {
output(data);
openapi("get_decks");
}
apis["clear_decks"] = { "tip":" 正在确认操作..." }
apis["clear_decks"].callback = function() {
output(data);
openapi("get_decks");
}
apis["upload_to_challonge"] = { "tip":" 正在上传卡组至Challonge..." }
apis["upload_to_challonge"].callback = function() {
output(data);
openapi("get_decks");
}
apis["show_deck"] = {}
apis["show_deck"].callback = function(deck) {
$("#deck").html(" ");
$("#deck").append("<label class='pull-right'>"+deck.name+"</label>");
$("#deck").append("<label>主卡组:<b>"+deck.main.length+"</b></label>");
var deck_main=$('<div></div>');
deck_main.addClass("line"+Math.ceil(deck.main.length/4));
for (var j in deck.main) {
deck_main.append("<img src='http://ygo233.my-card.in/ygopro/pics/"+deck.main[j]+".jpg!thumb'>");
}
deck_main.appendTo($("#deck"));
$("#deck").append("<label>额外卡组:<b>"+deck.extra.length+"</b></label>");
var deck_extra=$('<div></div>');
deck_extra.addClass("line"+deck.extra.length);
for (var j in deck.extra) {
deck_extra.append("<img src='http://ygo233.my-card.in/ygopro/pics/"+deck.extra[j]+".jpg!thumb'>");
}
deck_extra.appendTo($("#deck"));
$("#deck").append("<label>副卡组:<b>"+deck.side.length+"</b></label>");
var deck_side=$('<div></div>');
deck_side.addClass("line"+deck.side.length);
for (var j in deck.side) {
deck_side.append("<img src='http://ygo233.my-card.in/ygopro/pics/"+deck.side[j]+".jpg!thumb'>");
}
deck_side.appendTo($("#deck"));
//output("显示卡组:"+deck.name);
}
function openapi(api, msg, confirm2) {
if (apis[api] && apis[api].tip) {
output(apis[api].tip);
}
else {
output("正在操作...");
}
if(api=="upload_decks") {
$("#filesel").click();
}
else if (!confirm2 || confirm(confirm2)) {
$.getJSON("http://"+ip+":"+port+"/api/"+ api +"?username="+username+"&password="+password + (msg ? "&msg="+encodeURIComponent(msg) : "" ) + "&callback=?", function(data) {
if (apis[api]) {
apis[api].callback(data);
}
else {
output(data);
}
});
}
}
function upload_decks() {
var filesel=$('#filesel')[0];
if (!filesel.files.length) { return; }
var formData = new FormData();
for (var i=0; i < filesel.files.length; i++) {
formData.append('upload['+i+']', filesel.files[i]);
}
$.ajax({
url: "http://"+ip+":"+port+"/api/upload_decks?username="+username+"password="+password,
type: 'POST',
cache: false,
data: formData,
processData: false,
contentType: false
}).done(function(result) {
result=JSON.parse(result);
if(result.length) {
output("上传结果:");
for (var j in result) {
var r=result[j];
output(r.file+""+r.status);
}
}
else {
output("没有文件被上传!");
}
openapi("get_decks");
}).fail(function(result) {
output("上传失败!");
openapi("get_decks");
});
}
</script>
<script src="http://s4.cnzz.com/z_stat.php?id=1255875151&web_id=1255875151"></script>
</body>
</html>
\ No newline at end of file
favicon.ico

1.12 KB

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>识别卡图搜索卡片 - YGOPro 233服</title>
<base href="https://ygo233.com/">
<meta name="keywords" content="游戏王,YGOPro,233服,实验室" />
<meta name="description" content="识别卡图搜索卡片。" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="/static/style.css">
</head>
<body class="lab deck">
<header class="container">
<div class="row">
<nav class="navbar navbar-default">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar-collapse" aria-expanded="false">
<span class="sr-only">开关导航</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/">YGOPro 233服</a>
</div>
<div class="collapse navbar-collapse" id="navbar-collapse">
<ul class="nav navbar-nav">
<li class="index"><a href="/">首页</a></li>
<li class="download"><a href="/download">下载</a></li>
<li class="usage"><a href="/usage">使用方法</a></li>
<li class="changelog"><a href="/changelog">更新记录</a></li>
<li class="bugs"><a href="/bugs">BUG报告</a></li>
<li class="lab"><a href="/lab">实验室</a></li>
<li class="pre"><a href="/pre">先行卡</a></li>
</ul>
<p class="navbar-text navbar-right">主机信息(IP):<kbd>s1.ygo233.com</kbd>
<kbd>233</kbd></p>
</div>
</div>
</nav>
</div>
</header>
<div class="container">
<div class="row">
<div class="col-md-12">
<h1 class="title">识图 (Preview-Alpha)</h1>
</div>
</div>
<div class="row">
<div class="col-md-7 col-md-push-5 col-lg-6 col-lg-push-4">
<div id="deck">
<label>卡组</label>
</div>
</div>
<div class="col-md-5 col-md-pull-7 col-lg-4 col-lg-pull-6">
<div id="card">
<img id="cardpic" src="https://ygo233.my-card.in/ygopro/pics/2333365.jpg">
<div id="cardtext">
<div class="cardname">233服卡组展示</div>
<p></p><pre></pre>
</div>
</div>
</div>
<div class="col-lg-2 col-md-12">
<p class="buttons">
<button class="btn btn-default" id="upload_button">上传图片</button>
<input type='file' id="input_file" accept=".jpg" />
</p>
</div>
</div>
</div>
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="myModalLabel">分享卡组</h4>
</div>
<div class="modal-body text-center">
<div id="qrcode"></div>
<p>分享此二维码,或直接分享本页面网址</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">完成</button>
</div>
</div>
</div>
</div>
<footer>
<div class="container">
<div class="row">
<div class="col-md-12">
<p>&copy; 2018 <a href="http://mercury233.me/" target="_blank">Mercury233</a>
</div>
</div>
</div>
</footer>
<script>
var _hmt = _hmt || [];
(function() {
var hm = document.createElement("script");
hm.src = "https://hm.baidu.com/hm.js?80278025afb2c6934aa93a16b3b14b30";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();
</script>
<script src="https://cdn.jsdelivr.net/npm/jquery@2.2.4/dist//jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/js/bootstrap.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/jquery.qrcode@1.0.3/jquery.qrcode.min.js"></script>
<script>
var currentDeck = {};
$(function() {
$("#upload_button").click(startUploadDeck);
$("#input_file").on("change", uploadDeck);
});
parseQueryString = function() {
//http://stackoverflow.com/questions/523266/how-can-i-get-a-specific-parameter-from-location-search
var str = window.location.search;
var objURL = {};
str.replace(
new RegExp( "([^?=&]+)(=([^&]*))?", "g" ),
function( $0, $1, $2, $3 ){
objURL[ $1 ] = $3;
}
);
return objURL;
}
loadDeckFromURL = function() {
var deck = {};
var params=parseQueryString();
deck.name = params.name ? decodeURIComponent(params.name) : "未命名卡组";
deck.deck = params.deck;
deck = decodeDeck(deck);
showDeck(deck);
}
buildCard = function(id) {
var card_img = $("<img src='https://ygo233.my-card.in/ygopro/pics/"+id+".jpg!thumb' data-id='"+id+"'>");
card_img.click(function(){
showCard($(this).data("id"));
});
return card_img;
}
showDeck = function(deck) {
currentDeck = deck;
$("#deck").html(" ");
$("#deck").append("<label class='pull-right' id='deckname' contenteditable='true'></label>");
$("#deckname").text(deck.name);
$("#deck").append("<label>主卡组:<b>"+deck.main.length+"</b></label>");
var deck_main=$('<div></div>');
deck_main.addClass("line"+Math.ceil(deck.main.length/4));
for (var j in deck.main) {
deck_main.append(buildCard(deck.main[j]));
}
deck_main.appendTo($("#deck"));
$("#deck").append("<label>额外卡组:<b>"+deck.extra.length+"</b></label>");
var deck_extra=$('<div></div>');
deck_extra.addClass("line"+deck.extra.length);
for (var j in deck.extra) {
deck_extra.append(buildCard(deck.extra[j]));
}
deck_extra.appendTo($("#deck"));
$("#deck").append("<label>副卡组:<b>"+deck.side.length+"</b></label>");
var deck_side=$('<div></div>');
deck_side.addClass("line"+deck.side.length);
for (var j in deck.side) {
deck_side.append(buildCard(deck.side[j]));
}
deck_side.appendTo($("#deck"));
changeDeckName();
showCard(deck.main[0]);
}
showCard = function(id) {
$("#cardpic").attr("src", "https://ygo233.my-card.in/ygopro/pics/"+id+".jpg");
$("#cardtext").html("<div class='cardname'><div class='loader'></div></div>");
$.getJSON("https://ygo233.com/card/data/"+id+"/callback=?", function(card) {
$("#cardtext").html("");
$("#cardtext").append("<div class='cardname'>"+card.text.name+"["+card.id+"]</div>");
if (card.data.type & 1) { //TYPE_MONSTER
$("#cardtext").append("<p>["+card.text.type+"] "+card.text.attr+"<br>"+card.text.data+"</p>");
$("#cardtext").addClass("monster");
}
else {
$("#cardtext").append("<p>["+card.text.type+"]</p>");
$("#cardtext").removeClass("monster");
}
$("#cardtext").append("<pre>"+card.text.desc+"</pre>");
});
}
//+ Carlos R. L. Rodrigues
//@ http://jsfromhell.com/number/base-conversor [rev. #1]
Number.prototype.toBase = function(b, c){
var s = "", n = this;
if(b > (c = (c || BASE_DICT).split("")).length || b < 2) return "";
while(n)
s = c[n % b] + s, n = Math.floor(n / b);
return s;
};
String.prototype.parseBase = function(b, c){
var s = 0, n, l = (n = this.split("")).length, i = 0;
if(b > (c = c || BASE_DICT).length || b < 2) return NaN;
while(l--)
s += c.indexOf(n[i++]) * Math.pow(b, l);
return s;
};
var BASE_DICT = "0123456789ABCDEFGHIJKLMNPRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; // not including O and Q
var BASE_MAX = ("zzzzz").parseBase(60);
encodeDeck = function(deck) {
var newDeck = {};
newDeck.name = deck.name;
var deckArray = deck.main.concat([0]).concat(deck.extra).concat([0]).concat(deck.side);
newDeck.deck = encodeDeckArray(deckArray);
return newDeck;
}
decodeDeck = function(deck) {
var newDeck = {};
newDeck.name = deck.name;
newDeck.main = [];
newDeck.extra = [];
newDeck.side = [];
var deckArray = decodeDeckString(deck.deck);
var nowAdding = "main";
for (var i in deckArray) {
var card = deckArray[i];
if (card == 0) {
if (nowAdding == "main")
nowAdding = "extra";
else
nowAdding = "side"
continue;
}
newDeck[nowAdding].push(card);
}
return newDeck;
}
encodeDeckArray = function(deckArray) {
var deckIndex = {};
var newDeckArray = [];
for (var i in deckArray) {
var card = parseInt(deckArray[i]);
if (card > 0 && (card < deckArray.length || card > BASE_MAX))
warn("卡片密码过大或过小,无法正常编码!");
if (deckIndex[card] >= 0)
card = parseInt(deckIndex[card]) + 1;
else
deckIndex[card] = i;
var cardString = card.toBase(60);
if (cardString.length == 5) { }
else if (cardString.length == 4)
cardString = "0" + cardString;
else if (cardString.length == 3)
cardString = "00" + cardString;
else if (cardString.length == 2)
cardString = "Q" + cardString;
else
cardString = "O" + cardString; // the letter o
newDeckArray.push(cardString);
}
return newDeckArray.join("");
}
decodeDeckString = function(encodedDeck) {
var deckArray = [];
encodedDeck = encodedDeck.replace(/Q/g, "000");
encodedDeck = encodedDeck.replace(/O/g, "0000"); // the letter o
for (var i = 0; i < encodedDeck.length; i += 5) {
var cardString = encodedDeck.substr(i, 5);
var card = cardString.parseBase(60);
var index = card - 1;
if (index >= 0 && index < deckArray.length)
deckArray.push(deckArray[index]);
else
deckArray.push(card);
}
return deckArray;
}
startUploadDeck = function() {
$("#input_file").click();
}
uploadDeck = function() {
var file=this.files[0];
//console.log(file);
if(!file)
return;
if(file.name.indexOf(".jpg") < 0) {
warn("请选择JPG图片文件!");
return;
}
var reader = new FileReader();
reader.readAsArrayBuffer(file);
reader.onload = function() {sendArrayBuffer(this.result) };
}
sendArrayBuffer = function(buffer) {
var xhr = new XMLHttpRequest();
xhr.open('POST', 'http://pastec.ygo233.com:7998/index/searcher', true);
xhr.onload = function(e) {
if (this.status == 200) {
console.log(this.responseText);
var res=JSON.parse(this.responseText);
showResponse(res);
}
}
xhr.send(buffer);
}
showResponse = function(res) {
var deck = {};
deck.name="识别结果";
deck.main=res.image_ids;
if (res.image_ids.length==0) {
deck.name="没有找到卡片";
deck.main=[48202661];
}
deck.extra=[];
deck.side=[];
showDeck(deck);
}
readDeck = function(deck, fileText) {
//console.log(deck);
//console.log(filetext);
deck.main = [];
deck.extra = [];
deck.side = [];
var nowReading = "main";
fileArray = fileText.split('\n');
for (var i in fileArray) {
var line = fileArray[i].trim();
//console.log(line);
if(line == "#main")
nowReading = "main";
if(line == "#extra")
nowReading = "extra";
if(line == "!side")
nowReading = "side";
var card = parseInt(line);
if(card > 0) {
deck[nowReading].push(card);
}
}
showDeck(deck);
updateDeckURL();
}
changeDeckName = function() {
currentDeck.name = $("#deckname").text();
document.title = currentDeck.name + " - 卡组 - YGOPro 233服";
}
updateDeckURL = function() {
var newDeck = encodeDeck(currentDeck);
var newURL = window.location.origin + window.location.pathname + "?name=" + encodeURIComponent(newDeck.name) + "&deck=" + encodeURIComponent(newDeck.deck);
window.history.pushState({}, 0, newURL);
}
shareDeck = function() {
updateDeckURL();
$("#qrcode").html("");
$("#qrcode").qrcode({ width: 480, height: 480, text: window.location.href });
$("#myModal").modal("show");
//alert("已保存卡组,直接复制或分享当前页面地址即可!");
}
downloadDeck = function() {
var deckName = currentDeck.name;
if(!deckName.toLowerCase().endsWith(".ydk"))
deckName = deckName + ".ydk"
var deckArray = [];
deckArray.push("#created by ygo233.com", "#main");
deckArray = deckArray.concat(currentDeck.main);
deckArray.push("#extra");
deckArray = deckArray.concat(currentDeck.extra);
deckArray.push("!side");
deckArray = deckArray.concat(currentDeck.side);
deckArray.push("");
var blob = new Blob([deckArray.join("\n")], { type: "text/plain" });
this.href = window.URL.createObjectURL(blob);
this.download = deckName;
return true;
}
warn = function(text) {
alert(text);
}
</script>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>SRVPro Dashboard</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
<link href="/static/style.css" rel="stylesheet">
</head>
<body>
<header class="container">
<h1 class="title">SRVPro Dashboard</h1>
</header>
<div class="container">
<div class="row">
<div class="col-lg-12">
<p><a href="dashboard-en.html">Dashboard</a> (<a href="dashboard.html">房间管理</a>)</p>
<p><a href="pre-dashboard.html">Pre-Release Dashboard (先行卡更新)</a></p>
<p><a href="deck-dashboard.html">Deck Dashboard (竞赛模式卡组管理)</a></p>
<p><a href="replay-dashboard.html">Replay Dashboard (竞赛模式录像管理)</a></p>
<p><a href="update-dashboard.html">Update Dashboard (更新管理)</a></p>
</div>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/jquery@2.2.4/dist//jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/js/bootstrap.min.js"></script>
<script src="http://s4.cnzz.com/z_stat.php?id=1255875151&web_id=1255875151"></script>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>SRVPro Pre-Release Dashboard</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
<link href="/static/style.css" rel="stylesheet">
</head>
<body>
<header class="container">
<h1 class="title">SRVPro 先行卡更新</h1>
</header>
<div class="container">
<div class="row grid">
<div class="col-lg-2">
<input type="text" class="form-control" id="ip" value="" placeholder="IP">
</div>
<div class="col-lg-2">
<input type="text" class="form-control" id="port" value="" placeholder="Port">
</div>
<div class="col-lg-2">
<input type="text" class="form-control" id="username" value="" placeholder="Username">
</div>
<div class="col-lg-2">
<input type="password" class="form-control" id="password" value="" placeholder="Password">
</div>
<div class="col-lg-2">
<button class="btn btn-default" id="login_button">登陆</button>
<button class="btn btn-default" id="clear_button">清屏</button>
</div>
</div>
<div class="row grid buttons hidden">
<div class="col-lg-2">
<button class="btn btn-default" action="fetch_datas">下载最新数据库</button>
</div>
<div class="col-lg-2">
<button class="btn btn-default" action="load_db">读取数据库</button>
</div>
<div class="col-lg-2">
<button class="btn btn-default" action="copy_to_ygopro">更新到服务器</button>
</div>
<div class="col-lg-2">
<button class="btn btn-default" action="write_to_file">更新到列表页</button>
</div>
<div class="col-lg-2">
<button class="btn btn-default" action="pack_data">生成更新包</button>
</div>
<div class="col-lg-2">
<button class="btn btn-default" action="push_datas">上传到官网</button>
</div>
</div>
<div class="row buttons hidden">
<div class="col-lg-12">
<textarea class="form-control" rows="5" id="message" value="" placeholder="update message">新卡:
修复:</textarea>
</div>
</div>
</div>
<div class="container">
<hr>
<div class="row">
<div class="col-lg-12">
<ul id="output" class="list-unstyled">
</ul>
</div>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/jquery@2.2.4/dist//jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/js/bootstrap.min.js"></script>
<script>
var ip, port, password;
$(function(){
$("body").tooltip({selector: "[data-toggle='tooltip']"});
$("#login_button").click(login);
$("#clear_button").click(clear);
$(".buttons button").click(function(){openapi($(this).attr("action"))});
var params=parseQueryString();
$("#ip").val(params["ip"]);
$("#port").val(params["port"]);
$("#password").val(params["password"]);
$("#username").val(params["username"]);
});
function parseQueryString() {
//http://stackoverflow.com/questions/523266/how-can-i-get-a-specific-parameter-from-location-search
var str = window.location.search;
var objURL = {};
str.replace(
new RegExp( "([^?=&]+)(=([^&]*))?", "g" ),
function( $0, $1, $2, $3 ){
objURL[ $1 ] = $3;
}
);
return objURL;
}
function login() {
ip=$("#ip").val();
port=$("#port").val();
password=$("#password").val();
username=$("#username").val();
var es = new EventSource("http://"+ip+":"+port+"/api/msg?username="+username+"password="+password);
es.onmessage = function(e) {
var data_li = $('<li>'+ e.data +'</li>');
data_li.appendTo($("#output"));
if (e.data=="已连接。") {
$(".row.buttons").removeClass("hidden");
}
};
es.onerror = function(e) {
$(".row.buttons").addClass("hidden");
data_li = $('<li>已断开。</li>');
data_li.appendTo($("#output"));
//alert("连接断开!");
es.close();
};
}
function clear() {
$("#output").html(" ");
}
function openapi(api) {
$.getJSON("http://"+ip+":"+port+"/api/"+ api +"?username="+username+"&password="+password+"&message="+$("#message").val().replace(/\n/g,"!换行符!")+"&callback=?", function(data) {
var data_li = $('<li>'+ data.message +'</li>');
data_li.appendTo($("#output"));
});
}
</script>
<script src="http://s4.cnzz.com/z_stat.php?id=1255875151&web_id=1255875151"></script>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>SRVPro Replay Dashboard</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
<link href="/static/style.css" rel="stylesheet">
</head>
<body>
<header class="container">
<h1 class="title">SRVPro 竞赛模式录像管理</h1>
</header>
<div class="container">
<div class="row grid">
<div class="col-lg-1">
<input type="text" class="form-control" id="http" value="http" placeholder="http">
</div>
<div class="col-lg-3">
<input type="text" class="form-control" id="ip" value="" placeholder="IP">
</div>
<div class="col-lg-1">
<input type="text" class="form-control" id="port" value="" placeholder="port">
</div>
<div class="col-lg-3">
<input type="text" class="form-control" id="username" value="" placeholder="username">
</div>
<div class="col-lg-3">
<input type="password" class="form-control" id="password" value="" placeholder="password">
</div>
<div class="col-lg-4">
<button class="btn btn-default" id="open_button">刷新</button>
<button class="btn btn-default" id="empty_button">清空记录</button>
<button class="btn btn-default" id="pack_button">打包下载录像</button>
共有<span id="num">0</span>场决斗
</div>
</div>
<!--div class="row">
<div class="col-lg-2">
<button class="btn btn-default" id="empty_button">清空记录</button>
</div>
<div class="col-lg-2">
<button class="btn btn-default" id="pack_button">打包下载录像</button>
</div>
<div class="col-lg-2">
<span id="message_callback"></span>
</div>
</div-->
</div>
<div class="container">
<hr>
<div class="row">
<div class="col-lg-12">
<table class="table table-striped" id="rooms">
<thead>
<th width="15%">时间</th>
<th width="15%">房名</th>
<th width="25%">玩家</th>
<th width="25%">玩家</th>
<th width="10%" data-toggle="tooltip" data-container="body" title="MATCH打完才可以观看">云录像</th>
<th width="10%">下载录像</th>
</thead>
<tbody></tbody>
</table>
</div>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/jquery@2.2.4/dist//jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/js/bootstrap.min.js"></script>
<script>
$(function(){
$("body").tooltip({selector: "[data-toggle='tooltip']", trigger: "hover"});
$("#open_button").click(loadreplays);
$("#empty_button").click(clearreplays);
$("#pack_button").click(packreplays);
//$("#welcome_button").click(welcome);
var params=parseQueryString();
$("#ip").val(params["ip"]);
$("#port").val(params["port"]);
$("#password").val(params["password"]);
$("#username").val(params["username"]);
});
function parseQueryString() {
//http://stackoverflow.com/questions/523266/how-can-i-get-a-specific-parameter-from-location-search
var str = window.location.search;
var objURL = {};
str.replace(
new RegExp( "([^?=&]+)(=([^&]*))?", "g" ),
function( $0, $1, $2, $3 ){
objURL[ $1 ] = $3;
}
);
return objURL;
}
function loadreplays() {
var url=$("#http").val() + "://" + $("#ip").val() + ":" + $("#port").val() + "/api/duellog?callback=?"+ ($("#username").val() ? "&username="+$("#username").val() : "") +($("#password").val() ? "&pass="+$("#password").val() : "");
$.getJSON(url, listreplay);
$("#open_button").removeClass("btn-success");
}
function clearreplays() {
if (confirm("确实要清空记录吗?")) {
var url=$("#http").val() + "://" + $("#ip").val() + ":" + $("#port").val() + "/api/clearlog?callback=?"+ ($("#username").val() ? "&username="+$("#username").val() : "") +($("#password").val() ? "&pass="+$("#password").val() : "");
$.getJSON(url, clearreplays_success);
$("#empty_button").removeClass("btn-success");
}
}
function packreplays() {
window.open($("#http").val() + "://" + $("#ip").val() + ":" + $("#port").val() + "/api/archive.zip?username="+$("#username").val()+"&pass="+$("#password").val());
}
function clearreplays_success() {
$("#empty_button").addClass("btn-success");
$("#num").text(0);
$("#rooms tbody").remove();
$("#rooms").append($("<tbody></tbody>"));
}
function listreplay(data) {
$("#open_button").addClass("btn-success");
$("#num").text(data.length);
var tbody=$("<tbody></tbody>");
for (i in data) {
var duellog=data[i];
var tr=$("<tr></tr>");
tr.append($("<td>"+duellog.time+"</td>"));
tr.append($("<td>"+duellog.name+"</td>"));
if(duellog.roommode != 2) {
tr.append($("<td>"+((duellog.players) ? (duellog.players[0].winner ? "<span class='glyphicon glyphicon-bookmark'></span> " : "") + duellog.players[0].name : "")+"</td>"));
tr.append($("<td>"+((duellog.players) ? (duellog.players[1].winner ? "<span class='glyphicon glyphicon-bookmark'></span> " : "") + duellog.players[1].name : "")+"</td>"));
} else {
tr.append($("<td>"+((duellog.players) ? (duellog.players[0].winner ? "<span class='glyphicon glyphicon-bookmark'></span> " : "") + duellog.players[0].name + "<br>" + duellog.players[1].name : "")+"</td>"));
tr.append($("<td>"+((duellog.players) ? (duellog.players[2].winner ? "<span class='glyphicon glyphicon-bookmark'></span> " : "") + duellog.players[2].name + "<br>" + duellog.players[3].name : "")+"</td>"));
}
tr.append($("<td>"+duellog.cloud_replay_id+"</td>"));
tr.append($("<td><a href='"+$("#http").val() + "://" + $("#ip").val() + ":" + $("#port").val() + "/api/replay/"+duellog.replay_filename+"?username="+$("#username").val()+"&pass="+$("#password").val()+"' download><span class='glyphicon glyphicon-download-alt'></span></a></td>"));
tbody.append(tr);
}
$("#rooms tbody").remove();
$("#rooms").append(tbody);
}
</script>
<script src="http://s4.cnzz.com/z_stat.php?id=1255875151&web_id=1255875151"></script>
</body>
</html>
/*干掉站长统计的文本*/
a[title="站长统计"] {
display: none;
}
/*标题*/
h1.title {
font-family: 'Helvetica Neue', Helvetica, 'Microsoft Yahei', 'Hiragino Sans GB', 'WenQuanYi Micro Hei', sans-serif;
font-size: 22px;
padding-bottom: 15px;
border-bottom: 1px solid #eee;
}
.index .navbar-nav>li.index>a, .index .navbar-nav>li.index>a:focus, .index .navbar-nav>li.index>a:hover,
.download .navbar-nav>li.download>a, .download .navbar-nav>li.download>a:focus, .download .navbar-nav>li.download>a:hover,
.usage .navbar-nav>li.usage>a, .usage .navbar-nav>li.usage>a:focus, .usage .navbar-nav>li.usage>a:hover,
.changelog .navbar-nav>li.changelog>a, .changelog .navbar-nav>li.changelog>a:focus, .changelog .navbar-nav>li.changelog>a:hover,
.bugs .navbar-nav>li.bugs>a, .bugs .navbar-nav>li.bugs>a:focus, .bugs .navbar-nav>li.bugs>a:hover,
.lab .navbar-nav>li.lab>a, .lab .navbar-nav>li.lab>a:focus, .lab .navbar-nav>li.lab>a:hover,
.pre .navbar-nav>li.pre>a, .pre .navbar-nav>li.pre>a:focus, .pre .navbar-nav>li.pre>a:hover
{
color: #555;
background-color: #e7e7e7;
}
h1.title .date {
font-size: 14px;
float: right;
padding-top: 10px;
}
h2.title {
font-family: 'Helvetica Neue', Helvetica, 'Microsoft Yahei', 'Hiragino Sans GB', 'WenQuanYi Micro Hei', sans-serif;
font-size: 16px;
padding: 8px 0 8px 8px;
border-left: 2px solid #ddd;
}
footer {
margin: 100px 0 10px 0;
color: #767676;
text-align: center;
}
.row.grid {
margin-bottom: 15px;
}
#shouttemp {
border: 0;
width: 200px;
height: 20px;
}
#decklist, #output.deck {
overflow-y: scroll;
height: 520px;
}
#decklist li {
border: 1px solid #EEEEEE;
border-radius: 5px;
padding: 2px 5px;
margin-bottom: 3px;
line-height: 22px;
cursor: pointer;
}
#decklist li:hover {
border: 1px solid #B8D6FB;
background-color: #EBF3FD;
background-image: linear-gradient(to bottom, #FAFBFD, #EBF3FD);
}
.deck #card {
margin-top: 10px;
margin-bottom: 10px;
}
.deck #card, .deck #card pre {
font-family: 'Helvetica Neue', Helvetica, 'Microsoft Yahei', 'Hiragino Sans GB', 'WenQuanYi Micro Hei', sans-serif;
}
.deck #card #cardpic {
margin: 0 auto 5px auto;
width: 177px;
height: 254px;
display: block;
}
.deck #card #cardtext {
height: 260px;
}
.deck #card .cardname {
text-align: center;
margin: 5px 0 4px;
padding: 3px 0;
border: 1px solid #EEEEEE;
background-color: #F9F9F9;
height: 28px;
}
/* https://projects.lukehaas.me/css-loaders/ */
.loader,
.loader:before,
.loader:after {
border-radius: 50%;
width: 2.5em;
height: 2.5em;
-webkit-animation-fill-mode: both;
animation-fill-mode: both;
-webkit-animation: load7 1.8s infinite ease-in-out;
animation: load7 1.8s infinite ease-in-out;
}
.loader {
color: #333333;
font-size: 10px;
margin: 80px auto;
position: relative;
text-indent: -9999em;
-webkit-transform: translateZ(0);
-ms-transform: translateZ(0);
transform: translateZ(0);
-webkit-animation-delay: -0.16s;
animation-delay: -0.16s;
}
.loader:before,
.loader:after {
content: '';
position: absolute;
top: 0;
}
.loader:before {
left: -3.5em;
-webkit-animation-delay: -0.32s;
animation-delay: -0.32s;
}
.loader:after {
left: 3.5em;
}
@-webkit-keyframes load7 {
0%,
80%,
100% {
box-shadow: 0 2.5em 0 -1.3em;
}
40% {
box-shadow: 0 2.5em 0 0;
}
}
@keyframes load7 {
0%,
80%,
100% {
box-shadow: 0 2.5em 0 -1.3em;
}
40% {
box-shadow: 0 2.5em 0 0;
}
}
.deck #card p {
margin: 3px;
padding: 0 3px;
line-height: 22px;
}
.deck #card pre {
display: block;
margin: 3px 3px 0;
padding: 0 3px;
font-size: 14px;
line-height: 22px;
color: #333;
white-space: pre-wrap;
background-color: unset;
border: none;
height: 193px;
}
.deck #card .monster pre {
height: 171px;
}
.deck #deck {
width: 500px;
padding: 5px 0px;
background: #CCCCCC center center;
margin: 0 auto;
}
@media (min-width: 1200px) {
.deck #card {
margin-top: 0;
margin-bottom: 0;
}
.deck #deck {
margin: 0 -15px;
}
}
.deck #deck label {
text-shadow: -1px -1px #000;
color: #FFF;
font-weight: normal;
border: 1px solid #FFF;
padding: 0px 5px;
margin: 1px 7px;
}
.deck #deck label b {
margin: 0px 8px;
font-size: 16px;
line-height: 100%;
}
.deck #deck div {
border: 1px solid #FFF;
padding: 2px;
margin: 0px 7px;
min-height: 74px;
}
.deck #deck img {
width: 46px;
height: 66px;
margin: 1px;
border: 1px solid transparent;
}
.deck #deck .line11 img {
margin-right: -3.8px;
}
.deck #deck .line12 img {
margin-right: -7.7px;
}
.deck #deck .line13 img {
margin-right: -11px;
}
.deck #deck .line14 img {
margin-right: -13.7px;
}
.deck #deck .line15 img {
margin-right: -16.1px;
}
.deck #deck img:hover {
border: 1px solid #FFF;
}
#input_file {
display: none;
}
.modal-title {
font-family: 'Helvetica Neue', Helvetica, 'Microsoft Yahei', 'Hiragino Sans GB', 'WenQuanYi Micro Hei', sans-serif;
}
p.buttons {
line-height: 40px;
}
div.buttons {
line-height: 50px;
}
#pre_update_log .auto-generated {
max-height: 300px;
overflow-y: scroll;
}
#pre_release_cards {
width: auto;
margin-left: 15px;
margin-right: 15px;
font-family: 宋体;
}
#pre_release_cards img {
width: 44px;
height: 64px;
}
#pre_faq p {
padding-left: 2em;
border-left: 3px #EEEEEE solid;
line-height: 200%;
text-indent: -1.5em;
}
#pre_faq p::first-letter {
font-weight: bold;
margin-right: 0.5em;
}
#pre_faq p.q {
background-color: #F0F0F0;
border-color: #CCCCCC;
}
#pre_faq p.a {
margin-bottom: 2em;
}
#pre_faq p:hover {
border-color: #AAAAAA;
}
#output .add {
background-color:#94fbb1;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>SRVPro Update Dashboard</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
<link href="/static/style.css" rel="stylesheet">
</head>
<body>
<header class="container">
<h1 class="title">SRVPro 更新控制台</h1>
</header>
<div class="container">
<div class="row grid">
<div class="col-lg-2">
<input type="text" class="form-control" id="ip" value="" placeholder="IP">
</div>
<div class="col-lg-2">
<input type="text" class="form-control" id="port" value="" placeholder="Port">
</div>
<div class="col-lg-2">
<input type="username" class="form-control" id="username" value="" placeholder="Username">
</div>
<div class="col-lg-2">
<input type="password" class="form-control" id="password" value="" placeholder="Password">
</div>
<div class="col-lg-2">
<button class="btn btn-default" id="login_button">登陆</button>
<button class="btn btn-default" id="clear_button">清屏</button>
</div>
</div>
<!--div class="row grid buttons hidden">
<div class="col-lg-2">
<button class="btn btn-default" disabled title="暂未实装" action="">复制临时服务端</button>
</div>
<div class="col-lg-2">
<button class="btn btn-default" disabled title="暂未实装" action="">更新临时服务端</button>
</div>
<div class="col-lg-2">
<button class="btn btn-default" disabled title="暂未实装" action="">编译临时服务端</button>
</div>
<div class="col-lg-2">
<button class="btn btn-default" disabled title="暂未实装" action="">替换主要服务端</button>
</div>
<div class="col-lg-2">
<button class="btn btn-default" disabled title="暂未实装" action="">更新主要服务端数据库和脚本</button>
</div>
</div-->
<div class="row grid buttons hidden">
<div class="col-lg-2">
<button class="btn btn-default" action="fetch_datas">下载最新网页</button>
</div>
<div class="col-lg-2">
<button class="btn btn-default" action="load_db">读取数据库</button>
</div>
<div class="col-lg-2">
<button class="btn btn-default" action="make_changelog">生成更新记录</button>
</div>
<div class="col-lg-2">
<button class="btn btn-default" action="make_more_changelog">更多更新记录</button>
</div>
<div class="col-lg-2">
<button class="btn btn-default" action="update_changelog">写入更新记录</button>
</div>
<div class="col-lg-2">
<button class="btn btn-default" action="push_datas">上传到网页</button>
</div>
</div>
<div class="row buttons hidden">
<div class="col-lg-12">
<textarea class="form-control" rows="20" id="message" value="" placeholder="update message"></textarea>
<textarea class="hidden" id="message-head" value="" placeholder="update message">服务器升级,与官方版同步,修复一些BUG。
绝大部分修改来自于YGOPro官方开发者和爱好者的贡献。你可以在[GitHub](https://github.com/moecube/ygopro/tree/server)查看修改详情。
</textarea>
<textarea class="hidden" id="message-body" value="" placeholder="update message">新增卡片:
- 无
卡片更改:
- 无
</textarea>
<textarea class="hidden" id="message-other" value="" placeholder="update message">其他更改:
- 无</textarea>
</div>
</div>
</div>
<div class="container">
<hr>
<div class="row">
<div class="col-lg-12">
<ul id="output" class="list-unstyled">
</ul>
</div>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/jquery@2.2.4/dist//jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/js/bootstrap.min.js"></script>
<script>
var ip, port, password;
$(function(){
$("body").tooltip({selector: "[data-toggle='tooltip']"});
$("#login_button").click(login);
$("#clear_button").click(clear);
$(".buttons button").click(function(){openapi($(this).attr("action"))});
var params=parseQueryString();
$("#ip").val(params["ip"]);
$("#port").val(params["port"]);
$("#password").val(params["password"]);
$("#username").val(params["username"]);
$("#message").val($("#message-head").val()+$("#message-body").val()+$("#message-other").val());
});
function parseQueryString() {
//http://stackoverflow.com/questions/523266/how-can-i-get-a-specific-parameter-from-location-search
var str = window.location.search;
var objURL = {};
str.replace(
new RegExp( "([^?=&]+)(=([^&]*))?", "g" ),
function( $0, $1, $2, $3 ){
objURL[ $1 ] = $3;
}
);
return objURL;
}
function login() {
ip=$("#ip").val();
port=$("#port").val();
password=$("#password").val();
username=$("#username").val();
var es = new EventSource("http://"+ip+":"+port+"/api/msg?username="+username+"&password="+password);
es.onmessage = function(e) {
var data_li = $('<li>'+ e.data +'</li>');
data_li.appendTo($("#output"));
if (e.data=="已连接。") {
$(".row.buttons").removeClass("hidden");
}
else {
try {
var resJSON = JSON.parse(e.data);
if (resJSON.type=="changelog") {
$("#message").val($("#message-head").val()+ resJSON.changelog.join("\n") +$("#message-other").val());
}
}
catch (e) {
}
}
};
es.onerror = function(e) {
$(".row.buttons").addClass("hidden");
data_li = $('<li>已断开。</li>');
data_li.appendTo($("#output"));
//alert("连接断开!");
es.close();
};
}
function clear() {
$("#output").html(" ");
}
function openapi(api) {
$.getJSON("http://"+ip+":"+port+"/api/"+ api +"?username="+username+"&password="+password+"&message="+$("#message").val().replace(/\n/g,"!换行符!")+"&callback=?", function(data) {
var data_li = $('<li>'+ data.message +'</li>');
data_li.appendTo($("#output"));
});
}
</script>
<script src="http://s4.cnzz.com/z_stat.php?id=1255875151&web_id=1255875151"></script>
</body>
</html>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment