showoff 0.7.0 → 0.9.7

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.
Files changed (48) hide show
  1. checksums.yaml +7 -0
  2. data/README.rdoc +53 -475
  3. data/Rakefile +17 -18
  4. data/bin/showoff +29 -7
  5. data/lib/commandline_parser.rb +1 -1
  6. data/lib/showoff/version.rb +3 -0
  7. data/lib/showoff.rb +600 -91
  8. data/lib/showoff_utils.rb +110 -4
  9. data/public/css/disconnected-large.png +0 -0
  10. data/public/css/disconnected.png +0 -0
  11. data/public/css/fast.png +0 -0
  12. data/public/css/grippy-close.png +0 -0
  13. data/public/css/grippy.png +0 -0
  14. data/public/css/onepage.css +6 -0
  15. data/public/css/pace.png +0 -0
  16. data/public/css/paceMarker.png +0 -0
  17. data/public/css/presenter.css +333 -43
  18. data/public/css/sh_style.css +15 -0
  19. data/public/css/showoff.css +373 -48
  20. data/public/css/slow.png +0 -0
  21. data/public/css/spinner.gif +0 -0
  22. data/public/css/tipsy.css +26 -0
  23. data/public/favicon.ico +0 -0
  24. data/public/js/jquery.parsequery.min.js +2 -0
  25. data/public/js/jquery.tipsy.js +260 -0
  26. data/public/js/onepage.js +2 -3
  27. data/public/js/presenter.js +384 -33
  28. data/public/js/sh_lang/sh_gherkin.js +112 -0
  29. data/public/js/sh_lang/sh_gherkin.min.js +1 -0
  30. data/public/js/sh_lang/sh_ini.js +87 -0
  31. data/public/js/sh_lang/sh_ini.min.js +87 -0
  32. data/public/js/sh_lang/sh_puppet.js +182 -0
  33. data/public/js/sh_lang/sh_puppet.min.js +182 -0
  34. data/public/js/sh_lang/sh_puppet_output.js +22 -0
  35. data/public/js/sh_lang/sh_puppet_output.min.js +22 -0
  36. data/public/js/sh_lang/sh_shell.min.js +1 -0
  37. data/public/js/showoff.js +423 -51
  38. data/views/404.erb +19 -0
  39. data/views/download.erb +36 -0
  40. data/views/header.erb +35 -25
  41. data/views/header_mini.erb +22 -0
  42. data/views/index.erb +46 -1
  43. data/views/onepage.erb +35 -14
  44. data/views/presenter.erb +63 -21
  45. data/views/stats.erb +73 -0
  46. metadata +170 -131
  47. data/public/css/960.css +0 -653
  48. data/public/css/pdf.css +0 -12
