reveal-ck-rabbit-plugin 0.1 → 0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/css/rabbit.css +9 -0
- data/exe/reveal-ck-rabbit-plugin +2 -1
- data/plugin/rabbit.js +32 -13
- metadata +3 -10
- data/.gitignore +0 -8
- data/Gemfile +0 -6
- data/LICENSE +0 -21
- data/README.md +0 -35
- data/Rakefile +0 -2
- data/bin/console +0 -14
- data/bin/setup +0 -8
- data/reveal-ck-rabbit-plugin.gemspec +0 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fb704c892b72d4ecf88fe8573ec922253d8c90647433c10d10970b07d6fd9f2c
|
4
|
+
data.tar.gz: fca9d2dbf781bbd2bac41a6bed92cad80f994959c868ed72ac95e42f6d8821f6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: af0acdc09bec4b599737f1a10e097de6255e243a7f5036207aa94ee862c2fd548c4020c0ada1e1f698998031a23e602712f23eb2ee927b70be891b400056b6b6
|
7
|
+
data.tar.gz: 281de7f804bf7297863a14052c262f0b26504a3578a8ba1ea2f435326331f7705ce4b5843dcb0cb538908750cfee771aa332265ab76d4c28764c9e61b92727a1
|
data/css/rabbit.css
ADDED
data/exe/reveal-ck-rabbit-plugin
CHANGED
@@ -6,9 +6,10 @@ unless File.exist? 'slides.md'
|
|
6
6
|
exit 1
|
7
7
|
end
|
8
8
|
|
9
|
-
['images/rabbit', 'plugin/rabbit'].each do |dir|
|
9
|
+
['images/rabbit', 'plugin/rabbit', 'css'].each do |dir|
|
10
10
|
FileUtils.mkdir_p dir
|
11
11
|
end
|
12
12
|
FileUtils.cp(File.expand_path('../images/rabbit.png', __dir__), 'images/rabbit')
|
13
13
|
FileUtils.cp(File.expand_path('../images/turtle.png', __dir__), 'images/rabbit')
|
14
14
|
FileUtils.cp(File.expand_path('../plugin/rabbit.js', __dir__), 'plugin/rabbit')
|
15
|
+
FileUtils.cp(File.expand_path('../css/rabbit.css', __dir__), 'css')
|
data/plugin/rabbit.js
CHANGED
@@ -2,27 +2,46 @@
|
|
2
2
|
var start_time = null;
|
3
3
|
|
4
4
|
var img_rabbit = document.createElement('img');
|
5
|
-
img_rabbit.setAttribute('
|
6
|
-
img_rabbit.setAttribute('style', 'position:fixed; bottom:0px; left: 0px;
|
5
|
+
img_rabbit.setAttribute('id', 'rabbit-rabbit');
|
6
|
+
img_rabbit.setAttribute('style', 'position:fixed; bottom:0px; left: 0px; visibility:hidden');
|
7
|
+
|
7
8
|
var img_turtle = document.createElement('img');
|
8
|
-
img_turtle.setAttribute('
|
9
|
-
img_turtle.setAttribute('style', 'position:fixed; bottom:0px; left: 0px;
|
9
|
+
img_turtle.setAttribute('id', 'rabbit-turtle');
|
10
|
+
img_turtle.setAttribute('style', 'position:fixed; bottom:0px; left: 0px; visibility:hidden');
|
11
|
+
|
10
12
|
document.body.appendChild(img_turtle);
|
11
13
|
document.body.appendChild(img_rabbit);
|
12
14
|
|
15
|
+
// CSS background-image の URL を src に設定して background-image を削除
|
16
|
+
var set_image_src = function(img) {
|
17
|
+
var bg_image_url = window.getComputedStyle(img).backgroundImage.match(/^url\(\"([^\"]*)\"\)/);
|
18
|
+
if (bg_image_url) {
|
19
|
+
img.src = bg_image_url[1];
|
20
|
+
img.style.backgroundImage = 'none';
|
21
|
+
}
|
22
|
+
}
|
23
|
+
|
24
|
+
set_image_src(img_rabbit);
|
25
|
+
set_image_src(img_turtle);
|
26
|
+
|
13
27
|
setInterval(function(){
|
14
28
|
if (start_time) {
|
15
29
|
var alloted_time = Reveal.getConfig().alloted_time;
|
16
30
|
if (alloted_time) {
|
17
|
-
img_turtle.
|
18
|
-
|
31
|
+
var left = (window.innerWidth - img_turtle.width) * ((Date.now()-start_time) / 1000 / alloted_time) * 100 / window.innerWidth;
|
32
|
+
if (left > 100) {
|
33
|
+
img_turtle.style.visibility = 'hidden';
|
34
|
+
} else {
|
35
|
+
img_turtle.style.visibility = 'visible';
|
36
|
+
img_turtle.style.left = left + '%';
|
37
|
+
}
|
19
38
|
} else {
|
20
|
-
img_turtle.style.
|
39
|
+
img_turtle.style.visibility = 'visible';
|
21
40
|
}
|
22
41
|
}
|
23
42
|
}, 500);
|
24
43
|
|
25
|
-
var
|
44
|
+
var display_rabbit = function(current_page) {
|
26
45
|
if (!start_time) {
|
27
46
|
var re = /rabbit_start_time=(\d+)/;
|
28
47
|
if (current_page > 0 && document.cookie.match(re)) {
|
@@ -33,8 +52,9 @@
|
|
33
52
|
}
|
34
53
|
}
|
35
54
|
var total_page = Reveal.getTotalSlides();
|
36
|
-
img_rabbit.
|
37
|
-
img_rabbit.style.
|
55
|
+
var left = (window.innerWidth - img_rabbit.width) * (current_page / (total_page - 1)) * 100 / window.innerWidth;
|
56
|
+
img_rabbit.style.visibility = 'visible';
|
57
|
+
img_rabbit.style.left = left + '%';
|
38
58
|
}
|
39
59
|
var current_page = Reveal.getIndices().h
|
40
60
|
if (current_page == 0) {
|
@@ -42,8 +62,7 @@
|
|
42
62
|
document.cookie = 'rabbit_start_time=';
|
43
63
|
}
|
44
64
|
} else {
|
45
|
-
setTimeout(function(){
|
65
|
+
setTimeout(function(){display_rabbit(current_page)}, 0);
|
46
66
|
}
|
47
|
-
Reveal.addEventListener('slidechanged', function(event){
|
67
|
+
Reveal.addEventListener('slidechanged', function(event){display_rabbit(event.indexh)});
|
48
68
|
}());
|
49
|
-
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: reveal-ck-rabbit-plugin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.2'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- TOMITA Masahiro
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-02-
|
11
|
+
date: 2018-02-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -46,18 +46,11 @@ executables:
|
|
46
46
|
extensions: []
|
47
47
|
extra_rdoc_files: []
|
48
48
|
files:
|
49
|
-
-
|
50
|
-
- Gemfile
|
51
|
-
- LICENSE
|
52
|
-
- README.md
|
53
|
-
- Rakefile
|
54
|
-
- bin/console
|
55
|
-
- bin/setup
|
49
|
+
- css/rabbit.css
|
56
50
|
- exe/reveal-ck-rabbit-plugin
|
57
51
|
- images/rabbit.png
|
58
52
|
- images/turtle.png
|
59
53
|
- plugin/rabbit.js
|
60
|
-
- reveal-ck-rabbit-plugin.gemspec
|
61
54
|
homepage: http://github.com/tmtm/reveal-ck-rabbit-plugin
|
62
55
|
licenses:
|
63
56
|
- MIT
|
data/.gitignore
DELETED
data/Gemfile
DELETED
data/LICENSE
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
MIT License
|
2
|
-
|
3
|
-
Copyright (c) 2018 TOMITA Masahiro
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
7
|
-
in the Software without restriction, including without limitation the rights
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
10
|
-
furnished to do so, subject to the following conditions:
|
11
|
-
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
13
|
-
copies or substantial portions of the Software.
|
14
|
-
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
-
SOFTWARE.
|
data/README.md
DELETED
@@ -1,35 +0,0 @@
|
|
1
|
-
# reveal-ck-rabbit-plugin
|
2
|
-
|
3
|
-
[reveal-ck](http://jedcn.github.io/reveal-ck/)のスライドに、[rabbit](https://rabbit-shocker.org/)のようなウサギとカメを表示します。
|
4
|
-
|
5
|
-
## Installation
|
6
|
-
|
7
|
-
% gem install reveal-ck-rabbit-plugin
|
8
|
-
|
9
|
-
## Usage
|
10
|
-
|
11
|
-
% mkdir foo
|
12
|
-
% cd foo
|
13
|
-
% touch slides.md
|
14
|
-
% reveal-ck-rabbit-plugin
|
15
|
-
% reveal-ck generate
|
16
|
-
|
17
|
-
スライドを開始して2ページ目に進むとウサギが表示されます。
|
18
|
-
ウサギは現在のスライドの位置を示しています。
|
19
|
-
|
20
|
-
config.yml の `revealjs_config` に `alloted_time` を追加するとカメが表示されるようになります。
|
21
|
-
|
22
|
-
```yaml
|
23
|
-
title: "Slide title"
|
24
|
-
revealjs_config:
|
25
|
-
alloted_time: 300
|
26
|
-
```
|
27
|
-
|
28
|
-
スライドの2ページ目を表示した時から `alloted_time`秒かけて右端に進んでいきます。
|
29
|
-
|
30
|
-
ウサギよりもカメが先行するようなら時間内にスライドの最後までたどり着けない可能性があります。
|
31
|
-
|
32
|
-
reveal-ck はファイルが更新されると自動的にスライドがリロードされますが、カメの位置はリロード前と変わりません。
|
33
|
-
カメを最初の位置にリセットしたい場合は、スライドの1ページ目でリロードしてください。
|
34
|
-
|
35
|
-
Linux上のFirefoxでしか動作確認はしていません。
|
data/Rakefile
DELETED
data/bin/console
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require "bundler/setup"
|
4
|
-
require "reveal/ck/rabbit/plugin"
|
5
|
-
|
6
|
-
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
-
# with your gem easier. You can also use a different console, if you like.
|
8
|
-
|
9
|
-
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
-
# require "pry"
|
11
|
-
# Pry.start
|
12
|
-
|
13
|
-
require "irb"
|
14
|
-
IRB.start(__FILE__)
|
data/bin/setup
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
Gem::Specification.new do |spec|
|
2
|
-
spec.name = "reveal-ck-rabbit-plugin"
|
3
|
-
spec.version = '0.1'
|
4
|
-
spec.licenses = ['MIT']
|
5
|
-
spec.authors = ["TOMITA Masahiro"]
|
6
|
-
spec.email = ["tommy@tmtm.org"]
|
7
|
-
|
8
|
-
spec.summary = "reveal-ck rabbit plugin"
|
9
|
-
spec.description = "reveal-ck rabbit plugin"
|
10
|
-
spec.homepage = "http://github.com/tmtm/reveal-ck-rabbit-plugin"
|
11
|
-
|
12
|
-
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
13
|
-
f.match(%r{^(test|spec|features)/})
|
14
|
-
end
|
15
|
-
spec.bindir = "exe"
|
16
|
-
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
17
|
-
spec.require_paths = ["lib"]
|
18
|
-
|
19
|
-
spec.add_development_dependency "bundler", "~> 1.16"
|
20
|
-
spec.add_development_dependency "rake", "~> 10.0"
|
21
|
-
end
|