From b7926b7d9ad9d94e644be8104346c68a48d01df3 Mon Sep 17 00:00:00 2001 From: Justin Date: Tue, 8 Aug 2023 17:14:50 +0800 Subject: [PATCH] added gainers losers active backend --- static/app.js | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/static/app.js b/static/app.js index 44f8930..dca2f52 100755 --- a/static/app.js +++ b/static/app.js @@ -50,6 +50,7 @@ var moviesFeatures = document.querySelectorAll("#movies-features li"); 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 allFeaturesList = [ stocksFeatures, @@ -71,6 +72,7 @@ var allFeaturesList = [ ipoFeatures, economicFeatures, jokesFeatures, + marketFeatures, ]; // features remove buttons @@ -99,6 +101,7 @@ var moviesRemoveBtn = document.getElementById("movies-remove-btn"); 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 allFeaturesRemoveBtns = [ stocksRemoveBtn, @@ -120,6 +123,7 @@ var allFeaturesRemoveBtns = [ ipoRemoveBtn, economicRemoveBtn, jokesRemoveBtn, + marketRemoveBtn, ]; // features increase buttons var stocksincreaseBtn = document.getElementById("stocks-increase-btn"); @@ -147,6 +151,7 @@ var moviesincreaseBtn = document.getElementById("movies-increase-btn"); 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 allFeaturesIncreaseBtns = [ stocksincreaseBtn, @@ -168,6 +173,7 @@ var allFeaturesIncreaseBtns = [ ipoincreaseBtn, economicincreaseBtn, jokesincreaseBtn, + marketincreaseBtn, ]; // features decrease buttons @@ -196,6 +202,7 @@ var moviesDecreaseBtn = document.getElementById("movies-decrease-btn"); 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 allFeaturesDecreaseBtns = [ stocksDecreaseBtn, @@ -217,6 +224,7 @@ var allFeaturesDecreaseBtns = [ ipoDecreaseBtn, economicDecreaseBtn, jokesDecreaseBtn, + marketDecreaseBtn, ]; const changeVarValue = () => { @@ -245,6 +253,7 @@ const changeVarValue = () => { ipoFeatures = document.querySelectorAll("#ipo-features li"); economicFeatures = document.querySelectorAll("#economic-list li"); jokesFeatures = document.querySelectorAll("#jokes-list li"); + marketFeatures = document.querySelectorAll("#market-list li"); allFeaturesList = [ stocksFeatures, @@ -266,6 +275,7 @@ const changeVarValue = () => { ipoFeatures, economicFeatures, jokesFeatures, + marketFeatures, ]; }; @@ -645,6 +655,7 @@ var movies = document.getElementById("movies-features"); 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 allFeatures = [ stocks, @@ -666,6 +677,7 @@ var allFeatures = [ ipos, economics, jokes, + market, ]; // features select box @@ -677,6 +689,7 @@ var teamStatsSelect = document.getElementById("inputTransition103"); var moviesSelect = document.getElementById("inputTransition64"); var economicSelect = document.getElementById("inputTransition2222"); var jokesSelect = document.getElementById("jokes-categories"); +var marketSelect = document.getElementById("market-categories"); var allFeaturesSelectBox = [ null, null, @@ -697,6 +710,7 @@ var allFeaturesSelectBox = [ null, economicSelect, jokesSelect, + marketSelect, ]; // features select add buttons @@ -707,6 +721,7 @@ var liveGamesAddBtn = document.getElementById("inputTransitionBtn93"); 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 allFeaturesSelectAddBtn = [ null, @@ -728,6 +743,7 @@ var allFeaturesSelectAddBtn = [ null, economicAddBtn, jokesAddBtn, + marketAddBtn, ]; allFeaturesSelectAddBtn.map((value, index) => { @@ -767,6 +783,7 @@ var allFeaturesFile = [ null, null, null, + null, ]; // features file add button var imagesFileAddBtn = document.getElementById("inputTextBtn11"); @@ -792,6 +809,7 @@ var allFeaturesFileAddBtn = [ null, null, null, + null, ]; // features input text @@ -824,6 +842,7 @@ var allFeaturesText = [ null, null, null, + null, ]; // features text add button @@ -856,6 +875,7 @@ var allFeaturesTextAddBtn = [ null, null, null, + null, ]; @@ -879,6 +899,7 @@ var allFeaturesLimit = [ null, null, null, + null, ]; @@ -1153,6 +1174,7 @@ function getFeatureSettings() { "IPO Calendar", "Economic Calendar", "Jokes", + "Gainers, Losers, Active", ]; let pageNum = features.indexOf(feature) + 1; let pageSelector = "Page" + pageNum.toString(); @@ -1221,6 +1243,9 @@ function getFeatureSettings() { case 19: s = getJokesSettings(page); break; + case 20: + s = getMarketSettings(page); + break; } settings = { ...settings, ...s }; // merge both sets of settings @@ -1418,6 +1443,7 @@ function saveMovieAPIKey(){ "IPO Calendar", "Economic Calendar", "Jokes", + "Gainers, Losers, Active", ]; let pageNum = features.indexOf(feature) + 1; let pageSelector = "Page" + pageNum.toString(); @@ -1461,6 +1487,7 @@ function saveIpoAPIKey(){ "IPO Calendar", "Economic Calendar", "Jokes", + "Gainers, Losers, Active", ]; let pageNum = features.indexOf(feature) + 1; let pageSelector = "Page" + pageNum.toString(); @@ -1896,7 +1923,7 @@ inputAnimationBtn.addEventListener("click", () => { // scroll speed row two let inputScrollSpeedRow = []; -for (let i = 1; i <= 19; i++) { +for (let i = 1; i <= 20; i++) { inputScrollSpeedRow.push( document.getElementById( i === 1 ? "inputScrollSpeedRow" : `inputScrollSpeedRow${i}` @@ -3264,7 +3291,7 @@ function featureSavePrompt() { const pageIDs = ['Page1', 'Page2', 'Page3', 'Page4', 'Page5', 'Page6', 'Page7', 'Page8', 'Page9', 'Page10', 'Page11', 'Page12', 'Page13', - 'Page14', 'Page15', 'Page16', 'Page17', 'Page18', 'Page19']; + 'Page14', 'Page15', 'Page16', 'Page17', 'Page18', 'Page19', 'Page20']; for (const pageID of pageIDs) { // Select the parent div @@ -3272,7 +3299,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']; + 'inputScrollSpeed16', 'inputScrollSpeed17', 'inputScrollSpeed19BG', 'market-categories']; const selectMenus = parentDiv.querySelectorAll('select'); selectMenus.forEach(selectMenu => {