-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
125 lines (123 loc) · 5.25 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
{{define "content"}}
<div class="col-sm-12">
<div class="bs-component">
<div class="well">
<h1>{{.ServiceInfo.Title}}</h1>
</div>
</div>
{{if eq .Lang "ja"}}
<section>
<h3>ようこそお侍さん!</h3>
<p>ここでは本番サーバでの動作テストを行うことができます。</p>
<p>詳細は<a href="./about">こちら</a>をご参照ください。</p>
</section>
<div class="alert alert-dismissible alert-warning">
<h4>注意!</h4>
<p>ここでの提出は練習会、予選に応募したことになりません。</p>
<p>応募登録用にGoogle Classroomページをご用意させていただきました。詳細は<a href="http://samuraicoding.info/entry-jp.html" target="_blank" class="alert-link">こちら</a>をご覧ください。</p>
</div>
{{else}}
<section>
<h3>Hello Samurai!</h3>
<p>In this site, you can tune your AI on the game server which will be used practice, preliminary and final round.</p>
<p>Please find more infomation in <a href="./about">here</a>.</p>
</section>
<div class="alert alert-dismissible alert-warning">
<h4>Warning!</h4>
<p>The submission here will not be accepted for practice and preliminary round.</p>
<p>Please register the site on Google Classroom. Please refer <a href="http://samuraicoding.info/entry.html" target="_blank" class="alert-link">this</a> for details.</p>
</div>
{{end}}
<section>
<h3>{{if eq .Lang "ja"}}障害情報{{else}}Fault Information{{end}}</h3>
<ul class="nav nav-tabs">
<li class="active"><a href="#trial" data-toggle="tab" aria-expanded="true">Trial Page</a></li>
<li class=""><a href="#platform" data-toggle="tab" aria-expanded="false">Platform</a></li>
<li class=""><a href="#backend" data-toggle="tab" aria-expanded="false">Backend</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="trial" style="margin: 15px;">
</div>
<div class="tab-pane" id="platform" style="margin: 15px;">
</div>
<div class="tab-pane" id="backend" style="margin: 15px;">
</div>
</div>
</section>
<script type="text/javascript">
$(function() {
var get = function(id, repo) {
$.get(repo + "/issues", function(data) {
if (data.length == 0) {
$(id)
{{if eq .Lang "ja"}}
.append('<p>現在確認された障害はないと判断しています。</p>')
.append('<p>何か問題が発生した場合、<a href="./contact">こちら</a>にご連絡ください。</p>');
{{else}}
.append('<p>We thought that everything goes as we planned.</p>')
.append('<p>If you find any problem, notify <a href="/contact">here</a> please<p>');
{{end}}
return;
}
{{if eq .Lang "ja"}}
$(id).append('<p>' + data.length + '件の不具合が報告されています。</p>');
{{else}}
$(id).append('<p>' + data.length + ' issue(s) has been reported.</p>');
{{end}}
var tableSchema = ["#", "title", "labels", "created at", "updated at", "detail"];
var header = $();
tableSchema.forEach(function(v) {
header = header.add('<th>' + v + '</th>');
});
header = header.wrapAll('<tr />').parent();
header = header.wrapAll('<thead />').parent();
var body = $();
var wrapTd = function(s) {
return '<td>' + s + '</td>';
};
var dateFormat = function(t) {
var f = function(d) {
return ("0" + d).substr(-2);
}
return '<span data-toggle="tooltip" data-placement="bottom" title="' + t.toString() + '">' + t.getFullYear() + '/' + f(t.getMonth() + 1) + '/' + f(t.getDate()) + ' ' + f(t.getHours()) + ':' + f(t.getMinutes()) + ':' + f(t.getSeconds()) + '</span>';
};
data.sort(function(l, r) {
return l.number - r.number;
});
data.forEach(function(issue) {
var line = $();
line = line.add(wrapTd(issue.number));
line = line.add(wrapTd(issue.title));
var labels = $();
issue.labels.forEach(function(label, i) {
if (i > 0) {
labels = labels.add('<span> </span>');
}
labels = labels.add('<span class="label" style="background-color: #' + label.color + ';">' + label.name + '</span>');
});
if (issue.labels.length == 0) {
labels = labels.add("<span>-</span>");
}
line = line.add(labels.wrapAll('<td />').parent());
line = line.add(wrapTd(dateFormat(new Date(issue.created_at))));
line = line.add(wrapTd(dateFormat(new Date(issue.updated_at))));
line = line.add(wrapTd('<a target="_blank" href="' + issue.html_url + '">Detail</a>'));
line = line.wrapAll('<tr />').parent();
body = body.add(line);
});
body = body.wrapAll('<tbody />').parent();
var table = $();
table = table.add(header);
table = table.add(body);
table = table.wrapAll('<table class="table table-striped table-hover" />').parent();
$(id).append(table);
$('[data-toggle="tooltip"]').tooltip();
});
}
get("#trial", "https://api.github.com/repos/tut-cc/SamurAI_Coding_2018-19_Practice_PageTemplates");
get("#platform", "https://api.github.com/repos/takashi-chikayama/software-for-SamurAI-Coding-2018-19");
get("#backend", "https://api.github.com/repos/exKAZUu/ai-container");
});
</script>
</div>
{{end}}