parade-preshow 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in parade-preshow.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Franklin Webber
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,29 @@
1
+ # Parade::Preshow
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'parade-preshow'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install parade-preshow
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it
26
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
27
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
28
+ 4. Push to the branch (`git push origin my-new-feature`)
29
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,32 @@
1
+ require "parade-preshow/version"
2
+
3
+ module Parade
4
+ module Preshow
5
+ extend self
6
+
7
+ module Server
8
+ def self.included(server)
9
+ server.get "/preshow" do
10
+ Dir.glob("#{settings.presentation_directory}/preshow/*").map { |path| File.basename(path) }.to_json
11
+ end
12
+ end
13
+ end
14
+
15
+ def asset(filename)
16
+ File.expand_path(File.join(File.dirname(__FILE__),"parade-preshow",filename))
17
+ end
18
+
19
+ def stylesheet_file
20
+ asset "parade-preshow.css"
21
+ end
22
+
23
+ def javascript_file
24
+ asset "parade-preshow.js"
25
+ end
26
+
27
+ end
28
+
29
+ Server.register Preshow::Server
30
+ Server.register_javascript Preshow.javascript_file
31
+ Server.register_stylesheet Preshow.stylesheet_file
32
+ end
@@ -0,0 +1,17 @@
1
+ #preshow { display: none; }
2
+
3
+ #preshow_timer {
4
+ display:inline;
5
+ background-color:#000;
6
+ color:#fff;
7
+ font-size:3em;
8
+ border:2px solid black;
9
+ position: fixed;
10
+ padding:25px;
11
+ margin:0px;
12
+ z-index: 2147483647; /* max, see http://www.puidokas.com/max-z-index/ */
13
+ }
14
+
15
+ #preshow_timer {
16
+ bottom: 0px;
17
+ }
@@ -0,0 +1,182 @@
1
+ $(document).ready(function() {
2
+
3
+ // Setup the 'p' key to launch the preshow
4
+
5
+ MainKeyboard.on('p', function(){
6
+ $.publish("presentation:preshow:toggle");
7
+ });
8
+
9
+ // Have the presentation to hide it's footer when the pre-show starts
10
+
11
+ $.subscribe("presentation:preshow:start",$.proxy(function() {
12
+ this.footer.hide();
13
+ },presentation));
14
+
15
+ // Have the presentation show the footer and show the current slide
16
+ // when the pre-show ends.
17
+
18
+ $.subscribe("presentation:preshow:stop",$.proxy(function() {
19
+ this.footer.show();
20
+
21
+ // Returning from a presentation requires the presentation frame to
22
+ // be rebuilt.
23
+
24
+ this.presentationFrame.cycle({
25
+ timeout: 0
26
+ });
27
+ this.showSlide();
28
+
29
+ },presentation));
30
+
31
+
32
+ window.Preshow = Spine.Class.create({
33
+ init: function() {
34
+ this.element = $(arguments[0]);
35
+ this.secondsToRun = parseFloat(arguments[1] * 60);
36
+
37
+ $.subscribe("presentation:preshow:toggle",$.proxy(function() {
38
+ this.toggle();
39
+ },this));
40
+
41
+ },
42
+ preshowRunning: false,
43
+ start: function() {
44
+
45
+ if (this.preshowIntervalReference) {
46
+ return;
47
+ }
48
+
49
+ this.preservePresentationSpace();
50
+
51
+ this.load();
52
+
53
+ this.images = this.element.children("img");
54
+
55
+ this.currentImageIndex = 0;
56
+ this.totalImages = this.images.size();
57
+
58
+
59
+ this.preshowRunning = true;
60
+
61
+ $.publish("presentation:preshow:start");
62
+
63
+ this.currentRunTime = 0;
64
+ this.currentRemainingTime = this.secondsToRun;
65
+
66
+ this.nextImage();
67
+ this.preshowIntervalReference = setInterval($.proxy(this.perform,this),1000);
68
+
69
+ },
70
+ preservePresentationSpace: function() {
71
+ this.storedPresentationSpace = this.element.html();
72
+ },
73
+ restorePresentationSpace: function() {
74
+ this.element.empty();
75
+ this.element.html(this.storedPresentationSpace);
76
+ },
77
+ displayImagesInterval: 5,
78
+ perform: function() {
79
+ this.currentRunTime ++;
80
+ this.currentRemainingTime --;
81
+
82
+ time = this.secondsToTime(this.currentRemainingTime);
83
+
84
+ $('#preshow_timer').text(time + ' to go-time')
85
+ var description = this.preshowDescription && this.preshowDescription[tmpImg.attr("ref")]
86
+
87
+ if(description) {
88
+ $('#tips').show();
89
+ $('#tips').text(description);
90
+ } else {
91
+ $('#tips').hide();
92
+ }
93
+
94
+ if ((this.currentRunTime % this.displayImagesInterval) == 0) {
95
+ this.nextImage();
96
+ }
97
+
98
+ this.preshowTip();
99
+
100
+ if (this.currentRemainingTime <= 0) {
101
+ this.stop();
102
+ }
103
+
104
+ },
105
+ stop: function() {
106
+
107
+ if (!this.preshowIntervalReference) {
108
+ return;
109
+ }
110
+
111
+ this.preshowRunning = false;
112
+ window.clearInterval(this.preshowIntervalReference);
113
+ this.preshowIntervalReference = undefined;
114
+
115
+ $('#preshow').remove();
116
+ $('#tips').remove();
117
+ $('#preshow_timer').remove();
118
+
119
+ this.restorePresentationSpace();
120
+
121
+ $.publish("presentation:preshow:stop");
122
+
123
+ },
124
+ toggle: function() {
125
+
126
+ if (this.preshowIntervalReference) {
127
+ this.stop();
128
+ } else {
129
+ this.start();
130
+ }
131
+
132
+ },
133
+ preshowPath: "preshow",
134
+ load: function() {
135
+
136
+ $.getJSON(this.preshowPath, false, $.proxy(function(data) {
137
+
138
+ this.element.after("<div id='preshow'></div><div id='tips'></div><div id='preshow_timer'></div>")
139
+
140
+ $.each(data, $.proxy(function(i, n) {
141
+ if(n == "preshow.json") {
142
+ // has a descriptions file
143
+ $.getJSON("/file/preshow/preshow.json", false, function(data) {
144
+ this.preshowDescription = data;
145
+ })
146
+ } else {
147
+ $('#preshow').append('<img ref="' + n + '" src="/file/preshow/' + n + '"/>');
148
+ this.images = $("#preshow > img");
149
+ this.totalImages = this.images.size();
150
+ }
151
+ },this));
152
+
153
+ },this));
154
+
155
+ },
156
+ nextImage: function() {
157
+ this.currentImageIndex ++;
158
+ if((this.currentImageIndex + 1) > this.totalImages) {
159
+ this.currentImageIndex = 0;
160
+ }
161
+
162
+ this.element.empty();
163
+ tmpImg = this.images.eq(this.currentImageIndex).clone();
164
+ $(tmpImg).attr('width', '1020');
165
+ this.element.html(tmpImg);
166
+ },
167
+ preshowTip: function() {
168
+
169
+ },
170
+ secondsToTime: function(seconds) {
171
+ minutes = Math.floor(seconds / 60)
172
+ seconds = seconds - (minutes * 60)
173
+ if(seconds < 10) {
174
+ seconds = "0" + seconds
175
+ }
176
+ return minutes + ":" + seconds
177
+ }
178
+ });
179
+
180
+ preshow = new Preshow("#preso",0.25);
181
+
182
+ });
@@ -0,0 +1,5 @@
1
+ module Parade
2
+ module Preshow
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1,20 @@
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'parade-preshow/version'
5
+
6
+ Gem::Specification.new do |gem|
7
+ gem.name = "parade-preshow"
8
+ gem.version = Parade::Preshow::VERSION
9
+ gem.authors = ["Franklin Webber"]
10
+ gem.email = ["franklin.webber@gmail.com"]
11
+ gem.description = %q{Adds a time configurable preshow to a Parade presentation, allowing you to present images before your presentation starts.}
12
+ gem.summary = %q{Adds an image carousel of images to your Parade presentation}
13
+ gem.homepage = "https://github.com/burtlo/parade-preshow"
14
+ gem.license = "MIT"
15
+
16
+ gem.files = `git ls-files`.split($/)
17
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
18
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
19
+ gem.require_paths = ["lib"]
20
+ end
metadata ADDED
@@ -0,0 +1,57 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: parade-preshow
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Franklin Webber
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-03-05 00:00:00.000000000 Z
13
+ dependencies: []
14
+ description: Adds a time configurable preshow to a Parade presentation, allowing you
15
+ to present images before your presentation starts.
16
+ email:
17
+ - franklin.webber@gmail.com
18
+ executables: []
19
+ extensions: []
20
+ extra_rdoc_files: []
21
+ files:
22
+ - .gitignore
23
+ - Gemfile
24
+ - LICENSE.txt
25
+ - README.md
26
+ - Rakefile
27
+ - lib/parade-preshow.rb
28
+ - lib/parade-preshow/parade-preshow.css
29
+ - lib/parade-preshow/parade-preshow.js
30
+ - lib/parade-preshow/version.rb
31
+ - parade-preshow.gemspec
32
+ homepage: https://github.com/burtlo/parade-preshow
33
+ licenses:
34
+ - MIT
35
+ post_install_message:
36
+ rdoc_options: []
37
+ require_paths:
38
+ - lib
39
+ required_ruby_version: !ruby/object:Gem::Requirement
40
+ none: false
41
+ requirements:
42
+ - - ! '>='
43
+ - !ruby/object:Gem::Version
44
+ version: '0'
45
+ required_rubygems_version: !ruby/object:Gem::Requirement
46
+ none: false
47
+ requirements:
48
+ - - ! '>='
49
+ - !ruby/object:Gem::Version
50
+ version: '0'
51
+ requirements: []
52
+ rubyforge_project:
53
+ rubygems_version: 1.8.25
54
+ signing_key:
55
+ specification_version: 3
56
+ summary: Adds an image carousel of images to your Parade presentation
57
+ test_files: []