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