indices validation and web panel integration
This commit is contained in:
parent
34690b8433
commit
011a308900
@ -45,6 +45,7 @@ var imagesFeatures = document.querySelectorAll("#images-features li");
|
|||||||
var gifsFeatures = document.querySelectorAll("#gifs-features li");
|
var gifsFeatures = document.querySelectorAll("#gifs-features li");
|
||||||
var messagesFeatures = document.querySelectorAll("#messages-features li");
|
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 allFeaturesList = [
|
var allFeaturesList = [
|
||||||
stocksFeatures,
|
stocksFeatures,
|
||||||
@ -61,6 +62,7 @@ var allFeaturesList = [
|
|||||||
gifsFeatures,
|
gifsFeatures,
|
||||||
messagesFeatures,
|
messagesFeatures,
|
||||||
commoditiesFeatures,
|
commoditiesFeatures,
|
||||||
|
indicesFeatures,
|
||||||
];
|
];
|
||||||
|
|
||||||
// features remove buttons
|
// features remove buttons
|
||||||
@ -84,6 +86,7 @@ var imagesRemoveBtn = document.getElementById("images-remove-btn");
|
|||||||
var gifsRemoveBtn = document.getElementById("gifs-remove-btn");
|
var gifsRemoveBtn = document.getElementById("gifs-remove-btn");
|
||||||
var messagesRemoveBtn = document.getElementById("messages-remove-btn");
|
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 allFeaturesRemoveBtns = [
|
var allFeaturesRemoveBtns = [
|
||||||
stocksRemoveBtn,
|
stocksRemoveBtn,
|
||||||
@ -100,6 +103,7 @@ var allFeaturesRemoveBtns = [
|
|||||||
gifsRemoveBtn,
|
gifsRemoveBtn,
|
||||||
messagesRemoveBtn,
|
messagesRemoveBtn,
|
||||||
commoditiesRemoveBtn,
|
commoditiesRemoveBtn,
|
||||||
|
indicesRemoveBtn,
|
||||||
];
|
];
|
||||||
// features increase buttons
|
// features increase buttons
|
||||||
var stocksincreaseBtn = document.getElementById("stocks-increase-btn");
|
var stocksincreaseBtn = document.getElementById("stocks-increase-btn");
|
||||||
@ -122,6 +126,7 @@ var imagesincreaseBtn = document.getElementById("images-increase-btn");
|
|||||||
var gifsincreaseBtn = document.getElementById("gifs-increase-btn");
|
var gifsincreaseBtn = document.getElementById("gifs-increase-btn");
|
||||||
var messagesincreaseBtn = document.getElementById("messages-increase-btn");
|
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 allFeaturesIncreaseBtns = [
|
var allFeaturesIncreaseBtns = [
|
||||||
stocksincreaseBtn,
|
stocksincreaseBtn,
|
||||||
@ -138,6 +143,7 @@ var allFeaturesIncreaseBtns = [
|
|||||||
gifsincreaseBtn,
|
gifsincreaseBtn,
|
||||||
messagesincreaseBtn,
|
messagesincreaseBtn,
|
||||||
commoditiesincreaseBtn,
|
commoditiesincreaseBtn,
|
||||||
|
indicesincreaseBtn,
|
||||||
];
|
];
|
||||||
|
|
||||||
// features decrease buttons
|
// features decrease buttons
|
||||||
@ -161,6 +167,7 @@ var imagesDecreaseBtn = document.getElementById("images-decrease-btn");
|
|||||||
var gifsDecreaseBtn = document.getElementById("gifs-decrease-btn");
|
var gifsDecreaseBtn = document.getElementById("gifs-decrease-btn");
|
||||||
var messagesDecreaseBtn = document.getElementById("messages-decrease-btn");
|
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 allFeaturesDecreaseBtns = [
|
var allFeaturesDecreaseBtns = [
|
||||||
stocksDecreaseBtn,
|
stocksDecreaseBtn,
|
||||||
@ -177,6 +184,7 @@ var allFeaturesDecreaseBtns = [
|
|||||||
gifsDecreaseBtn,
|
gifsDecreaseBtn,
|
||||||
messagesDecreaseBtn,
|
messagesDecreaseBtn,
|
||||||
commoditiesDecreaseBtn,
|
commoditiesDecreaseBtn,
|
||||||
|
indicesDecreaseBtn,
|
||||||
];
|
];
|
||||||
|
|
||||||
const changeVarValue = () => {
|
const changeVarValue = () => {
|
||||||
@ -200,6 +208,7 @@ const changeVarValue = () => {
|
|||||||
gifsFeatures = document.querySelectorAll("#gifs-features li");
|
gifsFeatures = document.querySelectorAll("#gifs-features li");
|
||||||
messagesFeatures = document.querySelectorAll("#messages-features li");
|
messagesFeatures = document.querySelectorAll("#messages-features li");
|
||||||
commoditiesFeatures = document.querySelectorAll("#commodities-features li");
|
commoditiesFeatures = document.querySelectorAll("#commodities-features li");
|
||||||
|
indicesFeatures = document.querySelectorAll("#indices-features li");
|
||||||
|
|
||||||
allFeaturesList = [
|
allFeaturesList = [
|
||||||
stocksFeatures,
|
stocksFeatures,
|
||||||
@ -216,6 +225,7 @@ const changeVarValue = () => {
|
|||||||
gifsFeatures,
|
gifsFeatures,
|
||||||
messagesFeatures,
|
messagesFeatures,
|
||||||
commoditiesFeatures,
|
commoditiesFeatures,
|
||||||
|
indicesFeatures,
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -585,6 +595,7 @@ var images = document.getElementById("images-features");
|
|||||||
var gifs = document.getElementById("gifs-features");
|
var gifs = document.getElementById("gifs-features");
|
||||||
var messages = document.getElementById("messages-features");
|
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 allFeatures = [
|
var allFeatures = [
|
||||||
stocks,
|
stocks,
|
||||||
@ -601,6 +612,7 @@ var allFeatures = [
|
|||||||
gifs,
|
gifs,
|
||||||
messages,
|
messages,
|
||||||
commodities,
|
commodities,
|
||||||
|
indices,
|
||||||
];
|
];
|
||||||
|
|
||||||
// features select box
|
// features select box
|
||||||
@ -624,6 +636,7 @@ var allFeaturesSelectBox = [
|
|||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
|
null,
|
||||||
];
|
];
|
||||||
|
|
||||||
// features select add buttons
|
// features select add buttons
|
||||||
@ -647,6 +660,7 @@ var allFeaturesSelectAddBtn = [
|
|||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
|
null,
|
||||||
];
|
];
|
||||||
|
|
||||||
allFeaturesSelectAddBtn.map((value, index) => {
|
allFeaturesSelectAddBtn.map((value, index) => {
|
||||||
@ -680,6 +694,7 @@ var allFeaturesFile = [
|
|||||||
gifsFile,
|
gifsFile,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
|
null,
|
||||||
];
|
];
|
||||||
// features file add button
|
// features file add button
|
||||||
var imagesFileAddBtn = document.getElementById("inputTextBtn11");
|
var imagesFileAddBtn = document.getElementById("inputTextBtn11");
|
||||||
@ -700,6 +715,7 @@ var allFeaturesFileAddBtn = [
|
|||||||
gifsFileAddBtn,
|
gifsFileAddBtn,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
|
null,
|
||||||
];
|
];
|
||||||
|
|
||||||
// features input text
|
// features input text
|
||||||
@ -710,6 +726,7 @@ var currentWeatherText = document.getElementById("inputText6");
|
|||||||
var dailyForecastText = document.getElementById("inputText7");
|
var dailyForecastText = document.getElementById("inputText7");
|
||||||
var messagesText = document.getElementById("inputText13");
|
var messagesText = document.getElementById("inputText13");
|
||||||
var commoditiesText = document.getElementById("inputText20");
|
var commoditiesText = document.getElementById("inputText20");
|
||||||
|
var indicesText = document.getElementById("inputText21");
|
||||||
|
|
||||||
var allFeaturesText = [
|
var allFeaturesText = [
|
||||||
stocksText,
|
stocksText,
|
||||||
@ -726,6 +743,7 @@ var allFeaturesText = [
|
|||||||
null,
|
null,
|
||||||
messagesText,
|
messagesText,
|
||||||
commoditiesText,
|
commoditiesText,
|
||||||
|
indicesText,
|
||||||
];
|
];
|
||||||
|
|
||||||
// features text add button
|
// features text add button
|
||||||
@ -736,6 +754,7 @@ var currentWeatherTextAddBtn = document.getElementById("inputTextBtn6");
|
|||||||
var dailyForecastTextAddBtn = document.getElementById("inputTextBtn7");
|
var dailyForecastTextAddBtn = document.getElementById("inputTextBtn7");
|
||||||
var messagesTextAddBtn = document.getElementById("inputTextBtn13");
|
var messagesTextAddBtn = document.getElementById("inputTextBtn13");
|
||||||
var commoditiesTextAddBtn = document.getElementById("inputTextBtn20");
|
var commoditiesTextAddBtn = document.getElementById("inputTextBtn20");
|
||||||
|
var indicesTextAddBtn = document.getElementById("inputTextBtn21");
|
||||||
|
|
||||||
var allFeaturesTextAddBtn = [
|
var allFeaturesTextAddBtn = [
|
||||||
stocksTextAddBtn,
|
stocksTextAddBtn,
|
||||||
@ -752,6 +771,7 @@ var allFeaturesTextAddBtn = [
|
|||||||
null,
|
null,
|
||||||
messagesTextAddBtn,
|
messagesTextAddBtn,
|
||||||
commoditiesTextAddBtn,
|
commoditiesTextAddBtn,
|
||||||
|
indicesTextAddBtn,
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
@ -770,6 +790,7 @@ var allFeaturesLimit = [
|
|||||||
20,
|
20,
|
||||||
20,
|
20,
|
||||||
30,
|
30,
|
||||||
|
40,
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
@ -1025,6 +1046,7 @@ function getFeatureSettings() {
|
|||||||
"Custom GIFs",
|
"Custom GIFs",
|
||||||
"Custom Messages",
|
"Custom Messages",
|
||||||
"Commodities",
|
"Commodities",
|
||||||
|
"Indices",
|
||||||
];
|
];
|
||||||
let pageNum = features.indexOf(feature) + 1;
|
let pageNum = features.indexOf(feature) + 1;
|
||||||
let pageSelector = "Page" + pageNum.toString();
|
let pageSelector = "Page" + pageNum.toString();
|
||||||
@ -1078,6 +1100,9 @@ function getFeatureSettings() {
|
|||||||
case 14:
|
case 14:
|
||||||
s = getTradingSettings(page);
|
s = getTradingSettings(page);
|
||||||
break;
|
break;
|
||||||
|
case 15:
|
||||||
|
s = getTradingSettings(page);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
settings = { ...settings, ...s }; // merge both sets of settings
|
settings = { ...settings, ...s }; // merge both sets of settings
|
||||||
@ -1200,6 +1225,7 @@ function saveWeatherAPIKey(){
|
|||||||
"Custom GIFs",
|
"Custom GIFs",
|
||||||
"Custom Messages",
|
"Custom Messages",
|
||||||
"Commodities",
|
"Commodities",
|
||||||
|
"Indices",
|
||||||
];
|
];
|
||||||
let pageNum = features.indexOf(feature) + 1;
|
let pageNum = features.indexOf(feature) + 1;
|
||||||
let pageSelector = "Page" + pageNum.toString();
|
let pageSelector = "Page" + pageNum.toString();
|
||||||
@ -1553,7 +1579,7 @@ inputAnimationBtn.addEventListener("click", () => {
|
|||||||
// scroll speed row two
|
// scroll speed row two
|
||||||
let inputScrollSpeedRow = [];
|
let inputScrollSpeedRow = [];
|
||||||
|
|
||||||
for (let i = 1; i <= 14; i++) {
|
for (let i = 1; i <= 15; i++) {
|
||||||
inputScrollSpeedRow.push(
|
inputScrollSpeedRow.push(
|
||||||
document.getElementById(
|
document.getElementById(
|
||||||
i === 1 ? "inputScrollSpeedRow" : `inputScrollSpeedRow${i}`
|
i === 1 ? "inputScrollSpeedRow" : `inputScrollSpeedRow${i}`
|
||||||
@ -2130,3 +2156,60 @@ var specialChars = /[`!@#$%^&*()_+\-=\[\]{};':"\\|<>\/?~]/;
|
|||||||
}
|
}
|
||||||
document.getElementById("demo8").innerHTML = text;
|
document.getElementById("demo8").innerHTML = text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Indices validation
|
||||||
|
|
||||||
|
function indicesValidate() {
|
||||||
|
|
||||||
|
var specialChars = /[`!@#$%&*()_+\-=\[\]{};':"\\|<>\/?~]/;
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
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 (!["^DJI","^GSPC","^NDX","^RUT","^VIX","^GSPTSE","^MXX","^BVSP","^GDAXI","^FTSE","^IBEX","^FCHI","^SSMI","^BFX","^ATX","^AEX","^OMX",
|
||||||
|
"^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;
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user