Commit 106f2d57 authored by mercury233's avatar mercury233

update

parent a563be4e
## SRVPro-DashBoards
## SRVPro-Dashboards
[http://srvpro.ygo233.com/](http://srvpro.ygo233.com/)
http://srvpro.ygo233.com/
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>SRVPro Dashboard</title>
<link href="https://cdn.bootcss.com/bootstrap/3.3.5/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-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="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">
<div class="col-lg-8">
<input type="text" class="form-control" id="shout" value="" placeholder="喊话">
</div>
<div class="col-lg-4">
<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>
<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="10%">房号</th>
<th width="30%">房名</th>
<th width="25%">玩家</th>
<th width="25%">玩家</th>
<th width="10%">状态</th>
</thead>
<tbody></tbody>
</table>
</div>
</div>
</div>
<script src="https://cdn.bootcss.com/jquery/2.1.4/jquery.min.js"></script>
<script src="https://cdn.bootcss.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<script>
$(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);
var params=parseQueryString();
$("#ip").val(params["ip"]);
$("#port").val(params["port"]);
$("#password").val(params["password"]);
});
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=?"+ ($("#password").val() ? "&pass="+$("#password").val() : "");
$.getJSON(url, listroom);
$("#open_button").removeClass("btn-success");
}
function autoload() {
if (window.autoLoad) {
window.clearInterval(window.autoLoad);
window.autoLoad=false;
$("#message_callback").text("关闭自动刷新");
}
else {
if (!$("#password").val()) {
alert("请输入密码");
return;
}
window.autoLoad=window.setInterval(loadrooms,1000);
}
}
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.duelers.length<=2) {
tr.append($("<td>"+((room.duelers[0]) ? room.duelers[0].name : "")+"</td>"));
tr.append($("<td>"+((room.duelers[1]) ? room.duelers[1].name : "")+"</td>"));
}
else {
tr.append($("<td>"+((room.duelers[0]) ? room.duelers[0].name : "")+((room.duelers[2]) ? "<br>"+room.duelers[2].name : "")+"</td>"));
tr.append($("<td>"+((room.duelers[1]) ? room.duelers[1].name : "")+((room.duelers[3]) ? "<br>"+room.duelers[3].name : "")+"</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() + "&pass=" + $("#password").val() + "&callback=?";
$.getJSON(url, shoutcallback);
}
function stop() {
if (confirm("确实要停服吗?")) {
$("#message_callback").text('...');
var url=$("#http").val() + "://" + $("#ip").val() + ":" + $("#port").val() + "/api/message?stop=" + $("#shout").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() + "&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() + "&callback=?";
$.getJSON(url, shoutcallback);
}
}
function shoutcallback(data) {
$("#message_callback").text(data[0]);
if (data[1]) {
$("#shout").val(data[1]);
}
}
</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 Dashboard</title>
<link href="https://cdn.bootcss.com/bootstrap/3.3.5/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="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>
</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.bootcss.com/jquery/2.1.4/jquery.min.js"></script>
<script src="https://cdn.bootcss.com/bootstrap/3.3.5/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"]);
$("#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();
var es = new EventSource("http://"+ip+":"+port+"/api/msg?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["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/thumbnail/"+deck.main[j]+".jpg'>");
}
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/thumbnail/"+deck.extra[j]+".jpg'>");
}
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/thumbnail/"+deck.side[j]+".jpg'>");
}
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 +"?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?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
......@@ -14,7 +14,10 @@
<hr>
<div class="row">
<div class="col-lg-12">
<p><a href="dashboard.html">Dashboard (房间管理)</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>
</div>
</div>
</div>
......
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>SRVPro Dashboard</title>
<link href="https://cdn.bootcss.com/bootstrap/3.3.5/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="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.bootcss.com/jquery/2.1.4/jquery.min.js"></script>
<script src="https://cdn.bootcss.com/bootstrap/3.3.5/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"]);
});
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();
var es = new EventSource("http://"+ip+":"+port+"/api/msg?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 +"?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 Dashboard</title>
<link href="https://cdn.bootcss.com/bootstrap/3.3.5/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="password" class="form-control" id="password" value="" placeholder="password">
</div>
<div class="col-lg-4">
<button class="btn btn-default" id="open_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" data-toggle="tooltip" title="这个功能鸽了">清空记录</button>
</div>
<div class="col-lg-2">
<button class="btn btn-default" id="pack_button" data-toggle="tooltip" title="这个功能也鸽了">打包下载录像</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="20%">时间</th>
<th width="20%">房名</th>
<th width="20%">玩家</th>
<th width="20%">玩家</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.bootcss.com/jquery/2.1.4/jquery.min.js"></script>
<script src="https://cdn.bootcss.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<script>
$(function(){
$("body").tooltip({selector: "[data-toggle='tooltip']", trigger: "hover"});
$("#open_button").click(loadreplays);
//$("#welcome_button").click(welcome);
var params=parseQueryString();
$("#ip").val(params["ip"]);
$("#port").val(params["port"]);
$("#password").val(params["password"]);
});
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=?"+ ($("#password").val() ? "&pass="+$("#password").val() : "");
$.getJSON(url, listreplay);
$("#open_button").removeClass("btn-success");
}
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>"));
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>"));
tr.append($("<td>"+duellog.cloud_replay_id+"</td>"));
tr.append($("<td><a href='"+$("#http").val() + "://" + $("#ip").val() + ":" + $("#port").val() + "/api/replay/"+duellog.replay_filename+"?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>
\ 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