Fixed ratings loading in the preferences

This commit is contained in:
Michael Green
2024-10-20 02:10:59 +11:00
parent 478044a5a1
commit 48e4f17090
2 changed files with 34 additions and 10 deletions

View File

@@ -410,7 +410,7 @@ function LoadGamePlatforms() {
let platformContainer = document.getElementById('gamesummaryplatformscontent');
platformContainer.innerHTML = '';
for (let i = 0; i < result.length; i++) {
let logoUrl = '/api/v1/Platforms/' + result[i].id + '/platformlogo/original/logo.png';
let logoUrl = '/api/v1.1/Platforms/' + result[i].id + '/platformlogo/original/logo.png';
// create platform container
let platformItem = document.createElement('div');

View File

@@ -181,18 +181,42 @@ class PreferencesWindow {
"Adult"
];
for (let j = 0; j < ratingGroupsOrder.length; j++) {
let ageGroupValue = AgeRatingGroups[ratingGroupsOrder[j]];
let iconIdList = ageGroupValue[key.toLowerCase()];
let ratingGroup = ratingGroupsOrder[j];
let ageGroupValue = AgeRatingGroups[ratingGroup];
let ageGroupValueLower = {};
for (const [key, value] of Object.entries(ageGroupValue)) {
ageGroupValueLower[key.toLowerCase()] = value;
}
let iconIdList = ageGroupValueLower[key.toLowerCase()];
console.log(key.toLowerCase());
if (key == 'clasS_IND' || key == 'CLASS_IND') {
console.log("here");
}
// loop the age rating icons
for (let i = 0; i < iconIdList.length; i++) {
if (iconIdList) {
for (const [i, value] of Object.entries(iconIdList)) {
console.log(" " + iconIdList[i]);
let icon = document.createElement('img');
// icon.src = "/images/Ratings/" + key + "/" + AgeRatingStrings[iconIdList[i]] + ".svg";
icon.src = "/images/Ratings/" + key + "/" + iconIdList[i] + ".svg";
icon.title = AgeRatingStrings[iconIdList[i]];
// get age rating strings
let iconId = iconIdList[i];
let ageRatingString;
for (const [x, y] of Object.entries(AgeRatingStrings)) {
if (AgeRatingStrings[x] == iconId) {
ageRatingString = AgeRatingStrings[x];
break;
}
}
icon.src = "/images/Ratings/" + key + "/" + ageRatingString + ".svg";
icon.title = ageRatingString;
icon.alt = ageRatingString;
icon.classList.add("rating_image_mini");
classificationIcons.appendChild(icon);
}
}
}
classificationItemBox.appendChild(classificationIcons);
this.classificationSelector.appendChild(classificationItemBox);