Browse Source

fancier animation, no longer tries to show slides with no index.html

master
mort 8 years ago
parent
commit
84f977aa6d
2 changed files with 17 additions and 10 deletions
  1. 5
    4
      index.html
  2. 12
    6
      server.js

+ 5
- 4
index.html View File

@@ -51,9 +51,9 @@
text-align: center;
}

._content h1 { font-size: 5em }
._content h2 { font-size: 4.5em }
._content h3 { font-size: 4em }
._content h1 { font-size: 7em }
._content h2 { font-size: 6.5em }
._content h3 { font-size: 5em }

._content p { font-size: 2.2em }

@@ -76,11 +76,12 @@
}

#_overlay {
transition: opacity <<transition_time>>s;
transition: opacity <<transition_time>>s, transform <<transition_time>>s;
opacity: 1;
}
#_overlay.hidden {
opacity: 0;
transform: scale(1.1);
}
</style>
</head>

+ 12
- 6
server.js View File

@@ -83,9 +83,9 @@ function Slide(dir) {
sendfile(res, pathlib.join(dir, name));
}

self.dirExists = function() {
self.indexExists = function() {
try {
fs.accessSync(dir, fs.F_OK);
fs.accessSync(pathlib.join(dir, "index.html"));
return true;
} catch (err) {
return false;
@@ -162,8 +162,7 @@ function Slideshow(dir, changeInterval) {
slideIndex += 1;

// Go to the next slide, or restart
if ((slideIndex >= slides.length)
|| (!slides[slideIndex].dirExists())) {
if ((slideIndex >= slides.length)) {
clearTimeout(nextTimeout);
init();
} else {
@@ -171,8 +170,15 @@ function Slideshow(dir, changeInterval) {
nextTimeout = setTimeout(next, changeInterval);
}

// End all awaiting connections to notify slide change
self.sendEvent("next", { name: currentSlide.name });
// End all awaiting connections to notify slide change,
if (currentSlide.indexExists()) {
self.sendEvent("next", { name: currentSlide.name });

// Or go to the next slide if the current one doesn't have an index.html
} else {
clearTimeout(nextTimeout);
setTimeout(next, 0);
}
}

self.next = next;

Loading…
Cancel
Save