gibier 0.8.8 → 0.8.9
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 +4 -4
- data/lib/gibier/static_generator.rb +2 -3
- data/lib/gibier/version.rb +1 -1
- data/template/app.rb +2 -3
- data/template/project/Gemfile +2 -2
- data/template/project/app/slide.rb +42 -33
- data/template/project/app/track_field.rb +4 -5
- data/template/project/assets/css/application.css +23 -0
- data/template/project/server.rb +1 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 54ee7db66d7a6a0f8b0ea96ed4c6a3946c0b3fde
|
4
|
+
data.tar.gz: c626e010bb1c7c8f5d0eef18c43b75ce3e6f3aac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1d5bf74ef88f413cb9cd3ed26e1b0aebaa2d9f811ed11c632637f0325855a08e908456b5ba42d3acd1a8ff70b7daf043b0fde6a388b69c26b2331d1498839a69
|
7
|
+
data.tar.gz: ef1c644cc1d0fbc71bc95c0c789f0de856de7230c098994bc5eddf703f9560ee57495c084562921bb703cd749e0bb4423ae01af19e10cdaa90b67531026f6f37
|
@@ -41,13 +41,12 @@ module Gibier
|
|
41
41
|
def build(name, filename)
|
42
42
|
builder = Opal::Builder.new
|
43
43
|
|
44
|
-
use_gem(builder, 'opal-browser', 'opal')
|
45
44
|
use_gem(builder, 'opal-router', 'opal')
|
46
|
-
use_gem(builder, 'hyalite', 'client')
|
47
45
|
|
48
46
|
builder.append_paths './app'
|
47
|
+
builder.use_gem 'hyalite'
|
48
|
+
builder.use_gem 'opal-websocket'
|
49
49
|
builder.use_gem 'gibier'
|
50
|
-
builder.use_gem 'paggio'
|
51
50
|
builder.build "./app/slides/#{name}/app.rb"
|
52
51
|
|
53
52
|
File.open(filename, 'w') do |file|
|
data/lib/gibier/version.rb
CHANGED
data/template/app.rb
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
require 'slide'
|
2
2
|
require 'page_base'
|
3
3
|
require 'slides/#{name}/pages'
|
4
|
-
require '
|
5
|
-
require 'browser/location'
|
4
|
+
require 'opal/websocket'
|
6
5
|
|
7
6
|
Gibier.slide_name = '#{name}'
|
8
7
|
Gibier.gh_pages = `window.ghPages`
|
@@ -15,7 +14,7 @@ module App
|
|
15
14
|
end
|
16
15
|
|
17
16
|
$document.ready do
|
18
|
-
ws =
|
17
|
+
ws = Opal::WebSocket.new("ws://\#{`window.location.host`}/push_notification/start/slide/#{name}") unless Gibier.gh_pages
|
19
18
|
|
20
19
|
$window.on(:resize) do
|
21
20
|
App.render(ws)
|
data/template/project/Gemfile
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
source "https://rubygems.org"
|
2
2
|
|
3
3
|
gem 'gibier'
|
4
|
-
gem 'opal-browser'
|
5
4
|
gem 'opal-router', github: 'adambeynon/opal-router'
|
6
5
|
gem 'opal-haml', github: 'opal/opal-haml'
|
7
|
-
gem '
|
6
|
+
gem 'opal-websocket', github: 'youchan/opal-websocket'
|
7
|
+
gem 'hyalite'
|
8
8
|
|
@@ -1,8 +1,5 @@
|
|
1
1
|
require 'hyalite'
|
2
2
|
require 'opal-router'
|
3
|
-
require 'browser'
|
4
|
-
require 'browser/interval'
|
5
|
-
require 'browser/location'
|
6
3
|
require 'track_field'
|
7
4
|
|
8
5
|
module Gibier
|
@@ -51,7 +48,6 @@ module Gibier
|
|
51
48
|
|
52
49
|
class Slide
|
53
50
|
include Hyalite::Component
|
54
|
-
include Hyalite::Component::ShortHand
|
55
51
|
|
56
52
|
def pages(height)
|
57
53
|
case @state[:mode]
|
@@ -67,7 +63,8 @@ module Gibier
|
|
67
63
|
end
|
68
64
|
|
69
65
|
def initial_state
|
70
|
-
|
66
|
+
uri = $window.location.toString
|
67
|
+
page_num = uri.sub(/.*#([0-9]+)/, '\1').to_i
|
71
68
|
|
72
69
|
{
|
73
70
|
page_number: page_num,
|
@@ -83,7 +80,7 @@ module Gibier
|
|
83
80
|
end
|
84
81
|
|
85
82
|
unless Gibier.gh_pages
|
86
|
-
@props[:ws].
|
83
|
+
@props[:ws].onmessage do |msg|
|
87
84
|
(event, value) = msg.data.split(':')
|
88
85
|
case event
|
89
86
|
when 'keydown'
|
@@ -98,35 +95,43 @@ module Gibier
|
|
98
95
|
end
|
99
96
|
|
100
97
|
def page_to(num)
|
101
|
-
$window.location.assign("#{$window.location.
|
98
|
+
$window.location.assign("#{$window.location.toString.sub(/#\d+$/, '')}##{num}")
|
99
|
+
end
|
100
|
+
|
101
|
+
def page_back
|
102
|
+
page_to(@state[:page_number] - 1) if @state[:page_number] > 0
|
103
|
+
end
|
104
|
+
|
105
|
+
def page_forward
|
106
|
+
page_to(@state[:page_number] + 1) if @state[:page_number] < Gibier.page_count
|
102
107
|
end
|
103
108
|
|
104
109
|
def handle_key_down(event)
|
105
110
|
keycode = event.code
|
106
111
|
case keycode
|
107
|
-
when
|
108
|
-
|
109
|
-
when
|
110
|
-
|
111
|
-
when
|
112
|
+
when :Space, :ArrowRight, :ArrowUp
|
113
|
+
page_forward
|
114
|
+
when :Backspace, :ArrowLeft, :ArrowDown
|
115
|
+
page_back
|
116
|
+
when :KeyS, :KeyB
|
112
117
|
unless @state[:start]
|
113
118
|
set_state(start: Time.now)
|
114
119
|
else
|
115
120
|
set_state(start: nil)
|
116
121
|
end
|
117
|
-
when
|
122
|
+
when :KeyP
|
118
123
|
if @state[:mode] == :slide
|
119
124
|
set_state(mode: :print)
|
120
125
|
else
|
121
126
|
set_state(mode: :slide)
|
122
127
|
end
|
123
|
-
when
|
128
|
+
when :KeyF
|
124
129
|
set_state(footer_visible: !@state[:footer_visible])
|
125
|
-
if
|
130
|
+
if event.ctrl_key
|
126
131
|
fullscreen
|
127
132
|
end
|
128
|
-
when
|
129
|
-
if
|
133
|
+
when :F5
|
134
|
+
if event.shift_key
|
130
135
|
fullscreen
|
131
136
|
end
|
132
137
|
else
|
@@ -158,15 +163,15 @@ module Gibier
|
|
158
163
|
end
|
159
164
|
|
160
165
|
def render
|
161
|
-
follow_height = $window.
|
166
|
+
follow_height = $window.height / $window.width < SLIDE_HEIGHT / SLIDE_WIDTH
|
162
167
|
if follow_height
|
163
|
-
zoom = $window.
|
168
|
+
zoom = $window.height.to_f / SLIDE_HEIGHT * 0.98
|
164
169
|
else
|
165
|
-
zoom = $window.
|
170
|
+
zoom = $window.width.to_f / SLIDE_WIDTH * 0.98
|
166
171
|
end
|
167
172
|
|
168
|
-
top = ($window.
|
169
|
-
left = ($window.
|
173
|
+
top = ($window.height / zoom - SLIDE_HEIGHT) / 2
|
174
|
+
left = ($window.width / zoom - SLIDE_WIDTH) / 2
|
170
175
|
|
171
176
|
footer_style = @state[:page_number] == 1 || !@state[:footer_visible] ? {style: {display: 'none'}} : {}
|
172
177
|
|
@@ -174,17 +179,21 @@ module Gibier
|
|
174
179
|
when :slide
|
175
180
|
div({className: 'background'},
|
176
181
|
div({className: 'background-filter'},
|
177
|
-
div({
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
182
|
+
div({class: 'slide-controll'},
|
183
|
+
div({class: 'page-back', onClick: -> { page_back }}),
|
184
|
+
div({class: 'page-forward', onClick: -> { page_forward }}),
|
185
|
+
div({
|
186
|
+
className: 'slide',
|
187
|
+
style: {zoom: zoom, top: "#{top}px", left: "#{left}px"},
|
188
|
+
onKeyDown: -> (event) { handle_key_down(event) }
|
189
|
+
},
|
190
|
+
pages(SLIDE_HEIGHT * zoom)
|
191
|
+
),
|
192
|
+
Gibier::TrackField.el({total_time: duration, start: @state[:start], page_number: @state[:page_number], page_count: Gibier.page_count}),
|
193
|
+
section({className: 'footer'}.merge(footer_style),
|
194
|
+
p({className: 'title'}, Gibier.title),
|
195
|
+
p({className: 'powered-by'}, "Powered by ", span({className: "hyalite"}, "Hyalite"))
|
196
|
+
)
|
188
197
|
)
|
189
198
|
)
|
190
199
|
)
|
@@ -1,9 +1,6 @@
|
|
1
|
-
require 'browser/interval'
|
2
|
-
|
3
1
|
module Gibier
|
4
2
|
class TrackField
|
5
3
|
include Hyalite::Component
|
6
|
-
include Hyalite::Component::ShortHand
|
7
4
|
|
8
5
|
def initialize
|
9
6
|
super
|
@@ -15,15 +12,17 @@ module Gibier
|
|
15
12
|
end
|
16
13
|
|
17
14
|
def component_did_mount
|
18
|
-
|
15
|
+
func = Proc.new do
|
19
16
|
set_state(tic: !@state[:tic])
|
20
|
-
if el = $document
|
17
|
+
if el = $document[".track-field"].first
|
21
18
|
@width = el.width.to_i
|
22
19
|
spend_time = @props[:start] ? Time.now - @props[:start] : 0
|
23
20
|
rabbit_pos = [(spend_time / @props[:total_time]), 1].min * (@width - 40) * 0.96 + @width * 0.02
|
24
21
|
set_state(rabbit_pos: rabbit_pos)
|
25
22
|
end
|
26
23
|
end
|
24
|
+
|
25
|
+
`setInterval(func, 1000)`
|
27
26
|
end
|
28
27
|
|
29
28
|
def render
|
@@ -61,6 +61,29 @@ body {
|
|
61
61
|
width: 100%;
|
62
62
|
}
|
63
63
|
|
64
|
+
.slide-controll {
|
65
|
+
position: absolute;
|
66
|
+
height: 100%;
|
67
|
+
width: 100%;
|
68
|
+
}
|
69
|
+
|
70
|
+
.slide-controll .page-back {
|
71
|
+
position: absolute;
|
72
|
+
width: 25%;
|
73
|
+
height: 100%;
|
74
|
+
z-index: 10;
|
75
|
+
background-color: rgba(0, 0, 0, 0);
|
76
|
+
}
|
77
|
+
|
78
|
+
.slide-controll .page-forward {
|
79
|
+
position: absolute;
|
80
|
+
width: 25%;
|
81
|
+
height: 100%;
|
82
|
+
left: 75%;
|
83
|
+
z-index: 10;
|
84
|
+
background-color: rgba(0, 0, 0, 0);
|
85
|
+
}
|
86
|
+
|
64
87
|
.page p.icon {
|
65
88
|
margin: 0;
|
66
89
|
position: absolute;
|
data/template/project/server.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gibier
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- youchan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-10-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sinatra
|
@@ -315,7 +315,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
315
315
|
version: '0'
|
316
316
|
requirements: []
|
317
317
|
rubyforge_project:
|
318
|
-
rubygems_version: 2.6.
|
318
|
+
rubygems_version: 2.6.13
|
319
319
|
signing_key:
|
320
320
|
specification_version: 4
|
321
321
|
summary: A slide tool inspired by Rabbit
|