reveal-ck-rabbit-plugin 0.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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 72316396c424de4ff4b4540a8397f1c5e26c5e8472fb70f5948f899a2fa0218f
4
+ data.tar.gz: 8e5db85b540ab83ff791cab6aa5c251ee0ccc5e9240c7172d24b686a036c9bfd
5
+ SHA512:
6
+ metadata.gz: 77e37458e9857562c5a408c7a8f5f1ed685924d6e26c5831e1f3555e01cbbeca80e5a8edd4254c9db03f3d6ac189a9d9a910a0de400ab5beba25621763567a5d
7
+ data.tar.gz: 38322c371c77a727d27fc95db19bd6be547ddd82331b52fc6516e9f9bd8a3dc30612910b594a22ee18a950d79598f483782876cd6979d470044119d9768aefac
@@ -0,0 +1,8 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in reveal-ck-rabbit-plugin.gemspec
6
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,21 @@
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.
@@ -0,0 +1,35 @@
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でしか動作確認はしていません。
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+ task :default => :spec
@@ -0,0 +1,14 @@
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__)
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+ require 'fileutils'
3
+
4
+ unless File.exist? 'slides.md'
5
+ $stderr.puts "can not find slides.md"
6
+ exit 1
7
+ end
8
+
9
+ ['images/rabbit', 'plugin/rabbit'].each do |dir|
10
+ FileUtils.mkdir_p dir
11
+ end
12
+ FileUtils.cp(File.expand_path('../images/rabbit.png', __dir__), 'images/rabbit')
13
+ FileUtils.cp(File.expand_path('../images/turtle.png', __dir__), 'images/rabbit')
14
+ FileUtils.cp(File.expand_path('../plugin/rabbit.js', __dir__), 'plugin/rabbit')
Binary file
Binary file
@@ -0,0 +1,49 @@
1
+ (function() {
2
+ var start_time = null;
3
+
4
+ var img_rabbit = document.createElement('img');
5
+ img_rabbit.setAttribute('src', 'images/rabbit/rabbit.png');
6
+ img_rabbit.setAttribute('style', 'position:fixed; bottom:0px; left: 0px; height:15%; display:none');
7
+ var img_turtle = document.createElement('img');
8
+ img_turtle.setAttribute('src', 'images/rabbit/turtle.png');
9
+ img_turtle.setAttribute('style', 'position:fixed; bottom:0px; left: 0px; height:15%; display:none');
10
+ document.body.appendChild(img_turtle);
11
+ document.body.appendChild(img_rabbit);
12
+
13
+ setInterval(function(){
14
+ if (start_time) {
15
+ var alloted_time = Reveal.getConfig().alloted_time;
16
+ if (alloted_time) {
17
+ img_turtle.style.display = '';
18
+ img_turtle.style.left = (window.innerWidth - img_turtle.width) * ((Date.now()-start_time) / 1000 / alloted_time) + "px";
19
+ } else {
20
+ img_turtle.style.display = 'none';
21
+ }
22
+ }
23
+ }, 500);
24
+
25
+ var rabbit = function(current_page) {
26
+ if (!start_time) {
27
+ var re = /rabbit_start_time=(\d+)/;
28
+ if (current_page > 0 && document.cookie.match(re)) {
29
+ start_time = parseInt(document.cookie.match(re)[1]);
30
+ } else {
31
+ start_time = Date.now();
32
+ document.cookie = 'rabbit_start_time='+start_time;
33
+ }
34
+ }
35
+ var total_page = Reveal.getTotalSlides();
36
+ img_rabbit.style.display = '';
37
+ img_rabbit.style.left = (window.innerWidth - img_rabbit.width) * (current_page / (total_page - 1)) + "px";
38
+ }
39
+ var current_page = Reveal.getIndices().h
40
+ if (current_page == 0) {
41
+ if (!start_time) {
42
+ document.cookie = 'rabbit_start_time=';
43
+ }
44
+ } else {
45
+ setTimeout(function(){rabbit(current_page)}, 0);
46
+ }
47
+ Reveal.addEventListener('slidechanged', function(event){rabbit(event.indexh)});
48
+ }());
49
+
@@ -0,0 +1,21 @@
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
metadata ADDED
@@ -0,0 +1,85 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: reveal-ck-rabbit-plugin
3
+ version: !ruby/object:Gem::Version
4
+ version: '0.1'
5
+ platform: ruby
6
+ authors:
7
+ - TOMITA Masahiro
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2018-02-01 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.16'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.16'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ description: reveal-ck rabbit plugin
42
+ email:
43
+ - tommy@tmtm.org
44
+ executables:
45
+ - reveal-ck-rabbit-plugin
46
+ extensions: []
47
+ extra_rdoc_files: []
48
+ files:
49
+ - ".gitignore"
50
+ - Gemfile
51
+ - LICENSE
52
+ - README.md
53
+ - Rakefile
54
+ - bin/console
55
+ - bin/setup
56
+ - exe/reveal-ck-rabbit-plugin
57
+ - images/rabbit.png
58
+ - images/turtle.png
59
+ - plugin/rabbit.js
60
+ - reveal-ck-rabbit-plugin.gemspec
61
+ homepage: http://github.com/tmtm/reveal-ck-rabbit-plugin
62
+ licenses:
63
+ - MIT
64
+ metadata: {}
65
+ post_install_message:
66
+ rdoc_options: []
67
+ require_paths:
68
+ - lib
69
+ required_ruby_version: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ version: '0'
74
+ required_rubygems_version: !ruby/object:Gem::Requirement
75
+ requirements:
76
+ - - ">="
77
+ - !ruby/object:Gem::Version
78
+ version: '0'
79
+ requirements: []
80
+ rubyforge_project:
81
+ rubygems_version: 2.7.4
82
+ signing_key:
83
+ specification_version: 4
84
+ summary: reveal-ck rabbit plugin
85
+ test_files: []