diff --git a/js/account/inventory.js b/js/account/inventory.js
index 58bf9a8..80b6509 100755
--- a/js/account/inventory.js
+++ b/js/account/inventory.js
@@ -1,11 +1,15 @@
+console.log('path', window.location.pathname.split('/')[3])
+
if (window.location.pathname.split('/')[3] === "inventory") {
- const UserID = window.location.pathname.split('/')[2]
- if (UserID === JSON.parse(window.localStorage.getItem('p+account_info')).ID) {
+ const Username = window.location.pathname.split('/')[2]
+ console.log(JSON.parse(window.localStorage.getItem('p+account_info')).Username)
+ if (Username === JSON.parse(window.localStorage.getItem('p+account_info')).Username) {
+ console.log('is user')
let Nav = document.getElementsByClassName('nav-pills')[0]
let WishlistNav = document.createElement('li')
WishlistNav.classList.add('nav-item')
WishlistNav.innerHTML = `
-
+
Item Wishlist
@@ -13,6 +17,7 @@ if (window.location.pathname.split('/')[3] === "inventory") {
Nav.appendChild(WishlistNav)
if (window.location.pathname.split('/')[4] === "wishlist") {
+ console.log('aaa')
const ItemGrid = document.getElementsByClassName('itemgrid')[0]
const ItemCardContents = `
diff --git a/js/background.js b/js/background.js
index 2d079c7..f6b964b 100755
--- a/js/background.js
+++ b/js/background.js
@@ -69,10 +69,12 @@ function RunUpdateNotifier() {
}
})
})
+ /*
chrome.action.setBadgeBackgroundColor(
{color: 'red'},
- () => { /* ... */ },
+ () => { },
);
+ */
}
})
.catch(error => {console.log(error)})
@@ -86,7 +88,7 @@ chrome.contextMenus.removeAll(function() {
id: 'PolyPlus-RunUpdateNotifier',
contexts: ['all'],
documentUrlPatterns: [
- "https://polytoria.com/my/settings/polyplus-debug",
+ "https://polytoria.com/my/settings/polyplus#dev",
]
});
@@ -102,7 +104,9 @@ chrome.contextMenus.removeAll(function() {
targetUrlPatterns: [
"https://polytoria.com/places/**",
"https://polytoria.com/users/**",
- "https://polytoria.com/store/**"
+ "https://polytoria.com/u/**",
+ "https://polytoria.com/store/**",
+ "https://polytoria.com/guilds/**",
]
});
@@ -123,9 +127,14 @@ chrome.contextMenus.removeAll(function() {
})
// HANDLE CONTEXT MENU ITEMS
-chrome.contextMenus.onClicked.addListener(function (info, tab){
+chrome.contextMenus.onClicked.addListener(async function (info, tab){
if (info.menuItemId === 'PolyPlus-CopyID') {
- let ID = parseInt(info.linkUrl.split('/')[4])
+ console.log(info.linkUrl.split('/')[3])
+ let ID = info.linkUrl.split('/')[4]
+ if (info.linkUrl.split('/')[3] === "u") {
+ ID = (await (await fetch('https://api.polytoria.com/v1/users/find?username=' + info.linkUrl.split('/')[4])).json()).id
+ }
+ console.log(ID)
chrome.scripting
.executeScript({
target: {tabId: tab.id},
@@ -151,20 +160,6 @@ chrome.contextMenus.onClicked.addListener(function (info, tab){
}
});
-chrome.runtime.onMessage.addListener(function (message, sender) {
- console.log('hi')
- message = message.message || ''
- console.log(message)
- if (message === 'tooltip') {
- console.log('is about tooltip')
- chrome.scripting
- .executeScript({
- target: {tabId: sender.tab.id},
- func: UpdateTooltips
- })
- }
-});
-
/*
GREEN LOGO WHEN EXTENSION APPLIES TO CURRENT TAB PAGE, RED WHEN IT DOESN'T
COMING SOON
@@ -218,13 +213,4 @@ function CopyAvatarHash(hash) {
.catch(() => {
alert('Failure to copy avatar hash.')
});
-}
-
-function UpdateTooltips() {
- const Script = document.createElement('script')
- Script.innerHTML = `
- const tooltipTriggerList = document.querySelectorAll('[data-bs-toggle="tooltip"]')
- const tooltipList = [...tooltipTriggerList].map(tooltipTriggerEl => new bootstrap.Tooltip(tooltipTriggerEl))
- `
- document.body.appendChild(Script)
}
\ No newline at end of file
diff --git a/js/sitewide.js b/js/sitewide.js
index 111378c..263e7be 100755
--- a/js/sitewide.js
+++ b/js/sitewide.js
@@ -113,18 +113,18 @@ let Theme = ``;
}
});
- if (Settings.HideUserAdsOn === true) {
- if (Settings.HideUserAdsOn.Banners === true) {
+ if (Settings.HideUserAds.Enabled === true) {
+ if (Settings.HideUserAds.Banners === true) {
Theme += `
- div[style^="max-width: 728px;"]:has(.text-center a[href^="/ads/"]) {
+ div[style^="max-width: 728px;"]:has(a[href^="/ads"]) {
display: none;
}
`
}
- if (Settings.HideUserAdsOn.Rectangles === true) {
+ if (Settings.HideUserAds.Rectangles === true) {
Theme += `
- div[style^="max-width: 300px;"]:has(.text-center a[href^="/ads/"]) {
+ div[style^="max-width: 300px;"]:has(a[href^="/ads"]) {
display: none;
}
`
diff --git a/manifest.json b/manifest.json
index e91570d..b04beab 100755
--- a/manifest.json
+++ b/manifest.json
@@ -43,8 +43,8 @@
},
{
- "matches": ["https://polytoria.com/u/**"],
- "js": ["/js/account/profile.js"]
+ "matches": ["https://polytoria.com/u/**", "https://polytoria.com/users/**"],
+ "js": ["/js/account/profile.js", "/js/account/inventory.js"]
},
{
diff --git a/resources/getUserDetails.js b/resources/getUserDetails.js
index 2eb0bb7..48e8ecd 100644
--- a/resources/getUserDetails.js
+++ b/resources/getUserDetails.js
@@ -1,4 +1,5 @@
window.localStorage.setItem('p+account_info', JSON.stringify({
ID: userID,
- Bricks: document.querySelector('.brickBalanceCont').innerText.replace(/\s+/g,'')
+ Username: document.querySelector('a[href^="/u"]:has(.dropdown-item):first-child').innerText.replaceAll('\n', '').replaceAll('\t', '').trim(),
+ Bricks: document.querySelector('.brickBalanceCont').innerText.replace(/\s+/g,'').split('(')[0]
}))
\ No newline at end of file