new frontend basic functionality working
This commit is contained in:
@@ -560,10 +560,10 @@ allFeaturesTextAddBtn.map((value, index) => {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
var startButton = document.getElementById("start-btn");
|
||||
|
||||
// start the display
|
||||
|
||||
startButton.addEventListener("click", () => {
|
||||
var HTML = document.getElementById('display-format').innerHTML;
|
||||
console.log('pressed');
|
||||
@@ -577,3 +577,70 @@ startButton.addEventListener("click", () => {
|
||||
body:JSON.stringify(HTML)
|
||||
});
|
||||
});
|
||||
|
||||
var shutdownButton = document.getElementById("shutdown-btn");
|
||||
|
||||
shutdownButton.addEventListener("click", () => {
|
||||
fetch("/shutdown", {
|
||||
method:"GET",
|
||||
});
|
||||
});
|
||||
|
||||
var stopButton = document.getElementById("stop-btn");
|
||||
stopButton.addEventListener("click", () => {
|
||||
fetch("/stop", {
|
||||
method:"GET",
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
var dispFormatButton = document.getElementById("dispformat-btn");
|
||||
|
||||
var displayFormats = document.getElementById("inputDisplayFormat");
|
||||
|
||||
|
||||
function getSelected(selector) {
|
||||
var opt;
|
||||
for ( var i = 0, len = selector.options.length; i < len; i++ ) {
|
||||
opt = selector.options[i];
|
||||
if ( opt.selected === true ) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return opt.innerHTML;
|
||||
}
|
||||
// start the display
|
||||
dispFormatButton.addEventListener("click", () => {
|
||||
|
||||
opt = getSelected(displayFormats);
|
||||
fetch("/display_format", {
|
||||
method:"PUT",
|
||||
body:JSON.stringify(opt)
|
||||
});
|
||||
});
|
||||
|
||||
function saveSettings() {
|
||||
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"];
|
||||
let pageNum = features.indexOf(feature) + 1;
|
||||
let pageSelector = "Page" + pageNum.toString();
|
||||
|
||||
let page = document.getElementById(pageSelector);
|
||||
|
||||
let speed = getSelected(page.querySelectorAll(".speed-select")[0]);
|
||||
let animation = getSelected(page.querySelectorAll(".animation-select")[0]);
|
||||
|
||||
console.log(speed);
|
||||
console.log(animation);
|
||||
|
||||
|
||||
}
|
||||
|
||||
let saveSettingsButtons = document.querySelectorAll(".save-btn-div").forEach(button =>
|
||||
button.addEventListener("click", saveSettings)
|
||||
)
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user