showoffer 0.0.1

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 (206) hide show
  1. data/LICENSE +20 -0
  2. data/README.rdoc +559 -0
  3. data/Rakefile +27 -0
  4. data/bin/showoffer +189 -0
  5. data/lib/commandline_parser.rb +67 -0
  6. data/lib/showoff.rb +515 -0
  7. data/lib/showoff/version.rb +3 -0
  8. data/lib/showoff_utils.rb +360 -0
  9. data/public/css/960.css +653 -0
  10. data/public/css/fg.menu.css +114 -0
  11. data/public/css/onepage.css +60 -0
  12. data/public/css/pdf.css +12 -0
  13. data/public/css/presenter.css +76 -0
  14. data/public/css/reset.css +53 -0
  15. data/public/css/sh_style.css +66 -0
  16. data/public/css/showoff.css +403 -0
  17. data/public/css/spinner_bar.gif +0 -0
  18. data/public/css/theme/images/ui-bg_diagonals-small_100_f0efea_40x40.png +0 -0
  19. data/public/css/theme/images/ui-bg_flat_35_f0f0f0_40x100.png +0 -0
  20. data/public/css/theme/images/ui-bg_glass_55_fcf0ba_1x400.png +0 -0
  21. data/public/css/theme/images/ui-bg_glow-ball_25_2e2e28_600x600.png +0 -0
  22. data/public/css/theme/images/ui-bg_highlight-soft_100_f0efea_1x100.png +0 -0
  23. data/public/css/theme/images/ui-bg_highlight-soft_25_327E04_1x100.png +0 -0
  24. data/public/css/theme/images/ui-bg_highlight-soft_25_5A9D1A_1x100.png +0 -0
  25. data/public/css/theme/images/ui-bg_highlight-soft_95_ffedad_1x100.png +0 -0
  26. data/public/css/theme/images/ui-bg_inset-soft_22_3b3b35_1x100.png +0 -0
  27. data/public/css/theme/images/ui-icons_808080_256x240.png +0 -0
  28. data/public/css/theme/images/ui-icons_8DC262_256x240.png +0 -0
  29. data/public/css/theme/images/ui-icons_cd0a0a_256x240.png +0 -0
  30. data/public/css/theme/images/ui-icons_e7e6e4_256x240.png +0 -0
  31. data/public/css/theme/images/ui-icons_eeeeee_256x240.png +0 -0
  32. data/public/css/theme/images/ui-icons_ffffff_256x240.png +0 -0
  33. data/public/css/theme/ui.accordion.css +9 -0
  34. data/public/css/theme/ui.all.css +2 -0
  35. data/public/css/theme/ui.base.css +9 -0
  36. data/public/css/theme/ui.core.css +37 -0
  37. data/public/css/theme/ui.datepicker.css +62 -0
  38. data/public/css/theme/ui.dialog.css +13 -0
  39. data/public/css/theme/ui.progressbar.css +4 -0
  40. data/public/css/theme/ui.resizable.css +13 -0
  41. data/public/css/theme/ui.slider.css +17 -0
  42. data/public/css/theme/ui.tabs.css +9 -0
  43. data/public/css/theme/ui.theme.css +245 -0
  44. data/public/favicon.ico +0 -0
  45. data/public/highlight/AUTHORS.en.txt +46 -0
  46. data/public/highlight/AUTHORS.ru.txt +46 -0
  47. data/public/highlight/LICENSE +24 -0
  48. data/public/highlight/README.md +136 -0
  49. data/public/highlight/README.ru.md +140 -0
  50. data/public/highlight/classref.txt +437 -0
  51. data/public/highlight/export.html +87 -0
  52. data/public/highlight/highlight.js +630 -0
  53. data/public/highlight/highlight.pack.js +1 -0
  54. data/public/highlight/languages/1c.js +68 -0
  55. data/public/highlight/languages/apache.js +432 -0
  56. data/public/highlight/languages/avrasm.js +75 -0
  57. data/public/highlight/languages/axapta.js +43 -0
  58. data/public/highlight/languages/bash.js +56 -0
  59. data/public/highlight/languages/cmake.js +24 -0
  60. data/public/highlight/languages/cpp.js +62 -0
  61. data/public/highlight/languages/cs.js +41 -0
  62. data/public/highlight/languages/css.js +101 -0
  63. data/public/highlight/languages/delphi.js +70 -0
  64. data/public/highlight/languages/diff.js +64 -0
  65. data/public/highlight/languages/django.js +72 -0
  66. data/public/highlight/languages/dos.js +29 -0
  67. data/public/highlight/languages/erlang-repl.js +81 -0
  68. data/public/highlight/languages/erlang.js +201 -0
  69. data/public/highlight/languages/go.js +58 -0
  70. data/public/highlight/languages/haskell.js +77 -0
  71. data/public/highlight/languages/ini.js +32 -0
  72. data/public/highlight/languages/java.js +45 -0
  73. data/public/highlight/languages/javascript.js +53 -0
  74. data/public/highlight/languages/lisp.js +87 -0
  75. data/public/highlight/languages/lua.js +75 -0
  76. data/public/highlight/languages/mel.js +40 -0
  77. data/public/highlight/languages/nginx.js +224 -0
  78. data/public/highlight/languages/objectivec.js +94 -0
  79. data/public/highlight/languages/parser3.js +52 -0
  80. data/public/highlight/languages/perl.js +143 -0
  81. data/public/highlight/languages/php.js +55 -0
  82. data/public/highlight/languages/profile.js +49 -0
  83. data/public/highlight/languages/python.js +71 -0
  84. data/public/highlight/languages/renderman.js +230 -0
  85. data/public/highlight/languages/ruby.js +203 -0
  86. data/public/highlight/languages/scala.js +60 -0
  87. data/public/highlight/languages/smalltalk.js +55 -0
  88. data/public/highlight/languages/sql.js +90 -0
  89. data/public/highlight/languages/tex.js +62 -0
  90. data/public/highlight/languages/vala.js +75 -0
  91. data/public/highlight/languages/vbscript.js +30 -0
  92. data/public/highlight/languages/vhdl.js +30 -0
  93. data/public/highlight/languages/xml.js +103 -0
  94. data/public/highlight/styles/arta.css +151 -0
  95. data/public/highlight/styles/ascetic.css +45 -0
  96. data/public/highlight/styles/brown_paper.css +105 -0
  97. data/public/highlight/styles/brown_papersq.png +0 -0
  98. data/public/highlight/styles/dark.css +103 -0
  99. data/public/highlight/styles/default.css +121 -0
  100. data/public/highlight/styles/far.css +118 -0
  101. data/public/highlight/styles/github.css +129 -0
  102. data/public/highlight/styles/idea.css +118 -0
  103. data/public/highlight/styles/ir_black.css +103 -0
  104. data/public/highlight/styles/magula.css +118 -0
  105. data/public/highlight/styles/school_book.css +111 -0
  106. data/public/highlight/styles/school_book.png +0 -0
  107. data/public/highlight/styles/solarized_dark.css +96 -0
  108. data/public/highlight/styles/solarized_light.css +96 -0
  109. data/public/highlight/styles/sunburst.css +147 -0
  110. data/public/highlight/styles/vs.css +84 -0
  111. data/public/highlight/styles/zenburn.css +115 -0
  112. data/public/highlight/test.html +1609 -0
  113. data/public/js/coffee-script.js +8 -0
  114. data/public/js/core.js +79 -0
  115. data/public/js/fg.menu.js +645 -0
  116. data/public/js/jTypeWriter.js +26 -0
  117. data/public/js/jquery-1.4.2.min.js +154 -0
  118. data/public/js/jquery-print.js +109 -0
  119. data/public/js/jquery.batchImageLoad.js +56 -0
  120. data/public/js/jquery.cookie.js +96 -0
  121. data/public/js/jquery.cycle.all.js +1284 -0
  122. data/public/js/jquery.doubletap-0.1.js +105 -0
  123. data/public/js/jquery.uuid.js +24 -0
  124. data/public/js/jquery.ws-0.3pre.js +201 -0
  125. data/public/js/onepage.js +5 -0
  126. data/public/js/presenter.js +193 -0
  127. data/public/js/sh_lang/sh_bison.min.js +1 -0
  128. data/public/js/sh_lang/sh_c.min.js +1 -0
  129. data/public/js/sh_lang/sh_caml.min.js +1 -0
  130. data/public/js/sh_lang/sh_changelog.min.js +1 -0
  131. data/public/js/sh_lang/sh_coffeescript.min.js +1 -0
  132. data/public/js/sh_lang/sh_cpp.min.js +1 -0
  133. data/public/js/sh_lang/sh_csharp.min.js +1 -0
  134. data/public/js/sh_lang/sh_css.min.js +1 -0
  135. data/public/js/sh_lang/sh_cucumber.min.js +2 -0
  136. data/public/js/sh_lang/sh_desktop.min.js +1 -0
  137. data/public/js/sh_lang/sh_diff.min.js +1 -0
  138. data/public/js/sh_lang/sh_erlang.min.js +1 -0
  139. data/public/js/sh_lang/sh_flex.min.js +1 -0
  140. data/public/js/sh_lang/sh_glsl.min.js +1 -0
  141. data/public/js/sh_lang/sh_haxe.min.js +1 -0
  142. data/public/js/sh_lang/sh_html.min.js +1 -0
  143. data/public/js/sh_lang/sh_java.min.js +1 -0
  144. data/public/js/sh_lang/sh_javascript.min.js +1 -0
  145. data/public/js/sh_lang/sh_javascript_dom.min.js +1 -0
  146. data/public/js/sh_lang/sh_latex.min.js +1 -0
  147. data/public/js/sh_lang/sh_ldap.min.js +1 -0
  148. data/public/js/sh_lang/sh_log.min.js +1 -0
  149. data/public/js/sh_lang/sh_lsm.min.js +1 -0
  150. data/public/js/sh_lang/sh_m4.min.js +1 -0
  151. data/public/js/sh_lang/sh_makefile.min.js +1 -0
  152. data/public/js/sh_lang/sh_oracle.min.js +1 -0
  153. data/public/js/sh_lang/sh_pascal.min.js +1 -0
  154. data/public/js/sh_lang/sh_perl.min.js +1 -0
  155. data/public/js/sh_lang/sh_php.min.js +1 -0
  156. data/public/js/sh_lang/sh_prolog.min.js +1 -0
  157. data/public/js/sh_lang/sh_properties.min.js +1 -0
  158. data/public/js/sh_lang/sh_python.min.js +1 -0
  159. data/public/js/sh_lang/sh_ruby.min.js +1 -0
  160. data/public/js/sh_lang/sh_scala.min.js +1 -0
  161. data/public/js/sh_lang/sh_sh.min.js +1 -0
  162. data/public/js/sh_lang/sh_slang.min.js +1 -0
  163. data/public/js/sh_lang/sh_sml.min.js +1 -0
  164. data/public/js/sh_lang/sh_spec.min.js +1 -0
  165. data/public/js/sh_lang/sh_sql.min.js +1 -0
  166. data/public/js/sh_lang/sh_tcl.min.js +1 -0
  167. data/public/js/sh_lang/sh_xml.min.js +1 -0
  168. data/public/js/sh_lang/sh_xorg.min.js +1 -0
  169. data/public/js/sh_main.min.js +4 -0
  170. data/public/js/showoff.js +652 -0
  171. data/public/js/showoffcore.js +13 -0
  172. data/public/scripts/script.js +280 -0
  173. data/public/themes/ribbon/fonts/DroidSansMono.svg +626 -0
  174. data/public/themes/ribbon/fonts/DroidSansMono.ttf +0 -0
  175. data/public/themes/ribbon/fonts/PTSans.Bold.Italic.svg +728 -0
  176. data/public/themes/ribbon/fonts/PTSans.Bold.Italic.ttf +0 -0
  177. data/public/themes/ribbon/fonts/PTSans.Bold.Italic.woff +0 -0
  178. data/public/themes/ribbon/fonts/PTSans.Bold.svg +728 -0
  179. data/public/themes/ribbon/fonts/PTSans.Bold.ttf +0 -0
  180. data/public/themes/ribbon/fonts/PTSans.Bold.woff +0 -0
  181. data/public/themes/ribbon/fonts/PTSans.Italic.svg +728 -0
  182. data/public/themes/ribbon/fonts/PTSans.Italic.ttf +0 -0
  183. data/public/themes/ribbon/fonts/PTSans.Italic.woff +0 -0
  184. data/public/themes/ribbon/fonts/PTSans.Narrow.Bold.svg +728 -0
  185. data/public/themes/ribbon/fonts/PTSans.Narrow.Bold.ttf +0 -0
  186. data/public/themes/ribbon/fonts/PTSans.Narrow.Bold.woff +0 -0
  187. data/public/themes/ribbon/fonts/PTSans.Narrow.svg +728 -0
  188. data/public/themes/ribbon/fonts/PTSans.Narrow.ttf +0 -0
  189. data/public/themes/ribbon/fonts/PTSans.Narrow.woff +0 -0
  190. data/public/themes/ribbon/fonts/PTSans.svg +728 -0
  191. data/public/themes/ribbon/fonts/PTSans.ttf +0 -0
  192. data/public/themes/ribbon/fonts/PTSans.woff +0 -0
  193. data/public/themes/ribbon/fonts/TargetBlank.otf +0 -0
  194. data/public/themes/ribbon/fonts/TargetBlank.svg +14 -0
  195. data/public/themes/ribbon/images/grid.png +0 -0
  196. data/public/themes/ribbon/images/linen.png +0 -0
  197. data/public/themes/ribbon/images/ribbon.svg +4 -0
  198. data/public/themes/ribbon/styles/fonts.css +63 -0
  199. data/public/themes/ribbon/styles/print.css +68 -0
  200. data/public/themes/ribbon/styles/reset.css +42 -0
  201. data/public/themes/ribbon/styles/style.css +408 -0
  202. data/views/header.erb +11 -0
  203. data/views/index.erb +13 -0
  204. data/views/onepage.erb +39 -0
  205. data/views/presenter.erb +70 -0
  206. metadata +328 -0
