function downloadLogin(){var tp=new URLSearchParams(window.location.search).get("rf"); var referrer = escape(tp==null?document.referrer:tp);var href = escape(window.location.href);var protocol = document.location.protocol;if(href.indexOf("/file-api")!=-1){ alert("您已设置了游戏下载的js,并且点击了下载游戏按钮"); return false;}var host = window.location.host; var split = href.split("/");var versionId = 0,i=0;versionId = split[split.length-2];if(isNaN(versionId)) return false;var httpRequest = new XMLHttpRequest();httpRequest.open("GET", protocol+"//"+host+"/api/download/login/exe?referrer="+referrer+"¤t="+href+"¤tHost="+host+"&versionId="+versionId+(isNaN(Number(split[split.length - 3]))?"":("&channelId="+split[split.length-3])), true);httpRequest.send();httpRequest.onreadystatechange = function () { if (httpRequest.readyState == 4) { if(httpRequest.status == 200){ var res = httpRequest.responseText; var json = JSON.parse(res); if(json.href!=undefined && json.href!=""){ var url = json.href;window.open(url); /*var a = document.createElement("a");*/ /*a.href = encodeURI(url); if(json.boxName==undefined){ if(url.indexOf(".rar")>-1){a.download = json.loginName+".rar";}else{a.download = json.loginName+".exe";}}else{ a.download = json.boxName; }*/ /*a.click();*/ }else{alert(json.msg);} } }}}function goPayPage(){var tp=new URLSearchParams(window.location.search).get("rf"); var referrer = escape(tp==null?document.referrer:tp);var href = escape(window.location.href);var protocol = document.location.protocol;if(href.indexOf("/file-api")!=-1){ alert("您已设置了游戏下载的js,并且点击了下载游戏按钮"); return false;}var host = window.location.host; var split = href.split("/");var versionId = 0,i=0;versionId = split[split.length-2];if(isNaN(versionId)) return false;var httpRequest = new XMLHttpRequest();httpRequest.open("GET", protocol+"//"+host+"/api/download/login/exe?referrer="+referrer+"¤t="+href+"¤tHost="+host+"&versionId="+versionId+(isNaN(Number(split[split.length - 3]))?"":("&channelId="+split[split.length-3])), true);httpRequest.send();httpRequest.onreadystatechange = function () { if (httpRequest.readyState == 4) { if(httpRequest.status == 200){ var res = httpRequest.responseText; var json = JSON.parse(res); if(json.href!=undefined && json.href!=""){ var url = json.href;window.open(url); /*var a = document.createElement("a");*/ /*a.href = encodeURI(url); if(json.boxName==undefined){ if(url.indexOf(".rar")>-1){a.download = json.loginName+".rar";}else{a.download = json.loginName+".exe";}}else{ a.download = json.boxName; }*/ /*a.click();*/ }else{alert(json.msg);} } }}}