showoff 0.2.5 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -241,6 +241,7 @@ added where your cursor was. Binding this to a keybinding can allow you to add
241
241
  [<tt>create</tt>] Create new showoff presentation
242
242
  [<tt>help</tt>] Shows list of commands or help for one command
243
243
  [<tt>heroku</tt>] Setup your presentation to serve on Heroku
244
+ [<tt>heroku_secure</tt>] Setup your presentation to serve on Heroku with password protection
244
245
  [<tt>serve</tt>] Serves the showoff presentation in the current directory
245
246
 
246
247
  === <tt>add [title]</tt>
@@ -282,16 +283,27 @@ Shows list of commands or help for one command
282
283
 
283
284
  Setup your presentation to serve on Heroku
284
285
 
286
+ === <tt>heroku_secure heroku_name password</tt>
287
+
288
+ Setup your presentation to serve on Heroku with password protection using HTTP Authentication
289
+
285
290
  === <tt>serve </tt>
286
291
 
287
292
  Serves the showoff presentation in the current directory
288
293
 
289
294
 
290
-
291
295
  ==== Options
292
296
  These options are specified *after* the command.
293
297
 
294
298
  [<tt>-p, --port=arg</tt>] Port on which to run <i>( default: <tt>9090</tt>)</i>
299
+
300
+ === ZSH completion
301
+ You can complete commands and options in ZSH, by installing a script:
302
+
303
+ mkdir -p $HOME/.zsh/Completion
304
+ cp script/_showoff $HOME/.zsh/Completion
305
+ echo 'fpath=(~/.zsh/Completion $fpath)' >> $HOME/.zshrc
306
+
295
307
  = Real World Usage
296
308
 
297
309
  So far, ShowOff has been used in the following presentations (and many others):
@@ -319,7 +331,13 @@ So far, ShowOff has been used in the following presentations (and many others):
319
331
  http://github.com/scottbale/JavaScript-Function-Idioms
320
332
  * Open Source Bridge 2010 - Creating a low-cost clustered virtualization environment w/ Ganeti - Lance Albertson
321
333
  http://github.com/ramereth/presentation-ganeti
322
- * RailsConf 2010 - Domain-driven Test-assisted Production Rails Crisis Interventions - Rick Bradley http://railsconf2010.rickbradley.com/ http://github.com/rick/presentation_railsconf_2010
334
+ * RailsConf 2010 - Domain-driven Test-assisted Production Rails Crisis Interventions - Rick Bradley
335
+ http://railsconf2010.rickbradley.com/ http://github.com/rick/presentation_railsconf_2010
336
+ * WebWorkersCamp - 25 promising projects in 50 minutes - Bruno Michel
337
+ http://github.com/nono/Presentations/tree/master/20100703_25_promising_projects_in_50_minutes/
338
+ * 11th Libre Software Meeting 2010 - Ruby 1.9, The future of Ruby? - Bruno Michel
339
+ http://github.com/nono/Presentations/tree/master/20100708_RMLL_Ruby_1.9/
340
+
323
341
 
324
342
  If you use it for something, please let me know so I can add it.
325
343
 
@@ -328,6 +346,9 @@ If you use it for something, please let me know so I can add it.
328
346
  * TextMate Bundle - Showoff.tmdbundle - Dr Nic Williams
329
347
  http://github.com/drnic/Showoff.tmbundle
330
348
 
349
+ * Emacs major-mode - showoff-mode - Nick Parker
350
+ http://github.com/developernotes/showoff-mode
351
+
331
352
  = Future Plans
332
353
 
333
354
  I really want this to evolve into a dynamic presentation software server,
@@ -359,3 +380,6 @@ etc).
359
380
  * GLI gem
360
381
  * Firefox or Chrome to present
361
382
 
383
+ = Contributing
384
+
385
+ See the CONTRIB.txt file for how to contribute to this project
data/bin/showoff CHANGED
@@ -25,6 +25,19 @@ command [:create,:init] do |c|
25
25
  end
26
26
  end
27
27
 
28
+ desc 'Same as heroku create, but also adds password protection'
29
+ arg_name 'heroku_name password'
30
+ long_desc 'Creates the .gems file and config.ru file needed to push a showoff pres to heroku with password protection. it will then run ''heroku create'' for you to register the new project on heroku and add the remote for you. then all you need to do is commit the new created files and run ''git push heroku'' to deploy.'
31
+ command :heroku_secure do |c|
32
+ c.action do |global_options,options,args|
33
+ p args
34
+ raise "heroku_name is required" if args.empty?
35
+ raise "password is required" if args.length == 1
36
+ ShowOffUtils.heroku_secure(args[0], args[1])
37
+ end
38
+ end
39
+
40
+ desc 'Serves the showoff presentation in the current directory'
28
41
  desc 'Setup your presentation to serve on Heroku'
29
42
  arg_name 'heroku_name'
30
43
  long_desc 'Creates the .gems file and config.ru file needed to push a showoff pres to heroku. it will then run ''heroku create'' for you to register the new project on heroku and add the remote for you. then all you need to do is commit the new created files and run ''git push heroku'' to deploy.'
@@ -80,7 +93,7 @@ command [:add,:new] do |c|
80
93
  ShowOffUtils.add_slide(:dir => options[:d],
81
94
  :name => options[:n],
82
95
  :title => title,
83
- :number => !options[:m],
96
+ :number => !options[:u],
84
97
  :code => options[:s],
85
98
  :type => options[:t])
86
99
  end
data/lib/showoff.rb CHANGED
@@ -4,7 +4,7 @@ require 'json'
4
4
  require 'nokogiri'
5
5
  require 'showoff_utils'
6
6
  require 'princely'
7
- require 'ftools'
7
+ require 'fileutils'
8
8
 
9
9
  begin
10
10
  require 'RMagick'
@@ -26,6 +26,7 @@ rescue LoadError
26
26
  end
27
27
  require 'pp'
28
28
 
29
+
29
30
  class ShowOff < Sinatra::Application
30
31
 
31
32
  attr_reader :cached_image_size
@@ -234,6 +235,7 @@ class ShowOff < Sinatra::Application
234
235
 
235
236
  def index(static=false)
236
237
  if static
238
+ @title = ShowOffUtils.showoff_title
237
239
  @slides = get_slides_html(static)
238
240
  @asset_path = "."
239
241
  end
@@ -309,7 +311,7 @@ class ShowOff < Sinatra::Application
309
311
  else
310
312
  out = "#{path}/#{name}/static"
311
313
  # First make a directory
