Sha256: da130516e53faa7296eea4e012b4bd5af5f1515e9d4c00700be968c4b400e37d

Contents?: true

Size: 1.47 KB

Versions: 21

Compression:

Stored size: 1.47 KB

Contents

/*!
Deck JS - deck.split
Copyright (c) 2012 Qingping Hou <dave2008713@gmail.com>
                   about.houqp.me
Dual licensed under the MIT license and GPL license.
https://github.com/imakewebthings/deck.js/blob/master/MIT-license.txt
https://github.com/imakewebthings/deck.js/blob/master/GPL-license.txt
*/

/*
This module splits a long slide into multiple slides.
*/
(function($, deck, undefined) {
	var $d = $(document);

	createEmptySlide = function(title_el) {
		slide = $(document.createElement('section'));
		slide.addClass('slide').append(title_el.clone());
		return slide;
	};

	$d.bind('deck.beforeInit', function() {
		$(".slide").each( function(i, slide) {
			/* each slide */
			var is_split = false,
			prev_slide = $(slide),
			/* extract title which will be added to each new slides */
			title_el = prev_slide.children('h2'),
			tmp_slide = createEmptySlide(title_el);

			$(slide).children().each(function() {
				/* for each element inside original slide */
				var el = $(this);

				if (el.css('page-break-after') == 'always') {
					if (is_split) {
						tmp_slide.insertAfter(prev_slide);
						prev_slide = tmp_slide;
						tmp_slide = createEmptySlide(title_el);
					}
					else {
						/* find the first page break */
						is_split = true;
					}
				}
				else {
					if (is_split) {
						tmp_slide.append(el);
					}
				}
			})
			/* add remaining elements to a new slides */
			if (is_split) {
				tmp_slide.insertAfter(prev_slide);
			}
		});
	})
})(jQuery, 'deck');

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
hyla-1.0.9 lib/resources/assets/deck.js/extensions/split/deck.split.js
hyla-1.0.9.pre.3 lib/resources/assets/deck.js/extensions/split/deck.split.js
hyla-1.0.9.pre.2 lib/resources/assets/deck.js/extensions/split/deck.split.js
hyla-1.0.9.pre.1 lib/resources/assets/deck.js/extensions/split/deck.split.js
hyla-1.0.8 lib/resources/assets/deck.js/extensions/split/deck.split.js
hyla-1.0.7 lib/resources/assets/deck.js/extensions/split/deck.split.js
hyla-1.0.7.pre.9 lib/resources/assets/deck.js/extensions/split/deck.split.js
hyla-1.0.7.pre.8 lib/resources/assets/deck.js/extensions/split/deck.split.js
hyla-1.0.7.pre.7 lib/resources/assets/deck.js/extensions/split/deck.split.js
hyla-1.0.7.pre.6 lib/resources/assets/deck.js/extensions/split/deck.split.js
hyla-1.0.7.pre.5 lib/resources/assets/deck.js/extensions/split/deck.split.js
hyla-1.0.7.pre.3 lib/resources/assets/deck.js/extensions/split/deck.split.js
hyla-1.0.7.pre.2 lib/resources/assets/deck.js/extensions/split/deck.split.js
hyla-1.0.7.pre.1 lib/resources/deck.js/extensions/split/deck.split.js
hyla-1.0.6 lib/resources/deck.js/extensions/split/deck.split.js
hyla-1.0.5 lib/resources/deck.js/extensions/split/deck.split.js
hyla-1.0.5.pre.1 lib/resources/deck.js/extensions/split/deck.split.js
hyla-1.0.4 lib/resources/deck.js/extensions/split/deck.split.js
hyla-1.0.3 lib/resources/deck.js/extensions/split/deck.split.js
hyla-1.0.2 lib/resources/deck.js/extensions/split/deck.split.js