2021-08-11 19:58:01 +00:00
var availableFeatures = document . querySelectorAll ( "#available-features li" ) ;
2021-11-17 18:30:13 +00:00
var availableFeatures2 = document . querySelectorAll ( "#available-features-2 li" ) ;
2021-08-11 19:58:01 +00:00
var displayFormat = document . querySelector ( "#display-format" ) ;
2021-11-17 18:30:13 +00:00
var displayFormat2 = document . querySelector ( "#display-format-2" ) ;
2021-08-11 19:58:01 +00:00
var featureToDisplay = document . querySelector ( "#feature-to-display" ) ;
2021-11-17 18:30:13 +00:00
var featureToDisplay2 = document . querySelector ( "#feature-to-display-2" ) ;
2021-08-11 19:58:01 +00:00
var displayToFeature = document . querySelector ( "#display-to-feature" ) ;
2021-11-17 18:30:13 +00:00
var displayToFeature2 = document . querySelector ( "#display-to-feature-2" ) ;
2021-08-11 19:58:01 +00:00
var displayToFormat = document . querySelectorAll ( "#display-format li" ) ;
2021-11-17 18:30:13 +00:00
var displayToFormat2 = document . querySelectorAll ( "#display-format-2 li" ) ;
2021-08-11 19:58:01 +00:00
var availableToDisplay = document . querySelector ( "#available-features" ) ;
2021-11-17 18:30:13 +00:00
var availableToDisplay2 = document . querySelector ( "#available-features-2" ) ;
2021-08-11 19:58:01 +00:00
var displayincreaseBtn = document . getElementById ( "display-increase-btn" ) ;
2021-11-17 18:30:13 +00:00
var displayincreaseBtn2 = document . getElementById ( "display-increase-btn-2" ) ;
2021-08-11 19:58:01 +00:00
var displayDecreaseBtn = document . getElementById ( "display-decrease-btn" ) ;
2021-11-17 18:30:13 +00:00
var displayDecreaseBtn2 = document . getElementById ( "display-decrease-btn-2" ) ;
var secondRow = document . getElementById ( "second-row" ) ;
2021-08-11 19:58:01 +00:00
// features lists
var stocksFeatures = document . querySelectorAll ( "#stocks-features li" ) ;
var cryptoFeatures = document . querySelectorAll ( "#crypto-features li" ) ;
var forexFeatures = document . querySelectorAll ( "#forex-features li" ) ;
var currentWeatherFeatures = document . querySelectorAll (
"#current-weather-features li"
) ;
var dailyForecastFeatures = document . querySelectorAll (
"#daily-forecast-features li"
) ;
var newsFeatures = document . querySelectorAll ( "#news-features li" ) ;
var upcomingGamesFeatures = document . querySelectorAll (
"#upcoming-games-features li"
) ;
var pastGamesFeatures = document . querySelectorAll ( "#past-games-features li" ) ;
var liveGamesFeatures = document . querySelectorAll ( "#live-games-features li" ) ;
var teamStatsFeatures = document . querySelectorAll ( "#team-stats-features li" ) ;
var imagesFeatures = document . querySelectorAll ( "#images-features li" ) ;
var gifsFeatures = document . querySelectorAll ( "#gifs-features li" ) ;
var messagesFeatures = document . querySelectorAll ( "#messages-features li" ) ;
2022-06-12 18:04:59 +00:00
var commoditiesFeatures = document . querySelectorAll ( "#commodities-features li" ) ;
2022-10-05 10:29:42 +00:00
var indicesFeatures = document . querySelectorAll ( "#indices-features li" ) ;
2023-01-09 08:58:19 +00:00
var moviesFeatures = document . querySelectorAll ( "#movies-features li" ) ;
2023-03-08 06:41:44 +00:00
var ipoFeatures = document . querySelectorAll ( "#ipo-features li" ) ;
2023-06-14 07:57:05 +00:00
var economicFeatures = document . querySelectorAll ( "#economic-list li" ) ;
2023-07-12 08:06:32 +00:00
var jokesFeatures = document . querySelectorAll ( "#jokes-list li" ) ;
2023-08-08 09:14:50 +00:00
var marketFeatures = document . querySelectorAll ( "#market-list li" ) ;
2023-08-14 09:59:08 +00:00
var sectorFeatures = document . querySelectorAll ( "#sector-list li" ) ;
2023-08-16 08:22:39 +00:00
var placeFeatures = document . querySelectorAll ( "#place-list li" ) ;
2023-08-29 11:40:10 +00:00
var clock1Features = document . querySelectorAll ( "#clock1-features li" ) ;
2023-08-29 13:13:19 +00:00
var clock2Features = document . querySelectorAll ( "#clock2-features li" ) ;
var worldclockFeatures = document . querySelectorAll ( "#worldclock-features li" ) ;
2023-09-23 08:58:09 +00:00
var quotesFeatures = document . querySelectorAll ( "#quotes-list li" ) ;
2021-08-11 19:58:01 +00:00
var allFeaturesList = [
stocksFeatures ,
cryptoFeatures ,
forexFeatures ,
currentWeatherFeatures ,
dailyForecastFeatures ,
newsFeatures ,
upcomingGamesFeatures ,
pastGamesFeatures ,
liveGamesFeatures ,
teamStatsFeatures ,
imagesFeatures ,
gifsFeatures ,
messagesFeatures ,
2022-06-12 18:04:59 +00:00
commoditiesFeatures ,
2022-10-05 10:29:42 +00:00
indicesFeatures ,
2023-01-09 08:58:19 +00:00
moviesFeatures ,
2023-03-08 06:41:44 +00:00
ipoFeatures ,
2023-06-14 07:57:05 +00:00
economicFeatures ,
2023-07-12 08:06:32 +00:00
jokesFeatures ,
2023-08-08 09:14:50 +00:00
marketFeatures ,
2023-08-14 09:59:08 +00:00
sectorFeatures ,
2023-08-16 08:22:39 +00:00
placeFeatures ,
2023-08-29 11:40:10 +00:00
clock1Features ,
2023-08-29 13:13:19 +00:00
clock2Features ,
worldclockFeatures ,
2023-09-23 08:58:09 +00:00
quotesFeatures ,
2021-08-11 19:58:01 +00:00
] ;
// features remove buttons
var stocksRemoveBtn = document . getElementById ( "stocks-remove-btn" ) ;
var cryptoRemoveBtn = document . getElementById ( "crypto-remove-btn" ) ;
var forexRemoveBtn = document . getElementById ( "forex-remove-btn" ) ;
var currentWeatherRemoveBtn = document . getElementById (
"current-weather-remove-btn"
) ;
var dailyForecastRemoveBtn = document . getElementById (
"daily-forecast-remove-btn"
) ;
var newsRemoveBtn = document . getElementById ( "news-remove-btn" ) ;
var upcomingGamesRemoveBtn = document . getElementById (
"upcoming-games-remove-btn"
) ;
var pastGamesRemoveBtn = document . getElementById ( "past-games-remove-btn" ) ;
var liveGamesRemoveBtn = document . getElementById ( "live-games-remove-btn" ) ;
var teamStatsRemoveBtn = document . getElementById ( "team-stats-remove-btn" ) ;
var imagesRemoveBtn = document . getElementById ( "images-remove-btn" ) ;
var gifsRemoveBtn = document . getElementById ( "gifs-remove-btn" ) ;
var messagesRemoveBtn = document . getElementById ( "messages-remove-btn" ) ;
2022-06-12 18:04:59 +00:00
var commoditiesRemoveBtn = document . getElementById ( "commodities-remove-btn" ) ;
2022-10-05 10:29:42 +00:00
var indicesRemoveBtn = document . getElementById ( "indices-remove-btn" ) ;
2023-01-09 08:58:19 +00:00
var moviesRemoveBtn = document . getElementById ( "movies-remove-btn" ) ;
2023-03-08 06:41:44 +00:00
var ipoRemoveBtn = document . getElementById ( "ipo-remove-btn" ) ;
2023-06-14 07:57:05 +00:00
var economicRemoveBtn = document . getElementById ( "economic-remove-btn" ) ;
2023-07-12 08:06:32 +00:00
var jokesRemoveBtn = document . getElementById ( "jokes-remove-btn" ) ;
2023-08-08 09:14:50 +00:00
var marketRemoveBtn = document . getElementById ( "market-remove-btn" ) ;
2023-08-14 09:59:08 +00:00
var sectorRemoveBtn = document . getElementById ( "sector-remove-btn" ) ;
2023-08-16 08:22:39 +00:00
var placeRemoveBtn = document . getElementById ( "place-remove-btn" ) ;
2023-08-29 11:40:10 +00:00
var clock1RemoveBtn = document . getElementById ( "clock1-remove-btn" ) ;
2023-08-29 13:13:19 +00:00
var clock2RemoveBtn = document . getElementById ( "clock2-remove-btn" ) ;
var worldclockRemoveBtn = document . getElementById ( "worldclock-remove-btn" ) ;
2023-09-23 08:58:09 +00:00
var quotesRemoveBtn = document . getElementById ( "quotes-remove-btn" ) ;
2021-08-11 19:58:01 +00:00
var allFeaturesRemoveBtns = [
stocksRemoveBtn ,
cryptoRemoveBtn ,
forexRemoveBtn ,
currentWeatherRemoveBtn ,
dailyForecastRemoveBtn ,
newsRemoveBtn ,
upcomingGamesRemoveBtn ,
pastGamesRemoveBtn ,
liveGamesRemoveBtn ,
teamStatsRemoveBtn ,
imagesRemoveBtn ,
gifsRemoveBtn ,
messagesRemoveBtn ,
2022-06-12 18:04:59 +00:00
commoditiesRemoveBtn ,
2022-10-05 10:29:42 +00:00
indicesRemoveBtn ,
2023-01-09 08:58:19 +00:00
moviesRemoveBtn ,
2023-03-08 06:41:44 +00:00
ipoRemoveBtn ,
2023-06-14 07:57:05 +00:00
economicRemoveBtn ,
2023-07-12 08:06:32 +00:00
jokesRemoveBtn ,
2023-08-08 09:14:50 +00:00
marketRemoveBtn ,
2023-08-14 09:59:08 +00:00
sectorRemoveBtn ,
2023-08-16 08:22:39 +00:00
placeRemoveBtn ,
2023-08-29 11:40:10 +00:00
clock1RemoveBtn ,
2023-08-29 13:13:19 +00:00
clock2RemoveBtn ,
worldclockRemoveBtn ,
2023-09-23 08:58:09 +00:00
quotesRemoveBtn ,
2021-08-11 19:58:01 +00:00
] ;
// features increase buttons
var stocksincreaseBtn = document . getElementById ( "stocks-increase-btn" ) ;
var cryptoincreaseBtn = document . getElementById ( "crypto-increase-btn" ) ;
var forexincreaseBtn = document . getElementById ( "forex-increase-btn" ) ;
var currentWeatherincreaseBtn = document . getElementById (
"current-weather-increase-btn"
) ;
var dailyForecastincreaseBtn = document . getElementById (
"daily-forecast-increase-btn"
) ;
var newsincreaseBtn = document . getElementById ( "news-increase-btn" ) ;
var upcomingGamesincreaseBtn = document . getElementById (
"upcoming-games-increase-btn"
) ;
var pastGamesincreaseBtn = document . getElementById ( "past-games-increase-btn" ) ;
var liveGamesincreaseBtn = document . getElementById ( "live-games-increase-btn" ) ;
var teamStatsincreaseBtn = document . getElementById ( "team-stats-increase-btn" ) ;
var imagesincreaseBtn = document . getElementById ( "images-increase-btn" ) ;
var gifsincreaseBtn = document . getElementById ( "gifs-increase-btn" ) ;
var messagesincreaseBtn = document . getElementById ( "messages-increase-btn" ) ;
2022-06-12 18:04:59 +00:00
var commoditiesincreaseBtn = document . getElementById ( "commodities-increase-btn" ) ;
2022-10-05 10:29:42 +00:00
var indicesincreaseBtn = document . getElementById ( "indices-increase-btn" ) ;
2023-01-09 08:58:19 +00:00
var moviesincreaseBtn = document . getElementById ( "movies-increase-btn" ) ;
2023-03-08 06:41:44 +00:00
var ipoincreaseBtn = document . getElementById ( "ipo-increase-btn" ) ;
2023-06-14 07:57:05 +00:00
var economicincreaseBtn = document . getElementById ( "economic-increase-btn" ) ;
2023-07-12 08:06:32 +00:00
var jokesincreaseBtn = document . getElementById ( "jokes-increase-btn" ) ;
2023-08-08 09:14:50 +00:00
var marketincreaseBtn = document . getElementById ( "market-increase-btn" ) ;
2023-08-14 09:59:08 +00:00
var sectorincreaseBtn = document . getElementById ( "sector-increase-btn" ) ;
2023-08-16 08:22:39 +00:00
var placeincreaseBtn = document . getElementById ( "place-increase-btn" ) ;
2023-08-29 11:40:10 +00:00
var clock1increaseBtn = document . getElementById ( "clock1-increase-btn" ) ;
2023-08-29 13:13:19 +00:00
var clock2increaseBtn = document . getElementById ( "clock2-increase-btn" ) ;
var worldclockincreaseBtn = document . getElementById ( "worldclock-increase-btn" ) ;
2023-09-23 08:58:09 +00:00
var quotesincreaseBtn = document . getElementById ( "quotes-increase-btn" ) ;
2021-08-11 19:58:01 +00:00
var allFeaturesIncreaseBtns = [
stocksincreaseBtn ,
cryptoincreaseBtn ,
forexincreaseBtn ,
currentWeatherincreaseBtn ,
dailyForecastincreaseBtn ,
newsincreaseBtn ,
upcomingGamesincreaseBtn ,
pastGamesincreaseBtn ,
liveGamesincreaseBtn ,
teamStatsincreaseBtn ,
imagesincreaseBtn ,
gifsincreaseBtn ,
messagesincreaseBtn ,
2022-06-12 18:04:59 +00:00
commoditiesincreaseBtn ,
2022-10-05 10:29:42 +00:00
indicesincreaseBtn ,
2023-01-09 08:58:19 +00:00
moviesincreaseBtn ,
2023-03-08 06:41:44 +00:00
ipoincreaseBtn ,
2023-06-14 07:57:05 +00:00
economicincreaseBtn ,
2023-07-12 08:06:32 +00:00
jokesincreaseBtn ,
2023-08-08 09:14:50 +00:00
marketincreaseBtn ,
2023-08-14 09:59:08 +00:00
sectorincreaseBtn ,
2023-08-16 08:22:39 +00:00
placeincreaseBtn ,
2023-08-29 11:40:10 +00:00
clock1increaseBtn ,
2023-08-29 13:13:19 +00:00
clock2increaseBtn ,
worldclockincreaseBtn ,
2023-09-23 08:58:09 +00:00
quotesincreaseBtn ,
2021-08-11 19:58:01 +00:00
] ;
// features decrease buttons
var stocksDecreaseBtn = document . getElementById ( "stocks-decrease-btn" ) ;
var cryptoDecreaseBtn = document . getElementById ( "crypto-decrease-btn" ) ;
var forexDecreaseBtn = document . getElementById ( "forex-decrease-btn" ) ;
var currentWeatherDecreaseBtn = document . getElementById (
"current-weather-decrease-btn"
) ;
var dailyForecastDecreaseBtn = document . getElementById (
"daily-forecast-decrease-btn"
) ;
var newsDecreaseBtn = document . getElementById ( "news-decrease-btn" ) ;
var upcomingGamesDecreaseBtn = document . getElementById (
"upcoming-games-decrease-btn"
) ;
var pastGamesDecreaseBtn = document . getElementById ( "past-games-decrease-btn" ) ;
var liveGamesDecreaseBtn = document . getElementById ( "live-games-decrease-btn" ) ;
var teamStatsDecreaseBtn = document . getElementById ( "team-stats-decrease-btn" ) ;
var imagesDecreaseBtn = document . getElementById ( "images-decrease-btn" ) ;
var gifsDecreaseBtn = document . getElementById ( "gifs-decrease-btn" ) ;
var messagesDecreaseBtn = document . getElementById ( "messages-decrease-btn" ) ;
2022-06-12 18:04:59 +00:00
var commoditiesDecreaseBtn = document . getElementById ( "commodities-decrease-btn" ) ;
2022-10-05 10:29:42 +00:00
var indicesDecreaseBtn = document . getElementById ( "indices-decrease-btn" ) ;
2023-01-09 08:58:19 +00:00
var moviesDecreaseBtn = document . getElementById ( "movies-decrease-btn" ) ;
2023-03-08 06:41:44 +00:00
var ipoDecreaseBtn = document . getElementById ( "ipo-decrease-btn" ) ;
2023-06-14 07:57:05 +00:00
var economicDecreaseBtn = document . getElementById ( "economic-decrease-btn" ) ;
2023-07-12 08:06:32 +00:00
var jokesDecreaseBtn = document . getElementById ( "jokes-decrease-btn" ) ;
2023-08-08 09:14:50 +00:00
var marketDecreaseBtn = document . getElementById ( "market-decrease-btn" ) ;
2023-08-14 09:59:08 +00:00
var sectorDecreaseBtn = document . getElementById ( "sector-decrease-btn" ) ;
2023-08-16 08:22:39 +00:00
var placeDecreaseBtn = document . getElementById ( "place-decrease-btn" ) ;
2023-08-29 11:40:10 +00:00
var clock1DecreaseBtn = document . getElementById ( "clock1-decrease-btn" ) ;
2023-08-29 13:13:19 +00:00
var clock2DecreaseBtn = document . getElementById ( "clock2-decrease-btn" ) ;
var worldclockDecreaseBtn = document . getElementById ( "worldclock-decrease-btn" ) ;
2023-09-23 08:58:09 +00:00
var quotesDecreaseBtn = document . getElementById ( "quotes-decrease-btn" ) ;
2021-08-11 19:58:01 +00:00
var allFeaturesDecreaseBtns = [
stocksDecreaseBtn ,
cryptoDecreaseBtn ,
forexDecreaseBtn ,
currentWeatherDecreaseBtn ,
dailyForecastDecreaseBtn ,
newsDecreaseBtn ,
upcomingGamesDecreaseBtn ,
pastGamesDecreaseBtn ,
liveGamesDecreaseBtn ,
teamStatsDecreaseBtn ,
imagesDecreaseBtn ,
gifsDecreaseBtn ,
messagesDecreaseBtn ,
2022-06-12 18:04:59 +00:00
commoditiesDecreaseBtn ,
2022-10-05 10:29:42 +00:00
indicesDecreaseBtn ,
2023-01-09 08:58:19 +00:00
moviesDecreaseBtn ,
2023-03-08 06:41:44 +00:00
ipoDecreaseBtn ,
2023-06-14 07:57:05 +00:00
economicDecreaseBtn ,
2023-07-12 08:06:32 +00:00
jokesDecreaseBtn ,
2023-08-08 09:14:50 +00:00
marketDecreaseBtn ,
2023-08-14 09:59:08 +00:00
sectorDecreaseBtn ,
2023-08-16 08:22:39 +00:00
placeDecreaseBtn ,
2023-08-29 11:40:10 +00:00
clock1DecreaseBtn ,
2023-08-29 13:13:19 +00:00
clock2DecreaseBtn ,
worldclockDecreaseBtn ,
2023-09-23 08:58:09 +00:00
quotesDecreaseBtn ,
2021-08-11 19:58:01 +00:00
] ;
const changeVarValue = ( ) => {
stocksFeatures = document . querySelectorAll ( "#stocks-features li" ) ;
cryptoFeatures = document . querySelectorAll ( "#crypto-features li" ) ;
forexFeatures = document . querySelectorAll ( "#forex-features li" ) ;
currentWeatherFeatures = document . querySelectorAll (
"#current-weather-features li"
) ;
dailyForecastFeatures = document . querySelectorAll (
"#daily-forecast-features li"
) ;
newsFeatures = document . querySelectorAll ( "#news-features li" ) ;
upcomingGamesFeatures = document . querySelectorAll (
"#upcoming-games-features li"
) ;
pastGamesFeatures = document . querySelectorAll ( "#past-games-features li" ) ;
liveGamesFeatures = document . querySelectorAll ( "#live-games-features li" ) ;
teamStatsFeatures = document . querySelectorAll ( "#team-stats-features li" ) ;
imagesFeatures = document . querySelectorAll ( "#images-features li" ) ;
gifsFeatures = document . querySelectorAll ( "#gifs-features li" ) ;
messagesFeatures = document . querySelectorAll ( "#messages-features li" ) ;
2022-06-12 18:04:59 +00:00
commoditiesFeatures = document . querySelectorAll ( "#commodities-features li" ) ;
2022-10-05 10:29:42 +00:00
indicesFeatures = document . querySelectorAll ( "#indices-features li" ) ;
2023-01-09 08:58:19 +00:00
moviesFeatures = document . querySelectorAll ( "#movies-features li" ) ;
2023-03-08 06:41:44 +00:00
ipoFeatures = document . querySelectorAll ( "#ipo-features li" ) ;
2023-06-14 07:57:05 +00:00
economicFeatures = document . querySelectorAll ( "#economic-list li" ) ;
2023-07-12 08:06:32 +00:00
jokesFeatures = document . querySelectorAll ( "#jokes-list li" ) ;
2023-08-08 09:14:50 +00:00
marketFeatures = document . querySelectorAll ( "#market-list li" ) ;
2023-08-14 09:59:08 +00:00
sectorFeatures = document . querySelectorAll ( "#sector-list li" ) ;
2023-08-16 08:22:39 +00:00
placeFeatures = document . querySelectorAll ( "#place-list li" ) ;
2023-08-29 11:40:10 +00:00
clock1Features = document . querySelectorAll ( "#clock1-features li" ) ;
2023-08-29 13:13:19 +00:00
clock2Features = document . querySelectorAll ( "#clock2-features li" ) ;
worldclockFeatures = document . querySelectorAll ( "#worldclock-features li" ) ;
2023-09-23 08:58:09 +00:00
quotesFeatures = document . querySelectorAll ( "#quotes-list li" ) ;
2023-03-08 06:41:44 +00:00
2021-08-11 19:58:01 +00:00
allFeaturesList = [
stocksFeatures ,
cryptoFeatures ,
forexFeatures ,
currentWeatherFeatures ,
dailyForecastFeatures ,
newsFeatures ,
upcomingGamesFeatures ,
pastGamesFeatures ,
liveGamesFeatures ,
teamStatsFeatures ,
imagesFeatures ,
gifsFeatures ,
messagesFeatures ,
2022-06-12 18:04:59 +00:00
commoditiesFeatures ,
2022-10-05 10:29:42 +00:00
indicesFeatures ,
2023-01-09 08:58:19 +00:00
moviesFeatures ,
2023-03-08 06:41:44 +00:00
ipoFeatures ,
2023-06-14 07:57:05 +00:00
economicFeatures ,
2023-07-12 08:06:32 +00:00
jokesFeatures ,
2023-08-08 09:14:50 +00:00
marketFeatures ,
2023-08-14 09:59:08 +00:00
sectorFeatures ,
2023-08-16 08:22:39 +00:00
placeFeatures ,
2023-08-29 11:40:10 +00:00
clock1Features ,
2023-08-29 13:13:19 +00:00
clock2Features ,
worldclockFeatures ,
2023-09-23 08:58:09 +00:00
quotesFeatures ,
2021-08-11 19:58:01 +00:00
] ;
} ;
const addEventOnList = ( ) => {
// for available feature
for ( let i = 0 ; i < availableFeatures . length ; i ++ ) {
const availableFeature = availableFeatures [ i ] ;
availableFeature . addEventListener ( "click" , ( ) => {
for ( let i = 0 ; i < availableFeatures . length ; i ++ ) {
availableFeatures [ i ] . setAttribute ( "class" , "" ) ;
}
if ( availableFeature . getAttribute ( "class" ) == "active" ) {
availableFeature . setAttribute ( "class" , "" ) ;
} else {
availableFeature . setAttribute ( "class" , "active" ) ;
}
} ) ;
}
2021-11-17 18:30:13 +00:00
// for available feature 2
for ( let i = 0 ; i < availableFeatures2 . length ; i ++ ) {
const availableFeature = availableFeatures2 [ i ] ;
availableFeature . addEventListener ( "click" , ( ) => {
for ( let i = 0 ; i < availableFeatures2 . length ; i ++ ) {
availableFeatures2 [ i ] . setAttribute ( "class" , "" ) ;
}
if ( availableFeature . getAttribute ( "class" ) == "active" ) {
availableFeature . setAttribute ( "class" , "" ) ;
} else {
availableFeature . setAttribute ( "class" , "active" ) ;
}
} ) ;
}
2021-08-11 19:58:01 +00:00
// for display format
for ( let i = 0 ; i < displayToFormat . length ; i ++ ) {
const display _format = displayToFormat [ i ] ;
display _format . addEventListener ( "click" , ( ) => {
for ( let i = 0 ; i < displayToFormat . length ; i ++ ) {
displayToFormat [ i ] . setAttribute ( "class" , "" ) ;
}
if ( display _format . getAttribute ( "class" ) == "active" ) {
display _format . setAttribute ( "class" , "" ) ;
} else {
display _format . setAttribute ( "class" , "active" ) ;
}
} ) ;
}
2021-11-17 18:30:13 +00:00
// for display format 2
for ( let i = 0 ; i < displayToFormat2 . length ; i ++ ) {
const display _format = displayToFormat2 [ i ] ;
display _format . addEventListener ( "click" , ( ) => {
for ( let i = 0 ; i < displayToFormat2 . length ; i ++ ) {
displayToFormat2 [ i ] . setAttribute ( "class" , "" ) ;
}
if ( display _format . getAttribute ( "class" ) == "active" ) {
display _format . setAttribute ( "class" , "" ) ;
} else {
display _format . setAttribute ( "class" , "active" ) ;
}
} ) ;
}
2021-08-11 19:58:01 +00:00
} ;
const addEventonBtns = ( ) => {
featureToDisplay . addEventListener ( "click" , ( ) => {
for ( let i = 0 ; i < availableFeatures . length ; i ++ ) {
const availableFeature = availableFeatures [ i ] ;
if ( availableFeature . getAttribute ( "class" ) == "active" ) {
availableFeature . remove ( ) ;
availableFeature . setAttribute ( "class" , "" ) ;
displayFormat . appendChild ( availableFeature ) ;
availableFeatures = document . querySelectorAll ( "#available-features li" ) ;
displayToFormat = document . querySelectorAll ( "#display-format li" ) ;
addEventOnList ( ) ;
2023-07-17 10:18:07 +00:00
displaySavePrompt ( ) ;
2021-08-11 19:58:01 +00:00
}
}
} ) ;
displayToFeature . addEventListener ( "click" , ( ) => {
for ( let i = 0 ; i < displayToFormat . length ; i ++ ) {
const availableFormat = displayToFormat [ i ] ;
if ( availableFormat . getAttribute ( "class" ) == "active" ) {
availableFormat . remove ( ) ;
availableFormat . setAttribute ( "class" , "" ) ;
availableToDisplay . appendChild ( availableFormat ) ;
availableFeatures = document . querySelectorAll ( "#available-features li" ) ;
displayToFormat = document . querySelectorAll ( "#display-format li" ) ;
addEventOnList ( ) ;
2023-07-17 10:18:07 +00:00
displaySavePrompt ( ) ;
2021-08-11 19:58:01 +00:00
}
}
} ) ;
2021-11-17 18:30:13 +00:00
featureToDisplay2 . addEventListener ( "click" , ( ) => {
for ( let i = 0 ; i < availableFeatures2 . length ; i ++ ) {
const availableFeature = availableFeatures2 [ i ] ;
if ( availableFeature . getAttribute ( "class" ) == "active" ) {
availableFeature . remove ( ) ;
availableFeature . setAttribute ( "class" , "" ) ;
displayFormat2 . appendChild ( availableFeature ) ;
availableFeatures2 = document . querySelectorAll (
"#available-features-2 li"
) ;
displayToFormat2 = document . querySelectorAll ( "#display-format-2 li" ) ;
addEventOnList ( ) ;
2023-07-17 10:18:07 +00:00
displaySavePrompt ( ) ;
2021-11-17 18:30:13 +00:00
}
}
} ) ;
displayToFeature2 . addEventListener ( "click" , ( ) => {
for ( let i = 0 ; i < displayToFormat2 . length ; i ++ ) {
const availableFormat = displayToFormat2 [ i ] ;
if ( availableFormat . getAttribute ( "class" ) == "active" ) {
availableFormat . remove ( ) ;
availableFormat . setAttribute ( "class" , "" ) ;
availableToDisplay2 . appendChild ( availableFormat ) ;
availableFeatures2 = document . querySelectorAll (
"#available-features-2 li"
) ;
displayToFormat2 = document . querySelectorAll ( "#display-format-2 li" ) ;
addEventOnList ( ) ;
2023-07-17 10:18:07 +00:00
displaySavePrompt ( ) ;
2021-11-17 18:30:13 +00:00
}
}
} ) ;
2021-08-11 19:58:01 +00:00
} ;
addEventOnList ( ) ;
addEventonBtns ( ) ;
const addEventOnFeaturesList = ( ) => {
allFeaturesList . map ( ( value ) => {
for ( let i = 0 ; i < value . length ; i ++ ) {
const availableFeature = value [ i ] ;
availableFeature . addEventListener ( "click" , ( ) => {
for ( let i = 0 ; i < value . length ; i ++ ) {
value [ i ] . setAttribute ( "class" , "" ) ;
}
if ( availableFeature . getAttribute ( "class" ) == "active" ) {
availableFeature . setAttribute ( "class" , "" ) ;
} else {
availableFeature . setAttribute ( "class" , "active" ) ;
2022-02-26 16:35:15 +00:00
let getCustomImages = JSON . parse (
localStorage . getItem ( "customImages" )
) ;
let getCustomGifs = JSON . parse ( localStorage . getItem ( "customGifs" ) ) ;
let getCustomMsg = JSON . parse ( localStorage . getItem ( "customMsg" ) ) ;
2021-11-17 18:30:13 +00:00
getCustomImages . map ( ( value ) => {
let scrollSpeed1 = document . getElementById ( "inputScrollSpeed11" ) ;
let scrollSpeed2 = document . getElementById ( "inputScrollSpeedRow11" ) ;
let inputTransition = document . getElementById ( "inputTransition11" ) ;
let inputText12 = document . getElementById ( "inputText12" ) ;
let displayCheck = document . getElementById ( "flexCheckChecked25" ) ;
if ( value . fileName == availableFeature . innerText ) {
scrollSpeed1 . value = value . scrollSpeed ;
scrollSpeed2 . value = value . scrollSpeed2 ;
inputTransition . value = value . transition ;
inputText12 . value = value . pauseScreen ;
displayCheck . checked = value . displayCheck ;
}
} ) ;
getCustomGifs . map ( ( value ) => {
let scrollSpeed1 = document . getElementById ( "inputScrollSpeed12" ) ;
let scrollSpeed2 = document . getElementById ( "inputScrollSpeedRow12" ) ;
let inputTransition = document . getElementById ( "inputTransition12" ) ;
let inputText12 = document . getElementById ( "inputText112" ) ;
let displayCheck = document . getElementById ( "flexCheckChecked28" ) ;
if ( value . fileName == availableFeature . innerText ) {
scrollSpeed1 . value = value . scrollSpeed ;
scrollSpeed2 . value = value . scrollSpeed2 ;
inputTransition . value = value . transition ;
inputText12 . value = value . pauseScreen ;
displayCheck . checked = value . displayCheck ;
}
} ) ;
getCustomMsg . map ( ( value ) => {
let scrollSpeed1 = document . getElementById ( "inputScrollSpeed13" ) ;
let scrollSpeed2 = document . getElementById ( "inputScrollSpeedRow13" ) ;
let inputTransition = document . getElementById ( "inputTransition13" ) ;
let inputMsg = document . getElementById ( "inputText14" ) ;
let inputColor = document . getElementById ( "inputScrollSpeed16" ) ;
let inputSize = document . getElementById ( "inputScrollSpeed17" ) ;
2023-07-19 16:00:51 +00:00
let inputBg = document . getElementById ( "inputScrollSpeed19BG" ) ;
2021-11-17 18:30:13 +00:00
let displayCheck = document . getElementById ( "flexCheckChecked29" ) ;
if ( value . messageName == availableFeature . innerText ) {
scrollSpeed1 . value = value . scrollSpeed1 ;
scrollSpeed2 . value = value . scrollSpeed2 ;
inputTransition . value = value . transition ;
inputMsg . value = value . messageInput ;
inputColor . value = value . colorInput ;
inputSize . value = value . sizeInput ;
inputBg . value = value . backgroundInput ;
displayCheck . checked = value . displayCheck ;
}
} ) ;
2021-08-11 19:58:01 +00:00
}
} ) ;
}
} ) ;
} ;
addEventOnFeaturesList ( ) ;
// display increase function
displayincreaseBtn . addEventListener ( "click" , ( ) => {
for ( let i = 0 ; i < displayToFormat . length ; i ++ ) {
var displayItem = displayToFormat [ i ] ;
if ( displayItem . getAttribute ( "class" ) == "active" ) {
var prevElement = displayItem . previousElementSibling ;
var currentText = displayItem . innerText ;
displayItem . innerText = prevElement . innerText ;
prevElement . innerText = currentText ;
prevElement . setAttribute ( "class" , "active" ) ;
displayItem . setAttribute ( "class" , "" ) ;
2023-07-17 10:18:07 +00:00
displaySavePrompt ( ) ;
2021-08-11 19:58:01 +00:00
}
}
} ) ;
2021-11-17 18:30:13 +00:00
// display increase 2 function
displayincreaseBtn2 . addEventListener ( "click" , ( ) => {
for ( let i = 0 ; i < displayToFormat2 . length ; i ++ ) {
var displayItem = displayToFormat2 [ i ] ;
if ( displayItem . getAttribute ( "class" ) == "active" ) {
var prevElement = displayItem . previousElementSibling ;
var currentText = displayItem . innerText ;
displayItem . innerText = prevElement . innerText ;
prevElement . innerText = currentText ;
prevElement . setAttribute ( "class" , "active" ) ;
displayItem . setAttribute ( "class" , "" ) ;
2023-07-17 10:18:07 +00:00
displaySavePrompt ( ) ;
2021-11-17 18:30:13 +00:00
}
}
} ) ;
2021-08-11 19:58:01 +00:00
// display decrease function
displayDecreaseBtn . addEventListener ( "click" , ( ) => {
for ( let i = 0 ; i < displayToFormat . length ; i ++ ) {
var displayItem = displayToFormat [ i ] ;
if ( displayItem . getAttribute ( "class" ) == "active" ) {
var nextElement = displayItem . nextElementSibling ;
var currentText = displayItem . innerText ;
displayItem . innerText = nextElement . innerText ;
nextElement . innerText = currentText ;
nextElement . setAttribute ( "class" , "active" ) ;
displayItem . setAttribute ( "class" , "" ) ;
2023-07-17 10:18:07 +00:00
displaySavePrompt ( ) ;
2021-08-11 19:58:01 +00:00
break ;
}
}
} ) ;
2021-11-17 18:30:13 +00:00
// display decrease 2 function
displayDecreaseBtn2 . addEventListener ( "click" , ( ) => {
for ( let i = 0 ; i < displayToFormat2 . length ; i ++ ) {
var displayItem = displayToFormat2 [ i ] ;
if ( displayItem . getAttribute ( "class" ) == "active" ) {
var nextElement = displayItem . nextElementSibling ;
var currentText = displayItem . innerText ;
displayItem . innerText = nextElement . innerText ;
nextElement . innerText = currentText ;
nextElement . setAttribute ( "class" , "active" ) ;
displayItem . setAttribute ( "class" , "" ) ;
2023-07-17 10:18:07 +00:00
displaySavePrompt ( ) ;
2021-11-17 18:30:13 +00:00
break ;
}
}
} ) ;
2021-08-11 19:58:01 +00:00
// feature remove function
allFeaturesRemoveBtns . map ( ( value , index ) => {
value . addEventListener ( "click" , ( ) => {
for ( let i = 0 ; i < allFeaturesList [ index ] . length ; i ++ ) {
var item = allFeaturesList [ index ] [ i ] ;
2022-02-24 18:35:43 +00:00
console . log ( item ) ;
2023-03-17 08:50:55 +00:00
if ( ( item . getAttribute ( "class" ) == "active" ) && ( index == 0 ) ) {
let symbol = item . innerText ;
item . remove ( ) ;
uploaded _images = [ ] ;
uploaded _GIFs = [ ] ;
fetch ( "/deletePortfolioSettings" , {
method : "POST" ,
body : JSON . stringify ( symbol ) ,
} ) ;
2023-07-18 09:46:50 +00:00
displaySavePrompt2 ( ) ;
2023-03-17 08:50:55 +00:00
}
2023-03-17 09:22:10 +00:00
else if ( ( item . getAttribute ( "class" ) == "active" ) && ( index == 1 ) ) {
let symbol = item . innerText ;
item . remove ( ) ;
uploaded _images = [ ] ;
uploaded _GIFs = [ ] ;
fetch ( "/deletePortfolioCryptoSettings" , {
method : "POST" ,
body : JSON . stringify ( symbol ) ,
2023-07-18 09:46:50 +00:00
} ) ;
displaySavePrompt2 ( ) ;
2023-03-17 09:22:10 +00:00
}
2023-03-17 08:50:55 +00:00
else if ( item . getAttribute ( "class" ) == "active" ) {
2022-02-24 18:35:43 +00:00
item . remove ( ) ;
2022-03-02 10:18:05 +00:00
uploaded _images = [ ] ;
uploaded _GIFs = [ ] ;
2023-07-18 09:46:50 +00:00
displaySavePrompt2 ( ) ;
2021-08-11 19:58:01 +00:00
}
}
} ) ;
} ) ;
// feature increase function
allFeaturesIncreaseBtns . map ( ( value , index ) => {
value . addEventListener ( "click" , ( ) => {
for ( let i = 0 ; i < allFeaturesList [ index ] . length ; i ++ ) {
var item = allFeaturesList [ index ] [ i ] ;
if ( item . getAttribute ( "class" ) == "active" ) {
var prevElement = item . previousElementSibling ;
var currentText = item . innerText ;
item . innerText = prevElement . innerText ;
prevElement . innerText = currentText ;
prevElement . setAttribute ( "class" , "active" ) ;
item . setAttribute ( "class" , "" ) ;
2023-07-18 09:46:50 +00:00
displaySavePrompt2 ( ) ;
2021-08-11 19:58:01 +00:00
}
}
} ) ;
} ) ;
// feature decrease function
allFeaturesDecreaseBtns . map ( ( value , index ) => {
value . addEventListener ( "click" , ( ) => {
for ( let i = 0 ; i < allFeaturesList [ index ] . length ; i ++ ) {
var item = allFeaturesList [ index ] [ i ] ;
if ( item . getAttribute ( "class" ) == "active" ) {
var nextElement = item . nextElementSibling ;
var currentText = item . innerText ;
item . innerText = nextElement . innerText ;
nextElement . innerText = currentText ;
nextElement . setAttribute ( "class" , "active" ) ;
item . setAttribute ( "class" , "" ) ;
2023-07-18 09:46:50 +00:00
displaySavePrompt2 ( ) ;
2021-08-11 19:58:01 +00:00
break ;
}
}
} ) ;
} ) ;
// all features
var stocks = document . getElementById ( "stocks-features" ) ;
var crypto1 = document . getElementById ( "crypto-features" ) ;
var forex = document . getElementById ( "forex-features" ) ;
var currentWeather = document . getElementById ( "current-weather-features" ) ;
var dailyForecast = document . getElementById ( "daily-forecast-features" ) ;
var news = document . getElementById ( "news-features" ) ;
var upcomingGames = document . getElementById ( "upcoming-games-features" ) ;
var pastGames = document . getElementById ( "past-games-features" ) ;
var liveGames = document . getElementById ( "live-games-features" ) ;
var teamStats = document . getElementById ( "team-stats-features" ) ;
var images = document . getElementById ( "images-features" ) ;
var gifs = document . getElementById ( "gifs-features" ) ;
var messages = document . getElementById ( "messages-features" ) ;
2022-06-12 18:04:59 +00:00
var commodities = document . getElementById ( "commodities-features" ) ;
2022-10-05 10:29:42 +00:00
var indices = document . getElementById ( "indices-features" ) ;
2023-01-09 08:58:19 +00:00
var movies = document . getElementById ( "movies-features" ) ;
2023-03-08 06:41:44 +00:00
var ipos = document . getElementById ( "ipo-features" ) ;
2023-06-14 07:57:05 +00:00
var economics = document . getElementById ( "economic-list" ) ;
2023-07-12 08:06:32 +00:00
var jokes = document . getElementById ( "jokes-list" ) ;
2023-08-08 09:14:50 +00:00
var market = document . getElementById ( "market-list" ) ;
2023-08-14 09:59:08 +00:00
var sector = document . getElementById ( "sector-list" ) ;
2023-08-16 08:22:39 +00:00
var place = document . getElementById ( "place-list" ) ;
2023-08-29 11:40:10 +00:00
var clock1 = document . getElementById ( "clock1-features" ) ;
2023-08-29 13:13:19 +00:00
var clock2 = document . getElementById ( "clock2-features" ) ;
var worldclock = document . getElementById ( "worldclock-features" ) ;
2023-09-23 08:58:09 +00:00
var quotes = document . getElementById ( "quotes-list" ) ;
2021-08-11 19:58:01 +00:00
var allFeatures = [
stocks ,
crypto1 ,
forex ,
currentWeather ,
dailyForecast ,
news ,
upcomingGames ,
pastGames ,
liveGames ,
teamStats ,
images ,
gifs ,
messages ,
2022-06-12 18:04:59 +00:00
commodities ,
2022-10-05 10:29:42 +00:00
indices ,
2023-01-09 08:58:19 +00:00
movies ,
2023-03-08 06:41:44 +00:00
ipos ,
2023-06-14 07:57:05 +00:00
economics ,
2023-07-12 08:06:32 +00:00
jokes ,
2023-08-08 09:14:50 +00:00
market ,
2023-08-14 09:59:08 +00:00
sector ,
2023-08-16 08:22:39 +00:00
place ,
2023-08-29 13:13:19 +00:00
clock1 ,
clock2 ,
worldclock ,
2023-09-23 08:58:09 +00:00
quotes ,
2021-08-11 19:58:01 +00:00
] ;
// features select box
var newsSelect = document . getElementById ( "inputTransition63" ) ;
var upcomingGamesSelect = document . getElementById ( "inputTransition73" ) ;
var pastGamesSelect = document . getElementById ( "inputTransition83" ) ;
var liveGamesSelect = document . getElementById ( "inputTransition93" ) ;
var teamStatsSelect = document . getElementById ( "inputTransition103" ) ;
2023-01-09 08:58:19 +00:00
var moviesSelect = document . getElementById ( "inputTransition64" ) ;
2023-06-14 07:57:05 +00:00
var economicSelect = document . getElementById ( "inputTransition2222" ) ;
2023-07-12 08:06:32 +00:00
var jokesSelect = document . getElementById ( "jokes-categories" ) ;
2023-08-08 09:14:50 +00:00
var marketSelect = document . getElementById ( "market-categories" ) ;
2023-08-14 09:59:08 +00:00
var sectorSelect = document . getElementById ( "sector-categories" ) ;
2023-08-16 08:22:39 +00:00
var placeSelect = document . getElementById ( "place-categories" ) ;
2021-08-11 19:58:01 +00:00
var allFeaturesSelectBox = [
null ,
null ,
null ,
null ,
null ,
newsSelect ,
upcomingGamesSelect ,
pastGamesSelect ,
liveGamesSelect ,
teamStatsSelect ,
null ,
null ,
null ,
2022-06-12 18:04:59 +00:00
null ,
2022-10-05 10:29:42 +00:00
null ,
2023-01-09 08:58:19 +00:00
moviesSelect ,
2023-03-08 06:41:44 +00:00
null ,
2023-06-14 07:57:05 +00:00
economicSelect ,
2023-07-12 08:06:32 +00:00
jokesSelect ,
2023-08-08 09:14:50 +00:00
marketSelect ,
2023-08-14 09:59:08 +00:00
sectorSelect ,
2023-08-16 08:22:39 +00:00
placeSelect ,
2023-08-29 11:40:10 +00:00
null ,
2023-08-29 13:13:19 +00:00
null ,
null ,
2023-09-23 08:58:09 +00:00
null ,
2021-08-11 19:58:01 +00:00
] ;
// features select add buttons
var newsAddBtn = document . getElementById ( "inputTransitionBtn63" ) ;
var upcomingGamesAddBtn = document . getElementById ( "inputTransitionBtn73" ) ;
var pastGamesAddBtn = document . getElementById ( "inputTransitionBtn83" ) ;
var liveGamesAddBtn = document . getElementById ( "inputTransitionBtn93" ) ;
var teamStatsAddBtn = document . getElementById ( "inputTransitionBtn103" ) ;
2023-06-14 07:57:05 +00:00
var economicAddBtn = document . getElementById ( "economic-countries-btn" ) ;
2023-07-12 08:06:32 +00:00
var jokesAddBtn = document . getElementById ( "jokes-categories-btn" ) ;
2023-08-08 09:14:50 +00:00
var marketAddBtn = document . getElementById ( "market-categories-btn" ) ;
2023-08-14 09:59:08 +00:00
var sectorAddBtn = document . getElementById ( "sector-categories-btn" ) ;
2023-08-16 08:22:39 +00:00
var placeAddBtn = document . getElementById ( "place-categories-btn" ) ;
2023-06-14 07:57:05 +00:00
2021-08-11 19:58:01 +00:00
var allFeaturesSelectAddBtn = [
null ,
null ,
null ,
null ,
null ,
newsAddBtn ,
upcomingGamesAddBtn ,
pastGamesAddBtn ,
liveGamesAddBtn ,
teamStatsAddBtn ,
null ,
null ,
null ,
2022-06-12 18:04:59 +00:00
null ,
2022-10-05 10:29:42 +00:00
null ,
2023-01-09 08:58:19 +00:00
null ,
2023-03-08 06:41:44 +00:00
null ,
2023-06-14 07:57:05 +00:00
economicAddBtn ,
2023-07-12 08:06:32 +00:00
jokesAddBtn ,
2023-08-08 09:14:50 +00:00
marketAddBtn ,
2023-08-14 09:59:08 +00:00
sectorAddBtn ,
2023-08-16 08:22:39 +00:00
placeAddBtn ,
2023-08-29 11:40:10 +00:00
null ,
2023-08-29 13:13:19 +00:00
null ,
null ,
2023-09-23 08:58:09 +00:00
null ,
2021-08-11 19:58:01 +00:00
] ;
allFeaturesSelectAddBtn . map ( ( value , index ) => {
if ( value != null ) {
value . addEventListener ( "click" , ( ) => {
var tag = document . createElement ( "li" ) ;
tag . innerHTML = allFeaturesSelectBox [ index ] . value ;
allFeatures [ index ] . appendChild ( tag ) ;
changeVarValue ( ) ;
addEventOnFeaturesList ( ) ;
2023-07-18 10:26:52 +00:00
displaySavePrompt2 ( ) ;
2021-08-11 19:58:01 +00:00
} ) ;
}
} ) ;
// features input file
var imagesFile = document . getElementById ( "inputText11" ) ;
var gifsFile = document . getElementById ( "inputText1112" ) ;
var allFeaturesFile = [
null ,
null ,
null ,
null ,
null ,
null ,
null ,
null ,
null ,
null ,
imagesFile ,
gifsFile ,
null ,
2022-06-12 18:04:59 +00:00
null ,
2022-10-05 10:29:42 +00:00
null ,
2023-01-09 08:58:19 +00:00
null ,
2023-03-08 06:41:44 +00:00
null ,
2023-06-14 07:57:05 +00:00
null ,
2023-07-12 08:06:32 +00:00
null ,
2023-08-08 09:14:50 +00:00
null ,
2023-08-14 09:59:08 +00:00
null ,
2023-08-16 08:22:39 +00:00
null ,
2023-08-29 11:40:10 +00:00
null ,
2023-08-29 13:13:19 +00:00
null ,
null ,
2023-09-23 08:58:09 +00:00
null ,
2021-08-11 19:58:01 +00:00
] ;
// features file add button
var imagesFileAddBtn = document . getElementById ( "inputTextBtn11" ) ;
var gifsFileAddBtn = document . getElementById ( "inputTextBtn1112" ) ;
var allFeaturesFileAddBtn = [
null ,
null ,
null ,
null ,
null ,
null ,
null ,
null ,
null ,
null ,
imagesFileAddBtn ,
gifsFileAddBtn ,
null ,
2022-06-12 18:04:59 +00:00
null ,
2022-10-05 10:29:42 +00:00
null ,
2023-01-09 08:58:19 +00:00
null ,
2023-03-08 06:41:44 +00:00
null ,
2023-06-14 07:57:05 +00:00
null ,
2023-07-12 08:06:32 +00:00
null ,
2023-08-08 09:14:50 +00:00
null ,
2023-08-14 09:59:08 +00:00
null ,
2023-08-16 08:22:39 +00:00
null ,
2023-08-29 11:40:10 +00:00
null ,
2023-08-29 13:13:19 +00:00
null ,
null ,
2023-09-23 08:58:09 +00:00
null ,
2021-08-11 19:58:01 +00:00
] ;
// features input text
var stocksText = document . getElementById ( "inputText3" ) ;
var cryptoText = document . getElementById ( "inputText4" ) ;
2023-06-12 07:31:14 +00:00
var forexText = document . getElementById ( "base-select" ) . value + ',' + document . getElementById ( "quote-select" ) . value ;
2021-08-11 19:58:01 +00:00
var currentWeatherText = document . getElementById ( "inputText6" ) ;
var dailyForecastText = document . getElementById ( "inputText7" ) ;
var messagesText = document . getElementById ( "inputText13" ) ;
2023-06-12 07:39:30 +00:00
var indicesText = document . getElementById ( "indices-items" ) ;
var commoditiesText = document . getElementById ( "commodities-items" ) ;
2021-08-11 19:58:01 +00:00
var allFeaturesText = [
stocksText ,
cryptoText ,
forexText ,
currentWeatherText ,
dailyForecastText ,
null ,
null ,
null ,
null ,
null ,
null ,
null ,
messagesText ,
2022-06-12 18:04:59 +00:00
commoditiesText ,
2022-10-05 10:29:42 +00:00
indicesText ,
2023-01-09 08:58:19 +00:00
null ,
2023-03-08 06:41:44 +00:00
null ,
2023-06-14 07:57:05 +00:00
null ,
2023-07-12 08:06:32 +00:00
null ,
2023-08-08 09:14:50 +00:00
null ,
2023-08-14 09:59:08 +00:00
null ,
2023-08-16 08:22:39 +00:00
null ,
2023-08-29 11:40:10 +00:00
null ,
2023-08-29 13:13:19 +00:00
null ,
null ,
2023-09-23 08:58:09 +00:00
null ,
2021-08-11 19:58:01 +00:00
] ;
// features text add button
var stocksTextAddBtn = document . getElementById ( "inputTextBtn3" ) ;
var cryptoTextAddBtn = document . getElementById ( "inputTextBtn4" ) ;
var forexTextAddBtn = document . getElementById ( "inputTextBtn5" ) ;
var currentWeatherTextAddBtn = document . getElementById ( "inputTextBtn6" ) ;
var dailyForecastTextAddBtn = document . getElementById ( "inputTextBtn7" ) ;
var messagesTextAddBtn = document . getElementById ( "inputTextBtn13" ) ;
2022-06-12 18:04:59 +00:00
var commoditiesTextAddBtn = document . getElementById ( "inputTextBtn20" ) ;
2022-10-05 10:29:42 +00:00
var indicesTextAddBtn = document . getElementById ( "inputTextBtn21" ) ;
2021-08-11 19:58:01 +00:00
var allFeaturesTextAddBtn = [
stocksTextAddBtn ,
cryptoTextAddBtn ,
forexTextAddBtn ,
currentWeatherTextAddBtn ,
dailyForecastTextAddBtn ,
null ,
null ,
null ,
null ,
null ,
null ,
null ,
messagesTextAddBtn ,
2022-06-12 18:04:59 +00:00
commoditiesTextAddBtn ,
2022-10-05 10:29:42 +00:00
indicesTextAddBtn ,
2023-01-09 08:58:19 +00:00
null ,
2023-03-08 06:41:44 +00:00
null ,
2023-06-14 07:57:05 +00:00
null ,
2023-07-12 08:06:32 +00:00
null ,
2023-08-08 09:14:50 +00:00
null ,
2023-08-14 09:59:08 +00:00
null ,
2023-08-16 08:22:39 +00:00
null ,
2023-08-29 11:40:10 +00:00
null ,
2023-08-29 13:13:19 +00:00
null ,
null ,
2023-09-23 08:58:09 +00:00
null ,
2021-08-11 19:58:01 +00:00
] ;
2022-02-24 18:35:43 +00:00
var allFeaturesLimit = [
200 ,
100 ,
100 ,
20 ,
20 ,
null ,
null ,
null ,
null ,
null ,
20 ,
20 ,
20 ,
2022-06-12 18:04:59 +00:00
30 ,
2022-10-05 10:29:42 +00:00
40 ,
2023-01-09 08:58:19 +00:00
null ,
2023-03-08 06:41:44 +00:00
null ,
2023-06-14 07:57:05 +00:00
null ,
2023-07-12 08:06:32 +00:00
null ,
2023-08-08 09:14:50 +00:00
null ,
2023-08-14 09:59:08 +00:00
null ,
2023-08-16 08:22:39 +00:00
null ,
2023-08-29 11:40:10 +00:00
null ,
2023-08-29 13:13:19 +00:00
null ,
null ,
2023-09-23 08:58:09 +00:00
null ,
2022-02-24 18:35:43 +00:00
] ;
2022-06-11 16:19:01 +00:00
var createLi = false ;
// function addingItems() {
2021-08-11 19:58:01 +00:00
allFeaturesTextAddBtn . map ( ( value , index ) => {
if ( value !== null ) {
value . addEventListener ( "click" , ( ) => {
2022-06-11 16:19:01 +00:00
if ( ( value == messagesTextAddBtn ) && ( createLi === true ) ) {
2021-11-17 18:30:13 +00:00
// custom message
let messageName = document . getElementById ( "inputText13" ) . value ;
let scrollSpeed1 = document . getElementById ( "inputScrollSpeed13" ) . value ;
let scrollSpeed2 = document . getElementById (
"inputScrollSpeedRow13"
) . value ;
let transition = document . getElementById ( "inputTransition13" ) . value ;
let messageInput = document . getElementById ( "inputText14" ) . value ;
let colorInput = document . getElementById ( "inputScrollSpeed16" ) . value ;
let sizeInput = document . getElementById ( "inputScrollSpeed17" ) . value ;
let backgroundInput =
2023-07-19 16:00:51 +00:00
document . getElementById ( "inputScrollSpeed19BG" ) . value ;
2021-11-17 18:30:13 +00:00
let displayCheck =
document . getElementById ( "flexCheckChecked29" ) . checked ;
let messagesWrapper = document . getElementById ( "messages-features" ) ;
let fileFound = false ;
for ( let i = 0 ; i < messagesWrapper . children . length ; i ++ ) {
fileFound =
messagesWrapper . children [ i ] ? . innerText == messageName && true ;
}
if ( ! fileFound ) {
let values = {
messageName ,
scrollSpeed1 ,
scrollSpeed2 ,
transition ,
messageInput ,
colorInput ,
sizeInput ,
backgroundInput ,
displayCheck ,
} ;
2022-02-26 16:35:15 +00:00
let getCustomMsg = localStorage . getItem ( "customMsg" ) ;
2021-11-17 18:30:13 +00:00
let newValues = getCustomMsg && JSON . parse ( getCustomMsg ) ;
getCustomMsg && newValues . push ( values ) ;
2022-02-24 18:35:43 +00:00
// getCustomMsg
// ? localStorage.setItem("customMsg", JSON.stringify(newValues))
// : localStorage.setItem("customMsg", JSON.stringify([values]));
2022-06-11 16:19:01 +00:00
2021-11-17 18:30:13 +00:00
var tag = document . createElement ( "li" ) ;
2022-02-24 18:35:43 +00:00
var msg = "You've reached the maximum limit of items to add for this feature" ;
// if the list length exceeds the limit
if ( allFeatures [ index ] . getElementsByTagName ( "li" ) . length == allFeaturesLimit [ index ] ) {
document . getElementById ( "limit-msg" ) . innerHTML = msg ;
}
else {
tag . innerHTML = allFeaturesText [ index ] . value ;
2023-07-07 08:22:21 +00:00
tag . setAttribute ( "onclick" , "getCustomMsg(this.innerText)" ) ;
2022-02-24 18:35:43 +00:00
allFeatures [ index ] . appendChild ( tag ) ;
changeVarValue ( ) ;
addEventOnFeaturesList ( ) ;
2023-07-18 10:56:44 +00:00
displaySavePrompt2 ( ) ;
2022-06-11 16:19:01 +00:00
createLi = false ;
} }
2021-11-17 18:30:13 +00:00
} else {
2022-02-24 18:35:43 +00:00
var msg = "You've reached the maximum limit of items to add for this feature" ;
// if the list length exceeds the limit
if ( allFeatures [ index ] . getElementsByTagName ( "li" ) . length > allFeaturesLimit [ index ] ) {
document . getElementById ( "limit-msg" ) . innerHTML = msg ;
}
else {
2022-06-11 16:19:01 +00:00
if ( createLi === true ) {
2022-02-24 18:35:43 +00:00
var tag = document . createElement ( "li" ) ;
2023-06-12 07:31:14 +00:00
if ( index == 2 ) {
tag . innerHTML = document . getElementById ( "base-select" ) . value + ',' + document . getElementById ( "quote-select" ) . value ;
2023-07-11 09:37:21 +00:00
} else if ( index == 0 ) {
tag . innerHTML = allFeaturesText [ index ] . value ;
tag . setAttribute ( "onclick" , "getStockSymbol(this.innerText)" ) ;
} else if ( index == 1 ) {
tag . innerHTML = allFeaturesText [ index ] . value ;
tag . setAttribute ( "onclick" , "getCryptoSymbol(this.innerText)" ) ;
} else {
2023-06-12 07:31:14 +00:00
tag . innerHTML = allFeaturesText [ index ] . value ;
}
2022-02-24 18:35:43 +00:00
allFeatures [ index ] . appendChild ( tag ) ;
changeVarValue ( ) ;
addEventOnFeaturesList ( ) ;
2023-07-18 10:26:52 +00:00
displaySavePrompt2 ( ) ;
2022-06-11 16:19:01 +00:00
createLi = false ;
2022-02-24 18:35:43 +00:00
}
}
2022-06-11 16:19:01 +00:00
} } ) ;
2021-08-11 19:58:01 +00:00
}
} ) ;
2022-06-14 09:37:57 +00:00
var startButton = document . getElementById ( "start-btn" ) ;
// start the display
startButton . addEventListener ( "click" , ( ) => {
fetch ( "/start" , {
method : "PUT" ,
} ) ;
} ) ;
2021-10-25 18:42:00 +00:00
var brightnessButton = document . getElementById ( "brightness-btn" ) ;
// start the display
brightnessButton . addEventListener ( "click" , ( ) => {
let brightness = document . querySelectorAll ( ".brightness-text" ) [ 0 ] . value ;
fetch ( "/brightness" , {
2021-11-17 18:30:13 +00:00
method : "PUT" ,
body : JSON . stringify ( { brightness : brightness } ) ,
2021-10-25 18:42:00 +00:00
} ) ;
} ) ;
2021-08-18 19:50:02 +00:00
var shutdownButton = document . getElementById ( "shutdown-btn" ) ;
shutdownButton . addEventListener ( "click" , ( ) => {
fetch ( "/shutdown" , {
2021-11-17 18:30:13 +00:00
method : "GET" ,
2021-08-18 19:50:02 +00:00
} ) ;
2023-01-30 13:33:45 +00:00
document . getElementById ( 'yooo' ) . style . display = "block" ;
2021-08-18 19:50:02 +00:00
} ) ;
2022-02-24 18:35:43 +00:00
var restartButton = document . getElementById ( "restart-btn" ) ;
restartButton . addEventListener ( "click" , ( ) => {
fetch ( "/restart" , {
method : "GET" ,
} ) ;
2023-01-30 13:33:45 +00:00
document . getElementById ( 'yooo' ) . style . display = "block" ;
2022-02-24 18:35:43 +00:00
} ) ;
2022-02-26 16:35:15 +00:00
var resetButton = document . getElementById ( "reset-btn" ) ;
resetButton . addEventListener ( "click" , ( ) => {
fetch ( "/reset" , {
method : "GET" ,
} ) ;
2023-02-04 08:24:20 +00:00
document . getElementById ( 'yooo' ) . style . display = "block" ;
2022-02-26 16:35:15 +00:00
} ) ;
2022-02-24 18:35:43 +00:00
2021-08-18 19:50:02 +00:00
var stopButton = document . getElementById ( "stop-btn" ) ;
stopButton . addEventListener ( "click" , ( ) => {
fetch ( "/stop" , {
2021-11-17 18:30:13 +00:00
method : "GET" ,
2021-08-18 19:50:02 +00:00
} ) ;
} ) ;
2021-11-18 17:50:50 +00:00
2022-02-26 16:35:15 +00:00
var screensaverButton = document . getElementById ( "screensaver-btn" ) ;
screensaverButton . addEventListener ( "click" , ( ) => {
2021-11-18 17:50:50 +00:00
let anim = localStorage . getItem ( "inputAnimation" ) ;
fetch ( "/screensaver" , {
method : "POST" ,
body : anim ,
} ) ;
} ) ;
2021-11-20 15:30:31 +00:00
var updateButton = document . getElementById ( "update-btn" ) ;
updateButton . addEventListener ( "click" , ( ) => {
fetch ( "/update" , {
method : "POST" ,
} ) ;
} ) ;
2021-08-18 19:50:02 +00:00
var dispFormatButton = document . getElementById ( "dispformat-btn" ) ;
var displayFormats = document . getElementById ( "inputDisplayFormat" ) ;
2021-09-16 19:23:04 +00:00
// gets selected functions to display
2021-08-18 19:50:02 +00:00
function getSelected ( selector ) {
var opt ;
2021-11-17 18:30:13 +00:00
for ( var i = 0 , len = selector . options . length ; i < len ; i ++ ) {
opt = selector . options [ i ] ;
if ( opt . selected === true ) {
break ;
}
2021-08-18 19:50:02 +00:00
}
2021-11-17 18:30:13 +00:00
2021-08-18 19:50:02 +00:00
return opt . innerHTML ;
}
2021-09-16 19:23:04 +00:00
function getListItems ( list _el ) {
let symbols = list _el . getElementsByTagName ( "li" ) ;
2021-11-17 18:30:13 +00:00
let items = [ ] ;
2021-09-16 19:23:04 +00:00
for ( var i = 0 ; i < symbols . length ; ++ i ) {
items . push ( symbols [ i ] . innerText ) ;
}
return items ;
}
2022-02-24 17:05:37 +00:00
2021-08-18 19:50:02 +00:00
2021-12-10 17:06:47 +00:00
// gets which features are to be displayed
function getDisplaying ( ) {
let opt = getSelected ( displayFormats ) ;
if ( opt . includes ( "Standard" ) ) {
var list _el = document . getElementById ( "display-format" ) ;
let features = getListItems ( list _el ) ;
2022-02-24 17:05:37 +00:00
return [ features ] ;
2021-12-10 17:06:47 +00:00
} else if ( opt . includes ( "Professional" ) ) {
var top _list _el = document . getElementById ( "display-format" ) ;
let top _features = getListItems ( top _list _el ) ;
var bot _list _el = document . getElementById ( "display-format-2" ) ;
let bot _features = getListItems ( bot _list _el ) ;
let features = [ top _features , bot _features ] ;
return features ;
}
}
2022-02-24 19:04:57 +00:00
// gets feature specific settings
function getFeatureSettings ( ) {
2021-08-18 19:50:02 +00:00
let featureSelector = document . getElementById ( "drop" ) ;
feature = getSelected ( featureSelector ) ;
2021-11-17 18:30:13 +00:00
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" ,
2022-06-12 18:04:59 +00:00
"Commodities" ,
2022-10-05 10:29:42 +00:00
"Indices" ,
2023-01-09 08:58:19 +00:00
"Movies" ,
2023-03-08 06:41:44 +00:00
"IPO Calendar" ,
2023-06-14 07:57:05 +00:00
"Economic Calendar" ,
2023-07-12 08:06:32 +00:00
"Jokes" ,
2023-08-08 09:14:50 +00:00
"Gainers, Losers, Active" ,
2023-08-14 09:59:08 +00:00
"Sector Performance" ,
2023-08-17 10:10:02 +00:00
"Place (Reddit)" ,
2023-08-29 11:40:10 +00:00
"Clock 1" ,
2023-08-29 13:13:19 +00:00
"Clock 2" ,
"World Clock" ,
2023-09-23 08:58:09 +00:00
"Inspirational Quotes" ,
2021-11-17 18:30:13 +00:00
] ;
2021-08-18 19:50:02 +00:00
let pageNum = features . indexOf ( feature ) + 1 ;
let pageSelector = "Page" + pageNum . toString ( ) ;
2021-11-17 18:30:13 +00:00
2021-08-18 19:50:02 +00:00
let page = document . getElementById ( pageSelector ) ;
2021-11-17 18:30:13 +00:00
2021-09-16 19:23:04 +00:00
// these common to all settings
2022-03-07 16:47:07 +00:00
let speeds = page . querySelectorAll ( ".speed-select" ) ;
var speed ;
var speed2 ;
speed = getSelected ( speeds [ 0 ] ) ;
if ( speeds . length == 2 ) {
speed2 = getSelected ( page . querySelectorAll ( ".speed-select" ) [ 1 ] ) ;
} else {
speed2 = "Medium" ;
}
2021-08-18 19:50:02 +00:00
let animation = getSelected ( page . querySelectorAll ( ".animation-select" ) [ 0 ] ) ;
2021-11-17 18:30:13 +00:00
2022-03-07 16:47:07 +00:00
var settings = { feature : feature , speed : speed , speed2 : speed2 , animation : animation } ; // general settings
2021-11-17 18:30:13 +00:00
2021-09-16 19:23:04 +00:00
var s ;
//function specific settings
2021-11-17 18:30:13 +00:00
switch ( pageNum ) {
case 1 :
case 2 :
case 3 :
2021-09-16 19:23:04 +00:00
s = getTradingSettings ( page ) ;
break ;
2021-11-17 18:30:13 +00:00
case 4 :
case 5 :
2021-09-16 19:23:04 +00:00
s = getWeatherSettings ( page ) ;
break ;
2022-01-24 18:40:06 +00:00
case 6 :
2021-09-16 19:23:04 +00:00
s = getNewsSettings ( page ) ;
break ;
2021-11-17 18:30:13 +00:00
case 7 :
case 8 :
case 9 :
case 10 :
2021-09-16 19:23:04 +00:00
s = getSportsSettings ( page ) ;
break ;
2021-11-17 18:30:13 +00:00
case 11 :
case 12 :
2021-09-16 19:23:04 +00:00
s = getImageSettings ( page ) ;
break ;
case 13 :
s = getMessageSettings ( page ) ;
break ;
2022-06-12 18:04:59 +00:00
case 14 :
s = getTradingSettings ( page ) ;
break ;
2022-10-05 10:29:42 +00:00
case 15 :
s = getTradingSettings ( page ) ;
break ;
2023-01-09 08:58:19 +00:00
case 16 :
s = getMovieSettings ( page ) ;
break ;
2023-03-08 06:41:44 +00:00
case 17 :
s = getIpoSettings ( page ) ;
break ;
2023-06-14 07:57:05 +00:00
case 18 :
s = getEconomicSettings ( page ) ;
break ;
2023-07-12 08:06:32 +00:00
case 19 :
s = getJokesSettings ( page ) ;
break ;
2023-08-08 09:14:50 +00:00
case 20 :
s = getMarketSettings ( page ) ;
break ;
2023-08-14 09:59:08 +00:00
case 21 :
s = getSectorSettings ( page ) ;
break ;
2023-08-16 08:22:39 +00:00
case 22 :
s = getPlaceSettings ( page ) ;
break ;
2023-08-29 11:40:10 +00:00
case 23 :
s = getClock1Settings ( page ) ;
break ;
2023-08-29 13:13:19 +00:00
case 24 :
s = getClock2Settings ( page ) ;
break ;
case 25 :
s = getWorldclockSettings ( page ) ;
break ;
2023-09-23 08:58:09 +00:00
case 26 :
s = getQuotesSettings ( page ) ;
break ;
2021-09-16 19:23:04 +00:00
}
2021-12-10 17:06:47 +00:00
2021-12-29 13:05:45 +00:00
settings = { ... settings , ... s } ; // merge both sets of settings
return settings ;
}
function getFiles ( ) {
var data = new FormData ( ) ;
2021-11-17 18:30:13 +00:00
for ( var i = 0 ; i < uploaded _images . length ; i ++ ) {
2021-10-07 19:40:43 +00:00
data . append ( uploaded _images [ i ] . name , uploaded _images [ i ] ) ;
2021-12-29 13:05:45 +00:00
console . log ( uploaded _images [ i ] . name ) ;
2021-10-07 19:40:43 +00:00
}
2021-12-29 13:05:45 +00:00
for ( var i = 0 ; i < uploaded _GIFs . length ; i ++ ) {
2021-10-07 19:40:43 +00:00
data . append ( uploaded _GIFs [ i ] . name , uploaded _GIFs [ i ] ) ;
}
2021-12-29 13:05:45 +00:00
//return data;
2021-10-07 19:40:43 +00:00
fetch ( "/upload" , {
2021-11-17 18:30:13 +00:00
method : "POST" ,
body : data ,
2021-10-07 19:40:43 +00:00
} ) ;
2021-12-10 17:06:47 +00:00
}
function saveSettings ( ) {
2021-12-29 13:05:45 +00:00
let displaying = getDisplaying ( ) ;
let feature _settings = getFeatureSettings ( ) ;
let files = getFiles ( ) ;
console . log ( JSON . stringify ( { 'displaying' : displaying , 'feature_settings' : feature _settings , 'files' : files } ) ) ;
2021-12-10 17:06:47 +00:00
fetch ( "/save" , {
2021-12-29 13:05:45 +00:00
method : "POST" ,
2021-12-10 17:06:47 +00:00
body : JSON . stringify ( { 'displaying' : displaying , 'feature_settings' : feature _settings } ) ,
} ) ;
2021-08-18 19:50:02 +00:00
}
2021-12-10 17:06:47 +00:00
2022-02-24 18:35:43 +00:00
let saveSettingsButtons = document . querySelectorAll ( ".save-btn" ) . forEach ( ( button ) => button . addEventListener ( "click" , saveSettings ) ) ;
2021-09-16 19:23:04 +00:00
2021-11-17 18:30:13 +00:00
// gets the stock, crypto or forex specific settings
2021-09-16 19:23:04 +00:00
function getTradingSettings ( page ) {
// get all the tick boxes
2023-03-16 15:23:11 +00:00
let whatFeature = document . getElementById ( 'drop' ) . value ;
2021-09-16 19:23:04 +00:00
let percent = page . querySelectorAll ( ".percent-select" ) [ 0 ] . checked ;
let point = page . querySelectorAll ( ".point-select" ) [ 0 ] . checked ;
let no _logos = page . querySelectorAll ( ".logo-select" ) [ 0 ] . checked ;
let title = page . querySelectorAll ( ".title-select" ) [ 0 ] . checked ;
let symbols _el = page . querySelectorAll ( ".symbol-list" ) [ 0 ] ;
let symbols = getListItems ( symbols _el ) ;
2021-11-17 18:30:13 +00:00
2023-03-27 09:08:33 +00:00
if ( whatFeature == 2 ) {
2023-03-16 15:23:11 +00:00
let portfolio = page . querySelectorAll ( ".portfolio-select" ) [ 0 ] . checked ;
2023-08-03 10:06:40 +00:00
let lohivol = page . querySelectorAll ( ".lohivol-select" ) [ 0 ] . checked ;
2023-09-13 14:00:44 +00:00
let display _name = page . querySelectorAll ( ".name-select" ) [ 0 ] . checked ;
2023-03-16 15:23:11 +00:00
settings = {
percent : percent ,
point : point ,
logos : no _logos ,
title : title ,
symbols : symbols ,
chart : portfolio ,
2023-08-03 10:06:40 +00:00
lohivol : lohivol ,
2023-09-13 13:59:17 +00:00
display _name : display _name ,
2023-03-16 15:23:11 +00:00
} ;
}
2023-03-27 09:08:33 +00:00
else if ( whatFeature == 1 ) {
let prepost = page . querySelectorAll ( ".prepost-select" ) [ 0 ] . checked ;
let portfolio = page . querySelectorAll ( ".portfolio-select" ) [ 0 ] . checked ;
2023-08-03 09:37:29 +00:00
let lohivol = page . querySelectorAll ( ".lohivol-select" ) [ 0 ] . checked ;
2023-09-13 14:00:44 +00:00
let display _name = page . querySelectorAll ( ".name-select" ) [ 0 ] . checked ;
2023-03-27 09:08:33 +00:00
settings = {
prepost : prepost ,
percent : percent ,
point : point ,
logos : no _logos ,
title : title ,
symbols : symbols ,
chart : portfolio ,
2023-08-03 09:29:57 +00:00
lohivol : lohivol ,
2023-09-13 13:59:17 +00:00
display _name : display _name ,
2023-03-27 09:08:33 +00:00
} ;
}
2023-03-16 15:23:11 +00:00
else {
settings = {
percent : percent ,
point : point ,
logos : no _logos ,
title : title ,
symbols : symbols ,
} ;
}
2023-03-27 09:08:33 +00:00
console . log ( settings ) ;
2021-09-16 19:23:04 +00:00
return settings ;
2023-03-17 06:53:26 +00:00
}
2021-09-16 19:23:04 +00:00
2021-11-17 18:30:13 +00:00
// gets the current wether and forecast settings
2021-09-16 19:23:04 +00:00
function getWeatherSettings ( page ) {
let temp = getSelected ( page . querySelectorAll ( ".temp-select" ) [ 0 ] ) ;
let speed = getSelected ( page . querySelectorAll ( ".wind-speed-select" ) [ 0 ] ) ;
2021-12-22 09:43:36 +00:00
2021-09-16 19:23:04 +00:00
let title = page . querySelectorAll ( ".title-select" ) [ 0 ] . checked ;
2023-05-23 08:36:24 +00:00
2022-02-24 18:35:43 +00:00
let
2021-11-17 18:30:13 +00:00
settings = {
temp : temp ,
wind _speed : speed ,
title : title ,
} ;
2021-09-16 19:23:04 +00:00
//only for daily weather
try {
2021-11-17 18:30:13 +00:00
current _weather = page . querySelectorAll ( ".current-weather-select" ) [ 0 ]
. checked ;
settings [ "current_weather" ] = current _weather ;
} catch { }
2021-09-16 19:23:04 +00:00
2021-09-25 09:40:29 +00:00
let locations _el = page . querySelectorAll ( ".location-list" ) [ 0 ] ;
let locations = getListItems ( locations _el ) ;
2021-11-17 18:30:13 +00:00
settings [ "locations" ] = locations ;
2021-12-22 09:43:36 +00:00
console . log ( settings ) ;
2021-09-16 19:23:04 +00:00
return settings ;
}
2023-05-23 08:36:24 +00:00
// function saveWeatherAPIKey(){
// 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",
// "Commodities",
// "Indices",
// "Movies",
// "IPO Calendar",
// ];
// let pageNum = features.indexOf(feature) + 1;
// let pageSelector = "Page" + pageNum.toString();
// let page = document.getElementById(pageSelector);
2022-02-24 18:35:43 +00:00
2023-05-23 08:36:24 +00:00
// let api_key = page.querySelectorAll(".api-key")[0].value;
// let settings = {
// api_key:api_key
// };
2022-02-24 18:35:43 +00:00
2023-05-23 08:36:24 +00:00
// console.log(settings);
2022-02-24 18:35:43 +00:00
2023-05-23 08:36:24 +00:00
// fetch("/saveWeatherAPIKey", {
// method: "POST",
// body: JSON.stringify(settings),
// });
// }
2022-02-24 18:35:43 +00:00
2023-01-09 08:58:19 +00:00
function saveMovieAPIKey ( ) {
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" ,
"Commodities" ,
"Indices" ,
"Movies" ,
2023-03-08 06:41:44 +00:00
"IPO Calendar" ,
2023-06-14 07:57:05 +00:00
"Economic Calendar" ,
2023-07-12 08:06:32 +00:00
"Jokes" ,
2023-08-08 09:14:50 +00:00
"Gainers, Losers, Active" ,
2023-08-14 09:59:08 +00:00
"Sector Performance" ,
2023-08-17 10:10:02 +00:00
"Place (Reddit)" ,
2023-08-29 11:40:10 +00:00
"Clock 1" ,
2023-08-29 13:13:19 +00:00
"Clock 2" ,
"World Clock" ,
2023-09-23 08:58:09 +00:00
"Inspirational Quotes" ,
2023-01-09 08:58:19 +00:00
] ;
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 = {
api _key : api _key
} ;
console . log ( settings ) ;
fetch ( "/saveMovieAPIKey" , {
method : "POST" ,
body : JSON . stringify ( settings ) ,
} ) ;
}
2022-02-24 18:35:43 +00:00
2023-03-08 06:41:44 +00:00
function saveIpoAPIKey ( ) {
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" ,
"Commodities" ,
"Indices" ,
"Movies" ,
"IPO Calendar" ,
2023-06-14 07:57:05 +00:00
"Economic Calendar" ,
2023-07-12 08:06:32 +00:00
"Jokes" ,
2023-08-08 09:14:50 +00:00
"Gainers, Losers, Active" ,
2023-08-14 09:59:08 +00:00
"Sector Performance" ,
2023-08-17 10:10:02 +00:00
"Place (Reddit)" ,
2023-08-29 11:40:10 +00:00
"Clock 1" ,
2023-08-29 13:13:19 +00:00
"Clock 2" ,
"World Clock" ,
2023-09-23 08:58:09 +00:00
"Inspirational Quotes" ,
2023-03-08 06:41:44 +00:00
] ;
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 = {
api _key : api _key
} ;
console . log ( settings ) ;
fetch ( "/saveIpoAPIKey" , {
method : "POST" ,
body : JSON . stringify ( settings ) ,
} ) ;
}
var ipoAPIbtn = document . getElementById ( "ipo-api-btn" ) ;
ipoAPIbtn . addEventListener ( "click" , saveIpoAPIKey ) ;
2023-01-09 08:58:19 +00:00
var movieAPIbtn = document . getElementById ( "movie-api-btn" ) ;
movieAPIbtn . addEventListener ( "click" , saveMovieAPIKey ) ;
2022-02-24 18:35:43 +00:00
2023-05-23 08:36:24 +00:00
// var weatherAPIbtn = document.getElementById("weather-api-btn");
// weatherAPIbtn.addEventListener("click", saveWeatherAPIKey);
2022-02-24 18:35:43 +00:00
2021-11-17 18:30:13 +00:00
function getNewsSettings ( page ) {
2022-02-24 19:42:33 +00:00
2021-09-16 19:23:04 +00:00
let country = getSelected ( page . querySelectorAll ( ".country-select" ) [ 0 ] ) ;
let category = getSelected ( page . querySelectorAll ( ".category-select" ) [ 0 ] ) ;
2022-02-24 19:42:33 +00:00
let country _check = page . querySelectorAll ( ".country-check" ) [ 0 ] . checked ;
let category _check = page . querySelectorAll ( ".category-check" ) [ 0 ] . checked ;
let num _headlines = page . querySelectorAll ( ".headline-num" ) [ 0 ] . value
2021-09-16 19:23:04 +00:00
let title = page . querySelectorAll ( ".title-select" ) [ 0 ] . checked ;
2021-11-17 18:30:13 +00:00
settings = {
country : country ,
category : category ,
2022-02-24 19:42:33 +00:00
use _country : country _check ,
use _category : category _check ,
num _headlines : num _headlines ,
2021-11-17 18:30:13 +00:00
title : title ,
} ;
2022-02-24 19:42:33 +00:00
console . log ( settings ) ;
2021-09-16 19:23:04 +00:00
return settings ;
}
2023-01-09 08:58:19 +00:00
function getMovieSettings ( page ) {
let category = getSelected ( page . querySelectorAll ( ".movie-categories" ) [ 0 ] ) ;
let title = page . querySelectorAll ( ".title-select" ) [ 0 ] . checked ;
let api _key = page . querySelectorAll ( ".api-key" ) [ 0 ] ;
settings = {
category : category ,
title : title ,
api _key : api _key
} ;
return settings ;
}
2023-03-08 06:41:44 +00:00
function getIpoSettings ( page ) {
let title = page . querySelectorAll ( ".title-select" ) [ 0 ] . checked ;
let api _key = page . querySelectorAll ( ".api-key" ) [ 0 ] ;
settings = {
title : title ,
api _key : api _key
} ;
return settings ;
}
2021-11-17 18:30:13 +00:00
function getSportsSettings ( page ) {
2021-09-16 19:23:04 +00:00
let title = page . querySelectorAll ( ".title-select" ) [ 0 ] . checked ;
let leagues _el = page . querySelectorAll ( ".league-list" ) [ 0 ] ;
leagues = getListItems ( leagues _el ) ;
2022-01-29 09:26:55 +00:00
2021-11-17 18:30:13 +00:00
settings = { title : title , leagues : leagues } ;
2021-09-16 19:23:04 +00:00
return settings ;
}
2021-10-11 19:16:04 +00:00
var uploaded _images = [ ] ;
var uploaded _GIFs = [ ] ;
allFeaturesFileAddBtn . map ( ( value , index ) => {
if ( value !== null ) {
value . addEventListener ( "click" , ( ) => {
var tag = document . createElement ( "li" ) ;
tag . innerHTML = allFeaturesFile [ index ] . files [ 0 ] . name ;
if ( index == 10 ) {
2022-02-26 16:35:15 +00:00
let getCustomImg = localStorage . getItem ( "customImages" ) ;
2021-11-17 18:30:13 +00:00
let fileName = imagesFile . files [ 0 ] . name ;
let scrollSpeed = document . getElementById ( "inputScrollSpeed11" ) . value ;
let scrollSpeed2 = document . getElementById (
"inputScrollSpeedRow11"
) . value ;
let transition = document . getElementById ( "inputTransition11" ) . value ;
let pauseScreen = document . getElementById ( "inputText12" ) . value ;
let displayCheck =
document . getElementById ( "flexCheckChecked25" ) . checked ;
let fileFound = false ;
for ( let i = 0 ; i < allFeatures [ index ] . children . length ; i ++ ) {
fileFound =
allFeatures [ index ] . children [ i ] ? . innerText == fileName && true ;
}
if ( ! fileFound ) {
let values = {
fileName ,
scrollSpeed ,
scrollSpeed2 ,
transition ,
pauseScreen ,
displayCheck ,
} ;
let newValues = getCustomImg && JSON . parse ( getCustomImg ) ;
getCustomImg && newValues . push ( values ) ;
2022-02-24 18:35:43 +00:00
// getCustomImg
// ? localStorage.setItem("customImages", JSON.stringify(newValues))
// : localStorage.setItem("customImages", JSON.stringify([values]));
2021-11-17 18:30:13 +00:00
uploaded _images . push ( allFeaturesFile [ index ] . files [ 0 ] ) ;
allFeatures [ index ] . appendChild ( tag ) ;
}
2021-10-11 19:16:04 +00:00
} else if ( index == 11 ) {
2022-02-26 16:35:15 +00:00
let getCustomGifs = localStorage . getItem ( "customGifs" ) ;
2021-11-17 18:30:13 +00:00
let fileName = allFeaturesFile [ index ] . files [ 0 ] . name ;
let scrollSpeed = document . getElementById ( "inputScrollSpeed12" ) . value ;
let scrollSpeed2 = document . getElementById (
"inputScrollSpeedRow12"
) . value ;
let transition = document . getElementById ( "inputTransition12" ) . value ;
let pauseScreen = document . getElementById ( "inputText112" ) . value ;
let displayCheck =
document . getElementById ( "flexCheckChecked28" ) . checked ;
let fileFound = false ;
for ( let i = 0 ; i < allFeatures [ index ] . children . length ; i ++ ) {
fileFound =
allFeatures [ index ] . children [ i ] ? . innerText == fileName && true ;
}
if ( ! fileFound ) {
let values = {
fileName ,
scrollSpeed ,
scrollSpeed2 ,
transition ,
pauseScreen ,
displayCheck ,
} ;
let newValues = getCustomGifs && JSON . parse ( getCustomGifs ) ;
getCustomGifs && newValues . push ( values ) ;
2022-02-24 18:35:43 +00:00
// getCustomGifs
// ? localStorage.setItem("customGifs", JSON.stringify(newValues))
// : localStorage.setItem("customGifs", JSON.stringify([values]));
2021-11-17 18:30:13 +00:00
uploaded _GIFs . push ( allFeaturesFile [ index ] . files [ 0 ] ) ;
allFeatures [ index ] . appendChild ( tag ) ;
}
2021-10-11 19:16:04 +00:00
}
2022-02-24 18:35:43 +00:00
imagesFile . value = "" ;
2021-10-11 19:16:04 +00:00
changeVarValue ( ) ;
addEventOnFeaturesList ( ) ;
2023-07-18 10:26:52 +00:00
displaySavePrompt2 ( ) ;
2021-10-11 19:16:04 +00:00
} ) ;
}
} ) ;
2021-09-16 19:23:04 +00:00
//images and GIFs
2021-11-17 18:30:13 +00:00
function getImageSettings ( page ) {
2021-09-16 19:23:04 +00:00
let pause = page . querySelectorAll ( ".pause-select" ) [ 0 ] . value ;
let title = page . querySelectorAll ( ".title-select" ) [ 0 ] . checked ;
2021-11-17 18:30:13 +00:00
2021-09-16 19:23:04 +00:00
let images _el = page . querySelectorAll ( ".image-list" ) [ 0 ] ;
images = getListItems ( images _el ) ;
2021-11-17 18:30:13 +00:00
settings = { title : title , pause : pause , images : images } ;
2021-09-16 19:23:04 +00:00
return settings ;
}
2023-07-07 09:41:14 +00:00
// ADD MSG TO LIST AND SAVE MSG TO JSON FILE
2021-10-11 19:16:04 +00:00
var messages = [ ] ;
messagesTextAddBtn . addEventListener ( "click" , ( ) => {
2021-11-17 18:30:13 +00:00
let pageSelector = "Page13" ;
2021-10-11 19:16:04 +00:00
2021-11-17 18:30:13 +00:00
let page = document . getElementById ( pageSelector ) ;
2021-10-11 19:16:04 +00:00
2021-11-17 18:30:13 +00:00
let msg _name = messagesText . value ;
//let speed = getSelected(page.querySelectorAll(".speed-select")[0]);
//let animation = getSelected(page.querySelectorAll(".animation-select")[0]);
let message _text = page . querySelectorAll ( ".message-input" ) [ 0 ] . value ;
let text _colour = getSelected ( page . querySelectorAll ( ".text-colour" ) [ 0 ] ) ;
let text _size = getSelected ( page . querySelectorAll ( ".text-size" ) [ 0 ] ) ;
let background _colour = getSelected ( page . querySelectorAll ( ".back-colour" ) [ 0 ] ) ;
let message = {
name : msg _name ,
text : message _text ,
text _colour : text _colour ,
size : text _size ,
background _colour : background _colour ,
} ;
messages . push ( message ) ;
2023-07-07 09:41:14 +00:00
fetch ( "/sendMsgToJSON" , {
method : "POST" ,
body : JSON . stringify ( message ) ,
} ) ;
2021-11-17 18:30:13 +00:00
} ) ;
2021-10-11 19:16:04 +00:00
2021-09-16 19:23:04 +00:00
function getMessageSettings ( page ) {
2021-10-11 19:16:04 +00:00
let messages _el = page . querySelectorAll ( ".message-list" ) [ 0 ] ;
let message _names = getListItems ( messages _el ) ;
2021-11-17 18:30:13 +00:00
2021-10-11 19:16:04 +00:00
//remove any messages that arent in the list
let new _messages = [ ] ;
2021-12-15 11:06:54 +00:00
let new _names = [ ] ;
2021-11-17 18:30:13 +00:00
2021-12-15 11:06:54 +00:00
for ( let i = 0 ; i < message _names . length ; i ++ ) {
for ( let j = 0 ; j < messages . length ; j ++ ) {
if ( message _names [ i ] == messages [ j ] [ "name" ] ) {
new _messages . push ( messages [ j ] ) ;
new _names . push ( messages [ j ] [ "name" ] ) ;
}
2021-10-11 19:16:04 +00:00
}
2021-12-15 11:06:54 +00:00
if ( ! ( new _names . includes ( message _names [ i ] ) ) ) {
new _messages . push ( { name : message _names [ i ] } ) ;
}
2021-10-11 19:16:04 +00:00
}
2021-12-15 11:06:54 +00:00
2021-10-11 19:16:04 +00:00
let title = page . querySelectorAll ( ".title-select" ) [ 0 ] . checked ;
2021-11-17 18:30:13 +00:00
return { title : title , messages : new _messages } ;
}
2023-06-14 07:57:05 +00:00
// 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 ;
}
2023-08-08 09:49:31 +00:00
// market settings
function getMarketSettings ( page ) {
let title = page . querySelectorAll ( ".title-select" ) [ 0 ] . checked ;
let categories = getListItems ( page . querySelectorAll ( ".symbol-list" ) [ 0 ] ) ;
let percent = page . querySelectorAll ( ".percent-select" ) [ 0 ] . checked ;
let point = page . querySelectorAll ( ".point-select" ) [ 0 ] . checked ;
let no _logos = page . querySelectorAll ( ".logo-select" ) [ 0 ] . checked ;
let lohivol = page . querySelectorAll ( ".lohivol-select" ) [ 0 ] . checked ;
2023-09-13 13:59:17 +00:00
let display _name = page . querySelectorAll ( ".name-select" ) [ 0 ] . checked ;
2023-08-08 09:49:31 +00:00
settings = {
title : title ,
categories : categories ,
percent : percent ,
point : point ,
logos : no _logos ,
lohivol : lohivol ,
2023-09-13 13:59:17 +00:00
display _name : display _name ,
2023-08-08 09:49:31 +00:00
} ;
console . log ( settings ) ;
return settings ;
}
2023-08-14 10:06:47 +00:00
// sector settings
function getSectorSettings ( page ) {
let title = page . querySelectorAll ( ".title-select" ) [ 0 ] . checked ;
let categories = getListItems ( page . querySelectorAll ( ".symbol-list" ) [ 0 ] ) ;
let no _logos = page . querySelectorAll ( ".logo-select" ) [ 0 ] . checked ;
settings = {
title : title ,
categories : categories ,
logos : no _logos ,
} ;
console . log ( settings ) ;
return settings ;
}
2023-07-12 09:00:17 +00:00
// jokes settings
function getJokesSettings ( page ) {
let title = page . querySelectorAll ( ".title-select" ) [ 0 ] . checked ;
let categories = getListItems ( page . querySelectorAll ( ".symbol-list" ) [ 0 ] ) ;
let amount = page . querySelectorAll ( ".jokes-amount-select" ) [ 0 ] . value ;
2023-07-17 06:48:46 +00:00
let safe = page . querySelectorAll ( ".title-select" ) [ 1 ] . checked ;
2023-07-12 09:00:17 +00:00
const jokesdivElement = page . querySelector ( '.blacklist-checkboxes' ) ;
const allcheckboxes = jokesdivElement . querySelectorAll ( 'input' ) ;
const blacklist = [ ] ;
allcheckboxes . forEach ( checkbox => {
if ( checkbox . checked ) {
blacklist . push ( checkbox . value ) ;
}
} ) ;
settings = {
title : title ,
2023-07-17 06:52:19 +00:00
safe : safe ,
2023-07-12 09:00:17 +00:00
categories : categories ,
blacklist : blacklist ,
amount : amount ,
} ;
console . log ( settings ) ;
return settings ;
}
2023-08-16 08:27:49 +00:00
// place settings
function getPlaceSettings ( page ) {
let title = page . querySelectorAll ( ".title-select" ) [ 0 ] . checked ;
let places = getListItems ( page . querySelectorAll ( ".symbol-list" ) [ 0 ] ) ;
let pause _place = page . querySelectorAll ( ".pause-select" ) [ 0 ] . value ;
2023-08-16 08:33:58 +00:00
let width = page . querySelectorAll ( ".slider" ) [ 0 ] . value ;
2023-08-16 08:27:49 +00:00
settings = {
title : title ,
places : places ,
pause : pause _place ,
width : width ,
} ;
console . log ( settings ) ;
return settings ;
}
2023-08-29 11:47:15 +00:00
// clock1 settings
function getClock1Settings ( page ) {
2023-08-29 13:13:19 +00:00
let clock1pause = page . querySelectorAll ( ".pause-select" ) [ 0 ] . value ;
2023-08-29 11:47:15 +00:00
settings = {
2023-08-29 13:13:19 +00:00
pause : clock1pause ,
} ;
console . log ( settings ) ;
return settings ;
}
// clock2 settings
function getClock2Settings ( page ) {
let clock2pause = page . querySelectorAll ( ".pause-select" ) [ 0 ] . value ;
settings = {
pause : clock2pause ,
2023-08-29 11:47:15 +00:00
} ;
console . log ( settings ) ;
return settings ;
}
2023-08-29 13:13:19 +00:00
// world clock settings
function getWorldclockSettings ( page ) {
let worldclockpause = page . querySelectorAll ( ".pause-select" ) [ 0 ] . value ;
settings = {
pause : worldclockpause ,
} ;
console . log ( settings ) ;
return settings ;
}
2023-08-16 08:27:49 +00:00
2023-09-23 09:00:12 +00:00
// quotes settings
function getQuotesSettings ( page ) {
let title = page . querySelectorAll ( ".title-select" ) [ 0 ] . checked ;
let amount = page . querySelectorAll ( ".quotes-amount-select" ) [ 0 ] . value ;
settings = {
title : title ,
amount : amount ,
} ;
console . log ( settings ) ;
return settings ;
}
2021-11-17 18:30:13 +00:00
// Join Network
let wifiSsidInput = document . getElementById ( "wifi-ssid-input" ) ;
let wifiPassInput = document . getElementById ( "wifi-pass-input" ) ;
let countryCodeInput = document . getElementById ( "country-code-input" ) ;
let joinNetworkBtn = document . querySelector ( "#join-network-btn" ) ;
let connectedText = document . querySelector ( "#connected-text" ) ;
2022-03-02 15:09:52 +00:00
joinNetworkBtn . addEventListener ( "click" , ( ) => {
localStorage . setItem ( "wifiSsid" , wifiSsidInput . value ) ;
localStorage . setItem ( "wifiPass" , wifiPassInput . value ) ;
localStorage . setItem ( "countryCode" , countryCodeInput . value ) ;
2021-11-17 18:30:13 +00:00
2022-02-24 18:35:43 +00:00
// connectedText.style.display = "block";
// setTimeout(() => {
// connectedText.style.display = "none";
// }, 2000);
2021-11-18 19:41:50 +00:00
2022-03-02 15:09:52 +00:00
data = { country : countryCodeInput . value , ssid : wifiSsidInput . value , pwd : wifiPassInput . value }
2021-11-18 19:41:50 +00:00
2022-03-02 15:09:52 +00:00
fetch ( "/wifi" , {
method : "POST" ,
body : JSON . stringify ( data ) ,
} ) ;
} ) ;
2021-11-17 18:30:13 +00:00
// change display format
let displayFormatDropDown = document . querySelector ( "#inputDisplayFormat" ) ;
let displayFormatBtn = document . querySelector ( "#dispformat-btn" ) ;
let selectedDisplayText = document . querySelector ( "#selected-display-text" ) ;
let topRowText = document . querySelector ( "#top-row-text" ) ;
let bottomRowText = document . querySelector ( "#bottom-row-text" ) ;
displayFormatBtn . addEventListener ( "click" , ( ) => {
selectedDisplayText . innerText = displayFormatDropDown . value ;
2022-06-10 09:45:13 +00:00
if ( selectedDisplayText . innerText === "Professional Two Rows" ) {
2021-11-17 18:30:13 +00:00
topRowText . style . display = "inline" ;
bottomRowText . style . display = "inline" ;
secondRow . style . display = "flex" ;
2023-07-18 08:55:34 +00:00
displaySavePrompt ( ) ;
2021-11-17 18:30:13 +00:00
inputScrollSpeedRow . forEach ( ( value ) => {
value . parentElement . parentElement . style . display = "flex" ;
} ) ;
} else {
topRowText . style . display = "none" ;
bottomRowText . style . display = "none" ;
secondRow . style . display = "none" ;
2023-07-18 08:55:34 +00:00
displaySavePrompt ( ) ;
2021-11-17 18:30:13 +00:00
inputScrollSpeedRow . forEach ( ( value ) => {
value . parentElement . parentElement . style . display = "none" ;
} ) ;
}
} ) ;
2022-06-27 09:08:26 +00:00
// after clicking reset user settings, change back to standard scrolling
let resetSettingsBtn = document . querySelector ( "#reset-btn" )
resetSettingsBtn . addEventListener ( "click" , ( ) => {
selectedDisplayText . innerText = "Standard Scrolling" ;
topRowText . style . display = "none" ;
bottomRowText . style . display = "none" ;
secondRow . style . display = "none" ;
inputScrollSpeedRow . forEach ( ( value ) => {
value . parentElement . parentElement . style . display = "none" ;
} ) ;
} ) ;
2021-11-17 18:30:13 +00:00
// if selected display text = Professional two rows
2022-06-10 09:45:13 +00:00
if ( selectedDisplayText . innerText === "Professional Two Rows" ) {
2021-11-17 18:30:13 +00:00
topRowText . style . display = "inline" ;
2021-09-16 19:23:04 +00:00
}
2021-11-17 18:30:13 +00:00
// change host name
let hostNameInput = document . getElementById ( "host-name-input" ) ;
let hostNameBtn = document . getElementById ( "host-name-btn" ) ;
let hostNameText = document . getElementById ( "host-name" ) ;
hostNameBtn . addEventListener ( "click" , ( ) => {
hostNameText . innerText = hostNameInput . value ;
2022-02-24 18:35:43 +00:00
// localStorage.setItem("hostName", hostNameText.innerText);
2021-11-26 15:33:10 +00:00
data = { hostname : hostNameText . innerText }
fetch ( "/hostname" , {
method : "POST" ,
body : JSON . stringify ( data ) ,
} ) ;
2021-11-17 18:30:13 +00:00
} ) ;
2022-02-24 18:35:43 +00:00
// Add Weather API Key
// let weatherKeyInput = document.getElementById("api-key");
// let weatherKeyBtn = document.getElementById("weather-api-button");
// let inputTextWeather = document.getElementById("inputText-weather");
// weatherKeyBtn.addEventListener("click", () => {
// inputTextWeather.innerText = weatherKeyInput.value;
// data = {api-key:inputTextWeather.innerText}
// fetch("/weatherAPI", {
// method: "POST",
// body: JSON.stringify(data),
// });
// });
2021-11-17 18:30:13 +00:00
// change brightness
let brightnessInput = document . getElementById ( "brightness-input" ) ;
let brightnessBtn = document . getElementById ( "brightness-btn" ) ;
brightnessBtn . addEventListener ( "click" , ( ) => {
2022-02-24 18:35:43 +00:00
// localStorage.setItem("brightness", brightnessInput.value);
2021-11-17 18:30:13 +00:00
} ) ;
// change input animation
let inputAnimation = document . getElementById ( "inputAnimation" ) ;
let inputAnimationBtn = document . getElementById ( "input-animation-btn" ) ;
inputAnimationBtn . addEventListener ( "click" , ( ) => {
localStorage . setItem ( "inputAnimation" , inputAnimation . value ) ;
2021-11-18 17:50:50 +00:00
2021-11-17 18:30:13 +00:00
} ) ;
// scroll speed row two
let inputScrollSpeedRow = [ ] ;
2021-09-16 19:23:04 +00:00
2023-09-23 08:58:09 +00:00
for ( let i = 1 ; i <= 26 ; i ++ ) {
2021-11-17 18:30:13 +00:00
inputScrollSpeedRow . push (
document . getElementById (
i === 1 ? "inputScrollSpeedRow" : ` inputScrollSpeedRow ${ i } `
)
) ;
}
2021-08-18 19:50:02 +00:00
2021-11-17 18:30:13 +00:00
window . onload = ( ) => {
2022-02-24 18:35:43 +00:00
// let getHostName = localStorage.getItem("hostName");
// let getBrightness = localStorage.getItem("brightness");
// let getWifiSsid = localStorage.getItem("wifiSsid");
// let getWifiPass = localStorage.getItem("wifiPass");
// let getCountryCode = localStorage.getItem("countryCode");
// let getInputAnimation = localStorage.getItem("inputAnimation");
// getHostName &&
// (hostNameText.innerText = getHostName) &&
// (hostNameInput.value = getHostName);
2021-11-17 18:30:13 +00:00
2021-12-06 20:10:14 +00:00
//getBrightness && (brightnessInput.value = getBrightness);
2021-12-04 14:52:34 +00:00
//getWifiSsid && (wifiSsidInput.value = getWifiSsid);
//getWifiPass && (wifiPassInput.value = getWifiPass);
2021-12-06 20:10:14 +00:00
//getCountryCode && (countryCodeInput.value = getCountryCode);
2021-11-17 18:30:13 +00:00
2023-01-30 05:15:21 +00:00
// let getDispayFormat = localStorage.getItem("displayFormat");
// getDispayFormat && (displayFormatDropDown.value = getDispayFormat);
2021-11-17 18:30:13 +00:00
selectedDisplayText . innerText = displayFormatDropDown . value ;
2022-02-28 13:41:19 +00:00
// getInputAnimation && (inputAnimation.value = getInputAnimation);
2021-11-17 18:30:13 +00:00
2022-06-10 09:45:13 +00:00
if ( selectedDisplayText . innerText === "Professional Two Rows" ) {
2021-11-17 18:30:13 +00:00
topRowText . style . display = "inline" ;
bottomRowText . style . display = "inline" ;
secondRow . style . display = "flex" ;
inputScrollSpeedRow . forEach ( ( value ) => {
value . parentElement . parentElement . style . display = "flex" ;
} ) ;
} else {
topRowText . style . display = "none" ;
bottomRowText . style . display = "none" ;
secondRow . style . display = "none" ;
inputScrollSpeedRow . forEach ( ( value ) => {
value . parentElement . parentElement . style . display = "none" ;
} ) ;
}
// custom images
2021-12-08 17:26:35 +00:00
/ *
2021-11-17 18:30:13 +00:00
let localCustomImages = JSON . parse ( localStorage . getItem ( "customImages" ) ) ;
localCustomImages ? . map ( ( value ) => {
let tag = document . createElement ( "li" ) ;
tag . innerText = value . fileName ;
images . appendChild ( tag ) ;
} ) ;
// custom gifs
let localCustomGifs = JSON . parse ( localStorage . getItem ( "customGifs" ) ) ;
localCustomGifs ? . map ( ( value ) => {
let tag = document . createElement ( "li" ) ;
tag . innerText = value . fileName ;
gifs . appendChild ( tag ) ;
} ) ;
// custom messages
let localCustomMsg = JSON . parse ( localStorage . getItem ( "customMsg" ) ) ;
localCustomMsg ? . map ( ( value ) => {
let tag = document . createElement ( "li" ) ;
tag . innerText = value . messageName ;
var messagesWrapper = document . getElementById ( "messages-features" ) ;
messagesWrapper . appendChild ( tag ) ;
} ) ;
2021-12-08 17:26:35 +00:00
* * /
2021-11-17 18:30:13 +00:00
addEventOnList ( ) ;
addEventonBtns ( ) ;
changeVarValue ( ) ;
addEventOnFeaturesList ( ) ;
} ;
2022-06-10 10:05:10 +00:00
// Update button CSS effects if update available vs if already up to date
var btnText = document . getElementById ( "update-btn" ) . innerText
var divClass = document . getElementById ( "outer-div" )
if ( btnText == "Up to date" ) {
divClass . classList . remove ( "main-div2" ) ;
divClass . classList . add ( "main-div3" ) ;
} else {
divClass . classList . remove ( "main-div3" ) ;
divClass . classList . add ( "main-div2" ) ;
}
2022-06-11 05:30:16 +00:00
function togglePass ( ) {
var x = document . getElementById ( "wifi-pass-input" ) ;
if ( x . type === "password" ) {
x . type = "text" ;
} else {
x . type = "password" ;
}
}
2022-06-11 05:41:16 +00:00
// Show messages when updating ticker / joining wifi network
function showDiv ( ) {
document . getElementById ( 'update-message' ) . style . display = "block" ;
}
function showDivTwo ( ) {
document . getElementById ( 'wifi-message' ) . style . display = "block" ;
}
2022-06-11 05:45:10 +00:00
// Display message asking for restart of ticker when new API key added for weather
2023-05-23 08:36:24 +00:00
// function showWeatherP() {
// if(document.getElementById("api-key1").value==="") {
2022-06-11 05:45:10 +00:00
2023-05-23 08:36:24 +00:00
// document.getElementById('weather-api-p').style.display = "none";
// }
2022-06-11 05:45:10 +00:00
2023-05-23 08:36:24 +00:00
// else if (document.getElementById("api-key1").value==="Weather API Key") {
// document.getElementById('weather-api-p').style.display = "none";
2022-06-11 05:45:10 +00:00
2023-05-23 08:36:24 +00:00
// }
2022-06-11 05:45:10 +00:00
2023-05-23 08:36:24 +00:00
// else {
// document.getElementById('weather-api-p').style.display = "block"
// }
2022-06-11 05:45:10 +00:00
2023-05-23 08:36:24 +00:00
// }
2022-06-11 05:45:10 +00:00
2023-01-09 08:58:19 +00:00
// Display message asking for restart of ticker when new API key added for movie
function showMovieP ( ) {
if ( document . getElementById ( "api-key-movie" ) . value === "" ) {
document . getElementById ( 'movie-api-p' ) . style . display = "none" ;
}
else if ( document . getElementById ( "api-key-movie" ) . value === "Movies API Key" ) {
document . getElementById ( 'movie-api-p' ) . style . display = "none" ;
}
else {
document . getElementById ( 'movie-api-p' ) . style . display = "block"
}
}
2023-03-08 06:41:44 +00:00
function showIpoP ( ) {
if ( document . getElementById ( "api-key-ipo" ) . value === "" ) {
document . getElementById ( 'ipo-api-p' ) . style . display = "none" ;
}
else if ( document . getElementById ( "api-key-ipo" ) . value === "IPO Calendar API Key" ) {
document . getElementById ( 'ipo-api-p' ) . style . display = "none" ;
}
else {
document . getElementById ( 'ipo-api-p' ) . style . display = "block"
}
}
2022-06-11 15:57:23 +00:00
// Disable adding cities when no API key detected
2023-05-23 08:36:24 +00:00
// if(document.getElementById("api-key1").value==="") {
// document.getElementById('inputTextBtn6').disabled = true;
// }
2022-06-11 15:57:23 +00:00
2023-05-23 08:36:24 +00:00
// else if (document.getElementById("api-key1").value==="Weather API Key") {
// document.getElementById('inputTextBtn6').disabled = true;
// }
2022-06-11 15:57:23 +00:00
2023-05-23 08:36:24 +00:00
// else {
// document.getElementById('inputTextBtn6').disabled = false;
// }
2022-06-11 15:57:23 +00:00
2023-05-23 08:36:24 +00:00
// if(document.getElementById("api-key").value==="") {
// document.getElementById('inputTextBtn7').disabled = true;
// }
2022-06-11 15:57:23 +00:00
2023-05-23 08:36:24 +00:00
// else if (document.getElementById("api-key").value==="Weather API Key") {
// document.getElementById('inputTextBtn7').disabled = true;
// }
2022-06-11 15:57:23 +00:00
2023-05-23 08:36:24 +00:00
// else {
// document.getElementById('inputTextBtn7').disabled = false;
// }
2022-06-11 15:57:23 +00:00
2022-06-11 16:13:49 +00:00
// Stocks validation
function stockValidate ( ) {
var specialChars = /[`!@#$%^&*()_+\-=\[\]{};':"\\|,<>\/?~]/ ;
let x = document . getElementById ( "inputText3" ) . value ;
2023-03-16 10:55:10 +00:00
let portfolioCheckbox = document . getElementById ( "flexCheckChecked4" ) ;
let sharesText = document . getElementById ( "inputText8" ) . value ;
let averageCost = document . getElementById ( "inputText9" ) . value ;
let dateText = document . getElementById ( "inputText10" ) . value ;
2022-06-11 16:13:49 +00:00
let text ;
2023-03-16 10:55:10 +00:00
let text2 ;
2022-06-11 16:13:49 +00:00
if ( x . toUpperCase ( ) != x ) {
document . getElementById ( 'demo' ) . style . display = "block" ;
text = "Stock symbol must be uppercase" ;
document . getElementById ( "inputText3" ) . value = '' ;
// createLi = false;
}
else if ( x === '' ) {
document . getElementById ( 'demo' ) . style . display = "block" ;
text = "No blanks"
// createLi = false;
}
else if ( x . includes ( ' ' ) ) {
text = "No spaces" ;
document . getElementById ( 'demo' ) . style . display = "block" ;
document . getElementById ( "inputText3" ) . value = '' ;
// createLi = false;
}
else if ( x . length > 5 ) {
document . getElementById ( 'demo' ) . style . display = "block" ;
text = "No more than 5 characters" ;
document . getElementById ( "inputText3" ) . value = '' ;
// createLi = false;
}
else if ( /\d/ . test ( x ) ) {
document . getElementById ( 'demo' ) . style . display = "block" ;
text = "No numbers allowed" ;
document . getElementById ( "inputText3" ) . value = '' ;
// createLi = false;
}
// CAREFUL TO DELETE THE BACKEND LIST ITEMS, JUST DELETING THE VALUE LIKE THIS ISN"T 100% ACCURATE
else if ( specialChars . test ( x ) ) {
document . getElementById ( 'demo' ) . style . display = "block" ;
text = "No special characters allowed" ;
document . getElementById ( "inputText3" ) . value = '' ;
// createLi = false;
}
else {
text = "Input OK" ;
document . getElementById ( 'demo' ) . style . display = "none" ;
2023-03-16 10:55:10 +00:00
//PORTFOLIO VALIDATION HERE
if ( portfolioCheckbox . checked ) {
if ( ( sharesText === ' ' ) || ( averageCost === ' ' ) || ( dateText === ' ' ) ) {
text2 = "No spaces" ;
document . getElementById ( 'demo-portfolio' ) . style . display = "block" ;
document . getElementById ( "inputText8" ) . value = '' ;
document . getElementById ( "inputText9" ) . value = '' ;
document . getElementById ( "inputText10" ) . value = '' ;
document . getElementById ( "inputText3" ) . value = '' ;
}
else if ( ( isNaN ( sharesText ) ) || ( isNaN ( averageCost ) ) ) {
text2 = "No text characters, only numbers" ;
document . getElementById ( 'demo-portfolio' ) . style . display = "block" ;
document . getElementById ( "inputText8" ) . value = '' ;
document . getElementById ( "inputText9" ) . value = '' ;
document . getElementById ( "inputText10" ) . value = '' ;
document . getElementById ( "inputText3" ) . value = '' ;
}
else if ( ( ! dateText . includes ( '-' ) ) && ( dateText !== '' ) ) {
text2 = "Incorrect date format, it should be YYYY-MM-DD" ;
document . getElementById ( 'demo-portfolio' ) . style . display = "block" ;
document . getElementById ( "inputText8" ) . value = '' ;
document . getElementById ( "inputText9" ) . value = '' ;
document . getElementById ( "inputText10" ) . value = '' ;
document . getElementById ( "inputText3" ) . value = '' ;
}
else if ( ( ( sharesText !== '' ) || ( averageCost !== '' ) || ( dateText !== '' ) ) && ( ( sharesText === '' ) || ( averageCost === '' ) || ( dateText === '' ) ) ) {
text2 = "Some fields are empty" ;
document . getElementById ( 'demo-portfolio' ) . style . display = "block" ;
document . getElementById ( "inputText8" ) . value = '' ;
document . getElementById ( "inputText9" ) . value = '' ;
document . getElementById ( "inputText10" ) . value = '' ;
document . getElementById ( "inputText3" ) . value = '' ;
}
else {
text2 = "Input OK" ;
document . getElementById ( 'demo-portfolio' ) . style . display = "none" ;
createLi = true ;
// CALL ADDING ITEMS FUNCTION SO THAT ONLY VALIDATED ITEMS CAN GET ADDED TO LIST
// addingItems();
let cost = document . getElementById ( 'inputText9' ) . value ;
let shares = document . getElementById ( 'inputText8' ) . value ;
let symbol = document . getElementById ( 'inputText3' ) . value ;
let days = document . getElementById ( 'inputText10' ) . value ;
let settings = {
shares : shares ,
cost : cost ,
symbol : symbol ,
days : days ,
} ;
console . log ( JSON . stringify ( settings ) ) ;
setTimeout (
function ( ) {
document . getElementById ( 'inputText3' ) . value = "" ;
document . getElementById ( "inputText8" ) . value = '' ;
document . getElementById ( "inputText9" ) . value = '' ;
document . getElementById ( "inputText10" ) . value = '' ;
document . getElementById ( "inputText3" ) . value = '' ;
} , 100 ) ;
if ( ( sharesText !== '' ) && ( averageCost !== '' ) && ( dateText !== '' ) ) {
fetch ( "/savePortfolioSettings" , {
method : "POST" ,
body : JSON . stringify ( settings ) ,
} ) ;
}
}
document . getElementById ( "demo-portfolio" ) . innerHTML = text2 ;
}
else {
createLi = true ;
// CALL ADDING ITEMS FUNCTION SO THAT ONLY VALIDATED ITEMS CAN GET ADDED TO LIST
// addingItems();
setTimeout (
function ( ) {
document . getElementById ( 'inputText3' ) . value = "" ;
} , 100 ) ;
}
2022-06-11 16:13:49 +00:00
}
document . getElementById ( "demo" ) . innerHTML = text ;
}
// Crypto validation
function cryptoValidate ( ) {
var specialChars = /[`!@#$%^&*()_+\-=\[\]{};':"\\|<>\/?~]/ ;
let x = document . getElementById ( "inputText4" ) . value ;
let baseCurrency = x . split ( "," ) [ 1 ] ;
2023-03-17 10:06:29 +00:00
let portfolioCheckbox = document . getElementById ( "crypto_portfolio_checkbox" ) ;
let sharesText = document . getElementById ( "cryptoshares" ) . value ;
let averageCost = document . getElementById ( "cryptocost" ) . value ;
let dateText = document . getElementById ( "cryptodate" ) . value ;
2022-06-11 16:13:49 +00:00
let text ;
2023-03-17 10:06:29 +00:00
let text2 ;
2022-06-11 16:13:49 +00:00
if ( x . toUpperCase ( ) != x ) {
document . getElementById ( 'demo2' ) . style . display = "block" ;
text = "Crypto and base must be uppercase" ;
document . getElementById ( "inputText4" ) . value = '' ;
// createLi = false;
}
else if ( x === '' ) {
document . getElementById ( 'demo2' ) . style . display = "block" ;
text = "No blanks"
// createLi = false;
}
else if ( x . includes ( ' ' ) ) {
text = "No spaces" ;
document . getElementById ( 'demo2' ) . style . display = "block" ;
document . getElementById ( "inputText4" ) . value = '' ;
// createLi = false;
}
else if ( specialChars . test ( x ) ) {
document . getElementById ( 'demo2' ) . style . display = "block" ;
text = "No special characters allowed" ;
document . getElementById ( "inputText4" ) . value = '' ;
// createLi = false;
}
else if ( ! x . includes ( ',' ) ) {
document . getElementById ( 'demo2' ) . style . display = "block" ;
document . getElementById ( "inputText4" ) . value = '' ;
text = "Missing ',' (e.g. BTC,USD)"
// createLi = false;
}
else if ( ! [ "USD" , "AUD" , "BTC" , "CAD" , "CHF" , "EUR" , "GBP" , "ETH" , "JPY" , "NZD" ] . includes ( baseCurrency ) ) {
document . getElementById ( 'demo2' ) . style . display = "block" ;
document . getElementById ( "inputText4" ) . value = '' ;
text = "Invalid base currency"
}
else {
text = "Input OK" ;
document . getElementById ( 'demo2' ) . style . display = "none" ;
2023-03-17 10:06:29 +00:00
//PORTFOLIO VALIDATION HERE
if ( portfolioCheckbox . checked ) {
if ( ( sharesText === ' ' ) || ( averageCost === ' ' ) || ( dateText === ' ' ) ) {
text2 = "No spaces" ;
document . getElementById ( 'demo-portfolio-crypto' ) . style . display = "block" ;
document . getElementById ( "cryptoshares" ) . value = '' ;
document . getElementById ( "cryptocost" ) . value = '' ;
document . getElementById ( "cryptodate" ) . value = '' ;
document . getElementById ( "inputText4" ) . value = '' ;
}
else if ( ( isNaN ( sharesText ) ) || ( isNaN ( averageCost ) ) ) {
text2 = "No text characters, only numbers" ;
document . getElementById ( 'demo-portfolio-crypto' ) . style . display = "block" ;
document . getElementById ( "cryptoshares" ) . value = '' ;
document . getElementById ( "cryptocost" ) . value = '' ;
document . getElementById ( "cryptodate" ) . value = '' ;
document . getElementById ( "inputText4" ) . value = '' ;
}
else if ( ( ! dateText . includes ( '-' ) ) && ( dateText !== '' ) ) {
text2 = "Incorrect date format, it should be YYYY-MM-DD" ;
document . getElementById ( 'demo-portfolio-crypto' ) . style . display = "block" ;
document . getElementById ( "cryptoshares" ) . value = '' ;
document . getElementById ( "cryptocost" ) . value = '' ;
document . getElementById ( "cryptodate" ) . value = '' ;
document . getElementById ( "inputText4" ) . value = '' ;
}
else if ( ( ( sharesText !== '' ) || ( averageCost !== '' ) || ( dateText !== '' ) ) && ( ( sharesText === '' ) || ( averageCost === '' ) || ( dateText === '' ) ) ) {
text2 = "Some fields are empty" ;
document . getElementById ( 'demo-portfolio-crypto' ) . style . display = "block" ;
document . getElementById ( "cryptoshares" ) . value = '' ;
document . getElementById ( "cryptocost" ) . value = '' ;
document . getElementById ( "cryptodate" ) . value = '' ;
document . getElementById ( "inputText4" ) . value = '' ;
}
else {
text2 = "Input OK" ;
document . getElementById ( 'demo-portfolio-crypto' ) . style . display = "none" ;
createLi = true ;
let cost = document . getElementById ( 'cryptocost' ) . value ;
let shares = document . getElementById ( 'cryptoshares' ) . value ;
let symbol = document . getElementById ( 'inputText4' ) . value ;
let days = document . getElementById ( 'cryptodate' ) . value ;
let settings = {
shares : shares ,
cost : cost ,
symbol : symbol ,
days : days ,
} ;
console . log ( JSON . stringify ( settings ) ) ;
setTimeout (
function ( ) {
document . getElementById ( 'inputText4' ) . value = "" ;
document . getElementById ( "cryptocost" ) . value = '' ;
document . getElementById ( "cryptoshares" ) . value = '' ;
document . getElementById ( "cryptodate" ) . value = '' ;
document . getElementById ( "inputText4" ) . value = '' ;
} , 100 ) ;
if ( ( sharesText !== '' ) && ( averageCost !== '' ) && ( dateText !== '' ) ) {
fetch ( "/savePortfolioCryptoSettings" , {
method : "POST" ,
body : JSON . stringify ( settings ) ,
} ) ;
}
}
document . getElementById ( "demo-portfolio-crypto" ) . innerHTML = text2 ;
}
else {
createLi = true ;
// CALL ADDING ITEMS FUNCTION SO THAT ONLY VALIDATED ITEMS CAN GET ADDED TO LIST
setTimeout (
function ( ) {
document . getElementById ( 'inputText4' ) . value = "" ;
} , 100 ) ;
}
2022-06-11 16:13:49 +00:00
}
document . getElementById ( "demo2" ) . innerHTML = text ;
}
// Forex validation
function forexValidate ( ) {
2023-06-12 07:31:14 +00:00
createLi = true ;
}
2022-06-11 16:13:49 +00:00
2023-06-12 07:31:14 +00:00
// var specialChars = /[`!@#$%^&*()_+\-=\[\]{};':"\\|<>\/?~]/;
2022-06-11 16:13:49 +00:00
2023-06-12 07:31:14 +00:00
// let x = document.getElementById("inputText5").value;
// let quoteCurrency = x.split(",")[1];
// let baseCurrency = x.split(",")[0];
2022-06-11 16:13:49 +00:00
2023-06-12 07:31:14 +00:00
// // console.log("base"+baseCurrency);
// // console.log("quote"+quoteCurrency);
2022-06-11 16:13:49 +00:00
2023-06-12 07:31:14 +00:00
// let text;
// if (x.toUpperCase() != x) {
// document.getElementById('demo3').style.display = "block";
// text = "Base and quote must be uppercase";
// document.getElementById("inputText5").value = '';
// // createLi = false;
// }
// else if (x === '') {
// document.getElementById('demo3').style.display = "block";
// text = "No blanks"
// }
2022-06-11 16:13:49 +00:00
2023-06-12 07:31:14 +00:00
// else if (x.includes(' ')) {
// text = "No spaces";
// document.getElementById('demo3').style.display = "block";
// document.getElementById("inputText5").value = '';
// }
2022-06-11 16:13:49 +00:00
2023-06-12 07:31:14 +00:00
// else if (/\d/.test(x)) {
// document.getElementById('demo3').style.display = "block";
// text = "No numbers allowed";
// document.getElementById("inputText5").value = '';
// }
// // CAREFUL TO DELETE THE BACKEND LIST ITEMS, JUST DELETING THE VALUE LIKE THIS ISN"T 100% ACCURATE
// else if (specialChars.test(x)) {
// document.getElementById('demo3').style.display = "block";
// text = "No special characters allowed";
// document.getElementById("inputText5").value = '';
// }
2022-06-11 16:13:49 +00:00
2023-06-12 07:31:14 +00:00
// else if (!x.includes(',')) {
// document.getElementById('demo3').style.display = "block";
// document.getElementById("inputText5").value = '';
// text = "Missing ',' (e.g. EUR,USD)"
// }
2022-06-11 16:13:49 +00:00
2023-06-12 07:31:14 +00:00
// else if (x.length > 7) {
// document.getElementById('demo3').style.display = "block";
// text = "No more than 7 characters";
// document.getElementById("inputText5").value = '';
// }
2022-06-11 16:13:49 +00:00
2023-06-12 07:31:14 +00:00
// else if (!["USD","EUR","JPY","GBP","AUD","CAD","CHF","CNY","HKD","NZD","SEK","KRW","SGD","NOK","MXN","INR","RUB","ZAR","TRY","BRL",
// "TWD","DKK","PLN","THB","IDR","HUF","ILS","CLP","PHP","AED","CZK","COP","SAR","MYR","RON","CLP","ARS","VND","QAR","KWD"].includes(baseCurrency)) {
// document.getElementById('demo3').style.display = "block";
// document.getElementById("inputText5").value = '';
// text = "Invalid base currency"
2022-06-11 16:13:49 +00:00
2023-06-12 07:31:14 +00:00
// }
2022-06-11 16:13:49 +00:00
2023-06-12 07:31:14 +00:00
// else if (!["AED","AFN","ALL","AMD","AOA","ARS","AUD","AWG","AZN","BAM","BBD","BDT","BGN","BHD","BMD","BND","BOB","BRL","BSD", "BTN", "BWP", "BYN",
// "BZD", "CAD", "CDF", "CHF", "CLP", "CNY", "COP", "CRC", "CUC", "CUP", "CVE", "CZK", "DJF", "DKK", "DOP", "DZD", "EGP", "ERN", "ETB", "EUR",
// "FJD", "FKP", "FOK", "GBP", "GEL", "GGP", "GHS", "GIP", "GMD", "GNF", "GTQ", "GYD", "HKD", "HNL", "HRK", "HTG", "HUF", "IDR", "ILS", "IMP",
// "INR", "IQD", "IRR", "ISK", "JMD", "JOD", "JPY","KES","KGS","KHR","KID","KMF","KRW","KWD", "KYD","KZT","LAK","LBP","LKR","LRD","LSL", "LYD",
// "MAD","MDL","MGA","MKD","MMK","MNT","MOP","MRU","MUR","MVR","MWK","MXN","MYR","MZN","NAD","NGN","NIO","NOK","NPR","NZD","OMR","PAB","PEN",
// "PGK","PHP","PKR","PLN","PYG","QAR","RON","RSD","RUB","RWF","SAR","SBD","SCR","SDG","SEK","SGD","SHP","SLL","SOS","SRD","SSP","STN","SYP","SZL",
// "THB","TJS","TMT","TND","TOP","TRY","TTD","TVD","TWD","TZS","UAH","UGX","USD","UYU","UZS","VES","VND","VUV","WST","YER","ZAR"].includes(quoteCurrency)) {
// document.getElementById('demo3').style.display = "block";
// document.getElementById("inputText5").value = '';
// text = "Invalid quote currency"
2022-06-11 16:13:49 +00:00
2023-06-12 07:31:14 +00:00
// }
2022-06-11 16:13:49 +00:00
2023-06-12 07:31:14 +00:00
// else {
// text = "Input OK";
// document.getElementById('demo3').style.display = "none";
// createLi = true;
// // CALL ADDING ITEMS FUNCTION SO THAT ONLY VALIDATED ITEMS CAN GET ADDED TO LIST
// // addingItems();
// setTimeout(
// function() {
// document.getElementById('inputText5').value="";
// }, 100);
// }
// document.getElementById("demo3").innerHTML = text;
// }
2022-06-11 16:13:49 +00:00
// Custom messages validation
function customMsgValidate ( ) {
let x = document . getElementById ( "inputText13" ) . value ;
let y = document . getElementById ( "inputText14" ) . value ;
let text ;
if ( ( x === '' ) && ( y !== '' ) ) {
createLi = false ;
document . getElementById ( 'demo4' ) . style . display = "block" ;
text = "No blanks"
document . getElementById ( "inputText14" ) . value = '' ;
document . getElementById ( 'demo5' ) . style . display = "none" ;
}
else if ( ( y === '' ) && ( x !== '' ) ) {
createLi = false ;
document . getElementById ( 'demo5' ) . style . display = "block" ;
document . getElementById ( "inputText13" ) . value = '' ;
document . getElementById ( 'demo4' ) . style . display = "none" ;
text = "No blanks"
}
else if ( ( y === '' ) && ( x === '' ) ) {
createLi = false ;
document . getElementById ( 'demo5' ) . style . display = "block" ;
// document.getElementById("inputText13").value = '';
document . getElementById ( 'demo4' ) . style . display = "block" ;
text = "No blanks"
}
else if ( ( x !== '' ) && ( y !== '' ) ) {
text = "Input OK" ;
document . getElementById ( 'demo4' ) . style . display = "none" ;
document . getElementById ( 'demo5' ) . style . display = "none" ;
createLi = true ;
// CALL ADDING ITEMS FUNCTION SO THAT ONLY VALIDATED ITEMS CAN GET ADDED TO LIST
// addingItems();
setTimeout (
function ( ) {
document . getElementById ( 'inputText13' ) . value = "" ;
document . getElementById ( 'inputText14' ) . value = "" ;
} , 100 ) ;
}
document . getElementById ( "demo4" ) . innerHTML = text ;
document . getElementById ( "demo5" ) . innerHTML = text ;
}
// current weather validation
function currentWeatherValidate ( ) {
var specialChars = /[`!@#$%^&*()_+\-=\[\]{};':"\\|<>\/?~]/ ;
let x = document . getElementById ( "inputText6" ) . value ;
let text ;
if ( specialChars . test ( x ) ) {
document . getElementById ( 'demo6' ) . style . display = "block" ;
text = "No special characters allowed" ;
document . getElementById ( "inputText6" ) . value = '' ;
}
else if ( x === '' ) {
document . getElementById ( 'demo6' ) . style . display = "block" ;
text = "No blanks"
}
else if ( /\d/ . test ( x ) ) {
document . getElementById ( 'demo6' ) . style . display = "block" ;
text = "No numbers allowed" ;
document . getElementById ( "inputText6" ) . value = '' ;
}
else {
text = "Input OK" ;
document . getElementById ( 'demo6' ) . style . display = "none" ;
createLi = true ;
// CALL ADDING ITEMS FUNCTION SO THAT ONLY VALIDATED ITEMS CAN GET ADDED TO LIST
// addingItems();
setTimeout (
function ( ) {
document . getElementById ( 'inputText6' ) . value = "" ;
} , 100 ) ;
}
document . getElementById ( "demo6" ) . innerHTML = text ;
}
// Daily forecast validation
function dailyWeatherValidate ( ) {
var specialChars = /[`!@#$%^&*()_+\-=\[\]{};':"\\|<>\/?~]/ ;
let x = document . getElementById ( "inputText7" ) . value ;
let text ;
if ( specialChars . test ( x ) ) {
document . getElementById ( 'demo7' ) . style . display = "block" ;
text = "No special characters allowed" ;
document . getElementById ( "inputText7" ) . value = '' ;
}
else if ( x === '' ) {
document . getElementById ( 'demo7' ) . style . display = "block" ;
text = "No blanks"
}
else if ( /\d/ . test ( x ) ) {
document . getElementById ( 'demo7' ) . style . display = "block" ;
text = "No numbers allowed" ;
document . getElementById ( "inputText7" ) . value = '' ;
}
else {
text = "Input OK" ;
document . getElementById ( 'demo7' ) . style . display = "none" ;
createLi = true ;
// CALL ADDING ITEMS FUNCTION SO THAT ONLY VALIDATED ITEMS CAN GET ADDED TO LIST
// addingItems();
setTimeout (
function ( ) {
document . getElementById ( 'inputText7' ) . value = "" ;
} , 100 ) ;
}
document . getElementById ( "demo7" ) . innerHTML = text ;
}
// Commodities validation
function commoditiesValidate ( ) {
2023-06-12 07:39:30 +00:00
createLi = true ;
}
// var specialChars = /[`!@#$%^&*()_+\-=\[\]{};':"\\|<>\/?~]/;
2022-06-11 16:13:49 +00:00
2023-06-12 07:39:30 +00:00
// let x = document.getElementById("inputText20").value;
2022-06-11 16:13:49 +00:00
2023-06-12 07:39:30 +00:00
// let text;
// if (x.toUpperCase() != x) {
// document.getElementById('demo8').style.display = "block";
// text = "Commodity symbol must be uppercase";
// document.getElementById("inputText20").value = '';
// // createLi = false;
// }
// else if (x === '') {
// document.getElementById('demo8').style.display = "block";
// text = "No blanks"
// // createLi = false;
// }
2022-06-11 16:13:49 +00:00
2023-06-12 07:39:30 +00:00
// else if (x.includes(' ')) {
// text = "No spaces";
// document.getElementById('demo8').style.display = "block";
// document.getElementById("inputText20").value = '';
// // createLi = false;
// }
2022-06-11 16:13:49 +00:00
2023-06-12 07:39:30 +00:00
// else if (specialChars.test(x)) {
// document.getElementById('demo8').style.display = "block";
// text = "No special characters allowed";
// document.getElementById("inputText20").value = '';
// // createLi = false;
// }
2022-06-11 16:13:49 +00:00
2023-06-12 07:39:30 +00:00
// else if (!["ALU","BRENTOIL","LCO","COFFEE","XCU","CORN","COTTON","XAU","IRD","NI","XPD","XPT","XRH","RICE","RUTH","XAG","SOYBEAN",
// "XDR","SUGAR","TIN","WHEAT","WTIOIL","ZNC","ETHANOL","CPO","NG","COCOA","ROBUSTA","LUMBER","RUBBER","HOG","CATTLE"].includes(x)) {
// document.getElementById('demo8').style.display = "block";
// document.getElementById("inputText20").value = '';
// text = "Invalid commodity symbol"
2022-06-11 16:13:49 +00:00
2023-06-12 07:39:30 +00:00
// }
2022-06-11 16:13:49 +00:00
2023-06-12 07:39:30 +00:00
// else {
// text = "Input OK";
// document.getElementById('demo8').style.display = "none";
// createLi = true;
// // CALL ADDING ITEMS FUNCTION SO THAT ONLY VALIDATED ITEMS CAN GET ADDED TO LIST
// setTimeout(
// function() {
// document.getElementById('inputText20').value="";
// }, 100);
// }
// document.getElementById("demo8").innerHTML = text;
// }
2022-10-05 10:29:42 +00:00
// Indices validation
function indicesValidate ( ) {
2023-06-12 07:39:30 +00:00
createLi = true
} ;
// var specialChars = /[`!@#$%&*()_+\-=\[\]{};':"\\|<>\/?~]/;
2022-10-05 10:29:42 +00:00
2023-06-12 07:39:30 +00:00
// let x = document.getElementById("inputText21").value;
2022-10-05 10:29:42 +00:00
2023-06-12 07:39:30 +00:00
// let text;
// if (x.toUpperCase() != x) {
// document.getElementById('demo9').style.display = "block";
// text = "Index symbol must be uppercase";
// document.getElementById("inputText21").value = '';
// // createLi = false;
// }
// else if (x === '') {
// document.getElementById('demo9').style.display = "block";
// text = "No blanks"
// // createLi = false;
// }
2022-10-05 10:29:42 +00:00
2023-06-12 07:39:30 +00:00
// else if (x.includes(' ')) {
// text = "No spaces";
// document.getElementById('demo9').style.display = "block";
// document.getElementById("inputText21").value = '';
// // createLi = false;
// }
2022-10-05 10:29:42 +00:00
2023-06-12 07:39:30 +00:00
// else if (specialChars.test(x)) {
// document.getElementById('demo9').style.display = "block";
// text = "No special characters allowed";
// document.getElementById("inputText21").value = '';
// // createLi = false;
// }
2022-10-05 10:29:42 +00:00
2023-06-12 07:39:30 +00:00
// else if (!["^DJI","^GSPC","^NDX","^RUT","^VIX","^GSPTSE","^MXX","^BVSP","^GDAXI","^FTSE","^IBEX","^FCHI","^SSMI","^BFX","^ATX","^AEX","^OMX","^IXIC","FTSEMIB.MI",
// "^OMXH25","PSI20.LS","^STOXX","^STOXX50E","^N100","^KS11","^NZ50","^AXJO","^STI","000001.SS","399001.SZ","^N225","^NSEI","^BSESN","^HSI","^TWII","^JKSE","PSEI.PS","^SET.BK","XU100.IS"].includes(x)) {
// document.getElementById('demo9').style.display = "block";
// document.getElementById("inputText21").value = '';
// text = "Invalid index symbol"
2022-10-05 10:29:42 +00:00
2023-06-12 07:39:30 +00:00
// }
2023-01-09 10:34:29 +00:00
2023-06-12 07:39:30 +00:00
// else {
// text = "Input OK";
// document.getElementById('demo9').style.display = "none";
// createLi = true;
// // CALL ADDING ITEMS FUNCTION SO THAT ONLY VALIDATED ITEMS CAN GET ADDED TO LIST
// setTimeout(
// function() {
// document.getElementById('inputText21').value="";
// }, 100);
// }
// document.getElementById("demo9").innerHTML = text;
// }
2023-03-16 09:25:27 +00:00
// portoflio stuff
var portfolioCheckbox = document . getElementById ( "flexCheckChecked4" ) ;
if ( portfolioCheckbox . checked ) {
document . getElementById ( 'stocks-portfolio' ) . style . display = "block" ;
} else {
document . getElementById ( 'stocks-portfolio' ) . style . display = "none" ;
}
function portfolioValidate ( ) {
var portfolioCheckbox = document . getElementById ( "flexCheckChecked4" ) ;
if ( portfolioCheckbox . checked ) {
document . getElementById ( 'stocks-portfolio' ) . style . display = "block" ;
} else {
document . getElementById ( 'stocks-portfolio' ) . style . display = "none" ;
}
}
2023-03-17 09:32:03 +00:00
// crypto portfolio stuff
var portfolioCryptoCheckbox = document . getElementById ( "crypto_portfolio_checkbox" ) ;
if ( portfolioCryptoCheckbox . checked ) {
document . getElementById ( 'crypto-portfolio' ) . style . display = "block" ;
} else {
document . getElementById ( 'crypto-portfolio' ) . style . display = "none" ;
}
function portfolioCryptoValidate ( ) {
var portfolioCryptoCheckbox = document . getElementById ( "crypto_portfolio_checkbox" ) ;
if ( portfolioCryptoCheckbox . checked ) {
document . getElementById ( 'crypto-portfolio' ) . style . display = "block" ;
} else {
document . getElementById ( 'crypto-portfolio' ) . style . display = "none" ;
}
}
2023-03-16 09:25:27 +00:00
2023-04-21 10:52:09 +00:00
2023-08-22 13:31:45 +00:00
// screensaver show div
function showScreensaver ( ) {
document . getElementById ( 'screensaver-div' ) . style . display = "block" ;
}
function closeScreensaver ( ) {
document . getElementById ( 'screensaver-div' ) . style . display = "none" ;
document . getElementById ( 'screensaver-saved' ) . style . display = "none" ;
}
2023-04-21 10:52:09 +00:00
// scheduler show div
function showScheduler ( ) {
document . getElementById ( 'scheduler-div' ) . style . display = "block" ;
}
function closeScheduler ( ) {
document . getElementById ( 'scheduler-div' ) . style . display = "none" ;
2023-04-24 10:23:58 +00:00
document . getElementById ( 'saved' ) . style . display = "none" ;
2023-04-21 10:52:09 +00:00
}
2023-04-22 10:12:09 +00:00
// save scheduler settings
function saveSchedulerSettings ( ) {
let shutdown _hour = document . getElementById ( "shutdown-hour-select" ) . value ;
let shutdown _minute = document . getElementById ( "shutdown-minute-select" ) . value ;
let shutdown _enabled = document . getElementById ( "shutdown-enabled" ) . checked ;
let reboot _hour = document . getElementById ( "reboot-hour-select" ) . value ;
let reboot _minute = document . getElementById ( "reboot-minute-select" ) . value ;
let reboot _enabled = document . getElementById ( "reboot-enabled" ) . checked ;
2023-04-26 07:27:44 +00:00
let brightness1 _hour = document . getElementById ( "brightness1-hour1-select" ) . value ;
let brightness1 _minute = document . getElementById ( "brightness1-minute1-select" ) . value ;
let brightness1 _enabled = document . getElementById ( "brightness1-enabled" ) . checked ;
let brightness1 _bright = document . getElementById ( "brightness1-bright-select" ) . value ;
let brightness2 _hour = document . getElementById ( "brightness2-hour1-select" ) . value ;
let brightness2 _minute = document . getElementById ( "brightness2-minute1-select" ) . value ;
let brightness2 _enabled = document . getElementById ( "brightness2-enabled" ) . checked ;
let brightness2 _bright = document . getElementById ( "brightness2-bright-select" ) . value ;
let brightness3 _hour = document . getElementById ( "brightness3-hour1-select" ) . value ;
let brightness3 _minute = document . getElementById ( "brightness3-minute1-select" ) . value ;
let brightness3 _enabled = document . getElementById ( "brightness3-enabled" ) . checked ;
let brightness3 _bright = document . getElementById ( "brightness3-bright-select" ) . value ;
let brightness4 _hour = document . getElementById ( "brightness4-hour1-select" ) . value ;
let brightness4 _minute = document . getElementById ( "brightness4-minute1-select" ) . value ;
let brightness4 _enabled = document . getElementById ( "brightness4-enabled" ) . checked ;
let brightness4 _bright = document . getElementById ( "brightness4-bright-select" ) . value ;
2023-08-23 14:14:41 +00:00
let screensaver1 _hour = document . getElementById ( "screensaver1-hour-select" ) . value ;
let screensaver1 _minute = document . getElementById ( "screensaver1-minute-select" ) . value ;
let screensaver1 _endhour = document . getElementById ( "screensaver1-endhour-select" ) . value ;
let screensaver1 _endminute = document . getElementById ( "screensaver1-endminute-select" ) . value ;
let screensaver1 _enabled = document . getElementById ( "screensaver1-enabled" ) . checked ;
let screensaver1 _type = document . getElementById ( "screensaver1-type" ) . value ;
let screensaver2 _hour = document . getElementById ( "screensaver2-hour-select" ) . value ;
let screensaver2 _minute = document . getElementById ( "screensaver2-minute-select" ) . value ;
let screensaver2 _endhour = document . getElementById ( "screensaver2-endhour-select" ) . value ;
let screensaver2 _endminute = document . getElementById ( "screensaver2-endminute-select" ) . value ;
let screensaver2 _enabled = document . getElementById ( "screensaver2-enabled" ) . checked ;
let screensaver2 _type = document . getElementById ( "screensaver2-type" ) . value ;
let screensaver3 _hour = document . getElementById ( "screensaver3-hour-select" ) . value ;
let screensaver3 _minute = document . getElementById ( "screensaver3-minute-select" ) . value ;
let screensaver3 _endhour = document . getElementById ( "screensaver3-endhour-select" ) . value ;
let screensaver3 _endminute = document . getElementById ( "screensaver3-endminute-select" ) . value ;
let screensaver3 _enabled = document . getElementById ( "screensaver3-enabled" ) . checked ;
let screensaver3 _type = document . getElementById ( "screensaver3-type" ) . value ;
2023-04-22 10:12:09 +00:00
let timezone = document . getElementById ( "timezone-select" ) . value ;
let settings = {
shutdown _hour : shutdown _hour ,
shutdown _minute : shutdown _minute ,
shutdown _enabled : shutdown _enabled ,
reboot _hour : reboot _hour ,
reboot _minute : reboot _minute ,
reboot _enabled : reboot _enabled ,
timezone : timezone ,
2023-04-26 07:27:44 +00:00
brightness1 _hour : brightness1 _hour ,
brightness1 _minute : brightness1 _minute ,
brightness1 _bright : brightness1 _bright ,
brightness1 _enabled : brightness1 _enabled ,
brightness2 _hour : brightness2 _hour ,
brightness2 _minute : brightness2 _minute ,
brightness2 _bright : brightness2 _bright ,
brightness2 _enabled : brightness2 _enabled ,
brightness3 _hour : brightness3 _hour ,
brightness3 _minute : brightness3 _minute ,
brightness3 _bright : brightness3 _bright ,
brightness3 _enabled : brightness3 _enabled ,
brightness4 _hour : brightness4 _hour ,
brightness4 _minute : brightness4 _minute ,
brightness4 _bright : brightness4 _bright ,
brightness4 _enabled : brightness4 _enabled ,
2023-08-23 14:14:41 +00:00
screensaver1 _hour : screensaver1 _hour ,
screensaver1 _minute : screensaver1 _minute ,
screensaver1 _endhour : screensaver1 _endhour ,
screensaver1 _endminute : screensaver1 _endminute ,
screensaver1 _enabled : screensaver1 _enabled ,
screensaver1 _type : screensaver1 _type ,
screensaver2 _hour : screensaver2 _hour ,
screensaver2 _minute : screensaver2 _minute ,
screensaver2 _endhour : screensaver2 _endhour ,
screensaver2 _endminute : screensaver2 _endminute ,
screensaver2 _enabled : screensaver2 _enabled ,
screensaver2 _type : screensaver2 _type ,
screensaver3 _hour : screensaver3 _hour ,
screensaver3 _minute : screensaver3 _minute ,
screensaver3 _endhour : screensaver3 _endhour ,
screensaver3 _endminute : screensaver3 _endminute ,
screensaver3 _enabled : screensaver3 _enabled ,
screensaver3 _type : screensaver3 _type ,
2023-04-22 10:12:09 +00:00
} ;
console . log ( settings ) ;
2023-04-24 10:23:58 +00:00
fetch ( "/saveSchedulerSettings" , {
method : "POST" ,
2023-04-24 10:33:22 +00:00
body : JSON . stringify ( settings ) ,
2023-04-24 10:23:58 +00:00
} ) ;
document . getElementById ( 'saved' ) . style . display = "block" ;
2023-04-22 10:12:09 +00:00
}
2023-05-15 08:27:01 +00:00
// CHANGE TOP 20 OR TOP 10 WORLD GOLF RANKING
function setTop20 ( ) {
let top20 = document . getElementById ( "golf-ranking-number" ) . value ;
fetch ( "/setTop20or10" , {
method : "POST" ,
body : JSON . stringify ( top20 ) ,
} ) ;
}
2023-07-07 08:22:21 +00:00
2023-07-07 17:11:19 +00:00
let theIndexOfMsg = null
2023-07-07 15:18:58 +00:00
2023-07-07 08:22:21 +00:00
// get custom message values
function getCustomMsg ( value ) {
let messaged = value ;
const the _thing = document . getElementById ( "inputText13" ) ;
const the _msg = document . getElementById ( "inputText14" ) ;
const t _color = document . getElementById ( "inputScrollSpeed16" ) ;
2023-07-19 16:00:51 +00:00
const b _color = document . getElementById ( "inputScrollSpeed19BG" ) ;
2023-07-07 08:22:21 +00:00
const t _size = document . getElementById ( "inputScrollSpeed17" ) ;
the _thing . value = messaged ;
fetch ( "/fetchCustomMsg" , {
method : "POST" ,
body : JSON . stringify ( messaged ) ,
} )
. then ( response => response . json ( ) )
. then ( data => {
// Update the elements with the retrieved information
the _msg . value = data . text ;
t _color . value = data . text _colour ;
b _color . value = data . background _colour ;
t _size . value = data . size ;
2023-07-07 15:18:58 +00:00
theIndexOfMsg = data . index ;
2023-07-07 08:22:21 +00:00
} )
. catch ( error => {
console . error ( 'Error:' , error ) ;
} ) ;
}
2023-07-07 15:18:58 +00:00
// get custom message values
function updateSelectedMsg ( ) {
const msg _name = document . getElementById ( "inputText13" ) . value ;
const msg _text = document . getElementById ( "inputText14" ) . value ;
if ( ( msg _name !== '' ) && ( msg _text !== '' ) ) {
const text _color = document . getElementById ( "inputScrollSpeed16" ) . value ;
2023-07-19 16:00:51 +00:00
const background _color = document . getElementById ( "inputScrollSpeed19BG" ) . value ;
2023-07-07 15:18:58 +00:00
const text _size = document . getElementById ( "inputScrollSpeed17" ) . value ;
document . getElementById ( 'demo4' ) . style . display = "none" ;
document . getElementById ( 'demo5' ) . style . display = "none" ;
fetch ( "/updateSelectedMsg" , {
method : "POST" ,
body : JSON . stringify ( { 'name' : msg _name , 'text' : msg _text , 'text_colour' : text _color , 'size' : text _size , 'background_colour' : background _color , 'index' : theIndexOfMsg } ) ,
} ) ;
const ulElement = document . getElementById ( "messages-features" ) ;
const activeListItem = ulElement . querySelector ( "li.active" ) ;
activeListItem . innerText = msg _name ;
2023-07-07 17:22:46 +00:00
activeListItem . classList . remove ( "active" ) ;
2023-07-07 17:11:19 +00:00
theIndexOfMsg = null ;
2023-07-07 15:18:58 +00:00
document . getElementById ( 'updated-message-p' ) . style . display = "block" ;
setTimeout ( function hideElement ( ) {
document . getElementById ( 'updated-message-p' ) . style . display = "none" ;
} , 5000 ) ;
}
else {
customMsgValidate ( ) ;
}
}
2023-07-10 08:24:45 +00:00
// get stock portfolio values
function getStockSymbol ( value ) {
let stock _symbol = value ;
const stock _thing = document . getElementById ( "inputText3" ) ;
2023-07-11 09:04:29 +00:00
const stock _shares = document . getElementById ( "inputText8" ) ;
const stock _cost = document . getElementById ( "inputText9" ) ;
const stock _date = document . getElementById ( "inputText10" ) ;
const stock _portfolio _check = document . getElementById ( "flexCheckChecked4" ) ;
2023-07-10 08:24:45 +00:00
stock _thing . value = stock _symbol ;
2023-07-11 09:04:29 +00:00
if ( stock _portfolio _check . checked ) {
fetch ( "/fetchStockPortfolio" , {
method : "POST" ,
body : JSON . stringify ( stock _symbol ) ,
} )
. then ( response => response . json ( ) )
. then ( data => {
if ( JSON . stringify ( data ) !== '{}' ) {
// Update the elements with the retrieved information
stock _shares . value = data . shares ;
stock _cost . value = data . cost ;
stock _date . value = data . day ;
} else {
stock _shares . value = '' ;
stock _cost . value = '' ;
stock _date . value = '' ;
}
} )
. catch ( error => {
console . error ( 'Error:' , error ) ;
} ) ;
} }
2023-07-10 08:24:45 +00:00
// get crypto portfolio values
function getCryptoSymbol ( value ) {
let crypto _symbol = value ;
const crypto _thing = document . getElementById ( "inputText4" ) ;
2023-07-11 09:04:29 +00:00
const crypto _shares = document . getElementById ( "cryptoshares" ) ;
const crypto _cost = document . getElementById ( "cryptocost" ) ;
const crypto _date = document . getElementById ( "cryptodate" ) ;
const crypto _portfolio _check = document . getElementById ( "crypto_portfolio_checkbox" ) ;
2023-07-10 08:24:45 +00:00
crypto _thing . value = crypto _symbol ;
2023-07-11 09:04:29 +00:00
if ( crypto _portfolio _check . checked ) {
fetch ( "/fetchCryptoPortfolio" , {
method : "POST" ,
body : JSON . stringify ( crypto _symbol ) ,
} )
. then ( response => response . json ( ) )
. then ( data => {
if ( JSON . stringify ( data ) !== '{}' ) {
// Update the elements with the retrieved information
crypto _shares . value = data . shares ;
crypto _cost . value = data . cost ;
crypto _date . value = data . day ;
} else {
crypto _shares . value = '' ;
crypto _cost . value = '' ;
crypto _date . value = '' ;
}
} )
. catch ( error => {
console . error ( 'Error:' , error ) ;
} ) ;
} }
2023-07-11 10:25:44 +00:00
2023-07-11 11:09:46 +00:00
// remove stock portfolio position
function removeStockPorftolio ( ) {
let remove _stock _symbol = document . getElementById ( 'inputText3' ) . value ;
if ( remove _stock _symbol !== '' ) {
document . getElementById ( 'inputText9' ) . value = '' ;
document . getElementById ( 'inputText8' ) . value = '' ;
document . getElementById ( 'inputText10' ) . value = '' ;
2023-07-11 11:16:15 +00:00
fetch ( "/deletePortfolioPosition" , {
2023-07-11 11:09:46 +00:00
method : "POST" ,
body : JSON . stringify ( remove _stock _symbol ) ,
} ) ;
2023-07-11 11:16:15 +00:00
2023-07-11 11:26:11 +00:00
document . getElementById ( 'stockremoved-p' ) . innerHTML = 'Stock Position Removed!' ;
2023-07-11 11:09:46 +00:00
document . getElementById ( 'removed-stock-p' ) . style . display = "block" ;
setTimeout ( function hideElement ( ) {
document . getElementById ( 'removed-stock-p' ) . style . display = "none" ;
} , 5000 ) ;
2023-07-11 11:16:15 +00:00
}
else {
2023-07-11 11:26:11 +00:00
document . getElementById ( 'stockremoved-p' ) . innerHTML = 'No symbol selected.' ;
2023-07-11 11:09:46 +00:00
document . getElementById ( 'removed-stock-p' ) . style . display = "block" ;
setTimeout ( function hideElement ( ) {
document . getElementById ( 'removed-stock-p' ) . style . display = "none" ;
} , 5000 ) ;
}
}
2023-07-11 10:25:44 +00:00
// update stock portfolio position with new values
function updateStockPorftolio ( ) {
let update _stock _cost = document . getElementById ( 'inputText9' ) . value ;
let update _stock _shares = document . getElementById ( 'inputText8' ) . value ;
let update _symbol = document . getElementById ( 'inputText3' ) . value ;
let update _stock _days = document . getElementById ( 'inputText10' ) . value ;
let update _stock _settings = {
shares : update _stock _shares ,
cost : update _stock _cost ,
symbol : update _symbol ,
days : update _stock _days ,
} ;
2023-07-11 14:21:42 +00:00
if ( ( update _symbol === '' ) || ( update _symbol === ' ' ) ) {
document . getElementById ( 'stockremoved-p' ) . innerHTML = 'No symbol selected.' ;
document . getElementById ( 'removed-stock-p' ) . style . display = "block" ;
setTimeout ( function hideElement ( ) {
document . getElementById ( 'removed-stock-p' ) . style . display = "none" ;
} , 5000 ) ;
}
else if ( ( update _stock _cost === ' ' ) || ( update _stock _shares === ' ' ) || ( update _stock _days === ' ' ) ) {
document . getElementById ( 'stockremoved-p' ) . innerHTML = 'No spaces.' ;
document . getElementById ( 'removed-stock-p' ) . style . display = "block" ;
setTimeout ( function hideElement ( ) {
document . getElementById ( 'removed-stock-p' ) . style . display = "none" ;
} , 5000 ) ;
}
else if ( ( isNaN ( update _stock _cost ) ) || ( isNaN ( update _stock _shares ) ) ) {
document . getElementById ( 'stockremoved-p' ) . innerHTML = 'No text characters, only numbers.' ;
document . getElementById ( 'removed-stock-p' ) . style . display = "block" ;
setTimeout ( function hideElement ( ) {
document . getElementById ( 'removed-stock-p' ) . style . display = "none" ;
} , 5000 ) ;
}
else if ( ( ! update _stock _days . includes ( '-' ) ) && ( update _stock _days !== '' ) ) {
document . getElementById ( 'stockremoved-p' ) . innerHTML = 'Incorrect date format, it should be YYYY-MM-DD' ;
document . getElementById ( 'removed-stock-p' ) . style . display = "block" ;
setTimeout ( function hideElement ( ) {
document . getElementById ( 'removed-stock-p' ) . style . display = "none" ;
} , 5000 ) ;
}
else if ( ( ( update _stock _shares !== '' ) || ( update _stock _cost !== '' ) || ( update _stock _days !== '' ) ) && ( ( update _stock _shares === '' ) || ( update _stock _cost === '' ) || ( update _stock _days === '' ) ) ) {
document . getElementById ( 'stockremoved-p' ) . innerHTML = 'Some fields are empty.' ;
document . getElementById ( 'removed-stock-p' ) . style . display = "block" ;
setTimeout ( function hideElement ( ) {
document . getElementById ( 'removed-stock-p' ) . style . display = "none" ;
} , 5000 ) ;
}
else {
2023-07-11 10:25:44 +00:00
fetch ( "/savePortfolioSettings" , {
method : "POST" ,
body : JSON . stringify ( update _stock _settings ) ,
} ) ;
document . getElementById ( 'updated-stock-p' ) . style . display = "block" ;
setTimeout ( function hideElement ( ) {
document . getElementById ( 'updated-stock-p' ) . style . display = "none" ;
} , 5000 ) ;
}
}
2023-07-11 10:47:24 +00:00
2023-07-11 11:29:20 +00:00
// remove crypto portfolio position
function removeCryptoPorftolio ( ) {
let remove _crypto _symbol = document . getElementById ( 'inputText4' ) . value ;
if ( remove _crypto _symbol !== '' ) {
document . getElementById ( 'cryptoshares' ) . value = '' ;
document . getElementById ( 'cryptocost' ) . value = '' ;
document . getElementById ( 'cryptodate' ) . value = '' ;
fetch ( "/deletePortfolioPositionCrypto" , {
method : "POST" ,
body : JSON . stringify ( remove _crypto _symbol ) ,
} ) ;
document . getElementById ( 'cryptoremoved-p' ) . innerHTML = 'Crypto Position Removed!' ;
document . getElementById ( 'removed-crypto-p' ) . style . display = "block" ;
setTimeout ( function hideElement ( ) {
document . getElementById ( 'removed-crypto-p' ) . style . display = "none" ;
} , 5000 ) ;
}
else {
document . getElementById ( 'cryptoremoved-p' ) . innerHTML = 'No symbol selected.' ;
document . getElementById ( 'removed-crypto-p' ) . style . display = "block" ;
setTimeout ( function hideElement ( ) {
document . getElementById ( 'removed-crypto-p' ) . style . display = "none" ;
} , 5000 ) ;
}
}
2023-07-11 10:47:24 +00:00
// update crypto portfolio position with new values
function updateCryptoPorftolio ( ) {
let update _crypto _cost = document . getElementById ( 'cryptocost' ) . value ;
let update _crypto _shares = document . getElementById ( 'cryptoshares' ) . value ;
let update _crypto _symbol = document . getElementById ( 'inputText4' ) . value ;
let update _crypto _days = document . getElementById ( 'cryptodate' ) . value ;
let update _crypto _settings = {
shares : update _crypto _shares ,
cost : update _crypto _cost ,
symbol : update _crypto _symbol ,
days : update _crypto _days ,
} ;
2023-07-11 14:21:42 +00:00
if ( ( update _crypto _symbol === '' ) || ( update _crypto _symbol === ' ' ) ) {
document . getElementById ( 'cryptoremoved-p' ) . innerHTML = 'No symbol selected.' ;
document . getElementById ( 'removed-crypto-p' ) . style . display = "block" ;
setTimeout ( function hideElement ( ) {
document . getElementById ( 'removed-crypto-p' ) . style . display = "none" ;
} , 5000 ) ;
}
else if ( ( update _crypto _cost === ' ' ) || ( update _crypto _shares === ' ' ) || ( update _crypto _days === ' ' ) ) {
document . getElementById ( 'cryptoremoved-p' ) . innerHTML = 'No spaces.' ;
document . getElementById ( 'removed-crypto-p' ) . style . display = "block" ;
setTimeout ( function hideElement ( ) {
document . getElementById ( 'removed-crypto-p' ) . style . display = "none" ;
} , 5000 ) ;
}
else if ( ( isNaN ( update _crypto _cost ) ) || ( isNaN ( update _crypto _shares ) ) ) {
document . getElementById ( 'cryptoremoved-p' ) . innerHTML = 'No text characters, only numbers.' ;
document . getElementById ( 'removed-crypto-p' ) . style . display = "block" ;
setTimeout ( function hideElement ( ) {
document . getElementById ( 'removed-crypto-p' ) . style . display = "none" ;
} , 5000 ) ;
}
else if ( ( ! update _crypto _days . includes ( '-' ) ) && ( update _crypto _days !== '' ) ) {
document . getElementById ( 'cryptoremoved-p' ) . innerHTML = 'Incorrect date format, it should be YYYY-MM-DD' ;
document . getElementById ( 'removed-crypto-p' ) . style . display = "block" ;
setTimeout ( function hideElement ( ) {
document . getElementById ( 'removed-crypto-p' ) . style . display = "none" ;
} , 5000 ) ;
}
else if ( ( ( update _crypto _shares !== '' ) || ( update _crypto _cost !== '' ) || ( update _crypto _days !== '' ) ) && ( ( update _crypto _shares === '' ) || ( update _crypto _cost === '' ) || ( update _crypto _days === '' ) ) ) {
document . getElementById ( 'cryptoremoved-p' ) . innerHTML = 'Some fields are empty.' ;
document . getElementById ( 'removed-crypto-p' ) . style . display = "block" ;
setTimeout ( function hideElement ( ) {
document . getElementById ( 'removed-crypto-p' ) . style . display = "none" ;
} , 5000 ) ;
}
else {
2023-07-11 10:47:24 +00:00
fetch ( "/savePortfolioCryptoSettings" , {
method : "POST" ,
body : JSON . stringify ( update _crypto _settings ) ,
} ) ;
document . getElementById ( 'updated-crypto-p' ) . style . display = "block" ;
setTimeout ( function hideElement ( ) {
document . getElementById ( 'updated-crypto-p' ) . style . display = "none" ;
} , 5000 ) ;
}
}
2023-07-17 10:18:07 +00:00
// SAVE FEATURES TO DISPLAY PROMPT FUNCTIONS
2023-07-18 07:47:33 +00:00
var savePromptTimeout ;
var isSavePromptRunning = false ;
2023-07-17 10:18:07 +00:00
function displaySavePrompt ( ) {
2023-07-18 07:47:33 +00:00
// Check if the function is already running
if ( isSavePromptRunning ) {
return ;
}
isSavePromptRunning = true ;
2023-07-17 10:18:07 +00:00
document . getElementById ( 'save-prompt-message' ) . style . display = "block" ;
2023-07-18 07:47:33 +00:00
var savePrompt = document . getElementById ( 'save-prompt-p' ) ;
// Store the original color
var originalColor = savePrompt . style . color ;
// Set the new color for the transition effect
savePrompt . style . color = "yellow" ;
// Clear any existing timeout
clearTimeout ( savePromptTimeout ) ;
// Add a delay before reverting back to the original color
savePromptTimeout = setTimeout ( function ( ) {
savePrompt . style . color = originalColor ;
isSavePromptRunning = false ;
} , 300 ) ; // 0.3 seconds
2023-07-17 10:18:07 +00:00
}
function closeSavePrompt ( ) {
document . getElementById ( 'save-prompt-message' ) . style . display = "none" ;
}
function savePrompt ( ) {
saveSettings ( ) ;
document . getElementById ( 'save-prompt-message' ) . style . display = "none" ;
setTimeout (
function ( ) {
document . getElementById ( 'saved-msg-feedback' ) . style . display = "block" ;
2023-07-17 11:10:43 +00:00
fetch ( "/savePromptStartStop" , {
method : "PUT" ,
2023-07-17 10:45:07 +00:00
} ) ;
2023-07-17 10:18:07 +00:00
} , 100 ) ;
setTimeout (
function ( ) {
document . getElementById ( 'saved-msg-feedback' ) . style . display = "none" ;
} , 3000 ) ;
}
2023-07-18 09:46:50 +00:00
// SAVE FEATURE SETTINGS PROMPT FUNCTIONS
var savePromptTimeout2 ;
var isSavePromptRunning2 = false ;
function displaySavePrompt2 ( ) {
// Check if the function is already running
if ( isSavePromptRunning2 ) {
return ;
}
isSavePromptRunning2 = true ;
document . getElementById ( 'save-feature-prompt-message' ) . style . display = "block" ;
var savePrompt2 = document . getElementById ( 'save-feature-prompt-p' ) ;
// Store the original color
var originalColor2 = savePrompt2 . style . color ;
// Set the new color for the transition effect
2023-07-18 09:57:13 +00:00
savePrompt2 . style . color = "yellow" ;
2023-07-18 09:46:50 +00:00
// Clear any existing timeout
clearTimeout ( savePromptTimeout2 ) ;
// Add a delay before reverting back to the original color
savePromptTimeout2 = setTimeout ( function ( ) {
savePrompt2 . style . color = originalColor2 ;
isSavePromptRunning2 = false ;
} , 300 ) ; // 0.3 seconds
}
function closeFeatureSavePrompt ( ) {
document . getElementById ( 'save-feature-prompt-message' ) . style . display = "none" ;
}
function featureSavePrompt ( ) {
2023-07-18 15:28:39 +00:00
saveSettings ( ) ;
2023-07-18 09:46:50 +00:00
document . getElementById ( 'save-feature-prompt-message' ) . style . display = "none" ;
setTimeout (
function ( ) {
document . getElementById ( 'saved-feature-msg-feedback' ) . style . display = "block" ;
} , 100 ) ;
setTimeout (
function ( ) {
document . getElementById ( 'saved-feature-msg-feedback' ) . style . display = "none" ;
} , 3000 ) ;
}
2023-07-17 10:18:07 +00:00
2023-07-18 11:50:57 +00:00
const pageIDs = [ 'Page1' , 'Page2' , 'Page3' , 'Page4' , 'Page5' , 'Page6' , 'Page7' , 'Page8' , 'Page9' , 'Page10' , 'Page11' , 'Page12' , 'Page13' ,
2023-09-23 08:58:09 +00:00
'Page14' , 'Page15' , 'Page16' , 'Page17' , 'Page18' , 'Page19' , 'Page20' , 'Page21' , 'Page22' , 'Page23' , 'Page24' , 'Page25' , 'Page26' ] ;
2023-07-18 11:50:57 +00:00
for ( const pageID of pageIDs ) {
// Select the parent div
const parentDiv = document . getElementById ( pageID ) ;
// Add event listeners to select menus
const excludedIds = [ 'base-select' , 'quote-select' , 'commodities-items' , 'indices-items' , 'inputTransition73' ,
2023-07-19 05:15:06 +00:00
'inputTransition83' , 'inputTransition93' , 'inputTransition103' , 'inputTransition2222' , 'jokes-categories' , 'golf-ranking-number' ,
2023-08-16 08:22:39 +00:00
'inputScrollSpeed16' , 'inputScrollSpeed17' , 'inputScrollSpeed19BG' , 'market-categories' , 'sector-categories' , 'place-categories' ] ;
2023-07-18 11:50:57 +00:00
const selectMenus = parentDiv . querySelectorAll ( 'select' ) ;
selectMenus . forEach ( selectMenu => {
const id = selectMenu . id ;
if ( ! excludedIds . includes ( id ) ) {
selectMenu . addEventListener ( 'change' , function ( event ) {
displaySavePrompt2 ( ) ;
} ) ;
}
} ) ;
2023-08-16 08:22:39 +00:00
// Add event listeners for input text fields specifically for page22 (r/place)
2023-08-29 13:13:19 +00:00
if ( ( pageID === 'Page22' ) || ( pageID === 'Page23' ) || ( pageID === 'Page24' ) || ( pageID === 'Page25' ) ) {
2023-08-16 08:22:39 +00:00
const inputForms = parentDiv . querySelectorAll ( 'input[type="text"]' ) ;
inputForms . forEach ( inputForm => {
inputForm . addEventListener ( 'input' , function ( event ) {
displaySavePrompt2 ( ) ;
} ) ;
} ) ;
}
// Add event listeners for sliders specifically for page22 (r/place)
if ( pageID === 'Page22' ) {
const slider = parentDiv . querySelector ( '#myRange' ) ;
slider . addEventListener ( 'input' , function ( event ) {
displaySavePrompt2 ( ) ;
} ) ;
}
2023-07-18 11:50:57 +00:00
// Add event listeners to input checkboxes
const inputForms = parentDiv . querySelectorAll ( 'input[type="checkbox"]' ) ;
inputForms . forEach ( inputForm => {
inputForm . addEventListener ( 'input' , function ( event ) {
displaySavePrompt2 ( ) ;
} ) ;
} ) ;
}
2023-07-18 16:54:06 +00:00
// for drop down menu, change feature settings prompt text
var selectMenu = document . getElementById ( "drop" ) ;
var pElement = document . getElementById ( "save-feature-prompt-p" ) ;
var pElement2 = document . getElementById ( "saved-feature-msg-feedback" ) ;
// Add an event listener for the "change" event
selectMenu . addEventListener ( "change" , function ( ) {
document . getElementById ( 'save-feature-prompt-message' ) . style . display = "none" ;
var selectedOption = selectMenu . selectedOptions [ 0 ] ;
var selectedValue = selectedOption . textContent ;
pElement . textContent = selectedValue + " Settings - Changes detected." ;
pElement2 . innerHTML = selectedValue + " Settings -" + "<br>" + " Saved!" ;
} ) ;
2023-07-19 09:21:07 +00:00
// load selected network item into ssid input
function sendNetworkToSSID ( element ) {
var networksList = document . getElementById ( 'networks-list' ) ;
var lis = networksList . querySelectorAll ( "li" ) ;
var ssid _input = document . getElementById ( 'wifi-ssid-input' ) ;
var value = element . innerText ;
lis . forEach ( function ( li ) {
li . classList . remove ( "active" ) ;
} ) ;
ssid _input . value = value ;
element . classList . add ( "active" ) ;
}
2023-07-19 11:07:06 +00:00
// scan nearby networks
function scanNetworks ( ) {
var networksListReset = document . getElementById ( "networks-list" ) ;
networksListReset . innerHTML = "" ;
2023-07-24 09:40:17 +00:00
var listItem2 = document . createElement ( "li" ) ;
listItem2 . textContent = "Scanning networks..." ;
2023-07-24 10:02:00 +00:00
networksListReset . appendChild ( listItem2 ) ;
2023-07-19 11:07:06 +00:00
fetch ( "/scanNetworks" , {
method : "PUT" ,
} )
. then ( response => response . text ( ) )
. then ( data => {
// Parse the response data as JSON
var networks = JSON . parse ( data ) ;
2023-07-24 09:40:17 +00:00
networksListReset . innerHTML = "" ;
2023-07-19 11:07:06 +00:00
// Iterate over the networks object and create list items
for ( var ssid in networks ) {
var listItem = document . createElement ( "li" ) ;
listItem . textContent = ssid ;
listItem . onclick = function ( ) {
sendNetworkToSSID ( this ) ;
} ;
networksListReset . appendChild ( listItem ) ;
}
} )
. catch ( error => console . log ( error ) ) ;
}
2023-08-02 13:14:24 +00:00
// UPLOAD CUSTOM STOCK LOGO
function uploadStockLogo ( ) {
const fileInput _stocks = document . getElementById ( "stocks-logo-upload-browse" ) ;
2023-08-02 13:32:00 +00:00
if ( fileInput _stocks . value !== "" ) {
const stock _file = fileInput _stocks . files [ 0 ] ;
const stock _upload _msg = document . getElementById ( "stocklogoupload" ) ;
const formData _stocks = new FormData ( ) ;
formData _stocks . append ( 'file' , stock _file )
fetch ( '/upload_stocks' , {
method : 'POST' ,
body : formData _stocks
} )
stock _upload _msg . style . display = "block" ;
setTimeout ( function hideElement ( ) {
stock _upload _msg . style . display = "none" ;
} , 5000 ) ;
fileInput _stocks . value = "" ;
}
2023-08-02 13:14:24 +00:00
}
// UPLOAD CUSTOM CRYPTO LOGO
function uploadCryptoLogo ( ) {
const fileInput _crypto = document . getElementById ( "crypto-logo-upload-browse" ) ;
2023-08-02 13:32:00 +00:00
if ( fileInput _crypto . value !== "" ) {
const crypto _file = fileInput _crypto . files [ 0 ] ;
const crypto _upload _msg = document . getElementById ( "cryptologoupload" ) ;
const formData _crypto = new FormData ( ) ;
formData _crypto . append ( 'file' , crypto _file ) ;
fetch ( '/upload_crypto' , {
method : 'POST' ,
body : formData _crypto
} ) ;
crypto _upload _msg . style . display = "block" ;
setTimeout ( function hideElement ( ) {
crypto _upload _msg . style . display = "none" ;
} , 5000 ) ;
fileInput _crypto . value = "" ;
}
2023-08-02 13:14:24 +00:00
}
2023-08-16 08:22:39 +00:00
// TO GET SLIDER VALUE FOR IMAGE WIDTH IN R/PLACE
var slider = document . getElementById ( "myRange" ) ;
var output = document . getElementById ( "slider-value" ) ;
output . innerHTML = slider . value ; // Display the default slider value
// Update the current slider value (each time you drag the slider handle)
slider . oninput = function ( ) {
output . innerHTML = this . value ;
}
2023-08-22 13:57:21 +00:00
// save screensaver settings
function saveScreensaverSettings ( ) {
let clock1 _timecolor = document . getElementById ( "clock1-timecolor" ) . value ;
let clock1 _weekdaycolor = document . getElementById ( "clock1-weekdaycolor" ) . value ;
let clock1 _datecolor = document . getElementById ( "clock1-datecolor" ) . value ;
let clock1 _timezone = document . getElementById ( "clock1-timezone" ) . value ;
2023-08-23 13:19:14 +00:00
let clock1 _brightness = document . getElementById ( "clock1-brightness" ) . value ;
2023-08-22 13:57:21 +00:00
let clock1 _displaypm = document . getElementById ( "clock1-displaypm" ) . checked ;
let clock1 _displayseconds = document . getElementById ( "clock1-displayseconds" ) . checked ;
let clock1 _12hour = document . getElementById ( "clock1-12hour" ) . checked ;
let clock2 _timecolor = document . getElementById ( "clock2-timecolor" ) . value ;
let clock2 _datecolor = document . getElementById ( "clock2-datecolor" ) . value ;
let clock2 _timezone = document . getElementById ( "clock2-timezone" ) . value ;
2023-08-23 13:19:14 +00:00
let clock2 _brightness = document . getElementById ( "clock2-brightness" ) . value ;
2023-08-22 13:57:21 +00:00
let clock2 _displaypm = document . getElementById ( "clock2-displaypm" ) . checked ;
let clock2 _12hour = document . getElementById ( "clock2-12hour" ) . checked ;
let worldclock _citycolor = document . getElementById ( "worldclock-citycolor" ) . value ;
2023-08-23 13:19:14 +00:00
let worldclock _brightness = document . getElementById ( "worldclock-brightness" ) . value ;
2023-08-22 13:57:21 +00:00
let worldclock _displaypm = document . getElementById ( "worldclock-displaypm" ) . checked ;
let worldclock _displayseconds = document . getElementById ( "worldclock-displayseconds" ) . checked ;
let worldclock _12hour = document . getElementById ( "worldclock-12hour" ) . checked ;
let settings = {
clock1 _timecolor : clock1 _timecolor ,
clock1 _weekdaycolor : clock1 _weekdaycolor ,
clock1 _datecolor : clock1 _datecolor ,
clock1 _timezone : clock1 _timezone ,
2023-08-23 13:19:14 +00:00
clock1 _brightness : clock1 _brightness ,
2023-08-22 13:57:21 +00:00
clock1 _displaypm : clock1 _displaypm ,
clock1 _displayseconds : clock1 _displayseconds ,
clock1 _12hour : clock1 _12hour ,
clock2 _timecolor : clock2 _timecolor ,
clock2 _datecolor : clock2 _datecolor ,
clock2 _timezone : clock2 _timezone ,
2023-08-23 13:19:14 +00:00
clock2 _brightness : clock2 _brightness ,
2023-08-22 13:57:21 +00:00
clock2 _displaypm : clock2 _displaypm ,
clock2 _12hour : clock2 _12hour ,
worldclock _citycolor : worldclock _citycolor ,
2023-08-23 13:19:14 +00:00
worldclock _brightness : worldclock _brightness ,
2023-08-22 13:57:21 +00:00
worldclock _displaypm : worldclock _displaypm ,
worldclock _displayseconds : worldclock _displayseconds ,
worldclock _12hour : worldclock _12hour ,
} ;
console . log ( settings ) ;
2023-08-22 14:25:08 +00:00
fetch ( "/saveScreensaverSettings" , {
method : "POST" ,
body : JSON . stringify ( settings ) ,
} ) ;
2023-08-22 13:57:21 +00:00
document . getElementById ( 'screensaver-saved' ) . style . display = "block" ;
}