From 90fe3937bbf9c12cf174a51202eefa704df8e517 Mon Sep 17 00:00:00 2001 From: Neythen Treloar Date: Thu, 24 Feb 2022 19:04:57 +0000 Subject: [PATCH] bugfix --- static/app.js | 41 ++++++++++++++++++++++++++++++++--------- 1 file changed, 32 insertions(+), 9 deletions(-) diff --git a/static/app.js b/static/app.js index 80d35f1..12c8f60 100755 --- a/static/app.js +++ b/static/app.js @@ -959,7 +959,14 @@ function getDisplaying(){ } -function get_page(){ + + + + + +// gets feature specific settings +function getFeatureSettings() { + let featureSelector = document.getElementById("drop"); feature = getSelected(featureSelector); let features = [ @@ -981,13 +988,6 @@ function get_page(){ let pageSelector = "Page" + pageNum.toString(); let page = document.getElementById(pageSelector); - return page; -} - -// gets feature specific settings -function getFeatureSettings() { - - let page = get_page(); // these common to all settings let speed = getSelected(page.querySelectorAll(".speed-select")[0]); @@ -1128,7 +1128,27 @@ function getWeatherSettings(page) { } function saveWeatherAPIKey(){ - let page = get_page(); + let featureSelector = document.getElementById("drop"); + feature = getSelected(featureSelector); + let features = [ + "Stocks", + "Crypto", + "Forex", + "Current Weather", + "Daily Forecast", + "News", + "Sports (Upcoming Games)", + "Sports (Past Games)", + "Sports (Live Games)", + "Sports (Team Stats)", + "Custom Images", + "Custom GIFs", + "Custom Messages", + ]; + let pageNum = features.indexOf(feature) + 1; + let pageSelector = "Page" + pageNum.toString(); + + let page = document.getElementById(pageSelector); let api_key = page.querySelectorAll(".api-key")[0].value; let settings = { @@ -1150,6 +1170,7 @@ var weatherAPIbtn = document.getElementById("weather-api-btn"); weatherAPIbtn.addEventListener("click", saveWeatherAPIKey); function getNewsSettings(page) { + /* let country = getSelected(page.querySelectorAll(".country-select")[0]); let category = getSelected(page.querySelectorAll(".category-select")[0]); let title = page.querySelectorAll(".title-select")[0].checked; @@ -1164,6 +1185,8 @@ function getNewsSettings(page) { // use_sources: use_sources, sources: sources, }; + * */ + settings = {} return settings; }