showoff 0.9.7 → 0.9.7.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5b74b0bccf334e9ec1cc0d1f63e78920dbb09ac7
4
- data.tar.gz: 6821752697b1c41013d5723ac3be01b4e6d8a30b
3
+ metadata.gz: 756658ffcc3440e126ed64c256a82ed7f188d1e0
4
+ data.tar.gz: 6558c0816fe2ee1c4bfe1b18bf228b70f708a87e
5
5
  SHA512:
6
- metadata.gz: 4fe62f61ad47dcf4718b1c33229d2c10b9367d9ed2f823338876279924506bf441296308f8b8f382823764747d1dfb0121baf6b9fc5307424728a199655b0779
7
- data.tar.gz: 3756465ce5712780bd916c1eff7f54bcfe47928f6f67bbcaa93fc5c38ff712a392e4997936dd8549efde0ac718d6cb8171226bfd627056f9c22315493dc2f845
6
+ metadata.gz: 2fe546cdf496d75232a11593820ef1070c66f4089598aaf9c9679d2f593446e0b47df3e6b08815180d21edac570e4f9e517ce28bb27277d26d8520d757eab551
7
+ data.tar.gz: f6d1c58f94860d0f31982f91f3a64687fd80709a93f982a0c32a925a1189ecdf0ca6cfb773acb16495191d061e21f84762df78a0171efeb3769e13135a0cd6da
data/lib/showoff.rb CHANGED
@@ -682,7 +682,9 @@ class ShowOff < Sinatra::Application
682
682
  @all = Hash.new
683
683
  @@counter.each do |slide, stats|
684
684
  @all[slide] = 0
685
- stats.map { |host, count| @all[slide] += count }
685
+ stats.map do |host, visits|
686
+ visits.each { |entry| @all[slide] += entry['elapsed'].to_f }
687
+ end
686
688
  end
687
689
 
688
690
  # most and least five viewed slides
@@ -902,7 +904,7 @@ class ShowOff < Sinatra::Application
902
904
  # a bucket of slideviews for this address
903
905
  @@counter[slide][remote] ||= Array.new
904
906
  # and add this slide viewing to the bucket
905
- @@counter[slide][remote] << { :elapsed => time, :timestamp => Time.now.to_i, :presenter => @@current[:name] }
907
+ @@counter[slide][remote] << { 'elapsed' => time, 'timestamp' => Time.now.to_i, 'presenter' => @@current[:name] }
906
908
 
907
909
  when 'position'
908
910
  ws.send( { 'current' => @@current[:number] }.to_json ) unless @@cookie.nil?
@@ -1,3 +1,3 @@
1
1
  # No namespace here since ShowOff is a class and I'd have to inherit from
2
2
  # Sinatra::Application (which we don't want to load here)
3
- SHOWOFF_VERSION = '0.9.7'
3
+ SHOWOFF_VERSION = '0.9.7.1'
@@ -45,6 +45,10 @@ div.zoomed {
45
45
  background-color: #555;
46
46
  }
47
47
 
48
+ #topbar #links a.enabled {
49
+ background-color: #003d96;
50
+ }
51
+
48
52
  #topbar #links .mobile {
49
53
  display: none;
50
54
  }
@@ -4,9 +4,11 @@ var slaveWindow = null;
4
4
  var paceData = [];
5
5
 
