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
window.addEventListener("DOMContentLoaded", function() {
var divs = document.querySelectorAll(".kifu-player");
[].forEach.call(divs, function(div) { new _kifu_player(div); });
});
function _kifu_player(div) {
div.classList.add("shogi-container");
var params = [
[_label.KYOUCHOU, 0, _str.SURU, true, _str.SHINAI, false],
[_label.HANTEN, 1, _str.SURU, true, _str.SHINAI, false],
[_label.SPEED, 0, _str.HAYAI, 500, _str.FUTSUU, 1000, _str.OSOI, 2000]
];
var setting = new _setting_panel(div, params, function(index, val) {
switch (index) {
case 0: view.set_kyouchou(val == "true"); break;
case 1: view.set_hanten(val == "true"); break;
case 2: player.set_speed(parseInt(val)); break;
}
if (index <= 1) view.draw();
});
var view = new _view(div);
var player = new _player_panel(div, function(count, kyokumen, sasite) {
var s = (count == 0) ? "開始局面" : count + "手目";
var end;
if (!sasite.is_empty_sasite()) {
end = sasite.option & 0xf000;
if (end != 0) s += " " + _util.opt_moji(end);
if (count == 0 || end != 0)
s += "(" + sasite.to_string() + "まで)";
else s += " " + sasite.to_string();
}
setting.set_sasite(s);
view.set_kyokumen(kyokumen);
view.draw();
});
setting.init();
get_kifu(div, function(data) {
view.set_player_names(data[_key.PLAYER]);
view.set_mochigoma_mode(data[_key.MOCHIGOMA]);
player.set_data(data);
});
}