312
- File.makedirs("#{out}")
314
+ FileUtils.makedirs("#{out}")
313
315
  # Then write the html
314
316
  file = File.new("#{out}/index.html", "w")
315
317
  file.puts(data)
@@ -348,7 +350,4 @@ class ShowOff < Sinatra::Application
348
350
  end
349
351
  end
350
352
  end
351
-
352
-
353
-
354
353
  end
data/lib/showoff_utils.rb CHANGED
@@ -28,6 +28,7 @@ class ShowOffUtils
28
28
  end
29
29
  end
30
30
 
31
+ # Setup presentation to run on Heroku
31
32
  def self.heroku(name)
32
33
  if !File.exists?(SHOWOFF_JSON_FILE)
33
34
  puts "fail. not a showoff directory"
@@ -47,6 +48,42 @@ class ShowOffUtils
47
48
  f.puts 'run ShowOff.new'
48
49
  end if !File.exists?('config.ru')
49
50
 
51
+ puts "herokuized. run something like this to launch your heroku presentation:
52
+
53
+ heroku create #{name}
54
+ git add .gems config.ru
55
+ git commit -m 'herokuized'
56
+ git push heroku master
57
+ "
58
+ end
59
+
60
+ # Setup the presentation to run on Heroku with password protection
61
+ def self.heroku_secure(name, password)
62
+ if !File.exists?(SHOWOFF_JSON_FILE)
63
+ puts "fail. not a showoff directory"
64
+ return false
65
+ end
66
+ # create .gems file
67
+ File.open('.gems', 'w+') do |f|
68
+ f.puts "bluecloth"
69
+ f.puts "nokogiri"
70
+ f.puts "showoff"
71
+ f.puts "gli"
72
+ f.puts "rack"
73
+ end if !File.exists?('.gems')
74
+
75
+ # create config.ru file
76
+ File.open('config.ru', 'w+') do |f|
77
+ f.puts 'require "rack"'
78
+ f.puts 'require "showoff"'
79
+ f.puts 'showoff_app = ShowOff.new'
80
+ f.puts 'protected_showoff = Rack::Auth::Basic.new(showoff_app) do |username, password|'
81
+ f.puts "\tpassword == '#{password}'"
82
+ f.puts 'end'
83
+ f.puts 'run protected_showoff'
84
+
85
+ end if !File.exists?('config.ru')
86
+
50
87
  puts "herokuized. run something like this to launch your heroku presentation:
51
88
 
52
89
  heroku create #{name}
@@ -128,7 +165,7 @@ class ShowOffUtils
128
165
  Dir.mkdir dir
129
166
 
130
167
  showoff_json = JSON.parse(File.read(SHOWOFF_JSON_FILE))
131
- showoff_json << { "section" => dir }
168
+ showoff_json["section"] = dir
132
169
  File.open(SHOWOFF_JSON_FILE,'w') do |file|
133
170
  file.puts JSON.generate(showoff_json)
134
171
  end
