-var DEFAULT_TITLE = "ppt-control"
+const DEFAULT_TITLE = "ppt-control";
+const LABEL_STOPPED = "Slideshow stopped";
+const LABEL_RUNNING = "Slideshow running";
+const LABEL_DISCONNECTED = "Disconnected";
+const LABEL_FINAL_PREFIX = "Final slide ‐ ";
+const LABEL_END_PREFIX = "End of slideshow ‐ ";
var preloaded = false;
var preload = [];
next.click()
}
+window.addEventListener('resize', function(event) {set_control_width()}, true);
+
function sync_current() {
if (show_current.checked) {
var d = new Date;
if (Object.keys(presentationData).length > 0) {
currentPresentationData = presentationData[getPresentationName()];
- console.log("Current presentation is " + getPresentationName());
presentation_text.style.display = "block";
- status_text.textContent = "Slideshow running";
+ status_text.innerHTML = LABEL_RUNNING;
startBtn.style.display = "none";
stopBtn.style.display = "block";
if (show_current.checked) {
}
}
if (currentPresentationData.slide_current == currentPresentationData.slide_total) {
- status_text.textContent = "Slideshow running (last slide)";
+ status_text.innerHTML = LABEL_FINAL_PREFIX + LABEL_RUNNING;
}
if (currentPresentationData.slide_current == currentPresentationData.slide_total + 1) {
- status_text.textContent = "End of slideshow";
+ status_text.innerHTML = LABEL_END_PREFIX + LABEL_RUNNING;
next_img.src = "/black.jpg";
} else {
next_img.src = "/cache/" + currentPresentationData.name + "/" + (currentPresentationData.slide_current + 1) + ".jpg?t=" + d.getTime();
if (currentPresentationData.slide_current == 0) {
current_img.src = "/black.jpg";
next_img.src = "/black.jpg";
- status_text.textContent = "Slideshow not running";
+ status_text.innerHTML = LABEL_STOPPED;
startBtn.style.display = "block";
stopBtn.style.display = "none";
}
document.title = DEFAULT_TITLE;
current_img.src = "/black.jpg";
next_img.src = "/black.jpg";
- status_text.textContent = "Disconnected";
+ status_text.innerHTML = LABEL_DISCONNECTED;
total.textContent = "?";
current.value = "";
presentation_text.style.display = "none";
function receive_message(event) {
data = JSON.parse(event.data);
- console.log("Received data: " + data);
if (Object.keys(presentationData).includes(data.name)) {
// Existing presentation
presentationData[data.name] = {"name": data.name, "pres_open": data.pres_open, "slideshow": data.slideshow, "visible": data.visible, "slide_current": data.slide_current, "slide_total": data.slide_total, "option": presentationData[data.name].option};