@@ -0,0 +1,105 @@
1
+ (function($) {
2
+ var touchStatus = function(target, touch) {
3
+ this.target = $(target);
4
+ this.touch = touch;
5
+ this.startX = this.currentX = touch.screenX;
6
+ this.startY = this.currentY = touch.screenY;
7
+ this.eventType = null;
8
+ }
9
+ touchStatus.latestTap = null;
10
+
11
+ touchStatus.prototype.move = function(touch) {
12
+ this.currentX = touch.screenX;
13
+ this.currentY = touch.screenY;
14
+ }
15
+
16
+ touchStatus.prototype.process = function() {
17
+ var offsetX = this.currentX - this.startX;
18
+ var offsetY = this.currentY - this.startY;
19
+ if(offsetX == 0 && offsetY == 0) {
20
+ this.checkForDoubleTap()
21
+ } else if(Math.abs(offsetY) > Math.abs(offsetX)) {
22
+ this.eventType = offsetY > 0 ? 'swipedown' : 'swipeup';
23
+ this.target.trigger('swipe', [this])
24
+ } else {
25
+ this.eventType = offsetX > 0 ? 'swiperight' : 'swipeleft';
26
+ this.target.trigger('swipe', [this])
27
+ }
28
+ this.target.trigger(this.eventType, [this])
29
+ this.target.trigger('touch', [this])
30
+ }
31
+
32
+ touchStatus.prototype.checkForDoubleTap = function() {
33
+ if(touchStatus.latestTap) {
34
+ if((new Date() - touchStatus.latestTap) < 400)
35
+ this.eventType = 'doubletap'
36
+ }
37
+ if(!this.eventType) this.eventType = 'tap'
38
+ touchStatus.latestTap = new Date()
39
+ }
40
+
41
+ var swipeEvents = function(elements) {
42
+ elements.bind('touchstart', this.touchStart);
43
+ elements.bind('touchmove', this.touchMove);
44
+ elements.bind('touchcancel', this.touchCancel);
45
+ elements.bind('touchend', this.touchEnd);
46
+ }
47
+
48
+ swipeEvents.prototype.touchStart = function(evt) {
49
+ var target = this;
50
+ swipeEvents.eachTouch(evt, function(touch) {
51
+ swipeEvents.touches[touch.identifier] = new touchStatus(target, touch);
52
+ })
53
+ }
54
+
55
+ swipeEvents.prototype.touchMove = function(evt) {
56
+ swipeEvents.eachTouch(evt, function(touch) {
57
+ var loc = swipeEvents.touches[touch.identifier]
58
+ if(loc) loc.move(touch)
59
+ })
60
+ }
61
+
62
+ swipeEvents.prototype.touchCancel = function(evt) {
63
+ swipeEvents.eachTouch(evt, function(touch) {
64
+ swipeEvents.purge(touch, true)
65
+ })
66
+ }
67
+
68
+ swipeEvents.prototype.touchEnd = function(evt) {
69
+ swipeEvents.eachTouch(evt, function(touch) {
70
+ swipeEvents.purge(touch)
71
+ })
72
+ }
73
+
74
+ swipeEvents.touches = {}
75
+ swipeEvents.purge = function(touch, cancelled) {
76
+ if(!cancelled) {
77
+ var loc = swipeEvents.touches[touch.identifier]
78
+ if(loc) loc.process()
79
+ }
80
+ delete swipeEvents.touches[touch.identifier]
81
+ }
82
+
83
+ swipeEvents.eachTouch = function(evt, callback) {
84
+ var evt = evt.originalEvent;
85
+ var num = evt.changedTouches.length;
86
+ for(var i = 0; i < num; i++) {
87
+ callback(evt.changedTouches[i])
88
+ }
89
+ }
90
+
91
+ // adds custom events:
92
+ // touch // all events
93
+ // swipe // only swipe* events
94
+ // swipeleft
95
+ // swiperight
96
+ // swipeup
97
+ // swipedown
98
+ // tap
99
+ // doubletap
100
+ $.fn.addSwipeEvents = function(callback) {
101
+ new swipeEvents(this);
102
+ if(callback) this.bind('touch', callback)
103
+ return this;
104
+ }
105
+ })(jQuery);
@@ -0,0 +1,24 @@
1
+ /*
2
+ Usage 1: define the default prefix by using an object with the property prefix as a parameter which contains a string value; {prefix: 'id'}
3
+ Usage 2: call the function jQuery.uuid() with a string parameter p to be used as a prefix to generate a random uuid;
4
+ Usage 3: call the function jQuery.uuid() with no parameters to generate a uuid with the default prefix; defaul prefix: '' (empty string)
5
+ */
6
+
7
+ /*
8
+ Generate fragment of random numbers
9
+ */
10
+ jQuery._uuid_default_prefix = '';
11
+ jQuery._uuidlet = function () {
12
+ return(((1+Math.random())*0x10000)|0).toString(16).substring(1);
13
+ };
14
+ /*
15
+ Generates random uuid
16
+ */
17
+ jQuery.uuid = function (p) {
18
+ if (typeof(p) == 'object' && typeof(p.prefix) == 'string') {
19
+ jQuery._uuid_default_prefix = p.prefix;
20
+ } else {
21
+ p = p || jQuery._uuid_default_prefix || '';
22
+ return(p+jQuery._uuidlet()+jQuery._uuidlet()+"-"+jQuery._uuidlet()+"-"+jQuery._uuidlet()+"-"+jQuery._uuidlet()+"-"+jQuery._uuidlet()+jQuery._uuidlet()+jQuery._uuidlet());
23
+ };
24
+ };
@@ -0,0 +1,201 @@
1
+
2
+ (function($){
3
+
4
+ $.ws = {
5
+
6
+ //==========================================================
7
+ // jQuery plugin jquery.ws.js
8
+ // for Web Sockets
9
+ // need Browser Chrome4.0.249.0+
10
+ // Demo http://bloga.jp/ws/jq/
11
+ // serverside sample @see http://blog.livedoor.jp/kotesaki/archives/1355651.html
12
+
13
+ name : "ws",
14
+ version : "0.3-noenc-pre",
15
+ demo : "http://bloga.jp/ws/jq/conn/b1.htm",
16
+ author : "Toshiro Takahashi",
17
+ lisence : "same as jQuery @see http://docs.jquery.com/Licensing",
18
+ update : 'http://jsgt.org/lib/jquery/plugin/ws/update.txt',
19
+ ver : '<span class="wsVersion" style="color:#aaa"></span><script>'
20
+ + 'jQuery(function($){ $(".wsVersion").html("version:ws-"+$.ws.version) })'
21
+ + '</script>',
22
+
23
+ //Default settings
24
+ wsSettings: {
25
+ url : "ws://"+location.host,
26
+ data : null,//The data which transmit a message
27
+ onopen : function(e){},//callback on opened.
28
+ onmessage : function(msg,wsObject){},//callback on received
29
+ onclose : function(){},//callback on cloased
30
+ hbStr : "Heartbeat",//if null then no Heartbeat
31
+ hbinterval : 60000,//dafault 60sec, min=5000
32
+ onheartbeat: function(){}//callback on heartbeatsended
33
+ },
34
+ wsSetup: function( settings ) {
35
+ jQuery.extend( jQuery.ws.wsSettings, settings );
36
+ }
37
+
38
+ //Note: if you want to stop no-support alert dialog,
39
+ //$.ws.wsSetup({nonosupportmsg:true});
40
+ };
41
+
42
+ /*
43
+ //==========================================================
44
+ // Method
45
+ // Basic Method of this pulgin for Web Sockets
46
+
47
+ $.conn( settings )
48
+
49
+ */
50
+ $.extend($.ws ,{
51
+
52
+ conn : function( s ){
53
+
54
+ s = $.extend(true, s, $.extend(true, {}, $.ws.wsSettings, s));
55
+
56
+ if ("WebSocket" in window) {
57
+
58
+ var url=s.url ,
59
+ //WS Object
60
+ wsoj = new WebSocket( url ) ,
61
+ data = s.data ,
62
+ //Heartbeat
63
+ _MIN_HBINTERVAL=5000,
64
+ _INI_HBINTERVAL=60000,
65
+ hbtimer=null,
66
+ hbStr = (s.hbStr===null)?null:(typeof s.hbStr==='string')?s.hbStr:'Heartbeat',
67
+ hbinterval = (typeof s.hbinterval==='number')?
68
+ (s.hbinterval>=_MIN_HBINTERVAL)?s.hbinterval:_INI_HBINTERVAL
69
+ :_INI_HBINTERVAL;
70
+
71
+ //WS Events bind
72
+ $(wsoj)
73
+ .bind("open",function(e){
74
+ if(s.onopen){ s.onopen(e); } ;
75
+ if(s.hbStr!==null){
76
+ hbtimer = setInterval(function(){
77
+ $(wsoj).wssend(hbStr);
78
+ if(wsoj.onheartbeat){wsoj.onheartbeat(wsoj)}
79
+ }, hbinterval);
80
+ }
81
+ })
82
+ .bind("message",function(e){
83
+ if(s.onmessage){
84
+ s.onmessage(
85
+ e.originalEvent.data
86
+ .replace(/<script(.|\s)*?\/script>/g, ""),
87
+ wsoj
88
+ );
89
+ }
90
+ })
91
+ .bind("close",function(){
92
+ if(s.onclose){
93
+ s.onclose();
94
+ }
95
+ if(hbtimer) {
96
+ clearInterval(hbtimer);
97
+ hbtimer = null;
98
+ }
99
+ wsoj=null;
100
+ });
101
+
102
+ //Add Event to only Instance for on after Hertbeat
103
+ if(s.hbStr!==null){
104
+ wsoj.onheartbeat=function(woj){
105
+ s.onheartbeat(woj);
106
+ }
107
+ }
108
+
109
+ //WS send
110
+ $(wsoj).wssend(data);
111
+
112
+ //WS auto cloase
113
+ $(window)
114
+ .bind("unload",function(e){
115
+ wsoj.close();wsoj=null;
116
+ });
117
+
118
+ return wsoj;
119
+
120
+ } else {
121
+ //no support, message once.
122
+ if(!$.ws.nosupport){
123
+ if(!s.nonosupportmsg)
124
+ alert("no support, please use Chrome4 (v 4.0.238.0 +) or \n Safari nightly");
125
+ $.ws.nosupport=true;
126
+ }
127
+ }
128
+ }
129
+
130
+ });
131
+
132
+ /*
133
+ //==========================================================
134
+ // Method
135
+ // Sub Methods for Web Sockets
136
+
137
+ $(Selectors).wsload( url, data, fn )
138
+ $(Selectors).wssend(data)
139
+ $(Selectors).wsclose()
140
+
141
+ */
142
+ $.fn.extend({
143
+
144
+ //like $(Selectors).load() Some codes from jQuery1.3.2
145
+ wsload : function( url, data, fn ){
146
+
147
+ var off = url.indexOf(" ");
148
+ if ( off >= 0 ) {
149
+ var selector = url.slice(off, url.length);
150
+ url = url.slice(0, off);
151
+ }
152
+
153
+ if ( data )
154
+ if ( $.isFunction( data ) ) {
155
+ fn = data;
156
+ data = null;
157
+ } else if( typeof data === "object" ) {
158
+ data = $.param( data );
159
+ }
160
+ var self = this;
161
+
162
+ $.ws.conn({
163
+ url : url,
164
+ data : data,
165
+ onmessage : function(msg, wsoj){
166
+ if ( wsoj.readyState == wsoj.OPEN )
167
+ self.html( selector ?
168
+ $("<div/>")
169
+ .append(msg)
170
+ .find(selector) :
171
+ msg );
172
+
173
+ if( fn )
174
+ self.each( fn, [msg, wsoj.readyState, wsoj] );
175
+ }
176
+ });
177
+
178
+ return this;
179
+ },
180
+
181
+ //Send to WS Server $(webSocketOj).wssend(data)
182
+ wssend : function(data){
183
+ var oj=this[0];
184
+ if(typeof oj!=="object" && oj.toString()!=="[object WebSocket]"){return this;}
185
+ if(data){
186
+ oj.send(data);
187
+ }
188
+ return this;
189
+ },
190
+
191
+ //Close Web Sockets
192
+ wsclose : function(){
193
+ var oj=this[0];
194
+ if(typeof oj!=="object" && oj.toString()!=="[object WebSocket]"){return this;}
195
+ oj.close();
196
+ oj=null;
197
+ return this;
198
+ }
199
+ });
200
+
201
+ })(jQuery)
@@ -0,0 +1,5 @@
1
+ function setupOnePage() {
2
+ sh_highlightDocument('/js/sh_lang/', '.min.js')
3
+
4
+ centerSlides($("#slides > .slide"))
5
+ }
@@ -0,0 +1,193 @@
1
+ // presenter js
2
+ var w = null;
3
+
4
+ $(function(){
5
+ w = window.open('/' + window.location.search);
6
+ // side menu accordian crap
7
+ $("#preso").bind("showoff:loaded", function (event) {
8
+ $(".menu > ul ul").hide()
9
+ $(".menu > ul a").click(function() {
10
+ if ($(this).next().is('ul')) {
11
+ $(this).next().toggle()
12
+ } else {
13
+ gotoSlide($(this).attr('rel'))
14
+ w.gotoSlide($(this).attr('rel'))
15
+ postSlide()
16
+ }
17
+ return false
18
+ }).next().hide()
19
+ })
20
+ $("#minStop").hide()
21
+ $("#startTimer").click(function() { toggleTimer() })
22
+ $("#stopTimer").click(function() { toggleTimer() })
23
+ });
24
+
25
+ function presPrevStep()
26
+ {
27
+ prevStep()
28
+ w.prevStep()
29
+ postSlide()
30
+ }
31
+
32
+ function presNextStep()
33
+ {
34
+ nextStep()
35
+ w.nextStep()
36
+ postSlide()
37
+ }
38
+
39
+ function postSlide()
40
+ {
41
+ if(currentSlide) {
42
+ var notes = w.getCurrentNotes()
43
+ var fileName = currentSlide.children().first().attr('ref')
44
+ $('#notes').text(notes)
45
+ $('#slideFile').text(fileName)
46
+ }
47
+ }
48
+
49
+ // See e.g. http://www.quirksmode.org/js/keys.html for keycodes
50
+ function keyDown(event)
51
+ {
52
+ var key = event.keyCode;
53
+
54
+ if (event.ctrlKey || event.altKey || event.metaKey)
55
+ return true;
56
+
57
+ debug('keyDown: ' + key)
58
+
59
+ if (key >= 48 && key <= 57) // 0 - 9
60
+ {
61
+ gotoSlidenum = gotoSlidenum * 10 + (key - 48);
62
+ return true;
63
+ }
64
+
65
+ if (key == 13) {
66
+ if (gotoSlidenum > 0) {
67
+ debug('go to ' + gotoSlidenum);
68
+ slidenum = gotoSlidenum - 1;
69
+ showSlide(true);
70
+ w.slidenum = gotoSlidenum - 1;
71
+ w.showSlide(true);
72
+ gotoSlidenum = 0;
73
+ } else {
74
+ debug('executeCode');
75
+ executeAnyCode();
76
+ w.executeAnyCode();
77
+ }
78
+ }
79
+
80
+ if (key == 16) // shift key
81
+ {
82
+ shiftKeyActive = true;
83
+ }
84
+
85
+ if (key == 32) // space bar
86
+ {
87
+ if (shiftKeyActive) {
88
+ presPrevStep()
89
+ } else {
90
+ presNextStep()
91
+ }
92
+ }
93
+ else if (key == 68) // 'd' for debug
94
+ {
95
+ debugMode = !debugMode
96
+ doDebugStuff()
97
+ }
98
+ else if (key == 37 || key == 33 || key == 38) // Left arrow, page up, or up arrow
99
+ {
100
+ presPrevStep()
101
+ }
102
+ else if (key == 39 || key == 34 || key == 40) // Right arrow, page down, or down arrow
103
+ {
104
+ presNextStep()
105
+ }
106
+ else if (key == 84 || key == 67) // T or C for table of contents
107
+ {
108
+ $('#navmenu').toggle().trigger('click')
109
+ }
110
+ else if (key == 90 || key == 191) // z or ? for help
111
+ {
112
+ $('#help').toggle()
113
+ }
114
+ else if (key == 66 || key == 70) // f for footer (also "b" which is what kensington remote "stop" button sends
115
+ {
116
+ toggleFooter()
117
+ }
118
+ else if (key == 78) // 'n' for notes
119
+ {
120
+ toggleNotes()
121
+ }
122
+ else if (key == 27) // esc
123
+ {
124
+ removeResults();
125
+ w.removeResults();
126
+ }
127
+ else if (key == 80) // 'p' for preshow
128
+ {
129
+ w.togglePreShow();
130
+ }
131
+ return true
132
+ }
133
+
134
+ //* TIMER *//
135
+
136
+ var timerSetUp = false;
137
+ var timerRunning = false;
138
+ var intervalRunning = false;
139
+ var seconds = 0;
140
+ var totalMinutes = 35;
141
+
142
+ function toggleTimer()
143
+ {
144
+ if (!timerRunning) {
145
+ timerRunning = true
146
+ totalMinutes = parseInt($("#timerMinutes").attr('value'))
147
+ $("#minStart").hide()
148
+ $("#minStop").show()
149
+ $("#timerInfo").text(timerStatus(0));
150
+ seconds = 0
151
+ if (!intervalRunning) {
152
+ intervalRunning = true
153
+ setInterval(function() {
154
+ if (!timerRunning) { return; }
155
+ seconds++;
156
+ $("#timerInfo").text(timerStatus(seconds));
157
+ }, 1000); // fire every minute
158
+ }
159
+ } else {
160
+ seconds = 0
161
+ timerRunning = false
162
+ totalMinutes = 0
163
+ $("#timerInfo").text('')
164
+ $("#minStart").show()
165
+ $("#minStop").hide()
166
+ }
167
+ }
168
+
169
+ function timerStatus(seconds) {
170
+ var minutes = Math.round(seconds / 60);
171
+ var left = (totalMinutes - minutes);
172
+ var percent = Math.round((minutes / totalMinutes) * 100);
173
+ var progress = getSlidePercent() - percent;
174
+ setProgressColor(progress);
175
+ return minutes + '/' + left + ' - ' + percent + '%';
176
+ }
177
+
178
+ function setProgressColor(progress) {
179
+ ts = $('#timerSection')
180
+ ts.removeClass('tBlue')
181
+ ts.removeClass('tGreen')
182
+ ts.removeClass('tYellow')
183
+ ts.removeClass('tRed')
184
+ if(progress > 10) {
185
+ ts.addClass('tBlue')
186
+ } else if (progress > 0) {
187
+ ts.addClass('tGreen')
188
+ } else if (progress > -10) {
189
+ ts.addClass('tYellow')
190
+ } else {
191
+ ts.addClass('tRed')
192
+ }
193
+ }