1<!DOCTYPE HTML>
2<html>
3
4<!--
5  pgn4web javascript chessboard
6  copyright (C) 2009-2015 Paolo Casaschi
7  see README file and http://pgn4web.casaschi.net
8  for credits, license and more details
9-->
10
11<head>
12
13<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
14
15<title>pgn4web chess live broadcast</title>
16
17<script src="pgn4web-server-config.js" type="text/javascript"></script>
18<script type="text/javascript">
19"use strict";
20
21// this should have been defined in pgn4web-server-config.js
22// setting default value here just in case
23var pgn4web_live_pointer_url;
24if (pgn4web_live_pointer_url === undefined) { pgn4web_live_pointer_url = "."; }
25</script>
26
27<style type="text/css">
28
29html, body
30{ margin: 0px; padding: 0px; }
31
32body
33{ color: #BBBBBB; background: white; font-family: sans-serif; padding: 28px; }
34
35a
36{ color: #BBBBBB; text-decoration: none; }
37
38a:hover, a:active
39{ color: red; }
40
41</style>
42
43<link rel="icon" sizes="16x16" href="pawn.ico" />
44
45</head>
46
47<body onResize="resizeFrameHeight(document.getElementById('liveframe'));">
48
49<table border="0" cellpadding="0" cellspacing="0" width="99.9%" height="99.9%"><tbody><tr><td id="headRow">
50<h1 style="margin-top:0px; padding-top:0px; text-align:right;">
51<span style="float:left; color:red;">
52pgn4web chess live broadcast
53</span>
54<a href="." onfocus="this.blur();" style="width:49px; height:29px; background:url(pawns.png) -47px -15px; vertical-align:baseline; display:inline-block;"></a>
55</h1>
56</td></tr><tr><td style="padding: 40px;">
57<table id="framecontainer" cellpadding="0" cellspacing="0" width="100%" height="100%" style="background-color: #EDE8D5; box-shadow: 0px 0px 20px #663300; border-color: #EDE8D5; border-style: solid; border-width: 40px; border-radius: 10px;" onclick="toggleLiveMode();"><tbody><tr valign="middle"><td align="center">
58<table id="frameinnercontainer" cellpadding="0" cellspacing="0" width="100%" height="100%" onclick="stopEvProp(event);"><tbody><tr valign="middle"><td align="left" valign="top">
59<iframe style="opacity: 0.9;" id="analysisframe" name="analysisframeForLiveDotHtml" src="about:blank" height="0" width="0" frameborder="0" scrolling="no" marginheight="0" marginwidth="0">your browser does not support the required iframe functionality</iframe>
60</td><td width="100%" align="center">
61<iframe id="liveframe" src="about:blank" height="360" width="480" frameborder="0" scrolling="no" marginheight="0" marginwidth="0">your browser does not support the required iframe functionality</iframe>
62</td></tr></tbody></table>
63</td></tr></tbody></table>
64</td></tr></tbody></table>
65
66<script type="text/javascript">
67"use strict";
68
69var thisRegExp, theObj;
70
71thisRegExp = /(&|\?)(h|help)=(t|true)(&|$)/i;
72if (window.location.search.match(thisRegExp) !== null) {
73  alert("pgn4web live.html shows a randomly selected live games page");
74}
75
76thisRegExp = /(&|\?)(hp|headlessPage)=(t|true)(&|$)/i;
77if (window.location.search.match(thisRegExp) !== null) {
78  if (theObj = document.getElementById("headRow")) {
79    theObj.style.display = "none";
80  }
81}
82
83var liveMode = "random";
84thisRegExp = /(&|\?)(mode|m)=([^&]*)(&|$)/i;
85if (window.location.search.match(thisRegExp) !== null) {
86  liveMode = unescape(window.location.search.match(thisRegExp)[3]);
87}
88if (liveMode == "a") { liveMode = "analysis"; }
89if (liveMode == "c") { liveMode = "compact"; }
90if (liveMode == "d") { liveMode = "dynamic"; }
91if (liveMode == "r") { liveMode = "random"; }
92if (liveMode == "w") { liveMode = "widget"; }
93if ((liveMode != "analysis") && (liveMode != "compact") && (liveMode != "dynamic") && (liveMode != "random") && (liveMode != "widget")) {
94  liveMode = "random";
95}
96if ((liveMode == "random") || (liveMode == "r")) {
97  liveMode = ["analysis", "compact", "dynamic", "widget"][Math.floor(4 * Math.random())];
98}
99
100var pgnData = "";
101thisRegExp = /(&|\?)(pgnData|pd)=([^&]*)(&|$)/i;
102if (window.location.search.match(thisRegExp) !== null) {
103  pgnData = unescape(window.location.search.match(thisRegExp)[3]);
104}
105
106setLiveMode(liveMode);
107
108function setLiveMode(lm) {
109  var iniGame='\\[\\s*Result\\s*"\\*"\\s*\\]';
110  var extraParams = "ig=" + iniGame + (pgnData ? "&pd=" + pgnData : "");
111
112  var theFrameObject = document.getElementById("liveframe");
113  var theAnalysisObject = document.getElementById("analysisframe");
114  var theContainerObject = document.getElementById("framecontainer");
115  if (theFrameObject && theAnalysisObject && theContainerObject) {
116    liveMode = lm;
117    if (liveMode == "analysis") {
118      theFrameObject.src = pgn4web_live_pointer_url + "/dynamic-frame.html?l=t&ct=pink&scf=t&pf=u&ewt=analysisframeForLiveDotHtml&ewh=240&eww=192&ewup=lch%3DEDE8D5%26dch%3DCFCBB3%26hch%3DF8CCA0%26fmch%3D302F29%26ctch%3D9C9886%26bch%3DEDE8D5%26ss%3D24%26fpr%3D0%26pf%3Du%26fms%3D11%26fcs%3D19&ewpi=t&" + extraParams;
119      resizeFrameHeight(theFrameObject);
120      theFrameObject.width = "100%";
121      theAnalysisObject.src = pgn4web_live_pointer_url + "/blank.html";
122      theAnalysisObject.height = "240";
123      theAnalysisObject.width = "192";
124      theAnalysisObject.style.marginRight = "80px";
125      theContainerObject.style.borderRightWidth = "40px";
126    } else if (liveMode == "compact") {
127      theFrameObject.src = pgn4web_live_pointer_url + "/live-compact.html?" + extraParams;
128      theFrameObject.height = "360";
129      theFrameObject.width = "480";
130      theAnalysisObject.src = "about:blank";
131      theAnalysisObject.height = "0";
132      theAnalysisObject.width = "0";
133      theAnalysisObject.style.marginRight = "0";
134      theContainerObject.style.borderRightWidth = "40px";
135    } else if (liveMode == "dynamic") {
136      theFrameObject.src = pgn4web_live_pointer_url + "/dynamic-frame.html?l=t&ct=pink&hch=t&scf=t&pf=m&" + extraParams;
137      resizeFrameHeight(theFrameObject);
138      theFrameObject.width = "100%";
139      theAnalysisObject.src = "about:blank";
140      theAnalysisObject.height = "0";
141      theAnalysisObject.width = "0";
142      theAnalysisObject.style.marginRight = "0";
143      theContainerObject.style.borderRightWidth = "40px";
144    } else if (liveMode == "widget") {
145      theFrameObject.src = pgn4web_live_pointer_url + "/board.html?am=n&d=1000&ih=e&ss=41&ps=34&pf=u&lcs=Wtyk&dcs=OXJO&bbcs=OXJO&hm=b&hcs=ZbNv&bd=c&cbcs=UJ2e&ctcs=nkYj&hd=l&md=f&tm=17&fhcs=nkYj&fhs=14&fmcs=nkYj&fccs=nkYj&hmcs=ZbNv&fms=14&fcs=m&cd=h&bcs=Wtyk&fp=10&hl=t&fh=b&fw=779&rm=1&pd=live/live.pgn&" + extraParams;
146      theFrameObject.height = "445";
147      theFrameObject.width = "779";
148      theAnalysisObject.src = "about:blank";
149      theAnalysisObject.height = "0";
150      theAnalysisObject.width = "0";
151      theAnalysisObject.style.marginRight = "0";
152      theContainerObject.style.borderRightWidth = "23px";
153    } else {
154      return;
155    }
156    theContainerObject.title = "\"" + liveMode + "\" live view, click here for a different view";
157    if (theContainerObject = document.getElementById("frameinnercontainer")) {
158      theContainerObject.title = "\"" + liveMode + "\" live view";
159    }
160  }
161}
162
163function resizeFrameHeight(frObj) {
164  var wh;
165  if ((frObj) && ((liveMode == "analysis") || (liveMode == "dynamic"))) {
166    if (window.innerHeight) { wh = window.innerHeight; }
167    else if (document.documentElement && document.documentElement.clientHeight) { wh = document.documentElement.clientHeight; }
168    else if (document.body && document.body.clientHeight) { wh = document.body.clientHeight; }
169    else { wh = 0; }
170
171    frObj.height = Math.max(240, wh - document.getElementById("headRow").offsetHeight - 222) + "px";
172  }
173}
174
175function toggleLiveMode() {
176  if (liveMode == 'analysis') { liveMode = 'compact'; }
177  else if (liveMode == 'compact') { liveMode = 'dynamic'; }
178  else if (liveMode == 'dynamic') { liveMode = 'widget'; }
179  else if (liveMode == 'widget') { liveMode = 'analysis'; }
180  else { liveMode = 'analysis'; }
181  setLiveMode(liveMode);
182}
183
184function stopEvProp(e) {
185  e.cancelBubble = true;
186  if (e.stopPropagation) { e.stopPropagation(); }
187  if (e.preventDefault) { e.preventDefault(); }
188  return false;
189}
190
191</script>
192
193</body>
194
195</html>
196