-
Notifications
You must be signed in to change notification settings - Fork 2
/
debug.html
64 lines (64 loc) · 2.2 KB
/
debug.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Josekle debug mode</title>
<link href="css/besogo.css" rel="stylesheet" />
<style>
div#container {
display: flex;
flex-direction: row;
}
div#input-board {
width: 800px !important;
height: 800px;
}
.besogo-board {
width: 800px !important;
height: 800px !important;
}
.besogo-panels {
display: none !important;
}
</style>
<script src="besogo.all.js"></script>
<script>
window.onload = function() {
const nodeId=parseInt(document.location.href.split("#")[1]);
fetch('/josekle/sgf/hard.json')
.then(response => response.json())
.then(puzzles => {
const puzzle = puzzles[Math.floor(Math.random()*puzzles.length)];
console.log(puzzle);
const nodeId = puzzle["node_id"];
const solution = puzzle["solution"];
const url = "https://online-go.com/joseki/" + nodeId;
document.querySelector("#oje").src=url;
const a = document.createElement("a");
a.href = url;
a.innerText = url;
document.querySelector("body").appendChild(a);
const besogoBoard = document.createElement('div');
besogoBoard.id="input-board";
besogoBoard.classList.add("besogo-editor");
besogoBoard.coord="western";
// besogoBoard.innerText=sgf;
//besogoBoard.panels="control+tree";
document.querySelector("div#container").appendChild(besogoBoard);
besogo.autoInit();
const editor = document.querySelector('#input-board').editor;
for (var i = 0; i < solution.length; i++) {
editor.click(solution[i].x, solution[i].y, false, false);
}
// while (undefined === editor.nextNode(1)){}
editor.setZoom(1.0);
});
}
</script>
</head>
<body>
<div id="container">
<iframe id="oje" width="800" height="800" title="OGS Joseki Explorer" src=""></iframe>
</div>
</body>
</html>