@@ -0,0 +1,260 @@
1
+ // tipsy, facebook style tooltips for jquery
2
+ // version 1.0.0a
3
+ // (c) 2008-2010 jason frame [jason@onehackoranother.com]
4
+ // released under the MIT license
5
+
6
+ (function($) {
7
+
8
+ function maybeCall(thing, ctx) {
9
+ return (typeof thing == 'function') ? (thing.call(ctx)) : thing;
10
+ };
11
+
12
+ function isElementInDOM(ele) {
13
+ while (ele = ele.parentNode) {
14
+ if (ele == document) return true;
15
+ }
16
+ return false;
17
+ };
18
+
19
+ function Tipsy(element, options) {
20
+ this.$element = $(element);
21
+ this.options = options;
22
+ this.enabled = true;
23
+ this.fixTitle();
24
+ };
25
+
26
+ Tipsy.prototype = {
27
+ show: function() {
28
+ var title = this.getTitle();
29
+ if (title && this.enabled) {
30
+ var $tip = this.tip();
31
+
32
+ $tip.find('.tipsy-inner')[this.options.html ? 'html' : 'text'](title);
33
+ $tip.find('.tipsy-inner').css('width', this.options.width);
34
+ $tip[0].className = 'tipsy'; // reset classname in case of dynamic gravity
35
+ $tip.remove().css({top: 0, left: 0, visibility: 'hidden', display: 'block'}).prependTo(document.body);
36
+
37
+ var pos = $.extend({}, this.$element.offset(), {
38
+ width: this.$element[0].offsetWidth,
39
+ height: this.$element[0].offsetHeight
40
+ });
41
+
42
+ var actualWidth = $tip[0].offsetWidth,
43
+ actualHeight = $tip[0].offsetHeight,
44
+ gravity = maybeCall(this.options.gravity, this.$element[0]);
45
+
46
+ var tp;
47
+ switch (gravity.charAt(0)) {
48
+ case 'n':
49
+ tp = {top: pos.top + pos.height + this.options.offset, left: pos.left + pos.width / 2 - actualWidth / 2};
50
+ break;
51
+ case 's':
52
+ tp = {top: pos.top - actualHeight - this.options.offset, left: pos.left + pos.width / 2 - actualWidth / 2};
53
+ break;
54
+ case 'e':
55
+ tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth - this.options.offset};
56
+ break;
57
+ case 'w':
58
+ tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width + this.options.offset};
59
+ break;
60
+ }
61
+
62
+ if (gravity.length == 2) {
63
+ if (gravity.charAt(1) == 'w') {
64
+ tp.left = pos.left + pos.width / 2 - 15;
65
+ } else {
66
+ tp.left = pos.left + pos.width / 2 - actualWidth + 15;
67
+ }
68
+ }
69
+
70
+ $tip.css(tp).addClass('tipsy-' + gravity);
71
+ $tip.find('.tipsy-arrow')[0].className = 'tipsy-arrow tipsy-arrow-' + gravity.charAt(0);
72
+ if (this.options.className) {
73
+ $tip.addClass(maybeCall(this.options.className, this.$element[0]));
74
+ }
75
+
76
+ if (this.options.fade) {
77
+ $tip.stop().css({opacity: 0, display: 'block', visibility: 'visible'}).animate({opacity: this.options.opacity});
78
+ } else {
79
+ $tip.css({visibility: 'visible', opacity: this.options.opacity});
80
+ }
81
+ }
82
+ },
83
+
84
+ hide: function() {
85
+ if (this.options.fade) {
86
+ this.tip().stop().fadeOut(function() { $(this).remove(); });
87
+ } else {
88
+ this.tip().remove();
89
+ }
90
+ },
91
+
92
+ fixTitle: function() {
93
+ var $e = this.$element;
94
+ if ($e.attr('title') || typeof($e.attr('original-title')) != 'string') {
95
+ $e.attr('original-title', $e.attr('title') || '').removeAttr('title');
96
+ }
97
+ },
98
+
99
+ getTitle: function() {
100
+ var title, $e = this.$element, o = this.options;
101
+ this.fixTitle();
102
+ var title, o = this.options;
103
+ if (typeof o.title == 'string') {
104
+ title = $e.attr(o.title == 'title' ? 'original-title' : o.title);
105
+ } else if (typeof o.title == 'function') {
106
+ title = o.title.call($e[0]);
107
+ }
108
+ title = ('' + title).replace(/(^\s*|\s*$)/, "");
109
+ return title || o.fallback;
110
+ },
111
+
112
+ tip: function() {
113
+ if (!this.$tip) {
114
+ this.$tip = $('<div class="tipsy"></div>').html('<div class="tipsy-arrow"></div><div class="tipsy-inner"></div>');
115
+ this.$tip.data('tipsy-pointee', this.$element[0]);
116
+ }
117
+ return this.$tip;
118
+ },
119
+
120
+ validate: function() {
121
+ if (!this.$element[0].parentNode) {
122
+ this.hide();
123
+ this.$element = null;
124
+ this.options = null;
125
+ }
126
+ },
127
+
128
+ enable: function() { this.enabled = true; },
129
+ disable: function() { this.enabled = false; },
130
+ toggleEnabled: function() { this.enabled = !this.enabled; }
131
+ };
132
+
133
+ $.fn.tipsy = function(options) {
134
+
135
+ if (options === true) {
136
+ return this.data('tipsy');
137
+ } else if (typeof options == 'string') {
138
+ var tipsy = this.data('tipsy');
139
+ if (tipsy) tipsy[options]();
140
+ return this;
141
+ }
142
+
143
+ options = $.extend({}, $.fn.tipsy.defaults, options);
144
+
145
+ function get(ele) {
146
+ var tipsy = $.data(ele, 'tipsy');
147
+ if (!tipsy) {
148
+ tipsy = new Tipsy(ele, $.fn.tipsy.elementOptions(ele, options));
149
+ $.data(ele, 'tipsy', tipsy);
150
+ }
151
+ return tipsy;
152
+ }
153
+
154
+ function enter() {
155
+ var tipsy = get(this);
156
+ tipsy.hoverState = 'in';
157
+ if (options.delayIn == 0) {
158
+ tipsy.show();
159
+ } else {
160
+ tipsy.fixTitle();
161
+ setTimeout(function() { if (tipsy.hoverState == 'in') tipsy.show(); }, options.delayIn);
162
+ }
163
+ };
164
+
165
+ function leave() {
166
+ var tipsy = get(this);
167
+ tipsy.hoverState = 'out';
168
+ if (options.delayOut == 0) {
169
+ tipsy.hide();
170
+ } else {
171
+ setTimeout(function() { if (tipsy.hoverState == 'out') tipsy.hide(); }, options.delayOut);
172
+ }
173
+ };
174
+
175
+ if (!options.live) this.each(function() { get(this); });
176
+
177
+ if (options.trigger != 'manual') {
178
+ var binder = options.live ? 'live' : 'bind',
179
+ eventIn = options.trigger == 'hover' ? 'mouseenter' : 'focus',
180
+ eventOut = options.trigger == 'hover' ? 'mouseleave' : 'blur';
181
+ this[binder](eventIn, enter)[binder](eventOut, leave);
182
+ }
183
+
184
+ return this;
185
+
186
+ };
187
+
188
+ $.fn.tipsy.defaults = {
189
+ className: null,
190
+ delayIn: 0,
191
+ delayOut: 0,
192
+ fade: false,
193
+ fallback: '',
194
+ gravity: 'n',
195
+ html: false,
196
+ live: false,
197
+ offset: 0,
198
+ opacity: 0.8,
199
+ title: 'title',
200
+ trigger: 'hover',
201
+ width: 200
202
+ };
203
+
204
+ $.fn.tipsy.revalidate = function() {
205
+ $('.tipsy').each(function() {
206
+ var pointee = $.data(this, 'tipsy-pointee');
207
+ if (!pointee || !isElementInDOM(pointee)) {
208
+ $(this).remove();
209
+ }
210
+ });
211
+ };
212
+
213
+ // Overwrite this method to provide options on a per-element basis.
214
+ // For example, you could store the gravity in a 'tipsy-gravity' attribute:
215
+ // return $.extend({}, options, {gravity: $(ele).attr('tipsy-gravity') || 'n' });
216
+ // (remember - do not modify 'options' in place!)
217
+ $.fn.tipsy.elementOptions = function(ele, options) {
218
+ return $.metadata ? $.extend({}, options, $(ele).metadata()) : options;
219
+ };
220
+
221
+ $.fn.tipsy.autoNS = function() {
222
+ return $(this).offset().top > ($(document).scrollTop() + $(window).height() / 2) ? 's' : 'n';
223
+ };
224
+
225
+ $.fn.tipsy.autoWE = function() {
226
+ return $(this).offset().left > ($(document).scrollLeft() + $(window).width() / 2) ? 'e' : 'w';
227
+ };
228
+
229
+ /**
230
+ * yields a closure of the supplied parameters, producing a function that takes
231
+ * no arguments and is suitable for use as an autogravity function like so:
232
+ *
233
+ * @param margin (int) - distance from the viewable region edge that an
234
+ * element should be before setting its tooltip's gravity to be away
235
+ * from that edge.
236
+ * @param prefer (string, e.g. 'n', 'sw', 'w') - the direction to prefer
237
+ * if there are no viewable region edges effecting the tooltip's
238
+ * gravity. It will try to vary from this minimally, for example,
239
+ * if 'sw' is preferred and an element is near the right viewable
240
+ * region edge, but not the top edge, it will set the gravity for
241
+ * that element's tooltip to be 'se', preserving the southern
242
+ * component.
243
+ */
244
+ $.fn.tipsy.autoBounds = function(margin, prefer) {
245
+ return function() {
246
+ var dir = {ns: prefer[0], ew: (prefer.length > 1 ? prefer[1] : false)},
247
+ boundTop = $(document).scrollTop() + margin,
248
+ boundLeft = $(document).scrollLeft() + margin,
249
+ $this = $(this);
250
+
251
+ if ($this.offset().top < boundTop) dir.ns = 'n';
252
+ if ($this.offset().left < boundLeft) dir.ew = 'w';
253
+ if ($(window).width() + $(document).scrollLeft() - $this.offset().left < margin) dir.ew = 'e';
254
+ if ($(window).height() + $(document).scrollTop() - $this.offset().top < margin) dir.ns = 's';
255
+
256
+ return dir.ns + (dir.ew ? dir.ew : '');
257
+ }
258
+ };
259
+
260
+ })(jQuery);
data/public/js/onepage.js CHANGED
@@ -1,5 +1,4 @@
1
1
  function setupOnePage() {
2
- sh_highlightDocument('/js/sh_lang/', '.min.js')
3
-
2
+ sh_highlightDocument('/js/sh_lang/', '.min.js');
4
3
  centerSlides($("#slides > .slide"))
5
- }
4
+ }