slide-em-up 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.md CHANGED
@@ -9,6 +9,7 @@ TODO
9
9
  ----
10
10
 
11
11
  * Add specs :p
12
+ * https://github.com/rubygems/rubygems-test/blob/master/README.txt
12
13
  * Explain how to install and use it in README
13
14
  * Many more things
14
15
 
@@ -1,3 +1,3 @@
1
1
  module SlideEmUp
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
@@ -0,0 +1,2 @@
1
+ This theme was created by Hakim El Hattab:
2
+ http://hakim.se/experiments/css3-3d-slideshow
@@ -0,0 +1,209 @@
1
+ /**
2
+ * @author Hakim El Hattab
3
+ */
4
+
5
+
6
+ /*********************************************
7
+ * FONT-FACE DEFINITIONS
8
+ *********************************************/
9
+
10
+ @font-face {
11
+ font-family: 'League Gothic';
12
+ src: url('/fonts/league_gothic-webfont.ttf') format('truetype');
13
+ font-weight: normal;
14
+ font-style: normal;
15
+ }
16
+
17
+
18
+ /*********************************************
19
+ * GLOBAL STYLES
20
+ *********************************************/
21
+
22
+ html, body {
23
+ padding: 0;
24
+ margin: 0;
25
+ overflow: hidden;
26
+
27
+ font-family: 'Crimson Text', Times, 'Times New Roman', serif;
28
+ font-size: 36px;
29
+
30
+ background: #fff;
31
+ color: #222;
32
+
33
+ width: 100%;
34
+ height: 100%;
35
+
36
+ background-image: -webkit-gradient(
37
+ radial,
38
+ 50% 50%, 0,
39
+ 50% 50%, 1000,
40
+ from(rgba(245,245,245,1.0)),
41
+ to(rgba(100,100,100,1.0))
42
+ );
43
+
44
+ background-image: -moz-radial-gradient(
45
+ 50% 50% 90deg,
46
+ rgba(245,245,245,1.0) 0%,
47
+ rgba(100,100,100,1.0) 100%
48
+ );
49
+
50
+ }
51
+
52
+
53
+ /*********************************************
54
+ * HEADERS
55
+ *********************************************/
56
+ h1, h2, h3, h4 {
57
+ margin: 0 0 20px 0;
58
+ font-family: 'League Gothic', Arial, Helvetica, sans-serif;
59
+ line-height: 0.9em;
60
+ letter-spacing: 0.02em;
61
+ text-transform: uppercase;
62
+ color: #222;
63
+ text-shadow: 0px 0px 2px #fff, 0px 0px 4px #bbb;
64
+ }
65
+
66
+ h1 { font-size: 136px; }
67
+ h2 { font-size: 76px; }
68
+ h3 { font-size: 56px; }
69
+ h4 { font-size: 36px; }
70
+
71
+ h1.inverted,
72
+ h2.inverted,
73
+ h3.inverted,
74
+ h4.inverted {
75
+ color: #fff;
76
+ text-shadow: 0px 0px 2px #fff, 0px 0px 2px #888;
77
+ }
78
+
79
+
80
+ /*********************************************
81
+ * SLIDES
82
+ *********************************************/
83
+ #main {
84
+ position: absolute;
85
+ width: 1024px;
86
+ height: 768px;
87
+
88
+ left: 50%;
89
+ top: 50%;
90
+ margin-left: -512px;
91
+ margin-top: -320px;
92
+
93
+ text-align: center;
94
+
95
+ -webkit-perspective: 600px;
96
+ -webkit-perspective-origin: 50% 25%;
97
+ }
98
+
99
+ #main>section,
100
+ #main>section>section {
101
+ display: none;
102
+
103
+ position: absolute;
104
+ width: 100%;
105
+ min-height: 600px;
106
+
107
+ -webkit-transform-style: preserve-3d;
108
+
109
+ -webkit-transition: all 800ms cubic-bezier(0.260, 0.860, 0.440, 0.985);
110
+ -moz-transition: all 800ms cubic-bezier(0.260, 0.860, 0.440, 0.985);
111
+ -o-transition: all 800ms cubic-bezier(0.260, 0.860, 0.440, 0.985);
112
+ transition: all 800ms cubic-bezier(0.260, 0.860, 0.440, 0.985);
113
+ }
114
+
115
+ #main section.past {
116
+ display: block;
117
+ opacity: 0;
118
+
119
+ -webkit-transform: translate3d(-100%, 0, 0)
120
+ rotateY(-90deg)
121
+ translate3d(-100%, 0, 0);
122
+ }
123
+
124
+ #main section.present {
125
+ display: block;
126
+ }
127
+
128
+ #main section.future {
129
+ display: block;
130
+ opacity: 0;
131
+
132
+ -webkit-transform: translate3d(100%, 0, 0)
133
+ rotateY(90deg)
134
+ translate3d(100%, 0, 0);
135
+ }
136
+
137
+ #main section>section.past {
138
+ display: block;
139
+ opacity: 0;
140
+
141
+ -webkit-transform: translate3d(0, -50%, 0)
142
+ rotateX(70deg)
143
+ translate3d(0, -50%, 0);
144
+ }
145
+ #main section>section.future {
146
+ display: block;
147
+ opacity: 0;
148
+
149
+ -webkit-transform: translate3d(0, 50%, 0)
150
+ rotateX(-70deg)
151
+ translate3d(0, 50%, 0);
152
+ }
153
+
154
+
155
+ /*********************************************
156
+ * DEFAULT ELEMENT STYLES
157
+ *********************************************/
158
+
159
+ #main>section {
160
+ line-height: 1.2em;
161
+ text-shadow: 0px 0px 2px #fff, 0px 0px 4px #bbb;
162
+ font-weight: 600;
163
+ }
164
+
165
+ ol {
166
+ list-style: decimal;
167
+ list-style-position: inside;
168
+ }
169
+
170
+ li, p {
171
+ margin-bottom: 10px;
172
+ }
173
+
174
+ a:not(.image) {
175
+ color: #1b6263;
176
+ text-decoration: none;
177
+ border-bottom: 1px dashed rgba(0,0,0,0.3);
178
+ padding: 1px 3px;
179
+ }
180
+
181
+ a:not(.image):hover {
182
+ color: #fff;
183
+ background: #2fa794;
184
+ text-shadow: none;
185
+ border: none;
186
+ }
187
+
188
+ img {
189
+ margin: 30px 0 0 0;
190
+ background: rgba(255,255,255,0.12);
191
+ border: 4px solid #eee;
192
+
193
+ -webkit-box-shadow: 0 0 10px rgba(0, 0, 0, 0.15);
194
+ -moz-box-shadow: 0 0 10px rgba(0, 0, 0, 0.15);
195
+ box-shadow: 0 0 10px rgba(0, 0, 0, 0.15);
196
+
197
+ -webkit-transition: all .11s linear;
198
+ -moz-transition: all .11s linear;
199
+ -o-transition: all .11s linear;
200
+ transition: all .11s linear;
201
+ }
202
+
203
+ a.image:hover img {
204
+ background: rgba(255,255,255,0.2);
205
+
206
+ -webkit-box-shadow: 0 0 20px rgba(0, 0, 0, 0.25);
207
+ -moz-box-shadow: 0 0 20px rgba(0, 0, 0, 0.25);
208
+ box-shadow: 0 0 20px rgba(0, 0, 0, 0.25);
209
+ }
@@ -0,0 +1,57 @@
1
+ /* http://meyerweb.com/eric/tools/css/reset/
2
+ v2.0 | 20110126
3
+ License: none (public domain)
4
+ */
5
+
6
+ html, body, div, span, applet, object, iframe,
7
+ h1, h2, h3, h4, h5, h6, p, blockquote, pre,
8
+ a, abbr, acronym, address, big, cite, code,
9
+ del, dfn, em, img, ins, kbd, q, s, samp,
10
+ small, strike, strong, sub, sup, tt, var,
11
+ b, u, i, center,
12
+ dl, dt, dd, ol, ul, li,
13
+ fieldset, form, label, legend,
14
+ table, caption, tbody, tfoot, thead, tr, th, td,
15
+ article, aside, canvas, details, embed,
16
+ figure, figcaption, footer, header, hgroup,
17
+ menu, nav, output, ruby, section, summary,
18
+ time, mark, audio, video {
19
+ margin: 0;
20
+ padding: 0;
21
+ border: 0;
22
+ font-size: 100%;
23
+ font: inherit;
24
+ vertical-align: baseline;
25
+ }
26
+ /* HTML5 display-role reset for older browsers */
27
+ article, aside, details, figcaption, figure,
28
+ footer, header, hgroup, menu, nav, section {
29
+ display: block;
30
+ }
31
+ body {
32
+ line-height: 1;
33
+ }
34
+ ol, ul {
35
+ list-style: none;
36
+ }
37
+ blockquote, q {
38
+ quotes: none;
39
+ }
40
+ blockquote:before, blockquote:after,
41
+ q:before, q:after {
42
+ content: '';
43
+ content: none;
44
+ }
45
+ table {
46
+ border-collapse: collapse;
47
+ border-spacing: 0;
48
+ }
49
+
50
+
51
+ /* HTML5BP:
52
+ These selection declarations have to be separate.
53
+ No text-shadow: twitter.com/miketaylr/status/12228805301
54
+ Also: hot pink. */
55
+ ::-moz-selection{ background: #FF5E99; color:#fff; text-shadow: none; }
56
+ ::selection { background:#FF5E99; color:#fff; text-shadow: none; }
57
+
@@ -0,0 +1,24 @@
1
+ <!doctype html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title><%= meta.title %></title>
6
+ <link href='http://fonts.googleapis.com/css?family=Crimson+Text:regular,600,bold' rel='stylesheet' type='text/css'>
7
+ <link rel="stylesheet" href="/css/reset.css">
8
+ <link rel="stylesheet" href="/css/main.css">
9
+ </head>
10
+ <body>
11
+ <div id="main">
12
+ <% sections.each do |section| %>
13
+ <section id="section-<%= section.number %>">
14
+ <% section.slides.each do |slide| %>
15
+ <section id="slide-<%= section.number %>-<%= slide.number%>" class="<%= slide.classes %>">
16
+ <%= slide.html %>
17
+ </section>
18
+ <% end %>
19
+ </section>
20
+ <% end %>
21
+ </div>
22
+ <script src="/js/slideshow.js"></script>
23
+ </body>
24
+ </html>
@@ -0,0 +1,259 @@
1
+ /**
2
+ * Handles the very minimal navigation logic involved
3
+ * in the slideshow. Including keyboard navigation, touch
4
+ * interaction and URL history behavior.
5
+ *
6
+ * Slides are given unique hash based URL's so that they can
7
+ * be opened directly. I didn't use the HTML5 History API for
8
+ * this as it would have required the addition of server side
9
+ * rewrite rules and hence require more effort for anyone to
10
+ * set up.
11
+ *
12
+ * This component can be called from other scripts via a
13
+ * tiny API:
14
+ * ● Slideshow.navigateTo( indexh, indexv );
15
+ * ● Slideshow.navigateLeft();
16
+ * ● Slideshow.navigateRight();
17
+ * ● Slideshow.navigateUp();
18
+ * ● Slideshow.navigateDown();
19
+ *
20
+ *
21
+ * version 0.1:
22
+ * ● First release
23
+ *
24
+ * version 0.2:
25
+ * ● Refactored code and added inline documentation
26
+ * ● Slides now have unique URL's
27
+ * ● A basic API to invoke navigation was added
28
+ *
29
+ *
30
+ * @author Hakim El Hattab
31
+ * @version 0.2
32
+ */
33
+ var Slideshow = (function(){
34
+
35
+ var indexh = 0,
36
+ indexv = 0;
37
+
38
+ /**
39
+ * Activates the main program logic.
40
+ */
41
+ function initialize() {
42
+ document.addEventListener('keydown', onDocumentKeyDown, false);
43
+ document.addEventListener('touchstart', onDocumentTouchStart, false);
44
+ window.addEventListener('hashchange', onWindowHashChange, false);
45
+
46
+ // Read the initial state of the URL (hash)
47
+ readURL();
48
+ }
49
+
50
+ /**
51
+ * Handler for the document level 'keydown' event.
52
+ *
53
+ * @param {Object} event
54
+ */
55
+ function onDocumentKeyDown( event ) {
56
+
57
+ if( event.keyCode >= 37 && event.keyCode <= 40 ) {
58
+
59
+ switch( event.keyCode ) {
60
+ case 37: navigateLeft(); break; // left
61
+ case 39: navigateRight(); break; // right
62
+ case 38: navigateUp(); break; // up
63
+ case 40: navigateDown(); break; // down
64
+ }
65
+
66
+ slide();
67
+
68
+ event.preventDefault();
69
+
70
+ }
71
+ }
72
+
73
+ /**
74
+ * Handler for the document level 'touchstart' event.
75
+ *
76
+ * This enables very basic tap interaction for touch
77
+ * devices. Added mainly for performance testing of 3D
78
+ * transforms on iOS but was so happily surprised with
79
+ * how smoothly it runs so I left it in here. Apple +1
80
+ *
81
+ * @param {Object} event
82
+ */
83
+ function onDocumentTouchStart( event ) {
84
+
85
+ // We're only interested in one point taps
86
+ if (event.touches.length == 1) {
87
+ event.preventDefault();
88
+
89
+ var point = {
90
+ x: event.touches[0].clientX,
91
+ y: event.touches[0].clientY
92
+ };
93
+
94
+ // Define the extent of the areas that may be tapped
95
+ // to navigate
96
+ var wt = window.innerWidth * 0.3;
97
+ var ht = window.innerHeight * 0.3;
98
+
99
+ if( point.x < wt ) {
100
+ navigateLeft();
101
+ }
102
+ else if( point.x > window.innerWidth - wt ) {
103
+ navigateRight();
104
+ }
105
+ else if( point.y < ht ) {
106
+ navigateUp();
107
+ }
108
+ else if( point.y > window.innerHeight - ht ) {
109
+ navigateDown();
110
+ }
111
+
112
+ slide();
113
+
114
+ }
115
+ }
116
+
117
+
118
+ /**
119
+ * Handler for the window level 'hashchange' event.
120
+ *
121
+ * @param {Object} event
122
+ */
123
+ function onWindowHashChange( event ) {
124
+ readURL();
125
+ }
126
+
127
+ /**
128
+ * Updates one dimension of slides by showing the slide
129
+ * with the specified index.
130
+ *
131
+ * @param {String} selector A CSS selector that will fetch
132
+ * the group of slides we are working with
133
+ * @param {uint} index The index of the slide that should be
134
+ * shown
135
+ *
136
+ * @return {uint} The index of the slide that is now shown,
137
+ * might differ from the passed in index if it was out of
138
+ * bounds.
139
+ */
140
+ function updateSlides( selector, index ) {
141
+
142
+ // Select all slides and convert the NodeList result to
143
+ // an array
144
+ var slides = Array.prototype.slice.call( document.querySelectorAll( selector ) );
145
+
146
+ if( slides.length ) {
147
+ // Enforce max and minimum index bounds
148
+ index = Math.max(Math.min(index, slides.length - 1), 0);
149
+
150
+ slides[index].setAttribute('class', 'present');
151
+
152
+ // Any element previous to index is given the 'past' class
153
+ slides.slice(0, index).map(function(element){
154
+ element.setAttribute('class', 'past');
155
+ });
156
+
157
+ // Any element subsequent to index is given the 'future' class
158
+ slides.slice(index + 1).map(function(element){
159
+ element.setAttribute('class', 'future');
160
+ });
161
+ }
162
+ else {
163
+ // Since there are no slides we can't be anywhere beyond the
164
+ // zeroth index
165
+ index = 0;
166
+ }
167
+
168
+ return index;
169
+
170
+ }
171
+
172
+ /**
173
+ * Updates the visual slides to represent the currently
174
+ * set indices.
175
+ */
176
+ function slide() {
177
+ indexh = updateSlides( '#main>section', indexh );
178
+ indexv = updateSlides( 'section.present>section', indexv );
179
+
180
+ writeURL();
181
+ }
182
+
183
+ /**
184
+ * Reads the current URL (hash) and navigates accordingly.
185
+ */
186
+ function readURL() {
187
+ // Break the hash down to separate components
188
+ var bits = window.location.hash.slice(2).split('/');
189
+
190
+ // Read the index components of the hash
191
+ indexh = bits[0] ? parseInt( bits[0] ) : 0;
192
+ indexv = bits[1] ? parseInt( bits[1] ) : 0;
193
+
194
+ navigateTo( indexh, indexv );
195
+ }
196
+
197
+ /**
198
+ * Updates the page URL (hash) to reflect the current
199
+ * navigational state.
200
+ */
201
+ function writeURL() {
202
+ var url = '/';
203
+
204
+ // Only include the minimum possible number of components in
205
+ // the URL
206
+ if( indexh > 0 || indexv > 0 ) url += indexh
207
+ if( indexv > 0 ) url += '/' + indexv
208
+
209
+ window.location.hash = url;
210
+ }
211
+
212
+ /**
213
+ * Triggers a navigation to the specified indices.
214
+ *
215
+ * @param {uint} h The horizontal index of the slide to show
216
+ * @param {uint} v The vertical index of the slide to show
217
+ */
218
+ function navigateTo( h, v ) {
219
+ indexh = h === undefined ? indexh : h;
220
+ indexv = v === undefined ? indexv : v;
221
+
222
+ slide();
223
+ }
224
+
225
+ function navigateLeft() {
226
+ indexh --;
227
+ indexv = 0;
228
+ slide();
229
+ }
230
+ function navigateRight() {
231
+ indexh ++;
232
+ indexv = 0;
233
+ slide();
234
+ }
235
+ function navigateUp() {
236
+ indexv --;
237
+ slide();
238
+ }
239
+ function navigateDown() {
240
+ indexv ++;
241
+ slide();
242
+ }
243
+
244
+ // Initialize the program. Done right before returning to ensure
245
+ // that any inline variable definitions are available to all
246
+ // functions
247
+ initialize();
248
+
249
+ // Expose some methods publicly
250
+ return {
251
+ navigateTo: navigateTo,
252
+ navigateLeft: navigateLeft,
253
+ navigateRight: navigateRight,
254
+ navigateUp: navigateUp,
255
+ navigateDown: navigateDown
256
+ };
257
+
258
+ })();
259
+
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slide-em-up
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 31
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 1
10
- version: 0.1.1
9
+ - 2
10
+ version: 0.1.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Bruno Michel
@@ -95,8 +95,8 @@ dependencies:
95
95
  version_requirements: *id005
96
96
  description: Slide'em up is a presentation tool that displays markdown-formatted slides
97
97
  email: bruno.michel@af83.com
98
- executables: []
99
-
98
+ executables:
99
+ - slide-em-up
100
100
  extensions: []
101
101
 
102
102
  extra_rdoc_files:
@@ -111,6 +111,12 @@ files:
111
111
  - lib/slide-em-up/assets_api.rb
112
112
  - lib/slide-em-up/presentation.rb
113
113
  - lib/slide-em-up/version.rb
114
+ - themes/3d_slideshow/fonts/league_gothic-webfont.ttf
115
+ - themes/3d_slideshow/js/slideshow.js
116
+ - themes/3d_slideshow/css/main.css
117
+ - themes/3d_slideshow/css/reset.css
118
+ - themes/3d_slideshow/README
119
+ - themes/3d_slideshow/index.nlt
114
120
  has_rdoc: true
115
121
  homepage: http://github.com/nono/slide-em-up
116
122
  licenses: []