1<!DOCTYPE HTML> 2<html> 3 4<!-- 5 pgn4web javascript chessboard 6 copyright (C) 2009-2014 Paolo Casaschi 7 see README file and http://pgn4web.casaschi.net 8 for credits, license and more details 9--> 10 11<head> 12 13<title>pgn4web live broadcast</title> 14 15<link rel="icon" sizes="16x16" href="pawn.ico" /> 16 17<script src="pgn4web.js" type="text/javascript"></script> 18 19<script type="text/javascript"> 20 "use strict"; 21 22 var pgnFile; 23 var pgnFile_default = "live/live.pgn"; 24 // accepts pgnData as alias for pgnFile for consistency with board.html 25 if ((pgnFile = gup("pgnData")) === "") { 26 if ((pgnFile = gup("pgnFile")) === "") { 27 pgnFile = pgnFile_default; 28 } 29 } 30 31 var demoFlag = false; 32 var alertFlag = false; 33 if ((gup("demo") == "true") || (gup("demo") == "t") || 34 (gup("refreshDemo") == "true") || (gup("refreshDemo") == "t")) { 35 demoFlag = true; alertFlag = true; 36 } 37 38 var refreshMinutes; 39 if ((refreshMinutes = gup("refreshMinutes")) === "") { 40 refreshMinutes = 1; 41 } else { 42 var testMinutes = refreshMinutes + ""; 43 if ((testMinutes.match(/[^0-9\.]/)) || (refreshMinutes === 0)) { 44 if (alertFlag) { 45 alert("ERROR: refreshMinutes parameter must be a positive number.\n" + 46 "Supplied " + testMinutes + "; defaulting to 1."); 47 } 48 refreshMinutes = 1; 49 } 50 } 51 52 SetPgnUrl(pgnFile); 53 SetShortcutKeysEnabled(true); 54 SetLiveBroadcast(refreshMinutes, alertFlag, demoFlag, false); 55 56 function customFunctionOnPgnTextLoad() { 57 var resultObject = document.getElementById("results"); 58 if (resultObject) { 59 var resultString = ""; 60 resultString += fillWithBlanks("white", 15) + " "; 61 resultString += fillWithBlanks("black", 15) + " "; 62 resultString += fillWithBlanks("result", 7) + " "; 63 resultString += "\n \n"; 64 for (var gg = 0; gg < numberOfGames; gg++) { 65 resultString += fillWithBlanks(gameWhite[gg], 15) + " "; 66 resultString += fillWithBlanks(gameBlack[gg], 15) + " "; 67 resultString += fillWithBlanks(gameResult[gg], 7) + " "; 68 resultString += "\n"; 69 } 70 resultObject.innerText = resultString; 71 } 72 } 73 74 var blanks = " "; 75 function fillWithBlanks(str, num) { 76 if (str.length >= num) { return str.substr(0, num); } 77 else { return str + blanks.substr(0, num - str.length); } 78 } 79 80function gup(name) { 81 82 name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]"); 83 var regexS = "[\\?&]"+name+"=([^&#]*)"; 84 // commented below to match first occurrence (to avoid users overruling setting) 85 // regexS = regexS+"(?!.*"+regexS+")"; // matches the LAST occurrence 86 var regex = new RegExp( regexS, "i" ); 87 var results = regex.exec( window.location.href ); 88 if (results !== null) { return decodeURIComponent(results[1]); } 89 90 // allows for short version of the URL parameters, for instance sC matches squareColor 91 var compact_name = name.charAt(0); 92 for (var i=1; i<name.length; i++) { 93 if (name.charAt(i).match(/[A-Z]/)) { compact_name = compact_name + name.charAt(i).toLowerCase(); } 94 } 95 name = compact_name; 96 97 name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]"); 98 regexS = "[\\?&]"+name+"=([^&#]*)"; 99 // commented below to match first occurrence (to avoid users overruling setting) 100 // regexS = regexS+"(?!.*"+regexS+")"; // matches the LAST occurrence 101 regex = new RegExp( regexS, "i" ); 102 103 results = regex.exec( window.location.href ); 104 if (results !== null) { return decodeURIComponent(results[1]); } 105 106 return ""; 107} 108 109</script> 110 111</head> 112 113<body style="margin:0px; padding:1.75em; font-family:monospace; color:black; font-size:16px;"> 114 115<pre id="results" style="font-size:16px;"></pre> 116 117<span id="GameLiveStatus"></span> 118 119</body> 120 121</html> 122