Improvements

- "Run Update Notifier" context menu item now only runs on the developer debug page and nowhere else

- Settings are automatically saved whenever you edit the value of a select field

- Added accurate names for element IDs on the settings page so I can link to them

- If there is a hash/anchor URL specified in the settings page redirect URL it will carry the hash/anchor URL over to the local page URL
This commit is contained in:
Index 2024-03-07 14:59:37 -06:00
parent f4a8163745
commit 2e146391b1
4 changed files with 23 additions and 21 deletions

View file

@ -76,8 +76,7 @@ chrome.contextMenus.create({
id: 'PolyPlus-RunUpdateNotifier',
contexts: ['all'],
documentUrlPatterns: [
"https://polytoria.com/*",
SettingsURL
"https://polytoria.com/my/settings/polyplus-debug",
]
});

View file

@ -1,5 +1,7 @@
const InExtensionSettings = (window.location.pathname.split('/')[3] === "polyplus")
if (InExtensionSettings === true) { window.location.href = chrome.runtime.getURL('settings.html') }
if (InExtensionSettings === true) {
window.location.href = chrome.runtime.getURL('settings.html') + window.location.hash
}
document.addEventListener('DOMContentLoaded', function(){
const Nav = document.getElementsByClassName('nav nav-pills')[0]

View file

@ -320,7 +320,7 @@
</dialog>
<div id="page">
<h1 class="text-center">Poly+ Settings</h1>
<p class="setting-container">
<p class="setting-container" id="pinned-games">
<span class="indicator">&nbsp;</span>
<span class="title">
Pinned Games
@ -329,7 +329,7 @@
<br>
<span class="desc">Pin your favorite places to the top of the homepage! (limit: 5 places)</span>
</p>
<p class="setting-container" id="ForumMentions">
<p class="setting-container" id="forum-mentions">
<span class="indicator">&nbsp;</span>
<span class="title">
Forum Mentions
@ -340,7 +340,7 @@
<br>
<span style="font-size: 0.8rem; color: orange;">* Forum Mentions do not notify the user.</span>
</p>
<p class="setting-container" id="BestFriends">
<p class="setting-container" id="best-friends">
<span class="indicator">&nbsp;</span>
<span class="title">
Best Friends
@ -349,7 +349,7 @@
<br>
<span class="desc">Prioritize the bestest of friends on applicable friend lists! (limit: 7 best friends)</span>
</p>
<p class="setting-container" id="ImprovedFriendLists">
<p class="setting-container" id="improved-friend-lists">
<span class="indicator">&nbsp;</span>
<span class="title">
Improved Friend Lists
@ -362,7 +362,7 @@
<span style="font-size: 0.8rem; color: orange;">* You can only remove up to 25 friends at once.</span>
</span>
</p>
<p class="setting-container" id="IRLPriceWithCurrency">
<p class="setting-container" id="irl-price-with-brick-count">
<span class="indicator">&nbsp;</span>
<span class="title">
Show IRL price with Brick Count
@ -397,7 +397,7 @@
</select>
-->
</p>
<p class="setting-container" id="HideNotifBadges">
<p class="setting-container" id="hide-notification-badges">
<span class="indicator">&nbsp;</span>
<span class="title">
Hide Notification Badges
@ -406,7 +406,7 @@
<br>
<span class="desc">Hide the annoying red circles on the sidebar!</span>
</p>
<p class="setting-container" id="StoreOwnTag">
<p class="setting-container" id="store-own-tag">
<span class="indicator">&nbsp;</span>
<span class="title">
Show "OWNED" Tag on Store Main Page
@ -415,7 +415,7 @@
<br>
<span class="desc">Quickly see if you own the item at a glance with a little tag in the top left corner of item cards on the main store page!</span>
</p>
<p class="setting-container" id="ThemeCreator">
<p class="setting-container" id="theme-creator">
<span class="indicator">&nbsp;</span>
<span class="title">
Theme Creator
@ -425,7 +425,7 @@
<br>
<span class="desc">Unleash your creativity and customize the Polytoria website to your liking! (this feature is still in development)</span>
</p>
<p class="setting-container" id="MoreSearchFilters">
<p class="setting-container" id="more-search-filters">
<span class="indicator">&nbsp;</span>
<span class="title">
More Search Filters
@ -434,7 +434,7 @@
<br>
<span class="desc">Easily find what you're looking for with more search filters side-wide! (this does not affect the main site search on the navbar)</span>
</p>
<p class="setting-container" id="ApplyMembershipTheme">
<p class="setting-container" id="apply-membership-theme">
<span class="indicator">&nbsp;</span>
<span class="title">
Apply Membership Theme for <b>Free</b>
@ -447,7 +447,7 @@
<option value="PlusDX">Plus Deluxe</option>
</select>
</p>
<p class="setting-container" id="MultiCancelOutTrades">
<p class="setting-container" id="multi-cancel-outbound-trades">
<span class="indicator">&nbsp;</span>
<span class="title">
Multi-Cancel Outbound Trades
@ -460,7 +460,7 @@
<span style="font-size: 0.8rem; color: orange;">* You can only cancel up to 10 trades at once.</span>
</span>
</p>
<p class="setting-container" id="ModifyNav">
<p class="setting-container" id="modify-navbar">
<span class="indicator">&nbsp;</span>
<span class="title">
Modify Navbar
@ -472,7 +472,7 @@
Customize the navbar to your liking!
</span>
</p>
<p class="setting-container" id="ItemWishlist">
<p class="setting-container" id="item-wishlist">
<span class="indicator">&nbsp;</span>
<span class="title">
Item Wishlist
@ -483,7 +483,7 @@
Wishlist that item that you REALLY want!
</span>
</p>
<p class="setting-container" id="HideUpgradeBtn">
<p class="setting-container" id="hide-upgrade-button">
<span class="indicator">&nbsp;</span>
<span class="title">
Hide Upgrade Button
@ -492,7 +492,7 @@
<br>
<span class="desc">Hide the ugly blue "Upgrade" button on the sidebar!</span>
</p>
<p class="setting-container" id="OutfitCost">
<p class="setting-container" id="outfit-cost">
<span class="indicator">&nbsp;</span>
<span class="title">
Show Outfit Cost on Profiles
@ -507,7 +507,7 @@
<p>These features are a work in progress.</p>
<hr>
<!--
<p class="setting-container" id="GameProfiles">
<p class="setting-container" id="game-profiles">
<span class="indicator">&nbsp;</span>
<span class="title">
Game Profiles
@ -521,7 +521,7 @@
<span style="font-size: 0.8rem; color: orange;">* This feature will be expanded upon in the future.</span>
</p>
-->
<p class="setting-container" id="InlineEditing">
<p class="setting-container" id="inline-editing">
<span class="indicator">&nbsp;</span>
<span class="title">
Inline Editing
@ -534,7 +534,7 @@
<br>
<span style="font-size: 0.8rem; color: orange;">* This feature is not finished or polished.</span>
</p>
<p class="setting-container" id="ForumUnixStamps">
<p class="setting-container" id="forum-unix-timestamps">
<span class="indicator">&nbsp;</span>
<span class="title">
Forum Unix Timestamps

View file

@ -161,6 +161,7 @@ Elements.forEach(element => {
Array.from(Select).forEach(element => {
element.addEventListener('change', function() {
SetSetting(element.getAttribute('data-setting'), element, element.selectedIndex)
Save()
});
});
}