Browse files

Merge branch 'master' of git://github.com/Seldaek/slippy

* 'master' of git://github.com/Seldaek/slippy:
  Add support for data-background for download button, fixes #12
  Fix bug with adjacent slides containing backrgounds
  Adjust overview style
  Added support for full-screen images per slide
  Clean up of index.php
  fixing issues mentioned by sealdek and making web download work again
  tweak image handling: baseWidth: false to disable, noscale to disable single image, add imgScaleTrivial to avoid mini-scaling
  adding cli handling to index.php and explain download in README
  Support spaces in input for pdf conversion
  Updated README
  Speed up PDF rendering by using multiple concurrent renderers
  Update PhantomJS script to 1.3.0
  Remove TAB handler to show the overview (quite annoying when alt-tabbing through apps)
  Fix js execute button to work with html entities in code block
  Some fixes to the PDF rendering
  • Loading branch information...
2 parents c41d7d3 + 8aabfa7 commit ef59ce240561840addce9a32744297aa91447ea4 @koko-u committed Nov 16, 2012
Showing with 393 additions and 140 deletions.
  1. +54 −5 README.mdown
  2. +94 −29 bin/phantom-slippy-to-pdf.js
  3. +8 −2 bin/slippy-pdf.sh
  4. +86 −21 src/index.php
  5. +8 −8 src/slippy-pure.css
  6. +17 −1 src/slippy.css
  7. +126 −74 src/slippy.js
