ipo calendar

This commit is contained in:
Justin 2023-03-08 14:41:44 +08:00 committed by GitHub
parent 00098b6f9d
commit 68ad7bef41
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -47,6 +47,7 @@ var messagesFeatures = document.querySelectorAll("#messages-features li");
var commoditiesFeatures = document.querySelectorAll("#commodities-features li");
var indicesFeatures = document.querySelectorAll("#indices-features li");
var moviesFeatures = document.querySelectorAll("#movies-features li");
var ipoFeatures = document.querySelectorAll("#ipo-features li");
var allFeaturesList = [
stocksFeatures,
@ -65,6 +66,7 @@ var allFeaturesList = [
commoditiesFeatures,
indicesFeatures,
moviesFeatures,
ipoFeatures,
];
// features remove buttons
@ -90,6 +92,7 @@ var messagesRemoveBtn = document.getElementById("messages-remove-btn");
var commoditiesRemoveBtn = document.getElementById("commodities-remove-btn");
var indicesRemoveBtn = document.getElementById("indices-remove-btn");
var moviesRemoveBtn = document.getElementById("movies-remove-btn");
var ipoRemoveBtn = document.getElementById("ipo-remove-btn");
var allFeaturesRemoveBtns = [
stocksRemoveBtn,
@ -108,6 +111,7 @@ var allFeaturesRemoveBtns = [
commoditiesRemoveBtn,
indicesRemoveBtn,
moviesRemoveBtn,
ipoRemoveBtn,
];
// features increase buttons
var stocksincreaseBtn = document.getElementById("stocks-increase-btn");
@ -132,6 +136,7 @@ var messagesincreaseBtn = document.getElementById("messages-increase-btn");
var commoditiesincreaseBtn = document.getElementById("commodities-increase-btn");
var indicesincreaseBtn = document.getElementById("indices-increase-btn");
var moviesincreaseBtn = document.getElementById("movies-increase-btn");
var ipoincreaseBtn = document.getElementById("ipo-increase-btn");
var allFeaturesIncreaseBtns = [
stocksincreaseBtn,
@ -150,6 +155,7 @@ var allFeaturesIncreaseBtns = [
commoditiesincreaseBtn,
indicesincreaseBtn,
moviesincreaseBtn,
ipoincreaseBtn,
];
// features decrease buttons
@ -175,6 +181,7 @@ var messagesDecreaseBtn = document.getElementById("messages-decrease-btn");
var commoditiesDecreaseBtn = document.getElementById("commodities-decrease-btn");
var indicesDecreaseBtn = document.getElementById("indices-decrease-btn");
var moviesDecreaseBtn = document.getElementById("movies-decrease-btn");
var ipoDecreaseBtn = document.getElementById("ipo-decrease-btn");
var allFeaturesDecreaseBtns = [
stocksDecreaseBtn,
@ -193,6 +200,7 @@ var allFeaturesDecreaseBtns = [
commoditiesDecreaseBtn,
indicesDecreaseBtn,
moviesDecreaseBtn,
ipoDecreaseBtn,
];
const changeVarValue = () => {
@ -218,7 +226,8 @@ const changeVarValue = () => {
commoditiesFeatures = document.querySelectorAll("#commodities-features li");
indicesFeatures = document.querySelectorAll("#indices-features li");
moviesFeatures = document.querySelectorAll("#movies-features li");
ipoFeatures = document.querySelectorAll("#ipo-features li");
allFeaturesList = [
stocksFeatures,
cryptoFeatures,
@ -236,6 +245,7 @@ const changeVarValue = () => {
commoditiesFeatures,
indicesFeatures,
moviesFeatures,
ipoFeatures,
];
};
@ -607,6 +617,7 @@ var messages = document.getElementById("messages-features");
var commodities = document.getElementById("commodities-features");
var indices = document.getElementById("indices-features");
var movies = document.getElementById("movies-features");
var ipos = document.getElementById("ipo-features");
var allFeatures = [
stocks,
@ -625,6 +636,7 @@ var allFeatures = [
commodities,
indices,
movies,
ipos,
];
// features select box
@ -651,6 +663,7 @@ var allFeaturesSelectBox = [
null,
null,
moviesSelect,
null,
];
// features select add buttons
@ -676,6 +689,7 @@ var allFeaturesSelectAddBtn = [
null,
null,
null,
null,
];
allFeaturesSelectAddBtn.map((value, index) => {
@ -711,6 +725,7 @@ var allFeaturesFile = [
null,
null,
null,
null,
];
// features file add button
var imagesFileAddBtn = document.getElementById("inputTextBtn11");
@ -733,6 +748,7 @@ var allFeaturesFileAddBtn = [
null,
null,
null,
null,
];
// features input text
@ -762,6 +778,7 @@ var allFeaturesText = [
commoditiesText,
indicesText,
null,
null,
];
// features text add button
@ -791,6 +808,7 @@ var allFeaturesTextAddBtn = [
commoditiesTextAddBtn,
indicesTextAddBtn,
null,
null,
];
@ -811,6 +829,7 @@ var allFeaturesLimit = [
30,
40,
null,
null,
];
@ -1071,6 +1090,7 @@ function getFeatureSettings() {
"Commodities",
"Indices",
"Movies",
"IPO Calendar",
];
let pageNum = features.indexOf(feature) + 1;
let pageSelector = "Page" + pageNum.toString();
@ -1130,6 +1150,9 @@ function getFeatureSettings() {
case 16:
s = getMovieSettings(page);
break;
case 17:
s = getIpoSettings(page);
break;
}
settings = { ...settings, ...s }; // merge both sets of settings
@ -1254,6 +1277,7 @@ function saveWeatherAPIKey(){
"Commodities",
"Indices",
"Movies",
"IPO Calendar",
];
let pageNum = features.indexOf(feature) + 1;
let pageSelector = "Page" + pageNum.toString();
@ -1294,6 +1318,7 @@ function saveMovieAPIKey(){
"Commodities",
"Indices",
"Movies",
"IPO Calendar",
];
let pageNum = features.indexOf(feature) + 1;
let pageSelector = "Page" + pageNum.toString();
@ -1314,6 +1339,49 @@ function saveMovieAPIKey(){
}
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",
];
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);
var movieAPIbtn = document.getElementById("movie-api-btn");
movieAPIbtn.addEventListener("click", saveMovieAPIKey);
@ -1358,6 +1426,18 @@ function getMovieSettings(page) {
return settings;
}
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;
}
function getSportsSettings(page) {
let title = page.querySelectorAll(".title-select")[0].checked;
let leagues_el = page.querySelectorAll(".league-list")[0];
@ -1661,7 +1741,7 @@ inputAnimationBtn.addEventListener("click", () => {
// scroll speed row two
let inputScrollSpeedRow = [];
for (let i = 1; i <= 16; i++) {
for (let i = 1; i <= 17; i++) {
inputScrollSpeedRow.push(
document.getElementById(
i === 1 ? "inputScrollSpeedRow" : `inputScrollSpeedRow${i}`
@ -1818,6 +1898,25 @@ function showMovieP() {
}
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"
}
}
// Disable adding cities when no API key detected