Commit aa285789 authored by nanahira's avatar nanahira

changes to replay dashboard

parent 236959cd
...@@ -90,22 +90,30 @@ function parseQueryString() { ...@@ -90,22 +90,30 @@ function parseQueryString() {
return objURL; return objURL;
} }
function get_http() {
return $("#http").val() + "://" + $("#ip").val() + ($("#port").val() ? (":" + $("#port").val()) : "");
}
function get_value(name) {
return encodeURIComponent($(name).val());
}
function loadreplays() { function loadreplays() {
var url=$("#http").val() + "://" + $("#ip").val() + ":" + $("#port").val() + "/api/duellog?callback=?"+ ($("#username").val() ? "&username="+$("#username").val() : "") +($("#password").val() ? "&pass="+$("#password").val() : ""); var url=get_http() + "/api/duellog?callback=?"+ (get_value("#username") ? "&username="+get_value("#username") : "") +(get_value("#password") ? "&pass="+get_value("#password") : "");
$.getJSON(url, listreplay); $.getJSON(url, listreplay);
$("#open_button").removeClass("btn-success"); $("#open_button").removeClass("btn-success");
} }
function clearreplays() { function clearreplays() {
if (confirm("确实要清空记录吗?")) { if (confirm("确实要清空记录吗?")) {
var url=$("#http").val() + "://" + $("#ip").val() + ":" + $("#port").val() + "/api/clearlog?callback=?"+ ($("#username").val() ? "&username="+$("#username").val() : "") +($("#password").val() ? "&pass="+$("#password").val() : ""); var url=get_http() + "/api/clearlog?callback=?"+ (get_value("#username") ? "&username="+get_value("#username") : "") +(get_value("#password") ? "&pass="+get_value("#password") : "");
$.getJSON(url, clearreplays_success); $.getJSON(url, clearreplays_success);
$("#empty_button").removeClass("btn-success"); $("#empty_button").removeClass("btn-success");
} }
} }
function packreplays() { function packreplays() {
window.open($("#http").val() + "://" + $("#ip").val() + ":" + $("#port").val() + "/api/archive.zip?username="+$("#username").val()+"&pass="+$("#password").val()); window.open(get_http() + "/api/archive.zip?username="+get_value("#username")+"&pass="+get_value("#password"));
} }
function clearreplays_success() { function clearreplays_success() {
...@@ -135,7 +143,7 @@ function listreplay(data) { ...@@ -135,7 +143,7 @@ function listreplay(data) {
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.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>"+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>")); tr.append($("<td><a href='"+get_http() + "/api/replay/"+duellog.replay_filename+"?username="+get_value("#username")+"&pass="+get_value("#password")+"' download><span class='glyphicon glyphicon-download-alt'></span></a></td>"));
tbody.append(tr); tbody.append(tr);
......
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