citra-emu
/
citra-web
Archived
1
0
Fork 0

Added js folder for long scripts.

This commit is contained in:
chris062689 2017-06-24 10:08:37 -04:00
parent c7423cc391
commit aa9ca7da82
5 changed files with 77 additions and 68 deletions

View File

@ -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));

View File

@ -47,69 +47,4 @@ The Bleeding Edge build of Citra is the same as our nightly builds, with additio
</style>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.17.1/moment.min.js"></script>
<script type="text/javascript">
$(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 += '<a class="dl-icon" href="' + download_url + '"><img src="' + env_icon + '"></i></a>';
});
// Generate the link to the Github release.
download_span += '<a class="dl-icon" href="' + release.html_url + '"><img src="/images/icons/github.png"></i></a>';
if (release_commit_url != null) {
$('#downloads-' + v).append('<tr class="' + table_style + '"><td>' + release_date + '</td>' +
'<td><a href="' + release_commit_url + '/">' + release_title + '</a></td><td>' + download_span + '</td></tr>');
} else {
$('#downloads-' + v).append('<tr class="' + table_style + '"><td>' + release_date + '</td>' +
'<td>' + release_title + '</td><td>' + download_span + '</td></tr>');
}
if (i + 1 >= count) { break; }
};
});
}
});
</script>
<script src="/js/renderDownloads.js"></script>

View File

@ -120,6 +120,7 @@
</div>
{{ block "scripts" . }}{{ end }}
<script src="/js/renderNetplay.js"></script>
</body>
</html>

View File

@ -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 += '<a class="dl-icon" href="' + download_url + '"><img src="' + env_icon + '"></i></a>';
});
// Generate the link to the Github release.
download_span += '<a class="dl-icon" href="' + release.html_url + '"><img src="/images/icons/github.png"></i></a>';
if (release_commit_url != null) {
$('#downloads-' + v).append('<tr class="' + table_style + '"><td>' + release_date + '</td>' +
'<td><a href="' + release_commit_url + '/">' + release_title + '</a></td><td>' + download_span + '</td></tr>');
} else {
$('#downloads-' + v).append('<tr class="' + table_style + '"><td>' + release_date + '</td>' +
'<td>' + release_title + '</td><td>' + download_span + '</td></tr>');
}
if (i + 1 >= count) { break; }
};
});
}
});

View File

@ -0,0 +1,3 @@
$(document).ready(function() {
// Netplay goes here.
});