diff --git a/js/account/avatar-sandbox-rewrite.js b/js/account/avatar-sandbox-rewrite.js
index 5501abb..9a500f1 100644
--- a/js/account/avatar-sandbox-rewrite.js
+++ b/js/account/avatar-sandbox-rewrite.js
@@ -222,7 +222,6 @@ async function UpdateAvatar() {
if (ItemCache[x] === undefined) {
const ItemDetails = (await (await fetch('https://api.polytoria.com/v1/store/' + x)).json())
ItemCache[x] = {
- /*
type: ItemDetails.type,
name: ItemDetails.name,
price: ItemDetails.price,
@@ -231,7 +230,6 @@ async function UpdateAvatar() {
id: ItemDetails.creator.id
},
thumbnail: ItemDetails.thumbnail,
- */
asset: undefined
}
diff --git a/js/account/inventory.js b/js/account/inventory.js
index 4330b7c..4ec6d90 100755
--- a/js/account/inventory.js
+++ b/js/account/inventory.js
@@ -1,3 +1,7 @@
+/*
+ Proper pagination will be added in v1.2.3
+*/
+
Username = window.location.pathname.split('/')[2];
let UserID;
let ItemGrid;
@@ -7,19 +11,19 @@ if (window.location.pathname.split('/')[3] === 'inventory') {
UserID = (await (await fetch('https://api.polytoria.com/v1/users/find?username=' + Username )).json()).id;
ItemGrid = document.getElementsByClassName('itemgrid')[0];
- chrome.storage.sync.get(['PolyPlus_Settings', 'PolyPlus_ItemWishlist'], function(result){
+ /*
+ Rewritten item wishlist function will take in the data with a parameter instead
+ */
+ chrome.storage.sync.get(['PolyPlus_Settings'], function(result){
Settings = result.PolyPlus_Settings
const Nav = document.getElementsByClassName('nav-pills')[0];
- if (Settings.ItemWishlistOn
- && Username === JSON.parse(window.localStorage.getItem('p+account_info')).Username
- && window.location.pathname.split('/')[4] === 'wishlist'
- ) {
+ if (Settings.ItemWishlistOn && Username === JSON.parse(window.localStorage.getItem('p+account_info')).Username) {
let WishlistNav = document.createElement('li');
WishlistNav.classList.add('nav-item');
WishlistNav.innerHTML = `
-
+
Item Wishlist
@@ -45,7 +49,7 @@ if (window.location.pathname.split('/')[3] === 'inventory') {
let CollectibleNav = document.createElement('li');
CollectibleNav.classList.add('nav-item');
CollectibleNav.innerHTML = `
-
+
Collectibles
@@ -70,6 +74,9 @@ if (window.location.pathname.split('/')[3] === 'inventory') {
})();
}
+/*
+ Item Wishlist will be rewritten in v1.2.3
+*/
function ItemWishlist() {
const ItemGrid = document.getElementsByClassName('itemgrid')[0];
const ItemCardContents = `
@@ -91,6 +98,7 @@ function ItemWishlist() {
`;
ItemGrid.innerHTML = ''
+ document.getElementsByClassName('pagination')[0].remove()
const Search = document.createElement('div');
Search.classList = 'row';
Search.innerHTML = `
@@ -111,8 +119,8 @@ function ItemWishlist() {
@@ -156,7 +164,7 @@ function ItemWishlist() {
Wishlist.forEach((element) => {
let NewItemCard = document.createElement('div');
NewItemCard.classList = 'px-0';
- fetch('https://api.polytoria.com/v1/store/:id'.replace(':id', element))
+ fetch('https://api.polytoria.com/v1/store/' + element)
.then((response) => response.json())
.then((data) => {
NewItemCard.innerHTML = ItemCardContents.replace(':ItemID', data.id)
@@ -200,50 +208,51 @@ function ItemWishlist() {
});
});
});
-}
-const Update = function(type, query, isLimited, isAvailable) {
- let ItemGrid = document.getElementsByClassName('itemgrid')[0];
- let BrickBalance = parseInt(JSON.parse(window.localStorage.getItem('p+account_info')).Bricks);
- query = query.toLowerCase();
- let Results = Array.from(ItemGrid.children);
- for (let i = 0; i < Results.length; i++) {
- let Show = true;
-
- console.log('type: ', type);
- if (!(type === 'any')) {
- console.log("isn't any");
- if (!(Results[i].getAttribute('data-type') === type)) {
+ const Update = function(type, query, isLimited, isAvailable) {
+ let ItemGrid = document.getElementsByClassName('itemgrid')[0];
+ let BrickBalance = parseInt(JSON.parse(window.localStorage.getItem('p+account_info')).Bricks);
+ query = query.toLowerCase();
+ let Results = Array.from(ItemGrid.children);
+ for (let i = 0; i < Results.length; i++) {
+ let Show = true;
+
+ console.log('type: ', type);
+ if (!(type === 'any')) {
+ console.log("isn't any");
+ if (!(Results[i].getAttribute('data-type') === type)) {
+ Show = false;
+ }
+ }
+
+ if (!Results[i].getAttribute('data-name').toLowerCase().startsWith(query)) {
Show = false;
}
- }
-
- if (!Results[i].getAttribute('data-name').toLowerCase().startsWith(query)) {
- Show = false;
- }
-
- if (isLimited === true) {
- if (!(Results[i].getAttribute('data-limited') === 'true')) {
- Show = false;
+
+ if (isLimited === true) {
+ if (!(Results[i].getAttribute('data-limited') === 'true')) {
+ Show = false;
+ }
}
- }
-
- if (isAvailable === true) {
- if (!(parseInt(Results[i].getAttribute('data-price')) <= BrickBalance)) {
- Show = false;
+
+ if (isAvailable === true) {
+ if (!(parseInt(Results[i].getAttribute('data-price')) <= BrickBalance)) {
+ Show = false;
+ }
+ }
+
+ if (Show === true) {
+ Results[i].style.display = 'block';
+ } else {
+ Results[i].style.display = 'none';
}
- }
-
- if (Show === true) {
- Results[i].style.display = 'block';
- } else {
- Results[i].style.display = 'none';
}
}
}
async function CollectibleCategory() {
ItemGrid.innerHTML = ''
+ document.getElementsByClassName('pagination')[0].remove()
const CollectibleItemTypes = [
"hat",
"face",
diff --git a/js/account/profile.js b/js/account/profile.js
index 6b42f77..f59925e 100755
--- a/js/account/profile.js
+++ b/js/account/profile.js
@@ -12,7 +12,7 @@ let Utilities;
if (Username) {
(async () => {
- UserID = (await (await fetch('https://api.polytoria.com/v1/users/find?username=' + Username )).json());
+ UserID = (await (await fetch('https://api.'+window.location.hostname+'/v1/users/find?username=' + Username )).json());
Utilities = await import(chrome.runtime.getURL('resources/utils.js'));
Utilities = Utilities.default;
diff --git a/js/store/item-view.js b/js/store/item-view.js
index c9d3ab7..091895a 100755
--- a/js/store/item-view.js
+++ b/js/store/item-view.js
@@ -31,7 +31,7 @@ var Utilities;
Utilities.InjectResource('registerTooltips');
}
- if (Settings.IRLPriceWithCurrency && Settings.IRLPriceWithCurrency.Enabled === true && ItemOwned === false) {
+ if (Settings.IRLPriceWithCurrency && Settings.IRLPriceWithCurrency.Enabled === true) {
IRLPrice();
}
@@ -96,16 +96,37 @@ chrome.storage.onChanged.addListener(function (changes, namespace) {
async function IRLPrice() {
const Price = PurchaseBtn.getAttribute('data-price');
- if (Price === null || Price === '0') {
- return;
+ if (Price !== null && Price !== '0') {
+ const Span = document.createElement('span');
+ Span.classList = 'text-muted polyplus-own-tag';
+ Span.style.fontSize = '0.7rem';
+ Span.style.fontWeight = 'normal';
+ const IRLResult = await Utilities.CalculateIRL(Price, Settings.IRLPriceWithCurrency.Currency);
+ Span.innerText = '($' + IRLResult.result + ' ' + IRLResult.display + ')';
+ PurchaseBtn.appendChild(Span);
+ }
+
+ const Resellers = document.getElementById('resellers-container')
+ if (Resellers !== null) {
+ const observer = new MutationObserver(async function (list) {
+ for (const record of list) {
+ for (const element of record.addedNodes) {
+ if (element.tagName === 'DIV') {
+ const ResellerSpan = document.createElement('span');
+ ResellerSpan.classList = 'text-muted polyplus-own-tag';
+ ResellerSpan.style.fontSize = '0.7rem';
+ ResellerSpan.style.fontWeight = 'normal';
+ const ResellerIRLResult = await Utilities.CalculateIRL(element.getElementsByClassName('text-success')[0].innerText, Settings.IRLPriceWithCurrency.Currency);
+ ResellerSpan.innerText = ' ($' + ResellerIRLResult.result + ' ' + ResellerIRLResult.display + ')';
+ element.getElementsByClassName('text-success')[0].appendChild(ResellerSpan);
+ }
+ }
+ observer.observe(Resellers, {attributes: false, childList: true, subtree: false});
+ }
+ });
+
+ observer.observe(Resellers, {attributes: false, childList: true, subtree: false});
}
- const Span = document.createElement('span');
- Span.classList = 'text-muted polyplus-own-tag';
- Span.style.fontSize = '0.7rem';
- Span.style.fontWeight = 'normal';
- const IRLResult = await Utilities.CalculateIRL(Price, Settings.IRLPriceWithCurrency.Currency);
- Span.innerText = '($' + IRLResult.result + ' ' + IRLResult.display + ')';
- PurchaseBtn.appendChild(Span);
}
function HandleItemWishlist() {
diff --git a/manifest-old.json b/manifest-old.json
new file mode 100644
index 0000000..ad81aed
--- /dev/null
+++ b/manifest-old.json
@@ -0,0 +1,158 @@
+{
+ "manifest_version": 3,
+ "author": "Index",
+ "name": "Poly+",
+ "version": "1.21",
+ "version_name": "Pre-Release Build (v1.2.1)",
+ "description": "Power-up your Polytoria experience with Poly+! Created by Index.",
+ "homepage_url": "https://polyplus.vercel.app/",
+ "permissions": ["storage", "contextMenus", "scripting", "alarms", "notifications"],
+ "content_scripts": [
+ {
+ "matches": ["https://polytoria.com/*"],
+ "js": ["/js/sitewide.js", "/js/membership-themes.js"],
+ "css": ["/css/specific.css"],
+ "run_at": "document_start"
+ },
+
+ {
+ "matches": ["https://polytoria.com/my/settings/*"],
+ "js": ["/js/settings.js", "/js/extra-pages.js"],
+ "run_at": "document_start"
+ },
+
+ {
+ "matches": ["https://polytoria.com/", "https://polytoria.com/home"],
+ "js": ["/js/account/home.js"],
+ "run_at": "document_idle"
+ },
+
+ {
+ "matches": ["https://polytoria.com/places/**"],
+ "js": ["/js/places/place-view.js"]
+ },
+
+ {
+ "matches": ["https://polytoria.com/create/place/**"],
+ "js": ["/js/places/place-edit.js"]
+ },
+
+ {
+ "matches": ["https://polytoria.com/create/image", "https://polytoria.com/create/image/"],
+ "js": ["/js/create/image.js"]
+ },
+
+ {
+ "matches": ["https://polytoria.com/forum/post/**"],
+ "js": ["/js/forum/forum-view.js"]
+ },
+
+ {
+ "matches": ["https://polytoria.com/u/**", "https://polytoria.com/users/**"],
+ "js": ["/js/account/profile.js", "/js/account/inventory.js"]
+ },
+
+ {
+ "matches": ["https://polytoria.com/my/friends", "https://polytoria.com/my/friends/"],
+ "js": ["/js/account/friends.js"]
+ },
+
+ {
+ "matches": ["https://polytoria.com/store", "https://polytoria.com/store/"],
+ "js": ["/js/store/store.js"]
+ },
+
+ {
+ "matches": ["https://polytoria.com/store/**"],
+ "js": ["/js/store/item-view.js"]
+ },
+
+ {
+ "matches": ["https://polytoria.com/forum/search", "https://polytoria.com/forum/search?*"],
+ "js": ["/js/forum/forum-search.js"]
+ },
+
+ {
+ "matches": ["https://polytoria.com/trade/sent/*"],
+ "js": ["/js/account/trades-outbound.js"]
+ },
+
+ {
+ "matches": ["https://polytoria.com/u/*/inventory/"],
+ "js": ["/js/account/inventory.js"],
+ "run_at": "document_idle"
+ },
+
+ {
+ "matches": ["https://polytoria.com/my/settings/privacy"],
+ "js": ["/js/account/settings-privacy.js"]
+ },
+
+ {
+ "matches": ["https://polytoria.com/my/settings/transactions*"],
+ "js": ["/js/account/transactions.js"]
+ },
+
+ {
+ "matches": ["https://polytoria.com/store/**", "https://polytoria.com/places/**", "https://polytoria.com/guilds/**", "https://polytoria.com/feed/**"],
+ "js": ["/js/op-comments.js"]
+ },
+
+ {
+ "matches": ["https://polytoria.com/my/avatar*"],
+ "js": ["/js/account/avatar-sandbox2.js"]
+ },
+
+ {
+ "matches": ["https://polytoria.com/inbox*"],
+ "js": ["/js/account/inbox.js"]
+ },
+
+ {
+ "matches": ["https://polytoria.com/guilds/**"],
+ "js": ["/js/guilds.js"]
+ },
+
+ {
+ "matches": ["https://polytoria.com/store/**", "https://polytoria.com/models/**"],
+ "js": ["/js/library-download.js"]
+ },
+
+ {
+ "matches": ["https://polytoria.com/places/**", "https://polytoria.com/u/**"],
+ "js": ["the-great-divide.js"]
+ }
+ ],
+ "background": {
+ "service_worker": "/js/background.js",
+ "type": "module"
+ },
+ "host_permissions": ["https://*.polytoria.com/*"],
+ "web_accessible_resources": [
+ {
+ "resources": ["resources/*"],
+ "matches": ["https://polytoria.com/*"]
+ },
+
+ {
+ "resources": ["settings.html", "settings.js"],
+ "matches": ["https://polytoria.com/*"]
+ }
+ ],
+ "short_name": "Poly+",
+ "action": {
+ "default_title": "Poly+",
+ "default_icon": {
+ "16": "/images/icon.png",
+ "32": "/images/icon.png",
+ "48": "/images/icon.png",
+ "128": "/images/icon.png"
+ }
+ },
+ "icons": {
+ "16": "/images/icon.png",
+ "32": "/images/icon.png",
+ "48": "/images/icon.png",
+ "128": "/images/icon.png"
+ }
+}
diff --git a/manifest.json b/manifest.json
index ad81aed..9e4f94b 100755
--- a/manifest.json
+++ b/manifest.json
@@ -9,117 +9,117 @@
"permissions": ["storage", "contextMenus", "scripting", "alarms", "notifications"],
"content_scripts": [
{
- "matches": ["https://polytoria.com/*"],
+ "matches": ["https://polytoria.com/*", "https://polytoria.co/*"],
"js": ["/js/sitewide.js", "/js/membership-themes.js"],
"css": ["/css/specific.css"],
"run_at": "document_start"
},
{
- "matches": ["https://polytoria.com/my/settings/*"],
+ "matches": ["https://polytoria.com/my/settings/*", "https://polytoria.co/my/settings/*"],
"js": ["/js/settings.js", "/js/extra-pages.js"],
"run_at": "document_start"
},
{
- "matches": ["https://polytoria.com/", "https://polytoria.com/home"],
+ "matches": ["https://polytoria.com/", "https://polytoria.com/home", "https://polytoria.co/", "https://polytoria.co/home"],
"js": ["/js/account/home.js"],
"run_at": "document_idle"
},
{
- "matches": ["https://polytoria.com/places/**"],
+ "matches": ["https://polytoria.com/places/**", "https://polytoria.co/places/**"],
"js": ["/js/places/place-view.js"]
},
{
- "matches": ["https://polytoria.com/create/place/**"],
+ "matches": ["https://polytoria.com/create/place/**", "https://polytoria.co/create/place/**"],
"js": ["/js/places/place-edit.js"]
},
{
- "matches": ["https://polytoria.com/create/image", "https://polytoria.com/create/image/"],
+ "matches": ["https://polytoria.com/create/image", "https://polytoria.com/create/image/", "https://polytoria.co/create/image", "https://polytoria.co/create/image/"],
"js": ["/js/create/image.js"]
},
{
- "matches": ["https://polytoria.com/forum/post/**"],
+ "matches": ["https://polytoria.com/forum/post/**", "https://polytoria.co/forum/post/**"],
"js": ["/js/forum/forum-view.js"]
},
{
- "matches": ["https://polytoria.com/u/**", "https://polytoria.com/users/**"],
+ "matches": ["https://polytoria.com/u/**", "https://polytoria.com/users/**", "https://polytoria.co/u/**", "https://polytoria.co/users/**"],
"js": ["/js/account/profile.js", "/js/account/inventory.js"]
},
{
- "matches": ["https://polytoria.com/my/friends", "https://polytoria.com/my/friends/"],
+ "matches": ["https://polytoria.com/my/friends", "https://polytoria.com/my/friends/", "https://polytoria.co/my/friends", "https://polytoria.co/my/friends/"],
"js": ["/js/account/friends.js"]
},
{
- "matches": ["https://polytoria.com/store", "https://polytoria.com/store/"],
+ "matches": ["https://polytoria.com/store", "https://polytoria.com/store/", "https://polytoria.co/store", "https://polytoria.co/store/"],
"js": ["/js/store/store.js"]
},
{
- "matches": ["https://polytoria.com/store/**"],
+ "matches": ["https://polytoria.com/store/**", "https://polytoria.co/store/**"],
"js": ["/js/store/item-view.js"]
},
{
- "matches": ["https://polytoria.com/forum/search", "https://polytoria.com/forum/search?*"],
+ "matches": ["https://polytoria.com/forum/search", "https://polytoria.com/forum/search?*", "https://polytoria.co/forum/search", "https://polytoria.co/forum/search?*"],
"js": ["/js/forum/forum-search.js"]
},
{
- "matches": ["https://polytoria.com/trade/sent/*"],
+ "matches": ["https://polytoria.com/trade/sent/*", "https://polytoria.co/trade/sent/*"],
"js": ["/js/account/trades-outbound.js"]
},
{
- "matches": ["https://polytoria.com/u/*/inventory/"],
+ "matches": ["https://polytoria.com/u/*/inventory/", "https://polytoria.co/u/*/inventory/"],
"js": ["/js/account/inventory.js"],
"run_at": "document_idle"
},
{
- "matches": ["https://polytoria.com/my/settings/privacy"],
+ "matches": ["https://polytoria.com/my/settings/privacy", "https://polytoria.co/my/settings/privacy"],
"js": ["/js/account/settings-privacy.js"]
},
{
- "matches": ["https://polytoria.com/my/settings/transactions*"],
+ "matches": ["https://polytoria.com/my/settings/transactions*", "https://polytoria.co/my/settings/transactions*"],
"js": ["/js/account/transactions.js"]
},
{
- "matches": ["https://polytoria.com/store/**", "https://polytoria.com/places/**", "https://polytoria.com/guilds/**", "https://polytoria.com/feed/**"],
+ "matches": ["https://polytoria.com/store/**", "https://polytoria.com/places/**", "https://polytoria.com/guilds/**", "https://polytoria.com/feed/**", "https://polytoria.co/store/**", "https://polytoria.co/places/**", "https://polytoria.co/guilds/**", "https://polytoria.co/feed/**"],
"js": ["/js/op-comments.js"]
},
{
- "matches": ["https://polytoria.com/my/avatar*"],
- "js": ["/js/account/avatar-sandbox2.js"]
+ "matches": ["https://polytoria.com/my/avatar*", "https://polytoria.co/my/avatar*"],
+ "js": ["/js/account/avatar-sandbox-rewrite.js"]
},
{
- "matches": ["https://polytoria.com/inbox*"],
+ "matches": ["https://polytoria.com/inbox*", "https://polytoria.co/inbox*"],
"js": ["/js/account/inbox.js"]
},
{
- "matches": ["https://polytoria.com/guilds/**"],
+ "matches": ["https://polytoria.com/guilds/**", "https://polytoria.co/guilds/**"],
"js": ["/js/guilds.js"]
},
{
- "matches": ["https://polytoria.com/store/**", "https://polytoria.com/models/**"],
+ "matches": ["https://polytoria.com/store/**", "https://polytoria.com/models/**", "https://polytoria.co/store/**", "https://polytoria.co/models/**"],
"js": ["/js/library-download.js"]
},
{
- "matches": ["https://polytoria.com/places/**", "https://polytoria.com/u/**"],
+ "matches": ["https://polytoria.com/places/**", "https://polytoria.com/u/**", "https://polytoria.co/places/**", "https://polytoria.co/u/**"],
"js": ["the-great-divide.js"]
}
],
@@ -127,16 +127,16 @@
"service_worker": "/js/background.js",
"type": "module"
},
- "host_permissions": ["https://*.polytoria.com/*"],
+ "host_permissions": ["https://*.polytoria.com/*", "https://*.polytoria.co/*"],
"web_accessible_resources": [
{
"resources": ["resources/*"],
- "matches": ["https://polytoria.com/*"]
+ "matches": ["https://polytoria.com/*", "https://polytoria.co/*"]
},
{
"resources": ["settings.html", "settings.js"],
- "matches": ["https://polytoria.com/*"]
+ "matches": ["https://polytoria.com/*", "https://polytoria.co/*"]
}
],
"short_name": "Poly+",