Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(site): fix download url #124

Merged
merged 1 commit into from
Sep 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 35 additions & 21 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -106,15 +106,19 @@ <h3>Share your projects with your team</h3>
</ul>
</div>
<footer class="skz-footer">
<a class="skz-download" download>Download Skizzle for macOS</a>
<div class="doge">
<span>Wow.</span>
<span>Such download</span>
<span>Many good app</span>
<span>Very enjoyable</span>
<span>Much code reviews</span>
<span>So thank you</span>
<div class="skz-download-container">
<a class="skz-download" download>Download Skizzle for macOS</a>
<a class="skz-secondary-download" download>Download Skizzle for Windows</a>
<div class="doge">
<span>Wow.</span>
<span>Such download</span>
<span>Many good app</span>
<span>Very enjoyable</span>
<span>Much code reviews</span>
<span>So thank you</span>
</div>
</div>

<p>
Skizzle is an
<a href="https://github.com/AxaGuilDEv/Skizzle">open source project</a>
Expand All @@ -126,29 +130,39 @@ <h3>Share your projects with your team</h3>
<script>
var version = '1.2.0';

function getFileName() {
function getIsMacOS() {
Debaerdm marked this conversation as resolved.
Show resolved Hide resolved
var platform = window.navigator.platform;
var macosPlatforms = ['Macintosh', 'MacIntel', 'MacPPC', 'Mac68K'];
var fileName =
'https://github.com/AxaGuilDEv/Skizzle/releases/download/v' +
version +
'/Skizzle-' +
(macosPlatforms.indexOf(platform) !== -1 ? '' : 'Setup-') +
version;

if (macosPlatforms.indexOf(platform) !== -1) {
return fileName + '.dmg';
}
return macosPlatforms.indexOf(platform) !== -1;
}

return fileName + '.exe';
function getFileName() {
var url = 'https://github.com/AxaGuilDEv/Skizzle/releases/download/v'
var macOSFileName = url + version + '/Skizzle-' + version + '.dmg';
var windowsFileName = url + version + '/Skizzle-Setup-' + version + '.exe';

return {
macOSFileName,
windowsFileName
}
}

document.addEventListener('DOMContentLoaded', () => {
var fileName = getFileName();
var { macOSFileName, windowsFileName } = getFileName();
var downloadButtons = document.querySelectorAll('.skz-download');
var secondariesDownloadButtons = document.querySelectorAll('.skz-secondary-download');

var isMacOS = getIsMacOS();

downloadButtons.forEach(function (button) {
button.setAttribute('href', fileName);
button.textContent = isMacOS ? 'Download Skizzle for macOS' : 'Download Skizzle for Windows';
button.setAttribute('href', isMacOS ? macOSFileName : windowsFileName);
});

secondariesDownloadButtons.forEach(function (button) {
button.textContent = isMacOS ? 'Download Skizzle for Windows' : 'Download Skizzle for macOS';
button.setAttribute('href', isMacOS ? windowsFileName : macOSFileName);
});
});
</script>
Expand Down
8 changes: 6 additions & 2 deletions docs/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ body {
text-decoration: underline;
font-size: 0.8rem;
cursor: pointer;
color: #fff;
}

.skz-secondary-download:hover {
Expand Down Expand Up @@ -152,7 +153,9 @@ body {
z-index: 2;
}

.skz-footer .skz-download {
.skz-download-container {
display: flex;
flex-direction: column;
margin: auto;
}

Expand Down Expand Up @@ -180,6 +183,7 @@ body {
top: 0;
width: 100%;
height: 100%;
pointer-events: none;
font-family: 'Comic sans MS', sans-serif;
}

Expand Down Expand Up @@ -223,7 +227,7 @@ body {
transition-delay: 2.5s;
}

.skz-download:hover + .doge span {
[download]:hover ~ .doge span {
opacity: 1;
}

Expand Down