commodities and indices dropdown menus

This commit is contained in:
Justin 2023-06-12 15:39:30 +08:00 committed by GitHub
parent d91866ac5f
commit 5296819e48
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -750,8 +750,8 @@ var forexText = document.getElementById("base-select").value + ',' + document.ge
var currentWeatherText = document.getElementById("inputText6");
var dailyForecastText = document.getElementById("inputText7");
var messagesText = document.getElementById("inputText13");
var commoditiesText = document.getElementById("inputText20");
var indicesText = document.getElementById("inputText21");
var indicesText = document.getElementById("indices-items");
var commoditiesText = document.getElementById("commodities-items");
var allFeaturesText = [
stocksText,
@ -2465,115 +2465,116 @@ function dailyWeatherValidate() {
// Commodities validation
function commoditiesValidate() {
createLi = true;
}
// var specialChars = /[`!@#$%^&*()_+\-=\[\]{};':"\\|<>\/?~]/;
var specialChars = /[`!@#$%^&*()_+\-=\[\]{};':"\\|<>\/?~]/;
// let x = document.getElementById("inputText20").value;
let x = document.getElementById("inputText20").value;
// 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;
// }
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;
}
// else if (x.includes(' ')) {
// text = "No spaces";
// document.getElementById('demo8').style.display = "block";
// document.getElementById("inputText20").value = '';
// // createLi = false;
// }
else if (x.includes(' ')) {
text = "No spaces";
document.getElementById('demo8').style.display = "block";
document.getElementById("inputText20").value = '';
// createLi = false;
}
// else if (specialChars.test(x)) {
// document.getElementById('demo8').style.display = "block";
// text = "No special characters allowed";
// document.getElementById("inputText20").value = '';
// // createLi = false;
// }
else if (specialChars.test(x)) {
document.getElementById('demo8').style.display = "block";
text = "No special characters allowed";
document.getElementById("inputText20").value = '';
// createLi = false;
}
// 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"
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"
// }
}
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;
}
// 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;
// }
// Indices validation
function indicesValidate() {
createLi = true
};
// var specialChars = /[`!@#$%&*()_+\-=\[\]{};':"\\|<>\/?~]/;
var specialChars = /[`!@#$%&*()_+\-=\[\]{};':"\\|<>\/?~]/;
// let x = document.getElementById("inputText21").value;
let x = document.getElementById("inputText21").value;
// 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;
// }
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;
}
// else if (x.includes(' ')) {
// text = "No spaces";
// document.getElementById('demo9').style.display = "block";
// document.getElementById("inputText21").value = '';
// // createLi = false;
// }
else if (x.includes(' ')) {
text = "No spaces";
document.getElementById('demo9').style.display = "block";
document.getElementById("inputText21").value = '';
// createLi = false;
}
// else if (specialChars.test(x)) {
// document.getElementById('demo9').style.display = "block";
// text = "No special characters allowed";
// document.getElementById("inputText21").value = '';
// // createLi = false;
// }
else if (specialChars.test(x)) {
document.getElementById('demo9').style.display = "block";
text = "No special characters allowed";
document.getElementById("inputText21").value = '';
// createLi = false;
}
// 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"
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"
}
// }
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;
}
// 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;
// }
// portoflio stuff