6
6
  $(document).ready(function(){
7
- // attempt to open another window for the presentation. This may fail if
8
- // popup blockers are enabled. In that case, the presenter needs to manually
9
- // open the window by hitting the 'slave window' button.
7
+ // set up the presenter modes
8
+ mode = { track: false, follow: true, update: true, slave: false };
9
+
10
+ // attempt to open another window for the presentation if the mode defaults
11
+ // to enabling this. It does not by default, so this is likely a no-op.
10
12
  openSlave();
11
13
 
12
14
  // the presenter window doesn't need the reload on resize bit
@@ -60,9 +62,6 @@ $(document).ready(function(){
60
62
  bind('swipeleft', presNextStep). // next
61
63
  bind('swiperight', presPrevStep); // prev
62
64
 
63
- // set up the presenter modes
64
- mode = { track: false, follow: true, update: true };
65
-
66
65
  $('#remoteToggle').change( toggleFollower );
67
66
  $('#followerToggle').change( toggleUpdater );
68
67
 
@@ -110,28 +109,46 @@ function reportIssue() {
110
109
  window.open(link);
111
110
  }
112
111
 
112
+ function toggleSlave() {
113
+ mode.slave = !mode.slave;
114
+ openSlave();
115
+ }
116
+
113
117
  function openSlave()
114
118
  {
115
- try {
116
- if(slaveWindow == null || typeof(slaveWindow) == 'undefined' || slaveWindow.closed){
117
- slaveWindow = window.open('/' + window.location.hash);
119
+ if (mode.slave) {
120
+ try {
121
+ if(slaveWindow == null || typeof(slaveWindow) == 'undefined' || slaveWindow.closed){
122
+ slaveWindow = window.open('/' + window.location.hash, 'toolbar');
123
+ }
124
+ else if(slaveWindow.location.hash != window.location.hash) {
125
+ // maybe we need to reset content?
126
+ slaveWindow.location.href = '/' + window.location.hash;
127
+ }
128
+
129
+ // maintain the pointer back to the parent.
130
+ slaveWindow.presenterView = window;
131
+ slaveWindow.mode = { track: false, slave: true, follow: false };
132
+
133
+ $('#slaveWindow').addClass('enabled');
118
134
  }
119
- else if(slaveWindow.location.hash != window.location.hash) {
120
- // maybe we need to reset content?
121
- slaveWindow.location.href = '/' + window.location.hash;
135
+ catch(e) {
136
+ console.log('Failed to open or connect slave window. Popup blocker?');
122
137
  }
123
138
 
124
- // maintain the pointer back to the parent.
125
- slaveWindow.presenterView = window;
126
- slaveWindow.mode = { track: false, slave: true, follow: false };
127
- }
128
- catch(e) {
129
- console.log('Failed to open or connect slave window. Popup blocker?');
139
+ // Set up a maintenance loop to keep the connection between windows. I wish there were a cleaner way to do this.
140
+ if (typeof maintainSlave == 'undefined') {
141
+ maintainSlave = setInterval(openSlave, 1000);
142
+ }
130
143
  }
131
-
132
- // Set up a maintenance loop to keep the connection between windows. I wish there were a cleaner way to do this.
133
- if (typeof maintainSlave == 'undefined') {
134
- maintainSlave = setInterval(openSlave, 1000);
144
+ else {
145
+ try {
146
+ slaveWindow && slaveWindow.close();
147
+ $('#slaveWindow').removeClass('enabled');
148
+ }
149
+ catch (e) {
150
+ console.log('Slave window failed to close properly.');
151
+ }
135
152
  }
136
153
  }
137
154
 
@@ -34,7 +34,7 @@ sh_languages['puppet'] = [
34
34
  3
35
35
  ],
36
36
  [
37
- /\/[^\n]*\//g,
37
+ /\/[^\n]*\/\s/g, // anchor to \s to avoid matching directory names.
38
38
  'sh_regexp',
39
39
  -1
40
40
  ],
@@ -34,7 +34,7 @@ sh_languages['puppet'] = [
34
34
  3
35
35
  ],
36
36
  [
37
- /\/[^\n]*\//g,
37
+ /\/[^\n]*\/\s/g, // anchor to \s to avoid matching directory names.
38
38
  'sh_regexp',
39
39
  -1
40
40
  ],
data/views/presenter.erb CHANGED
@@ -38,7 +38,7 @@
38
38
  <% end %>
39
39
  <a id="stats" href="/stats" target="_showoffchild">Viewing Statistics</a>
40
40
  <a id="downloads" href="/download" target="_showoffchild">Downloads</a>
41
- <a id="slaveWindow" href="javascript:openSlave();" title="Open a slave window if your popup blocker prevented it.">Open Slave Window</a>
41
+ <a id="slaveWindow" href="javascript:toggleSlave();" title="Enable the slave window.">Enable Slave Window</a>
42
42
  <a id="generatePDF" href="/pdf" title="Call out to wkhtmltopdf to generate a PDF.">Generate PDF</a>
43
43
  <a id="onePage" href="/onepage" title="Load the single page view. Useful for printing.">Single Page</a>
44
44
  </span>
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.7
4
+ version: 0.9.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Scott Chacon
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-27 00:00:00.000000000 Z
11
+ date: 2014-02-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sinatra