Skip to content

Commit

Permalink
small improvements
Browse files Browse the repository at this point in the history
- removed tabs permission apparently it was unnecessary

- fixed store main page "owned" tags when the user's inventory is private/friends-only

- fixed "creator" tags in comment sections around the site

- deleted currently-unused currencies.json resource
  • Loading branch information
indexxing committed May 29, 2024
1 parent 120f8cc commit 4bf9139
Show file tree
Hide file tree
Showing 8 changed files with 88 additions and 168 deletions.
8 changes: 3 additions & 5 deletions css/polytoria.css
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
/*
I did not create this CSS, this CSS is from Polytoria.com
I was given permission by Alyx to download and use it for the extension: https://imgur.com/a/uJW9f5i
I will remove this at request if neccessary
I did not create this CSS, this CSS is from Polytoria.com
I was given permission by Alyx to download and use it for the extension: https://imgur.com/a/uJW9f5i
I will remove this at request if neccessary
*/

@charset "UTF-8";
Expand Down
16 changes: 1 addition & 15 deletions js/background.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
const Manifest = chrome.runtime.getManifest();
const SettingsURL = chrome.runtime.getURL('settings.html');

/*
ON INSTALL:
chrome.runtime.onInstalled.addListener(() => {
chrome.tabs.create({url: 'https://polyplus.vercel.app/app/welcome.html'})
});
*/

