diff --git a/js/msdl.js b/js/msdl.js index b8a0125..6897fa0 100644 --- a/js/msdl.js +++ b/js/msdl.js @@ -132,16 +132,15 @@ function onDownloadsXhrChange() { response.ProductDownloadOptions.forEach(option => { let optionContainer = document.createElement('div'); + let header = document.createElement('h1'); + header.textContent = `Windows 11 ${option.LocalizedLanguage}` + let downloadButton = document.createElement('a'); downloadButton.href = option.Uri; downloadButton.textContent = `Download ${option.LocalizedProductDisplayName}`; downloadButton.target = "_blank"; optionContainer.appendChild(downloadButton); - let info = document.createElement('p'); - info.textContent = `Language: ${option.LocalizedLanguage}`; - optionContainer.appendChild(info); - msContent.appendChild(optionContainer); }); } else { @@ -159,6 +158,11 @@ function getFromServer() { xhr.send(); } +function getFileNameFromLink(link) { + let raw_link = link.split('?')[0]; + return raw_link.split('/').pop(); +} + function displayResponseFromServer() { pleaseWait.style.display = "none"; @@ -174,20 +178,20 @@ function displayResponseFromServer() { msContent.style.display = "block"; if (response.ProductDownloadOptions && response.ProductDownloadOptions.length > 0) { + let header = document.createElement('h2'); + header.textContent = `${response.ProductDownloadOptions[0].ProductDisplayName} ${response.ProductDownloadOptions[0].LocalizedLanguage}` + msContent.appendChild(header); + response.ProductDownloadOptions.forEach(option => { - let optionContainer = document.createElement('div'); - let downloadButton = document.createElement('a'); downloadButton.href = option.Uri; - downloadButton.textContent = `Download ${option.LocalizedProductDisplayName}`; + downloadButton.textContent = getFileNameFromLink(option.Uri); downloadButton.target = "_blank"; - optionContainer.appendChild(downloadButton); - - let info = document.createElement('p'); - info.textContent = `Language: ${option.LocalizedLanguage}`; - optionContainer.appendChild(info); - - msContent.appendChild(optionContainer); + + let br = document.createElement('br'); + + msContent.appendChild(downloadButton); + msContent.appendChild(br); }); } else { msContent.innerHTML = "

No download options available.

";