var log=function(e,t){t=t||"INFO";var o=moment().format("DD MMM HH:mm:ss");console.log(o+" ["+t.toUpperCase()+"] "+e)};log("Scripts loaded");var staticLoaded=0,jsonLoaded=0,playerCount=0,errorMsg="Error loading content!",loadStatic=function(e){for(var t=0;te.length?void log("JSON data incomplete, not storing in cache!","WARN"):($.cookies.set("jsondata",e,{expiresAt:moment().add("days",15).toDate()}),void log("Updated JSON data cache"))},function(o){updateOnline(!1),log("Error loading "+e+"!","WARN");var n=$.cookies.get("jsondata");if(null!=n)log("Loading JSON items from cache...","WARN"),updateJsonItems(n);else{log("No cached JSON items found!","WARN");for(var a in t)$("#"+t[a]).html(errorMsg)}}),setTimeout(function(){log(jsonLoaded+"/"+t.length+" JSON items loaded"),jsonLoaded=0},3e3)},getJson=function(e,t,o){if(e){t=t||function(){},o=o||function(){};var n="undefined"!=typeof XMLHttpRequest?new XMLHttpRequest:new ActiveXObject("Microsoft.XMLHTTP");n.open("get",e,!0),n.onreadystatechange=function(){var e;4==n.readyState&&200==n.status&&(e=JSON.parse(n.responseText),t(e))},n.onerror=function(){o(9001)},n.timeout=2500,n.ontimeout=function(){o(9001)},n.send()}},updateJsonItems=function(e){for(var t in jsonContent){var o=jsonContent[t],n=e[o];null!=n&&0!=n.length?($("#"+o).html(parseArray(n,o)),jsonLoaded+=1,log("(JSON "+jsonLoaded+") Loaded "+o)):(log("Error loading "+o+"!","WARN"),$("#"+o).html(errorMsg))}},parseArray=function(e,t){var o="";if("developers"==t)for(var n in e){var a=" - ";a+="Madgeek1450"==e[n]?"TFM Creator":"DarthSalamon"==e[n]?"Lead Developer":"Developer",o+='
  • '+e[n]+a+"
  • "}else for(var n in e)o+='
  • '+e[n]+"
  • ";return o},updateOnline=function(e){e?$("#status").html("The server is Online!"):$("#status").html("The server is Offline :/")};