r/place frontend added

This commit is contained in:
Justin 2023-08-16 16:22:39 +08:00 committed by GitHub
parent 636f08a11c
commit e6db488aa6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -52,6 +52,7 @@ var economicFeatures = document.querySelectorAll("#economic-list li");
var jokesFeatures = document.querySelectorAll("#jokes-list li"); var jokesFeatures = document.querySelectorAll("#jokes-list li");
var marketFeatures = document.querySelectorAll("#market-list li"); var marketFeatures = document.querySelectorAll("#market-list li");
var sectorFeatures = document.querySelectorAll("#sector-list li"); var sectorFeatures = document.querySelectorAll("#sector-list li");
var placeFeatures = document.querySelectorAll("#place-list li");
var allFeaturesList = [ var allFeaturesList = [
stocksFeatures, stocksFeatures,
@ -75,6 +76,7 @@ var allFeaturesList = [
jokesFeatures, jokesFeatures,
marketFeatures, marketFeatures,
sectorFeatures, sectorFeatures,
placeFeatures,
]; ];
// features remove buttons // features remove buttons
@ -105,6 +107,7 @@ var economicRemoveBtn = document.getElementById("economic-remove-btn");
var jokesRemoveBtn = document.getElementById("jokes-remove-btn"); var jokesRemoveBtn = document.getElementById("jokes-remove-btn");
var marketRemoveBtn = document.getElementById("market-remove-btn"); var marketRemoveBtn = document.getElementById("market-remove-btn");
var sectorRemoveBtn = document.getElementById("sector-remove-btn"); var sectorRemoveBtn = document.getElementById("sector-remove-btn");
var placeRemoveBtn = document.getElementById("place-remove-btn");
var allFeaturesRemoveBtns = [ var allFeaturesRemoveBtns = [
stocksRemoveBtn, stocksRemoveBtn,
@ -128,6 +131,7 @@ var allFeaturesRemoveBtns = [
jokesRemoveBtn, jokesRemoveBtn,
marketRemoveBtn, marketRemoveBtn,
sectorRemoveBtn, sectorRemoveBtn,
placeRemoveBtn,
]; ];
// features increase buttons // features increase buttons
var stocksincreaseBtn = document.getElementById("stocks-increase-btn"); var stocksincreaseBtn = document.getElementById("stocks-increase-btn");
@ -157,6 +161,7 @@ var economicincreaseBtn = document.getElementById("economic-increase-btn");
var jokesincreaseBtn = document.getElementById("jokes-increase-btn"); var jokesincreaseBtn = document.getElementById("jokes-increase-btn");
var marketincreaseBtn = document.getElementById("market-increase-btn"); var marketincreaseBtn = document.getElementById("market-increase-btn");
var sectorincreaseBtn = document.getElementById("sector-increase-btn"); var sectorincreaseBtn = document.getElementById("sector-increase-btn");
var placeincreaseBtn = document.getElementById("place-increase-btn");
var allFeaturesIncreaseBtns = [ var allFeaturesIncreaseBtns = [
stocksincreaseBtn, stocksincreaseBtn,
@ -180,6 +185,7 @@ var allFeaturesIncreaseBtns = [
jokesincreaseBtn, jokesincreaseBtn,
marketincreaseBtn, marketincreaseBtn,
sectorincreaseBtn, sectorincreaseBtn,
placeincreaseBtn,
]; ];
// features decrease buttons // features decrease buttons
@ -210,6 +216,7 @@ var economicDecreaseBtn = document.getElementById("economic-decrease-btn");
var jokesDecreaseBtn = document.getElementById("jokes-decrease-btn"); var jokesDecreaseBtn = document.getElementById("jokes-decrease-btn");
var marketDecreaseBtn = document.getElementById("market-decrease-btn"); var marketDecreaseBtn = document.getElementById("market-decrease-btn");
var sectorDecreaseBtn = document.getElementById("sector-decrease-btn"); var sectorDecreaseBtn = document.getElementById("sector-decrease-btn");
var placeDecreaseBtn = document.getElementById("place-decrease-btn");
var allFeaturesDecreaseBtns = [ var allFeaturesDecreaseBtns = [
stocksDecreaseBtn, stocksDecreaseBtn,
@ -233,6 +240,7 @@ var allFeaturesDecreaseBtns = [
jokesDecreaseBtn, jokesDecreaseBtn,
marketDecreaseBtn, marketDecreaseBtn,
sectorDecreaseBtn, sectorDecreaseBtn,
placeDecreaseBtn,
]; ];
const changeVarValue = () => { const changeVarValue = () => {
@ -263,6 +271,7 @@ const changeVarValue = () => {
jokesFeatures = document.querySelectorAll("#jokes-list li"); jokesFeatures = document.querySelectorAll("#jokes-list li");
marketFeatures = document.querySelectorAll("#market-list li"); marketFeatures = document.querySelectorAll("#market-list li");
sectorFeatures = document.querySelectorAll("#sector-list li"); sectorFeatures = document.querySelectorAll("#sector-list li");
placeFeatures = document.querySelectorAll("#place-list li");
allFeaturesList = [ allFeaturesList = [
stocksFeatures, stocksFeatures,
@ -286,6 +295,7 @@ const changeVarValue = () => {
jokesFeatures, jokesFeatures,
marketFeatures, marketFeatures,
sectorFeatures, sectorFeatures,
placeFeatures,
]; ];
}; };
@ -667,6 +677,7 @@ var economics = document.getElementById("economic-list");
var jokes = document.getElementById("jokes-list"); var jokes = document.getElementById("jokes-list");
var market = document.getElementById("market-list"); var market = document.getElementById("market-list");
var sector = document.getElementById("sector-list"); var sector = document.getElementById("sector-list");
var place = document.getElementById("place-list");
var allFeatures = [ var allFeatures = [
stocks, stocks,
@ -690,6 +701,7 @@ var allFeatures = [
jokes, jokes,
market, market,
sector, sector,
place,
]; ];
// features select box // features select box
@ -703,6 +715,7 @@ var economicSelect = document.getElementById("inputTransition2222");
var jokesSelect = document.getElementById("jokes-categories"); var jokesSelect = document.getElementById("jokes-categories");
var marketSelect = document.getElementById("market-categories"); var marketSelect = document.getElementById("market-categories");
var sectorSelect = document.getElementById("sector-categories"); var sectorSelect = document.getElementById("sector-categories");
var placeSelect = document.getElementById("place-categories");
var allFeaturesSelectBox = [ var allFeaturesSelectBox = [
null, null,
null, null,
@ -725,6 +738,7 @@ var allFeaturesSelectBox = [
jokesSelect, jokesSelect,
marketSelect, marketSelect,
sectorSelect, sectorSelect,
placeSelect,
]; ];
// features select add buttons // features select add buttons
@ -737,6 +751,7 @@ var economicAddBtn = document.getElementById("economic-countries-btn");
var jokesAddBtn = document.getElementById("jokes-categories-btn"); var jokesAddBtn = document.getElementById("jokes-categories-btn");
var marketAddBtn = document.getElementById("market-categories-btn"); var marketAddBtn = document.getElementById("market-categories-btn");
var sectorAddBtn = document.getElementById("sector-categories-btn"); var sectorAddBtn = document.getElementById("sector-categories-btn");
var placeAddBtn = document.getElementById("place-categories-btn");
var allFeaturesSelectAddBtn = [ var allFeaturesSelectAddBtn = [
null, null,
@ -760,6 +775,7 @@ var allFeaturesSelectAddBtn = [
jokesAddBtn, jokesAddBtn,
marketAddBtn, marketAddBtn,
sectorAddBtn, sectorAddBtn,
placeAddBtn,
]; ];
allFeaturesSelectAddBtn.map((value, index) => { allFeaturesSelectAddBtn.map((value, index) => {
@ -801,6 +817,7 @@ var allFeaturesFile = [
null, null,
null, null,
null, null,
null,
]; ];
// features file add button // features file add button
var imagesFileAddBtn = document.getElementById("inputTextBtn11"); var imagesFileAddBtn = document.getElementById("inputTextBtn11");
@ -828,6 +845,7 @@ var allFeaturesFileAddBtn = [
null, null,
null, null,
null, null,
null,
]; ];
// features input text // features input text
@ -862,6 +880,7 @@ var allFeaturesText = [
null, null,
null, null,
null, null,
null,
]; ];
// features text add button // features text add button
@ -896,6 +915,7 @@ var allFeaturesTextAddBtn = [
null, null,
null, null,
null, null,
null,
]; ];
@ -921,6 +941,7 @@ var allFeaturesLimit = [
null, null,
null, null,
null, null,
null,
]; ];
@ -1197,6 +1218,7 @@ function getFeatureSettings() {
"Jokes", "Jokes",
"Gainers, Losers, Active", "Gainers, Losers, Active",
"Sector Performance", "Sector Performance",
"r/place (Reddit)",
]; ];
let pageNum = features.indexOf(feature) + 1; let pageNum = features.indexOf(feature) + 1;
let pageSelector = "Page" + pageNum.toString(); let pageSelector = "Page" + pageNum.toString();
@ -1271,6 +1293,9 @@ function getFeatureSettings() {
case 21: case 21:
s = getSectorSettings(page); s = getSectorSettings(page);
break; break;
case 22:
s = getPlaceSettings(page);
break;
} }
settings = { ...settings, ...s }; // merge both sets of settings settings = { ...settings, ...s }; // merge both sets of settings
@ -1470,6 +1495,7 @@ function saveMovieAPIKey(){
"Jokes", "Jokes",
"Gainers, Losers, Active", "Gainers, Losers, Active",
"Sector Performance", "Sector Performance",
"r/place (Reddit)",
]; ];
let pageNum = features.indexOf(feature) + 1; let pageNum = features.indexOf(feature) + 1;
let pageSelector = "Page" + pageNum.toString(); let pageSelector = "Page" + pageNum.toString();
@ -1515,6 +1541,7 @@ function saveIpoAPIKey(){
"Jokes", "Jokes",
"Gainers, Losers, Active", "Gainers, Losers, Active",
"Sector Performance", "Sector Performance",
"r/place (Reddit)",
]; ];
let pageNum = features.indexOf(feature) + 1; let pageNum = features.indexOf(feature) + 1;
let pageSelector = "Page" + pageNum.toString(); let pageSelector = "Page" + pageNum.toString();
@ -1990,7 +2017,7 @@ inputAnimationBtn.addEventListener("click", () => {
// scroll speed row two // scroll speed row two
let inputScrollSpeedRow = []; let inputScrollSpeedRow = [];
for (let i = 1; i <= 21; i++) { for (let i = 1; i <= 22; i++) {
inputScrollSpeedRow.push( inputScrollSpeedRow.push(
document.getElementById( document.getElementById(
i === 1 ? "inputScrollSpeedRow" : `inputScrollSpeedRow${i}` i === 1 ? "inputScrollSpeedRow" : `inputScrollSpeedRow${i}`
@ -3358,7 +3385,7 @@ function featureSavePrompt() {
const pageIDs = ['Page1', 'Page2', 'Page3', 'Page4', 'Page5', 'Page6', 'Page7', 'Page8', 'Page9', 'Page10', 'Page11', 'Page12', 'Page13', const pageIDs = ['Page1', 'Page2', 'Page3', 'Page4', 'Page5', 'Page6', 'Page7', 'Page8', 'Page9', 'Page10', 'Page11', 'Page12', 'Page13',
'Page14', 'Page15', 'Page16', 'Page17', 'Page18', 'Page19', 'Page20', 'Page21']; 'Page14', 'Page15', 'Page16', 'Page17', 'Page18', 'Page19', 'Page20', 'Page21', 'Page22'];
for (const pageID of pageIDs) { for (const pageID of pageIDs) {
// Select the parent div // Select the parent div
@ -3366,7 +3393,7 @@ for (const pageID of pageIDs) {
// Add event listeners to select menus // Add event listeners to select menus
const excludedIds = ['base-select', 'quote-select', 'commodities-items', 'indices-items', 'inputTransition73', const excludedIds = ['base-select', 'quote-select', 'commodities-items', 'indices-items', 'inputTransition73',
'inputTransition83', 'inputTransition93', 'inputTransition103', 'inputTransition2222', 'jokes-categories', 'golf-ranking-number', 'inputTransition83', 'inputTransition93', 'inputTransition103', 'inputTransition2222', 'jokes-categories', 'golf-ranking-number',
'inputScrollSpeed16', 'inputScrollSpeed17', 'inputScrollSpeed19BG', 'market-categories', 'sector-categories']; 'inputScrollSpeed16', 'inputScrollSpeed17', 'inputScrollSpeed19BG', 'market-categories', 'sector-categories', 'place-categories'];
const selectMenus = parentDiv.querySelectorAll('select'); const selectMenus = parentDiv.querySelectorAll('select');
selectMenus.forEach(selectMenu => { selectMenus.forEach(selectMenu => {
@ -3377,6 +3404,22 @@ for (const pageID of pageIDs) {
}); });
} }
}); });
// Add event listeners for input text fields specifically for page22 (r/place)
if (pageID === 'Page22') {
const inputForms = parentDiv.querySelectorAll('input[type="text"]');
inputForms.forEach(inputForm => {
inputForm.addEventListener('input', function(event) {
displaySavePrompt2();
});
});
}
// Add event listeners for sliders specifically for page22 (r/place)
if (pageID === 'Page22') {
const slider = parentDiv.querySelector('#myRange');
slider.addEventListener('input', function(event) {
displaySavePrompt2();
});
}
// Add event listeners to input checkboxes // Add event listeners to input checkboxes
const inputForms = parentDiv.querySelectorAll('input[type="checkbox"]'); const inputForms = parentDiv.querySelectorAll('input[type="checkbox"]');
inputForms.forEach(inputForm => { inputForms.forEach(inputForm => {
@ -3489,3 +3532,16 @@ function uploadCryptoLogo() {
} }
} }
// TO GET SLIDER VALUE FOR IMAGE WIDTH IN R/PLACE
var slider = document.getElementById("myRange");
var output = document.getElementById("slider-value");
output.innerHTML = slider.value; // Display the default slider value
// Update the current slider value (each time you drag the slider handle)
slider.oninput = function() {
output.innerHTML = this.value;
}