showoff 0.2.3 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -244,9 +244,17 @@ So far, ShowOff has been used in the following presentations:
244
244
  http://github.com/Sutto/roro-perth-rails-3
245
245
  * PDXRB Tech Talk - Here's Sinatra - Jesse Cooke
246
246
  http://github.com/jc00ke/pdxrb_sinatra
247
+ * Red Dirt Ruby Conference May 2010 - Plain Old Tokyo Storage - Jeremy Hinegardner
248
+ http://github.com/copiousfreetime/plain-old-tokyo-storage-presentation
249
+ http://plain-old-tokyo-storage.heroku.com/
247
250
 
248
251
  If you use it for something, please let me know so I can add it.
249
252
 
253
+ = Editor Support
254
+
255
+ * TextMate Bundle - Showoff.tmdbundle - Dr Nic Williams
256
+ http://github.com/drnic/Showoff.tmbundle
257
+
250
258
  = Future Plans
251
259
 
252
260
  I really want this to evolve into a dynamic presentation software server,
data/lib/showoff.rb CHANGED
@@ -114,7 +114,7 @@ class ShowOff < Sinatra::Application
114
114
  paths.pop
115
115
  path = paths.join('/')
116
116
  replacement_prefix = static ?
117
- %(img src="file://#{options.pres_dir}/static/#{path}) :
117
+ %(img src="file://#{options.pres_dir}/#{path}) :
118
118
  %(img src="/image/#{path})
119
119
  slide.gsub(/img src=\"(.*?)\"/) do |s|
120
120
  img_path = File.join(path, $1)
@@ -188,7 +188,7 @@ class ShowOff < Sinatra::Application
188
188
  data = ''
189
189
  files.each do |f|
190
190
  fname = f.gsub(options.pres_dir + '/', '').gsub('.md', '')
191
- data += process_markdown(fname, File.read(f),static)
191
+ data += process_markdown(fname, File.read(f), static)
192
192
  end
193
193
  end
194
194
  data
@@ -328,7 +328,7 @@ class ShowOff < Sinatra::Application
328
328
  end
329
329
 
330
330
  get %r{/(.*)} do
331
- @title = 'testing'
331
+ @title = ShowOffUtils.showoff_title
332
332
  what = params[:captures].first
333
333
  what = 'index' if "" == what
334
334
  if (what != "favicon.ico")
data/lib/showoff_utils.rb CHANGED
@@ -236,6 +236,15 @@ class ShowOffUtils
236
236
  order
237
237
  end
238
238
 
239
+ def self.showoff_title(dir = '.')
240
+ index = File.join(dir, ShowOffUtils::SHOWOFF_JSON_FILE )
241
+ order = nil
242
+ if File.exists?(index)
243
+ data = JSON.parse(File.read(index))
244
+ data.is_a?(Hash) && data['name'] || "Presentation"
245
+ end
246
+ end
247
+
239
248
  EXTENSIONS = {
240
249
  'pl' => 'perl',
241
250
  'rb' => 'ruby',
@@ -1,13 +1,29 @@
1
- .slide {
2
- margin: 10px;
3
- padding: 0;
4
- width: 1020px;
5
- height: 740px;
6
- margin-left:auto;
7
- margin-right:auto;
8
- overflow:hidden;
9
- border: 1px solid #333;
10
- page-break-after: always
1
+ /* Screen */
2
+ @media screen {
3
+ .slide {
4
+ margin: 10px;
5
+ padding: 0;
6
+ width: 1020px;
7
+ height: 740px;
8
+ margin-left:auto;
9
+ margin-right:auto;
10
+ overflow:hidden;
11
+ border: 1px solid #333;
12
+ page-break-after: always
13
+ }
14
+ }
15
+
16
+ /* Print */
17
+ @media print {
18
+ .slide, .preso {
19
+ margin: 10px;
20
+ padding: 0;
21
+ width: 800px;
22
+ height: 600px;
23
+ overflow:hidden;
24
+ border: none;
25
+ page-break-after: always
26
+ }
11
27
  }
12
28
 
13
29
  /* iPhone */
@@ -40,5 +56,4 @@
40
56
  border: 1px solid #333;
41
57
  page-break-after: always
42
58
  }
43
- }
44
-
59
+ }
@@ -1,23 +1,25 @@
1
- body {
2
- font-family: "Gill Sans", Helvetica, Arial, sans-serif;
3
- }
1
+ @media screen {
2
+ body {
3
+ font-family: "Gill Sans", Helvetica, Arial, sans-serif;
4
+ }
4
5
 
5
- #preso, .slide {
6
- background: #fff;
7
- width: 1020px;
8
- height: 740px;
9
- margin-left:auto;
10
- margin-right:auto;
11
- overflow:hidden;
12
- }
6
+ #preso, .slide {
7
+ background: #fff;
8
+ width: 1020px;
9
+ height: 740px;
10
+ margin-left:auto;
11
+ margin-right:auto;
12
+ overflow:hidden;
13
+ }
13
14
 
14
- #footer {
15
- background: #eee;
16
- padding: 2px;
17
- width: 1010px;
18
- height: 20px;
19
- margin-left:auto;
20
- margin-right:auto;
15
+ #footer {
16
+ background: #eee;
17
+ padding: 2px;
18
+ width: 1010px;
19
+ height: 20px;
20
+ margin-left:auto;
21
+ margin-right:auto;
22
+ }
21
23
  }
