diff --git a/gulpfile.js b/gulpfile.js index bbc1d15..5be03e3 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -45,6 +45,12 @@ gulp.task("css", ['hugo'], () => ( .pipe(gulp.dest('./')) )); +gulp.task("js", ['hugo'], () => ( + gulp.src(`${distPath}/js/**/*.js`, {base: './'}) + .pipe(md5(10, `${distPath}/**/*.html`)) + .pipe(gulp.dest('./')) +)); + gulp.task('images', ['hugo'], () => ( gulp.src(`${distPath}/images/*`, {base: './'}) .pipe(gulp.dest('./')), @@ -62,13 +68,13 @@ gulp.task('images', ['hugo'], () => ( .pipe(gulp.dest('./')) )); -gulp.task('html', ['hugo', 'css', 'images'], () => ( +gulp.task('html', ['hugo', 'css', 'js', 'images'], () => ( gulp.src(`${distPath}/**/*.html`, {base: './'}) .pipe(htmlmin({collapseWhitespace: true})) .pipe(gulp.dest('./')) )); -gulp.task('deploy', ['hugo', 'css', 'images', 'html'], () => { +gulp.task('deploy', ['html'], () => { require('fs').writeFileSync(`${distPath}/CNAME`, `${cname}`); require('fs').writeFileSync(`${distPath}/robots.txt`, `Sitemap: https://${cname}/sitemap.xml\n\nUser-agent: *`); return gulp.src(`${distPath}/**/*`).pipe(ghPages(deployOptions)); diff --git a/site/content/download.md b/site/content/download.md index 70e7a2d..793c52a 100644 --- a/site/content/download.md +++ b/site/content/download.md @@ -47,69 +47,4 @@ The Bleeding Edge build of Citra is the same as our nightly builds, with additio - + diff --git a/site/themes/citra-bs-theme/layouts/_default/baseof.html b/site/themes/citra-bs-theme/layouts/_default/baseof.html index bcd6011..0513498 100755 --- a/site/themes/citra-bs-theme/layouts/_default/baseof.html +++ b/site/themes/citra-bs-theme/layouts/_default/baseof.html @@ -120,6 +120,7 @@ {{ block "scripts" . }}{{ end }} + diff --git a/site/themes/citra-bs-theme/static/js/renderDownloads.js b/site/themes/citra-bs-theme/static/js/renderDownloads.js new file mode 100644 index 0000000..21acb6b --- /dev/null +++ b/site/themes/citra-bs-theme/static/js/renderDownloads.js @@ -0,0 +1,64 @@ +$(document).ready(function() { + getRelease('nightly'); + getRelease('bleeding-edge'); + + function getRelease(v, count = 5) { + $.getJSON('https://api.github.com/repos/citra-emu/citra-' + v + '/releases', function(releases) { + $("#last-updated-" + v).text(moment(releases[0].published_at).fromNow()); + + for (var i = 0; i < releases.length; ++i) { + var release = releases[i]; + let release_date = moment(release.published_at).fromNow(); + + let release_commit = null; + let release_commit_url = null; + if (v == 'nightly') { + release_commit = release.assets[0].name.split('-').pop().trim().split('.')[0]; + release_commit_url = 'https://github.com/citra-emu/citra-' + v + '/commit/' + release_commit; + } + + let release_title = ''; + if (v == 'nightly') { + release_title = 'Nightly Build'; + } else if (v == 'bleeding-edge') { + release_title = 'Bleeding Edge Build'; + } + + if (release_commit) { + release_title += ' - ' + release_commit; + } + + var download_span = ''; + + var table_style = ''; + if (i == 0) { table_style = 'table-first'; } + + release.assets.forEach(function(asset) { + if (asset.name.includes('nupkg')) return; + if (asset.name.includes('RELEASES')) return; + + let env_icon = './images/icons/file.png'; + if (asset.name.includes('windows')) env_icon = '/images/icons/windows.png'; + else if (asset.name.includes('exe')) env_icon = '/images/icons/windows.png'; + else if (asset.name.includes('osx')) env_icon = '/images/icons/apple.png'; + else if (asset.name.includes('linux')) env_icon = '/images/icons/linux.png'; + + let download_url = 'https://github.com/citra-emu/citra-' + v + '/releases/download/' + release.tag_name + '/' + asset.name; + download_span += ''; + }); + + // Generate the link to the Github release. + download_span += ''; + + if (release_commit_url != null) { + $('#downloads-' + v).append('' + release_date + '' + + '' + release_title + '' + download_span + ''); + } else { + $('#downloads-' + v).append('' + release_date + '' + + '' + release_title + '' + download_span + ''); + } + if (i + 1 >= count) { break; } + }; + }); + } +}); diff --git a/site/themes/citra-bs-theme/static/js/renderNetplay.js b/site/themes/citra-bs-theme/static/js/renderNetplay.js new file mode 100644 index 0000000..89af55b --- /dev/null +++ b/site/themes/citra-bs-theme/static/js/renderNetplay.js @@ -0,0 +1,3 @@ +$(document).ready(function() { + // Netplay goes here. +});