bug fixes
This commit is contained in:
parent
1a2af482aa
commit
beb002feb9
5 changed files with 51 additions and 43 deletions
|
|
@ -293,11 +293,14 @@ async function FormatAvatar() {
|
|||
FormattedAvatar.tool = await FetchMesh(FormattedAvatar.tool);
|
||||
}
|
||||
|
||||
if (FormattedAvatar.face === undefined) { FormattedAvatar.face = 'https://c0.ptacdn.com/static/3dview/DefaultFace.png'; }
|
||||
if (!FormattedAvatar.face.startsWith('data:') && !FormattedAvatar.face.startsWith('http')) {
|
||||
if (FormattedAvatar.face && typeof FormattedAvatar.face === 'number') {
|
||||
FormattedAvatar.face = await FetchAsset(FormattedAvatar.face);
|
||||
} else {
|
||||
FormattedAvatar.face = 'https://c0.ptacdn.com/static/3dview/DefaultFace.png';
|
||||
}
|
||||
}
|
||||
|
||||
if (typeof FormattedAvatar.shirt === 'number') {
|
||||
FormattedAvatar.shirt = await FetchAsset(FormattedAvatar.shirt);
|
||||
|
|
|
|||
|
|
@ -8,8 +8,12 @@ var BestFriendsData;
|
|||
|
||||
let Utilities;
|
||||
|
||||
(async () => {
|
||||
Utilities = await import(chrome.runtime.getURL('resources/utils.js'));
|
||||
Utilities = Utilities.default;
|
||||
|
||||
chrome.storage.sync.get(['PolyPlus_Settings'], async function (result) {
|
||||
Settings = result.PolyPlus_Settings || Utilities.DefaultSettings;
|
||||
Settings = Utilities.MergeObjects(result.PolyPlus_Settings || Utilities.DefaultSettings);
|
||||
|
||||
if (Settings.IRLPriceWithCurrency && Settings.IRLPriceWithCurrency.Enabled === true) {
|
||||
IRLPrice();
|
||||
|
|
@ -23,6 +27,7 @@ chrome.storage.sync.get(['PolyPlus_Settings'], async function (result) {
|
|||
Update();
|
||||
}
|
||||
});
|
||||
})();
|
||||
|
||||
let ContainerElement = `
|
||||
<div class="card-body p-0 m-1 scrollFadeContainer d-flex"></div>`;
|
||||
|
|
|
|||
|
|
@ -374,8 +374,8 @@ async function HoardersList(min, avatars) {
|
|||
Owners.push(...InitialOwners.inventories);
|
||||
|
||||
// Get owners (up to 300, if needed)
|
||||
if (InitialOwners.pages > 3) {
|
||||
InitialOwners.pages = 3;
|
||||
if (InitialOwners.pages > Utilities.Limits.HoardersListPages) {
|
||||
InitialOwners.pages = Utilities.Limits.HoardersListPages;
|
||||
}
|
||||
if (InitialOwners.pages > 1 && OwnerPagesFetched < InitialOwners.pages) {
|
||||
for (let i = 1; i < InitialOwners.pages; i++) {
|
||||
|
|
|
|||
|
|
@ -103,7 +103,8 @@ export default {
|
|||
PinnedGames: 10,
|
||||
BestFriends: 15,
|
||||
ImprovedFrLists: 20,
|
||||
ItemWishlist: 20
|
||||
ItemWishlist: 20,
|
||||
HoardersListPages: 4
|
||||
},
|
||||
MeshTypes: ['hat', 'hair', 'head attachment', 'face accessory', 'neck accessory', 'head cover', 'back accessory', 'shoulder accessory', 'tool'],
|
||||
TextureTypes: ['shirt', 'pants', 'face'],
|
||||
|
|
@ -235,5 +236,23 @@ export default {
|
|||
Script.remove();
|
||||
});
|
||||
Node.appendChild(Script);
|
||||
},
|
||||
// MergeObjects function was written by ChatGPT cause I was lazy and it was awhile ago
|
||||
MergeObjects: function(obj1, obj2) {
|
||||
var mergedObj = {};
|
||||
|
||||
// Copy the values from obj1 to the mergedObj
|
||||
for (var key in obj1) {
|
||||
mergedObj[key] = obj1[key];
|
||||
}
|
||||
|
||||
// Merge the values from obj2 into the mergedObj, favoring obj2 for non-existing keys in obj1
|
||||
for (var key in obj2) {
|
||||
if (!obj1.hasOwnProperty(key)) {
|
||||
mergedObj[key] = obj2[key];
|
||||
}
|
||||
}
|
||||
|
||||
return mergedObj;
|
||||
}
|
||||
};
|
||||
|
|
|
|||
25
settings.js
25
settings.js
|
|
@ -50,7 +50,7 @@ Elements.forEach((element) => {
|
|||
|
||||
if (Select) {
|
||||
Select.addEventListener('change', function () {
|
||||
if (Select.getAttribute('data-useValue') !== undefined) {
|
||||
if (Select.getAttribute('data-useValue') !== null) {
|
||||
let Value = Select.options[Select.selectedIndex].value;
|
||||
if (!isNaN(Value)) {
|
||||
Value = parseInt(Value);
|
||||
|
|
@ -150,7 +150,7 @@ Elements.forEach((element) => {
|
|||
|
||||
function LoadCurrent() {
|
||||
chrome.storage.sync.get(['PolyPlus_Settings'], function (result) {
|
||||
Settings = MergeObjects(result.PolyPlus_Settings || Utilities.DefaultSettings, Utilities.DefaultSettings);
|
||||
Settings = Utilities.MergeObjects(result.PolyPlus_Settings || Utilities.DefaultSettings, Utilities.DefaultSettings);
|
||||
RecentSave = structuredClone(Settings)
|
||||
|
||||
console.log('Current Settings: ', Settings);
|
||||
|
|
@ -313,7 +313,7 @@ function LoadThemeJSON(string) {
|
|||
JSONTable[i] = '';
|
||||
}
|
||||
}
|
||||
Settings.ThemeCreator = MergeObjects(JSONTable, Utilities.DefaultSettings.ThemeCreator);
|
||||
Settings.ThemeCreator = Utilities.MergeObjects(JSONTable, Utilities.DefaultSettings.ThemeCreator);
|
||||
Save();
|
||||
console.log(JSONTable.length, JSONTable, 'applied');
|
||||
document.getElementById('ThemeCreator').getElementsByTagName('button')[1].click();
|
||||
|
|
@ -326,25 +326,6 @@ function LoadThemeJSON(string) {
|
|||
}
|
||||
}
|
||||
|
||||
// MergeObjects function was written by ChatGPT cause I was lazy and it was awhile ago
|
||||
function MergeObjects(obj1, obj2) {
|
||||
var mergedObj = {};
|
||||
|
||||
// Copy the values from obj1 to the mergedObj
|
||||
for (var key in obj1) {
|
||||
mergedObj[key] = obj1[key];
|
||||
}
|
||||
|
||||
// Merge the values from obj2 into the mergedObj, favoring obj2 for non-existing keys in obj1
|
||||
for (var key in obj2) {
|
||||
if (!obj1.hasOwnProperty(key)) {
|
||||
mergedObj[key] = obj2[key];
|
||||
}
|
||||
}
|
||||
|
||||
return mergedObj;
|
||||
}
|
||||
|
||||
function AreIdentical(obj1, obj2) {
|
||||
if (obj1.length !== obj2.length) { return false }
|
||||
return JSON.stringify(obj1) === JSON.stringify(obj2)
|
||||
|
|
|
|||
Reference in a new issue