added economic settings backend

This commit is contained in:
Justin 2023-06-14 15:57:05 +08:00 committed by GitHub
parent 5203d0a0ee
commit a5f495be5e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -48,6 +48,7 @@ var commoditiesFeatures = document.querySelectorAll("#commodities-features li");
var indicesFeatures = document.querySelectorAll("#indices-features li");
var moviesFeatures = document.querySelectorAll("#movies-features li");
var ipoFeatures = document.querySelectorAll("#ipo-features li");
var economicFeatures = document.querySelectorAll("#economic-list li");
var allFeaturesList = [
stocksFeatures,
@ -67,6 +68,7 @@ var allFeaturesList = [
indicesFeatures,
moviesFeatures,
ipoFeatures,
economicFeatures,
];
// features remove buttons
@ -93,6 +95,7 @@ var commoditiesRemoveBtn = document.getElementById("commodities-remove-btn");
var indicesRemoveBtn = document.getElementById("indices-remove-btn");
var moviesRemoveBtn = document.getElementById("movies-remove-btn");
var ipoRemoveBtn = document.getElementById("ipo-remove-btn");
var economicRemoveBtn = document.getElementById("economic-remove-btn");
var allFeaturesRemoveBtns = [
stocksRemoveBtn,
@ -112,6 +115,7 @@ var allFeaturesRemoveBtns = [
indicesRemoveBtn,
moviesRemoveBtn,
ipoRemoveBtn,
economicRemoveBtn,
];
// features increase buttons
var stocksincreaseBtn = document.getElementById("stocks-increase-btn");
@ -137,6 +141,7 @@ var commoditiesincreaseBtn = document.getElementById("commodities-increase-btn")
var indicesincreaseBtn = document.getElementById("indices-increase-btn");
var moviesincreaseBtn = document.getElementById("movies-increase-btn");
var ipoincreaseBtn = document.getElementById("ipo-increase-btn");
var economicincreaseBtn = document.getElementById("economic-increase-btn");
var allFeaturesIncreaseBtns = [
stocksincreaseBtn,
@ -156,6 +161,7 @@ var allFeaturesIncreaseBtns = [
indicesincreaseBtn,
moviesincreaseBtn,
ipoincreaseBtn,
economicincreaseBtn,
];
// features decrease buttons
@ -182,6 +188,7 @@ var commoditiesDecreaseBtn = document.getElementById("commodities-decrease-btn")
var indicesDecreaseBtn = document.getElementById("indices-decrease-btn");
var moviesDecreaseBtn = document.getElementById("movies-decrease-btn");
var ipoDecreaseBtn = document.getElementById("ipo-decrease-btn");
var economicDecreaseBtn = document.getElementById("economic-decrease-btn");
var allFeaturesDecreaseBtns = [
stocksDecreaseBtn,
@ -201,6 +208,7 @@ var allFeaturesDecreaseBtns = [
indicesDecreaseBtn,
moviesDecreaseBtn,
ipoDecreaseBtn,
economicDecreaseBtn,
];
const changeVarValue = () => {
@ -227,6 +235,7 @@ const changeVarValue = () => {
indicesFeatures = document.querySelectorAll("#indices-features li");
moviesFeatures = document.querySelectorAll("#movies-features li");
ipoFeatures = document.querySelectorAll("#ipo-features li");
economicFeatures = document.querySelectorAll("#economic-list li");
allFeaturesList = [
stocksFeatures,
@ -246,6 +255,7 @@ const changeVarValue = () => {
indicesFeatures,
moviesFeatures,
ipoFeatures,
economicFeatures,
];
};
@ -610,6 +620,7 @@ var commodities = document.getElementById("commodities-features");
var indices = document.getElementById("indices-features");
var movies = document.getElementById("movies-features");
var ipos = document.getElementById("ipo-features");
var economics = document.getElementById("economic-list");
var allFeatures = [
stocks,
@ -629,6 +640,7 @@ var allFeatures = [
indices,
movies,
ipos,
economics,
];
// features select box
@ -638,6 +650,7 @@ var pastGamesSelect = document.getElementById("inputTransition83");
var liveGamesSelect = document.getElementById("inputTransition93");
var teamStatsSelect = document.getElementById("inputTransition103");
var moviesSelect = document.getElementById("inputTransition64");
var economicSelect = document.getElementById("inputTransition2222");
var allFeaturesSelectBox = [
null,
null,
@ -656,6 +669,7 @@ var allFeaturesSelectBox = [
null,
moviesSelect,
null,
economicSelect,
];
// features select add buttons
@ -664,6 +678,8 @@ var upcomingGamesAddBtn = document.getElementById("inputTransitionBtn73");
var pastGamesAddBtn = document.getElementById("inputTransitionBtn83");
var liveGamesAddBtn = document.getElementById("inputTransitionBtn93");
var teamStatsAddBtn = document.getElementById("inputTransitionBtn103");
var economicAddBtn = document.getElementById("economic-countries-btn");
var allFeaturesSelectAddBtn = [
null,
null,
@ -682,6 +698,7 @@ var allFeaturesSelectAddBtn = [
null,
null,
null,
economicAddBtn,
];
allFeaturesSelectAddBtn.map((value, index) => {
@ -718,6 +735,7 @@ var allFeaturesFile = [
null,
null,
null,
null,
];
// features file add button
var imagesFileAddBtn = document.getElementById("inputTextBtn11");
@ -741,6 +759,7 @@ var allFeaturesFileAddBtn = [
null,
null,
null,
null,
];
// features input text
@ -771,6 +790,7 @@ var allFeaturesText = [
indicesText,
null,
null,
null,
];
// features text add button
@ -801,6 +821,7 @@ var allFeaturesTextAddBtn = [
indicesTextAddBtn,
null,
null,
null,
];
@ -822,6 +843,7 @@ var allFeaturesLimit = [
40,
null,
null,
null,
];
@ -1086,6 +1108,7 @@ function getFeatureSettings() {
"Indices",
"Movies",
"IPO Calendar",
"Economic Calendar",
];
let pageNum = features.indexOf(feature) + 1;
let pageSelector = "Page" + pageNum.toString();
@ -1148,6 +1171,9 @@ function getFeatureSettings() {
case 17:
s = getIpoSettings(page);
break;
case 18:
s = getEconomicSettings(page);
break;
}
settings = { ...settings, ...s }; // merge both sets of settings
@ -1339,6 +1365,7 @@ function saveMovieAPIKey(){
"Indices",
"Movies",
"IPO Calendar",
"Economic Calendar",
];
let pageNum = features.indexOf(feature) + 1;
let pageSelector = "Page" + pageNum.toString();
@ -1380,6 +1407,7 @@ function saveIpoAPIKey(){
"Indices",
"Movies",
"IPO Calendar",
"Economic Calendar",
];
let pageNum = features.indexOf(feature) + 1;
let pageSelector = "Page" + pageNum.toString();
@ -1630,6 +1658,25 @@ function getMessageSettings(page) {
return { title: title, messages: new_messages };
}
// economic settings
function getEconomicSettings(page) {
let title = page.querySelectorAll(".title-select")[0].checked;
let countries = getListItems(page.querySelectorAll(".symbol-list")[0]);
let importance = page.querySelectorAll(".economic-importance-select")[0].value;
let timezone = page.querySelectorAll(".economic-tz-select")[0].value;
settings = {
title: title,
countries: countries,
importance: importance,
timezone: timezone,
};
console.log(settings);
return settings;
}
// Join Network
let wifiSsidInput = document.getElementById("wifi-ssid-input");
@ -1761,7 +1808,7 @@ inputAnimationBtn.addEventListener("click", () => {
// scroll speed row two
let inputScrollSpeedRow = [];
for (let i = 1; i <= 17; i++) {
for (let i = 1; i <= 18; i++) {
inputScrollSpeedRow.push(
document.getElementById(
i === 1 ? "inputScrollSpeedRow" : `inputScrollSpeedRow${i}`