// WHEN CLICKING ON EXTENSION ICON OPEN THE SETTINGS PAGE
chrome.action.onClicked.addListener((tab) => {
chrome.tabs.create({active: true, url: SettingsURL});
Expand Down Expand Up @@ -73,12 +65,6 @@ function RunUpdateNotifier() {
});
}
);
/*
chrome.action.setBadgeBackgroundColor(
{color: 'red'},
() => { },
);
*/
}
})
.catch((error) => {
Expand All @@ -93,7 +79,7 @@ chrome.contextMenus.removeAll(function () {
title: 'Run Update Notifier',
id: 'PolyPlus-RunUpdateNotifier',
contexts: ['all'],
documentUrlPatterns: ['https://polytoria.com/my/settings/polyplus#dev']
documentUrlPatterns: ['https://polytoria.com/my/settings/polyplus*']
});

// COPY ASSET ID CONTEXT MENU ITEM REGISTRATION
Expand Down
6 changes: 5 additions & 1 deletion js/op-comments.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/*
this script will need to be updated when the new profile URLs are fully rolled out
*/

!(() => {
let Comments = document.getElementById('comments');
const Type = window.location.pathname.split('/')[1];
Expand All @@ -21,7 +25,7 @@
const Observer = new MutationObserver(function (list) {
for (let record of list) {
for (let element of record.addedNodes) {
if (element.classList === 'card mb-3') {
if (element.classList.contains('card')) {
LoadCreatorTag(element);
}
}
Expand Down
4 changes: 2 additions & 2 deletions js/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ document.addEventListener('DOMContentLoaded', function () {
PolyPlusItem.classList = 'nav-link';
PolyPlusItem.href = SettingsURL;
PolyPlusItem.innerHTML = `
<i class="fa-regular fa-sparkles me-1"></i> <span class="pilltitle">Poly+</span>
`;
<i class="fa-regular fa-sparkles me-1"></i> <span class="pilltitle">Poly+</span>
`;

Nav.insertBefore(PolyPlusItem, Nav.getElementsByTagName('hr')[0]);
});
132 changes: 67 additions & 65 deletions js/store/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,18 @@ 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()).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);
});
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) {
Expand Down Expand Up @@ -153,52 +158,44 @@ function EventItems() {
ItemGrid.classList.remove('itemgrid');
ItemGrid.innerHTML = `
<div id="p+ei">
${Groups[Page].map(
(x, index) => `
<div class="row px-2 px-lg-0" style="animation-delay: 0.24s;">
<div class="col">
<h6 class="dash-ctitle2">${x.date}</h6>
<h5 class="dash-ctitle">${x.name}</h5>
</div>
${
x.link !== undefined
? `
<div class="col-auto d-flex align-items-center">
<a class="text-muted" href="${x.link}">
<span class="d-none d-lg-inline">${x.link.startsWith('https://polytoria.com/places/') ? 'Event Place' : 'Blog Post'}</span>
<i class="fas fa-angle-right ms-2"></i>
${Groups[Page].map((x, index) => `
<div class="row px-2 px-lg-0" style="animation-delay: 0.24s;">
<div class="col">
<h6 class="dash-ctitle2">${x.date}</h6>
<h5 class="dash-ctitle">${x.name}</h5>
</div>
${x.link !== undefined ? `
<div class="col-auto d-flex align-items-center">
<a class="text-muted" href="${x.link}">
<span class="d-none d-lg-inline">${x.link.startsWith('https://polytoria.com/places/') ? 'Event Place' : 'Blog Post'}</span>
<i class="fas fa-angle-right ms-2"></i>
</a>
</div>
`
: ''
}
</div>
<div class="card card-dash mcard mb-3" style="animation-delay: 0.27s;">
<div class="card-body p-0 m-1 scrollFadeContainer">
<div class="d-flex">
${x.items.map((x) => `
<a href="/store/${x.id}">
<div class="scrollFade card me-2 place-card force-desktop text-center mb-2" style="opacity: 1;">
<div class="card-body">
<img src="${x.thumbnail}" class="place-card-image">
<div>
<div class="mt-2 mb-1 place-card-title">
${x.name}
</div>
</div>
</div>
</div>
</a>
`).join('')}
</div>
`
: ''
}
</div>
<div class="card card-dash mcard mb-3" style="animation-delay: 0.27s;">
<div class="card-body p-0 m-1 scrollFadeContainer">
<div class="d-flex">
${x.items
.map(
(x) => `
<a href="/store/${x.id}">
<div class="scrollFade card me-2 place-card force-desktop text-center mb-2" style="opacity: 1;">
<div class="card-body">
<img src="${x.thumbnail}" class="place-card-image">
<div>
<div class="mt-2 mb-1 place-card-title">
${x.name}
</div>
</div>
</div>
</div>
</a>
`
)
.join('')}
</div>
</div>
</div>
`
).join('')}
</div>
</div>
`).join('')}
</div>
<div class="d-flex justify-content-center mt-3">
Expand Down Expand Up @@ -280,20 +277,27 @@ function EventItems() {

const UpdateEventItems = function () {
Current.innerText = Page + 1;
Container.innerHTML = Groups[Page].map(
(x, index) => `
<div class="row px-2 px-lg-0" style="animation-delay: 0.24s;">
<div class="col">
<h6 class="dash-ctitle2">${x.date}</h6>
<h5 class="dash-ctitle">${x.name}</h5>
</div>
</div>
Container.innerHTML = Groups[Page].map((x, index) => `
<div class="row px-2 px-lg-0" style="animation-delay: 0.24s;">
<div class="col">
<h6 class="dash-ctitle2">${x.date}</h6>
<h5 class="dash-ctitle">${x.name}</h5>
</div>
${x.link !== undefined ? `
<div class="col-auto d-flex align-items-center">
<a class="text-muted" href="${x.link}">
<span class="d-none d-lg-inline">${x.link.startsWith('https://polytoria.com/places/') ? 'Event Place' : 'Blog Post'}</span>
<i class="fas fa-angle-right ms-2"></i>
</a>
</div>
`
: ''
}
</div>
<div class="card card-dash mcard mb-3" style="animation-delay: 0.27s;">
<div class="card-body p-0 m-1 scrollFadeContainer">
<div class="d-flex">
${x.items
.map(
(x) => `
${x.items.map((x) => `
<a href="/store/${x.id}">
<div class="scrollFade card me-2 place-card force-desktop text-center mb-2" style="opacity: 1;">
<div class="card-body">
Expand All @@ -306,9 +310,7 @@ function EventItems() {
</div>
</div>
</a>
`
)
.join('')}
`).join('')}
</div>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"version_name": "Pre-Release Build (v1.1.1)",
"description": "Power-up your Polytoria experience with Poly+! Created by Index.",
"homepage_url": "https://polyplus.vercel.app/",
"permissions": ["storage", "contextMenus", "tabs", "scripting", "alarms", "notifications"],
"permissions": ["storage", "contextMenus", "scripting", "alarms", "notifications"],
"content_scripts": [
{
"matches": ["https://polytoria.com/*"],
Expand Down
59 changes: 0 additions & 59 deletions resources/currencies.json

This file was deleted.

29 changes: 9 additions & 20 deletions settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -390,15 +390,15 @@ <h1 class="text-center" style="text-shadow: 0px 0px 5px orange; padding-bottom:
<option value="BRL">Brazilian Real (BRL)</option>
</select>
<!--
<select id="IRLPriceWithCurrencyPackage" class="form-select form-select-sm mb-2" style="width:350px;" data-setting="Package" data-parent="IRLPriceWithCurrency">
<option value="0" selected>$0.99 Brick Package</option>
<option value="1">$4.99 Brick Package</option>
<option value="2">$9.99 Brick Package</option>
<option value="3">$24.99 Brick Package</option>
<option value="4">$49.99 Brick Package</option>
<option value="5">$99.99 Brick Package</option>
</select>
-->
<select id="IRLPriceWithCurrencyPackage" class="form-select form-select-sm mb-2" style="width:350px;" data-setting="Package" data-parent="IRLPriceWithCurrency">
<option value="0" selected>$0.99 Brick Package</option>
<option value="1">$4.99 Brick Package</option>
<option value="2">$9.99 Brick Package</option>
<option value="3">$24.99 Brick Package</option>
<option value="4">$49.99 Brick Package</option>
<option value="5">$99.99 Brick Package</option>
</select>
-->
</p>
<p class="setting-container" id="hide-notification-badges">
<span class="indicator">&nbsp;</span>
Expand Down Expand Up @@ -484,17 +484,6 @@ <h1 class="text-center" style="text-shadow: 0px 0px 5px orange; padding-bottom:
<br />
<span class="desc"> Wishlist that item that you REALLY want! </span>
</p>
<!--
<p class="setting-container" id="hide-upgrade-button">
<span class="indicator">&nbsp;</span>
<span class="title">
Hide Upgrade Button
<button class="btn btn-sm toggle-btn" data-setting="HideUpgradeBtnOn">Toggle</button>
</span>
<br>
<span class="desc">Hide the ugly blue "Upgrade" button on the sidebar!</span>
</p>
-->
<p class="setting-container" id="try-on-items">
<span class="indicator">&nbsp;</span>
<span class="title">
Expand Down

0 comments on commit 4bf9139

Please sign in to comment.