showoff 0.18.2 → 0.19.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -387,6 +387,8 @@ function toggleNotes() {
387
387
  if(windowIsClosed(notesWindow)){
388
388
  notesWindow = blankStyledWindow(I18n.t('notes.label'), 'width=350,height=450', 'notes', true);
389
389
  window.setTimeout(function() {
390
+ $(notesWindow.document.documentElement).addClass('floatingNotes');
391
+
390
392
  // call back and update the parent presenter if the window is closed
391
393
  notesWindow.onunload = function(e) {
392
394
  notesWindow.opener.toggleNotes();
@@ -27,6 +27,9 @@ var loadSlidesPrefix
27
27
 
28
28
  var mode = { track: true, follow: true };
29
29
 
30
+ // global variable to register tours with
31
+ var tours = {};
32
+
30
33
  // a dummy websocket object to make standalone presentations easier.
31
34
  var ws = {}
32
35
  ws.send = function() { /* no-op */ }
@@ -103,9 +106,20 @@ function setupPreso(load_slides, prefix) {
103
106
  annotations = new Annotate();
104
107
 
105
108
  // must be defined using [] syntax for a variable button name on IE.
106
- var closeLabel = I18n.t('help.close');
107
- var buttons = {};
108
- buttons[closeLabel] = function() { $(this).dialog( "close" ); };
109
+ var buttons = [
110
+ {
111
+ text: I18n.t('help.close'),
112
+ click: function() { $(this).dialog( "close" ); }
113
+ },
114
+ {
115
+ text: I18n.t('tour.reset'),
116
+ "class": 'auxillary-buttons',
117
+ click: function() {
118
+ document.cookie="tours=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;";
119
+ document.cookie="tourVersion=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;";
120
+ }
121
+ }
122
+ ];
109
123
 
110
124
  $("#help-modal").dialog({
111
125
  autoOpen: false,
@@ -205,16 +219,11 @@ function initializePresentation(prefix) {
205
219
 
206
220
  $('pre.highlight code').each(function(i, block) {
207
221
  try {
222
+ // syntax highlight the code
208
223
  hljs.highlightBlock(block);
209
224
 
210
- // Highlight requested lines
211
- block.innerHTML = block.innerHTML.split(/\r?\n/).map(function (line, i) {
212
- if (line.indexOf('* ') === 0) {
213
- return line.replace(/^\*(.*)$/, '<div class="highlightedLine">$1</div>');
214
- }
215
-
216
- return line;
217
- }).join('\n');
225
+ // then add focus on any lines marked
226
+ highlightLines(block);
218
227
 
219
228
  } catch(e) {
220
229
  console.log('Syntax highlighting failed on ' + $(this).closest('div.slide').attr('id'));
@@ -579,6 +588,64 @@ function clearCookies() {
579
588
  document.cookie = "locale=;expires=Thu, 21 Sep 1979 00:00:01 UTC;";
580
589
  document.cookie = "layout=;expires=Thu, 21 Sep 1979 00:00:01 UTC;";
581
590
  document.cookie = "notes=;expires=Thu, 21 Sep 1979 00:00:01 UTC;";
591
+ document.cookie = "tourVersion=;expires=Thu, 21 Sep 1979 00:00:01 UTC;";
592
+ }
593
+
594
+ // called when slides with special content are displayed. (like the Activity complete toggle)
595
+ // Show a "welcome intro" the first time it's seen.
596
+ function showTour(name) {
597
+ // we don't need to show tours if we're a display view
598
+ if('presenterView' in window) {
599
+ return false;
600
+ }
601
+
602
+ // dont' blow up if someone calls a missing tour
603
+ if(!(name in tours)) {
604
+ console.log('No such tour: '+name);
605
+ return false;
606
+ }
607
+
608
+ var clientTours = document.cookieHash['tours'] || [];
609
+
610
+ if(clientTours.indexOf(name) == -1) {
611
+ toggleKeybinding('off');
612
+
613
+ var steps = tours[name] || [];
614
+
615
+ var intro = introJs();
616
+ intro.setOptions({
617
+ showStepNumbers: false,
618
+ showBullets: false,
619
+ steps: steps
620
+ });
621
+
622
+ if(steps.length > 1) {
623
+ intro.setOption("showBullets", true);
624
+ }
625
+
626
+ intro.onexit(function() {
627
+ toggleKeybinding('on');
628
+ });
629
+
630
+ // record tour completion so we don't continue to annoy people
631
+ intro.oncomplete(function() {
632
+ clientTours.push(name);
633
+ document.cookieHash['tours'] = clientTours;
634
+ document.cookie = "tours="+JSON.stringify(clientTours);
635
+ });
636
+
637
+ intro.start();
638
+ }
639
+ }
640
+
641
+ // get the value of an option=value class applied to a slide
642
+ function getSlideOption(option) {
643
+ var classes = currentSlide.attr('class').split(' ');
644
+ var match = classes.find(function(item){
645
+ return (item.indexOf(option+'=') == 0);
646
+ });
647
+
648
+ return (match ? match.split('=')[1] : null);
582
649
  }
583
650
 
584
651
  function checkSlideParameter() {
@@ -663,16 +730,18 @@ function showSlide(back_step, updatepv) {
663
730
  currentSlide.find('canvas.annotations').first().stopAnnotation();
664
731
  }
665
732
 
666
- currentSlide = slides.eq(slidenum)
733
+ if(currentSlide) { currentSlide.removeClass('currentSlide') };
734
+ currentSlide = slides.eq(slidenum)
735
+ currentSlide.addClass('currentSlide');
667
736
 
668
- var transition = currentSlide.attr('data-transition')
669
- var fullPage = currentSlide.find(".content").is('.full-page');
737
+ var transition = currentSlide.attr('data-transition')
738
+ var fullPage = currentSlide.find(".content").is('.full-page');
670
739
 
671
- if (back_step || fullPage) {
672
- transition = 'none'
673
- }
740
+ if (back_step || fullPage) {
741
+ transition = 'none'
742
+ }
674
743
 
675
- $('#preso').cycle(slidenum, transition)
744
+ $('#preso').cycle(slidenum, transition)
676
745
 
677
746
  if (fullPage) {
678
747
  $('#preso').css({'width' : '100%', 'overflow' : 'visible'});
@@ -774,6 +843,17 @@ function showSlide(back_step, updatepv) {
774
843
  activityIncomplete = false;
775
844
  }
776
845
 
846
+ if(currentSlide.hasClass('activity')) {
847
+ showTour('showoff:activity');
848
+ }
849
+ if(getSlideOption('form')) {
850
+ showTour('showoff:form');
851
+ }
852
+ var tour = getSlideOption('tour');
853
+ if(tour) {
854
+ showTour(tour);
855
+ }
856
+
777
857
  // show the sync button if we're not on the same slide as the presenter
778
858
  checkSyncState();
779
859
 
@@ -865,6 +945,17 @@ function showIncremental(incr)
865
945
  }
866
946
  }
867
947
 
948
+ // focus highlight requested lines of a given code block
949
+ function highlightLines(block) {
950
+ block.innerHTML = block.innerHTML.split(/\r?\n/).map(function (line, i) {
951
+ if (line.indexOf('* ') === 0) {
952
+ return line.replace(/^\*(.*)$/, '<div class="highlightedLine">$1</div>');
953
+ }
954
+
955
+ return line;
956
+ }).join('\n');
957
+ }
958
+
868
959
  // form handling
869
960
  function submitForm(form) {
870
961
  if(validateForm(form)) {
@@ -10,6 +10,7 @@
10
10
  <link rel="stylesheet" type="text/css" href="<%= @asset_path %>/css/highlight/<%= @highlightStyle %>.css" />
11
11
  <link rel="stylesheet" type="text/css" href="<%= @asset_path %>/css/mermaid-6.0.0.css" />
12
12
  <link rel="stylesheet" type="text/css" href="<%= @asset_path %>/css/font-awesome-4.4.0/css/font-awesome.min.css">
13
+ <link rel="stylesheet" type="text/css" href="<%= @asset_path %>/css/introjs-2.5.local.css">
13
14
  <link rel="stylesheet" type="text/css" href="<%= @asset_path %>/css/jquery-ui-1.12.1.css">
14
15
  <link rel="stylesheet" type="text/css" href="<%= @asset_path %>/css/showoff.css?v=<%= SHOWOFF_VERSION %>" />
15
16
  <link rel="stylesheet" type="text/css" href="<%= @asset_path %>/css/zoomline-0.0.1.css">
@@ -28,6 +29,9 @@
28
29
  <script type="text/javascript" src="<%= @asset_path %>/js/simpleStrings-0.0.1.js"></script>
29
30
  <script type="text/javascript" src="<%= @asset_path %>/js/mermaid-6.0.0-min.js"></script>
30
31
 
32
+ <!-- waiting on https://github.com/usablica/intro.js/pull/727 -->
33
+ <script type="text/javascript" src="<%= @asset_path %>/js/intro-2.5.local.js"></script>
34
+
31
35
  <script type="text/javascript" src="<%= @asset_path %>/js/coffee-script-1.1.3-pre.js"></script>
32
36
 
33
37
  <script type="text/javascript" src="<%= @asset_path %>/js/annotations.js?v=<%= SHOWOFF_VERSION %>"></script>
@@ -3,6 +3,30 @@
3
3
  <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
4
  <head>
5
5
  <%= erb :header %>
6
+
7
+ <script type="text/javascript">
8
+ tours['showoff:activity'] = [
9
+ {
10
+ element: ".currentSlide .activityToggle",
11
+ intro: I18n.t('tour.activity.complete')
12
+ }
13
+ ];
14
+
15
+ tours['showoff:form'] = [
16
+ {
17
+ element: ".currentSlide input.save",
18
+ intro: I18n.t('tour.form.save')
19
+ }
20
+ ];
21
+
22
+ tours['showoff:menu'] = [
23
+ {
24
+ element: "#hamburger",
25
+ intro: I18n.t('tour.menu')
26
+ }
27
+ ];
28
+
29
+ </script>
6
30
  </head>
7
31
 
8
32
  <body>
@@ -11,15 +11,19 @@
11
11
 
12
12
  <% if @inline %>
13
13
 
14
- <%= inline_css(['showoff.css', 'font-awesome-4.4.0/css/font-awesome.min.css', 'onepage.css', "highlight/#{@highlightStyle}.css"], 'public/css') %>
14
+ <%= inline_css(['font-awesome-4.4.0/css/font-awesome.min.css', 'mermaid-6.0.0.css', "highlight/#{@highlightStyle}.css"], 'public/css') %>
15
+ <%= inline_css(['showoff.css', 'onepage.css'], 'public/css') %>
15
16
  <%= inline_css(css_files) %>
16
17
 
17
- <%= inline_js(['jquery-2.1.4.min.js', 'jquery-print.js', 'showoff.js', 'highlight.pack-9.2.0.js'], 'public/js') %>
18
+ <%= inline_js(['jquery-2.1.4.min.js', 'showoff.js', 'highlight.pack-9.2.0.js'], 'public/js') %>
19
+ <%= inline_js(['bigtext-0.1.8.js', 'simpleStrings-0.0.1.js', 'mermaid-6.0.0-min.js'], 'public/js') %>
20
+
18
21
  <%= inline_js(@languages, 'public/js') if @languages %>
19
22
  <%= inline_js(js_files) %>
20
23
 
21
24
  <% else %>
22
- <% ['showoff.css', 'font-awesome-4.4.0/css/font-awesome.min.css', 'onepage.css', "highlight/#{@highlightStyle}.css"].each do |css_file| %>
25
+ <% ['font-awesome-4.4.0/css/font-awesome.min.css', 'mermaid-6.0.0.css', "highlight/#{@highlightStyle}.css",
26
+ 'showoff.css', 'onepage.css'].each do |css_file| %>
23
27
  <link rel="stylesheet" href="<%= @asset_path %>/css/<%= css_file %>" type="text/css"/>
24
28
  <% end %>
25
29
 
@@ -27,7 +31,8 @@
27
31
  <link rel="stylesheet" href="<%= @asset_path %>/file/<%= css_file %>" type="text/css"/>
28
32
  <% end %>
29
33
 
30
- <% ['jquery-2.1.4.min.js', 'jquery-print.js', 'showoff.js', 'highlight.pack-9.2.0.js'].each do |js_file| %>
34
+ <% ['jquery-2.1.4.min.js', 'showoff.js', 'highlight.pack-9.2.0.js',
35
+ 'bigtext-0.1.8.js', 'simpleStrings-0.0.1.js', 'mermaid-6.0.0-min.js'].each do |js_file| %>
31
36
  <script type="text/javascript" src="<%= @asset_path %>/js/<%= js_file %>"></script>
32
37
  <% end %>
33
38
  <% js_files.each do |js_file| %>
@@ -45,13 +50,28 @@
45
50
  $(document).ready(function() {
46
51
  $('pre.highlight code').each(function(i, block) {
47
52
  try {
53
+ // syntax highlight the code
48
54
  hljs.highlightBlock(block);
55
+
56
+ // then add focus on any lines marked
57
+ highlightLines(block);
49
58
  } catch(e) {
50
59
  console.log('Syntax highlighting failed on ' + $(this).closest('div.slide').attr('id'));
51
60
  console.log('Syntax highlighting failed for ' + $(this).attr('class'));
52
61
  console.log(e);
53
62
  }
54
63
  });
64
+
65
+
66
+ // render diagrams and text manipulations unconditionally instead of waiting for slide views
67
+ mermaid.init(undefined, $(".language-render-diagram"));
68
+ $('.content.bigtext').bigtext();
69
+
70
+ // translate SVG images, inlining them first if needed.
71
+ user_translations = <%= JSON.pretty_generate user_translations %>;
72
+ $('img').simpleStrings({strings: user_translations});
73
+ $('svg').simpleStrings({strings: user_translations});
74
+ $('.translate').simpleStrings({strings: user_translations});
55
75
  });
56
76
  </script>
57
77
 
@@ -12,6 +12,116 @@
12
12
  <script type="text/javascript">
13
13
  editUrl = "<%= @edit %>";
14
14
  issueUrl = "<%= @issues %>";
15
+
16
+ tours['showoff:activity'] = [
17
+ {
18
+ element: ".currentSlide .count",
19
+ intro: I18n.t('tour.activity.count')
20
+ }
21
+ ];
22
+
23
+ tours['showoff:form'] = [
24
+ {
25
+ element: "#notes",
26
+ intro: I18n.t('tour.form.responses'),
27
+ scrollToElement: false
28
+ },
29
+ {
30
+ element: ".currentSlide input.display",
31
+ intro: I18n.t('tour.form.display')
32
+ }
33
+ ];
34
+
35
+ $(function(){
36
+ var tourVersion = 1;
37
+ var clientTour = document.cookieHash['tourVersion'] || 0;
38
+
39
+ if(clientTour < tourVersion) {
40
+ toggleKeybinding('off');
41
+
42
+ var intro = introJs();
43
+ intro.setOptions({
44
+ showProgress: true,
45
+ showStepNumbers: false,
46
+ exitOnOverlayClick: false,
47
+ steps: [
48
+ {
49
+ intro: I18n.t('tour.welcome'),
50
+ version: 1
51
+ },
52
+ {
53
+ element: "#slaveWindow",
54
+ intro: I18n.t('tour.displayview'),
55
+ version: 1
56
+ },
57
+ {
58
+ element: "#annotationLabel",
59
+ intro: I18n.t('tour.annotations'),
60
+ version: 1
61
+ },
62
+ {
63
+ element: "#timerSection",
64
+ intro: I18n.t('tour.timer'),
65
+ version: 1
66
+ },
67
+ {
68
+ element: "#feedbackPace",
69
+ intro: I18n.t('tour.pace'),
70
+ version: 1
71
+ },
72
+ {
73
+ element: "#questions",
74
+ intro: I18n.t('tour.questions'),
75
+ version: 1
76
+ },
77
+ {
78
+ element: "#notes-controls",
79
+ intro: I18n.t('tour.notes'),
80
+ highlightClass: "tourDark",
81
+ version: 1
82
+ },
83
+ {
84
+ element: "#slideSource",
85
+ intro: I18n.t('tour.slidesource'),
86
+ version: 1
87
+ },
88
+ {
89
+ element: "#settings",
90
+ intro: I18n.t('tour.settings'),
91
+ version: 1
92
+ },
93
+ {
94
+ element: "#edit",
95
+ intro: I18n.t('tour.edit'),
96
+ version: 1
97
+ },
98
+ {
99
+ element: "#report",
100
+ intro: I18n.t('tour.report'),
101
+ version: 1
102
+ }
103
+ ].filter(function(item) { return (item['version'] > clientTour) && ((item['element'] == undefined) || document.querySelector(item['element'])) })
104
+ // the queryselector filter eliminates tips for features that have been turned off
105
+ });
106
+
107
+ // re-enable the keyboard whether the tour was completed or not
108
+ intro.onexit(function() {
109
+ toggleKeybinding('on');
110
+ });
111
+
112
+ // record tour completion so we don't continue to annoy people
113
+ intro.oncomplete(function() {
114
+ document.cookie = "tourVersion="+tourVersion;
115
+ });
116
+
117
+ // give it a chance to finish loading the presentation
118
+ $("body").bind("showoff:loaded", function (event) {
119
+ intro.start();
120
+ });
121
+
122
+ }
123
+ });
124
+
15
125
  </script>
16
126
  </head>
17
127
 
@@ -24,7 +134,7 @@
24
134
 
25
135
  <span id="links">
26
136
  <span class="desktop">
27
- <label for="annotationsToggle" class="no-mobile" title="<%= I18n.t('presenter.topbar.tooltip.annotations') %>"><%= I18n.t('presenter.topbar.annotations') %> <i class="fa fa-pencil"></i></label>
137
+ <label id="annotationLabel" for="annotationsToggle" class="no-mobile" title="<%= I18n.t('presenter.topbar.tooltip.annotations') %>"><%= I18n.t('presenter.topbar.annotations') %> <i class="fa fa-pencil"></i></label>
28
138
  <input type="checkbox" id="annotationsToggle" autocomplete="off" class="no-mobile" />
29
139
 
30
140
  <% if @edit %>
@@ -133,7 +243,7 @@
133
243
 
134
244
  <div id="notes-wrapper">
135
245
  <ul class="section-selector"></ul>
136
- <div class="controls">
246
+ <div class="controls" id="notes-controls">
137
247
  <a class="no-mobile fa fa-minus small" aria-hidden="true" href="#"></a>
138
248
  <a class="no-mobile fa fa-dot-circle-o small" aria-hidden="true" href="#"></a>
139
249
  <a class="no-mobile fa fa-plus small" aria-hidden="true" href="#"></a>
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.18.2
4
+ version: 0.19.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: 2017-06-15 00:00:00.000000000 Z
12
+ date: 2017-08-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sinatra
@@ -389,6 +389,7 @@ files:
389
389
  - public/css/images/ui-icons_777777_256x240.png
390
390
  - public/css/images/ui-icons_cc0000_256x240.png
391
391
  - public/css/images/ui-icons_ffffff_256x240.png
392
+ - public/css/introjs-2.5.local.css
392
393
  - public/css/jquery-ui-1.12.1.css
393
394
  - public/css/mermaid-6.0.0.css
394
395
  - public/css/onepage.css
@@ -408,6 +409,7 @@ files:
408
409
  - public/js/bigtext-0.1.8.js
409
410
  - public/js/coffee-script-1.1.3-pre.js
410
411
  - public/js/highlight.pack-9.2.0.js
412
+ - public/js/intro-2.5.local.js
411
413
  - public/js/jTypeWriter-1.1.js
412
414
  - public/js/jquery-2.1.4.min.js
413
415
  - public/js/jquery-ui-1.12.1.js
@@ -433,18 +435,7 @@ homepage: https://puppetlabs.github.io/showoff
433
435
  licenses:
434
436
  - MIT
435
437
  metadata: {}
436
- post_install_message: |2
437
- _________________________________________
438
- / Ahoy ahead! \
439
- | User interface changes in this release. |
440
- | |
441
- \ Please clear your browser cache. /
442
- -----------------------------------------
443
- \ ^__^
444
- \ (oo)\_______
445
- (__)\ )\/\
446
- ||----w |
447
- || ||
438
+ post_install_message:
448
439
  rdoc_options: []
449
440
  require_paths:
450
441
  - lib