var debug="null" var langMap = new Object() langMap['EN'] = 0 langMap['ES'] = 1 langMap['FR'] = 2 langMap['DE'] = 3 langMap['IT'] = 4 var showConnected = false function handleCasterMessage(message,updateObj) { //console.log('handle') if (message != "connectionStatus") { //console.log(message) for (var i in updateObj) { for(var j in updateObj[i]) { if(j != 'objId') { if (updateObj[i]['objId'] != null && j != null && updateObj[i][j] != null) { if(debug == "true") { console.log("Message: " + message + "node: " + updateObj[i]['objId'] + ", attribute: " + j + ", value: " + updateObj[i][j]) } if (showConnected == false) { showConnected = true document.getElementById('connectedDisplay').style.display = 'inline' } updateData(updateObj[i]['objId'],j,updateObj[i][j]); } } } } } } function updateData(nodeName, attribute, value) { if (nodeName.indexOf('OOT-') != -1) { updateOOT(nodeName, attribute + '', value) } else if (nodeName.indexOf('-player-') != -1) { if (activePage == 'Stats') { updatePlayerStats(nodeName, attribute + '', value) } } else if (nodeName.indexOf('GC-') != -1) { if(debug == "true") { console.log('matchdata') } updateMatchData(nodeName, attribute + '', value) } else if (nodeName.indexOf('Lineup') != -1) { if (activePage == 'Overview') { if(debug == "true") { console.log('lineup') } updateLineups(nodeName, attribute + '', value) } } else if (nodeName.indexOf('Comment') != -1) { if (activePage == 'Overview') { if(debug == "true") { console.log('comment') } updateCommentary(nodeName, attribute + '', value) } else if (activePage == 'Commentary' || activePage == "CommentaryPopup") { if(debug == "true") { console.log('comment') } updateCommentaryPages(nodeName, attribute + '', value) } } else if (nodeName.indexOf('t-' + activeGameId + '-' + langMap[activeLang] + '-add') != -1) { updateEventList(value) } else if (nodeName.indexOf('t-' + activeGameId + '-remove') != -1) { removeEvent(value) } } function updateOOT(nodeName, attribute, value) { var leagueMark = nodeName.indexOf('-') var gameIdMark = nodeName.lastIndexOf('-') var ootGameId = 0 var ootLeague = '' if (gameIdMark != -1) { ootGameId = nodeName.substring(gameIdMark + 1) } if (leagueMark != -1 && gameIdMark != -1) { ootLeague = nodeName.substring(leagueMark + 1, gameIdMark) } if (activeLeague.toLowerCase() == ootLeague.toLowerCase()) { switch (attribute) { case "0": updateOOTElement('ootHomeScore' + ootGameId, value) break case "1": updateOOTElement('ootAwayScore' + ootGameId, value) break case "2": if (activeLang.toLowerCase() == 'en' && activeCC == '5901') { updateOOTElement('ootStatus' + ootGameId, value) } break case "3": if (activeLang.toLowerCase() == 'en' && activeCC == '9999') { updateOOTElement('ootStatus' + ootGameId, value) } break case "4": if (activeLang.toLowerCase() == 'en' && activeCC == '3436') { updateOOTElement('ootStatus' + ootGameId, value) } break case "5": if (activeLang.toLowerCase() == 'en' && activeCC == '4716') { updateOOTElement('ootStatus' + ootGameId, value) } break case "6": if (activeLang.toLowerCase() == 'en' && activeCC == '3888') { updateOOTElement('ootStatus' + ootGameId, value) } break case "7": if (activeLang.toLowerCase() == 'en' && activeCC == '5739') { updateOOTElement('ootStatus' + ootGameId, value) } break case "8": if (activeLang.toLowerCase() == 'es') { updateOOTElement('ootStatus' + ootGameId, value) } break case "9": if (activeLang.toLowerCase() == 'fr') { updateOOTElement('ootStatus' + ootGameId, value) } break case "10": if (activeLang.toLowerCase() == 'de') { updateOOTElement('ootStatus' + ootGameId, value) } break case "11": if (activeLang.toLowerCase() == 'it') { updateOOTElement('ootStatus' + ootGameId, value) } break default: break } } } function updateOOTElement(elementName, value) { if (document.getElementById(elementName)) { document.getElementById(elementName).innerHTML = value } }