Final Changes before Public Beta
This commit is contained in:
parent
976cdfbf25
commit
df14f2ea17
10 changed files with 129 additions and 111 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
> BETA Testing
|
> Public BETA Testing
|
||||||
# Poly+
|
# 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!
|
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!
|
||||||
|
|
||||||
|
|
@ -10,4 +10,4 @@ As of right now, Poly+ only works on chromium-based browsers and Firefox (howeve
|
||||||
1. First enable developer mode on your browser (developer mode allows you to load unpacked extensions)
|
1. First enable developer mode on your browser (developer mode allows you to load unpacked extensions)
|
||||||
2. Second click the "Load Unpacked" button
|
2. Second click the "Load Unpacked" button
|
||||||
3. Third when the file selector comes up pick the unzipped folder from this GitHub repository
|
3. Third when the file selector comes up pick the unzipped folder from this GitHub repository
|
||||||
4. Fourth go to Polytoria and you should see the extension's button on the sidebar
|
4. Fourth go to Polytoria and you should see the extension's button on the sidebar
|
||||||
|
|
@ -55,7 +55,7 @@ UpdateLocalData();
|
||||||
|
|
||||||
function UpdateLocalData() {
|
function UpdateLocalData() {
|
||||||
chrome.storage.sync.get(['PolyPlus_Settings'], function(result) {
|
chrome.storage.sync.get(['PolyPlus_Settings'], function(result) {
|
||||||
Settings = result.PolyPlus_Settings || {PinnedGamesOn: false}
|
Settings = result.PolyPlus_Settings || {PinnedGamesOn: true, BestFriendsOn: false}
|
||||||
});
|
});
|
||||||
|
|
||||||
chrome.storage.sync.get(['PolyPlus_PinnedGames'], function(result) {
|
chrome.storage.sync.get(['PolyPlus_PinnedGames'], function(result) {
|
||||||
|
|
|
||||||
|
|
@ -6,25 +6,10 @@ chrome.action.onClicked.addListener((tab) => {
|
||||||
});
|
});
|
||||||
|
|
||||||
// REGISTER AN ALARM FOR DAILY UPDATE CHECK
|
// REGISTER AN ALARM FOR DAILY UPDATE CHECK
|
||||||
/*
|
|
||||||
chrome.alarms.create("PolyPlus-UpdateCheck", {
|
chrome.alarms.create("PolyPlus-UpdateCheck", {
|
||||||
periodInMinutes: 24 * 60,
|
periodInMinutes: 24 * 60,
|
||||||
when: Date.now() + (12 - new Date().getHours()) * 60 * 60 * 1000,
|
when: Date.now() + (12 - new Date().getHours()) * 60 * 60 * 1000,
|
||||||
});
|
});
|
||||||
*/
|
|
||||||
|
|
||||||
// Create a date object with the current date and the desired time
|
|
||||||
/*
|
|
||||||
var date = new Date();
|
|
||||||
date.setHours(19, 31, 0, 0); // 7:25 PM
|
|
||||||
|
|
||||||
// Create an alarm that fires at 7:25 PM and repeats every day
|
|
||||||
chrome.alarms.create("PolyPlus-UpdateCheck", {
|
|
||||||
periodInMinutes: 24 * 60,
|
|
||||||
when: date.getTime()
|
|
||||||
});
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
// HANDLE ALARMS FIRING
|
// HANDLE ALARMS FIRING
|
||||||
chrome.alarms.onAlarm.addListener(function(alarm){
|
chrome.alarms.onAlarm.addListener(function(alarm){
|
||||||
|
|
@ -78,6 +63,15 @@ chrome.contextMenus.create({
|
||||||
|
|
||||||
// HANDLE CONTEXT MENU ITEMS
|
// HANDLE CONTEXT MENU ITEMS
|
||||||
chrome.contextMenus.onClicked.addListener(function (info, tab){
|
chrome.contextMenus.onClicked.addListener(function (info, tab){
|
||||||
|
chrome.notifications.create({
|
||||||
|
type: "basic",
|
||||||
|
iconUrl: chrome.runtime.getURL("icon.png"),
|
||||||
|
title: "New Update Available",
|
||||||
|
message: "A new update is available for Poly+!",
|
||||||
|
}, function(id) {
|
||||||
|
console.log(id)
|
||||||
|
})
|
||||||
|
|
||||||
if (info.menuItemId === 'PolyPlus-CopyID') {
|
if (info.menuItemId === 'PolyPlus-CopyID') {
|
||||||
let ID = parseInt(info.linkUrl.split('/')[4])
|
let ID = parseInt(info.linkUrl.split('/')[4])
|
||||||
chrome.scripting
|
chrome.scripting
|
||||||
|
|
@ -121,30 +115,4 @@ function CopyAvatarHash(hash) {
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
alert('Failure to copy avatar hash.')
|
alert('Failure to copy avatar hash.')
|
||||||
});
|
});
|
||||||
}
|
|
||||||
|
|
||||||
function HandleJoinPlace(url) {
|
|
||||||
console.log('HANDLING JOINING PLACE')
|
|
||||||
const PlaceID = new URL(url).pathname.split('/')[2]
|
|
||||||
fetch('https://polytoria.com/api/places/join',{
|
|
||||||
method: 'POST',
|
|
||||||
body: {
|
|
||||||
placeID:PlaceID
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.then(response => {
|
|
||||||
if (!response.ok) {
|
|
||||||
throw new Error('Network not ok')
|
|
||||||
}
|
|
||||||
return response.json()
|
|
||||||
})
|
|
||||||
.then(data => {
|
|
||||||
if (data.success !== true) {throw new Error(data.message)}
|
|
||||||
window.location.href = 'polytoria://client/' + data.token
|
|
||||||
})
|
|
||||||
.catch(error => {console.log(error)})
|
|
||||||
}
|
|
||||||
|
|
||||||
export default {
|
|
||||||
hi: 1
|
|
||||||
}
|
}
|
||||||
|
|
@ -8,7 +8,6 @@ const ExpectedSettings = {
|
||||||
IRLPriceWithCurrencyCurrency: 0,
|
IRLPriceWithCurrencyCurrency: 0,
|
||||||
IRLPriceWithCurrencyPackage: 0,
|
IRLPriceWithCurrencyPackage: 0,
|
||||||
HideNotifBadgesOn: true,
|
HideNotifBadgesOn: true,
|
||||||
SimplifiedProfileURLsOn: true,
|
|
||||||
StoreOwnTagOn: true,
|
StoreOwnTagOn: true,
|
||||||
ThemeCreatorOn: false,
|
ThemeCreatorOn: false,
|
||||||
ThemeCreator: {
|
ThemeCreator: {
|
||||||
|
|
|
||||||
|
|
@ -26,18 +26,23 @@ let GamePinned;
|
||||||
RatingsContainer.children[0].appendChild(PercentageLabel)
|
RatingsContainer.children[0].appendChild(PercentageLabel)
|
||||||
|
|
||||||
chrome.storage.sync.get(['PolyPlus_Settings'], function(result) {
|
chrome.storage.sync.get(['PolyPlus_Settings'], function(result) {
|
||||||
Settings = result.PolyPlus_Settings;
|
Settings = result.PolyPlus_Settings || {
|
||||||
|
PinnedGamesOn: true,
|
||||||
|
InlineEditingOn: false,
|
||||||
|
GameProfilesOn: false
|
||||||
|
};
|
||||||
|
|
||||||
if (Settings.PinnedGamesOn === true) {
|
if (Settings.PinnedGamesOn === true) {
|
||||||
HandlePinnedGames()
|
HandlePinnedGames()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Disabled settings
|
// Work in Progress
|
||||||
if (Settings.InlineEditingOn === true || 1 === 1) {
|
if (Settings.InlineEditingOn === true) {
|
||||||
HandleInlineEditing()
|
HandleInlineEditing()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Settings.GameProfilesOn === true && 1 === 2) {
|
// Work in Progress
|
||||||
|
if (Settings.GameProfilesOn === true) {
|
||||||
HandleGameProfiles()
|
HandleGameProfiles()
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -46,6 +51,7 @@ let GamePinned;
|
||||||
async function HandlePinnedGames() {
|
async function HandlePinnedGames() {
|
||||||
chrome.storage.sync.get(['PolyPlus_PinnedGames'], function(result){
|
chrome.storage.sync.get(['PolyPlus_PinnedGames'], function(result){
|
||||||
PinnedGames = result.PolyPlus_PinnedGames || {};
|
PinnedGames = result.PolyPlus_PinnedGames || {};
|
||||||
|
/*
|
||||||
const PinBtn = document.createElement('button');
|
const PinBtn = document.createElement('button');
|
||||||
PinBtn.classList = 'btn btn-warning btn-sm';
|
PinBtn.classList = 'btn btn-warning btn-sm';
|
||||||
PinBtn.style = 'position: absolute; right: 0; margin-right: 7px;'
|
PinBtn.style = 'position: absolute; right: 0; margin-right: 7px;'
|
||||||
|
|
@ -60,17 +66,45 @@ async function HandlePinnedGames() {
|
||||||
PinBtn.innerHTML = '<i class="fa-duotone fa-star"></i> Pin (max 5/5)'
|
PinBtn.innerHTML = '<i class="fa-duotone fa-star"></i> Pin (max 5/5)'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
const PinBtn = document.createElement('button');
|
||||||
|
PinBtn.classList = 'btn btn-warning btn-sm';
|
||||||
|
PinBtn.style = 'position: absolute; right: 0; margin-right: 7px;'
|
||||||
|
|
||||||
|
if (PinnedGames.includes(parseInt(GameID))) {
|
||||||
|
PinBtn.innerHTML = '<i class="fa-duotone fa-star"></i> Un-pin';
|
||||||
|
} else {
|
||||||
|
if (PinnedGames.length !== 5) {
|
||||||
|
PinBtn.innerHTML = '<i class="fa-duotone fa-star"></i> Pin'
|
||||||
|
} else {
|
||||||
|
PinBtn.setAttribute('disabled', true)
|
||||||
|
PinBtn.innerHTML = '<i class="fa-duotone fa-star"></i> Pin (max 5/5)'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
PinBtn.addEventListener('click', function() {
|
PinBtn.addEventListener('click', function() {
|
||||||
PinBtn.setAttribute('disabled', 'true')
|
PinBtn.setAttribute('disabled', 'true')
|
||||||
|
|
||||||
chrome.storage.sync.get(['PolyPlus_PinnedGames'], function(result) {
|
chrome.storage.sync.get(['PolyPlus_PinnedGames'], function(result) {
|
||||||
PinnedGames = result.PolyPlus_PinnedGames || {};
|
PinnedGames = result.PolyPlus_PinnedGames || [];
|
||||||
if (PinnedGames[GameID]) {
|
/*
|
||||||
delete PinnedGames[GameID]
|
const Index = PinnedGames.indexOf(parseInt(GameID))
|
||||||
|
if (Index !== -1) {
|
||||||
|
//delete PinnedGames[GameID]
|
||||||
|
PinnedGames.splice(Index, 1)
|
||||||
PinBtn.innerHTML = '<i class="fa-duotone fa-star"></i> Pin'
|
PinBtn.innerHTML = '<i class="fa-duotone fa-star"></i> Pin'
|
||||||
} else {
|
} else {
|
||||||
PinnedGames[GameID] = {lastVisited: new Date()}
|
//PinnedGames[GameID] = {lastVisited: new Date()}
|
||||||
|
PinnedGames.push(parseInt(GameID))
|
||||||
|
PinBtn.innerHTML = '<i class="fa-duotone fa-star"></i> Un-pin'
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
const Index = PinnedGames.indexOf(parseInt(GameID));
|
||||||
|
if (Index !== -1) {
|
||||||
|
PinnedGames.splice(Index, 1);
|
||||||
|
PinBtn.innerHTML = '<i class="fa-duotone fa-star"></i> Pin'
|
||||||
|
} else {
|
||||||
|
PinnedGames.push(parseInt(GameID));
|
||||||
PinBtn.innerHTML = '<i class="fa-duotone fa-star"></i> Un-pin'
|
PinBtn.innerHTML = '<i class="fa-duotone fa-star"></i> Un-pin'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -83,13 +117,14 @@ async function HandlePinnedGames() {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
document.querySelectorAll('.card-header')[2].appendChild(PinBtn);
|
document.getElementsByClassName('card-header')[2].appendChild(PinBtn);
|
||||||
|
|
||||||
chrome.storage.onChanged.addListener(function(changes, namespace) {
|
chrome.storage.onChanged.addListener(function(changes, namespace) {
|
||||||
if ('PolyPlus_PinnedGames' in changes) {
|
if ('PolyPlus_PinnedGames' in changes) {
|
||||||
chrome.storage.sync.get(['PolyPlus_PinnedGames'], function(result) {
|
chrome.storage.sync.get(['PolyPlus_PinnedGames'], function(result) {
|
||||||
PinnedGames = result.PolyPlus_PinnedGames || {};
|
PinnedGames = result.PolyPlus_PinnedGames || [];
|
||||||
|
|
||||||
|
/*
|
||||||
if (PinnedGames[GameID]) {
|
if (PinnedGames[GameID]) {
|
||||||
PinBtn.innerHTML = '<i class="fa-duotone fa-star"></i> Un-pin'
|
PinBtn.innerHTML = '<i class="fa-duotone fa-star"></i> Un-pin'
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -101,6 +136,18 @@ async function HandlePinnedGames() {
|
||||||
PinBtn.innerHTML = '<i class="fa-duotone fa-star"></i> Pin (max 5/5)'
|
PinBtn.innerHTML = '<i class="fa-duotone fa-star"></i> Pin (max 5/5)'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
if (PinnedGames.includes(parseInt(GameID))) {
|
||||||
|
PinBtn.innerHTML = '<i class="fa-duotone fa-star"></i> Un-pin'
|
||||||
|
} else {
|
||||||
|
if (PinnedGames.length !== 5) {
|
||||||
|
PinBtn.removeAttribute('disabled')
|
||||||
|
PinBtn.innerHTML = '<i class="fa-duotone fa-star"></i> Pin'
|
||||||
|
} else {
|
||||||
|
PinBtn.setAttribute('disabled', true)
|
||||||
|
PinBtn.innerHTML = '<i class="fa-duotone fa-star"></i> Pin (max 5/5)'
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -5,21 +5,23 @@ var PurchaseBtn;
|
||||||
var WishlistBtn;
|
var WishlistBtn;
|
||||||
|
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
if (!(window.location.href.split('/')[4])) {return}
|
if (!(window.location.href.split('/')[4])) {return}
|
||||||
chrome.storage.sync.get(['PolyPlus_Settings'], function(result){
|
chrome.storage.sync.get(['PolyPlus_Settings'], function(result){
|
||||||
var Settings = result.PolyPlus_Settings || {
|
var Settings = result.PolyPlus_Settings || {
|
||||||
IRLPriceWithCurrencyOn: false,
|
IRLPriceWithCurrencyOn: false,
|
||||||
IRLPriceWithCurrencyCurrency: 0,
|
IRLPriceWithCurrencyCurrency: 0,
|
||||||
ItemWishlistOn: true
|
ItemWishlistOn: true
|
||||||
}
|
}
|
||||||
PurchaseBtn = document.getElementsByClassName('btn btn-outline-success')[0]
|
PurchaseBtn = document.getElementsByClassName('btn btn-outline-success')[0]
|
||||||
|
console.log(PurchaseBtn)
|
||||||
|
|
||||||
if (Settings.IRLPriceWithCurrencyOn === true){ IRLPrice() }
|
if (Settings.IRLPriceWithCurrencyOn === true){ IRLPrice() }
|
||||||
|
|
||||||
if (Settings.ItemWishlistOn === true && !(PurchaseBtn.getAttribute('disabled'))) {
|
if (Settings.ItemWishlistOn === true && !(PurchaseBtn.getAttribute('disabled'))) {
|
||||||
HandleItemWishlist()
|
console.log('AAAA')
|
||||||
}
|
HandleItemWishlist()
|
||||||
})
|
}
|
||||||
|
})
|
||||||
}, 100)
|
}, 100)
|
||||||
|
|
||||||
chrome.storage.onChanged.addListener(function(changes, namespace) {
|
chrome.storage.onChanged.addListener(function(changes, namespace) {
|
||||||
|
|
@ -96,7 +98,7 @@ function IRLPrice() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function HandleItemWishlist() {
|
function HandleItemWishlist() {
|
||||||
const DescriptionText = document.getElementsByClassName('card-text')[0]
|
const DescriptionText = document.querySelector('.mcard .card-body:has(p)')
|
||||||
WishlistBtn = document.createElement('button')
|
WishlistBtn = document.createElement('button')
|
||||||
chrome.storage.sync.get(['PolyPlus_ItemWishlist'], function(result){
|
chrome.storage.sync.get(['PolyPlus_ItemWishlist'], function(result){
|
||||||
ItemWishlist = result.PolyPlus_ItemWishlist || [];
|
ItemWishlist = result.PolyPlus_ItemWishlist || [];
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,7 @@
|
||||||
|
|
||||||
{
|
{
|
||||||
"matches": ["https://polytoria.com/store/**"],
|
"matches": ["https://polytoria.com/store/**"],
|
||||||
"js": ["/js/store/item-view.js", "/js/store/try-on.js"]
|
"js": ["/js/store/item-view.js"]
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,13 @@
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>Poly+ Settings</title>
|
<!-- META TAGS -->
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
|
||||||
|
<!-- TITLE -->
|
||||||
|
<title>Poly+ | Settings</title>
|
||||||
|
|
||||||
|
<!-- CSS -->
|
||||||
<link rel="stylesheet" href="https://c0.ptacdn.com/static/app.64aa42f6.css">
|
<link rel="stylesheet" href="https://c0.ptacdn.com/static/app.64aa42f6.css">
|
||||||
</head>
|
</head>
|
||||||
<body data-bs-theme="dark">
|
<body data-bs-theme="dark">
|
||||||
|
|
@ -328,7 +335,7 @@
|
||||||
</div>
|
</div>
|
||||||
</dialog>
|
</dialog>
|
||||||
<div id="page">
|
<div id="page">
|
||||||
<p id="PinnedGames">
|
<p class="setting-container" id="PinnedGames">
|
||||||
<span>
|
<span>
|
||||||
Pinned Games (<span class="status">enabled</span>)
|
Pinned Games (<span class="status">enabled</span>)
|
||||||
<button class="btn btn-warning btn-sm" data-setting="PinnedGamesOn">Toggle</button>
|
<button class="btn btn-warning btn-sm" data-setting="PinnedGamesOn">Toggle</button>
|
||||||
|
|
@ -336,7 +343,7 @@
|
||||||
<br>
|
<br>
|
||||||
<span class="desc">Pin your favorite games to the top of the homepage!</span>
|
<span class="desc">Pin your favorite games to the top of the homepage!</span>
|
||||||
</p>
|
</p>
|
||||||
<p id="ForumMentions">
|
<p class="setting-container" id="ForumMentions">
|
||||||
<span>
|
<span>
|
||||||
Forum Mentions (<span class="status">disabled</span>)
|
Forum Mentions (<span class="status">disabled</span>)
|
||||||
<button class="btn btn-warning btn-sm" data-setting="ForumMentsOn">Toggle</button>
|
<button class="btn btn-warning btn-sm" data-setting="ForumMentsOn">Toggle</button>
|
||||||
|
|
@ -344,7 +351,7 @@
|
||||||
<br>
|
<br>
|
||||||
<span class="desc">Get a quick link to the popular person everyone is talking about's profile!</span>
|
<span class="desc">Get a quick link to the popular person everyone is talking about's profile!</span>
|
||||||
</p>
|
</p>
|
||||||
<p id="BestFriends">
|
<p class="setting-container" id="BestFriends">
|
||||||
<span>
|
<span>
|
||||||
Best Friends (<span class="status">enabled</span>)
|
Best Friends (<span class="status">enabled</span>)
|
||||||
<button class="btn btn-warning btn-sm" data-setting="BestFriendsOn">Toggle</button>
|
<button class="btn btn-warning btn-sm" data-setting="BestFriendsOn">Toggle</button>
|
||||||
|
|
@ -352,7 +359,7 @@
|
||||||
<br>
|
<br>
|
||||||
<span class="desc">Prioritize the bestest of friends on applicable friend lists!</span>
|
<span class="desc">Prioritize the bestest of friends on applicable friend lists!</span>
|
||||||
</p>
|
</p>
|
||||||
<p id="ImprovedFriendLists">
|
<p class="setting-container" id="ImprovedFriendLists">
|
||||||
<span>
|
<span>
|
||||||
Improved Friend Lists (<span class="status">enabled</span>)
|
Improved Friend Lists (<span class="status">enabled</span>)
|
||||||
<button class="btn btn-warning btn-sm" data-setting="ImprovedFrListsOn">Toggle</button>
|
<button class="btn btn-warning btn-sm" data-setting="ImprovedFrListsOn">Toggle</button>
|
||||||
|
|
@ -364,7 +371,7 @@
|
||||||
<span style="font-size: 0.8rem; color: orange;">* You can only remove up to 25 friends at once.</span>
|
<span style="font-size: 0.8rem; color: orange;">* You can only remove up to 25 friends at once.</span>
|
||||||
</span>
|
</span>
|
||||||
</p>
|
</p>
|
||||||
<p id="IRLPriceWithCurrency">
|
<p class="setting-container" id="IRLPriceWithCurrency">
|
||||||
<span>
|
<span>
|
||||||
Show IRL price with Brick Count (<span class="status">enabled</span>)
|
Show IRL price with Brick Count (<span class="status">enabled</span>)
|
||||||
<button class="btn btn-warning btn-sm" data-setting="IRLPriceWithCurrencyOn">Toggle</button>
|
<button class="btn btn-warning btn-sm" data-setting="IRLPriceWithCurrencyOn">Toggle</button>
|
||||||
|
|
@ -396,7 +403,7 @@
|
||||||
<option value="5">$99.99 USD</option>
|
<option value="5">$99.99 USD</option>
|
||||||
</select>
|
</select>
|
||||||
</p>
|
</p>
|
||||||
<p id="HideNotifBadges">
|
<p class="setting-container" id="HideNotifBadges">
|
||||||
<span>
|
<span>
|
||||||
Hide Notification Badges (<span class="status">disabled</span>)
|
Hide Notification Badges (<span class="status">disabled</span>)
|
||||||
<button class="btn btn-warning btn-sm" data-setting="HideNotifBadgesOn">Toggle</button>
|
<button class="btn btn-warning btn-sm" data-setting="HideNotifBadgesOn">Toggle</button>
|
||||||
|
|
@ -404,7 +411,10 @@
|
||||||
<br>
|
<br>
|
||||||
<span class="desc">Hide the annoying red circles on the sidebar!</span>
|
<span class="desc">Hide the annoying red circles on the sidebar!</span>
|
||||||
</p>
|
</p>
|
||||||
<p id="SimplifiedProfileURLs">
|
<!--
|
||||||
|
No longer a setting
|
||||||
|
|
||||||
|
<p class="setting-container" id="SimplifiedProfileURLs">
|
||||||
<span>
|
<span>
|
||||||
Simplified Profile URLs (<span class="status">enabled</span>)
|
Simplified Profile URLs (<span class="status">enabled</span>)
|
||||||
<button class="btn btn-warning btn-sm" data-setting="SimplifiedProfileURLsOn">Toggle</button>
|
<button class="btn btn-warning btn-sm" data-setting="SimplifiedProfileURLsOn">Toggle</button>
|
||||||
|
|
@ -412,7 +422,8 @@
|
||||||
<br>
|
<br>
|
||||||
<span class="desc">Makes all profile URLs simpler by allowing for you to go to "https://polytoria.com/profile/UsernameGoesHere" to redirect to the real profile URL!</span>
|
<span class="desc">Makes all profile URLs simpler by allowing for you to go to "https://polytoria.com/profile/UsernameGoesHere" to redirect to the real profile URL!</span>
|
||||||
</p>
|
</p>
|
||||||
<p id="StoreOwnTag">
|
-->
|
||||||
|
<p class="setting-container" id="StoreOwnTag">
|
||||||
<span>
|
<span>
|
||||||
Show "OWNED" Tag on Store Main Page (<span class="status">enabled</span>)
|
Show "OWNED" Tag on Store Main Page (<span class="status">enabled</span>)
|
||||||
<button class="btn btn-warning btn-sm" data-setting="StoreOwnTagOn">Toggle</button>
|
<button class="btn btn-warning btn-sm" data-setting="StoreOwnTagOn">Toggle</button>
|
||||||
|
|
@ -420,7 +431,7 @@
|
||||||
<br>
|
<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>
|
<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>
|
||||||
<p id="ThemeCreator">
|
<p class="setting-container" id="ThemeCreator">
|
||||||
<span>
|
<span>
|
||||||
Theme Creator (<span class="status">disabled</span>)
|
Theme Creator (<span class="status">disabled</span>)
|
||||||
<button class="btn btn-warning btn-sm" data-setting="ThemeCreatorOn">Toggle</button>
|
<button class="btn btn-warning btn-sm" data-setting="ThemeCreatorOn">Toggle</button>
|
||||||
|
|
@ -429,7 +440,7 @@
|
||||||
<br>
|
<br>
|
||||||
<span class="desc">Unleash your creativity and customize the Polytoria website to your liking! (this feature is still in development)</span>
|
<span class="desc">Unleash your creativity and customize the Polytoria website to your liking! (this feature is still in development)</span>
|
||||||
</p>
|
</p>
|
||||||
<p id="MoreSearchFilters">
|
<p class="setting-container" id="MoreSearchFilters">
|
||||||
<span>
|
<span>
|
||||||
More Search Filters (<span class="status">enabled</span>)
|
More Search Filters (<span class="status">enabled</span>)
|
||||||
<button class="btn btn-warning btn-sm" data-setting="MoreSearchFiltersOn">Toggle</button>
|
<button class="btn btn-warning btn-sm" data-setting="MoreSearchFiltersOn">Toggle</button>
|
||||||
|
|
@ -437,7 +448,7 @@
|
||||||
<br>
|
<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>
|
<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>
|
||||||
<p id="ApplyMembershipTheme">
|
<p class="setting-container" id="ApplyMembershipTheme">
|
||||||
<span>
|
<span>
|
||||||
Apply Membership Theme for <b>Free</b> (<span class="status">disabled</span>)
|
Apply Membership Theme for <b>Free</b> (<span class="status">disabled</span>)
|
||||||
<button class="btn btn-warning btn-sm" data-setting="ApplyMembershipThemeOn">Toggle</button>
|
<button class="btn btn-warning btn-sm" data-setting="ApplyMembershipThemeOn">Toggle</button>
|
||||||
|
|
@ -449,7 +460,10 @@
|
||||||
<option value="PlusDX">Plus Deluxe</option>
|
<option value="PlusDX">Plus Deluxe</option>
|
||||||
</select>
|
</select>
|
||||||
</p>
|
</p>
|
||||||
<p id="ForumMarkdown" style="display: none;">
|
<!--
|
||||||
|
Forum markdown has been added officially
|
||||||
|
|
||||||
|
<p class="setting-container" id="ForumMarkdown">
|
||||||
<span>
|
<span>
|
||||||
Forum Markdown (<span class="status">disabled</span>)
|
Forum Markdown (<span class="status">disabled</span>)
|
||||||
<button class="btn btn-warning btn-sm" data-setting="ForumMarkOn">Toggle</button>
|
<button class="btn btn-warning btn-sm" data-setting="ForumMarkOn">Toggle</button>
|
||||||
|
|
@ -459,7 +473,8 @@
|
||||||
Format forum posts to make them look epic!
|
Format forum posts to make them look epic!
|
||||||
</span>
|
</span>
|
||||||
</p>
|
</p>
|
||||||
<p id="MultiCancelOutTrades">
|
-->
|
||||||
|
<p class="setting-container" id="MultiCancelOutTrades">
|
||||||
<span>
|
<span>
|
||||||
Multi-Cancel Outbound Trades (<span class="status">enabled</span>)
|
Multi-Cancel Outbound Trades (<span class="status">enabled</span>)
|
||||||
<button class="btn btn-warning btn-sm" data-setting="MultiCancelOutTradesOns">Toggle</button>
|
<button class="btn btn-warning btn-sm" data-setting="MultiCancelOutTradesOns">Toggle</button>
|
||||||
|
|
@ -471,7 +486,7 @@
|
||||||
<span style="font-size: 0.8rem; color: orange;">* You can only cancel up to 10 trades at once.</span>
|
<span style="font-size: 0.8rem; color: orange;">* You can only cancel up to 10 trades at once.</span>
|
||||||
</span>
|
</span>
|
||||||
</p>
|
</p>
|
||||||
<p id="ModifyNav">
|
<p class="setting-container" id="ModifyNav">
|
||||||
<span>
|
<span>
|
||||||
Modify Navbar (<span class="status">disabled</span>)
|
Modify Navbar (<span class="status">disabled</span>)
|
||||||
<button class="btn btn-warning btn-sm" data-setting="ModifyNavOn">Toggle</button>
|
<button class="btn btn-warning btn-sm" data-setting="ModifyNavOn">Toggle</button>
|
||||||
|
|
@ -482,7 +497,7 @@
|
||||||
Customize the navbar to your liking!
|
Customize the navbar to your liking!
|
||||||
</span>
|
</span>
|
||||||
</p>
|
</p>
|
||||||
<p id="ItemWishlist">
|
<p class="setting-container" id="ItemWishlist">
|
||||||
<span>
|
<span>
|
||||||
Item Wishlist (<span class="status">enabled</span>)
|
Item Wishlist (<span class="status">enabled</span>)
|
||||||
<button class="btn btn-warning btn-sm" data-setting="ItemWishlistOn">Toggle</button>
|
<button class="btn btn-warning btn-sm" data-setting="ItemWishlistOn">Toggle</button>
|
||||||
|
|
@ -492,7 +507,7 @@
|
||||||
Wishlist that item that you REALLY want!
|
Wishlist that item that you REALLY want!
|
||||||
</span>
|
</span>
|
||||||
</p>
|
</p>
|
||||||
<p id="HideUpgradeBtn">
|
<p class="setting-container" id="HideUpgradeBtn">
|
||||||
<span>
|
<span>
|
||||||
Hide Upgrade Button (<span class="status">disabled</span>)
|
Hide Upgrade Button (<span class="status">disabled</span>)
|
||||||
<button class="btn btn-warning btn-sm" data-setting="HideUpgradeBtnOn">Toggle</button>
|
<button class="btn btn-warning btn-sm" data-setting="HideUpgradeBtnOn">Toggle</button>
|
||||||
|
|
|
||||||
35
settings.js
35
settings.js
|
|
@ -1,22 +1,7 @@
|
||||||
|
const SaveBtn = document.getElementById('Save')
|
||||||
|
const Elements = Array.from(document.getElementsByClassName('setting-container'))
|
||||||
|
|
||||||
var Settings;
|
var Settings;
|
||||||
var SaveBtn = document.getElementById('Save')
|
|
||||||
var Elements = [
|
|
||||||
document.getElementById("PinnedGames"),
|
|
||||||
document.getElementById("ForumMentions"),
|
|
||||||
document.getElementById("BestFriends"),
|
|
||||||
document.getElementById("ImprovedFriendLists"),
|
|
||||||
document.getElementById("IRLPriceWithCurrency"),
|
|
||||||
document.getElementById("HideNotifBadges"),
|
|
||||||
document.getElementById("SimplifiedProfileURLs"),
|
|
||||||
document.getElementById("StoreOwnTag"),
|
|
||||||
document.getElementById("ThemeCreator"),
|
|
||||||
document.getElementById("MoreSearchFilters"),
|
|
||||||
document.getElementById("ApplyMembershipTheme"),
|
|
||||||
document.getElementById("MultiCancelOutTrades"),
|
|
||||||
document.getElementById("ModifyNav"),
|
|
||||||
document.getElementById("ItemWishlist"),
|
|
||||||
document.getElementById("HideUpgradeBtn")
|
|
||||||
];
|
|
||||||
var ExpectedSettings = {
|
var ExpectedSettings = {
|
||||||
PinnedGamesOn: true,
|
PinnedGamesOn: true,
|
||||||
ForumMentsOn: false,
|
ForumMentsOn: false,
|
||||||
|
|
@ -26,7 +11,6 @@ var ExpectedSettings = {
|
||||||
IRLPriceWithCurrencyCurrency: 0,
|
IRLPriceWithCurrencyCurrency: 0,
|
||||||
IRLPriceWithCurrencyPackage: 0,
|
IRLPriceWithCurrencyPackage: 0,
|
||||||
HideNotifBadgesOn: false,
|
HideNotifBadgesOn: false,
|
||||||
SimplifiedProfileURLsOn: true,
|
|
||||||
StoreOwnTagOn: true,
|
StoreOwnTagOn: true,
|
||||||
ThemeCreatorOn: false,
|
ThemeCreatorOn: false,
|
||||||
ThemeCreator: {
|
ThemeCreator: {
|
||||||
|
|
@ -41,7 +25,7 @@ var ExpectedSettings = {
|
||||||
ModifyNavOn: false,
|
ModifyNavOn: false,
|
||||||
ModifyNav: [
|
ModifyNav: [
|
||||||
{
|
{
|
||||||
Label: "Play",
|
Label: "Places",
|
||||||
Link: "https://polytoria.com/places"
|
Link: "https://polytoria.com/places"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
@ -69,7 +53,7 @@ var ExpectedSettings = {
|
||||||
HideUpgradeBtnOn: false
|
HideUpgradeBtnOn: false
|
||||||
}
|
}
|
||||||
|
|
||||||
var ResetDefaultsModal = document.getElementById('ResetDefaults-Modal')
|
const ResetDefaultsModal = document.getElementById('ResetDefaults-Modal')
|
||||||
var ThemeCreatorModal = {
|
var ThemeCreatorModal = {
|
||||||
Modal: document.getElementById('ThemeCreator-Modal'),
|
Modal: document.getElementById('ThemeCreator-Modal'),
|
||||||
Save: document.getElementById('ThemeCreator-Modal-Save'),
|
Save: document.getElementById('ThemeCreator-Modal-Save'),
|
||||||
|
|
@ -105,7 +89,6 @@ Elements.forEach(element => {
|
||||||
|
|
||||||
if (Button) {
|
if (Button) {
|
||||||
Button.addEventListener('click', function() {
|
Button.addEventListener('click', function() {
|
||||||
console.log('button clicked!!!!')
|
|
||||||
ToggleSetting(Button.getAttribute('data-setting'), element)
|
ToggleSetting(Button.getAttribute('data-setting'), element)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -173,14 +156,18 @@ Elements.forEach(element => {
|
||||||
Array.from(ModalInputs).forEach(input => {
|
Array.from(ModalInputs).forEach(input => {
|
||||||
if (!(input.getAttribute('data-ignore') === 'true')) {
|
if (!(input.getAttribute('data-ignore') === 'true')) {
|
||||||
if (!(input.getAttribute('data-parent'))) {
|
if (!(input.getAttribute('data-parent'))) {
|
||||||
if (Settings[Modal.getAttribute('data-setting')][input.getAttribute('data-setting')] !== "undefined") {
|
if (Settings[Modal.getAttribute('data-setting')][input.getAttribute('data-setting')] !== "undefined" && Settings[Modal.getAttribute('data-setting')][input.getAttribute('data-setting')] !== undefined) {
|
||||||
input.value = Settings[Modal.getAttribute('data-setting')][input.getAttribute('data-setting')]
|
input.value = Settings[Modal.getAttribute('data-setting')][input.getAttribute('data-setting')]
|
||||||
|
} else {
|
||||||
|
input.value = ''
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
let Parent = input.getAttribute('data-parent')
|
let Parent = input.getAttribute('data-parent')
|
||||||
if (Settings[Modal.getAttribute('data-setting')][Parent][input.getAttribute('data-setting')] !== "undefined") {
|
if (Settings[Modal.getAttribute('data-setting')][Parent][input.getAttribute('data-setting')] !== "undefined" && Settings[Modal.getAttribute('data-setting')][Parent][input.getAttribute('data-setting')] !== undefined) {
|
||||||
if (!isNaN(parseInt(Parent))) {Parent = parseInt(Parent)}
|
if (!isNaN(parseInt(Parent))) {Parent = parseInt(Parent)}
|
||||||
input.value = Settings[Modal.getAttribute('data-setting')][Parent][input.getAttribute('data-setting')]
|
input.value = Settings[Modal.getAttribute('data-setting')][Parent][input.getAttribute('data-setting')]
|
||||||
|
} else {
|
||||||
|
input.value = ''
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Reference in a new issue