From 43d9ea7ccaefe508e877d929c67b056c1637b318 Mon Sep 17 00:00:00 2001 From: Neythen Date: Tue, 21 Sep 2021 20:31:47 +0100 Subject: [PATCH] tick bosxes populate from saved settings --- csv/crypto_settings.json | 2 +- csv/forex_settings.json | 2 +- csv/news_settings.json | 2 +- csv/stocks_settings.json | 2 +- static/app.js | 6 ++- templates/index.html | 97 +++++++++++++++++++++++++++++++--------- 6 files changed, 85 insertions(+), 26 deletions(-) diff --git a/csv/crypto_settings.json b/csv/crypto_settings.json index b9f447c..7a2ab7d 100644 --- a/csv/crypto_settings.json +++ b/csv/crypto_settings.json @@ -1 +1 @@ -{"feature": "Stocks", "speed": "medium", "animation": "continuous", "percent": false, "point": true, "no_logos": true, "chart": false, "title": true, "symbols": {"NEO,USD": -1, "BTC,USD": -1, "ETH,BTC": -1, "ADA,GBP": -1}} \ No newline at end of file +{"feature": "Stocks", "speed": "medium", "animation": "continuous", "percent": false, "point": true, "logos": true, "chart": false, "title": true, "symbols": {"NEO,USD": -1, "BTC,USD": -1, "ETH,BTC": -1, "ADA,GBP": -1}} diff --git a/csv/forex_settings.json b/csv/forex_settings.json index a4f9ea5..cd38e98 100644 --- a/csv/forex_settings.json +++ b/csv/forex_settings.json @@ -1 +1 @@ -{"feature": "Stocks", "speed": "medium", "animation": "continuous", "percent": false, "point": true, "no_logos": true, "chart": false, "title": true, "symbols": {"NZD,USD": -1, "CAD,USD": -1, "GBP,BTC": -1}} \ No newline at end of file +{"feature": "Stocks", "speed": "medium", "animation": "continuous", "percent": false, "point": true, "logos": true, "chart": false, "title": true, "symbols": {"NZD,USD": -1, "CAD,USD": -1, "GBP,BTC": -1}} diff --git a/csv/news_settings.json b/csv/news_settings.json index 3ed4a99..7910be1 100644 --- a/csv/news_settings.json +++ b/csv/news_settings.json @@ -1 +1 @@ -{"feature": "News", "speed": "medium", "animation": "continuous", "country": "USA", "category": "general", "title": true, "sources": {"Bloomberg": -1, "ABC News": -1, "Yahoo": -1}} \ No newline at end of file +{"feature": "News", "speed": "medium", "animation": "continuous", "country": "USA", "category": "general", "title": true, "use_sources":true, "sources": {"Bloomberg": -1, "ABC News": -1, "Yahoo": -1}} diff --git a/csv/stocks_settings.json b/csv/stocks_settings.json index e5cf1b3..5b8a74a 100644 --- a/csv/stocks_settings.json +++ b/csv/stocks_settings.json @@ -1 +1 @@ -{"feature": "Stocks", "speed": "medium", "animation": "continuous", "percent": false, "point": true, "no_logos": true, "chart": false, "title": true, "symbols": {"APL": 0.0, "GOOG": 0.0, "FB": -1, "ROKU": -1, "TGT": -1, "TSLA": -1, "SNAP": -1, "NFLX": -1, "MSFT": -1}} \ No newline at end of file +{"feature": "Stocks", "speed": "slow", "animation": "continuous", "percent": true, "point": false, "logos": true, "chart": false, "title": true, "symbols": {"APL": 0.0, "GOOG": 0.0, "FB": -1, "ROKU": -1, "TGT": -1, "TSLA": -1, "SNAP": -1, "NFLX": -1, "MSFT": -1}} diff --git a/static/app.js b/static/app.js index 15ef5cc..edc7e4a 100644 --- a/static/app.js +++ b/static/app.js @@ -603,6 +603,7 @@ function getSelected(selector) { var opt; for ( var i = 0, len = selector.options.length; i < len; i++ ) { opt = selector.options[i]; + if ( opt.selected === true ) { break; } @@ -702,7 +703,7 @@ function getTradingSettings(page) { let symbols_el = page.querySelectorAll(".symbol-list")[0]; let symbols = getListItems(symbols_el); - let settings = {'percent': percent, 'point':point, 'no_logos':no_logos, 'chart':chart, 'title': title, 'symbols': symbols} + let settings = {'percent': percent, 'point':point, 'logos':no_logos, 'chart':chart, 'title': title, 'symbols': symbols} return settings; } @@ -741,10 +742,11 @@ 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; + let use_sources = page.querySelectorAll(".sources-select")[0].checked; let sources_el = page.querySelectorAll(".sources-list")[0]; let sources = getListItems(sources_el); - settings = {'country':country, 'category': category, 'title':title, 'sources': sources}; + settings = {'country':country, 'category': category, 'title':title, 'use_sources':use_sources, 'sources': sources}; return settings; } diff --git a/templates/index.html b/templates/index.html index 9eea09b..74f49f1 100644 --- a/templates/index.html +++ b/templates/index.html @@ -321,6 +321,10 @@ type="checkbox" value="" id="flexCheckChecked" + + {% if stocks_settings.percent%} + checked + {%endif%} /> @@ -337,7 +341,9 @@ type="checkbox" value="" id="flexCheckChecked2" - checked + {% if stocks_settings.point%} + checked + {%endif%} /> @@ -354,7 +360,9 @@ type="checkbox" value="" id="flexCheckChecked3" - checked + {% if stocks_settings.logos%} + checked + {%endif%} /> @@ -371,6 +379,9 @@ type="checkbox" value="" id="flexCheckChecked4" + {% if stocks_settings.chart%} + checked + {%endif%} /> @@ -387,7 +398,9 @@ type="checkbox" value="" id="flexCheckChecked5" - checked + {% if stocks_settings.title%} + checked + {%endif%} /> @@ -511,6 +524,9 @@ type="checkbox" value="" id="flexCheckChecked6" + {% if crypto_settings.percent%} + checked + {%endif%} /> @@ -527,7 +543,9 @@ type="checkbox" value="" id="flexCheckChecked7" - checked + {% if crypto_settings.point%} + checked + {%endif%} /> @@ -544,7 +562,9 @@ type="checkbox" value="" id="flexCheckChecked8" - checked + {% if crypto_settings.logos%} + checked + {%endif%} /> @@ -561,6 +581,9 @@ type="checkbox" value="" id="flexCheckChecked9" + {% if crypto_settings.chart%} + checked + {%endif%} /> @@ -577,7 +600,9 @@ type="checkbox" value="" id="flexCheckChecked10" - checked + {% if crypto_settings.title%} + checked + {%endif%} /> @@ -701,6 +726,9 @@ type="checkbox" value="" id="flexCheckChecked11" + {% if forex_settings.percent%} + checked + {%endif%} /> @@ -717,7 +745,9 @@ type="checkbox" value="" id="flexCheckChecked12" - checked + {% if forex_settings.point%} + checked + {%endif%} /> @@ -734,7 +764,9 @@ type="checkbox" value="" id="flexCheckChecked13" - checked + {% if forex_settings.logos%} + checked + {%endif%} /> @@ -751,6 +783,9 @@ type="checkbox" value="" id="flexCheckChecked14" + {% if forex_settings.chart%} + checked + {%endif%} /> @@ -767,7 +802,9 @@ type="checkbox" value="" id="flexCheckChecked15" - checked + {% if forex_settings.title%} + checked + {%endif%} /> @@ -951,7 +988,9 @@ type="checkbox" value="" id="flexCheckChecked16" - checked + {% if current_weather.title%} + checked + {%endif%} /> @@ -1153,7 +1192,9 @@ type="checkbox" value="" id="flexCheckChecked18" - checked + {% if daily_weather.title%} + checked + {%endif%} /> @@ -1282,11 +1323,13 @@
@@ -1322,7 +1365,9 @@ type="checkbox" value="" id="flexCheckChecked19" - checked + {% if news_settings.title%} + checked + {%endif%} />
@@ -1447,7 +1492,9 @@ type="checkbox" value="" id="flexCheckChecked21" - checked + {% if upcoming_games.title%} + checked + {%endif%} /> @@ -1572,7 +1619,9 @@ type="checkbox" value="" id="flexCheckChecked22" - checked + {% if past_games.title%} + checked + {%endif%} /> @@ -1697,7 +1746,9 @@ type="checkbox" value="" id="flexCheckChecked23" - checked + {% if live_games.title%} + checked + {%endif%} /> @@ -1821,7 +1872,9 @@ type="checkbox" value="" id="flexCheckChecked24" - checked + {% if team_stats.title%} + checked + {%endif%} /> @@ -1970,7 +2023,9 @@ type="checkbox" value="" id="flexCheckChecked25" - checked + {% if image_settings.title%} + checked + {%endif%} /> @@ -2121,7 +2176,9 @@ type="checkbox" value="" id="flexCheckChecked28" - checked + {% if GIF_settings.title%} + checked + {%endif%} />