Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #24 from Ralt/gh-pages

Allow the overview method to the outside world
  • Loading branch information...
commit f57b89f6890de8d6b6146cec9fa01d1aa6d192f5 2 parents 1297a4f + 63db75c
@LeaVerou authored
Showing with 35 additions and 30 deletions.
  1. +35 −30 slideshow.js
View
65 slideshow.js
@@ -64,6 +64,39 @@ var self = window.SlideShow = function(slide) {
// Get the slide elements into an array
this.slides = $$('.slide', body);
+
+ // Get the overview
+ this.overview = function(evt) {
+ if(body.classList.contains('show-thumbnails')) {
+ body.classList.remove('show-thumbnails');
+ body.classList.remove('headers-only');
+ }
+ else {
+ body.classList.add('show-thumbnails');
+
+ if(evt && (!evt.shiftKey || !evt.ctrlKey)) {
+ body.classList.add('headers-only');
+ }
+
+ body.addEventListener('click', function(evt) {
+ var slide = evt.target;
+
+ while(slide && !slide.classList.contains('slide')) {
+ slide = slide.parentNode;
+ }
+
+ if(slide) {
+ me.goto(slide.id);
+ setTimeout(function() { me.adjustFontSize(); }, 1000); // for Opera
+ }
+
+ body.classList.remove('show-thumbnails');
+ body.classList.remove('headers-only');
+
+ body.removeEventListener('click', arguments.callee);
+ }, false);
+ }
+ }
// Order of the slides
this.order = [];
@@ -180,35 +213,7 @@ self.prototype = {
me.goto(+slide? slide - 1 : slide);
break;
case 72: // H
- if(body.classList.contains('show-thumbnails')) {
- body.classList.remove('show-thumbnails');
- body.classList.remove('headers-only');
- }
- else {
- body.classList.add('show-thumbnails');
-
- if(!evt.shiftKey || !evt.ctrlKey) {
- body.classList.add('headers-only');
- }
-
- body.addEventListener('click', function(evt) {
- var slide = evt.target;
-
- while(slide && !slide.classList.contains('slide')) {
- slide = slide.parentNode;
- }
-
- if(slide) {
- me.goto(slide.id);
- setTimeout(function() { me.adjustFontSize(); }, 1000); // for Opera
- }
-
- body.classList.remove('show-thumbnails');
- body.classList.remove('headers-only');
-
- body.removeEventListener('click', arguments.callee);
- }, false);
- }
+ me.overview(evt);
break;
case 74: // J
if(body.classList.contains('hide-elements')) {
@@ -552,4 +557,4 @@ addEventListener('load', function(){ // no idea why the timeout is needed
}
});
-});
+});
Please sign in to comment.
Something went wrong with that request. Please try again.