-
Notifications
You must be signed in to change notification settings - Fork 6
/
collection.html
177 lines (144 loc) · 6.27 KB
/
collection.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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
<html>
<!--
pgn4web javascript chessboard
copyright (C) 2009, 2010 Paolo Casaschi
see README file and http://pgn4web.casaschi.net
for credits, license and more details
-->
<head>
<title>chess games</title>
<link href="collection.css" type="text/css" rel="stylesheet" />
<link rel="shortcut icon" href="pawn.ico" />
<script src="pgn4web.js" type="text/javascript"></script>
<script type="text/javascript">
thisRegExp = /(&|\?)(help|h)([^&$]*)(&|$)/i;
if (window.location.search.match(thisRegExp) !== null) {
alert("pgn4web collection.html parameters" + "\n" +
" - pgnFile=filename.pgn" + "\n" +
" - title=page title" + "\n" +
" - search=search expression" + "\n" +
" - help");
}
pgnFilename = "";
thisRegExp = /(&|\?)(pgnFile|pf)=([^&$]*)(&|$)/i;
if (window.location.search.match(thisRegExp) !== null) {
pgnFilename = unescape(window.location.search.match(thisRegExp)[3]);
} else {
// accepts pgnData as alias for pgnFile for consistency with board.html
thisRegExp = /(&|\?)(pgnData|pd)=([^&$]*)(&|$)/i;
if (window.location.search.match(thisRegExp) !== null) {
pgnFilename = unescape(window.location.search.match(thisRegExp)[3]);
}
}
if (pgnFilename === "") {
pgnTitle = "no PGN file loaded";
} else {
SetPgnUrl(pgnFilename); // if set, this has precedence over the inline PGN in the HTML file
pgnTitle = pgnFilename;
}
thisRegExp = /(&|\?)(title|t)=([^&$]*)(&|$)/i;
if (window.location.search.match(thisRegExp) !== null) {
pgnTitle = unescape(window.location.search.match(thisRegExp)[3]);
}
document.title = "chess games: " + pgnTitle;
thisRegExp = /(&|\?)(search|s)=([^&$]*)(&|$)/i;
if (window.location.search.match(thisRegExp) !== null) {
pgnSearchTarget = unescape(window.location.search.match(thisRegExp)[3]);
} else {
pgnSearchTarget = "";
}
SetImagePath("alpha/36"); // use "" path if images are in the same folder as this javascript file
SetImageType("png");
SetHighlightOption(false); // true or false
SetGameSelectorOptions(" Event Site Rd White Black Res Date", true, 12, 12, 2, 15, 15, 3, 10); // (head, num, chEvent, chSite, chRound, chWhite, chBlack, chResult, chDate);
SetCommentsIntoMoveText(false);
SetCommentsOnSeparateLines(false);
SetAutoplayDelay(1000); // milliseconds
SetAutostartAutoplay(false);
SetAutoplayNextGame(false); // if set, move to the next game at the end of the current game during autoplay
SetInitialGame(1); // number of game to be shown at load, from 1 (default); values (keep the quotes) of "first", "last", "random" are accepted; other string values assumed as PGN search string
SetInitialHalfmove(1, true); // halfmove number to be shown at load, 0 for start position, -1 for random halfmove
SetShortcutKeysEnabled(true);
function customFunctionOnPgnTextLoad() {
if (theObject = document.getElementById('numGm')) { theObject.innerHTML = numberOfGames; }
searchPgnGame(pgnSearchTarget);
}
function customFunctionOnPgnGameLoad() {
if (theObject = document.getElementById('currGm')) { theObject.innerHTML = currentGame+1; }
if (theObject = document.getElementById('numPly')) { theObject.innerHTML = PlyNumber; }
}
function customFunctionOnMove() {
if (theObject = document.getElementById('currPly')) { theObject.innerHTML = CurrentPly; }
}
</script>
</head>
<body>
<!-- paste your PGN below and make sure you dont specify an external source with SetPgnUrl() -->
<form style="display: none;"><textarea style="display: none;" id="pgnText">
</textarea></form>
<!-- paste your PGN above and make sure you dont specify an external source with SetPgnUrl() -->
<table class="containerTable">
<tr valign=bottom>
<td class="containerCell" colspan=2>
<div style="font-size: 200%; font-weight: bold; text-align: center;">
<script type="text/javascript">
document.write(pgnTitle);
</script>
</div>
</td>
</tr>
<tr valign=bottom>
<td class="containerCell" colspan=2>
<div id="GameSelector"></div>
<div id="GameSearch"></div>
</td>
</tr>
<tr valign=top>
<td class="containerCell" align="left" width=50%>
<div id="GameBoard"></div>
<p></p>
<div id="GameButtons"></div>
</td>
<td class="containerCell" width=50% style="text-align: left;">
<table>
<tr><td class="label">date</td><td><span id="GameDate"></span></td></tr>
<tr><td class="label">site</td><td><span style="white-space: nowrap;" id="GameSite"></span></td></tr>
<tr><td colspan=2 class="rowSpace"></td></tr>
<tr><td class="label">event</td><td><span style="white-space: nowrap;" id="GameEvent"></span></td></tr>
<tr><td class="label">round</td><td><span id="GameRound"></span></td></tr>
<tr><td colspan=2 class="rowSpace"></td></tr>
<tr><td class="label">white</td><td class="boldItem"><span style="white-space: nowrap;" id="GameWhite"></span></td></tr>
<tr><td class="label">black</td><td class="boldItem"><span style="white-space: nowrap;" id="GameBlack"></span></td></tr>
<tr><td colspan=2 class="rowSpace"></td></tr>
<tr><td class="label">result</td><td class="boldItem"><span id="GameResult"></span></td></tr>
<tr><td colspan=2 class="rowSpace"></td></tr>
<tr><td class="label">side</td><td><span id="GameSideToMove"></span></td></tr>
<tr><td class="label">last</td><td><span class="move"><span id="GameLastMove"></span></span></td></tr>
<tr><td class="label">next</td><td><span class="move"><span id="GameNextMove"></span></span></td></tr>
<tr><td colspan=2 class="rowSpace"></td></tr>
<tr><td class="label">ply</td><td><span id=currPly>0</span> (<span id=numPly>0</span>)</td></tr>
<tr><td class="label">game</td><td><span id=currGm>0</span> (<span id=numGm>0</span>)</td></tr>
<tr><td colspan=2 class="rowSpace"></td></tr>
<tr><td class="label">archive</td>
<td>
<script type="text/javascript">
if (pgnFilename) {
document.write('<a class="linkItem" href="' + pgnFilename + '">' + pgnFilename + '</a>');
}
</script>
</td>
<!--
<tr><td colspan=2 class="rowSpace"></td></tr>
<tr><td class="label">Move comment</td><td><span id="GameLastComment"></span></td></tr>
-->
</table>
</td>
</tr>
<tr valign=top>
<td class="gametextContainerCell" style="text-align: justify;" colspan=2>
<div class="gametextDiv" id="GameText"></div>
</td>
</tr>
</table>
</body>
</html>