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
_util.onload(function() { try { var divs = document.getElementsByClassName("kifu-viewer"); [].forEach.call(divs, function(div) { new _kifu_viewer(div); }); } catch (e) { alert(e.name + ": " + e.message); } }); function _kifu_viewer(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.NEXT, 1, _str.SURU, true, _str.SHINAI, false], [_label.SPEED, 2, _str.HAYAI, 100, _str.FUTSUU, 200, _str.OSOI, 400] ]; 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: controller.set_show_next(val == "true"); break; case 3: controller.set_speed(parseInt(val)); break; } if (index <= 1) view.draw(); //else if (index == 2) view.clean_and_draw(true); }); var view = new _view(div); var kyokumen = _kyokumen.get_hirate_kyokumen(); view.set_kyokumen(kyokumen); view.draw(); var controller = new _controller_panel(div, view, 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(); }); controller.set_show_next(false); get_kifu(div, function(data) { view.set_player_names(data[_key.PLAYER]); view.set_mochigoma_mode(data[_key.MOCHIGOMA]); var kyokumen = data[_key.KYOKUMEN]; view.set_kyokumen(kyokumen); view.draw(); controller.set_sasite_tree(data[_key.SASITE]); }); }