@@ -1,66 +1,66 @@
1
- pre.sh_sourceCode {
2
- background-color: white;
3
- color: black;
4
- font-style: normal;
5
- font-weight: normal;
6
- }
7
-
8
- pre.sh_sourceCode .sh_keyword { color: blue; font-weight: bold; } /* language keywords */
9
- pre.sh_sourceCode .sh_type { color: darkgreen; } /* basic types */
10
- pre.sh_sourceCode .sh_usertype { color: teal; } /* user defined types */
11
- pre.sh_sourceCode .sh_string { color: red; font-family: monospace; } /* strings and chars */
12
- pre.sh_sourceCode .sh_regexp { color: orange; font-family: monospace; } /* regular expressions */
13
- pre.sh_sourceCode .sh_specialchar { color: pink; font-family: monospace; } /* e.g., \n, \t, \\ */
14
- pre.sh_sourceCode .sh_comment { color: brown; font-style: italic; } /* comments */
15
- pre.sh_sourceCode .sh_number { color: purple; } /* literal numbers */
16
- pre.sh_sourceCode .sh_preproc { color: darkblue; font-weight: bold; } /* e.g., #include, import */
17
- pre.sh_sourceCode .sh_symbol { color: darkred; } /* */
18
- pre.sh_sourceCode .sh_function { color: black; font-weight: bold; } /* function calls and declarations */
19
- pre.sh_sourceCode .sh_cbracket { color: red; } /* block brackets (e.g., {, }) */
20
- pre.sh_sourceCode .sh_todo { font-weight: bold; background-color: cyan; } /* TODO and FIXME */
21
-
22
- /* Predefined variables and functions (for instance glsl) */
23
- pre.sh_sourceCode .sh_predef_var { color: darkblue; }
24
- pre.sh_sourceCode .sh_predef_func { color: darkblue; font-weight: bold; }
25
-
26
- /* for OOP */
27
- pre.sh_sourceCode .sh_classname { color: teal; }
28
-
29
- /* line numbers (not yet implemented) */
30
- pre.sh_sourceCode .sh_linenum { color: black; font-family: monospace; }
31
-
32
- /* Internet related */
33
- pre.sh_sourceCode .sh_url { color: blue; text-decoration: underline; font-family: monospace; }
34
-
35
- /* for ChangeLog and Log files */
36
- pre.sh_sourceCode .sh_date { color: blue; font-weight: bold; }
37
- pre.sh_sourceCode .sh_time, pre.sh_sourceCode .sh_file { color: darkblue; font-weight: bold; }
38
- pre.sh_sourceCode .sh_ip, pre.sh_sourceCode .sh_name { color: darkgreen; }
39
-
40
- /* for Prolog, Perl... */
41
- pre.sh_sourceCode .sh_variable { color: darkgreen; }
42
-
43
- /* for LaTeX */
44
- pre.sh_sourceCode .sh_italics { color: darkgreen; font-style: italic; }
45
- pre.sh_sourceCode .sh_bold { color: darkgreen; font-weight: bold; }
46
- pre.sh_sourceCode .sh_underline { color: darkgreen; text-decoration: underline; }
47
- pre.sh_sourceCode .sh_fixed { color: green; font-family: monospace; }
48
- pre.sh_sourceCode .sh_argument { color: darkgreen; }
49
- pre.sh_sourceCode .sh_optionalargument { color: purple; }
50
- pre.sh_sourceCode .sh_math { color: orange; }
51
- pre.sh_sourceCode .sh_bibtex { color: blue; }
52
-
53
- /* for diffs */
54
- pre.sh_sourceCode .sh_oldfile { color: orange; }
55
- pre.sh_sourceCode .sh_newfile { color: darkgreen; }
56
- pre.sh_sourceCode .sh_difflines { color: blue; }
57
-
58
- /* for css */
59
- pre.sh_sourceCode .sh_selector { color: purple; }
60
- pre.sh_sourceCode .sh_property { color: blue; }
61
- pre.sh_sourceCode .sh_value { color: darkgreen; font-style: italic; }
62
-
63
- /* other */
64
- pre.sh_sourceCode .sh_section { color: black; font-weight: bold; }
65
- pre.sh_sourceCode .sh_paren { color: red; }
66
- pre.sh_sourceCode .sh_attribute { color: darkgreen; }
1
+ pre.sh_sourceCode {
2
+ background-color: white;
3
+ color: black;
4
+ font-style: normal;
5
+ font-weight: normal;
6
+ }
7
+
8
+ pre.sh_sourceCode .sh_keyword { color: blue; font-weight: bold; } /* language keywords */
9
+ pre.sh_sourceCode .sh_type { color: darkgreen; } /* basic types */
10
+ pre.sh_sourceCode .sh_usertype { color: teal; } /* user defined types */
11
+ pre.sh_sourceCode .sh_string { color: red; font-family: monospace; } /* strings and chars */
12
+ pre.sh_sourceCode .sh_regexp { color: orange; font-family: monospace; } /* regular expressions */
13
+ pre.sh_sourceCode .sh_specialchar { color: pink; font-family: monospace; } /* e.g., \n, \t, \\ */
14
+ pre.sh_sourceCode .sh_comment { color: brown; font-style: italic; } /* comments */
15
+ pre.sh_sourceCode .sh_number { color: purple; } /* literal numbers */
16
+ pre.sh_sourceCode .sh_preproc { color: darkblue; font-weight: bold; } /* e.g., #include, import */
17
+ pre.sh_sourceCode .sh_symbol { color: darkred; } /* */
18
+ pre.sh_sourceCode .sh_function { color: black; font-weight: bold; } /* function calls and declarations */
19
+ pre.sh_sourceCode .sh_cbracket { color: red; } /* block brackets (e.g., {, }) */
20
+ pre.sh_sourceCode .sh_todo { font-weight: bold; background-color: cyan; } /* TODO and FIXME */
21
+
22
+ /* Predefined variables and functions (for instance glsl) */
23
+ pre.sh_sourceCode .sh_predef_var { color: darkblue; }
24
+ pre.sh_sourceCode .sh_predef_func { color: darkblue; font-weight: bold; }
25
+
26
+ /* for OOP */
27
+ pre.sh_sourceCode .sh_classname { color: teal; }
28
+
29
+ /* line numbers (not yet implemented) */
30
+ pre.sh_sourceCode .sh_linenum { color: black; font-family: monospace; }
31
+
32
+ /* Internet related */
33
+ pre.sh_sourceCode .sh_url { color: blue; text-decoration: underline; font-family: monospace; }
34
+
35
+ /* for ChangeLog and Log files */
36
+ pre.sh_sourceCode .sh_date { color: blue; font-weight: bold; }
37
+ pre.sh_sourceCode .sh_time, pre.sh_sourceCode .sh_file { color: darkblue; font-weight: bold; }
38
+ pre.sh_sourceCode .sh_ip, pre.sh_sourceCode .sh_name { color: darkgreen; }
39
+
40
+ /* for Prolog, Perl... */
41
+ pre.sh_sourceCode .sh_variable { color: darkgreen; }
42
+
43
+ /* for LaTeX */
44
+ pre.sh_sourceCode .sh_italics { color: darkgreen; font-style: italic; }
45
+ pre.sh_sourceCode .sh_bold { color: darkgreen; font-weight: bold; }
46
+ pre.sh_sourceCode .sh_underline { color: darkgreen; text-decoration: underline; }
47
+ pre.sh_sourceCode .sh_fixed { color: green; font-family: monospace; }
48
+ pre.sh_sourceCode .sh_argument { color: darkgreen; }
49
+ pre.sh_sourceCode .sh_optionalargument { color: purple; }
50
+ pre.sh_sourceCode .sh_math { color: orange; }
51
+ pre.sh_sourceCode .sh_bibtex { color: blue; }
52
+
53
+ /* for diffs */
54
+ pre.sh_sourceCode .sh_oldfile { color: orange; }
55
+ pre.sh_sourceCode .sh_newfile { color: darkgreen; }
56
+ pre.sh_sourceCode .sh_difflines { color: blue; }
57
+
58
+ /* for css */
59
+ pre.sh_sourceCode .sh_selector { color: purple; }
60
+ pre.sh_sourceCode .sh_property { color: blue; }
61
+ pre.sh_sourceCode .sh_value { color: darkgreen; font-style: italic; }
62
+
63
+ /* other */
64
+ pre.sh_sourceCode .sh_section { color: black; font-weight: bold; }
65
+ pre.sh_sourceCode .sh_paren { color: red; }
66
+ pre.sh_sourceCode .sh_attribute { color: darkgreen; }
@@ -1,26 +1,26 @@
1
- // jTypeWriter, JQuery plugin
2
- // v 1.1
3
- // Licensed under GPL licenses.
4
- // Copyright (C) 2008 Nikos "DuMmWiaM" Kontis, info@dummwiam.com
5
- // http://www.DuMmWiaM.com/jTypeWriter
6
- // ----------------------------------------------------------------------------
7
- // Permission is hereby granted, free of charge, to any person obtaining a copy
8
- // of this software and associated documentation files (the "Software"), to deal
9
- // in the Software without restriction, including without limitation the rights
10
- // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
- // copies of the Software, and to permit persons to whom the Software is
12
- // furnished to do so, subject to the following conditions:
13
- //
14
- // The above copyright notice and this permission notice shall be included in
15
- // all copies or substantial portions of the Software.
16
- //
17
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
- // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
- // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
- // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
- // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
- // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
- // THE SOFTWARE.
24
- // ----------------------------------------------------------------------------
25
-
1
+ // jTypeWriter, JQuery plugin
2
+ // v 1.1
3
+ // Licensed under GPL licenses.
4
+ // Copyright (C) 2008 Nikos "DuMmWiaM" Kontis, info@dummwiam.com
5
+ // http://www.DuMmWiaM.com/jTypeWriter
6
+ // ----------------------------------------------------------------------------
7
+ // Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ // of this software and associated documentation files (the "Software"), to deal
9
+ // in the Software without restriction, including without limitation the rights
10
+ // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ // copies of the Software, and to permit persons to whom the Software is
12
+ // furnished to do so, subject to the following conditions:
13
+ //
14
+ // The above copyright notice and this permission notice shall be included in
15
+ // all copies or substantial portions of the Software.
16
+ //
17
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
+ // THE SOFTWARE.
24
+ // ----------------------------------------------------------------------------
25
+
26
26
  eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(7($){$.u.v=7(b){5 c,8,w,r,x,A;5 d=$.W({},$.u.v.H,b);5 e=d.I*J;5 f=d.K.X();5 g=d.L;5 h=d.M;5 j=d.9;5 k=d.N;5 l=d.O;5 m=(f=="Y")?" ":".";5 n=P Q();5 o=0;y(i=0;i<q.p;i++){4(j){$(q[i]).9(j)}4(f=="s")n.R({3:$(q[i]),6:$(q[i]).9()});t n.R({3:$(q[i]),6:$(q[i]).9().Z(m)});4(!g)o=n[i].6.p>o?n[i].6.p:o;t o+=n[i].6.p;$(q[i]).9("")}B();7 B(){c=e/o;8=0;w=r=0;x=(!g)?C(S,c):C(T,c)};7 S(){8++;y(i=0;i<n.p;i++){5 a=n[i];4(a.6.p>=8){4(f=="s"){a.3.9(a.6.U(0,8))}t{a.3.z(a.6[8-1]);4(8<o){a.3.z(m)}}}}4(8>=o){D()}};7 T(){$3=n[w];4(f=="s"){$3.3.9($3.6.U(0,++r))}t{$3.3.z($3.6[r++]);4(r<$3.6.p)$3.3.z(m)}4(r>=$3.6.p){w++;r=0}8++;4(8>=o){D()}};7 D(){E(x);4(f!="s"){}4(k){4(l)A=C(V,l*J);t F()}h()};7 F(){y(i=0;i<n.p;i++){n[i].3.9("")}B()};7 V(){F();E(A)};7 G(){E(x);y(i=0;i<n.p;i++){n[i].3.9(n[i].6)}};q.G=G;10 q};$.u.v.H={I:2,K:"s",L:11,M:7(){},9:"",N:12,O:0};$.u.v.13={14:P Q()}})(15);',62,68,'|||obj|if|var|initialText|function|nIntervalCounter|text||||||||||||||||length|this|nSequentialCounterInternal|letter|else|fn|jTypeWriter|nSequentialCounter|nInterval|for|append|nLoopInterval|init|setInterval|circleEnd|clearInterval|newLoop|endEffect|defaults|duration|1000|type|sequential|onComplete|loop|loopDelay|new|Array|push|typerSimultaneous|typerSequential|substr|loopInterval|extend|toLowerCase|word|split|return|true|false|variables|aObjects|jQuery'.split('|'),0,{}))
