diff --git a/README.md b/README.md
index 3196fba..e7e7487 100644
--- a/README.md
+++ b/README.md
@@ -4,43 +4,60 @@
> [!IMPORTANT]
> This extension is currently in BETA. If you find any bugs, please report them in this repository's issues section as it'd be a great help towards the development of the extension.
-> [!TIP]
-> Would you like to learn what's in store for Poly+? Check out the roadmap [here](https://github.com/users/indexxing/projects/2)!
-
# Poly+
-Poly+ is an upcoming quality-of-life browser extension for the Polytoria website! The extension provides tons of improvements to improve your experience on Polytoria! Visit the website [here](https://polyplus.vercel.app/)!
+Poly+ is a quality-of-life browser extension for the Polytoria website! The extension provides tons of improvements to improve your experience on Polytoria! Visit the website [here](https://polyplus.vercel.app/)!





+
# Features
-- Pinned Games
-- Forum Mentions
+- ๐ Pinned Games
+- ๐ฃ Forum Mentions
+- ๐จ Theme Creator
+- ๐ Store "owned" Tags
+- ๐งพ Item Wishlist
- Best Friends
- Improved Friend Lists
- IRL Price with Brick Count
- Hide Sidebar Notification Badges
-- Theme Creator
-- Store `owned` Tags
- More Search Filters
- Modify Navbar
- Free Membership Themes
- Multi-Cancel Outbound Trades
-- Item Wishlist
-- Outfit Cost
+- Quick Place Downloads
+- Try-On Items
+- Show Outfit Cost on Profiles
+- Show Approximate Place Revenue
+- Show "Owners" instead of "Sales"
+- Collectibles' Hoarders List
+- Quick Library Downloads
+- "Event Items" Store Category
+- Show Friend Count on Homepage
+- Timed-Item Owner Check
+- Hide User Ads
+- Multi-Decal Uploading
+- Avatar Dimension Toggle
And there is more to come!
+### Experimental Settings
+
+> Experimental settings may not be finished and may have bugs!
+
+- Game Profiles
+- Inline Editing
+- Forum Unix Timestamps
+- Avatar Sandbox
+
# Supported Browsers
-As of right now, Poly+ only works on Chromium-based browsers. Currently, there are no plans to bring it to other browsers.
-
-> TL;DR Chromium-based browsers
+Poly+ is supported on Chromium-based browsers and Firefox!
## Examples of Browsers that are Chromium-based
@@ -55,13 +72,13 @@ As of right now, Poly+ only works on Chromium-based browsers. Currently, there a
## How to Download - Stable Build?
-1. Go to the releases section of this GitHub repository
-2. Go to the latest release and download the .ZIP file for that release
-3. Extract the .ZIP
-4. Enable developer mode on your browser (developer mode allows you to load unpacked extensions)
-5. Click the "Load Unpacked" button
-6. When the file selector comes up, open the unzipped folder from this GitHub repository
-7. Go to Polytoria and you should see some changes!
+1. Go to the extensions (or add-ons) webstore for your respective browser:
+ - Chromium-based browsers: [Chrome Webstore](https://chromewebstore.google.com/detail/poly+/feafepokhecfmimpepbpccmcnjbcbklg)
+ - Firefox: [Firefox Add-ons Store](https://addons.mozilla.org/en-US/firefox/addon/polytoriaplus/)
+
+2. Click on the Poly+ icon in your browser's tooltip (if it's pinned, if not you may have to go to a sub-menu in your browser's toolbar and find the extension there) to go to the settings page, and customize your experience. Remember to click save at the bottom of the page when you are done!
+
+3. Go to Polytoria's website and enjoy the many features and QOL improvements that come with Poly+!
## How to Download - Pre-Release Build?
@@ -75,4 +92,4 @@ As of right now, Poly+ only works on Chromium-based browsers. Currently, there a
6. Go to your browser extensions page (usually `browserName://extensions`)
7. Click the "Load Unpacked" button
8. When the file selector comes up, open the unzipped folder of this repository's source code
-9. Go to Polytoria and you should see some changes!
+9. Go to Polytoria and you should see some changes!
\ No newline at end of file
diff --git a/css/settings.css b/css/settings.css
index 53c126b..4600f89 100644
--- a/css/settings.css
+++ b/css/settings.css
@@ -1,8 +1,14 @@
html,
body,
#page {
+ /*
background: #202020;
color: #fff;
+ */
+ background: linear-gradient(rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0.7)), url(/images/client-loading.png);
+ background-color: #222222;
+ background-size: 400px;
+ background-position: center;
}
#page {
@@ -42,7 +48,7 @@ h2 span.indent {
.setting-container .title {
font-size: 1.4rem;
- font-weight: lighter;
+ font-weight: bold;
}
.setting-container .desc {
@@ -89,15 +95,13 @@ dialog .modal-body p:first-child {
border-radius: 5rem;
display: inline-block;
cursor: default;
+ margin-right: 4px;
+ height: 20px;
+ vertical-align: text-top;
}
-.setting-container.enabled .indicator {
- background-color: #007bff;
-}
-
-.setting-container.disabled .indicator {
- background-color: orangered;
-}
+.setting-container.enabled .indicator { background-color: #007bff;}
+.setting-container.disabled .indicator { background-color: orangered; }
.toggle-btn {
float: right;
@@ -107,7 +111,12 @@ dialog .modal-body p:first-child {
.limited-time {
background: transparent;
border-color: transparent;
+ /*
+ changed the box shadow to black cause @dargy begged me to
box-shadow: -3px -3px 15px 0 rgba(255, 116, 16, 0.25) inset, 3px 3px 15px 0 rgba(205, 96, 255, 0.25) inset;
+ */
+ box-shadow: -3px -3px 15px 0 black inset;
+ border: none;
}
.limited-time * {
@@ -145,8 +154,13 @@ dialog .modal-body p:first-child {
background:
linear-gradient(
45deg,
+ /*
+ changed the gradient to blue and green cause @ItsLuiggiYahoo begged me to
rgba(255, 116, 16, 1),
rgba(205, 96, 255, 1)
+ */
+ blue,
+ green
);
-webkit-mask:
linear-gradient(#fff 0 0) content-box,
@@ -157,6 +171,17 @@ dialog .modal-body p:first-child {
border-radius: inherit;
}
+.warning {
+ font-size: 0.8rem;
+ color: orange;
+ font-weight: lighter;
+}
+
+.card {
+ --bs-card-border-color: #1e1e1e;
+ --bs-card-bg: #121212;
+}
+
@-webkit-keyframes LimitedTimeTag {
0%{color:rgba(255, 116, 16, 1);}
50%{color:rgba(23, 107, 233, 1);}
diff --git a/images/client-loading.png b/images/client-loading.png
new file mode 100644
index 0000000..8811acb
Binary files /dev/null and b/images/client-loading.png differ
diff --git a/images/greatdivide.png b/images/greatdivide.png
new file mode 100644
index 0000000..0261dcc
Binary files /dev/null and b/images/greatdivide.png differ
diff --git a/icons/icon-update.png b/images/icon-update.png
similarity index 100%
rename from icons/icon-update.png
rename to images/icon-update.png
diff --git a/icons/icon.png b/images/icon.png
similarity index 100%
rename from icons/icon.png
rename to images/icon.png
diff --git a/js/account/avatar-sandbox-rewrite.js b/js/account/avatar-sandbox-rewrite.js
new file mode 100644
index 0000000..5501abb
--- /dev/null
+++ b/js/account/avatar-sandbox-rewrite.js
@@ -0,0 +1,496 @@
+let Utilities;
+
+const Container = document.querySelector('.container.p-0.p-lg-5')
+const ItemCache = {
+ 24122: {
+ type: "hat",
+ accessoryType: "hat",
+ name: "Polytoria Cap",
+ price: 0,
+ creator: {
+ name: "Polytoria",
+ id: 1
+ },
+ thumbnail: "https://c0.ptacdn.com/thumbnails/assets/RR0VPd5hX30Fx5APwRBGObotf1xD1DRT.png",
+ asset: "https://c0.ptacdn.com/assets/InBsL5bpJdp84ZPZGQMeHuyCBlo-uOv7.glb"
+ },
+ 24118: {
+ type: "shirt",
+ name: "Green Polytoria Flannel",
+ price: 0,
+ creator: {
+ name: "Polytoria",
+ id: 1
+ },
+ thumbnail: "https://c0.ptacdn.com/thumbnails/assets/s7l57JugjbZfWTKAQ0cqTohOBraRbX5E.png",
+ asset: "https://c0.ptacdn.com/assets/uWrrnFGwgNN5W171vqYTWY7E639rKiXK.png"
+ },
+ 24123: {
+ type: "pants",
+ name: "Jeans",
+ price: 0,
+ creator: {
+ name: "Polytoria",
+ id: 1
+ },
+ thumbnail: "https://c0.ptacdn.com/thumbnails/assets/anebTuFMLg8NKhRL3ab7hbzCfmcsFqGO.png",
+ asset: "https://c0.ptacdn.com/assets/HD6TFdXD8CaflRNmd84VCNyNsmTB0SH3.png"
+ }
+}
+let Avatar = {
+ useCharacter: true,
+ items: [24122],
+ shirt: 24118,
+ pants: 24123,
+ headColor: '#e0e0e0',
+ torsoColor: '#e0e0e0',
+ leftArmColor: '#e0e0e0',
+ rightArmColor: '#e0e0e0',
+ leftLegColor: '#e0e0e0',
+ rightLegColor: '#e0e0e0'
+};
+
+/* Discovery */
+let Page = 1
+let Search = ""
+let TabSelected = "hat"
+
+!(async () => {
+ Utilities = await import(chrome.runtime.getURL('resources/utils.js'));
+ Utilities = Utilities.default;
+
+ chrome.storage.sync.get(['PolyPlus_Settings'], function(result){
+ Settings = result.PolyPlus_Settings || Utilities.DefaultSettings;
+
+ if (Settings.AvatarSandboxOn || 1 === 1) {
+ if (new URLSearchParams(window.location.search).has('sandbox')) {
+ document.title = 'Poly+ Avatar Sandbox'
+ PageLoad()
+ } else {
+ const SandboxButton = document.createElement('a');
+ SandboxButton.classList = 'btn btn-outline-success w-100 mt-3';
+ SandboxButton.href = '?sandbox=true';
+ SandboxButton.innerHTML = ' Avatar Sandbox';
+ document.getElementById('cont-move').parentElement.appendChild(SandboxButton);
+ }
+ }
+ })
+})();
+
+async function PageLoad() {
+ const PageContents = (await ((await fetch(chrome.runtime.getURL('resources/avatar-sandbox.html'))).text()))
+ Container.innerHTML = PageContents
+ Utilities.InjectResource("registerTooltips")
+
+ IFrame = document.getElementById('viewFrame')
+
+ UpdateAvatar()
+ LoadItems()
+
+ const Tabs = document.getElementById('tabs')
+ Array.from(Tabs.children).forEach((element) => {
+ element.addEventListener('click', function () {
+ let Link = element.getElementsByTagName('a')[0];
+ if (!Link.classList.contains('active')) {
+ Link.classList.add('active');
+ Tabs.querySelector(`[data-tab="${TabSelected}"]`).classList.remove('active');
+ TabSelected = Link.getAttribute('data-tab');
+ Page = 1;
+ LoadItems();
+ }
+ });
+ });
+
+ const ClearButton = document.getElementById('clear');
+ ClearButton.addEventListener('click', function () {
+ Avatar = {
+ useCharacter: true,
+ items: [24122],
+ shirt: 24118,
+ pants: 24123,
+ headColor: '#e0e0e0',
+ torsoColor: '#e0e0e0',
+ leftArmColor: '#e0e0e0',
+ rightArmColor: '#e0e0e0',
+ leftLegColor: '#e0e0e0',
+ rightLegColor: '#e0e0e0'
+ };
+ UpdateAvatar();
+ });
+
+ const LoadMyselfButton = document.getElementById('myself');
+ LoadMyselfButton.addEventListener('click', function () {
+ LoadUser(JSON.parse(window.localStorage.getItem('p+account_info')).ID);
+ });
+
+ const JSONUploadButton = document.getElementById('jsonUpload');
+ JSONUploadButton.addEventListener('change', function () {
+ const Reader = new FileReader();
+ Reader.addEventListener('loadend', function () {
+ Avatar = JSON.parse(Reader.result);
+ UpdateAvatar();
+
+ JSONUploadButton.value = '';
+ });
+
+ Reader.readAsText(JSONUploadButton.files[0]);
+ });
+
+ const JSONSaveButton = document.getElementById('jsonSave');
+ JSONSaveButton.addEventListener('click', function () {
+ const Download = document.createElement('a');
+ Download.href = URL.createObjectURL(
+ new Blob([JSON.stringify(Avatar)], {
+ type: 'application/json'
+ })
+ );
+ Download.setAttribute('download', 'AvatarSandbox.json');
+ document.body.appendChild(Download);
+ Download.click();
+ document.body.removeChild(Download);
+ });
+
+ const OpenInNewTabButton = document.getElementById('openNewTab');
+ OpenInNewTabButton.addEventListener('click', function () {
+ window.open(IFrame, "_blank")
+ });
+
+ const LoadAsset = document.getElementById('load-asset')
+ const LoadAssetType = document.getElementById('load-asset-type')
+ LoadAsset.addEventListener('click', function(){
+ const SelectedType = LoadAssetType.options[LoadAssetType.selectedIndex].value
+
+ if (SelectedType !== 'user') {
+ if (SelectedType === 'hat') {
+ Avatar.items.push(LoadAsset.previousElementSibling.value);
+ } else {
+ Avatar[SelectedType] = parseInt(LoadAsset.previousElementSibling.value)
+ }
+ UpdateAvatar();
+ } else {
+ LoadUser(LoadAsset.previousElementSibling.value)
+ }
+ })
+}
+
+async function UpdateAvatar() {
+ // Hats, Tools: https://api.polytoria.com/v1/assets/serve-mesh/ID
+ // or: https://api.polytoria.com/v1/assets/serve/ID/Asset
+
+ const FormattedAvatar = structuredClone(Avatar)
+
+ const AccessoryPromise = [...Avatar.items, Avatar.tool].filter((x) => x !== undefined && !x.toString().startsWith('http') && !x.toString().startsWith('data:')).map(async (x, index) => {
+ 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,
+ creator: {
+ name: ItemDetails.creator.name,
+ id: ItemDetails.creator.id
+ },
+ thumbnail: ItemDetails.thumbnail,
+ asset: undefined
+ }
+
+ if (ItemDetails.type === 'hat') {
+ ItemCache[x].accessoryType = ItemDetails.accessoryType
+ }
+ }
+
+ if (ItemCache[x].asset === undefined) {
+ const MeshURL = (await (await fetch('https://api.polytoria.com/v1/assets/serve-mesh/' + x)).json())
+ if (MeshURL.success) {
+ ItemCache[x].asset = MeshURL.url
+ if (ItemCache[x].type === 'hat') {
+ FormattedAvatar.items[index] = MeshURL.url
+ } else {
+ FormattedAvatar[ItemCache[x].type] = MeshURL.url
+ }
+ }
+ } else {
+ if (ItemCache[x].type === 'hat') {
+ FormattedAvatar.items[index] = ItemCache[x].asset
+ } else {
+ FormattedAvatar[ItemCache[x].type] = ItemCache[x].asset
+ }
+ }
+ })
+
+ const TexturePromise = [Avatar.shirt, Avatar.pants, Avatar.face].filter((x) => x !== undefined && !x.toString().startsWith('http') && !x.toString().startsWith('data:') && x !== undefined).map(async (x, index) => {
+ 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,
+ creator: {
+ name: ItemDetails.creator.name,
+ id: ItemDetails.creator.id
+ },
+ thumbnail: ItemDetails.thumbnail,
+ */
+ asset: undefined
+ }
+
+ if (ItemDetails.price === 0) {
+ if (ItemDetails.sales === 0) {
+ ItemCache[x].price = null
+ } else {
+ ItemCache[x].price = 0
+ }
+ }
+ }
+
+ if (ItemCache[x].asset === undefined) {
+ const TextureURL = (await (await fetch('https://api.polytoria.com/v1/assets/serve/' + x + '/Asset')).json())
+ if (TextureURL.success) {
+ ItemCache[x].asset = TextureURL.url
+ if (x === Avatar.shirt) {
+ FormattedAvatar.shirt = TextureURL.url
+ } else if (x === Avatar.pants) {
+ FormattedAvatar.pants = TextureURL.url
+ } else if (x === Avatar.face) {
+ FormattedAvatar.face = TextureURL.url
+ }
+ }
+ } else {
+ if (x === Avatar.shirt) {
+ FormattedAvatar.shirt = ItemCache[x].asset
+ } else if (x === Avatar.pants) {
+ FormattedAvatar.pants = ItemCache[x].asset
+ } else if (x === Avatar.face) {
+ FormattedAvatar.face = ItemCache[x].asset
+ }
+ }
+ })
+
+ if (Avatar.face === undefined) {
+ FormattedAvatar.face = "https://c0.ptacdn.com/static/3dview/DefaultFace.png"
+ }
+
+ await Promise.all(AccessoryPromise)
+ await Promise.all(TexturePromise)
+
+ console.log('Real Avatar: ', Avatar)
+ console.log('Formatted: ', FormattedAvatar)
+ IFrame.addEventListener('load', function(){
+ IFrame.src = 'https://polytoria.com/ptstatic/itemview/#' + btoa(encodeURIComponent(JSON.stringify(FormattedAvatar)))
+ })
+ IFrame.src = 'about:blank'
+
+ UpdateBodyColors()
+ LoadWearing()
+}
+
+function LoadUser(id) {
+ fetch('https://api.polytoria.com/v1/users/' + id + '/avatar')
+ .then((response) => {
+ if (!response.ok) {
+ throw new Error('Network not ok');
+ }
+ return response.json();
+ })
+ .then((data) => {
+ Avatar.items = [];
+
+ data.assets.forEach((item) => {
+ ItemCache[item.id] = {
+ type: item.type,
+ name: item.name,
+ price: null,
+ creator: null,
+ thumbnail: item.thumbnail,
+ asset: item.path
+ }
+
+ if (item.type === 'hat' || item.type === 'tool') {
+ ItemCache[item.id].creator = {
+ id: 1,
+ name: "Polytoria"
+ }
+ }
+
+ if (item.type === 'hat') {
+ ItemCache[item.id].accessoryType = item.accessoryType
+ Avatar.items.push(item.id)
+ } else {
+ Avatar[item.type] = item.id
+ }
+ });
+
+ Avatar.headColor = '#' + data.colors.head || '#cdcdcd';
+ Avatar.torsoColor = '#' + data.colors.torso || '#cdcdcd';
+ Avatar.leftArmColor = '#' + data.colors.leftArm || '#cdcdcd';
+ Avatar.rightArmColor = '#' + data.colors.rightArm || '#cdcdcd';
+ Avatar.leftLegColor = '#' + data.colors.leftLeg || '#cdcdcd';
+ Avatar.rightLegColor = '#' + data.colors.rightLeg || '#cdcdcd';
+
+ UpdateAvatar();
+ })
+ .catch((error) => {
+ console.log(error);
+ });
+}
+
+async function LoadItems() {
+ document.getElementById('inventory').innerHTML = ''
+
+ const Items = (await (await fetch('https://api.polytoria.com/v1/store?limit=12&order=desc&sort=createdAt&showOffsale=true&types[]='+ TabSelected +'&search=' + Search + '&page=' + Page)).json()).assets
+ Items.forEach(item => {
+ const ItemColumn = document.createElement('div')
+ ItemColumn.classList = 'col-auto'
+ ItemColumn.innerHTML = `
+
+ `
+ document.getElementById('inventory').appendChild(ItemColumn)
+
+ ItemCache[item.id] = {
+ type: item.type,
+ name: item.name,
+ price: item.price,
+ creator: {
+ name: item.creator.name,
+ id: item.creator.id
+ },
+ thumbnail: item.thumbnail,
+ asset: undefined
+ }
+
+ if (item.price === 0) {
+ if (item.sales === 0) {
+ console.log("ITEM IS AWARD-ONLY!!! ", item)
+ ItemCache[item.id].price = null
+ } else {
+ ItemCache[item.id].price = 0
+ }
+ }
+
+ if (item.type === 'hat') {
+ ItemCache[item.id].accessoryType = item.accessoryType
+ }
+
+ ItemColumn.getElementsByClassName('p-2')[0].addEventListener('click', function(){
+ WearAsset(item)
+ })
+ })
+}
+
+function LoadWearing() {
+ document.getElementById('wearing').innerHTML = '';
+ [...Avatar.items, Avatar.shirt, Avatar.pants].filter((x) => x !== undefined).forEach(id => {
+ const Cached = Object.values(ItemCache)[Object.keys(ItemCache).indexOf(id.toString())]
+ if (Cached !== undefined) {
+ if (Cached.creator === null) {
+ Cached.creator = {
+ id: 1,
+ name: "-"
+ }
+ }
+
+ if (Cached.price === null) { Cached.price = "???" }
+
+ const ItemColumn = document.createElement('div')
+ ItemColumn.classList = 'col-auto'
+ ItemColumn.innerHTML = `
+
+
+
+
+ ${ (Cached.type === 'hat') ? `
+
+ ${CleanAccessoryType(Cached.accessoryType)}
+
+ ` : ''}
+
+
+
+
+ ${Cached.name}
+
+
+ by ${Cached.creator.name || "-"}
+
+
Free' : (Cached.price !== "???") ? 'text-success">$ ' + Cached.price : 'text-muted">??? ' }
+
+
+ `
+ document.getElementById('wearing').appendChild(ItemColumn)
+
+ ItemColumn.getElementsByClassName('p-2')[0].addEventListener('click', function(){
+ WearAsset(Cached)
+ })
+ }
+ })
+}
+
+function WearAsset(details) {
+ if (Avatar[details.type] !== details.id && Avatar.items.indexOf(details.id) === -1) {
+ // Equip
+ if (details.type === 'hat') {
+ Avatar.items.push(details.id)
+ } else {
+ Avatar[details.type] = details.id
+ }
+ } else {
+ // Unequip
+ if (details.type === 'hat') {
+ Avatar.items.splice(Avatar.items.indexOf(details.id), 1);
+ } else {
+ Avatar[details.type] = undefined
+ }
+ }
+
+ UpdateAvatar()
+ LoadWearing()
+}
+
+function UpdateBodyColors() {
+ const BodyColors = {
+ head: Avatar.headColor,
+ torso: Avatar.torsoColor,
+ leftArm: Avatar.leftArmColor,
+ rightArm: Avatar.rightArmColor,
+ leftLeg: Avatar.leftLegColor,
+ rightLeg: Avatar.rightLegColor
+ }
+
+ Object.keys(BodyColors).forEach((elementID, i) => {
+ document.getElementById(elementID).style.backgroundColor = Object.values(BodyColors)[i]
+ })
+}
+
+function CleanAccessoryType(type) {
+ const CleanAccessoryTypes = {
+ hat: "Hat",
+ backAccessory: "Back Accessory",
+ faceAccessory: "Face Accessory",
+ headAttachment: "Head Attachment",
+ hair: "Hair",
+ neckAccessory: "Neck Accessory",
+ headCover: "Head Cover",
+ headAccessory: "Head Accessory"
+ }
+ return Object.values(CleanAccessoryTypes)[Object.keys(CleanAccessoryTypes).indexOf(type)] || "!!!"+type
+}
\ No newline at end of file
diff --git a/js/account/inventory.js b/js/account/inventory.js
index f6e96a1..4330b7c 100755
--- a/js/account/inventory.js
+++ b/js/account/inventory.js
@@ -1,168 +1,208 @@
-console.log('path', window.location.pathname.split('/')[3]);
+Username = window.location.pathname.split('/')[2];
+let UserID;
+let ItemGrid;
if (window.location.pathname.split('/')[3] === 'inventory') {
- 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
-
- `;
- Nav.appendChild(WishlistNav);
+ !(async () => {
+ UserID = (await (await fetch('https://api.polytoria.com/v1/users/find?username=' + Username )).json()).id;
+ ItemGrid = document.getElementsByClassName('itemgrid')[0];
- if (window.location.pathname.split('/')[4] === 'wishlist') {
- console.log('aaa');
- const ItemGrid = document.getElementsByClassName('itemgrid')[0];
- const ItemCardContents = `
-
-
- :LimitedTag
-
-
-
-
-
- :ItemName
-
-
-
- by :CreatorName
-
- X
- `;
+ chrome.storage.sync.get(['PolyPlus_Settings', 'PolyPlus_ItemWishlist'], function(result){
+ Settings = result.PolyPlus_Settings
- Array.from(ItemGrid.children).forEach((element) => {
- element.remove();
- });
- Array.from(Nav.children).forEach((element) => {
- element = element.children[0];
- if (!(element === WishlistNav)) {
- if (element.classList.contains('active')) {
- element.classList.remove('active');
- }
+ 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'
+ ) {
+ let WishlistNav = document.createElement('li');
+ WishlistNav.classList.add('nav-item');
+ WishlistNav.innerHTML = `
+
+
+ Item Wishlist
+
+ `;
+ Nav.appendChild(WishlistNav);
+
+ if (window.location.pathname.split('/')[4] === 'wishlist') {
+ Array.from(Nav.children).forEach((element) => {
+ element = element.children[0];
+ if (!(element === WishlistNav)) {
+ if (element.classList.contains('active')) {
+ element.classList.remove('active');
+ }
+ }
+ });
+ WishlistNav.children[0].classList.add('active');
+
+ ItemWishlist()
}
- });
- WishlistNav.children[0].classList.add('active');
- const Search = document.createElement('div');
- Search.classList = 'row';
- Search.innerHTML = `
-
-
- Any
- Hat
- Faces
- Tools
- Shirt
- Pants
-
-
-
-
-
-
-
-
-
- Is Limited?
- Items that are limited
-
-
-
-
-
-
-
- Is Available?
- Items that are equal to or less than the budget (excluding limiteds)
-
-
-
- `;
- ItemGrid.parentElement.prepend(document.createElement('br'), ItemGrid.parentElement.children[0]);
- ItemGrid.parentElement.prepend(Search, ItemGrid.parentElement.children[0]);
+ }
- let Type = document.getElementById('polyplus-itemwish-type');
- let SearchBar = document.getElementById('polyplus-itemwish-searchbar');
- let IsLimited = document.getElementById('polyplus-itemwish-isLimited');
- let IsAvailable = document.getElementById('polyplus-itemwish-isAvailable');
-
- Type.addEventListener('change', function () {
- Update(Type.options[Type.selectedIndex].value, SearchBar.value, IsLimited.checked, IsAvailable.checked);
- });
-
- SearchBar.addEventListener('change', function () {
- Update(Type.options[Type.selectedIndex].value, SearchBar.value, IsLimited.checked, IsAvailable.checked);
- });
-
- IsLimited.addEventListener('change', function () {
- Update(Type.options[Type.selectedIndex].value, SearchBar.value, IsLimited.checked, IsAvailable.checked);
- });
-
- IsAvailable.addEventListener('change', function () {
- Update(Type.options[Type.selectedIndex].value, SearchBar.value, IsLimited.checked, IsAvailable.checked);
- });
-
- chrome.storage.sync.get(['PolyPlus_ItemWishlist'], function (result) {
- let Wishlist = result.PolyPlus_ItemWishlist || [];
- console.log('wishlist: ', Wishlist);
- Wishlist.forEach((element) => {
- let NewItemCard = document.createElement('div');
- NewItemCard.classList = 'px-0';
- fetch('https://api.polytoria.com/v1/store/:id'.replace(':id', element))
- .then((response) => response.json())
- .then((data) => {
- NewItemCard.innerHTML = ItemCardContents.replace(':ItemID', data.id)
- .replace(':ItemThumbnail', data.thumbnail)
- .replace(':ItemName', data.name)
- .replace(':CreatorID', data.creator.id)
- .replace(':CreatorName', data.creator.name);
- if (data.isLimited === true) {
- NewItemCard.innerHTML = NewItemCard.innerHTML.replace(':LimitedTag', 'Limited
');
- } else {
- NewItemCard.innerHTML = NewItemCard.innerHTML.replace(':LimitedTag', '');
- }
- NewItemCard.setAttribute('data-id', data.id);
- NewItemCard.setAttribute('data-name', data.name);
- NewItemCard.setAttribute('data-type', data.type);
- NewItemCard.setAttribute('data-creator', data.creator.name);
- NewItemCard.setAttribute('data-limited', data.isLimited);
- if (data.isLimited === false) {
- NewItemCard.setAttribute('data-price', data.price);
+ if (Settings.CollectibleInventoryCatOn) {
+ let CollectibleNav = document.createElement('li');
+ CollectibleNav.classList.add('nav-item');
+ CollectibleNav.innerHTML = `
+
+
+ Collectibles
+
+ `;
+ Nav.appendChild(CollectibleNav);
+
+ if (window.location.pathname.split('/')[4] === 'collectibles') {
+ Array.from(Nav.children).forEach((element) => {
+ element = element.children[0];
+ if (!(element === CollectibleNav)) {
+ if (element.classList.contains('active')) {
+ element.classList.remove('active');
}
+ }
+ });
+ CollectibleNav.children[0].classList.add('active');
- ItemGrid.appendChild(NewItemCard);
-
- NewItemCard.getElementsByClassName('polyplus-itemwish-removebtn')[0].addEventListener('click', function () {
- let Index = Wishlist.indexOf(parseInt(NewItemCard.getAttribute('data-id')));
- if (Index === -1) {
- NewItemCard.remove();
- return;
- } else {
- Wishlist.splice(Index, 1);
- console.log(Wishlist);
- NewItemCard.remove();
- }
- chrome.storage.sync.set({PolyPlus_ItemWishlist: Wishlist, arrayOrder: true}, function () {
- console.log('ItemWishlist successfully saved: ' + ItemWishlist);
- });
- });
- })
- .catch((error) => {
- console.error('Error:', error);
- });
- });
- });
- }
- }
+ CollectibleCategory()
+ }
+ }
+ });
+ })();
}
-function Update(type, query, isLimited, isAvailable) {
+function ItemWishlist() {
+ const ItemGrid = document.getElementsByClassName('itemgrid')[0];
+ const ItemCardContents = `
+
+
+ :LimitedTag
+
+
+
+
+
+ :ItemName
+
+
+
+ by :CreatorName
+
+ X
+ `;
+
+ ItemGrid.innerHTML = ''
+ const Search = document.createElement('div');
+ Search.classList = 'row';
+ Search.innerHTML = `
+
+
+ Any
+ Hat
+ Faces
+ Tools
+ Shirt
+ Pants
+
+
+
+
+
+
+
+
+
+ Is Limited?
+ Items that are limited
+
+
+
+
+
+
+
+ Is Available?
+ Items that are equal to or less than the budget (excluding limiteds)
+
+
+
+ `;
+ ItemGrid.parentElement.prepend(document.createElement('br'), ItemGrid.parentElement.children[0]);
+ ItemGrid.parentElement.prepend(Search, ItemGrid.parentElement.children[0]);
+
+ let Type = document.getElementById('polyplus-itemwish-type');
+ let SearchBar = document.getElementById('polyplus-itemwish-searchbar');
+ let IsLimited = document.getElementById('polyplus-itemwish-isLimited');
+ let IsAvailable = document.getElementById('polyplus-itemwish-isAvailable');
+
+ Type.addEventListener('change', function () {
+ Update(Type.options[Type.selectedIndex].value, SearchBar.value, IsLimited.checked, IsAvailable.checked);
+ });
+
+ SearchBar.addEventListener('change', function () {
+ Update(Type.options[Type.selectedIndex].value, SearchBar.value, IsLimited.checked, IsAvailable.checked);
+ });
+
+ IsLimited.addEventListener('change', function () {
+ Update(Type.options[Type.selectedIndex].value, SearchBar.value, IsLimited.checked, IsAvailable.checked);
+ });
+
+ IsAvailable.addEventListener('change', function () {
+ Update(Type.options[Type.selectedIndex].value, SearchBar.value, IsLimited.checked, IsAvailable.checked);
+ });
+
+ chrome.storage.sync.get(['PolyPlus_ItemWishlist'], function (result) {
+ let Wishlist = result.PolyPlus_ItemWishlist || [];
+ console.log('wishlist: ', Wishlist);
+ Wishlist.forEach((element) => {
+ let NewItemCard = document.createElement('div');
+ NewItemCard.classList = 'px-0';
+ fetch('https://api.polytoria.com/v1/store/:id'.replace(':id', element))
+ .then((response) => response.json())
+ .then((data) => {
+ NewItemCard.innerHTML = ItemCardContents.replace(':ItemID', data.id)
+ .replace(':ItemThumbnail', data.thumbnail)
+ .replace(':ItemName', data.name)
+ .replace(':CreatorID', data.creator.id)
+ .replace(':CreatorName', data.creator.name);
+ if (data.isLimited === true) {
+ NewItemCard.innerHTML = NewItemCard.innerHTML.replace(':LimitedTag', 'Limited
');
+ } else {
+ NewItemCard.innerHTML = NewItemCard.innerHTML.replace(':LimitedTag', '');
+ }
+ NewItemCard.setAttribute('data-id', data.id);
+ NewItemCard.setAttribute('data-name', data.name);
+ NewItemCard.setAttribute('data-type', data.type);
+ NewItemCard.setAttribute('data-creator', data.creator.name);
+ NewItemCard.setAttribute('data-limited', data.isLimited);
+ if (data.isLimited === false) {
+ NewItemCard.setAttribute('data-price', data.price);
+ }
+
+ ItemGrid.appendChild(NewItemCard);
+
+ NewItemCard.getElementsByClassName('polyplus-itemwish-removebtn')[0].addEventListener('click', function () {
+ let Index = Wishlist.indexOf(parseInt(NewItemCard.getAttribute('data-id')));
+ if (Index === -1) {
+ NewItemCard.remove();
+ return;
+ } else {
+ Wishlist.splice(Index, 1);
+ console.log(Wishlist);
+ NewItemCard.remove();
+ }
+ chrome.storage.sync.set({PolyPlus_ItemWishlist: Wishlist, arrayOrder: true}, function () {
+ console.log('ItemWishlist successfully saved: ' + ItemWishlist);
+ });
+ });
+ })
+ .catch((error) => {
+ console.error('Error:', error);
+ });
+ });
+ });
+}
+
+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();
@@ -201,3 +241,52 @@ function Update(type, query, isLimited, isAvailable) {
}
}
}
+
+async function CollectibleCategory() {
+ ItemGrid.innerHTML = ''
+ const CollectibleItemTypes = [
+ "hat",
+ "face",
+ "tool"
+ ]
+ const Collectibles = []
+
+ for (let type of CollectibleItemTypes) {
+ const InitialInventory = (await (await fetch('https://api.polytoria.com/v1/users/' + UserID + '/inventory?type=' + type + '&limit=100')).json())
+ Collectibles.push(...InitialInventory.inventory.filter((x) => x.asset.isLimited === true))
+
+ if (InitialInventory.pages > 1) {
+ if (InitialInventory.pages > 3) {
+ InitialInventory.pages = 3
+ }
+
+ for (let page = 2; i < InitialInventory.pages; i++) {
+ const PageResult = (await (await fetch('https://api.polytoria.com/v1/users/' + UserID + '/inventory?type=' + type + '&limit=100&page=' + page)).json())
+ Collectibles.push(...PageResult.inventory.filter((x) => x.asset.isLimited === true))
+ }
+ }
+ }
+
+ Collectibles.forEach(item => {
+ item = item.asset
+ const ItemColumn = document.createElement('div')
+ ItemColumn.classList = 'px-0'
+ ItemColumn.innerHTML = `
+
+
+
Limited
+
+
+
+
+
+ ${item.name}
+
+
+
+ by Polytoria
+
+ `
+ ItemGrid.appendChild(ItemColumn)
+ })
+}
\ No newline at end of file
diff --git a/js/account/outfit-overwrite.js b/js/account/outfit-overwrite.js
deleted file mode 100644
index e69de29..0000000
diff --git a/js/account/profile.js b/js/account/profile.js
index fd4f4a9..6b42f77 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()).id;
+ UserID = (await (await fetch('https://api.polytoria.com/v1/users/find?username=' + Username )).json());
Utilities = await import(chrome.runtime.getURL('resources/utils.js'));
Utilities = Utilities.default;
@@ -25,7 +25,7 @@ if (Username) {
UserIDRow.innerHTML = `
Player ID
- ${UserID}
+ ${UserID.id}
`
InfoColumns.children[0].insertBefore(UserIDRow, InfoColumns.children[0].children[1]);
@@ -33,7 +33,7 @@ if (Username) {
const CopyButton = UserIDRow.getElementsByTagName('a')[0]
CopyButton.addEventListener('click', function(){
navigator.clipboard
- .writeText(UserID)
+ .writeText(UserID.id)
.then(() => {
CopyButton.classList.add('text-success')
CopyButton.children[0].classList = 'fa-duotone fa-circle-check'
@@ -79,12 +79,6 @@ if (Username) {
});
}
- /*
-
-
-
- */
-
AvatarIFrame = document.getElementById('user-avatar-card').getElementsByTagName('iframe')[0]
if (Settings.AvatarDimensionToggleOn === true || 1 === 1) {
const AvatarCard = document.getElementById('user-avatar-card')
@@ -97,20 +91,32 @@ if (Username) {
ToggleButton.addEventListener('click', async function(){
if (ToggleButton.children[0].classList.contains('fa-image')) {
if (document.getElementById('polyplus-2davatar')) {
+ const AvatarImage = document.getElementById('polyplus-2davatar')
+
+ AvatarImage.width = AvatarIFrame.offsetWidth
+ AvatarImage.height = AvatarIFrame.offsetHeight
+ AvatarImage.style.display = 'block'
AvatarIFrame.style.display = 'none'
- document.getElementById('polyplus-2davatar').style.display = 'block'
+
ToggleButton.children[0].classList = 'toggleIcn fad fa-360-degrees'
} else {
const AvatarImage = document.createElement('img')
AvatarImage.id = 'polyplus-2davatar'
AvatarImage.width = AvatarIFrame.offsetWidth
AvatarImage.height = AvatarIFrame.offsetHeight
+ AvatarImage.style.padding = '20px'
- const UserDetails = (await (await fetch('https://api.polytoria.com/v1/users/' + UserID)).json())
+ const UserDetails = (await (await fetch('https://api.polytoria.com/v1/users/' + UserID.id)).json())
AvatarImage.src = UserDetails.thumbnail.avatar
AvatarIFrame.style.display = 'none'
- AvatarCard.children[0].insertBefore(AvatarImage, AvatarCard.getElementsByClassName('user-badges')[0])
+
+ const CustomBadge = document.querySelector('#user-avatar-card .badge:has(.pi)')
+ if (CustomBadge === null) {
+ AvatarCard.children[0].insertBefore(AvatarImage, AvatarCard.getElementsByClassName('user-badges')[0])
+ } else {
+ AvatarCard.children[0].insertBefore(AvatarImage, CustomBadge.parentElement)
+ }
ToggleButton.children[0].classList = 'toggleIcn fad fa-360-degrees'
}
@@ -122,6 +128,24 @@ if (Username) {
})
}
});
+
+ if (new URLSearchParams(window.location.search).get('birthday') === 'true') {
+ const JoinDateRow = document.querySelector('#user-stats-card .mb-1:has(.fa-calendar)')
+ const BirthdayCard = document.createElement('div')
+ BirthdayCard.classList = 'card card-themed card-player-birthday mb-2'
+ BirthdayCard.innerHTML = `
+
+
+ It's my ${new Date().getFullYear() - new Date(JoinDateRow.children[1].innerText).getFullYear()}rd Polytoria anniversary!
+
+
Send ${UserID.username} congrats
+
+ `
+ document.getElementById('user-avatar-card').parentElement.insertBefore(BirthdayCard, document.getElementById('user-avatar-card'))
+ JoinDateRow.children[1].innerHTML = ' ' + JoinDateRow.children[1].innerHTML
+ JoinDateRow.children[1].classList.add('text-birthday-gradient')
+ JoinDateRow.children[1].classList.add('fw-semibold')
+ }
})();
if (AvatarIFrame === null) {
@@ -168,7 +192,7 @@ if (Username) {
alert('Failure to copy sharable 3D avatar URL.');
});
});
-} else if (UserID && UserID[0] === '@') {
+} else if (Username && Username[0] === '@') {
const Username = window.location.pathname.split('/')[2].substring(1);
let Reference = new URLSearchParams(new URL(window.location.href).search);
@@ -205,7 +229,7 @@ function BestFriends() {
FavoriteBtn = document.createElement('button');
FavoriteBtn.classList = 'btn btn-warning btn-sm ml-2';
if (!(BestFriends.length === Utilities.Limits.BestFriends)) {
- if (Array.isArray(BestFriends) && BestFriends.includes(parseInt(UserID))) {
+ if (Array.isArray(BestFriends) && BestFriends.includes(parseInt(UserID.id))) {
FavoriteBtn.innerText = 'Remove Best Friend Status';
} else {
FavoriteBtn.innerText = 'Best Friend';
@@ -213,9 +237,9 @@ function BestFriends() {
} else {
FavoriteBtn.innerText = 'Remove Best Friend Status (max ' + Utilities.Limits.BestFriends + '/' + Utilities.Limits.BestFriends + ')';
}
- if (UserID !== JSON.parse(window.localStorage.getItem('p+account_info')).ID && document.getElementById('add-friend-button').classList.contains('btn-success') === false) {
+ if (UserID.id !== JSON.parse(window.localStorage.getItem('p+account_info')).ID && document.getElementById('add-friend-button').classList.contains('btn-success') === false) {
FavoriteBtn.addEventListener('click', function () {
- Fav(UserID, FavoriteBtn);
+ Fav(UserID.id, FavoriteBtn);
});
} else {
FavoriteBtn.style.display = 'none';
@@ -223,25 +247,25 @@ function BestFriends() {
document.querySelectorAll('.section-title.px-3.px-lg-0.mt-3')[0].appendChild(FavoriteBtn);
function Fav(UserID, btn) {
- if (UserID === JSON.parse(window.localStorage.getItem('p+account_info')).ID) {
+ if (UserID.id === JSON.parse(window.localStorage.getItem('p+account_info')).ID) {
return;
}
btn.setAttribute('disabled', 'true');
chrome.storage.sync.get(['PolyPlus_BestFriends'], function (result) {
const BestFriends = result.PolyPlus_BestFriends || [];
- const index = BestFriends.indexOf(parseInt(UserID));
+ const index = BestFriends.indexOf(parseInt(UserID.id));
if (index !== -1) {
// Number exists, remove it
BestFriends.splice(index, 1);
btn.innerText = 'Best Friend';
- console.log('Number', parseInt(UserID), 'removed from BestFriends');
+ console.log('Number', parseInt(UserID.id), 'removed from BestFriends');
} else {
// Number doesn't exist, add it
- BestFriends.push(parseInt(UserID));
+ BestFriends.push(parseInt(UserID.id));
btn.innerText = 'Remove Best Friend Status';
- console.log('Number', parseInt(UserID), 'added to BestFriends');
+ console.log('Number', parseInt(UserID.id), 'added to BestFriends');
}
chrome.storage.sync.set({PolyPlus_BestFriends: BestFriends, arrayOrder: true}, function () {
@@ -260,7 +284,7 @@ function BestFriends() {
BestFriends = result.PolyPlus_BestFriends || [];
if (!(BestFriends.length === Utilities.Limits.BestFriends)) {
- if (Array.isArray(BestFriends) && BestFriends.includes(parseInt(UserID))) {
+ if (Array.isArray(BestFriends) && BestFriends.includes(parseInt(UserID.id))) {
FavoriteBtn.innerText = 'Remove Best Friend Status';
} else {
FavoriteBtn.innerText = 'Best Friend';
diff --git a/js/background.js b/js/background.js
index 738f63e..1d2e669 100755
--- a/js/background.js
+++ b/js/background.js
@@ -80,7 +80,15 @@ const DefaultSettings = {
},
UploadMultipleDecals: true,
GD_ServerBalanceOn: true,
- AvatarDimensionToggleOn: true
+ AvatarDimensionToggleOn: true,
+ TheGreatDivide: {
+ Enabled: true,
+ UnbalancedIndicatorOn: true,
+ MVPUserIndicatorOn: true,
+ UserStatsOn: true,
+ LeaderboardsOn: true
+ },
+ CollectibleInventoryCatOn: true
}
// ON EXTENSION INSTALL / RELOAD
@@ -93,20 +101,93 @@ chrome.runtime.onInstalled.addListener(() => {
})
});
-chrome.runtime.onMessage.addListener(function (request, sender, sendResponse) {
+chrome.runtime.onMessage.addListener(async function (request, sender, sendResponse) {
if (request.action === 'reload') {
chrome.runtime.reload();
- } else if (request.action === 'sweetalert2') {
+ } else if (request.action === 'greatdivide_stats') {
+ const Statistics = (await (await fetch('https://stats.silly.mom/player_stats?username=' + request.username)).json()).results
+
chrome.tabs.query({ active: true, currentWindow: true }, function(tabs){
- console.log([request.icon, request.title, request.text])
chrome.scripting
.executeScript({
target: {tabId: tabs[0].id},
- func: OpenSweetAlert2Modal,
- // would have just let it pass thru the object for sweetalert2 - but probably not a good idea lol
- args: [request.icon, request.title, request.text]
+ func: LoadStats,
+ args: [Statistics]
})
})
+
+ const LoadStats = function(stats){
+ if (stats !== null) {
+ stats = stats[0]
+ document.getElementById('p+greatdivide_stats').innerHTML = `
+
+
+
+ Kills
+
+
+ ${stats.Kills.toLocaleString()} (${stats.UniqueKills.toLocaleString()} unique)
+
+
+
+
+
+ Deaths
+
+
+ ${stats.Deaths.toLocaleString()}
+
+
+
+
+
+ Kill Death Ratio
+
+
+ ${(stats.Kills / stats.Deaths).toFixed(4)}
+
+
+
+
+
+ Points Scored
+
+
+ ${stats.PointsScored.toLocaleString()}
+
+
+
+
+
+ Cash Earned
+
+
+ ${stats.CashEarned.toLocaleString()}
+
+
+
+
+
+ Flags Captured
+
+
+ ${stats.FlagsCaptured} (${stats.FlagsReturned} returned)
+
+
+
+
+
+ Airdrops Collected
+
+
+ ${stats.AirdropsCollected}
+
+
+ `
+ } else {
+ document.getElementById('p+greatdivide_stats').innerHTML = "This user hasn't participated in The Great Divide.
"
+ }
+ }
}
});
@@ -131,11 +212,13 @@ function GetNext12PM() {
}
// HANDLE ALARMS FIRING
+/*
chrome.alarms.onAlarm.addListener(function (alarm) {
if (alarm.name === 'PolyPlus-UpdateCheck') {
RunUpdateNotifier();
}
});
+*/
function RunUpdateNotifier() {
chrome.storage.local.get(['PolyPlus_LiveVersion', 'PolyPlus_OutOfDate', 'PolyPlus_SkipUpdate'], function (result) {
const OutOfDate = result.PolyPlus_OutOfDate || false;
@@ -194,16 +277,54 @@ chrome.contextMenus.removeAll(function () {
});
// COPY ASSET ID CONTEXT MENU ITEM REGISTRATION
+ /*
+ const AssetTypes = ["Place", "User", "Item", "Guild"]
+ AssetTypes.forEach(type => {
+ chrome.contextMenus.create({
+ title: 'Copy ' + type + ' ID',
+ id: 'PolyPlus-Copy' + type + 'ID',
+ contexts: ['link'],
+ documentUrlPatterns: ['https://polytoria.com/*', SettingsURL],
+ targetUrlPatterns: [
+ 'https://polytoria.com/places/**'
+ ]
+ });
+ })
+ */
chrome.contextMenus.create({
- title: 'Copy Asset ID',
- id: 'PolyPlus-CopyID',
+ title: 'Copy Place ID',
+ id: 'PolyPlus-CopyPlaceID',
+ contexts: ['link'],
+ documentUrlPatterns: ['https://polytoria.com/*', SettingsURL],
+ targetUrlPatterns: [
+ 'https://polytoria.com/places/**'
+ ]
+ });
+ chrome.contextMenus.create({
+ title: 'Copy User ID',
+ id: 'PolyPlus-CopyUserID',
contexts: ['link'],
documentUrlPatterns: ['https://polytoria.com/*', SettingsURL],
targetUrlPatterns: [
- 'https://polytoria.com/places/**',
'https://polytoria.com/users/**',
- 'https://polytoria.com/u/**',
- 'https://polytoria.com/store/**',
+ 'https://polytoria.com/u/**'
+ ]
+ });
+ chrome.contextMenus.create({
+ title: 'Copy Item ID',
+ id: 'PolyPlus-CopyItemID',
+ contexts: ['link'],
+ documentUrlPatterns: ['https://polytoria.com/*', SettingsURL],
+ targetUrlPatterns: [
+ 'https://polytoria.com/store/**'
+ ]
+ });
+ chrome.contextMenus.create({
+ title: 'Copy Guild ID',
+ id: 'PolyPlus-CopyGuildID',
+ contexts: ['link'],
+ documentUrlPatterns: ['https://polytoria.com/*', SettingsURL],
+ targetUrlPatterns: [
'https://polytoria.com/guilds/**'
]
});
@@ -222,7 +343,7 @@ chrome.contextMenus.removeAll(function () {
// HANDLE CONTEXT MENU ITEMS
chrome.contextMenus.onClicked.addListener(async function (info, tab) {
- if (info.menuItemId === 'PolyPlus-CopyID') {
+ if (["CopyPlaceID", "CopyUserID", "CopyItemID", "CopyGuildID"].indexOf(info.menuItemId.split('-')[1]) !== -1) {
console.log(info.linkUrl.split('/')[3]);
let ID = info.linkUrl.split('/')[4];
if (info.linkUrl.split('/')[3] === 'u') {
diff --git a/js/library-download.js b/js/library-download.js
index 021fea5..2050461 100644
--- a/js/library-download.js
+++ b/js/library-download.js
@@ -2,10 +2,17 @@ const AssetID = window.location.pathname.split('/')[2];
const LibraryType = document.querySelectorAll('ol a')[1].innerText.toLowerCase();
const LibraryTypes = ['model', 'audio', 'decal', 'mesh', 'shirt', 'pant'];
-if (LibraryTypes.some(element => element.startsWith(LibraryType))) {
+if (LibraryTypes.some(element => LibraryType.startsWith(element))) {
chrome.storage.sync.get(['PolyPlus_Settings'], async function (result) {
Settings = result.PolyPlus_Settings || {};
+ if (['model', 'audio', 'decal', 'mesh'].some(element => LibraryType.startsWith(element))) {
+ const Breadcrumbs = document.querySelectorAll('ol a')
+ Breadcrumbs[0].href = '/library'
+ Breadcrumbs[0].innerText = 'Library'
+ Breadcrumbs[1].href = '/library'
+ }
+
if (Settings.LibraryDownloadsOn === false) {
return;
}
@@ -18,7 +25,15 @@ if (LibraryTypes.some(element => element.startsWith(LibraryType))) {
DownloadLink.innerHTML = ` Download`;
Dropdown.insertBefore(DownloadLink, Dropdown.children[Dropdown.children.length - 1]);
- console.log('type', LibraryType, LibraryType.startsWith('shirt'), LibraryType.startsWith('pant'))
+ const SourceLink = document.createElement('a');
+ SourceLink.classList = 'dropdown-item text-primary';
+ SourceLink.href = '#';
+ SourceLink.innerHTML = ` Copy CDN URL`;
+
+ if (LibraryType.startsWith('audio') || LibraryType.startsWith('decal') || LibraryType.startsWith('shirt') || LibraryType.startsWith('pant') || LibraryType.startsWith('mesh')) {
+ Dropdown.insertBefore(SourceLink, DownloadLink)
+ }
+
switch (LibraryType) {
case LibraryType.startsWith('model'):
DownloadLink.href = 'https://api.polytoria.com/v1/models/get-model?id=' + AssetID;
@@ -27,14 +42,28 @@ if (LibraryTypes.some(element => element.startsWith(LibraryType))) {
const AudioBlob = new Blob([document.getElementsByTagName('audio')[0]], {type: 'octet-steam'});
DownloadLink.href = URL.createObjectURL(AudioBlob);
DownloadLink.download = document.getElementsByTagName('h1')[0].innerText + '.mp3';
+
+ console.log('aaaaa')
+ SourceLink.addEventListener('click', function() {
+ console.log('LCICKED!!')
+ navigator.clipboard
+ .writeText(document.getElementsByTagName('audio')[0].src)
+ .then(() => {})
+ .catch(() => {
+ alert('Failure to copy .png file CDN url to clipboard')
+ });
+ })
+ break;
+ /*
case (LibraryType.startsWith('decal')):
const DecalBlob = new Blob([document.getElementsByClassName('store-thumbnail')[0]], {type: 'image/png'});
DownloadLink.href = URL.createObjectURL(DecalBlob);
DownloadLink.download = document.getElementsByTagName('h1')[0].innerText + '.png';
break;
+ */
}
- if (LibraryType.startsWith('shirt') || LibraryType.startsWith('pant')) {
+ if (LibraryType.startsWith('shirt') || LibraryType.startsWith('pant') || LibraryType.startsWith('decal')) {
let ClothingURL = null;
DownloadLink.addEventListener('click', async function () {
if (ClothingURL !== null) {
@@ -43,7 +72,6 @@ if (LibraryTypes.some(element => element.startsWith(LibraryType))) {
ClothingURL = (await (await fetch('https://api.polytoria.com/v1/assets/serve/' + AssetID + '/Asset')).json());
if (ClothingURL.success === true) {
- //const ClothingBlob = new Blob([(await (await fetch(ClothingURL.url)).blob())], {type: 'image/png'})
const ClothingBlob = (await (await fetch(ClothingURL.url)).blob())
DownloadLink.href = URL.createObjectURL(ClothingBlob);
DownloadLink.download = document.getElementsByTagName('h1')[0].innerText + '.png';
@@ -53,6 +81,23 @@ if (LibraryTypes.some(element => element.startsWith(LibraryType))) {
alert('Failure to fetch .png file for clothing item');
}
});
+
+ SourceLink.addEventListener('click', async function(){
+ if (ClothingURL !== null) {
+ return;
+ }
+ ClothingURL = (await (await fetch('https://api.polytoria.com/v1/assets/serve/' + AssetID + '/Asset')).json());
+
+ if (ClothingURL.success === true) {
+ navigator.clipboard.writeText(ClothingURL.url)
+ .then(() => {})
+ .catch(() => {
+ alert('Failure to copy .png file CDN url to clipboard')
+ });
+ } else {
+ alert('Failure to fetch .png file for clothing item');
+ }
+ })
} else if (LibraryType.startsWith('mesh')) {
let MeshURL = null;
DownloadLink.addEventListener('click', async function () {
@@ -70,6 +115,23 @@ if (LibraryTypes.some(element => element.startsWith(LibraryType))) {
alert('Failure to fetch .glb file for mesh');
}
});
+
+ SourceLink.addEventListener('click', async function(){
+ if (MeshURL !== null) {
+ return;
+ }
+ MeshURL = (await (await fetch('https://api.polytoria.com/v1/assets/serve-mesh/' + AssetID)).json());
+
+ if (MeshURL.success === true) {
+ navigator.clipboard.writeText(MeshURL.url)
+ .then(() => {})
+ .catch(() => {
+ alert('Failure to copy .glb file CDN url to clipboard')
+ });
+ } else {
+ alert('Failure to fetch .glb file for mesh');
+ }
+ })
}
});
}
diff --git a/js/places/place-view.js b/js/places/place-view.js
index bbaf081..12bc689 100644
--- a/js/places/place-view.js
+++ b/js/places/place-view.js
@@ -50,10 +50,6 @@ const Gamepasses = Array.from(GamepassesTab.getElementsByClassName('card')) || [
Utilities = await import(chrome.runtime.getURL('resources/utils.js'));
Utilities = Utilities.default;
- if (Settings.GD_ServerBalanceOn && PlaceID === '9656') {
- TheGreatDivide()
- }
-
if (Settings.PinnedGamesOn === true) {
PinnedGames();
}
@@ -516,37 +512,4 @@ function GetAchievementDifficulty(percent) {
} else if (percent >= 0 && percent <= 0.9) {
return 'Impossible';
}
-}
-
-// Temp Feature for The Great Divide event
-async function TheGreatDivide() {
- const Team = (await (await fetch('https://api.polytoria.com/v1/users/' + UserID + '/greatdivide')).json()).team
- if (Team !== undefined) {
- const Servers = Array.from(document.getElementById('servers-tabpane').children)
-
- Servers.forEach(server => {
- const TeamCounts = {
- phantoms: server.getElementsByClassName('border-phantoms').length,
- cobras: server.getElementsByClassName('border-cobras').length
- }
-
- let Enemy = "cobras"
- if (Team === "cobras") { Enemy = "phantoms" }
-
- if (TeamCounts[Team] < TeamCounts[Enemy]) {
- console.log(server.getElementsByTagName('button')[0])
- const UnbalancedText = document.createElement('p')
- UnbalancedText.classList = 'mb-2'
- UnbalancedText.style.fontSize = '0.7rem'
- UnbalancedText.style.color = 'orange'
- UnbalancedText.innerHTML = `*Potentially Unbalanced `
-
- const ServerInfoColumn = server.getElementsByClassName('col-3')[0]
- ServerInfoColumn.children[0].style.marginBottom = '0px'
- ServerInfoColumn.insertBefore(UnbalancedText, ServerInfoColumn.children[1])
-
- Utilities.InjectResource("registerTooltips")
- }
- })
- }
}
\ No newline at end of file
diff --git a/js/sitewide.js b/js/sitewide.js
index 7dca3c2..c5292b6 100755
--- a/js/sitewide.js
+++ b/js/sitewide.js
@@ -1,227 +1,214 @@
+console.log('start of script')
+
var Settings;
let Theme = ``;
(async () => {
+ console.log('start of async')
let Utilities = await import(chrome.runtime.getURL('resources/utils.js'));
Utilities = Utilities.default;
+ console.log('imported utils')
chrome.storage.sync.get(['PolyPlus_Settings'], function (result) {
- // Merge settings and expected settings to make sure all keys exist
- const RawSettings = result.PolyPlus_Settings;
- Settings = MergeObjects(RawSettings || Utilities.DefaultSettings, Utilities.DefaultSettings);
+ console.log("fetched settings: ", result)
+ // Merge settings and expected settings to make sure all keys exist
+ const RawSettings = result.PolyPlus_Settings;
+ Settings = Utilities.MergeObjects(RawSettings || Utilities.DefaultSettings, Utilities.DefaultSettings);
- // Apply theme settings after Settings is defined
- applyThemeSettings();
- });
-})();
+ const PageLoad = async function() {
+ console.log("fired dom load")
+ if (document.getElementsByClassName('card-header')[0] && document.getElementsByClassName('card-header')[0].innerText === ' Page not found') {
+ return;
+ }
+ console.log("passed error check")
-function applyThemeSettings() {
- // If theme exists, create a style element to represent it
- if (Settings.ThemeCreator && Settings.ThemeCreator.Enabled === true) {
- switch (Settings.ThemeCreator.BGImageSize) {
- case 0:
- Settings.ThemeCreator.BGImageSize = 'fit';
- break;
- case 1:
- Settings.ThemeCreator.BGImageSize = 'cover';
- break;
- case 2:
- Settings.ThemeCreator.BGImageSize = 'contain';
- break;
+ Utilities.InjectResource('getUserDetails');
+ document.body.setAttribute('data-URL', window.location.pathname);
+
+ if (Settings.IRLPriceWithCurrency && Settings.IRLPriceWithCurrency.Enabled === true) {
+ const IRLResult = await Utilities.CalculateIRL(document.querySelector('.brickBalanceCont').innerText.replace(/\s+/g, ''), Settings.IRLPriceWithCurrency.Currency);
+ // Desktop
+ document.querySelector('.text-success .brickBalanceCount').innerHTML += ` (${IRLResult.icon}${IRLResult.result} ${IRLResult.display})`;
+
+ // Mobile
+ document.querySelector('.text-success .brickBalanceCont').innerHTML += ` (${IRLResult.icon}${IRLResult.result} ${IRLResult.display})`;
+ //document.querySelector('.text-success .brickBalanceCont').innerHTML += `(${IRLResult.icon}${IRLResult.result} ${IRLResult.display})
`
+ }
+
+ if (Settings.ModifyNavOn && Settings.ModifyNavOn === true) {
+ let NavbarItems = document.querySelectorAll('.navbar-nav.me-auto a.nav-link[href]');
+ let Needed = [NavbarItems[11], NavbarItems[12], NavbarItems[13], NavbarItems[14], NavbarItems[15]];
+ for (let i = 0; i < Settings.ModifyNav.length; i++) {
+ if (Settings.ModifyNav[i].Label != null) {
+ Needed[i].children[1].innerText = Settings.ModifyNav[i].Label;
+ Needed[i].href = Settings.ModifyNav[i].Link;
+ }
+ }
+ }
}
- Theme += `
- :root {
- --polyplus-navbgcolor: ${Settings.ThemeCreator.NavBGColor};
- --polyplus-navbordercolor: ${Settings.ThemeCreator.NavBorderColor};
- --polyplus-navitemcolor: ${Settings.ThemeCreator.NavItemColor};
- --polyplus-sidebarbgcolor: ${Settings.ThemeCreator.SideBGColor};
- --polyplus-sidebarbordercolor: ${Settings.ThemeCreator.SideBorderColor};
- --polyplus-sidebaritembgcolor: ${Settings.ThemeCreator.SideItemBGColor};
- --polyplus-sidebaritembordercolor: ${Settings.ThemeCreator.SideItemBorderColor};
- --polyplus-sidebaritemcolor: ${Settings.ThemeCreator.SideItemColor};
- --polyplus-sidebaritemlabelcolor: ${Settings.ThemeCreator.SideItemLabelColor};
- --polyplus-bgcolor: ${Settings.ThemeCreator.BGColor};
- --polyplus-bgimage: url(${Settings.ThemeCreator.BGImage});
- --polyplus-bgimagesize: ${Settings.ThemeCreator.BGImageSize};
- --polyplus-primarytextcolor: ${Settings.ThemeCreator.PrimaryTextColor};
- --polyplus-secondarytextcolor: ${Settings.ThemeCreator.SecondaryTextColor};
- --polyplus-linktextcolor: ${Settings.ThemeCreator.LinkTextColor};
- --polyplus-linkhoveredtextcolor: ${Settings.ThemeCreator.LinkHoveredTextColor};
- --polyplus-linkfocusedtextcolor: ${Settings.ThemeCreator.LinkFocusedTextColor};
- --polyplus-linkvisitedtextcolor: ${Settings.ThemeCreator.LinkVisitedTextColor};
- --polyplus-cardheadbgcolor: ${Settings.ThemeCreator.CardHeadBGColor};
- --polyplus-cardbodybgcolor: ${Settings.ThemeCreator.CardBodyBGColor};
- --polyplus-cardbordercolor: ${Settings.ThemeCreator.CardBorderColor};
- }
-
- nav {
- background-color: var(--polyplus-navbgcolor) !important;
- border-bottom: 1px solid var(--polyplus-navbordercolor) !important;
- }
-
- .nav-sidebar {
- background-color: var(--polyplus-sidebarbgcolor) !important;
- border-right: 1px solid var(--polyplus-sidebarbordercolor) !important;
- }
-
- #app {
- background-color: var(--polyplus-bgcolor) !important;
- background-image: var(--polyplus-bgimage) !important;
- background-size var(--polyplus-bgimagesize)
- color: var(--polyplus-primarytextcolor) !important;
- }
-
- .text-muted {
- color: var(--polyplus-secondarytextcolor) !important;
- }
-
- a {
- color: var(--polyplus-linktextcolor) !important;
- }
-
- a:hover {
- color: var(--polyplus-linkhoveredtextcolor) !important;
- }
-
- a:focus {
- color: var(--polyplus-linkfocusedtextcolor) !important;
- }
-
- /*
- a:visited {
- color: var(--polyplus-linkvisitedtextcolor) !important;
- }
- */
-
- .card-header {
- background-color: var(--polyplus-cardheadbgcolor) !important;
- }
-
- .card {
- background-color: var(--polyplus-cardbodybgcolor) !important;
- border-color: var(--polyplus-cardbordercolor) !important;
- }
-
- nav a.nav-link {
- color: var(--polyplus-navitemcolor) !important;
- }
-
- .nav-sidebar .nav-sidebar-button {
- background-color: var(--polyplus-sidebaritembgcolor) !important;
- border-color: var(--polyplus-sidebaritembordercolor) !important;
- color: var(--polyplus-sidebaritemcolor) !important;
- }
-
- .nav-sidebar-text {
- color: var(--polyplus-sidebaritemlabelcolor) !important;
- }
- `;
- }
-
- const combination = "reload";
- let currentCombination = "";
- document.addEventListener("keypress", function (e) {
- currentCombination += e.key;
- if (currentCombination === combination && document.activeElement.tagName !== "INPUT" && document.activeElement.tagName !== "TEXTAREA") {
- console.log("Reloading Poly+...");
- chrome.runtime.sendMessage({ action: "reload" });
- window.location.reload();
- } else if (!combination.startsWith(currentCombination)) {
- currentCombination = "";
+ if (document.readyState === 'complete') {
+ PageLoad()
+ } else {
+ document.addEventListener('DOMContentLoaded', PageLoad);
}
- });
- if (Settings.HideUserAds && Settings.HideUserAds.Enabled === true) {
- if (Settings.HideUserAds.Banners && Settings.HideUserAds.Banners === true) {
- Theme += `
+ // Apply Theme
+ LoadTheme();
+
+ const combination = "reload";
+ let currentCombination = "";
+ document.addEventListener("keypress", function (e) {
+ currentCombination += e.key;
+ if (currentCombination === combination && document.activeElement.tagName !== "INPUT" && document.activeElement.tagName !== "TEXTAREA") {
+ console.log("Reloading Poly+...");
+ chrome.runtime.sendMessage({ action: "reload" });
+ window.location.reload();
+ } else if (!combination.startsWith(currentCombination)) {
+ currentCombination = "";
+ }
+ });
+
+ if (Settings.HideUserAds && Settings.HideUserAds.Enabled === true) {
+ if (Settings.HideUserAds.Banners && Settings.HideUserAds.Banners === true) {
+ Theme += `
div[style^="max-width: 728px;"]:has(a[href^="/ads"]) {
display: none;
}
`;
- }
+ }
- if (Settings.HideUserAds.Rectangles && Settings.HideUserAds.Rectangles === true) {
- Theme += `
+ if (Settings.HideUserAds.Rectangles && Settings.HideUserAds.Rectangles === true) {
+ Theme += `
div[style^="max-width: 300px;"]:has(a[href^="/ads"]) {
display: none;
}
`;
+ }
}
- }
- if (Settings.HideNotifBadgesOn === true) {
- Theme += `
- .notif-nav .notif-sidebar {
+ if (Settings.HideNotifBadgesOn === true) {
+ document.getElementsByClassName('notifications-toggle')[0].getElementsByTagName('i')[0].classList = 'fa-bell far'
+ Theme += `
+ .notif-nav.notif-sidebar {
+ display: none;
+ }
+
+ .notifications-toggle {
+ opacity: 0.6;
+ }
+
+ .notifications-toggle .unread-indicator {
display: none;
}
`;
- }
-
- // Credit to @SK-Fast (also known as DevPixels) for the improved loading code (taken from his original Poly+, and reformatted to Index Poly+)
- const ThemeBlob = new Blob([Theme], { type: 'text/css' });
- const ThemeURL = URL.createObjectURL(ThemeBlob);
- document.head.innerHTML += ` `;
-
- document.addEventListener('DOMContentLoaded', async function () {
- if (document.getElementsByClassName('card-header')[0] && document.getElementsByClassName('card-header')[0].innerText === ' Page not found') {
- return;
- }
-
- Utilities.InjectResource('getUserDetails');
- document.body.setAttribute('data-URL', window.location.pathname);
-
- const UserData = JSON.parse(window.localStorage.getItem('p+account_info'));
-
- if (Settings.IRLPriceWithCurrency && Settings.IRLPriceWithCurrency.Enabled === true) {
- const IRLResult = await Utilities.CalculateIRL(document.querySelector('.brickBalanceCont').innerText.replace(/\s+/g, ''), Settings.IRLPriceWithCurrency.Currency);
- // Desktop
- document.querySelector('.text-success .brickBalanceCount').innerHTML += ` (${IRLResult.icon}${IRLResult.result} ${IRLResult.display})`;
-
- // Mobile
- document.querySelector('.text-success .brickBalanceCont').innerHTML += ` (${IRLResult.icon}${IRLResult.result} ${IRLResult.display})`;
- //document.querySelector('.text-success .brickBalanceCont').innerHTML += `(${IRLResult.icon}${IRLResult.result} ${IRLResult.display})
`
- }
-
- if (Settings.ModifyNavOn && Settings.ModifyNavOn === true) {
- let NavbarItems = document.querySelectorAll('.navbar-nav.me-auto a.nav-link[href]');
- let Needed = [NavbarItems[11], NavbarItems[12], NavbarItems[13], NavbarItems[14], NavbarItems[15]];
- for (let i = 0; i < Settings.ModifyNav.length; i++) {
- if (Settings.ModifyNav[i].Label != null) {
- console.log(Needed[i], Needed[i].children[1]);
- Needed[i].children[1].innerText = Settings.ModifyNav[i].Label;
- Needed[i].href = Settings.ModifyNav[i].Link;
- }
- }
- }
-
- /*
- if (Settings.HideUserAdsOn === true) {
- Array.from(document.querySelectorAll('.text-center:has(a[href^="/ads"])')).forEach(ad => {ad.remove()})
- }
- */
-
- if (Settings.HideNotifBadgesOn === true) {
- document.getElementsByClassName('notif-nav notif-sidebar').forEach((element) => {
- element.remove();
- });
}
+
+ // Credit to @SK-Fast (also known as DevPixels) for the improved loading code (taken from his original Poly+, and reformatted to Index Poly+)
+ const ThemeBlob = new Blob([Theme], { type: 'text/css' });
+ const ThemeURL = URL.createObjectURL(ThemeBlob);
+ document.head.innerHTML += ` `;
});
-}
+})();
-function MergeObjects(obj1, obj2) {
- var mergedObj = {};
+function LoadTheme() {
+ if (!Settings.ThemeCreator || Settings.ThemeCreator.Enabled !== true) { return }
- // Copy the values from obj1 to the mergedObj
- for (var key in obj1) {
- mergedObj[key] = obj1[key];
+ switch (Settings.ThemeCreator.BGImageSize) {
+ case 0:
+ Settings.ThemeCreator.BGImageSize = 'fit';
+ break;
+ case 1:
+ Settings.ThemeCreator.BGImageSize = 'cover';
+ break;
+ case 2:
+ Settings.ThemeCreator.BGImageSize = 'contain';
+ break;
+ }
+ Theme += `
+ :root {
+ --polyplus-navbgcolor: ${Settings.ThemeCreator.NavBGColor};
+ --polyplus-navbordercolor: ${Settings.ThemeCreator.NavBorderColor};
+ --polyplus-navitemcolor: ${Settings.ThemeCreator.NavItemColor};
+ --polyplus-sidebarbgcolor: ${Settings.ThemeCreator.SideBGColor};
+ --polyplus-sidebarbordercolor: ${Settings.ThemeCreator.SideBorderColor};
+ --polyplus-sidebaritembgcolor: ${Settings.ThemeCreator.SideItemBGColor};
+ --polyplus-sidebaritembordercolor: ${Settings.ThemeCreator.SideItemBorderColor};
+ --polyplus-sidebaritemcolor: ${Settings.ThemeCreator.SideItemColor};
+ --polyplus-sidebaritemlabelcolor: ${Settings.ThemeCreator.SideItemLabelColor};
+ --polyplus-bgcolor: ${Settings.ThemeCreator.BGColor};
+ --polyplus-bgimage: url(${Settings.ThemeCreator.BGImage});
+ --polyplus-bgimagesize: ${Settings.ThemeCreator.BGImageSize};
+ --polyplus-primarytextcolor: ${Settings.ThemeCreator.PrimaryTextColor};
+ --polyplus-secondarytextcolor: ${Settings.ThemeCreator.SecondaryTextColor};
+ --polyplus-linktextcolor: ${Settings.ThemeCreator.LinkTextColor};
+ --polyplus-linkhoveredtextcolor: ${Settings.ThemeCreator.LinkHoveredTextColor};
+ --polyplus-linkfocusedtextcolor: ${Settings.ThemeCreator.LinkFocusedTextColor};
+ --polyplus-linkvisitedtextcolor: ${Settings.ThemeCreator.LinkVisitedTextColor};
+ --polyplus-cardheadbgcolor: ${Settings.ThemeCreator.CardHeadBGColor};
+ --polyplus-cardbodybgcolor: ${Settings.ThemeCreator.CardBodyBGColor};
+ --polyplus-cardbordercolor: ${Settings.ThemeCreator.CardBorderColor};
}
- // 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];
- }
+ nav {
+ background-color: var(--polyplus-navbgcolor) !important;
+ border-bottom: 1px solid var(--polyplus-navbordercolor) !important;
}
- return mergedObj;
-}
+ .nav-sidebar {
+ background-color: var(--polyplus-sidebarbgcolor) !important;
+ border-right: 1px solid var(--polyplus-sidebarbordercolor) !important;
+ }
+
+ #app {
+ background-color: var(--polyplus-bgcolor) !important;
+ background-image: var(--polyplus-bgimage) !important;
+ background-size var(--polyplus-bgimagesize)
+ color: var(--polyplus-primarytextcolor) !important;
+ }
+
+ .text-muted {
+ color: var(--polyplus-secondarytextcolor) !important;
+ }
+
+ a {
+ color: var(--polyplus-linktextcolor) !important;
+ }
+
+ a:hover {
+ color: var(--polyplus-linkhoveredtextcolor) !important;
+ }
+
+ a:focus {
+ color: var(--polyplus-linkfocusedtextcolor) !important;
+ }
+
+ /*
+ a:visited {
+ color: var(--polyplus-linkvisitedtextcolor) !important;
+ }
+ */
+
+ .card-header {
+ background-color: var(--polyplus-cardheadbgcolor) !important;
+ }
+
+ .card {
+ background-color: var(--polyplus-cardbodybgcolor) !important;
+ border-color: var(--polyplus-cardbordercolor) !important;
+ }
+
+ nav a.nav-link {
+ color: var(--polyplus-navitemcolor) !important;
+ }
+
+ .nav-sidebar .nav-sidebar-button {
+ background-color: var(--polyplus-sidebaritembgcolor) !important;
+ border-color: var(--polyplus-sidebaritembordercolor) !important;
+ color: var(--polyplus-sidebaritemcolor) !important;
+ }
+
+ .nav-sidebar-text {
+ color: var(--polyplus-sidebaritemlabelcolor) !important;
+ }
+ `;
+}
\ No newline at end of file
diff --git a/js/store/item-view.js b/js/store/item-view.js
index af8e093..c9d3ab7 100755
--- a/js/store/item-view.js
+++ b/js/store/item-view.js
@@ -308,13 +308,11 @@ function TryOnItems() {
- `;
+ `;
document.body.prepend(TryOnModal);
ItemThumbnail.parentElement.appendChild(TryOnBtn);
TryOnModal.children[1].prepend(TryIFrame);
-
- //Utilities.InjectResource('registerTooltips')
}
async function HoardersList(min, avatars) {
@@ -324,21 +322,21 @@ async function HoardersList(min, avatars) {
const Tab = document.createElement('li');
Tab.classList = 'nav-item';
Tab.innerHTML = `
-
-
- Hoarders
-
- `;
+
+
+ Hoarders
+
+ `;
Tabs.appendChild(Tab);
const TabContent = document.createElement('div');
TabContent.classList = 'd-none';
TabContent.innerHTML = `
-
- loading... (this may take a few seconds)
-
-
- `;
+
+ loading... (this may take a few seconds)
+
+
+ `;
document.getElementById('owners').parentElement.appendChild(TabContent);
// Add tab logic
@@ -645,13 +643,13 @@ function CheckOwner() {
const CheckOwnerDiv = document.createElement('div');
CheckOwnerDiv.classList = 'mt-3 d-none';
CheckOwnerDiv.innerHTML = `
-
-
- Check
-
+
+
+ Check
+
- ...
- `;
+ ...
+ `;
ImageCard.appendChild(CheckOwnerDiv);
@@ -698,7 +696,7 @@ function CheckOwner() {
if (Owns.owned === true) {
ResultText.classList = 'text-success';
- ResultText.innerHTML = ' ' + Username + ' owns #' + Owns.inventory.serial + ' of ' + document.getElementsByTagName('h1')[0].innerText + '".';
+ ResultText.innerHTML = ' ' + Username + ' owns #' + Owns.inventory.serial + ' of "' + document.getElementsByTagName('h1')[0].innerText + '".';
} else {
ResultText.classList = 'text-danger';
ResultText.innerHTML = ' ' + Username + ' does not own "' + document.getElementsByTagName('h1')[0].innerText + '".';
diff --git a/js/store/store.js b/js/store/store.js
index f8d5b3d..83f6fea 100755
--- a/js/store/store.js
+++ b/js/store/store.js
@@ -21,24 +21,37 @@ chrome.storage.sync.get(['PolyPlus_Settings'], async function (result) {
});
}
- if (Settings.StoreOwnTagOn === true) {
- Inventory = (await (await fetch('https://api.polytoria.com/v1/users/' + UserID + '/inventory?type=hat&limit=100')).json());
- if (Inventory.errors === undefined) {
- Inventory = Inventory.inventory
- Inventory.concat(await (await fetch('https://api.polytoria.com/v1/users/' + UserID + '/inventory?type=face&limit=100')).json()).inventory;
- Inventory.concat(await (await fetch('https://api.polytoria.com/v1/users/' + UserID + '/inventory?type=tool&limit=100')).json()).inventory;
- console.log(Inventory);
- Array.from(ItemGrid.children).forEach((element) => {
- LoadOwnedTags(element);
- });
- } else {
- console.log(Inventory)
- }
- }
-
if (Settings.EventItemsCatOn === true) {
EventItems();
}
+
+ if (Settings.StoreOwnTagOn === true) {
+ chrome.storage.local.get('PolyPlus_InventoryCache', async function(result){
+ console.log(result)
+ if (result.PolyPlus_InventoryCache !== undefined && (new Date().getTime() - result.PolyPlus_InventoryCache[1] < 5000)) {
+ console.log('not undefined')
+ Inventory = result.PolyPlus_InventoryCache[0]
+ Array.from(ItemGrid.children).forEach((element) => {
+ LoadOwnedTags(element);
+ });
+ } else {
+ Inventory = (await (await fetch('https://api.polytoria.com/v1/users/' + UserID + '/inventory?type=hat&limit=100')).json());
+ if (Inventory.errors === undefined) {
+ Inventory = Inventory.inventory
+ Inventory = [...Inventory, ...(await (await fetch('https://api.polytoria.com/v1/users/' + UserID + '/inventory?type=face&limit=100')).json()).inventory];
+ Inventory = [...Inventory, ...(await (await fetch('https://api.polytoria.com/v1/users/' + UserID + '/inventory?type=tool&limit=100')).json()).inventory];
+ Inventory = [...Inventory, ...(await (await fetch('https://api.polytoria.com/v1/users/' + UserID + '/inventory?type=profileTheme&limit=100')).json()).inventory];
+ console.log(Inventory);
+ chrome.storage.local.set({'PolyPlus_InventoryCache': [Inventory, new Date().getTime()]}, function(){})
+ Array.from(ItemGrid.children).forEach((element) => {
+ LoadOwnedTags(element);
+ });
+ } else {
+ console.log(Inventory)
+ }
+ }
+ })
+ }
});
const observer = new MutationObserver(async function (list) {
diff --git a/resources/avatar-sandbox.html b/resources/avatar-sandbox.html
index 90eacd6..b6ec7be 100755
--- a/resources/avatar-sandbox.html
+++ b/resources/avatar-sandbox.html
@@ -2,9 +2,26 @@
#options {
position: absolute;
bottom: 0;
- margin: 20px;
- margin-bottom: 40px;
+ margin-bottom: 15px;
font-size: 1.25rem;
+ background: #1a1a1a;
+ border-radius: 10px;
+ padding: 2.5px;
+ font-size: 1.25rem;
+
+ /*
+ button iteration #2
+
+ font-size: 1.25rem;
+ background: #333333;
+ border-radius: var(--bs-card-border-radius);
+ padding: 2.5px;
+ font-size: 1.25rem;
+ left: -1px;
+ bottom: -1px;
+ border-top-left-radius: 0px;
+ border-bottom-right-radius: 0px;
+ */
}
#options *:not(input) {
@@ -18,12 +35,15 @@
margin-bottom: 3.5px;
}
+
+ The Avatar Sandbox is currently being rewritten to have better caching and better, more reliable code. It should be included in v1.2.3
+
+
+
+ Load Myself
+
-
-
-
- Myself
-
-
Clear
+
+
+
+ Save
+
+
Hat
+ Tool
Face
+
Shirt
Pants
@@ -89,13 +115,13 @@
-
+
+
+
-
+
+
@@ -137,7 +163,29 @@
@@ -145,3 +193,8 @@
+
\ No newline at end of file
diff --git a/resources/utils.js b/resources/utils.js
index d1c68dd..2b67bb4 100644
--- a/resources/utils.js
+++ b/resources/utils.js
@@ -100,11 +100,20 @@ export default {
},
UploadMultipleDecals: true,
GD_ServerBalanceOn: true,
- AvatarDimensionToggleOn: true
+ AvatarDimensionToggleOn: true,
+ TheGreatDivide: {
+ Enabled: true,
+ UnbalancedIndicatorOn: true,
+ MVPUserIndicatorOn: true,
+ UserStatsOn: true,
+ LeaderboardsOn: true
+ },
+ CollectibleInventoryCatOn: true
},
Limits: {
PinnedGames: 10,
BestFriends: 15,
+ // Item Wishlist and ImprovedFrLists limit here is not implemented in the code
ImprovedFrLists: 20,
ItemWishlist: 20,
HoardersListPages: 4
@@ -201,6 +210,16 @@ export default {
Result = (bricks * 0.49).toFixed(2);
Display = 'BRL';
+ break;
+
+ // Zimbabwean Dollar
+ case 8:
+ Icon = 'Z$'
+ IsIconAbbr = true
+
+ Result = (bricks * 0.13739106).toFixed(2)
+ Display = 'ZWL'
+
break;
}
@@ -244,7 +263,7 @@ export default {
});
Node.appendChild(Script);
},
- // MergeObjects function was written by ChatGPT cause I was lazy and it was awhile ago
+ // MergeObjects function was written by ChatGPT cause I was lazy and it was a while ago
MergeObjects: function(obj1, obj2) {
var mergedObj = {};
diff --git a/settings.html b/settings.html
index af33b8c..164c3b0 100755
--- a/settings.html
+++ b/settings.html
@@ -278,21 +278,54 @@
-
Poly+ Settings
-
+
+ Poly+ Settings
+
+
- "Potentially Unbalanced" Server Tag
- Toggle
+ The Great Divide
+ Toggle
-
Quickly check if The Great Divide official event place servers are balanced or not! To be unbalanced, the team opposite of you has to have at least 1 more member in the server than you.
-
+
Reinforcements to aid in your quest to bring home the victory to your team, and bring honor to your peers.
+
+
+
+ "Potentially Unbalanced" indicator in server list
+
+
+
+
+ User Statistics tab on profiles
+
+
+
+
+ * some features use @dargy 's public API! thank you!
+
* available until July 14th
@@ -315,19 +348,8 @@
Get a quick link to the popular person everyone is talking about's profile!
-
* Forum Mentions do not notify the user or show up as a notification on their account.
+
* Forum Mentions do not notify the user or show up as a notification on their account.
-
@@ -338,18 +360,7 @@
Accept or decline all friend requests with the click of a button or multi-remove existing friends!
- * You can only remove up to friends at once.
-
-
-
-
-
- Upload multiple decals
- Toggle
-
-
-
- Lets you quickly upload multiple decals at once!
+ * You can only remove up to friends at once.
@@ -362,9 +373,9 @@
See the real life currency value along with Bricks across the site!
- * Currencies were calculated on [DATE] .
+ * Currencies were calculated on [DATE] .
- * Currencies other than USD are purely approximations.
+ * Currencies other than USD are purely approximations.
United States Dollar (USD)
@@ -375,6 +386,7 @@
Australian Dollar (AUD)
Turkish Lira (TRY)
Brazilian Real (BRL)
+ Zimbabwean Dollar (ZWL)