delete weather api keys

This commit is contained in:
Justin 2023-05-23 16:36:24 +08:00 committed by GitHub
parent 418336d7bf
commit 508456ff19
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1252,14 +1252,12 @@ function getWeatherSettings(page) {
let speed = getSelected(page.querySelectorAll(".wind-speed-select")[0]);
let title = page.querySelectorAll(".title-select")[0].checked;
let api_key = page.querySelectorAll(".api-key")[0];
let
settings = {
temp: temp,
wind_speed: speed,
title: title,
api_key:api_key
};
//only for daily weather
@ -1276,45 +1274,45 @@ function getWeatherSettings(page) {
return settings;
}
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();
// 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);
// let page = document.getElementById(pageSelector);
let api_key = page.querySelectorAll(".api-key")[0].value;
let settings = {
api_key:api_key
};
// let api_key = page.querySelectorAll(".api-key")[0].value;
// let settings = {
// api_key:api_key
// };
console.log(settings);
// console.log(settings);
fetch("/saveWeatherAPIKey", {
method: "POST",
body: JSON.stringify(settings),
});
}
// fetch("/saveWeatherAPIKey", {
// method: "POST",
// body: JSON.stringify(settings),
// });
// }
function saveMovieAPIKey(){
@ -1404,8 +1402,8 @@ ipoAPIbtn.addEventListener("click", saveIpoAPIKey);
var movieAPIbtn = document.getElementById("movie-api-btn");
movieAPIbtn.addEventListener("click", saveMovieAPIKey);
var weatherAPIbtn = document.getElementById("weather-api-btn");
weatherAPIbtn.addEventListener("click", saveWeatherAPIKey);
// var weatherAPIbtn = document.getElementById("weather-api-btn");
// weatherAPIbtn.addEventListener("click", saveWeatherAPIKey);
function getNewsSettings(page) {
@ -1879,22 +1877,22 @@ function showDivTwo() {
// Display message asking for restart of ticker when new API key added for weather
function showWeatherP() {
if(document.getElementById("api-key1").value==="") {
// function showWeatherP() {
// if(document.getElementById("api-key1").value==="") {
document.getElementById('weather-api-p').style.display = "none";
}
// document.getElementById('weather-api-p').style.display = "none";
// }
else if (document.getElementById("api-key1").value==="Weather API Key") {
document.getElementById('weather-api-p').style.display = "none";
// else if (document.getElementById("api-key1").value==="Weather API Key") {
// document.getElementById('weather-api-p').style.display = "none";
}
// }
else {
document.getElementById('weather-api-p').style.display = "block"
}
// else {
// document.getElementById('weather-api-p').style.display = "block"
// }
}
// }
// Display message asking for restart of ticker when new API key added for movie
@ -1939,32 +1937,32 @@ function showIpoP() {
// Disable adding cities when no API key detected
if(document.getElementById("api-key1").value==="") {
document.getElementById('inputTextBtn6').disabled = true;
}
// if(document.getElementById("api-key1").value==="") {
// document.getElementById('inputTextBtn6').disabled = true;
// }
else if (document.getElementById("api-key1").value==="Weather API Key") {
document.getElementById('inputTextBtn6').disabled = true;
}
// else if (document.getElementById("api-key1").value==="Weather API Key") {
// document.getElementById('inputTextBtn6').disabled = true;
// }
else {
document.getElementById('inputTextBtn6').disabled = false;
}
// else {
// document.getElementById('inputTextBtn6').disabled = false;
// }
if(document.getElementById("api-key").value==="") {
document.getElementById('inputTextBtn7').disabled = true;
}
// if(document.getElementById("api-key").value==="") {
// document.getElementById('inputTextBtn7').disabled = true;
// }
else if (document.getElementById("api-key").value==="Weather API Key") {
document.getElementById('inputTextBtn7').disabled = true;
}
// else if (document.getElementById("api-key").value==="Weather API Key") {
// document.getElementById('inputTextBtn7').disabled = true;
// }
else {
document.getElementById('inputTextBtn7').disabled = false;
}
// else {
// document.getElementById('inputTextBtn7').disabled = false;
// }
// Stocks validation