浏览代码

CSS changes

master
mort 8 年前
父节点
当前提交
751a2d8245
共有 2 个文件被更改,包括 18 次插入17 次删除
  1. 14
    5
      index.html
  2. 4
    12
      server.js

+ 14
- 5
index.html 查看文件

<html> <html>
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Slides</title> <title>Slides</title>
<style> <style>
html, body { html, body {


#_overlay { #_overlay {
z-index: 2; z-index: 2;
will-change: opacity;
} }
#_main { #_main {
z-index: 1; z-index: 1;
position: absolute; position: absolute;
width: 100%; width: 100%;
height: 100%; height: 100%;
top: 0px;
top: 0%;
left: 0px; left: 0px;

display: flex;
align-items: center;
justify-content: center;
} }


._content {
._content ._wrapper {
display: inline-block;
text-align: center; text-align: center;
} }


} }


#_overlay { #_overlay {
transition: opacity {{transition_time}}s;
transition: opacity <<transition_time>>s;
opacity: 1; opacity: 1;
} }
#_overlay.hidden { #_overlay.hidden {
fetch("/slide") fetch("/slide")
.then(response => response.text()) .then(response => response.text())
.then(text => { .then(text => {
history.replaceState({}, "", "/"+name+"/");
main().innerHTML = "<div class='_wrapper'>"+text+"</div>";
setTimeout(() => { setTimeout(() => {
history.replaceState({}, "", "/"+name+"/");
main().innerHTML = text;
overlay().className = "_content hidden"; overlay().className = "_content hidden";
}, 1000); }, 1000);
}) })


function await() { function await() {
// Wait for the next slide change, then update again // Wait for the next slide change, then update again
console.log("fetching");
fetch("/await") fetch("/await")
.then(response => response.json()) .then(response => response.json())
.then(obj => { .then(obj => {
console.log("fetched", JSON.stringify(obj));
if (obj.evt === "next") { if (obj.evt === "next") {
update(obj.args.name); update(obj.args.name);
} else if (obj.evt === "reload") { } else if (obj.evt === "reload") {

+ 4
- 12
server.js 查看文件



var conf = JSON.parse(fs.readFileSync("conf.json")); var conf = JSON.parse(fs.readFileSync("conf.json"));
var index = fs.readFileSync("index.html", "utf-8") 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) { function error(res, err) {
console.trace(err); console.trace(err);
var slides = []; var slides = [];


self.sendEvent = function(evt, args) { 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) { self.serve = function(req, res) {

正在加载...
取消
保存