| @@ -2,6 +2,7 @@ | |||
| <html> | |||
| <head> | |||
| <meta charset="utf-8"> | |||
| <meta name="viewport" content="width=device-width, initial-scale=1"> | |||
| <title>Slides</title> | |||
| <style> | |||
| html, body { | |||
| @@ -13,6 +14,7 @@ | |||
| #_overlay { | |||
| z-index: 2; | |||
| will-change: opacity; | |||
| } | |||
| #_main { | |||
| z-index: 1; | |||
| @@ -23,11 +25,16 @@ | |||
| position: absolute; | |||
| width: 100%; | |||
| height: 100%; | |||
| top: 0px; | |||
| top: 0%; | |||
| left: 0px; | |||
| display: flex; | |||
| align-items: center; | |||
| justify-content: center; | |||
| } | |||
| ._content { | |||
| ._content ._wrapper { | |||
| display: inline-block; | |||
| text-align: center; | |||
| } | |||
| @@ -53,7 +60,7 @@ | |||
| } | |||
| #_overlay { | |||
| transition: opacity {{transition_time}}s; | |||
| transition: opacity <<transition_time>>s; | |||
| opacity: 1; | |||
| } | |||
| #_overlay.hidden { | |||
| @@ -88,9 +95,9 @@ | |||
| fetch("/slide") | |||
| .then(response => response.text()) | |||
| .then(text => { | |||
| history.replaceState({}, "", "/"+name+"/"); | |||
| main().innerHTML = "<div class='_wrapper'>"+text+"</div>"; | |||
| setTimeout(() => { | |||
| history.replaceState({}, "", "/"+name+"/"); | |||
| main().innerHTML = text; | |||
| overlay().className = "_content hidden"; | |||
| }, 1000); | |||
| }) | |||
| @@ -110,9 +117,11 @@ | |||
| function await() { | |||
| // Wait for the next slide change, then update again | |||
| console.log("fetching"); | |||
| fetch("/await") | |||
| .then(response => response.json()) | |||
| .then(obj => { | |||
| console.log("fetched", JSON.stringify(obj)); | |||
| if (obj.evt === "next") { | |||
| update(obj.args.name); | |||
| } else if (obj.evt === "reload") { | |||
| @@ -6,7 +6,7 @@ var urllib = require("url"); | |||
| var conf = JSON.parse(fs.readFileSync("conf.json")); | |||
| var index = fs.readFileSync("index.html", "utf-8") | |||
| .replace("{{transition_time}}", conf.transition_time); | |||
| .replace(/<<transition_time>>/g, conf.transition_time); | |||
| function error(res, err) { | |||
| console.trace(err); | |||
| @@ -105,17 +105,9 @@ function Slideshow(dir, changeInterval) { | |||
| var slides = []; | |||
| self.sendEvent = function(evt, args) { | |||
| awaiters.forEach(res => res.end(JSON.stringify({ | |||
| evt: evt, | |||
| args: args | |||
| }))); | |||
| } | |||
| self.sendEvent = function(evt, args) { | |||
| awaiters.forEach(res => res.end(JSON.stringify({ | |||
| evt: evt, | |||
| args: args | |||
| }))); | |||
| var str = JSON.stringify({ evt: evt, args: args }); | |||
| awaiters.forEach(res => res.end(str)); | |||
| awaiters = []; | |||
| } | |||
| self.serve = function(req, res) { | |||