From 62ac8bcf568fbf862845b56204950b970381ef92 Mon Sep 17 00:00:00 2001 From: Justin Date: Mon, 14 Aug 2023 17:59:08 +0800 Subject: [PATCH] sector performance backend --- static/app.js | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/static/app.js b/static/app.js index ac3aaa7..8d99765 100755 --- a/static/app.js +++ b/static/app.js @@ -51,6 +51,7 @@ var ipoFeatures = document.querySelectorAll("#ipo-features li"); var economicFeatures = document.querySelectorAll("#economic-list li"); var jokesFeatures = document.querySelectorAll("#jokes-list li"); var marketFeatures = document.querySelectorAll("#market-list li"); +var sectorFeatures = document.querySelectorAll("#sector-list li"); var allFeaturesList = [ stocksFeatures, @@ -73,6 +74,7 @@ var allFeaturesList = [ economicFeatures, jokesFeatures, marketFeatures, + sectorFeatures, ]; // features remove buttons @@ -102,6 +104,7 @@ var ipoRemoveBtn = document.getElementById("ipo-remove-btn"); var economicRemoveBtn = document.getElementById("economic-remove-btn"); var jokesRemoveBtn = document.getElementById("jokes-remove-btn"); var marketRemoveBtn = document.getElementById("market-remove-btn"); +var sectorRemoveBtn = document.getElementById("sector-remove-btn"); var allFeaturesRemoveBtns = [ stocksRemoveBtn, @@ -124,6 +127,7 @@ var allFeaturesRemoveBtns = [ economicRemoveBtn, jokesRemoveBtn, marketRemoveBtn, + sectorRemoveBtn, ]; // features increase buttons var stocksincreaseBtn = document.getElementById("stocks-increase-btn"); @@ -152,6 +156,7 @@ var ipoincreaseBtn = document.getElementById("ipo-increase-btn"); var economicincreaseBtn = document.getElementById("economic-increase-btn"); var jokesincreaseBtn = document.getElementById("jokes-increase-btn"); var marketincreaseBtn = document.getElementById("market-increase-btn"); +var sectorincreaseBtn = document.getElementById("sector-increase-btn"); var allFeaturesIncreaseBtns = [ stocksincreaseBtn, @@ -174,6 +179,7 @@ var allFeaturesIncreaseBtns = [ economicincreaseBtn, jokesincreaseBtn, marketincreaseBtn, + sectorincreaseBtn, ]; // features decrease buttons @@ -203,6 +209,7 @@ var ipoDecreaseBtn = document.getElementById("ipo-decrease-btn"); var economicDecreaseBtn = document.getElementById("economic-decrease-btn"); var jokesDecreaseBtn = document.getElementById("jokes-decrease-btn"); var marketDecreaseBtn = document.getElementById("market-decrease-btn"); +var sectorDecreaseBtn = document.getElementById("sector-decrease-btn"); var allFeaturesDecreaseBtns = [ stocksDecreaseBtn, @@ -225,6 +232,7 @@ var allFeaturesDecreaseBtns = [ economicDecreaseBtn, jokesDecreaseBtn, marketDecreaseBtn, + sectorDecreaseBtn, ]; const changeVarValue = () => { @@ -254,6 +262,7 @@ const changeVarValue = () => { economicFeatures = document.querySelectorAll("#economic-list li"); jokesFeatures = document.querySelectorAll("#jokes-list li"); marketFeatures = document.querySelectorAll("#market-list li"); + sectorFeatures = document.querySelectorAll("#sector-list li"); allFeaturesList = [ stocksFeatures, @@ -276,6 +285,7 @@ const changeVarValue = () => { economicFeatures, jokesFeatures, marketFeatures, + sectorFeatures, ]; }; @@ -656,6 +666,7 @@ var ipos = document.getElementById("ipo-features"); var economics = document.getElementById("economic-list"); var jokes = document.getElementById("jokes-list"); var market = document.getElementById("market-list"); +var sector = document.getElementById("sector-list"); var allFeatures = [ stocks, @@ -678,6 +689,7 @@ var allFeatures = [ economics, jokes, market, + sector, ]; // features select box @@ -690,6 +702,7 @@ var moviesSelect = document.getElementById("inputTransition64"); var economicSelect = document.getElementById("inputTransition2222"); var jokesSelect = document.getElementById("jokes-categories"); var marketSelect = document.getElementById("market-categories"); +var sectorSelect = document.getElementById("sector-categories"); var allFeaturesSelectBox = [ null, null, @@ -711,6 +724,7 @@ var allFeaturesSelectBox = [ economicSelect, jokesSelect, marketSelect, + sectorSelect, ]; // features select add buttons @@ -722,6 +736,7 @@ var teamStatsAddBtn = document.getElementById("inputTransitionBtn103"); var economicAddBtn = document.getElementById("economic-countries-btn"); var jokesAddBtn = document.getElementById("jokes-categories-btn"); var marketAddBtn = document.getElementById("market-categories-btn"); +var sectorAddBtn = document.getElementById("sector-categories-btn"); var allFeaturesSelectAddBtn = [ null, @@ -744,6 +759,7 @@ var allFeaturesSelectAddBtn = [ economicAddBtn, jokesAddBtn, marketAddBtn, + sectorAddBtn, ]; allFeaturesSelectAddBtn.map((value, index) => { @@ -784,6 +800,7 @@ var allFeaturesFile = [ null, null, null, + null, ]; // features file add button var imagesFileAddBtn = document.getElementById("inputTextBtn11"); @@ -810,6 +827,7 @@ var allFeaturesFileAddBtn = [ null, null, null, + null, ]; // features input text @@ -843,6 +861,7 @@ var allFeaturesText = [ null, null, null, + null, ]; // features text add button @@ -876,6 +895,7 @@ var allFeaturesTextAddBtn = [ null, null, null, + null, ]; @@ -900,6 +920,7 @@ var allFeaturesLimit = [ null, null, null, + null, ]; @@ -1175,6 +1196,7 @@ function getFeatureSettings() { "Economic Calendar", "Jokes", "Gainers, Losers, Active", + "Sector Performance", ]; let pageNum = features.indexOf(feature) + 1; let pageSelector = "Page" + pageNum.toString(); @@ -1246,6 +1268,9 @@ function getFeatureSettings() { case 20: s = getMarketSettings(page); break; + case 21: + s = getSectorSettings(page); + break; } settings = { ...settings, ...s }; // merge both sets of settings @@ -1444,6 +1469,7 @@ function saveMovieAPIKey(){ "Economic Calendar", "Jokes", "Gainers, Losers, Active", + "Sector Performance", ]; let pageNum = features.indexOf(feature) + 1; let pageSelector = "Page" + pageNum.toString(); @@ -1488,6 +1514,7 @@ function saveIpoAPIKey(){ "Economic Calendar", "Jokes", "Gainers, Losers, Active", + "Sector Performance", ]; let pageNum = features.indexOf(feature) + 1; let pageSelector = "Page" + pageNum.toString(); @@ -1945,7 +1972,7 @@ inputAnimationBtn.addEventListener("click", () => { // scroll speed row two let inputScrollSpeedRow = []; -for (let i = 1; i <= 20; i++) { +for (let i = 1; i <= 21; i++) { inputScrollSpeedRow.push( document.getElementById( i === 1 ? "inputScrollSpeedRow" : `inputScrollSpeedRow${i}` @@ -3313,7 +3340,7 @@ function featureSavePrompt() { const pageIDs = ['Page1', 'Page2', 'Page3', 'Page4', 'Page5', 'Page6', 'Page7', 'Page8', 'Page9', 'Page10', 'Page11', 'Page12', 'Page13', - 'Page14', 'Page15', 'Page16', 'Page17', 'Page18', 'Page19', 'Page20']; + 'Page14', 'Page15', 'Page16', 'Page17', 'Page18', 'Page19', 'Page20', 'Page21']; for (const pageID of pageIDs) { // Select the parent div @@ -3321,7 +3348,7 @@ for (const pageID of pageIDs) { // Add event listeners to select menus const excludedIds = ['base-select', 'quote-select', 'commodities-items', 'indices-items', 'inputTransition73', 'inputTransition83', 'inputTransition93', 'inputTransition103', 'inputTransition2222', 'jokes-categories', 'golf-ranking-number', - 'inputScrollSpeed16', 'inputScrollSpeed17', 'inputScrollSpeed19BG', 'market-categories']; + 'inputScrollSpeed16', 'inputScrollSpeed17', 'inputScrollSpeed19BG', 'market-categories', 'sector-categories']; const selectMenus = parentDiv.querySelectorAll('select'); selectMenus.forEach(selectMenu => {