@@ -0,0 +1,2 @@
1
+ if(!this.sh_languages){this.sh_languages={};}
2
+ sh_languages['cucumber']=[[[/#/g,'sh_comment',1],[/@/g,'sh_comment',1],[/Scenario:/g,'sh_keyword',1],[/Feature:/g,'sh_keyword',1],[/In order to/g,'sh_variable',1],[/As a/g,'sh_variable',1],[/I want to/g,'sh_variable',1],[/I wish to/g,'sh_variable',1],[/I can/g,'sh_variable',1],[/So that/g,'sh_variable',1],[/\b(?:Given|When|Then|And|But)\b/g,'sh_keyword',-1]],[[/$/g,null,-2]]];
data/public/js/showoff.js CHANGED
@@ -21,350 +21,353 @@ var loadSlidesBool
21
21
  var loadSlidesPrefix
22
22
 
23
23
  function setupPreso(load_slides, prefix) {
24
- if (preso_started)
25
- {
26
- alert("already started")
27
- return
28
- }
29
- preso_started = true
24
+ if (preso_started)
25
+ {
26
+ alert("already started")
27
+ return
28
+ }
29
+ preso_started = true
30
30
 
31
- loadSlidesBool = load_slides
32
- loadSlidesPrefix = prefix
33
- loadSlides(loadSlidesBool, loadSlidesPrefix)
31
+ loadSlidesBool = load_slides
32
+ loadSlidesPrefix = prefix
33
+ loadSlides(loadSlidesBool, loadSlidesPrefix)
34
34
 
35
- doDebugStuff()
35
+ doDebugStuff()
36
36
 
37
- // bind event handlers
38
- document.onkeydown = keyDown
39
- document.onkeyup = keyUp
40
- /* window.onresize = resized; */
41
- /* window.onscroll = scrolled; */
42
- /* window.onunload = unloaded; */
37
+ // bind event handlers
38
+ document.onkeydown = keyDown
39
+ document.onkeyup = keyUp
40
+ /* window.onresize = resized; */
41
+ /* window.onscroll = scrolled; */
42
+ /* window.onunload = unloaded; */
43
43
  }
44
44
 
45
45
  function loadSlides(load_slides, prefix) {
46
- //load slides offscreen, wait for images and then initialize
47
- if (load_slides) {
48
- $("#slides").load("/slides", false, function(){
49
- $("#slides img").batchImageLoad({
46
+ //load slides offscreen, wait for images and then initialize
47
+ if (load_slides) {
48
+ $("#slides").load("/slides", false, function(){
49
+ $("#slides img").batchImageLoad({
50
50
  loadingCompleteCallback: initializePresentation(prefix)
51
51
  })
52
- })
53
- } else {
52
+ })
53
+ } else {
54
54
  $("#slides img").batchImageLoad({
55
55
  loadingCompleteCallback: initializePresentation(prefix)
56
56
  })
57
- }
57
+ }
58
58
  }
59
59
 
60
60
  function initializePresentation(prefix) {
61
- //center slides offscreen
62
- centerSlides($('#slides > .slide'))
61
+ // unhide for height to work in static mode
62
+ $("#slides").show();
63
63
 
64
- //copy into presentation area
65
- $("#preso").empty()
66
- $('#slides > .slide').appendTo($("#preso"))
64
+ //center slides offscreen
65
+ centerSlides($('#slides > .slide'))
67
66
 
68
- //populate vars
69
- slides = $('#preso > .slide')
70
- slideTotal = slides.size()
67
+ //copy into presentation area
68
+ $("#preso").empty()
69
+ $('#slides > .slide').appendTo($("#preso"))
70
+
71
+ //populate vars
72
+ slides = $('#preso > .slide')
73
+ slideTotal = slides.size()
71
74
 
72
- //setup manual jquery cycle
73
- $('#preso').cycle({
74
- timeout: 0
75
- })
75
+ //setup manual jquery cycle
76
+ $('#preso').cycle({
77
+ timeout: 0
78
+ })
76
79
 
77
- setupMenu()
78
- if (slidesLoaded) {
79
- showSlide()
80
- } else {
81
- showFirstSlide();
82
- slidesLoaded = true
83
- }
84
- setupSlideParamsCheck();
85
- sh_highlightDocument(prefix+'/js/sh_lang/', '.min.js')
80
+ setupMenu()
81
+ if (slidesLoaded) {
82
+ showSlide()
83
+ } else {
84
+ showFirstSlide();
85
+ slidesLoaded = true
86
+ }
87
+ setupSlideParamsCheck();
88
+ sh_highlightDocument(prefix+'/js/sh_lang/', '.min.js')
86
89
  }
87
90
 
88
91
  function centerSlides(slides) {
89
- slides.each(function(s, slide) {
90
- centerSlide(slide)
91
- })
92
+ slides.each(function(s, slide) {
93
+ centerSlide(slide)
94
+ })
92
95
  }
93
96
 
94
97
  function centerSlide(slide) {
95
- var slide_content = $(slide).children(".content").first()
96
- var height = slide_content.height()
97
- var mar_top = (0.5 * parseFloat($(slide).height())) - (0.5 * parseFloat(height))
98
- if (mar_top < 0) {
99
- mar_top = 0
100
- }
101
- slide_content.css('margin-top', mar_top)
98
+ var slide_content = $(slide).children(".content").first()
99
+ var height = slide_content.height()
100
+ var mar_top = (0.5 * parseFloat($(slide).height())) - (0.5 * parseFloat(height))
101
+ if (mar_top < 0) {
102
+ mar_top = 0
103
+ }
104
+ slide_content.css('margin-top', mar_top)
102
105
  }
103
106
 
104
107
  function setupMenu() {
105
- $('#navmenu').hide();
108
+ $('#navmenu').hide();
106
109
 
107
- var currSlide = 0
108
- var menu = new ListMenu()
110
+ var currSlide = 0
111
+ var menu = new ListMenu()
109
112
 
110
- slides.each(function(s, elem) {
111
- content = $(elem).children(".content")
112
- shortTxt = $(content).text().substr(0, 20)
113
- path = $(content).attr('ref').split('/')
114
- currSlide += 1
115
- menu.addItem(path, shortTxt, currSlide)
116
- })
113
+ slides.each(function(s, elem) {
114
+ content = $(elem).children(".content")
115
+ shortTxt = $(content).text().substr(0, 20)
116
+ path = $(content).attr('ref').split('/')
117
+ currSlide += 1
118
+ menu.addItem(path, shortTxt, currSlide)
119
+ })
117
120
 
118
- $('#navigation').html(menu.getList())
119
- $('#navmenu').menu({
120
- content: $('#navigation').html(),
121
- flyOut: true
122
- });
121
+ $('#navigation').html(menu.getList())
122
+ $('#navmenu').menu({
123
+ content: $('#navigation').html(),
124
+ flyOut: true
125
+ });
123
126
  }
124
127
 
125
128
  function checkSlideParameter() {
126
- if (slideParam = currentSlideFromParams()) {
127
- slidenum = slideParam;
128
- }
129
+ if (slideParam = currentSlideFromParams()) {
130
+ slidenum = slideParam;
131
+ }
129
132
  }
130
133
 
131
134
  function currentSlideFromParams() {
132
- var result;
133
- if (result = window.location.hash.match(/#([0-9]+)/)) {
134
- return result[result.length - 1] - 1;
135
- }
135
+ var result;
136
+ if (result = window.location.hash.match(/#([0-9]+)/)) {
137
+ return result[result.length - 1] - 1;
138
+ }
136
139
  }
137
140
 
138
141
  function setupSlideParamsCheck() {
139
- var check = function() {
140
- var currentSlide = currentSlideFromParams();
141
- if (slidenum != currentSlide) {
142
- slidenum = currentSlide;
143
- showSlide();
144
- }
145
- setTimeout(check, 100);
146
- }
147
- setTimeout(check, 100);
142
+ var check = function() {
143
+ var currentSlide = currentSlideFromParams();
144
+ if (slidenum != currentSlide) {
145
+ slidenum = currentSlide;
146
+ showSlide();
147
+ }
148
+ setTimeout(check, 100);
149
+ }
150
+ setTimeout(check, 100);
148
151
  }
149
152
 
150
153
  function gotoSlide(slideNum) {
151
- slidenum = parseInt(slideNum)
152
- if (!isNaN(slidenum)) {
153
- showSlide()
154
- }
154
+ slidenum = parseInt(slideNum)
155
+ if (!isNaN(slidenum)) {
156
+ showSlide()
157
+ }
155
158
  }
156
159
 
157
160
  function showFirstSlide() {
158
- slidenum = 0
159
- checkSlideParameter();
160
- showSlide()
161
+ slidenum = 0
162
+ checkSlideParameter();
163
+ showSlide()
161
164
  }
162
165
 
163
166
  function showSlide(back_step) {
164
167
 
165
- if(slidenum < 0) {
166
- slidenum = 0
167
- return
168
- }
168
+ if(slidenum < 0) {
169
+ slidenum = 0
170
+ return
171
+ }
169
172
 
170
- if(slidenum > (slideTotal - 1)) {
171
- slidenum = slideTotal - 1
172
- return
173
- }
173
+ if(slidenum > (slideTotal - 1)) {
174
+ slidenum = slideTotal - 1
175
+ return
176
+ }
174
177
 
175
- currentSlide = slides.eq(slidenum)
178
+ currentSlide = slides.eq(slidenum)
176
179
 
177
- var transition = currentSlide.attr('data-transition')
178
- var fullPage = currentSlide.find(".content").is('.full-page');
180
+ var transition = currentSlide.attr('data-transition')
181
+ var fullPage = currentSlide.find(".content").is('.full-page');
179
182
 
180
- if (back_step || fullPage) {
181
- transition = 'none'
182
- }
183
+ if (back_step || fullPage) {
184
+ transition = 'none'
185
+ }
183
186
 
184
- $('#preso').cycle(slidenum, transition)
187
+ $('#preso').cycle(slidenum, transition)
185
188
 
186
- if (fullPage) {
187
- $('#preso').css({'width' : '100%', 'overflow' : 'visible'});
188
- currentSlide.css({'width' : '100%', 'text-align' : 'center', 'overflow' : 'visible'});
189
- } else {
190
- $('#preso').css({'width' : '1020px', 'overflow' : 'hidden'});
191
- }
189
+ if (fullPage) {
190
+ $('#preso').css({'width' : '100%', 'overflow' : 'visible'});
191
+ currentSlide.css({'width' : '100%', 'text-align' : 'center', 'overflow' : 'visible'});
192
+ } else {
193
+ $('#preso').css({'width' : '1020px', 'overflow' : 'hidden'});
194
+ }
192
195
 
193
- percent = getSlidePercent()
194
- $("#slideInfo").text((slidenum + 1) + '/' + slideTotal + ' - ' + percent + '%')
196
+ percent = getSlidePercent()
197
+ $("#slideInfo").text((slidenum + 1) + '/' + slideTotal + ' - ' + percent + '%')
195
198
 
196
- if(!back_step) {
197
- // determine if there are incremental bullets to show
198
- // unless we are moving backward
199
- determineIncremental()
200
- } else {
201
- incrCurr = 0
202
- incrSteps = 0
203
- }
204
- location.hash = slidenum + 1;
205
- $('body').addSwipeEvents().
206
- bind('swipeleft', swipeLeft).
207
- bind('swiperight', swipeRight)
208
- removeResults()
199
+ if(!back_step) {
200
+ // determine if there are incremental bullets to show
201
+ // unless we are moving backward
202
+ determineIncremental()
203
+ } else {
204
+ incrCurr = 0
205
+ incrSteps = 0
206
+ }
207
+ location.hash = slidenum + 1;
208
+ $('body').addSwipeEvents().
209
+ bind('swipeleft', swipeLeft).
210
+ bind('swiperight', swipeRight)
211
+ removeResults()
209
212
 
210
- $(currentSlide).find(".content").trigger("showoff:show");
213
+ $(currentSlide).find(".content").trigger("showoff:show");
211
214
 
212
- return getCurrentNotes()
215
+ return getCurrentNotes()
213
216
  }
214
217
 
215
218
  function getSlideProgress()
216
219
  {
217
- return (slidenum + 1) + '/' + slideTotal
220
+ return (slidenum + 1) + '/' + slideTotal
218
221
  }
219
222
 
220
223
  function getCurrentNotes()
221
224
  {
222
- return currentSlide.find("p.notes").text()
225
+ return currentSlide.find("p.notes").text()
223
226
  }
224
227
 
225
228
  function getSlidePercent()
226
229
  {
227
- return Math.ceil(((slidenum + 1) / slideTotal) * 100)
230
+ return Math.ceil(((slidenum + 1) / slideTotal) * 100)
228
231
  }
229
232
 
230
233
  function determineIncremental()
231
234
  {
232
- incrCurr = 0
233
- incrCode = false
234
- incrElem = currentSlide.find(".incremental > ul > li")
235
- incrSteps = incrElem.size()
236
- if(incrSteps == 0) {
237
- // also look for commandline
238
- incrElem = currentSlide.find(".incremental > pre > code > code")
239
- incrSteps = incrElem.size()
240
- incrCode = true
241
- }
242
- incrElem.each(function(s, elem) {
243
- $(elem).hide()
244
- })
235
+ incrCurr = 0
236
+ incrCode = false
237
+ incrElem = currentSlide.find(".incremental > ul > li")
238
+ incrSteps = incrElem.size()
239
+ if(incrSteps == 0) {
240
+ // also look for commandline
241
+ incrElem = currentSlide.find(".incremental > pre > code > code")
242
+ incrSteps = incrElem.size()
243
+ incrCode = true
244
+ }
245
+ incrElem.each(function(s, elem) {
246
+ $(elem).hide()
247
+ })
245
248
  }
246
249
 
247
250
  function prevStep()
248
251
  {
249
252
 
250
- var event = jQuery.Event("showoff:prev");
251
- $(currentSlide).find(".content").trigger(event);
252
- if (event.isDefaultPrevented()) {
253
- return;
254
- }
253
+ var event = jQuery.Event("showoff:prev");
254
+ $(currentSlide).find(".content").trigger(event);
255
+ if (event.isDefaultPrevented()) {
256
+ return;
257
+ }
255
258
 
256
- slidenum--
257
- return showSlide(true) // We show the slide fully loaded
259
+ slidenum--
260
+ return showSlide(true) // We show the slide fully loaded
258
261
  }
259
262
 
260
263
  function nextStep()
261
264
  {
262
- var event = jQuery.Event("showoff:next");
263
- $(currentSlide).find(".content").trigger(event);
264
- if (event.isDefaultPrevented()) {
265
- return;
266
- }
267
-
268
- if (incrCurr >= incrSteps) {
269
- slidenum++
270
- return showSlide()
271
- } else {
272
- elem = incrElem.eq(incrCurr)
273
- if (incrCode && elem.hasClass('command')) {
274
- incrElem.eq(incrCurr).show().jTypeWriter({duration:1.0})
275
- } else {
276
- incrElem.eq(incrCurr).show()
277
- }
278
- incrCurr++
279
- }
265
+ var event = jQuery.Event("showoff:next");
266
+ $(currentSlide).find(".content").trigger(event);
267
+ if (event.isDefaultPrevented()) {
268
+ return;
269
+ }
270
+
271
+ if (incrCurr >= incrSteps) {
272
+ slidenum++
273
+ return showSlide()
274
+ } else {
275
+ elem = incrElem.eq(incrCurr)
276
+ if (incrCode && elem.hasClass('command')) {
277
+ incrElem.eq(incrCurr).show().jTypeWriter({duration:1.0})
278
+ } else {
279
+ incrElem.eq(incrCurr).show()
280
+ }
281
+ incrCurr++
282
+ }
280
283
  }
281
284
 
282
285
  function doDebugStuff()
283
286
  {
284
- if (debugMode) {
285
- $('#debugInfo').show()
286
- debug('debug mode on')
287
- } else {
288
- $('#debugInfo').hide()
289
- }
287
+ if (debugMode) {
288
+ $('#debugInfo').show()
289
+ debug('debug mode on')
290
+ } else {
291
+ $('#debugInfo').hide()
292
+ }
290
293
  }
291
294
 
292
295
  function debug(data)
293
296
  {
294
- $('#debugInfo').text(data)
297
+ $('#debugInfo').text(data)
295
298
  }
296
299
 
297
300
  // See e.g. http://www.quirksmode.org/js/keys.html for keycodes
298
301
  function keyDown(event)
299
302
  {
300
- var key = event.keyCode;
301
-
302
- if (event.ctrlKey || event.altKey || event.metaKey)
303
- return true;
304
-
305
- debug('keyDown: ' + key)
306
-
307
- if (key >= 48 && key <= 57) // 0 - 9
308
- {
309
- gotoSlidenum = gotoSlidenum * 10 + (key - 48);
310
- return true;
311
- }
312
-
313
- if (key == 13){
314
- if (gotoSlidenum > 0) {
315
- debug('go to ' + gotoSlidenum);
316
- slidenum = gotoSlidenum - 1;
317
- showSlide(true);
318
- gotoSlidenum = 0;
319
- } else {
320
- debug('executeCode');
321
- executeCode.call($('.sh_javaScript code:visible'));
322
- }
323
-
324
- }
325
-
326
-
327
- if (key == 16) // shift key
328
- {
329
- shiftKeyActive = true;
330
- }
331
- if (key == 32) // space bar
332
- {
333
- if (shiftKeyActive) { prevStep() }
334
- else { nextStep() }
335
- }
336
- else if (key == 68) // 'd' for debug
337
- {
338
- debugMode = !debugMode
339
- doDebugStuff()
340
- }
341
- else if (key == 37 || key == 33 || key == 38) // Left arrow, page up, or up arrow
342
- {
343
- prevStep()
344
- }
345
- else if (key == 39 || key == 34 || key == 40) // Right arrow, page down, or down arrow
346
- {
347
- nextStep()
348
- }
349
- else if (key == 82) // R for reload
350
- {
351
- if (confirm('really reload slides?')) {
352
- loadSlides(loadSlidesBool, loadSlidesPrefix)
353
- showSlide()
354
- }
355
- }
356
- else if (key == 84 || key == 67) // T or C for table of contents
357
- {
358
- $('#navmenu').toggle().trigger('click')
359
- }
360
- else if (key == 90) // z for help
361
- {
362
- $('#help').toggle()
363
- }
364
- else if (key == 66 || key == 70) // f for footer (also "b" which is what kensington remote "stop" button sends
365
- {
366
- toggleFooter()
367
- }
303
+ var key = event.keyCode;
304
+
305
+ if (event.ctrlKey || event.altKey || event.metaKey)
306
+ return true;
307
+
308
+ debug('keyDown: ' + key)
309
+
310
+ if (key >= 48 && key <= 57) // 0 - 9
311
+ {
312
+ gotoSlidenum = gotoSlidenum * 10 + (key - 48);
313
+ return true;
314
+ }
315
+
316
+ if (key == 13){
317
+ if (gotoSlidenum > 0) {
318
+ debug('go to ' + gotoSlidenum);
319
+ slidenum = gotoSlidenum - 1;
320
+ showSlide(true);
321
+ gotoSlidenum = 0;
322
+ } else {
323
+ debug('executeCode');
324
+ executeCode.call($('.sh_javaScript code:visible'));
325
+ }
326
+
327
+ }
328
+
329
+
330
+ if (key == 16) // shift key
331
+ {
332
+ shiftKeyActive = true;
333
+ }
334
+ if (key == 32) // space bar
335
+ {
336
+ if (shiftKeyActive) { prevStep() }
337
+ else { nextStep() }
338
+ }
339
+ else if (key == 68) // 'd' for debug
340
+ {
341
+ debugMode = !debugMode
342
+ doDebugStuff()
343
+ }
344
+ else if (key == 37 || key == 33 || key == 38) // Left arrow, page up, or up arrow
345
+ {
346
+ prevStep()
347
+ }
348
+ else if (key == 39 || key == 34 || key == 40) // Right arrow, page down, or down arrow
349
+ {
350
+ nextStep()
351
+ }
352
+ else if (key == 82) // R for reload
353
+ {
354
+ if (confirm('really reload slides?')) {
355
+ loadSlides(loadSlidesBool, loadSlidesPrefix)
356
+ showSlide()
357
+ }
358
+ }
359
+ else if (key == 84 || key == 67) // T or C for table of contents
360
+ {
361
+ $('#navmenu').toggle().trigger('click')
362
+ }
363
+ else if (key == 90) // z for help
364
+ {
365
+ $('#help').toggle()
366
+ }
367
+ else if (key == 66 || key == 70) // f for footer (also "b" which is what kensington remote "stop" button sends
368
+ {
369
+ toggleFooter()
370
+ }
368
371
  else if (key == 27) // esc
369
372
  {
370
373
  removeResults();
@@ -373,95 +376,95 @@ function keyDown(event)
373
376
  {
374
377
  runPreShow();
375
378
  }
376
- return true
379
+ return true
377
380
  }
378
381
 
379
382
  function toggleFooter()
380
383
  {
381
- $('#footer').toggle()
384
+ $('#footer').toggle()
382
385
  }
383
386
 
384
387
  function keyUp(event) {
385
- var key = event.keyCode;
386
- debug('keyUp: ' + key);
387
- if (key == 16) // shift key
388
- {
389
- shiftKeyActive = false;
390
- }
388
+ var key = event.keyCode;
389
+ debug('keyUp: ' + key);
390
+ if (key == 16) // shift key
391
+ {
392
+ shiftKeyActive = false;
393
+ }
391
394
  }
392
395
 
393
396
 
394
397
  function swipeLeft() {
395
- nextStep()
398
+ nextStep()
396
399
  }
397
400
 
398
401
  function swipeRight() {
399
- prevStep()
402
+ prevStep()
400
403
  }
401
404
 
402
405
  function ListMenu(s)
403
406
  {
404
- this.slide = s
405
- this.typeName = 'ListMenu'
406
- this.itemLength = 0;
407
- this.items = new Array();
408
- this.addItem = function (key, text, slide) {
409
- if (key.length > 1) {
410
- thisKey = key.shift()
411
- if (!this.items[thisKey]) {
412
- this.items[thisKey] = new ListMenu(slide)
413
- }
414
- this.items[thisKey].addItem(key, text, slide)
415
- } else {
416
- thisKey = key.shift()
417
- this.items[thisKey] = new ListMenuItem(text, slide)
418
- }
419
- }
420
- this.getList = function() {
421
- var newMenu = $("<ul>")
422
- for(var i in this.items) {
423
- var item = this.items[i]
424
- var domItem = $("<li>")
425
- if (item.typeName == 'ListMenu') {
426
- choice = $("<a rel=\"" + (item.slide - 1) + "\" href=\"#\">" + i + "</a>")
427
- domItem.append(choice)
428
- domItem.append(item.getList())
429
- }
430
- if (item.typeName == 'ListMenuItem') {
431
- choice = $("<a rel=\"" + (item.slide - 1) + "\" href=\"#\">" + item.slide + '. ' + item.textName + "</a>")
432
- domItem.append(choice)
433
- }
434
- newMenu.append(domItem)
435
- }
436
- return newMenu
437
- }
407
+ this.slide = s
408
+ this.typeName = 'ListMenu'
409
+ this.itemLength = 0;
410
+ this.items = new Array();
411
+ this.addItem = function (key, text, slide) {
412
+ if (key.length > 1) {
413
+ thisKey = key.shift()
414
+ if (!this.items[thisKey]) {
415
+ this.items[thisKey] = new ListMenu(slide)
416
+ }
417
+ this.items[thisKey].addItem(key, text, slide)
418
+ } else {
419
+ thisKey = key.shift()
420
+ this.items[thisKey] = new ListMenuItem(text, slide)
421
+ }
422
+ }
423
+ this.getList = function() {
424
+ var newMenu = $("<ul>")
425
+ for(var i in this.items) {
426
+ var item = this.items[i]
427
+ var domItem = $("<li>")
428
+ if (item.typeName == 'ListMenu') {
429
+ choice = $("<a rel=\"" + (item.slide - 1) + "\" href=\"#\">" + i + "</a>")
430
+ domItem.append(choice)
431
+ domItem.append(item.getList())
432
+ }
433
+ if (item.typeName == 'ListMenuItem') {
434
+ choice = $("<a rel=\"" + (item.slide - 1) + "\" href=\"#\">" + item.slide + '. ' + item.textName + "</a>")
435
+ domItem.append(choice)
436
+ }
437
+ newMenu.append(domItem)
438
+ }
439
+ return newMenu
440
+ }
438
441
  }
439
442
 
440
443
  function ListMenuItem(t, s)
441
444
  {
442
- this.typeName = "ListMenuItem"
443
- this.slide = s
444
- this.textName = t
445
+ this.typeName = "ListMenuItem"
446
+ this.slide = s
447
+ this.textName = t
445
448
  }
446
449
 
447
450
  var removeResults = function() {
448
- $('.results').remove();
451
+ $('.results').remove();
449
452
  };
450
453
 
451
454
  var print = function(text) {
452
- removeResults();
453
- var _results = $('<div>').addClass('results').html($.print(text, {max_string:500}));
454
- $('body').append(_results);
455
- _results.click(removeResults);
455
+ removeResults();
456
+ var _results = $('<div>').addClass('results').html($.print(text, {max_string:500}));
457
+ $('body').append(_results);
458
+ _results.click(removeResults);
456
459
  };
457
460
 
458
461
  function executeCode () {
459
- result = null;
460
- var codeDiv = $(this);
461
- codeDiv.addClass("executing");
462
- eval(codeDiv.text());
463
- setTimeout(function() { codeDiv.removeClass("executing");}, 250 );
464
- if (result != null) print(result);
462
+ result = null;
463
+ var codeDiv = $(this);
464
+ codeDiv.addClass("executing");
465
+ eval(codeDiv.text());
466
+ setTimeout(function() { codeDiv.removeClass("executing");}, 250 );
467
+ if (result != null) print(result);
465
468
  }
466
469
  $('.sh_javaScript code').live("click", executeCode);
467
470
 
@@ -481,8 +484,8 @@ var preshow_imagesTotal = 0;
481
484
  var preshow_des;
482
485
 
483
486
  function runPreShow() {
484
- if(preshow_running) {
485
- stopPreShow()
487
+ if(preshow_running) {
488
+ stopPreShow()
486
489
  } else {
487
490
  var minutes = prompt("Minutes from now to start")
488
491
  preshow_secondsLeft = parseFloat(minutes) * 60
@@ -496,7 +499,7 @@ function runPreShow() {
496
499
  preshow_des = data
497
500
  })
498
501
  } else {
499
- $('#preshow').append('<img ref="' + n + '" src="/file/_preshow/' + n + '"/>')
502
+ $('#preshow').append('<img ref="' + n + '" src="/file/_preshow/' + n + '"/>')
500
503
  }
501
504
  })
502
505
  startPreShow()
@@ -505,30 +508,30 @@ function runPreShow() {
505
508
  }
506
509
 
507
510
  function startPreShow() {
508
- if (!preshow_running) {
509
- preshow_running = true
510
- preshow_seconds = 0
511
- preshow_images = $('#preshow > img')
512
- preshow_imagesTotal = preshow_images.size()
513
- nextPreShowImage()
514
-
515
- if(!preshow_timerRunning) {
516
- setInterval(function() {
517
- preshow_timerRunning = true
518
- if (!preshow_running) { return }
519
- preshow_seconds++
520
- preshow_secondsLeft--
511
+ if (!preshow_running) {
512
+ preshow_running = true
513
+ preshow_seconds = 0
514
+ preshow_images = $('#preshow > img')
515
+ preshow_imagesTotal = preshow_images.size()
516
+ nextPreShowImage()
517
+
518
+ if(!preshow_timerRunning) {
519
+ setInterval(function() {
520
+ preshow_timerRunning = true
521
+ if (!preshow_running) { return }
522
+ preshow_seconds++
523
+ preshow_secondsLeft--
521
524
  if (preshow_secondsLeft < 0) {
522
525
  stopPreShow()
523
526
  }
524
- if (preshow_seconds == preshow_secondsPer) {
525
- preshow_seconds = 0
526
- nextPreShowImage()
527
- }
527
+ if (preshow_seconds == preshow_secondsPer) {
528
+ preshow_seconds = 0
529
+ nextPreShowImage()
530
+ }
528
531
  addPreShowTips()
529
- }, 1000)
530
- }
531
- }
532
+ }, 1000)
533
+ }
534
+ }
532
535
  }
533
536
 
534
537
  function addPreShowTips() {
@@ -554,11 +557,11 @@ function secondsToTime(sec) {
554
557
 
555
558
  function stopPreShow() {
556
559
  preshow_running = false
557
-
560
+
558
561
  $('#preshow').remove()
559
562
  $('#tips').remove()
560
563
  $('#preshow_timer').remove()
561
-
564
+
562
565
  toggleFooter()
563
566
  loadSlides(loadSlidesBool, loadSlidesPrefix);
564
567
  }