Permalink
Browse files

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

  • Loading branch information...
1 parent 54eeb01 commit 1af758be08eaa20f6afbb6cc75771aeda6e543d6 @Randgalt Randgalt committed Mar 16, 2013
Showing with 11 additions and 5 deletions.
  1. +11 −5 js/nf.js
View
16 js/nf.js
@@ -151,23 +151,29 @@ 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;
boxArtOverride = thisRepo.metadata.boxArt;
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">';

0 comments on commit 1af758b

Please sign in to comment.