showoff 0.9.10.7 → 0.9.10.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -118,12 +118,20 @@ function reportIssue() {
118
118
  window.open(link);
119
119
  }
120
120
 
121
+ // open browser to remote edit URL
121
122
  function editSlide() {
122
123
  var slide = $("span#slideFile").text().replace(/\/\d+$/, '');
123
124
  var link = editUrl + slide + ".md";
124
125
  window.open(link);
125
126
  }
126
127
 
128
+ // call the edit endpoint to open up a local file editor
129
+ function openEditor() {
130
+ var slide = $("span#slideFile").text().replace(/\/\d+$/, '');
131
+ var link = '/edit/' + slide + ".md";
132
+ $.get(link);
133
+ }
134
+
127
135
  function toggleSlave() {
128
136
  mode.slave = !mode.slave;
129
137
  openSlave();
@@ -186,7 +194,7 @@ function openNext()
186
194
  if (mode.next) {
187
195
  try {
188
196
  if(nextWindow == null || typeof(nextWindow) == 'undefined' || nextWindow.closed){
189
- nextWindow = window.open('/?track=false&feedback=false&next=true#' + nextSlideNum(true),'','width=300,height=200');
197
+ nextWindow = window.open('/?track=false&feedback=false&next=true#' + nextSlideNum(true),'','width=320,height=300');
190
198
  }
191
199
  else if(nextWindow.location.hash != '#' + nextSlideNum(true)) {
192
200
  // maybe we need to reset content?
data/public/js/showoff.js CHANGED
@@ -15,6 +15,7 @@ var incrCurr = 0
15
15
  var incrCode = false
16
16
  var debugMode = false
17
17
  var gotoSlidenum = 0
18
+ var lastMessageGuid = 0
18
19
  var shiftKeyActive = false
19
20
  var query
20
21
  var slideStartTime = new Date().getTime()
@@ -62,7 +63,11 @@ function setupPreso(load_slides, prefix) {
62
63
  if(query.track == 'false') mode.track = false;
63
64
 
64
65
  // make sure that the next view doesn't bugger things on the first load
65
- if(query.next == 'true') mode.next = true;
66
+ if(query.next == 'true') {
67
+ $('#preso').addClass('zoomed');
68
+ mode.next = true;
69
+ zoom();
70
+ }
66
71
 
67
72
  // Make sure the slides always look right.
68
73
  // Better would be dynamic calculations, but this is enough for now.
@@ -190,6 +195,28 @@ function initializePresentation(prefix) {
190
195
  $("#preso").trigger("showoff:loaded");
191
196
  }
192
197
 
198
+ /* This looks like the zoom() function for the presenter preview, but it uses a different algorithm */
199
+ function zoom()
200
+ {
201
+ if(window.innerWidth <= 480) {
202
+ $(".zoomed").css("zoom", 0.32);
203
+ }
204
+ else {
205
+ var hSlide = parseFloat($("#preso").height());
206
+ var wSlide = parseFloat($("#preso").width());
207
+ var hBody = parseFloat($("html").height());
208
+ var wBody = parseFloat($("html").width());
209
+
210
+ newZoom = Math.min(hBody/hSlide, wBody/wSlide) - 0.04;
211
+
212
+ $(".zoomed").css("zoom", newZoom);
213
+ $(".zoomed").css("-ms-zoom", newZoom);
214
+ $(".zoomed").css("-webkit-zoom", newZoom);
215
+ $(".zoomed").css("-moz-transform", "scale("+newZoom+")");
216
+ $(".zoomed").css("-moz-transform-origin", "left top");
217
+ }
218
+ }
219
+
193
220
  function centerSlides(slides) {
194
221
  slides.each(function(s, slide) {
195
222
  centerSlide(slide)
@@ -271,8 +298,9 @@ function setupSlideParamsCheck() {
271
298
  }
272
299
 
273
300
  function gotoSlide(slideNum, updatepv) {
274
- slidenum = parseInt(slideNum);
275
- if (!isNaN(slidenum)) {
301
+ var newslide = parseInt(slideNum);
302
+ if (slidenum != newslide && !isNaN(newslide)) {
303
+ slidenum = newslide;
276
304
  showSlide(false, updatepv);
277
305
  }
278
306
  }
@@ -338,6 +366,10 @@ function showSlide(back_step, updatepv) {
338
366
  var fileName = currentSlide.children().first().attr('ref');
339
367
  $('#slideFilename').text(fileName);
340
368
 
369
+ if (query.next) {
370
+ $(currentSlide).find('li').removeClass('hidden');
371
+ }
372
+
341
373
  // Update presenter view, if we spawned one
342
374
  if (updatepv && 'presenterView' in window && ! mode.next) {
343
375
  var pv = window.presenterView;
@@ -410,17 +442,17 @@ function determineIncremental()
410
442
  incrCode = true
411
443
  }
412
444
  incrElem.each(function(s, elem) {
413
- $(elem).css('visibility', 'hidden');
445
+ $(elem).addClass('incremental hidden');
414
446
  })
415
447
  }
416
448
 
417
449
  function showIncremental(incr)
418
450
  {
419
- elem = incrElem.eq(incrCurr)
451
+ elem = incrElem.eq(incrCurr);
420
452
  if (incrCode && elem.hasClass('command')) {
421
- incrElem.eq(incrCurr).css('visibility', 'visible').jTypeWriter({duration:1.0})
453
+ incrElem.eq(incrCurr).removeClass('hidden').jTypeWriter({duration:1.0});
422
454
  } else {
423
- incrElem.eq(incrCurr).css('visibility', 'visible')
455
+ incrElem.eq(incrCurr).removeClass('hidden');
424
456
  }
425
457
  }
426
458
 
@@ -636,6 +668,16 @@ function disconnected() {
636
668
  function parseMessage(data) {
637
669
  var command = JSON.parse(data);
638
670
 
671
+ if ("id" in command) {
672
+ var guid = command['id'];
673
+ if (lastMessageGuid != guid) {
674
+ lastMessageGuid = guid;
675
+ }
676
+ else {
677
+ return;
678
+ }
679
+ }
680
+
639
681
  if ("current" in command) { follow(command["current"]); }
640
682
 
641
683
  // Presenter messages only, so catch errors if method doesn't exist
@@ -646,7 +688,6 @@ function parseMessage(data) {
646
688
  catch(e) {
647
689
  console.log("Not a presenter!");
648
690
  }
649
-
650
691
  }
651
692
 
652
693
  function sendPace(pace) {
data/views/presenter.erb CHANGED
@@ -31,7 +31,12 @@
31
31
  <div id="main">
32
32
  <div id="topbar">
33
33
  <div id="slideSource">
34
- Source: <span id="slideFile"></span>
34
+ Source:
35
+ <% if @request.host == 'localhost' %>
36
+ <a href="javascript:openEditor();"><span id="slideFile"></span></a>
37
+ <% else %>
38
+ <span id="slideFile">
39
+ <% end %>
35
40
  </div>
36
41
  <span id="links">
37
42
  <span class="desktop">
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: showoff
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.10.7
4
+ version: 0.9.10.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Scott Chacon
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-18 00:00:00.000000000 Z
11
+ date: 2015-03-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sinatra
@@ -232,6 +232,7 @@ files:
232
232
  - public/js/core.js
233
233
  - public/js/fg.menu.js
234
234
  - public/js/jTypeWriter.js
235
+ - public/js/jquery-1.11.2.js
235
236
  - public/js/jquery-1.4.2.min.js
236
237
  - public/js/jquery-print.js
237
238
  - public/js/jquery.batchImageLoad.js