fix: removed duplicate companies

This commit is contained in:
Michael Green
2023-06-30 23:17:03 +10:00
parent 0cc8e76f77
commit 0e3a3b3ecd
2 changed files with 22 additions and 12 deletions

View File

@@ -128,24 +128,34 @@
var gamePublisherLoaded = false; var gamePublisherLoaded = false;
if (result.involvedCompanies) { if (result.involvedCompanies) {
ajaxCall('/api/v1/games/' + gameId + '/companies', 'GET', function (result) { ajaxCall('/api/v1/games/' + gameId + '/companies', 'GET', function (result) {
var lstDevelopers = [];
var lstPublishers = [];
for (var i = 0; i < result.length; i++) { for (var i = 0; i < result.length; i++) {
var companyLabel = document.createElement('span'); var companyLabel = document.createElement('span');
companyLabel.className = 'gamegenrelabel'; companyLabel.className = 'gamegenrelabel';
companyLabel.innerHTML = result[i].company.name; companyLabel.innerHTML = result[i].company.name;
if (result[i].involvement.developer == true) { if (result[i].involvement.developer == true) {
if (gameHeaderDeveloperLabel.innerHTML.length > 0) { if (!lstDevelopers.includes(result[i].company.name)) {
gameHeaderDeveloperLabel += ", "; if (gameHeaderDeveloperLabel.innerHTML.length > 0) {
gameHeaderDeveloperLabel += ", ";
}
gameHeaderDeveloperLabel.innerHTML += result[i].company.name;
gameDeveloperLabel.appendChild(companyLabel);
lstDevelopers.push(result[i].company.name);
gameDeveloperLoaded = true;
} }
gameHeaderDeveloperLabel.innerHTML += result[i].company.name;
gameDeveloperLabel.appendChild(companyLabel);
gameDeveloperLoaded = true;
} else { } else {
if (result[i].involvement.publisher == true) { if (result[i].involvement.publisher == true) {
gamePublisherLabel.appendChild(companyLabel); if (!lstPublishers.includes(result[i].company.name)) {
gamePublisherLoaded = true; lstPublishers.push(result[i].company.name);
gamePublisherLabel.appendChild(companyLabel);
gamePublisherLoaded = true;
}
} }
} }
} }
@@ -346,7 +356,7 @@
for (var i = 0; i < gameScreenshots_Items.length; i++) { for (var i = 0; i < gameScreenshots_Items.length; i++) {
if (gameScreenshots_Items[i].id == gameScreenshots_Selected.id) { if (gameScreenshots_Items[i].id == gameScreenshots_Selected.id) {
gameScreenshots_Items[i].classList.add('gamescreenshosts_gallery_item_selected'); gameScreenshots_Items[i].classList.add('gamescreenshosts_gallery_item_selected');
gameScreenshots_Selected.scrollIntoView(); gameScreenshots_Selected.scrollIntoView({ behavior: "smooth", block: "end", inline: "nearest" });
} else { } else {
gameScreenshots_Items[i].classList.remove('gamescreenshosts_gallery_item_selected'); gameScreenshots_Items[i].classList.remove('gamescreenshosts_gallery_item_selected');
} }

View File

@@ -16,7 +16,7 @@
h3 { h3 {
border-bottom-style: solid; border-bottom-style: solid;
/*border-bottom-color: #916b01;*/ /*border-bottom-color: #916b01;*/
border-bottom-width: 3px; border-bottom-width: 1px;
/*border-image: linear-gradient(to right, blue 25%, yellow 25%, yellow 50%,red 50%, red 75%, teal 75%) 5;*/ /*border-image: linear-gradient(to right, blue 25%, yellow 25%, yellow 50%,red 50%, red 75%, teal 75%) 5;*/
border-image: linear-gradient(to right, rgba(255,0,0,1) 0%, rgba(251,255,0,1) 16%, rgba(0,255,250,1) 30%, rgba(0,16,255,1) 46%, rgba(250,0,255,1) 62%, rgba(255,0,0,1) 78%, rgba(255,237,0,1) 90%, rgba(20,255,0,1) 100%) 5; border-image: linear-gradient(to right, rgba(255,0,0,1) 0%, rgba(251,255,0,1) 16%, rgba(0,255,250,1) 30%, rgba(0,16,255,1) 46%, rgba(250,0,255,1) 62%, rgba(255,0,0,1) 78%, rgba(255,237,0,1) 90%, rgba(20,255,0,1) 100%) 5;
@@ -388,7 +388,7 @@ iframe {
} }
.gamescreenshosts_gallery_item:hover { .gamescreenshosts_gallery_item:hover {
border-color: lightblue; border-color: lightgray;
} }
.gamescreenshosts_gallery_item_selected { .gamescreenshosts_gallery_item_selected {