var clientVersion = null; function trace(a){if(window.Debug&&window.Debug.writeln){window.Debug.writeln(a);}else if(window.console)window.console.log(a);} function embedSWFCallback(e) { // NOTE: this does not detect if the swf was loaded successfully if (e.success) { // e.id = swf ID ("cardhunter_gameclient") // e.ref = HTML object reference } else { // failed to load flash // e.id = swf ID as above // e.ref is undefined $('#altContent').html('
Card hunter requires Flash Player 11.5 or later, get it here:
'); } } function loadRealClient() { var version = clientVersion; trace('Loading client version ' + version); var flashvars = { }; var params = { menu: "false", scale: "noScale", allowFullscreen: "true", allowFullscreenInteractive: "true", allowScriptAccess: "always", bgcolor: "#000000", wmode: "direct" // can cause issues with FP settings & webcam }; var attributes = { id:"cardhunter_gameclient", name:"cardhunter_gameclient" }; $('#altContent').html('Card hunter requires Flash Player 11.5 or later, get it here:
'); var swfLoc = ''; if ((version != undefined) && (version != null)) { swfLoc = version + '/release/'; } else { swfLoc = 'client/release/'; } swfobject.embedSWF( swfLoc + 'CardHunterWebApp.swf', "altContent", "100%", "100%", "11.5.0", swfLoc + 'expressInstall.swf', flashvars, params, attributes, embedSWFCallback); } function loadClient(version) { clientVersion = version; loadRealClient(); } function setMaintenance(){ $('#altContent').html('Card Hunter is currently down for maintenance. Please try again in a few minutes.
'); } function checkMaintenance(){ var maintenanceURL = 'https://live-server.cardhunter.com/check_maintenance.jsp'; var today = new Date(); $.ajax({ type: 'GET', url: maintenanceURL, cache: false, crossDomain: true, dataType: "text", success: function(dataStr) { var xmlDoc = null; var shortVersion = undefined; if ($.type(dataStr) === "string"){ xmlDoc = $.parseXML(dataStr); }else{ trace("Invalid response: " + dataStr); } if (xmlDoc != null){ var xml = $(xmlDoc); var statusObj = xml.find("active"); if (statusObj != undefined){ if (statusObj.text() == 1){ shortVersionObj = xml.find("shortVersion"); if (shortVersionObj != undefined){ shortVersion = shortVersionObj.text(); } if (shortVersion != undefined){ loadClient(shortVersion); }else{ setMaintenance(); } }else{ setMaintenance(); } }else{ $('#altContent').html('Error: invalid server status response: ' + dataStr); } }else{ trace("Failed to parse XML"); $('#altContent').html('Error: invalid server status response: ' + dataStr); } }, error: function(jqXHR, textStatus, errorThrown){ if ($('html').is('.ie6, .ie7, .ie8, .ie9')) { if (window.location.protocol != "https:") { var secureURL = 'https://game.cardhunter.com/';; var altContent = 'Error checking server status: ' + errorThrown + '