diff --git a/assets/js/selecting.js b/assets/js/selecting.js index f2d37ddbba..4e8f0d4fc0 100644 --- a/assets/js/selecting.js +++ b/assets/js/selecting.js @@ -1,69 +1,51 @@ -function isSSLothable(v) { - var m = v.minor; - var n = v.nver; - return ( - (m == 4 && n == 37) || - (m == 5 && n == 38) || - (m == 6 && n == 39) || - (m == 7 && n == 40) || - (m == 8 && n == 41) || - (m == 9 && n == 42) || - (m == 10 && n == 43) || - (m == 11 && n == 43) || - (m == 12 && n == 44) || - (m == 13 && n == 45) - ); -} - -function getResultText(v) { - if (v.major == 0) { - return 1; - } - if (v.region == "C") { - return 2; - } - return undefined; -} - -function getRedirect(v) { - if (v.major < 11 || v.minor < 4) { - return "installing-boot9strap-(soundhax)"; - } - if (v.nver < 37 && v.minor < 16) { - return "installing-boot9strap-(soundhax-sp)"; - } - if (isSSLothable(v)) { - return "installing-boot9strap-(ssloth-browser)"; - } - if (v.region == "T") { - return "seedminer(twn)"; - } - return "seedminer"; -} - -function redirect() { - var v = { - major: document.getElementById("mySelect").value, - minor: document.getElementById("mySelec").value, - nver: document.getElementById("mySel").value, - region: document.getElementById("mySe").value - }; - var result = getResultText(v); - if (result !== undefined) { - document.getElementById("result_invalidVersion").style.display = "none"; - document.getElementById("result_methodUnavailable").style.display = "none"; - - switch(result) { - case 1: - document.getElementById("result_invalidVersion").style.display = "block"; - break; - case 2: - document.getElementById("result_methodUnavailable").style.display = "block"; - break; - default: - break; - } - } else { - window.location.href = getRedirect(v); - } -} +function sslothable(s, n) { + if + ( + (s == 4 && n == 37) || + (s == 5 && n == 38) || + (s == 6 && n == 39) || + (s == 7 && n == 40) || + (s == 8 && n == 41) || + (s == 9 && n == 42) || + (s == 10 && n == 43) || + (s == 11 && n == 43) || + (s == 12 && n == 44) || + (s == 13 && n == 45) + ) { + return true; + } + else { + return false; + } + + } + function redirect() { + var cfw = document.getElementById("mySelecti"); + var mainver = document.getElementById("mySelect"); + var smallver = document.getElementById("mySelec"); + var nver = document.getElementById("mySel"); + var region = document.getElementById("mySe"); + document.getElementById("result_invalidVersion").style.display = "none"; + document.getElementById("result_methodUnavailable").style.display = "none"; + if (mainver.value == 0) { + document.getElementById("result_invalidVersion").style.display = "block"; + } + else if (mainver.value < 11 || smallver.value < 4) { + window.location.href = "installing-boot9strap-(soundhax)"; + } + else if (nver.value < 36 && smallver.value < 16) { + window.location.href = "installing-boot9strap-(soundhax-sp)"; + } + else if (sslothable(smallver.value, nver.value)) { + window.location.href = "installing-boot9strap-(ssloth-browser)"; + } + else if (region.value === "T") { + window.location.href = "seedminer-(twn)"; + } + else if (region.value === "C") { + document.getElementById("result_methodUnavailable").style.display = "block"; + } + else { + window.location.href = "seedminer"; + } + }