Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Make sure the same box art isn't used 2 times in a row

  • Loading branch information...
commit 1af758be08eaa20f6afbb6cc75771aeda6e543d6 1 parent 54eeb01
@Randgalt Randgalt authored
Showing with 11 additions and 5 deletions.
  1. +11 −5 js/nf.js
View
16 js/nf.js
@@ -151,9 +151,11 @@ function parseISO8601(value) {
function buildRepoContent()
{
- var imageUrl, imageFileName, boxArtOverride, i;
+ var imageUrl, boxArtOverride, i;
+ var imageFileName = "";
var repoContent = "";
var boxArtIndex = 0;
+ var previousImageFileName = "";
for (i = 0; i < reposTab.length; ++i )
{
var thisRepo = reposTab[i].repo;
@@ -161,13 +163,17 @@ function buildRepoContent()
if (boxArtOverride) {
imageFileName = boxArtOverride;
} else {
- imageFileName = 'box-art-' + boxArtIndex + '.jpg'
- boxArtIndex++;
- if (boxArtIndex > 8) {
- boxArtIndex = 0;
+ while ( imageFileName === previousImageFileName )
+ {
+ imageFileName = 'box-art-' + boxArtIndex + '.jpg'
+ boxArtIndex++;
+ if (boxArtIndex > 8) {
+ boxArtIndex = 0;
+ }
}
}
imageUrl = 'assets/' + imageFileName;
+ previousImageFileName = imageFileName;
repoContent += '<a class="standard-anchor" href="' + thisRepo.html_url + '">';
repoContent += '<div class="repo-item-container">';
Please sign in to comment.
Something went wrong with that request. Please try again.