This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
This is the same principle used in a previous gist: https://gist.github.com/1955854 | |
In this case, we use blank elements in the slide to provide an animation "step." | |
The presenter explicitly hits next/prev to reveal and unravel the animation instead | |
of it happening automatically when the slide is made current and leaves the screen. | |
The HTML structure be: | |
<section class="slide"> | |
<p>Some normal slide content...</p> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function($, window, undefined) { | |
/* | |
First we extend the defaults for the StackView options object. | |
This is a common pattern in all the modules, (infinite, navigation), | |
that each module extends the defaults to deal with the options that | |
pertain to its own code. | |
*/ | |
$.extend(true, window.StackView.defaults, { | |
selectors: { | |
/* Our types only have this one extension, a selector that points to |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function($, window, undefined) { | |
/* Let's say we want to completely override the template and adapter | |
for the webpage type. Simple enough, just get the type and set each of | |
those proeprties to new values. */ | |
var webpage = window.StackView.get_types().webpage; | |
webpage.template = '<li><%= id %></li>'; | |
webpage.adapter = function(item, options) { | |
return { | |
id: item.id | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).bind('deck.init', function() { | |
$.each(Processing.instances, function(i, instance) { | |
instance.exit(); // Exit all drawings to start | |
}); | |
}); | |
$(document).bind('deck.change', function(event, from, to) { | |
var $exitingCanvases = $.deck('getSlide', from).find('canvas[data-processing-sources]'); | |
var $enteringCanvases = $.deck('getSlide', to).find('canvas[data-processing-sources]'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Add this to bottom of deck container | |
<div class="deck-progress"><span></span></div> | |
And add this CSS wherever: | |
.deck-progress { | |
position:absolute; | |
left:0; | |
right:0; | |
bottom:0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var notify = function(message) { | |
var $message = $('<p style="display:none;">' + message + '</p>'); | |
$('.notifications').append($message); | |
$message.slideDown(300, function() { | |
window.setTimeout(function() { | |
$message.slideUp(300, function() { | |
$message.remove(); | |
}); | |
}, 2000); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function($, undefined) { | |
$.deck('extend', { | |
name: 'goto', | |
options: { | |
class: 'deck-goto', | |
datalistSelector: '#goto-datalist', | |
formSelector: '.goto-form', | |
inputSelector: '#goto-slide', | |
countNested: true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
class FileHandler(object): | |
def __init__(self, filename = "", query_type = ""): | |
self.filename = filename | |
self.query_type = query_type | |
def line_from_file(self, filename=None, query_type=None): | |
if filename != None |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).on('deck.beforeChange', function(event, from, to) { | |
var $slides = $.deck('getSlides'); | |
var onLastSlide = from === $slides.length - 1; | |
var onFirstSlide = !from; | |
var goingForward = to > from; | |
var nextUrl = $('link[rel="next"]').attr('href'); | |
var prevUrl = $('link[rel="prev"]').attr('href'); | |
if (onLastSlide && goingForward && nextUrl) { | |
window.location = nextUrl; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).on('deck.beforeChange', function(event, from, to) { | |
var $slides = $.deck('getSlides'); | |
var onLastSlide = from === $slides.length - 1; | |
var onFirstSlide = !from; | |
var goingForward = to > from; | |
if (onLastSlide && goingForward) { | |
event.preventDefault(); | |
$.deck('go', 0); | |
} |