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