sarahmei-slidedown 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,205 @@
1
+ /*
2
+ * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
3
+ *
4
+ * Uses the built in easing capabilities added In jQuery 1.1
5
+ * to offer multiple easing options
6
+ *
7
+ * TERMS OF USE - jQuery Easing
8
+ *
9
+ * Open source under the BSD License.
10
+ *
11
+ * Copyright © 2008 George McGinley Smith
12
+ * All rights reserved.
13
+ *
14
+ * Redistribution and use in source and binary forms, with or without modification,
15
+ * are permitted provided that the following conditions are met:
16
+ *
17
+ * Redistributions of source code must retain the above copyright notice, this list of
18
+ * conditions and the following disclaimer.
19
+ * Redistributions in binary form must reproduce the above copyright notice, this list
20
+ * of conditions and the following disclaimer in the documentation and/or other materials
21
+ * provided with the distribution.
22
+ *
23
+ * Neither the name of the author nor the names of contributors may be used to endorse
24
+ * or promote products derived from this software without specific prior written permission.
25
+ *
26
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
27
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
28
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
29
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
31
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
32
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
33
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
34
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
35
+ *
36
+ */
37
+
38
+ // t: current time, b: begInnIng value, c: change In value, d: duration
39
+ jQuery.easing['jswing'] = jQuery.easing['swing'];
40
+
41
+ jQuery.extend( jQuery.easing,
42
+ {
43
+ def: 'easeOutQuad',
44
+ swing: function (x, t, b, c, d) {
45
+ //alert(jQuery.easing.default);
46
+ return jQuery.easing[jQuery.easing.def](x, t, b, c, d);
47
+ },
48
+ easeInQuad: function (x, t, b, c, d) {
49
+ return c*(t/=d)*t + b;
50
+ },
51
+ easeOutQuad: function (x, t, b, c, d) {
52
+ return -c *(t/=d)*(t-2) + b;
53
+ },
54
+ easeInOutQuad: function (x, t, b, c, d) {
55
+ if ((t/=d/2) < 1) return c/2*t*t + b;
56
+ return -c/2 * ((--t)*(t-2) - 1) + b;
57
+ },
58
+ easeInCubic: function (x, t, b, c, d) {
59
+ return c*(t/=d)*t*t + b;
60
+ },
61
+ easeOutCubic: function (x, t, b, c, d) {
62
+ return c*((t=t/d-1)*t*t + 1) + b;
63
+ },
64
+ easeInOutCubic: function (x, t, b, c, d) {
65
+ if ((t/=d/2) < 1) return c/2*t*t*t + b;
66
+ return c/2*((t-=2)*t*t + 2) + b;
67
+ },
68
+ easeInQuart: function (x, t, b, c, d) {
69
+ return c*(t/=d)*t*t*t + b;
70
+ },
71
+ easeOutQuart: function (x, t, b, c, d) {
72
+ return -c * ((t=t/d-1)*t*t*t - 1) + b;
73
+ },
74
+ easeInOutQuart: function (x, t, b, c, d) {
75
+ if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
76
+ return -c/2 * ((t-=2)*t*t*t - 2) + b;
77
+ },
78
+ easeInQuint: function (x, t, b, c, d) {
79
+ return c*(t/=d)*t*t*t*t + b;
80
+ },
81
+ easeOutQuint: function (x, t, b, c, d) {
82
+ return c*((t=t/d-1)*t*t*t*t + 1) + b;
83
+ },
84
+ easeInOutQuint: function (x, t, b, c, d) {
85
+ if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
86
+ return c/2*((t-=2)*t*t*t*t + 2) + b;
87
+ },
88
+ easeInSine: function (x, t, b, c, d) {
89
+ return -c * Math.cos(t/d * (Math.PI/2)) + c + b;
90
+ },
91
+ easeOutSine: function (x, t, b, c, d) {
92
+ return c * Math.sin(t/d * (Math.PI/2)) + b;
93
+ },
94
+ easeInOutSine: function (x, t, b, c, d) {
95
+ return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
96
+ },
97
+ easeInExpo: function (x, t, b, c, d) {
98
+ return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
99
+ },
100
+ easeOutExpo: function (x, t, b, c, d) {
101
+ return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
102
+ },
103
+ easeInOutExpo: function (x, t, b, c, d) {
104
+ if (t==0) return b;
105
+ if (t==d) return b+c;
106
+ if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
107
+ return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
108
+ },
109
+ easeInCirc: function (x, t, b, c, d) {
110
+ return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;
111
+ },
112
+ easeOutCirc: function (x, t, b, c, d) {
113
+ return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
114
+ },
115
+ easeInOutCirc: function (x, t, b, c, d) {
116
+ if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;
117
+ return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;
118
+ },
119
+ easeInElastic: function (x, t, b, c, d) {
120
+ var s=1.70158;var p=0;var a=c;
121
+ if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;
122
+ if (a < Math.abs(c)) { a=c; var s=p/4; }
123
+ else var s = p/(2*Math.PI) * Math.asin (c/a);
124
+ return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
125
+ },
126
+ easeOutElastic: function (x, t, b, c, d) {
127
+ var s=1.70158;var p=0;var a=c;
128
+ if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;
129
+ if (a < Math.abs(c)) { a=c; var s=p/4; }
130
+ else var s = p/(2*Math.PI) * Math.asin (c/a);
131
+ return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
132
+ },
133
+ easeInOutElastic: function (x, t, b, c, d) {
134
+ var s=1.70158;var p=0;var a=c;
135
+ if (t==0) return b; if ((t/=d/2)==2) return b+c; if (!p) p=d*(.3*1.5);
136
+ if (a < Math.abs(c)) { a=c; var s=p/4; }
137
+ else var s = p/(2*Math.PI) * Math.asin (c/a);
138
+ if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
139
+ return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
140
+ },
141
+ easeInBack: function (x, t, b, c, d, s) {
142
+ if (s == undefined) s = 1.70158;
143
+ return c*(t/=d)*t*((s+1)*t - s) + b;
144
+ },
145
+ easeOutBack: function (x, t, b, c, d, s) {
146
+ if (s == undefined) s = 1.70158;
147
+ return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
148
+ },
149
+ easeInOutBack: function (x, t, b, c, d, s) {
150
+ if (s == undefined) s = 1.70158;
151
+ if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
152
+ return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
153
+ },
154
+ easeInBounce: function (x, t, b, c, d) {
155
+ return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b;
156
+ },
157
+ easeOutBounce: function (x, t, b, c, d) {
158
+ if ((t/=d) < (1/2.75)) {
159
+ return c*(7.5625*t*t) + b;
160
+ } else if (t < (2/2.75)) {
161
+ return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
162
+ } else if (t < (2.5/2.75)) {
163
+ return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
164
+ } else {
165
+ return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
166
+ }
167
+ },
168
+ easeInOutBounce: function (x, t, b, c, d) {
169
+ if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;
170
+ return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;
171
+ }
172
+ });
173
+
174
+ /*
175
+ *
176
+ * TERMS OF USE - EASING EQUATIONS
177
+ *
178
+ * Open source under the BSD License.
179
+ *
180
+ * Copyright © 2001 Robert Penner
181
+ * All rights reserved.
182
+ *
183
+ * Redistribution and use in source and binary forms, with or without modification,
184
+ * are permitted provided that the following conditions are met:
185
+ *
186
+ * Redistributions of source code must retain the above copyright notice, this list of
187
+ * conditions and the following disclaimer.
188
+ * Redistributions in binary form must reproduce the above copyright notice, this list
189
+ * of conditions and the following disclaimer in the documentation and/or other materials
190
+ * provided with the distribution.
191
+ *
192
+ * Neither the name of the author nor the names of contributors may be used to endorse
193
+ * or promote products derived from this software without specific prior written permission.
194
+ *
195
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
196
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
197
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
198
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
199
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
200
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
201
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
202
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
203
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
204
+ *
205
+ */
@@ -0,0 +1,14 @@
1
+ (function($) {
2
+ var currentHash = document.location.hash;
3
+
4
+ var checkHash = function checkAgain() {
5
+ var newHash = document.location.hash;
6
+ if (currentHash != newHash) {
7
+ currentHash = newHash;
8
+ $(document).trigger('hash.changed');
9
+ }
10
+ window.setTimeout(checkAgain, 10);
11
+ }
12
+
13
+ checkHash();
14
+ })(jQuery);
@@ -0,0 +1,93 @@
1
+ (function($) {
2
+ jQuery.easing.def = "easeOutQuart"; // For tweening
3
+
4
+ var allSlides = function() {
5
+ return $('#slides #track > div');
6
+ }
7
+
8
+ var slideDimensions = function() {
9
+ return {
10
+ width: $(window).width(),
11
+ height: $(window).height()
12
+ }
13
+ }
14
+
15
+ var getIndex = function() {
16
+ var index = document.location.hash.split('#')[1];
17
+ return Number(index);
18
+ }
19
+
20
+ var setIndex = function(idx) {
21
+ var newSlide = '#slide-' + idx;
22
+ if ($(newSlide).size() < 1) { return false; }
23
+ document.location.hash = '#' + idx;
24
+ }
25
+
26
+ var setSlideDimensions = function() {
27
+ var dimensions = slideDimensions();
28
+
29
+ $('#slides').height(dimensions.height);
30
+ $('#slides').width(dimensions.width);
31
+
32
+ allSlides().height(dimensions.height);
33
+ allSlides().width(dimensions.width);
34
+ }
35
+
36
+ var showCurrentSlide = function() {
37
+ var dimensions = slideDimensions();
38
+ var index = getIndex();
39
+ var offset = (index || 0) * dimensions.width;
40
+
41
+ $('#track').animate({ marginLeft: '-' + offset + 'px' }, 200);
42
+ }
43
+
44
+ var verticalAlign = function() {
45
+ var dimensions = slideDimensions();
46
+ var margin = (dimensions.height - $(this).height()) / 2;
47
+ $(this).css({ paddingTop: margin + 'px' });
48
+ }
49
+
50
+ var formatGist = function() {
51
+ $('.gist-meta').css({ fontSize: '12px' });
52
+ $('.gist .gist-file .gist-data pre').css({
53
+ padding: '0.4em',
54
+ overflow: 'hidden',
55
+ fontSize: '26px'
56
+ });
57
+
58
+ allSlides().find('.content').each(verticalAlign);
59
+ }
60
+
61
+ var adjustSlides = function() {
62
+ var dimensions = slideDimensions();
63
+
64
+ setSlideDimensions();
65
+ showCurrentSlide();
66
+
67
+ formatGist();
68
+ }
69
+
70
+ var move = function(event) {
71
+ var DIRECTIONS = {
72
+ 37: -1, // ARROW LEFT
73
+ 39: 1, // ARROW RIGHT
74
+ 32: 1, // SPACE BAR
75
+ 13: 1 // RETURN
76
+ }
77
+
78
+ if (dir = DIRECTIONS[event.which]) {
79
+ setIndex(getIndex() + dir);
80
+ }
81
+ }
82
+
83
+ $(window).bind('resize', function() { adjustSlides(); });
84
+ $(document).bind('keydown', move);
85
+ $(document).bind('hash.changed', adjustSlides);
86
+ $(document).ready(function() {
87
+ setIndex(getIndex() || 0);
88
+ $(this).trigger('hash.changed');
89
+ if (document.location.search.indexOf('notes') == 1) {
90
+ $('.notes').show();
91
+ }
92
+ });
93
+ })(jQuery);
@@ -0,0 +1,43 @@
1
+ <html>
2
+ <head>
3
+ <title>Slides</title>
4
+ <style type="text/css" media="screen">
5
+ <%= read('css/slides.css') %>
6
+ </style>
7
+ <% stylesheets.each do |style| %>
8
+ <style type="text/css" media="screen">
9
+ <%= style %>
10
+ </style>
11
+ <% end %>
12
+ <script type="text/javascript">
13
+ <%= read('js/jquery-1.3.2.js') %>
14
+ </script>
15
+ <script type="text/javascript" charset="utf-8">
16
+ <%= read('js/jquery.easing.js') %>
17
+ </script>
18
+ <script type="text/javascript" charset="utf-8">
19
+ <%= read('js/jquery.hash-changed.js') %>
20
+ </script>
21
+ <script type="text/javascript" charset="utf-8">
22
+ <%= read('js/slides.js') %>
23
+ </script>
24
+ <% jabascripts.each do |jaba| %>
25
+ <script type="text/javascript" charset="utf-8">
26
+ <%= jaba %>
27
+ </script>
28
+ <% end %>
29
+ </head>
30
+ <body>
31
+ <div id="slides">
32
+ <div id="track">
33
+ <% slides.each_with_index do |slide, idx| %>
34
+ <div class="<%= slide.classes.join(' ') %>">
35
+ <div id="slide-<%= idx %>" class="content">
36
+ <%= slide.html %>
37
+ </div>
38
+ </div>
39
+ <% end %>
40
+ </div>
41
+ </div>
42
+ </body>
43
+ </html>
data/vendor/albino.rb ADDED
@@ -0,0 +1,80 @@
1
+ ##
2
+ # Wrapper for the Pygments command line tool, pygmentize.
3
+ #
4
+ # Pygments: http://pygments.org/
5
+ #
6
+ # Assumes pygmentize is in the path. If not, set its location
7
+ # with Albino.bin = '/path/to/pygmentize'
8
+ #
9
+ # Use like so:
10
+ #
11
+ # @syntaxer = Albino.new('/some/file.rb', :ruby)
12
+ # puts @syntaxer.colorize
13
+ #
14
+ # This'll print out an HTMLized, Ruby-highlighted version
15
+ # of '/some/file.rb'.
16
+ #
17
+ # To use another formatter, pass it as the third argument:
18
+ #
19
+ # @syntaxer = Albino.new('/some/file.rb', :ruby, :bbcode)
20
+ # puts @syntaxer.colorize
21
+ #
22
+ # You can also use the #colorize class method:
23
+ #
24
+ # puts Albino.colorize('/some/file.rb', :ruby)
25
+ #
26
+ # Another also: you get a #to_s, for somewhat nicer use in Rails views.
27
+ #
28
+ # ... helper file ...
29
+ # def highlight(text)
30
+ # Albino.new(text, :ruby)
31
+ # end
32
+ #
33
+ # ... view file ...
34
+ # <%= highlight text %>
35
+ #
36
+ # The default lexer is 'text'. You need to specify a lexer yourself;
37
+ # because we are using STDIN there is no auto-detect.
38
+ #
39
+ # To see all lexers and formatters available, run `pygmentize -L`.
40
+ #
41
+ # Chris Wanstrath // chris@ozmm.org
42
+ # GitHub // http://github.com
43
+ #
44
+ require 'open4'
45
+
46
+ class Albino
47
+ @@bin = '/usr/local/bin/pygmentize'
48
+
49
+ def self.bin=(path)
50
+ @@bin = path
51
+ end
52
+
53
+ def self.colorize(*args)
54
+ new(*args).colorize
55
+ end
56
+
57
+ def initialize(target, lexer = :ruby, format = :html)
58
+ @target = File.exists?(target) ? File.read(target) : target rescue target
59
+ @options = { :l => lexer, :f => format }
60
+ end
61
+
62
+ def execute(command)
63
+ pid, stdin, stdout, stderr = Open4.popen4(command)
64
+ stdin.puts @target
65
+ stdin.close
66
+ stdout.read.strip
67
+ end
68
+
69
+ def colorize(options = {})
70
+ execute @@bin + convert_options(options)
71
+ end
72
+ alias_method :to_s, :colorize
73
+
74
+ def convert_options(options = {})
75
+ @options.merge(options).inject('') do |string, (flag, value)|
76
+ string + " -#{flag} #{value}" if value
77
+ string
78
+ end
79
+ end
80
+ end
metadata ADDED
@@ -0,0 +1,89 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sarahmei-slidedown
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.7
5
+ platform: ruby
6
+ authors:
7
+ - Pat Nakajima
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-03-10 00:00:00 -07:00
13
+ default_executable: slidedown
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: maruku
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: "0"
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: nokogiri
27
+ type: :runtime
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: "0"
34
+ version:
35
+ description:
36
+ email:
37
+ executables:
38
+ - slidedown
39
+ extensions: []
40
+
41
+ extra_rdoc_files: []
42
+
43
+ files:
44
+ - bin/
45
+ - bin/slidedown
46
+ - lib/
47
+ - lib/slide.rb
48
+ - lib/slidedown.rb
49
+ - README.md
50
+ - templates/css
51
+ - templates/css/screen.css
52
+ - templates/css/slides.css
53
+ - templates/js
54
+ - templates/js/jquery-1.3.2.js
55
+ - templates/js/jquery.easing.js
56
+ - templates/js/jquery.hash-changed.js
57
+ - templates/js/slides.js
58
+ - templates/template.erb
59
+ - vendor
60
+ - vendor/albino.rb
61
+ has_rdoc: false
62
+ homepage:
63
+ post_install_message:
64
+ rdoc_options: []
65
+
66
+ require_paths:
67
+ - lib
68
+ - vendor
69
+ required_ruby_version: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ version: "0"
74
+ version:
75
+ required_rubygems_version: !ruby/object:Gem::Requirement
76
+ requirements:
77
+ - - ">="
78
+ - !ruby/object:Gem::Version
79
+ version: "0"
80
+ version:
81
+ requirements: []
82
+
83
+ rubyforge_project:
84
+ rubygems_version: 1.2.0
85
+ signing_key:
86
+ specification_version: 2
87
+ summary: Create slides with Markdown
88
+ test_files: []
89
+