showoff 0.14.3 → 0.15.0

Sign up to get free protection for your applications and to get access to all the features.
data/public/js/showoff.js CHANGED
@@ -68,11 +68,6 @@ function setupPreso(load_slides, prefix) {
68
68
  // give us the ability to disable tracking via url parameter
69
69
  if(query.track == 'false') mode.track = false;
70
70
 
71
- // make sure that the next view doesn't bugger things on the first load
72
- if(query.next == 'true') {
73
- mode.next = true;
74
- }
75
-
76
71
  // Make sure the slides always look right.
77
72
  // Better would be dynamic calculations, but this is enough for now.
78
73
  zoom();
@@ -87,20 +82,24 @@ function setupPreso(load_slides, prefix) {
87
82
  }
88
83
  }
89
84
 
90
- function loadSlides(load_slides, prefix, reload) {
85
+ function loadSlides(load_slides, prefix, reload, hard) {
91
86
  var url = loadSlidesPrefix + "slides";
92
87
  if (reload) {
93
88
  url += "?cache=clear";
94
89
  }
90
+
95
91
  //load slides offscreen, wait for images and then initialize
92
+ $('body').addClass('busy');
96
93
  if (load_slides) {
97
94
  $("#slides").load(url, false, function(){
98
- $("#slides img").batchImageLoad({
99
- loadingCompleteCallback: initializePresentation(prefix)
100
- });
101
- if (reload) {
95
+ if(hard) {
102
96
  location.reload(true);
103
97
  }
98
+ else {
99
+ $("#slides img").batchImageLoad({
100
+ loadingCompleteCallback: initializePresentation(prefix)
101
+ });
102
+ }
104
103
  })
105
104
  } else {
106
105
  $("#slides img").batchImageLoad({
@@ -126,7 +125,7 @@ function initializePresentation(prefix) {
126
125
  timeout: 0
127
126
  })
128
127
 
129
- setupMenu()
128
+ setupMenu();
130
129
 
131
130
  if (slidesLoaded) {
132
131
  showSlide()
@@ -136,6 +135,8 @@ function initializePresentation(prefix) {
136
135
  }
137
136
  setupSlideParamsCheck();
138
137
 
138
+ // Remove spinner in case we're reloading
139
+ $('body').removeClass('busy');
139
140
 
140
141
  $('pre.highlight code').each(function(i, block) {
141
142
  try {
@@ -187,20 +188,18 @@ function zoom(presenter) {
187
188
 
188
189
  var newZoom = Math.min(hBody/hSlide, wBody/wSlide);
189
190
 
190
- // Because Firefox's transform doesn't scale up very well
191
- newZoom = newZoom > 1 ? 1 : newZoom - .04;
191
+ // match the 65/35 split in the stylesheet for the side-by-side layout
192
+ if($("#preview").hasClass("beside")) {
193
+ wBody *= 0.64;
194
+ newZoom = Math.min(hBody/hSlide, wBody/wSlide);
195
+ }
192
196
 
193
- // Calculate the new offsets to roughly center the preview again
194
- var hPos = (hBody - (hSlide * newZoom)) / 2;
195
- var wPos = (wBody - (wSlide * newZoom)) / 2;
197
+ // Calculate margins to center the thing *before* scaling
198
+ var hMargin = (hBody - hSlide) /2;
199
+ var wMargin = (wBody - wSlide) /2;
196
200
 
197
- preso.css("zoom", newZoom);
198
- preso.css("-ms-zoom", newZoom);
199
- preso.css("-webkit-zoom", newZoom);
200
- // Firefox doesn't support zoom
201
- // Don't use standard transform to avoid modifying Chrome
202
- preso.css("-moz-transform", "scale(" + newZoom + ") translateX(" + wPos + "px) translateY(" + hPos + "px)");
203
- preso.css("-moz-transform-origin", "0 0");
201
+ preso.css("margin", hMargin + "px " + wMargin + "px");
202
+ preso.css("transform", "scale(" + newZoom + ")");
204
203
 
205
204
  // correct the zoom factor for the presenter
206
205
  if (presenter) {
@@ -212,7 +211,6 @@ function zoom(presenter) {
212
211
 
213
212
  // TODO: When we fix the presenter on IE so the viewport isn't all wack, we
214
213
  // may have to revisit this.
215
-
216
214
  var zoomLevel = Number( preso.css('zoom') ) || 1;
217
215
  annotations.zoom = 1 / zoomLevel
218
216
  }
@@ -456,8 +454,9 @@ function setupSlideParamsCheck() {
456
454
  function gotoSlide(slideNum, updatepv) {
457
455
  var newslide = parseInt(slideNum);
458
456
  if (slidenum != newslide && !isNaN(newslide)) {
457
+ var back = (newslide == (slidenum - 1))
459
458
  slidenum = newslide;
460
- showSlide(false, updatepv);
459
+ showSlide(back, updatepv);
461
460
  }
462
461
  }
463
462
 
@@ -543,7 +542,7 @@ function showSlide(back_step, updatepv) {
543
542
 
544
543
 
545
544
  // Update presenter view, if we spawned one
546
- if (updatepv && 'presenterView' in window && ! mode.next) {
545
+ if (updatepv && 'presenterView' in window) {
547
546
  var pv = window.presenterView;
548
547
  pv.slidenum = slidenum;
549
548
  pv.incrCurr = incrCurr
@@ -617,7 +616,7 @@ function determineIncremental()
617
616
  {
618
617
  incrCurr = 0
619
618
  incrCode = false
620
- incrElem = currentSlide.find(".incremental > ul > li")
619
+ incrElem = currentSlide.find(".incremental li")
621
620
  incrSteps = incrElem.size()
622
621
  if(incrSteps == 0) {
623
622
  // also look for commandline
@@ -897,7 +896,7 @@ function parseMessage(data) {
897
896
  try {
898
897
  switch (command['message']) {
899
898
  case 'current':
900
- follow(command["current"]);
899
+ follow(command["current"], command["increment"]);
901
900
  break;
902
901
 
903
902
  case 'complete':
@@ -1027,10 +1026,29 @@ function editSlide() {
1027
1026
  window.open(link);
1028
1027
  }
1029
1028
 
1030
- function follow(slide) {
1029
+ function follow(slide, newIncrement) {
1031
1030
  if (mode.follow) {
1031
+ var lastSlide = slidenum;
1032
1032
  console.log("New slide: " + slide);
1033
1033
  gotoSlide(slide);
1034
+
1035
+ if( ! $("body").hasClass("presenter") ) {
1036
+ switch (slidenum - lastSlide) {
1037
+ case -1:
1038
+ fireEvent("showoff:prev");
1039
+ break;
1040
+
1041
+ case 1:
1042
+ fireEvent("showoff:next");
1043
+ break;
1044
+ }
1045
+
1046
+ // if the master says we're incrementing. Use a loop in case the viewer is out of sync
1047
+ while(newIncrement > incrCurr) {
1048
+ increment();
1049
+ }
1050
+
1051
+ }
1034
1052
  }
1035
1053
  }
1036
1054
 
@@ -1039,41 +1057,44 @@ function getPosition() {
1039
1057
  ws.send(JSON.stringify({ message: 'position' }));
1040
1058
  }
1041
1059
 
1060
+ function fireEvent(ev) {
1061
+ var event = jQuery.Event(ev);
1062
+ $(currentSlide).find(".content").trigger(event);
1063
+ if (event.isDefaultPrevented()) {
1064
+ return;
1065
+ }
1066
+ }
1067
+
1068
+ function increment() {
1069
+ showIncremental(incrCurr);
1070
+
1071
+ var incrEvent = jQuery.Event("showoff:incr");
1072
+ incrEvent.slidenum = slidenum;
1073
+ incrEvent.incr = incrCurr;
1074
+ $(currentSlide).find(".content").trigger(incrEvent);
1075
+
1076
+ incrCurr++;
1077
+ }
1078
+
1042
1079
  function prevStep(updatepv)
1043
1080
  {
1044
- var event = jQuery.Event("showoff:prev");
1045
- $(currentSlide).find(".content").trigger(event);
1046
- if (event.isDefaultPrevented()) {
1047
- return;
1048
- }
1049
-
1081
+ fireEvent("showoff:prev");
1050
1082
  track();
1051
-
1052
- slidenum--
1053
- return showSlide(true, updatepv) // We show the slide fully loaded
1083
+ slidenum--;
1084
+ return showSlide(true, updatepv); // We show the slide fully loaded
1054
1085
  }
1055
1086
 
1056
1087
  function nextStep(updatepv)
1057
1088
  {
1058
- var event = jQuery.Event("showoff:next");
1059
- $(currentSlide).find(".content").trigger(event);
1060
- if (event.isDefaultPrevented()) {
1061
- return;
1062
- }
1063
-
1064
- track();
1089
+ fireEvent("showoff:next");
1090
+ track();
1065
1091
 
1066
- if (incrCurr >= incrSteps) {
1067
- slidenum++
1068
- return showSlide(false, updatepv)
1069
- } else {
1070
- showIncremental(incrCurr);
1071
- var incrEvent = jQuery.Event("showoff:incr");
1072
- incrEvent.slidenum = slidenum;
1073
- incrEvent.incr = incrCurr;
1074
- $(currentSlide).find(".content").trigger(incrEvent);
1075
- incrCurr++;
1076
- }
1092
+ if (incrCurr >= incrSteps) {
1093
+ slidenum++;
1094
+ return showSlide(false, updatepv);
1095
+ } else {
1096
+ increment();
1097
+ }
1077
1098
  }
1078
1099
 
1079
1100
  // carrying on our grand tradition of overwriting functions of the same name with presenter.js
@@ -1172,19 +1193,20 @@ function keyDown(event){
1172
1193
  }
1173
1194
 
1174
1195
  switch(getAction(event)) {
1175
- case 'DEBUG': toggleDebug(); break;
1176
- case 'PREV': prevStep(); break;
1177
- case 'NEXT': nextStep(); break;
1178
- case 'RELOAD': reloadSlides(); break;
1179
- case 'CONTENTS': toggleContents(); break;
1180
- case 'HELP': toggleHelp(); break;
1181
- case 'BLANK': blankScreen(); break;
1182
- case 'FOOTER': toggleFooter(); break;
1183
- case 'FOLLOW': toggleFollow(); break;
1184
- case 'NOTES': toggleNotes(); break;
1185
- case 'CLEAR': removeResults(); break;
1186
- case 'PAUSE': togglePause(); break;
1187
- case 'PRESHOW': togglePreShow(); break;
1196
+ case 'DEBUG': toggleDebug(); break;
1197
+ case 'PREV': prevStep(); break;
1198
+ case 'NEXT': nextStep(); break;
1199
+ case 'REFRESH': reloadSlides(); break;
1200
+ case 'RELOAD': reloadSlides(true); break;
1201
+ case 'CONTENTS': toggleContents(); break;
1202
+ case 'HELP': toggleHelp(); break;
1203
+ case 'BLANK': blankScreen(); break;
1204
+ case 'FOOTER': toggleFooter(); break;
1205
+ case 'FOLLOW': toggleFollow(); break;
1206
+ case 'NOTES': toggleNotes(); break;
1207
+ case 'CLEAR': removeResults(); break;
1208
+ case 'PAUSE': togglePause(); break;
1209
+ case 'PRESHOW': togglePreShow(); break;
1188
1210
  case 'EXECUTE':
1189
1211
  debug('executeCode');
1190
1212
  executeVisibleCodeBlock();
@@ -1243,11 +1265,17 @@ function toggleDebug () {
1243
1265
  doDebugStuff();
1244
1266
  }
1245
1267
 
1246
- function reloadSlides () {
1247
- if (confirm('Are you sure you want to reload the slides?')) {
1248
- $('html,body').css('cursor','progress');
1249
- loadSlides(loadSlidesBool, loadSlidesPrefix, true);
1250
- showSlide();
1268
+ function reloadSlides (hard) {
1269
+ if(hard) {
1270
+ var message = 'Are you sure you want to reload Showoff?';
1271
+ }
1272
+ else {
1273
+ var message = "Are you sure you want to refresh the slide content?\n\n";
1274
+ message += '(Use `RELOAD` to fully reload the entire UI)';
1275
+ }
1276
+
1277
+ if (confirm(message)) {
1278
+ loadSlides(loadSlidesBool, loadSlidesPrefix, true, hard);
1251
1279
  }
1252
1280
  }
1253
1281
 
data/views/header.erb CHANGED
@@ -8,26 +8,25 @@
8
8
  <% end %>
9
9
 
10
10
  <link rel="stylesheet" type="text/css" href="<%= @asset_path %>/css/highlight/<%= @highlightStyle %>.css" />
11
- <link rel="stylesheet" type="text/css" href="<%= @asset_path %>/css/showoff.css" />
11
+ <link rel="stylesheet" type="text/css" href="<%= @asset_path %>/css/showoff.css?v=<%= SHOWOFF_VERSION %>" />
12
12
  <link rel="stylesheet" type="text/css" href="<%= @asset_path %>/css/font-awesome-4.4.0/css/font-awesome.min.css">
13
13
 
14
14
  <script type="text/javascript" src="<%= @asset_path %>/js/jquery-2.1.4.min.js"></script>
15
15
 
16
- <script type="text/javascript" src="<%= @asset_path %>/js/jquery.cycle.all.js"></script>
16
+ <script type="text/javascript" src="<%= @asset_path %>/js/jquery.cycle.all-2.8.0.js"></script>
17
17
  <script type="text/javascript" src="<%= @asset_path %>/js/jquery-print.js"></script>
18
- <script type="text/javascript" src="<%= @asset_path %>/js/jquery.batchImageLoad.js"></script>
19
- <script type="text/javascript" src="<%= @asset_path %>/js/jquery.parsequery.min.js"></script>
20
- <script type="text/javascript" src="<%= @asset_path %>/js/jquery.doubletap-0.1.js"></script>
21
- <script type="text/javascript" src="<%= @asset_path %>/js/jTypeWriter.js"> </script>
22
- <script type="text/javascript" src="<%= @asset_path %>/js/highlight.pack.js"></script>
18
+ <script type="text/javascript" src="<%= @asset_path %>/js/jquery.batchImageLoad-1.0.0.js"></script>
19
+ <script type="text/javascript" src="<%= @asset_path %>/js/jquery.parsequery.min-6a20f83.js"></script>
20
+ <script type="text/javascript" src="<%= @asset_path %>/js/jquery.doubletap-4ff02c5.js"></script>
21
+ <script type="text/javascript" src="<%= @asset_path %>/js/jTypeWriter-1.1.js"></script>
22
+ <script type="text/javascript" src="<%= @asset_path %>/js/highlight.pack-9.2.0.js"></script>
23
23
 
24
- <script type="text/javascript" src="<%= @asset_path %>/js/coffee-script.js"></script>
24
+ <script type="text/javascript" src="<%= @asset_path %>/js/coffee-script-1.1.3-pre.js"></script>
25
25
 
26
- <script type="text/javascript" src="<%= @asset_path %>/js/annotations.js"></script>
27
- <script type="text/javascript" src="<%= @asset_path %>/js/showoff.js"></script>
26
+ <script type="text/javascript" src="<%= @asset_path %>/js/annotations.js?v=<%= SHOWOFF_VERSION %>"></script>
27
+ <script type="text/javascript" src="<%= @asset_path %>/js/showoff.js?v=<%= SHOWOFF_VERSION %>"></script>
28
28
 
29
29
  <% css_files.each do |css_file| %>
30
- <% alternate = ShowOffUtils.default_style?(css_file) ? '' : 'alternate ' %>
31
30
  <link rel="stylesheet" href="<%= @asset_path %>/file/<%= css_file %>" type="text/css"/>
32
31
  <% end %>
33
32
 
@@ -7,15 +7,14 @@
7
7
  <link rel="icon" href="<%= @favicon %>"/>
8
8
  <% end %>
9
9
 
10
- <link rel="stylesheet" type="text/css" href="<%= @asset_path %>/css/showoff.css" />
10
+ <link rel="stylesheet" type="text/css" href="<%= @asset_path %>/css/showoff.css?v=<%= SHOWOFF_VERSION %>" />
11
11
  <link rel="stylesheet" type="text/css" href="<%= @asset_path %>/css/font-awesome-4.4.0/css/font-awesome.min.css">
12
12
 
13
13
  <script type="text/javascript" src="<%= @asset_path %>/js/jquery-2.1.4.min.js"></script>
14
14
 
15
- <script type="text/javascript" src="<%= @asset_path %>/js/showoff.js"></script>
15
+ <script type="text/javascript" src="<%= @asset_path %>/js/showoff.js?v=<%= SHOWOFF_VERSION %>"></script>
16
16
 
17
17
  <% css_files.each do |css_file| %>
18
- <% alternate = ShowOffUtils.default_style?(css_file) ? '' : 'alternate ' %>
19
18
  <link rel="stylesheet" href="<%= @asset_path %>/file/<%= css_file %>" type="text/css"/>
20
19
  <% end %>
21
20
 
data/views/help.erb CHANGED
@@ -29,7 +29,12 @@
29
29
  <hr />
30
30
 
31
31
  <div>
32
- <span class="description">Reload all slides.</span>
32
+ <span class="description">Refresh slide content.</span>
33
+ <span class="action">REFRESH</span>
34
+ <span class="hotkeys"><%= mapped_keys('REFRESH') %></span>
35
+ </div>
36
+ <div>
37
+ <span class="description">Completely reload Showoff.</span>
33
38
  <span class="action">RELOAD</span>
34
39
  <span class="hotkeys"><%= mapped_keys('RELOAD') %></span>
35
40
  </div>
data/views/presenter.erb CHANGED
@@ -3,17 +3,17 @@
3
3
  <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
4
  <head>
5
5
  <%= erb :header %>
6
- <link rel="stylesheet" href="<%= @asset_path %>/css/presenter.css" type="text/css"/>
7
- <link href="<%= @asset_path %>/css/TimeCircles.css" rel="stylesheet">
8
- <script type="text/javascript" src="<%= @asset_path %>/js/TimeCircles.js"></script>
9
- <script type="text/javascript" src="<%= @asset_path %>/js/presenter.js"></script>
6
+ <link rel="stylesheet" href="<%= @asset_path %>/css/presenter.css?v=<%= SHOWOFF_VERSION %>" type="text/css"/>
7
+ <link href="<%= @asset_path %>/css/TimeCircles-89ac5ae.css" rel="stylesheet">
8
+ <script type="text/javascript" src="<%= @asset_path %>/js/TimeCircles-89ac5ae.js"></script>
9
+ <script type="text/javascript" src="<%= @asset_path %>/js/presenter.js?v=<%= SHOWOFF_VERSION %>"></script>
10
10
  <script type="text/javascript">
11
11
  editUrl = "<%= @edit %>";
12
12
  issueUrl = "<%= @issues %>";
13
13
  </script>
14
14
  </head>
15
15
 
16
- <body>
16
+ <body class="presenter">
17
17
  <%= erb :help %>
18
18
 
19
19
  <div id="main">
@@ -40,7 +40,6 @@
40
40
  </span>
41
41
  <span>
42
42
  <a id="slaveWindow" href="javascript:toggleSlave();" title="Enable the display window.">Display Window <i class="fa fa-clone"></i></a>
43
- <a id="nextWindow" href="javascript:toggleNext();" title="Enable the next window view.">Next Window <i class="fa fa-clone"></i></a>
44
43
  <a id="notesWindow" href="javascript:toggleNotes();" title="Enable the popout notes window.">Notes Window <i class="fa fa-clone"></i></a>
45
44
  </span>
46
45
  <span>
@@ -48,11 +47,21 @@
48
47
  <a id="onePage" href="/" title="Switch to Display Window.">Switch Views <i class="fa fa-exchange fa-rotate-90"></i></a>
49
48
  </span>
50
49
  </span>
50
+ <select id="layoutSelector" autocomplete="off">
51
+ <option value="default" selected>Default Layout</option>
52
+ <option value="thumbs" title="Display thumbnail previews of the next and previous slides.">Thumbnails</option>
53
+ <option value="floating" title="Open the next slide as a floating window.">Floating</option>
54
+ <option value="beside" title="Display the next slide as a large preview in the main presenter view.">Side-by-Side</option>
55
+ </select>
51
56
  <span class="mobile">
52
57
  <a id="update" href="">Update</a>
53
58
  </span>
54
59
  </span>
55
60
  </div>
61
+ <div id="nextWindowConfirmation">
62
+ <p>Browser security requires confirmation before opening a new window.</p>
63
+ <p><a href="javascript:chooseLayout('default');">cancel</a><input type="button" onClick="javascript:openNext();" value="Open Window" /></p>
64
+ </div>
56
65
 
57
66
  <div id="center">
58
67
  <div id="sidebar">
@@ -72,11 +81,14 @@
72
81
  <img id="paceMarker" src="<%= @asset_path %>/css/paceMarker.png" />
73
82
  </div>
74
83
  <div id="navigation" class="submenu"></div>
84
+ <div id="navigationHover"></div>
75
85
  </div>
76
86
  <div id="presenter">
77
87
  <div id="frame">
78
88
  <div id="preview">
79
89
  <img id="disconnected" src="<%= @asset_path %>/css/disconnected-large.png" />
90
+ <div id="prevSlide" class="thumb"><div class="container"></div><h3 class="label">Previous</h3></div>
91
+ <div id="nextSlide" class="thumb"><div class="container"></div><h3 class="label">Next</h3></div>
80
92
  <div id="preso">loading presentation...</div>
81
93
  </div>
82
94
  <div id="annotationToolbar">
@@ -112,7 +124,6 @@
112
124
  <span id="enableAnnotations" title="Enable the annotation system.">
113
125
  <label for="annotationsToggle">Annotations</label><input type="checkbox" id="annotationsToggle" autocomplete="off" />
114
126
  </span>
115
-
116
127
  </div>
117
128
  </div>
118
129
  </div>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: showoff
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.3
4
+ version: 0.15.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Scott Chacon
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-11-02 00:00:00.000000000 Z
12
+ date: 2016-11-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sinatra
@@ -199,7 +199,7 @@ files:
199
199
  - views/onepage.erb
200
200
  - views/presenter.erb
201
201
  - views/stats.erb
202
- - public/css/TimeCircles.css
202
+ - public/css/TimeCircles-89ac5ae.css
203
203
  - public/css/disconnected-large.png
204
204
  - public/css/disconnected.png
205
205
  - public/css/font-awesome-4.4.0/css/font-awesome.min.css
@@ -326,17 +326,17 @@ files:
326
326
  - public/css/titlebar/powershell.png
327
327
  - public/css/titlebar/right.png
328
328
  - public/favicon.ico
329
- - public/js/TimeCircles.js
329
+ - public/js/TimeCircles-89ac5ae.js
330
330
  - public/js/annotations.js
331
- - public/js/coffee-script.js
332
- - public/js/highlight.pack.js
333
- - public/js/jTypeWriter.js
331
+ - public/js/coffee-script-1.1.3-pre.js
332
+ - public/js/highlight.pack-9.2.0.js
333
+ - public/js/jTypeWriter-1.1.js
334
334
  - public/js/jquery-2.1.4.min.js
335
335
  - public/js/jquery-print.js
336
- - public/js/jquery.batchImageLoad.js
337
- - public/js/jquery.cycle.all.js
338
- - public/js/jquery.doubletap-0.1.js
339
- - public/js/jquery.parsequery.min.js
336
+ - public/js/jquery.batchImageLoad-1.0.0.js
337
+ - public/js/jquery.cycle.all-2.8.0.js
338
+ - public/js/jquery.doubletap-4ff02c5.js
339
+ - public/js/jquery.parsequery.min-6a20f83.js
340
340
  - public/js/presenter.js
341
341
  - public/js/showoff.js
342
342
  - public/unsupported.html