22
24
 
23
25
  /* iPhone */
@@ -256,3 +258,44 @@ a.fg-button { float:left; }
256
258
  color:#0000FF !important;
257
259
  background-color: yellow;
258
260
  }
261
+
262
+ /** Print **/
263
+ @media print {
264
+ body {
265
+ font-size: 70%;
266
+ }
267
+
268
+ #preso, .slide {
269
+ border: 1px solid #999;
270
+ }
271
+
272
+ .slide .center {
273
+ width: 600px;
274
+ height: 600px;
275
+ display: table-cell;
276
+ text-align: center;
277
+ vertical-align: middle;
278
+ }
279
+
280
+ #preso, .slide {
281
+ background: #fff;
282
+ width: 600px;
283
+ height: 600px;
284
+ margin-left:auto;
285
+ margin-right:auto;
286
+ overflow:hidden;
287
+ }
288
+
289
+ #footer {
290
+ background: #eee;
291
+ padding: 2px;
292
+ width: 590px;
293
+ height: 20 px;
294
+ margin-left:auto;
295
+ margin-right:auto;
296
+ }
297
+
298
+ pre, code {
299
+ font-family: Monaco, monospace;
300
+ }
301
+ }
data/public/js/core.js ADDED
@@ -0,0 +1,79 @@
1
+ // CORE module, abstracts environment-specifics
2
+ var CORE = function(){
3
+
4
+ /*
5
+ * blatantly ripped off from Douglas Crockford
6
+ */
7
+ var modifyLanguage = function(){
8
+ Function.prototype.method = function (name, func) {
9
+ if (!this.prototype[name]){
10
+ this.prototype[name] = func;
11
+ return this;
12
+ }
13
+ };
14
+ Function.method('inherits', function(Parent){
15
+ this.prototype = new Parent();
16
+ return this;
17
+ });
18
+ Array.method('each', function(f, index){
19
+ for (var i=0; i<this.length; i++){
20
+ f(this[i], i);
21
+ }
22
+ });
23
+ Array.method('reduce', function(f, value){
24
+ this.each(function(item){
25
+ value = f(item, value);
26
+ });
27
+ return value;
28
+ });
29
+ Array.method('contains', function(test){
30
+ var contains = false;
31
+ this.each(function(item){
32
+ if (item === test){
33
+ contains = true;
34
+ return false;
35
+ }
36
+ });
37
+ return contains;
38
+ });
39
+ Object.create = function(o){
40
+ var F = function(){};
41
+ F.prototype = o;
42
+ return new F();
43
+ };
44
+ Object.mixin = function(obj,mixin){
45
+ for (name in mixin){
46
+ if (mixin.hasOwnProperty(name)){
47
+ obj[name] = mixin[name];
48
+ }
49
+ }
50
+ return obj;
51
+ };
52
+ };
53
+
54
+ modifyLanguage();
55
+
56
+ return {
57
+
58
+ out : function(output){
59
+ //implemented by env
60
+ },
61
+
62
+ require : function(toImport){
63
+ this.out("'require' not implemented!");
64
+ },
65
+
66
+ debug : function(a, deep){
67
+ this.out( a + ', typeof ' + typeof a);
68
+ for (var name in a){
69
+ if (deep || (a.hasOwnProperty(name))){
70
+ if (typeof a[name] === 'function'){
71
+ this.out(name + ': [a method]');
72
+ } else {
73
+ this.out(name + ':' + a[name]);
74
+ }
75
+ }
76
+ }
77
+ }
78
+ };
79
+ }();
@@ -62,13 +62,13 @@
62
62
  var r = /["\\\x00-\x1f\x7f-\x9f]/g;
63
63
 
64
64
  var str = r.test(value)
65
- ? '"' + value.replace(r, function (a) {
65
+ ? value.replace(r, function (a) {
66
66
  var c = character_substitutions[a];
67
67
  if (c) return c;
68
68
  c = a.charCodeAt();
69
69
  return '\\u00' + Math.floor(c / 16).toString(16) + (c % 16).toString(16);
70
- }) + '"'
71
- : '"' + value + '"';
70
+ })
71
+ : value ;
72
72
  if (str.length > opts.max_string)
73
73
  return str.slice(0, opts.max_string + 1) + '..."';
74
74
  else
data/public/js/showoff.js CHANGED
@@ -17,6 +17,8 @@ var debugMode = false
17
17
  var gotoSlidenum = 0
18
18
  var shiftKeyActive = false
19
19
 
20
+ var loadSlidesBool
21
+ var loadSlidesPrefix
20
22
 
21
23
  function setupPreso(load_slides, prefix) {
22
24
  if (preso_started)
@@ -26,8 +28,9 @@ function setupPreso(load_slides, prefix) {
26
28
  }
27
29
  preso_started = true
28
30
 
29
-
30
- loadSlides(load_slides, prefix)
31
+ loadSlidesBool = load_slides
32
+ loadSlidesPrefix = prefix
33
+ loadSlides(loadSlidesBool, loadSlidesPrefix)
31
34
 
32
35
  doDebugStuff()
33
36
 
@@ -39,7 +42,7 @@ function setupPreso(load_slides, prefix) {
39
42
  /* window.onunload = unloaded; */
40
43
  }
41
44
 
42
- function loadSlides(load_slides, prefix) {
45
+ function loadSlides(load_slides, prefix) {
43
46
  //load slides offscreen, wait for images and then initialize
44
47
  if (load_slides) {
45
48
  $("#slides").load("/slides", false, function(){
@@ -76,9 +79,10 @@ function initializePresentation(prefix) {
76
79
  showSlide()
77
80
  alert('slides loaded')
78
81
  } else {
79
- showFirstSlide()
82
+ showFirstSlide();
80
83
  slidesLoaded = true
81
84
  }
85
+ setupSlideParamsCheck();
82
86
  sh_highlightDocument(prefix+'/js/sh_lang/', '.min.js')
83
87
  }
84
88
 
@@ -119,6 +123,31 @@ function setupMenu() {
119
123
  });
120
124
  }
121
125
 
126
+ function checkSlideParameter() {
127
+ if (slideParam = currentSlideFromParams()) {
128
+ slidenum = slideParam;
129
+ }
130
+ }
131
+
132
+ function currentSlideFromParams() {
133
+ var result;
134
+ if (result = window.location.hash.match(/#([0-9]+)/)) {
135
+ return result[result.length - 1] - 1;
136
+ }
137
+ }
138
+
139
+ function setupSlideParamsCheck() {
140
+ var check = function() {
141
+ var currentSlide = currentSlideFromParams();
142
+ if (slidenum != currentSlide) {
143
+ slidenum = currentSlide;
144
+ showSlide();
145
+ }
146
+ setTimeout(check, 100);
147
+ }
148
+ setTimeout(check, 100);
149
+ }
150
+
122
151
  function gotoSlide(slideNum) {
123
152
  slidenum = parseInt(slideNum)
124
153
  if (!isNaN(slidenum)) {
@@ -128,6 +157,7 @@ function gotoSlide(slideNum) {
128
157
 
129
158
  function showFirstSlide() {
130
159
  slidenum = 0
160
+ checkSlideParameter();
131
161
  showSlide()
132
162
  }
133
163
 
@@ -172,7 +202,7 @@ function showSlide(back_step) {
172
202
  incrCurr = 0
173
203
  incrSteps = 0
174
204
  }
175
-
205
+ location.hash = slidenum + 1;
176
206
  $('body').addSwipeEvents().
177
207
  bind('swipeleft', swipeLeft).
178
208
  bind('swiperight', swipeRight)
@@ -186,7 +216,7 @@ function getSlideProgress()
186
216
  return (slidenum + 1) + '/' + slideTotal
187
217
  }
188
218
 
189
- function getCurrentNotes()
219
+ function getCurrentNotes()
190
220
  {
191
221
  return currentSlide.find("p.notes").text()
192
222
  }
@@ -263,19 +293,26 @@ function keyDown(event)
263
293
  return true;
264
294
 
265
295
  debug('keyDown: ' + key)
266
-
296
+
267
297
  if (key >= 48 && key <= 57) // 0 - 9
268
298
  {
269
299
  gotoSlidenum = gotoSlidenum * 10 + (key - 48);
270
300
  return true;
271
301
  }
272
- if (key == 13 && gotoSlidenum > 0)
273
- {
274
- debug('go to ' + gotoSlidenum);
275
- slidenum = gotoSlidenum - 1;
276
- showSlide(true);
302
+
303
+ if (key == 13){
304
+ if (gotoSlidenum > 0) {
305
+ debug('go to ' + gotoSlidenum);
306
+ slidenum = gotoSlidenum - 1;
307
+ showSlide(true);
308
+ gotoSlidenum = 0;
309
+ } else {
310
+ debug('executeCode');
311
+ executeCode.call($('.sh_javaScript code:visible'));
312
+ }
313
+
277
314
  }
278
- gotoSlidenum = 0;
315
+
279
316
 
280
317
  if (key == 16) // shift key
281
318
  {
@@ -302,7 +339,7 @@ function keyDown(event)
302
339
  else if (key == 82) // R for reload
303
340
  {
304
341
  if (confirm('really reload slides?')) {
305
- loadSlides()
342
+ loadSlides(loadSlidesBool, loadSlidesPrefix)
306
343
  showSlide()
307
344
  }
308
345
  }
@@ -325,7 +362,7 @@ function keyDown(event)
325
362
  return true
326
363
  }
327
364
 
328
- function toggleFooter()
365
+ function toggleFooter()
329
366
  {
330
367
  $('#footer').toggle()
331
368
  }
@@ -399,16 +436,17 @@ var removeResults = function() {
399
436
 
400
437
  var print = function(text) {
401
438
  removeResults();
402
- var _results = $('<div>').addClass('results').text($.print(text));
439
+ var _results = $('<div>').addClass('results').html($.print(text, {max_string:500}));
403
440
  $('body').append(_results);
404
441
  _results.click(removeResults);
405
442
  };
406
443
 
407
- $('.sh_javaScript code').live("click", function() {
408
- result = null;
409
- var codeDiv = $(this);
410
- codeDiv.addClass("executing");
411
- eval(codeDiv.text());
412
- setTimeout(function() { codeDiv.removeClass("executing");}, 250 );
413
- if (result != null) print(result);
414
- });
444
+ function executeCode () {
445
+ result = null;
446
+ var codeDiv = $(this);
447
+ codeDiv.addClass("executing");
448
+ eval(codeDiv.text());
449
+ setTimeout(function() { codeDiv.removeClass("executing");}, 250 );
450
+ if (result != null) print(result);
451
+ }
452
+ $('.sh_javaScript code').live("click", executeCode);
@@ -0,0 +1,13 @@
1
+ // Make CORE.out() write to showoff 'result' global variable http://github.com/scottbale/showoff
2
+ (function(CORE){
3
+
4
+ CORE.require = function(toImport){
5
+ //nothing to do
6
+ };
7
+ CORE.out = function(output){
8
+ result = result || '';
9
+ result = result + '<p>' + output + '</p>';
10
+ };
11
+
12
+ return CORE;
13
+ }(CORE));
data/views/index.erb CHANGED
@@ -20,6 +20,8 @@
20
20
  <script type="text/javascript" src="<%= @asset_path %>/js/showoff.js"></script>
21
21
  <script type="text/javascript" src="<%= @asset_path %>/js/jTypeWriter.js"> </script>
22
22
  <script type="text/javascript" src="<%= @asset_path %>/js/sh_main.min.js"></script>
23
+ <script type="text/javascript" src="<%= @asset_path %>/js/core.js"></script>
24
+ <script type="text/javascript" src="<%= @asset_path %>/js/showoffcore.js"></script>
23
25
 
24
26
  <link type="text/css" href="<%= @asset_path %>/css/fg.menu.css" media="screen" rel="stylesheet" />
25
27
  <link type="text/css" href="<%= @asset_path %>/css/theme/ui.all.css" media="screen" rel="stylesheet" />
data/views/onepage.erb CHANGED
@@ -17,7 +17,7 @@
17
17
  <% end %>
18
18
 
19
19
  <% if !@no_js %>
20
- <%= inline_js(['jquery-1.4.min.js', 'jquery.jswipe.js', 'jquery-print.js', 'showoff.js', 'onepage.js', 'sh_main.min.js'], 'public/js') %>
20
+ <%= inline_js(['jquery-1.4.min.js', 'jquery.jswipe.js', 'jquery-print.js', 'showoff.js', 'onepage.js', 'sh_main.min.js', 'core.js', 'showoffcore.js'], 'public/js') %>
21
21
  <script type="text/javascript">
22
22
  $(document).ready(function() {
23
23
  setupOnePage()
metadata CHANGED
@@ -1,12 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: showoff
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 0
7
- - 2
8
- - 3
9
- version: 0.2.3
4
+ version: 0.2.4
10
5
  platform: ruby
11
6
  authors:
12
7
  - Scott Chacon
@@ -19,66 +14,54 @@ default_executable:
19
14
  dependencies:
20
15
  - !ruby/object:Gem::Dependency
21
16
  name: sinatra
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
24
20
  requirements:
25
21
  - - ">="
26
22
  - !ruby/object:Gem::Version
27
- segments:
28
- - 0
29
23
  version: "0"
30
- type: :runtime
31
- version_requirements: *id001
24
+ version:
32
25
  - !ruby/object:Gem::Dependency
33
26
  name: bluecloth
34
- prerelease: false
35
- requirement: &id002 !ruby/object:Gem::Requirement
27
+ type: :runtime
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
36
30
  requirements:
37
31
  - - ">="
38
32
  - !ruby/object:Gem::Version
39
- segments:
40
- - 0
41
33
  version: "0"
42
- type: :runtime
43
- version_requirements: *id002
34
+ version:
44
35
  - !ruby/object:Gem::Dependency
45
36
  name: nokogiri
46
- prerelease: false
47
- requirement: &id003 !ruby/object:Gem::Requirement
37
+ type: :runtime
38
+ version_requirement:
39
+ version_requirements: !ruby/object:Gem::Requirement
48
40
  requirements:
49
41
  - - ">="
50
42
  - !ruby/object:Gem::Version
51
- segments:
52
- - 0
53
43
  version: "0"
54
- type: :runtime
55
- version_requirements: *id003
44
+ version:
56
45
  - !ruby/object:Gem::Dependency
57
46
  name: json
58
- prerelease: false
59
- requirement: &id004 !ruby/object:Gem::Requirement
47
+ type: :runtime
48
+ version_requirement:
49
+ version_requirements: !ruby/object:Gem::Requirement
60
50
  requirements:
61
51
  - - ">="
62
52
  - !ruby/object:Gem::Version
63
- segments:
64
- - 0
65
53
  version: "0"
66
- type: :runtime
67
- version_requirements: *id004
54
+ version:
68
55
  - !ruby/object:Gem::Dependency
69
56
  name: gli
70
- prerelease: false
71
- requirement: &id005 !ruby/object:Gem::Requirement
57
+ type: :runtime
58
+ version_requirement:
59
+ version_requirements: !ruby/object:Gem::Requirement
72
60
  requirements:
73
61
  - - ">="
74
62
  - !ruby/object:Gem::Version
75
- segments:
76
- - 1
77
- - 1
78
- - 0
79
63
  version: 1.1.0
80
- type: :runtime
81
- version_requirements: *id005
64
+ version:
82
65
  description: " ShowOff is a Sinatra web app that reads simple configuration files for a\n presentation. It is sort of like a Keynote web app engine. I am using it\n to do all my talks in 2010, because I have a deep hatred in my heart for\n Keynote and yet it is by far the best in the field.\n\n The idea is that you setup your slide files in section subdirectories and\n then startup the showoff server in that directory. It will read in your\n showoff.json file for which sections go in which order and then will give \n you a URL to present from.\n"
83
66
  email: schacon@gmail.com
84
67
  executables:
@@ -131,6 +114,7 @@ files:
131
114
  - public/css/theme/ui.tabs.css
132
115
  - public/css/theme/ui.theme.css
133
116
  - public/favicon.ico
117
+ - public/js/core.js
134
118
  - public/js/fg.menu.js
135
119
  - public/js/jquery-1.4.min.js
136
120
  - public/js/jquery-print.js
@@ -183,7 +167,8 @@ files:
183
167
  - public/js/sh_lang/sh_xorg.min.js
184
168
  - public/js/sh_main.min.js
185
169
  - public/js/showoff.js
186
- has_rdoc: true
170
+ - public/js/showoffcore.js
171
+ has_rdoc: false
187
172
  homepage: http://github.com/schacon/showoff
188
173
  licenses: []
189
174
 
@@ -196,20 +181,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
196
181
  requirements:
197
182
  - - ">="
198
183
  - !ruby/object:Gem::Version
199
- segments:
200
- - 0
201
184
  version: "0"
185
+ version:
202
186
  required_rubygems_version: !ruby/object:Gem::Requirement
203
187
  requirements:
204
188
  - - ">="
205
189
  - !ruby/object:Gem::Version
206
- segments:
207
- - 0
208
190
  version: "0"
191
+ version:
209
192
  requirements: []
210
193
 
211
194
  rubyforge_project:
212
- rubygems_version: 1.3.6
195
+ rubygems_version: 1.3.5
213
196
  signing_key:
214
197
  specification_version: 3
215
198
  summary: The best damn presentation software a developer could ever love.