basic global stocks implemented

This commit is contained in:
Justin 2023-09-25 17:53:45 +08:00 committed by GitHub
parent 2f51fd206e
commit 9bee6a7416
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -57,6 +57,7 @@ var clock1Features = document.querySelectorAll("#clock1-features li");
var clock2Features = document.querySelectorAll("#clock2-features li"); var clock2Features = document.querySelectorAll("#clock2-features li");
var worldclockFeatures = document.querySelectorAll("#worldclock-features li"); var worldclockFeatures = document.querySelectorAll("#worldclock-features li");
var quotesFeatures = document.querySelectorAll("#quotes-list li"); var quotesFeatures = document.querySelectorAll("#quotes-list li");
var globalstocksFeatures = document.querySelectorAll("#globalstocks-features li");
var allFeaturesList = [ var allFeaturesList = [
stocksFeatures, stocksFeatures,
@ -85,6 +86,7 @@ var allFeaturesList = [
clock2Features, clock2Features,
worldclockFeatures, worldclockFeatures,
quotesFeatures, quotesFeatures,
globalstocksFeatures,
]; ];
// features remove buttons // features remove buttons
@ -120,6 +122,7 @@ var clock1RemoveBtn = document.getElementById("clock1-remove-btn");
var clock2RemoveBtn = document.getElementById("clock2-remove-btn"); var clock2RemoveBtn = document.getElementById("clock2-remove-btn");
var worldclockRemoveBtn = document.getElementById("worldclock-remove-btn"); var worldclockRemoveBtn = document.getElementById("worldclock-remove-btn");
var quotesRemoveBtn = document.getElementById("quotes-remove-btn"); var quotesRemoveBtn = document.getElementById("quotes-remove-btn");
var globalstocksRemoveBtn = document.getElementById("globalstocks-remove-btn");
var allFeaturesRemoveBtns = [ var allFeaturesRemoveBtns = [
stocksRemoveBtn, stocksRemoveBtn,
@ -148,6 +151,7 @@ var allFeaturesRemoveBtns = [
clock2RemoveBtn, clock2RemoveBtn,
worldclockRemoveBtn, worldclockRemoveBtn,
quotesRemoveBtn, quotesRemoveBtn,
globalstocksRemoveBtn,
]; ];
// features increase buttons // features increase buttons
var stocksincreaseBtn = document.getElementById("stocks-increase-btn"); var stocksincreaseBtn = document.getElementById("stocks-increase-btn");
@ -182,6 +186,7 @@ var clock1increaseBtn = document.getElementById("clock1-increase-btn");
var clock2increaseBtn = document.getElementById("clock2-increase-btn"); var clock2increaseBtn = document.getElementById("clock2-increase-btn");
var worldclockincreaseBtn = document.getElementById("worldclock-increase-btn"); var worldclockincreaseBtn = document.getElementById("worldclock-increase-btn");
var quotesincreaseBtn = document.getElementById("quotes-increase-btn"); var quotesincreaseBtn = document.getElementById("quotes-increase-btn");
var globalstocksincreaseBtn = document.getElementById("globalstocks-increase-btn");
var allFeaturesIncreaseBtns = [ var allFeaturesIncreaseBtns = [
stocksincreaseBtn, stocksincreaseBtn,
@ -210,6 +215,7 @@ var allFeaturesIncreaseBtns = [
clock2increaseBtn, clock2increaseBtn,
worldclockincreaseBtn, worldclockincreaseBtn,
quotesincreaseBtn, quotesincreaseBtn,
globalstocksincreaseBtn,
]; ];
// features decrease buttons // features decrease buttons
@ -245,6 +251,7 @@ var clock1DecreaseBtn = document.getElementById("clock1-decrease-btn");
var clock2DecreaseBtn = document.getElementById("clock2-decrease-btn"); var clock2DecreaseBtn = document.getElementById("clock2-decrease-btn");
var worldclockDecreaseBtn = document.getElementById("worldclock-decrease-btn"); var worldclockDecreaseBtn = document.getElementById("worldclock-decrease-btn");
var quotesDecreaseBtn = document.getElementById("quotes-decrease-btn"); var quotesDecreaseBtn = document.getElementById("quotes-decrease-btn");
var globalstocksDecreaseBtn = document.getElementById("globalstocks-decrease-btn");
var allFeaturesDecreaseBtns = [ var allFeaturesDecreaseBtns = [
stocksDecreaseBtn, stocksDecreaseBtn,
@ -273,6 +280,7 @@ var allFeaturesDecreaseBtns = [
clock2DecreaseBtn, clock2DecreaseBtn,
worldclockDecreaseBtn, worldclockDecreaseBtn,
quotesDecreaseBtn, quotesDecreaseBtn,
globalstocksDecreaseBtn,
]; ];
const changeVarValue = () => { const changeVarValue = () => {
@ -308,7 +316,8 @@ const changeVarValue = () => {
clock2Features = document.querySelectorAll("#clock2-features li"); clock2Features = document.querySelectorAll("#clock2-features li");
worldclockFeatures = document.querySelectorAll("#worldclock-features li"); worldclockFeatures = document.querySelectorAll("#worldclock-features li");
quotesFeatures = document.querySelectorAll("#quotes-list li"); quotesFeatures = document.querySelectorAll("#quotes-list li");
globalstocksFeatures = document.querySelectorAll("#globalstocks-features li");
allFeaturesList = [ allFeaturesList = [
stocksFeatures, stocksFeatures,
cryptoFeatures, cryptoFeatures,
@ -336,6 +345,7 @@ const changeVarValue = () => {
clock2Features, clock2Features,
worldclockFeatures, worldclockFeatures,
quotesFeatures, quotesFeatures,
globalstocksFeatures,
]; ];
}; };
@ -722,6 +732,7 @@ var clock1 = document.getElementById("clock1-features");
var clock2 = document.getElementById("clock2-features"); var clock2 = document.getElementById("clock2-features");
var worldclock = document.getElementById("worldclock-features"); var worldclock = document.getElementById("worldclock-features");
var quotes = document.getElementById("quotes-list"); var quotes = document.getElementById("quotes-list");
var globalstocks = document.getElementById("globalstocks-features");
var allFeatures = [ var allFeatures = [
stocks, stocks,
@ -750,6 +761,7 @@ var allFeatures = [
clock2, clock2,
worldclock, worldclock,
quotes, quotes,
globalstocks,
]; ];
// features select box // features select box
@ -791,6 +803,7 @@ var allFeaturesSelectBox = [
null, null,
null, null,
null, null,
null,
]; ];
// features select add buttons // features select add buttons
@ -832,6 +845,7 @@ var allFeaturesSelectAddBtn = [
null, null,
null, null,
null, null,
null,
]; ];
allFeaturesSelectAddBtn.map((value, index) => { allFeaturesSelectAddBtn.map((value, index) => {
@ -878,6 +892,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");
@ -910,6 +925,7 @@ var allFeaturesFileAddBtn = [
null, null,
null, null,
null, null,
null,
]; ];
// features input text // features input text
@ -921,6 +937,7 @@ var dailyForecastText = document.getElementById("inputText7");
var messagesText = document.getElementById("inputText13"); var messagesText = document.getElementById("inputText13");
var indicesText = document.getElementById("indices-items"); var indicesText = document.getElementById("indices-items");
var commoditiesText = document.getElementById("commodities-items"); var commoditiesText = document.getElementById("commodities-items");
var globalstocksText = document.getElementById("globalstocks_symbol");
var allFeaturesText = [ var allFeaturesText = [
stocksText, stocksText,
@ -949,6 +966,7 @@ var allFeaturesText = [
null, null,
null, null,
null, null,
globalstocksText,
]; ];
// features text add button // features text add button
@ -960,6 +978,7 @@ 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 indicesTextAddBtn = document.getElementById("inputTextBtn21");
var globalstocksTextAddBtn = document.getElementById("globalstocks_symbol_addbtn");
var allFeaturesTextAddBtn = [ var allFeaturesTextAddBtn = [
stocksTextAddBtn, stocksTextAddBtn,
@ -988,6 +1007,7 @@ var allFeaturesTextAddBtn = [
null, null,
null, null,
null, null,
globalstocksTextAddBtn,
]; ];
@ -1018,6 +1038,7 @@ var allFeaturesLimit = [
null, null,
null, null,
null, null,
null,
]; ];
@ -1299,6 +1320,7 @@ function getFeatureSettings() {
"Clock 2", "Clock 2",
"World Clock", "World Clock",
"Inspirational Quotes", "Inspirational Quotes",
"Global Stocks",
]; ];
let pageNum = features.indexOf(feature) + 1; let pageNum = features.indexOf(feature) + 1;
let pageSelector = "Page" + pageNum.toString(); let pageSelector = "Page" + pageNum.toString();
@ -1388,6 +1410,9 @@ function getFeatureSettings() {
case 26: case 26:
s = getQuotesSettings(page); s = getQuotesSettings(page);
break; break;
case 27:
s = getGlobalStocksSettings(page);
break;
} }
settings = { ...settings, ...s }; // merge both sets of settings settings = { ...settings, ...s }; // merge both sets of settings
@ -1596,6 +1621,7 @@ function saveMovieAPIKey(){
"Clock 2", "Clock 2",
"World Clock", "World Clock",
"Inspirational Quotes", "Inspirational Quotes",
"Global Stocks",
]; ];
let pageNum = features.indexOf(feature) + 1; let pageNum = features.indexOf(feature) + 1;
let pageSelector = "Page" + pageNum.toString(); let pageSelector = "Page" + pageNum.toString();
@ -1646,6 +1672,7 @@ function saveIpoAPIKey(){
"Clock 2", "Clock 2",
"World Clock", "World Clock",
"Inspirational Quotes", "Inspirational Quotes",
"Global Stocks",
]; ];
let pageNum = features.indexOf(feature) + 1; let pageNum = features.indexOf(feature) + 1;
let pageSelector = "Page" + pageNum.toString(); let pageSelector = "Page" + pageNum.toString();
@ -2192,7 +2219,7 @@ inputAnimationBtn.addEventListener("click", () => {
// scroll speed row two // scroll speed row two
let inputScrollSpeedRow = []; let inputScrollSpeedRow = [];
for (let i = 1; i <= 26; i++) { for (let i = 1; i <= 27; i++) {
inputScrollSpeedRow.push( inputScrollSpeedRow.push(
document.getElementById( document.getElementById(
i === 1 ? "inputScrollSpeedRow" : `inputScrollSpeedRow${i}` i === 1 ? "inputScrollSpeedRow" : `inputScrollSpeedRow${i}`
@ -3607,7 +3634,7 @@ function featureSavePrompt() {
const pageIDs = ['Page1', 'Page2', 'Page3', 'Page4', 'Page5', 'Page6', 'Page7', 'Page8', 'Page9', 'Page10', 'Page11', 'Page12', 'Page13', const pageIDs = ['Page1', 'Page2', 'Page3', 'Page4', 'Page5', 'Page6', 'Page7', 'Page8', 'Page9', 'Page10', 'Page11', 'Page12', 'Page13',
'Page14', 'Page15', 'Page16', 'Page17', 'Page18', 'Page19', 'Page20', 'Page21', 'Page22', 'Page23', 'Page24', 'Page25', 'Page26']; 'Page14', 'Page15', 'Page16', 'Page17', 'Page18', 'Page19', 'Page20', 'Page21', 'Page22', 'Page23', 'Page24', 'Page25', 'Page26', 'Page27'];
for (const pageID of pageIDs) { for (const pageID of pageIDs) {
// Select the parent div // Select the parent div