View
59 README.mdown
@@ -13,7 +13,7 @@ Navigate, double click anywhere, press space or use the left/up and right/down a
Go to a slide directly, press number keys and then enter
-Get an overview, press escape, tab or delete then click on a slide to go straight to it
+Get an overview, press escape or delete then click on a slide to go straight to it
How to: Make your own slide deck
--------------------------------
@@ -65,6 +65,11 @@ Finally you should initialize Slippy and the syntax highlighter:
});
</script>
+Images are automatically scaled to fit onto the slide whatever the size of the
+browser window. You can tweak the behaviour with the baseWidth and imgScaleTrivial
+parameters (see below). If one of your images should never be scaled, add the class
+"noscale" to the <img> tag, i.e. <img src="text.png" class="noscale"/>
+
The slippy() call takes an option object, which accepts the following keys:
- animLen, duration for default animations (0 = disabled)
@@ -74,23 +79,66 @@ The slippy() call takes an option object, which accepts the following keys:
- animOutRewind, receives a slide and animates it
- baseWidth, defines the base for img resizing, if you don't want only
full-width images, specify this as the pixel width of a slide so that
- images are scaled properly (default is 620px wide)
+ images are scaled properly (default is 620px wide). Set to false to not scale images.
+- imgScaleTrivial, defines the limit beneath that images are not scaled to avoid
+ unnecessary scaling that renders the image less nice.
- ratio, defines the width/height ratio of the slides, defaults to 1.3 (620x476)
- margin, the fraction of screen to use as slide margin, defaults to 0.15
+How to: Show images fullscreen
+------------------------------
+
+If a slide contains a `data-background` attribute, the referenced image will be
+inserted fullscreen, and the background (if the image is not of the same aspect ratio
+as the screen) will turn black. Example:
+
+```html
+<div class="slide" data-background="foo.jpg">
+ <h1>Content</h1>
+</div>
+```
+
+Server
+------
+
+The src/ folder contains an index.php that serves slides.
+
+- Put the src folder inside the webroot of a web server
+- Copy config.php.dist to config.php and adjust to point to the folder containing
+ your slides - or just copy/symlink all slides into the src folder. The
+ index.php looks for html files in that folder and shows them, using the
+ header information for title and author.
+
+Exporting self-contained HTML presentations
+-------------------------------------------
+
+Slippy can generate a presentation in a single file, with all javascript, css
+and images inlined.
+
+ php src/index.php <slippy slides> [<output file>]
+
+If you omit the output file, slippy will generate the filename from the input
+file, appending _compiled to the name.
+
+If you set up the slippy webserver (see above), you can also click the download link.
+
+Limitation: If you use images in css statements, they are not included. If you
+need to do that, you should generate a PDF instead (see below).
+
Exporting PDFs
--------------
To upload your presentation on SlideShare, or to share it with others, it can be convenient to
export it to a PDF. Slippy comes with a CLI utility that does just that.
-The only requirement is that you download [PhantomJS](http://code.google.com/p/phantomjs/downloads/list) (1.1 only)
+The only requirement is that you download [PhantomJS](http://code.google.com/p/phantomjs/downloads/list) (1.3.0)
and [pdftk](http://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/) and place the executables in the bin/phantomjs
-and bin/pdftk dirs or make them accessible via your PATH environment variable.
+and bin/pdftk dirs or make them accessible via your PATH environment variable. If you're on linux you can
+probably install pdftk with your distro's package manager.
Once that is done, you can call the script using `bin/slippy-pdf.sh <path to your html presentation> <path to the pdf file to generate>`.
-It'll take a while and then should output a 4:3 PDF file. If you don't like the aspect ratio or size,
+It will take a while and then should output a 4:3 PDF file. If you don't like the aspect ratio or size,
you can change the viewport size in the `bin/phantom-slippy-to-pdf.js` file. If you have rendering issues (missing
images or such), try increasing the delay, or rendering again, sometimes PhantomJS just fails without apparent reason.
@@ -129,6 +177,7 @@ Changelog
- Added a template to render the slide repository page
- Added a packager that embeds everything for easy distribution of slides as one html file
- Added incremental slides functionality (use the incremental class on any elements to make them appear one by one)
+ - Added fullscreen image support on a per-slide basis (`data-background="img url"` on a slide div)
- JS Alerts are now cleared when changing slide, but stay visible longer
- Fixed bug preventing "0" to be used to switch to slides
View
123 bin/phantom-slippy-to-pdf.js
@@ -1,37 +1,102 @@
-var current, slides, viewport, output, delay;
+var viewport, output, delay, renderers = [];
+
+// checks version
+if (phantom.version.major == 1 && phantom.version.minor < 3) {
+ console.log('This script requires PhantomJS v1.3.0+, you have v'+phantom.version.major+'.'+phantom.version.minor+'.'+phantom.version.patch);
+ phantom.exit(-1);
+}
+
+// check usage
+if (phantom.args.length !== 2) {
+ console.log('Usage: phantom-pdf.js URL dirname');
+ phantom.exit(-1);
+}
// settings
delay = 500;
viewport = { width: 1024, height: 768 };
+output = phantom.args[1];
+
+(function init() {
+ var i, slides, workers, slidesPerWorker, page;
+
+ page = new WebPage()
+ page.open(phantom.args[0], function (status) {
+ if (status !== 'success') {
+ console.log('Unable to load the given URL');
+ phantom.exit(-1);
+ } else {
+ slides = page.evaluate(function () {
+ return $('.slideContent').length;
+ });
+
+ workers = Math.min(4, slides);
+ slidesPerWorker = Math.ceil(slides / workers);
+ i = 0;
+
+ console.log('Initializing renderers');
-// init
-if (phantom.state.length === 0) {
- if (phantom.args.length !== 2) {
- console.log('Usage: phantom-pdf.js URL dirname');
- phantom.exit();
- } else {
- phantom.state = 'rasterize';
- console.log('opening page');
- phantom.open(phantom.args[0]);
+ while (slides > 0) {
+ if (i > 0) {
+ page = new WebPage();
+ }
+ page.viewportSize = { width: viewport.width, height: viewport.height };
+ page.paperSize = { width: viewport.width * 1.5, height: viewport.height * 1.5 + 30 };
+ renderers.push(renderer(page, phantom.args[0], i * slidesPerWorker, Math.min(slidesPerWorker, slides)))
+ i++;
+ slides -= slidesPerWorker;
+ }
+ }
+ });
+}());
+
+function jobFinished(renderer) {
+ renderers.splice(renderers.indexOf(renderer), 1);
+ if (renderers.length == 0) {
+ console.log('Done.');
+ phantom.exit(0);
+ }
+}
+
+function renderer(page, url, currentSlide, slides) {
+ page.open(url, openHandler);
+
+ function openHandler(status) {
+ if (status !== 'success') {
+ console.log('Unable to load the given URL');
+ phantom.exit(-1);
+ } else {
+ // wait to be sure the page is loaded correctly
+ setTimeout(initPage, 1000);
+ }
}
-} else {
- // run
- current = 1;
- slides = $('.slideContent').length;
- phantom.viewportSize = { width: viewport.width, height: viewport.height };
- phantom.paperSize = { width: viewport.width * 1.5, height: viewport.height * 1.5 + 30 };
- output = phantom.args[1];
-
- phantom.sleep(1000);
- $('.incremental').css('opacity', '1').removeClass('.incremental');
-
- for (;current<=slides;current++) {
- console.log('rendering slide '+current);
- phantom.sleep(delay);
- phantom.render(output+'slide'+"000".substring(current.toString().length)+current+'.pdf');
- $(document).click();
- $(document).click();
+
+ function initPage() {
+ var i;
+ page.evaluate(function () {
+ $('.incremental').css('opacity', '1').removeClass('incremental');
+ });
+ // move to the current slide
+ page.evaluate('function () {'+
+ '$(document).slippy().showSlide('+currentSlide+');'+
+ '}');
+ // wait to be sure the slide animation is over
+ setTimeout(renderNextSlide, delay);
+ };
+
+ function renderNextSlide() {
+ if (!slides) {
+ return jobFinished(this);
+ }
+
+ console.log('Rendering slide '+currentSlide);
+ page.render(output+'slide'+"000".substring(currentSlide.toString().length)+currentSlide+'.pdf');
+ page.evaluate(function () {
+ $(document).slippy().nextSlide();
+ });
+ slides--;
+ currentSlide++;
+ // wait to be sure the slide animation is over
+ setTimeout(renderNextSlide, delay);
}
- console.log('done');
- phantom.exit();
}
View
10 bin/slippy-pdf.sh
@@ -7,6 +7,7 @@ if [ "" = "$2" ]; then
echo "Usage: ./phantom-pdf.sh <slides URL> <PDF filename>"
exit 1
fi
+
mkdir -p tmp-pdf/
rm -f tmp-pdf/*.png
rm -f tmp-pdf/*.pdf
@@ -35,7 +36,12 @@ if [ "" = "$pdftk" ]; then
fi
fi
-$phantom $bin/phantom-slippy-to-pdf.js $1 tmp-pdf/
+$phantom $bin/phantom-slippy-to-pdf.js "$1" tmp-pdf/
+if [ "$?" != "0" ]
+then
+ echo 'PhantomJS error, aborting.'
+ exit
+fi
-$pdftk tmp-pdf/*.pdf cat output $2
+$pdftk tmp-pdf/*.pdf cat output "$2"
rm -r tmp-pdf/
View
107 src/index.php
@@ -20,6 +20,39 @@
$dir = rtrim($dir, '/').'/';
}
+// handle CLI mode
+if (PHP_SAPI === 'cli') {
+ if (!isset($_SERVER['argv'][1])) {
+ echo "USAGE: index.php <name of your slides html file> [<target file>]\n";
+ exit(1);
+ } elseif (!file_exists($_SERVER['argv'][1])) {
+ echo "File not found: ".$_SERVER['argv'][1]."\n";
+ exit(1);
+ }
+
+ $file = $_SERVER['argv'][1];
+ if (isset($_SERVER['argv'][2])) {
+ $targetfile = $_SERVER['argv'][2];
+ } else {
+ $targetfile = substr($file, 0, strrpos($file, '.')).'_compiled.html';
+ }
+
+ if (file_exists($targetfile)) {
+ echo "File $targetfile exists. Do you want to overwrite (y/n)? [y]: ";
+ $handle = fopen("php://stdin", "r");
+ $line = fgets($handle);
+ if (strtolower(trim($line)) !== 'y' && trim($line) !== '') {
+ echo "Aborting.\n";
+ exit(1);
+ }
+ }
+
+ $html = compactDeck(cleanDeck($file));
+ file_put_contents($targetfile, $html);
+ echo "Successfully saved slides to $targetfile\n";
+ exit(0);
+}
+
// fetch slide deck
if (isset($_GET['file'])) {
$file = $dir . basename($_GET['file']);
@@ -34,21 +67,31 @@
die;
}
-// prepare slide deck content
-$file = file_get_contents($file);
-$file = preg_replace_callback('{(<pre[^>]+>)(.+?)(</pre>)}s', 'slippy_recode', $file);
+$html = cleanDeck($file);
+// handle downloads
if (isset($_GET['download']) && $_GET['download']) {
- downloadDeck($file);
- die;
+ header('Content-Type: text/html');
+ header('Content-Disposition: attachment; filename="'.basename($file).'"');
+ echo compactDeck($html);
+ exit(0);
}
-echo $file;
+echo $html;
+
+/**
+ * Prepare slide deck content
+ */
+function cleanDeck($file)
+{
+ $html = file_get_contents($file);
+ return preg_replace_callback('{(<pre[^>]+>)(.+?)(</pre>)}s', 'slippyRecode', $html);
+}
/**
* Strips the leading whitespace off <pre> tags and html encodes them
*/
-function slippy_recode($match)
+function slippyRecode($match)
{
$whitespace = preg_replace('#^\r?\n?([ \t]*).*#s', '$1', $match[2]);
$output = preg_replace('/^'.preg_quote($whitespace, '/').'/m', '', $match[2]);
@@ -88,14 +131,13 @@ function fetchDecksData($decks)
/**
* Embeds all dependencies (js, css, images) into a slide deck file and serves it as a download
+ *
+ * @param string $html the content of the slides html file
*/
-function downloadDeck($file)
+function compactDeck($html)
{
- header('Content-Type: text/html');
- header('Content-Disposition: attachment; filename="'.$_GET['file'].'"');
- $baseUrl = ($_SERVER['SERVER_PORT'] === 443 ? 'https':'http') .'://'. $_SERVER['HTTP_HOST'].'/index.php';
$doc = new DOMDocument();
- @$doc->loadHTML($file);
+ @$doc->loadHTML($html);
$xpath = new DOMXPath($doc);
$jsFiles = $xpath->evaluate('//script[@type="text/javascript"][@src!=""]');
foreach ($jsFiles as $js) {
@@ -112,17 +154,37 @@ function downloadDeck($file)
$css->parentNode->replaceChild($node, $css);
}
$imgFiles = $xpath->evaluate('//img[@src!=""]');
- $types = array(
+ $imgAttributes = $xpath->evaluate('//*[@data-background!=""]');
+ foreach ($imgFiles as $img) {
+ $source = $img->getAttribute('src');
+ if ($data = convertImage($source)) {
+ $img->setAttribute('src', $data);
+ }
+ }
+ foreach ($imgAttributes as $img) {
+ $source = $img->getAttribute('data-background');
+ if ($data = convertImage($source)) {
+ $img->setAttribute('data-background', $data);
+ }
+ }
+
+ return $doc->saveHTML();
+}
+
+function convertImage($url)
+{
+ static $types = array(
'png' => 'image/png',
'gif' => 'image/gif',
'jpg' => 'image/jpeg',
'jpeg' => 'image/jpeg',
);
- foreach ($imgFiles as $img) {
- $source = $img->getAttribute('src');
+
+ if (PHP_SAPI !== 'cli') {
+ $baseUrl = ($_SERVER['SERVER_PORT'] === 443 ? 'https':'http') .'://'. $_SERVER['HTTP_HOST'].'/index.php';
$parts = parse_url($baseUrl);
$imgUrl = $parts['scheme'].'://'.$parts['host'];
- if ($source{0} !== '/') {
+ if ($url{0} !== '/') {
if (substr($parts['path'], -1) === '/') {
$imgUrl .= $parts['path'];
} elseif (dirname($parts['path']) === '\\') {
@@ -131,10 +193,13 @@ function downloadDeck($file)
$imgUrl .= dirname($parts['path']);
}
}
- $imgUrl .= $source;
- $ext = strtolower(substr($source, strrpos($source, '.') + 1));
- $data = 'data:'.$types[$ext].';base64,'.base64_encode(file_get_contents(str_replace(' ', '%20', $imgUrl)));
- $img->setAttribute('src', $data);
+ } else {
+ // no image path rewriting on cli
+ $imgUrl = '';
+ }
+ $imgUrl .= $url;
+ $ext = strtolower(substr($url, strrpos($url, '.') + 1));
+ if (isset($types[$ext])) {
+ return 'data:'.$types[$ext].';base64,'.base64_encode(file_get_contents(str_replace(' ', '%20', $imgUrl)));
}
- echo $doc->saveHTML();
}
View
16 src/slippy-pure.css
@@ -34,14 +34,14 @@ a.eval {
}
/** Overview screen */
-.overview .slide {
- -moz-border-radius: 2em;
- -webkit-border-radius: 2em;
- border-radius: 2em;
- border: 0.5em solid #ccc;
-}
-.overview .slide.active {
- border: 0.5em solid #888;
+.overviewWrapper {
+ -moz-border-radius: .25em;
+ -webkit-border-radius: .25em;
+ border-radius: .25em;
+ border: 1px solid #ccc;
+}
+.overviewWrapper.active {
+ border: 1px solid #888;
}
.overviewWrapper:hover {
position: relative;
View
18 src/slippy.css
@@ -47,6 +47,23 @@ a.eval {
left: -100%;
}
+body.slide-background .footer {
+ display: none;
+}
+
+#slippy-slide-background {
+ width: 100%;
+ height: 100%;
+ position: absolute;
+ left: 0px;
+ top: 0px;
+ z-index: 0;
+}
+
+body.overview #slippy-slide-background {
+ display: none;
+}
+
.layout {
display:none;
}
@@ -68,7 +85,6 @@ a.eval {
.overviewWrapper {
float: left;
- margin: 2%;
position: relative;
}
View
200 src/slippy.js
@@ -17,7 +17,7 @@
var slides, curSlide, options, inOverview,
incrementals, curIncremental = 0,
// methods
- buildSlide, preparePreTags, executeCode, nextSlide, prevSlide, showSlide, setSlide, getCurrentSlide,
+ buildSlide, preparePreTags, executeCode, nextSlide, prevSlide, showSlide, setSlide, getCurrentSlide, updateSlideBackground,
keyboardNav, antiScroll, urlChange, autoSize, clickNav, animInForward, animInRewind, animOutForward, animOutRewind,
incrementalBefore, incrementalAfter;
@@ -55,7 +55,7 @@
if ($(this).hasClass('eval')) {
$(this)
.before('<a class="eval">Execute</a>').prev()
- .data('src', content);
+ .data('src', $("<div/>").html(content).text());
}
match = content.match(/\r?\n?([ \t]*)/);
if (match && match[1]) {
@@ -98,24 +98,36 @@
$('.slideContent')
.height(slideH*0.95)
.css('margin', (slideH*0.05).toString() + "px auto 0");
- $('.slideContent img').each(function() {
- var ratio, imgWidth, imgHeight;
- imgWidth = $.data(this, 'origWidth');
- imgHeight = $.data(this, 'origHeight');
- if (!imgWidth || !imgHeight) {
- imgWidth = $(this).width();
- imgHeight = $(this).height();
- $.data(this, 'origWidth', imgWidth);
- $.data(this, 'origHeight', imgHeight);
- }
- if (imgWidth >= imgHeight) {
- ratio = Math.min(imgWidth, options.baseWidth) / options.baseWidth;
- $(this).css('width', Math.round(ratio * slideW * 0.9));
- } else {
- ratio = Math.min(imgHeight, options.baseWidth / options.ratio) / (options.baseWidth / options.ratio);
- $(this).css('height', Math.round(ratio * slideH * 0.9));
- }
- });
+ if (options.baseWidth) {
+ $('.slideContent img').each(function() {
+ if ($(this).hasClass('noscale')) return;
+ var ratio, imgWidth, imgHeight;
+ imgWidth = $.data(this, 'origWidth');
+ imgHeight = $.data(this, 'origHeight');
+ if (!imgWidth || !imgHeight) {
+ imgWidth = $(this).width();
+ imgHeight = $(this).height();
+ $.data(this, 'origWidth', imgWidth);
+ $.data(this, 'origHeight', imgHeight);
+ }
+ if (imgWidth >= imgHeight) {
+ ratio = Math.min(imgWidth, options.baseWidth) / options.baseWidth;
+ var target = Math.round(ratio * slideW * 0.9);
+ if (Math.abs(target - imgWidth) < options.imgScaleTrivial) {
+ // avoid useless scaling that just makes the image look ugly
+ target = imgWidth;
+ }
+ $(this).css('width', target);
+ } else {
+ ratio = Math.min(imgHeight, options.baseWidth / options.ratio) / (options.baseWidth / options.ratio);
+ var target = Math.round(ratio * slideH * 0.9);
+ if (Math.abs(target - imgHeight) < options.imgScaleTrivial) {
+ target = imgHeight;
+ }
+ $(this).css('height', target);
+ }
+ });
+ }
$('.slideContent embed').each(function() {
var ratio, imgWidth, newWidth, $el, $parent, $object;
$el = $(this);
@@ -145,9 +157,9 @@
resizeOverview = function() {
$('.overviewWrapper')
- .height(slideH * 0.13)
- .width(slideW * 0.15)
- .css('margin', slideH * 0.05);
+ .height(slideH * 0.2)
+ .width(slideW * 0.2)
+ .css('margin', slideH * 0.02);
};
centerVertically = function() {
@@ -246,13 +258,28 @@
// TODO show help;
break;
- // handle delete, esc, tab for overview
- case 9:
+ // handle delete, esc for overview
case 27:
case 46:
if ($.browser.msie && $.browser.version < 9) { break; }
if (inOverview) { break; }
slides.wrap($('<div/>').addClass('overviewWrapper'));
+
+ slides.each(function (idx, el) {
+ var img;
+ el = $(el);
+ // mark wrapper as active for active slide
+ if (el.hasClass('active')) {
+ el.parent().addClass('active');
+ }
+
+ // add slide backgrounds to overview wrappers
+ if (img = el.data('background')) {
+ el.parent().css('background', '#000 url("' + img + '") center center no-repeat')
+ .css('background-size', '100%');
+ }
+ });
+
$('body').removeClass('slide-'+(curSlide+1)).addClass('overview');
slides.bind('click.slippyOverview', function (e) {
showSlide(slides.index(this));
@@ -413,6 +440,25 @@
curSlide = num;
slides.eq(curSlide).addClass('active');
$('.slideDisplay').text((num+1)+'/'+slides.length);
+ updateSlideBackground();
+ };
+
+ updateSlideBackground = function() {
+ var img;
+ if (img = slides.eq(curSlide).data('background')) {
+ $('#slippy-slide-background').remove();
+ $('<div id="slippy-slide-background"></div>')
+ .prependTo('body')
+ .css('background-size', '100%')
+ .css('background-position', 'center center')
+ .css('background-image', 'url("' + img + '")')
+ .css('background-repeat', 'no-repeat')
+ .css('background-color', '#000')
+ $('body').addClass('slide-background');
+ } else {
+ $('#slippy-slide-background').remove();
+ $('body').removeClass('slide-background');
+ }
};
getCurrentSlide = function() {
@@ -427,59 +473,65 @@
};
$.fn.slippy = function(settings) {
- var defaults = {
- // animation duration for default anim callbacks, in milliseconds
- animLen: 350,
- // base width for proportional image scaling
- baseWidth: 620,
- // define animation callbacks, they receive a slide dom node to animate
- animInForward: animInForward,
- animInRewind: animInRewind,
- animOutForward: animOutForward,
- animOutRewind: animOutRewind,
- // margin fraction, defaults to 0.15
- margin: 0.15,
- // width/height ratio of the slides, defaults to 1.3 (620x476)
- ratio: 1.3,
- incrementalBefore: null,
- incrementalAfter: null
- };
-
- options = $.extend(defaults, settings);
-
- slides = this;
- $('<div/>').addClass('slideDisplay').prependTo('body');
-
- // wrap footer divs
- $('.footer').wrapInner($('<div/>').addClass('footerContent'));
-
- $('.incremental').each(incrementalBefore);
-
- // prep slides
- this.each(buildSlide);
- this.last().addClass('lastslide');
- $('.layout').remove();
-
- $(document)
- .click(clickNav)
- .keyup(keyboardNav);
+ if (slides === undefined) {
+ var defaults = {
+ // animation duration for default anim callbacks, in milliseconds
+ animLen: 350,
+ // base width for proportional image scaling
+ baseWidth: 620,
+ // do not scale images by less then this to avoid unncessery scaling (in pixels)
+ imgScaleTrivial: 30,
+ // define animation callbacks, they receive a slide dom node to animate
+ animInForward: animInForward,
+ animInRewind: animInRewind,
+ animOutForward: animOutForward,
+ animOutRewind: animOutRewind,
+ // margin fraction, defaults to 0.15
+ margin: 0.15,
+ // width/height ratio of the slides, defaults to 1.3 (620x476)
+ ratio: 1.3,
+ incrementalBefore: null,
+ incrementalAfter: null
+ };
+
+ options = $.extend(defaults, settings);
+
+ slides = this;
+ $('<div/>').addClass('slideDisplay').prependTo('body');
+
+ // wrap footer divs
+ $('.footer').wrapInner($('<div/>').addClass('footerContent'));
+
+ $('.incremental').each(incrementalBefore);
+
+ // prep slides
+ this.each(buildSlide);
+ this.last().addClass('lastslide');
+ $('.layout').remove();
+
+ $(document)
+ .click(clickNav)
+ .keyup(keyboardNav);
+
+ slides.touch({
+ swipeLeft: nextSlide,
+ swipeRight: prevSlide,
+ tap: clickNav
+ });
- slides.touch({
- swipeLeft: nextSlide,
- swipeRight: prevSlide,
- tap: clickNav
- });
+ $(window)
+ .resize(autoSize.all)
+ .scroll(antiScroll);
- $(window)
- .resize(autoSize.all)
- .scroll(antiScroll);
+ $('img').load(autoSize.all);
- autoSize.all();
+ autoSize.all();
- $.history.init(urlChange);
- if (curSlide === undefined) {
- curSlide = -1;
- nextSlide();
+ $.history.init(urlChange);
+ if (curSlide === undefined) {
+ curSlide = -1;
+ nextSlide();
+ }
}
return {

0 comments on commit ef59ce2

Please sign in to comment.