diff --git a/assets/js/fileinfo.js b/assets/js/fileinfo.js new file mode 100644 index 0000000..4daa9a8 --- /dev/null +++ b/assets/js/fileinfo.js @@ -0,0 +1,19 @@ +var fileinfo = {}; + +function setSnapshotFileInfo(key, name, size, url) { + fileinfo[key + "_NAME"] = name; + fileinfo[key + "_SIZE"] = size; + fileinfo[key + "_URL"] = url; + fileinfo[key + "_ASC_URL"] = url + ".asc"; + fileinfo[key + "_SHA256_URL"] = url + ".sha256"; + fileinfo[key + "_SHA512_URL"] = url + ".sha512"; +} +jQuery(document).ready(function () { + for (var fileid in fileinfo) { + if (fileid.indexOf("_URL") >= 0) { + $("a[id=" + fileid + "]").attr('href', fileinfo[fileid]); + } else { + $("#" + fileid).text(fileinfo[fileid]); + } + } +}); \ No newline at end of file diff --git a/assets/js/home.js b/assets/js/home.js index 614ff84..8eb660d 100644 --- a/assets/js/home.js +++ b/assets/js/home.js @@ -3,41 +3,41 @@ $(document).ready(function() { var w = window.navigator.platform; var bits = 32; fi = function(s) { - return window.navigator.userAgent.indexOf(s) > -1; + return window.navigator.userAgent.includes(s); }; if (fi('x86_64') || fi('x86-64') || fi('Win64') || fi('x64;') || fi('amd64') || fi('AMD64') || fi('WOW64') || fi('x64_64') || w === 'MacIntel' || w === 'Linux x86_64') { bits = 64; } - var OSName="Unknown OS"; - if (navigator.appVersion.indexOf("Win")!=-1) { - OSName="Windows"; - if (bits == 64) { - DLName = fileinfo['WIN64_RELEASE_INSTALLER_NAME']; - downloadLink = fileinfo['WIN64_RELEASE_INSTALLER_URL']; - } - else { - DLName = fileinfo['WIN32_RELEASE_INSTALLER_NAME']; - downloadLink = fileinfo['WIN32_RELEASE_INSTALLER_URL']; - } - } - else if (navigator.appVersion.indexOf("Mac")!=-1) { - OSName="Mac OS X"; - DLName = fileinfo['MAC_RELEASE_NAME']; - downloadLink = fileinfo['MAC_RELEASE_URL']; - } - else if (navigator.appVersion.indexOf("X11")!=-1) { - OSName="Linux"; - DLName = fileinfo['MAC_RELEASE_NAME']; - downloadLink = "downloads.html#linux"; - } - else if (navigator.appVersion.indexOf("Linux")!=-1) { - OSName="Linux"; - DLName = fileinfo['MAC_RELEASE_NAME']; - downloadLink = "downloads.html#linux"; - } + var OSName = "Unsupported OS"; + var DLName = "OpenSCAD 2021.01"; + var downloadLink = "downloads.html"; + if (fi("Win")) { + OSName=`Windows ${bits} bit`; + DLName = fileinfo[`WIN${bits}_RELEASE_INSTALLER_NAME`]; + downloadLink = fileinfo[`WIN${bits}_RELEASE_INSTALLER_URL`]; + } + else if (fi("Mac")) { + OSName = "Mac OS X Intel"; + DLName = fileinfo['MAC_RELEASE_NAME']; + downloadLink = fileinfo['MAC_RELEASE_URL']; + } + else if (fi("X11") || fi("Linux")) { + OSName = "Linux"; + downloadLink = "downloads.html#linux"; + + if (bits === 64) { + OSName += " 64 bit"; + DLName = fileinfo['LIN64_RELEASE_NAME']; + downloadLink = fileinfo['LIN64_RELEASE_URL']; + } else if (fi("aarch64")) { + OSName += " ARM 64 bit"; + DLName = fileinfo['ARM64_RELEASE_NAME']; + downloadLink = fileinfo['ARM64_RELEASE_URL']; + } + } - $("#home-download a#download-link").attr("href",downloadLink); + $("#home-download a#download-link").attr("href", downloadLink); $("#home-download-link h4").text(DLName + " " + OSName); var news, i; diff --git a/downloads.html b/downloads.html index 3a55f1a..5f99c11 100644 --- a/downloads.html +++ b/downloads.html @@ -28,28 +28,7 @@ - - + diff --git a/index.html b/index.html index a403367..7779839 100644 --- a/index.html +++ b/index.html @@ -29,11 +29,8 @@ - - - + +