dzslides-sass 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +202 -0
- data/README.ad +43 -0
- data/Rakefile +1 -0
- data/dzslides-sass.gemspec +23 -0
- data/js/dzslides/dzslides.js +418 -0
- data/lib/dzslides.rb +4 -0
- data/lib/dzslides/sass/version.rb +5 -0
- data/scss/dzslides-core.scss +18 -0
- data/scss/dzslides/_global.scss +41 -0
- data/scss/dzslides/components/_aspect.scss +13 -0
- data/scss/dzslides/components/_body.scss +24 -0
- data/scss/dzslides/components/_details.scss +3 -0
- data/scss/dzslides/components/_figure.scss +16 -0
- data/scss/dzslides/components/_incremental.scss +8 -0
- data/scss/dzslides/components/_progress-bar.scss +8 -0
- data/scss/dzslides/components/_reset.scss +16 -0
- data/scss/dzslides/components/_section.scss +15 -0
- data/scss/dzslides/components/_view.scss +48 -0
- metadata +112 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: c76c0d1f0f14f8186717602ffe09cad79d62ff77
|
4
|
+
data.tar.gz: c2dae50e824bc739754c334e3cf9a58581deb85d
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 80b69e4dc4410d68959f75f759bb81cbd0d1f7e739e74d807ec70d8199cfc09324c4f5cbec66765cd7517ba8ef77fb56e8b7645df5ce9bfe0487e513553b8dcb
|
7
|
+
data.tar.gz: 0e452930c7005927eff7a423ee8406850f80b394b250d24d07e45e66a6a9d9958f22e068cb2c07a28b66204fb00cefd6d2c9c859a2e64d6f6a8822bef163d41e
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,202 @@
|
|
1
|
+
|
2
|
+
Apache License
|
3
|
+
Version 2.0, January 2004
|
4
|
+
http://www.apache.org/licenses/
|
5
|
+
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
7
|
+
|
8
|
+
1. Definitions.
|
9
|
+
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
12
|
+
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
14
|
+
the copyright owner that is granting the License.
|
15
|
+
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
17
|
+
other entities that control, are controlled by, or are under common
|
18
|
+
control with that entity. For the purposes of this definition,
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
20
|
+
direction or management of such entity, whether by contract or
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
23
|
+
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
25
|
+
exercising permissions granted by this License.
|
26
|
+
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
28
|
+
including but not limited to software source code, documentation
|
29
|
+
source, and configuration files.
|
30
|
+
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
32
|
+
transformation or translation of a Source form, including but
|
33
|
+
not limited to compiled object code, generated documentation,
|
34
|
+
and conversions to other media types.
|
35
|
+
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
37
|
+
Object form, made available under the License, as indicated by a
|
38
|
+
copyright notice that is included in or attached to the work
|
39
|
+
(an example is provided in the Appendix below).
|
40
|
+
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
47
|
+
the Work and Derivative Works thereof.
|
48
|
+
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
50
|
+
the original version of the Work and any modifications or additions
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
62
|
+
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
65
|
+
subsequently incorporated within the Work.
|
66
|
+
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
73
|
+
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
79
|
+
where such license applies only to those patent claims licensable
|
80
|
+
by such Contributor that are necessarily infringed by their
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
83
|
+
institute patent litigation against any entity (including a
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
86
|
+
or contributory patent infringement, then any patent licenses
|
87
|
+
granted to You under this License for that Work shall terminate
|
88
|
+
as of the date such litigation is filed.
|
89
|
+
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
92
|
+
modifications, and in Source or Object form, provided that You
|
93
|
+
meet the following conditions:
|
94
|
+
|
95
|
+
(a) You must give any other recipients of the Work or
|
96
|
+
Derivative Works a copy of this License; and
|
97
|
+
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
99
|
+
stating that You changed the files; and
|
100
|
+
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
103
|
+
attribution notices from the Source form of the Work,
|
104
|
+
excluding those notices that do not pertain to any part of
|
105
|
+
the Derivative Works; and
|
106
|
+
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
109
|
+
include a readable copy of the attribution notices contained
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
112
|
+
of the following places: within a NOTICE text file distributed
|
113
|
+
as part of the Derivative Works; within the Source form or
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
115
|
+
within a display generated by the Derivative Works, if and
|
116
|
+
wherever such third-party notices normally appear. The contents
|
117
|
+
of the NOTICE file are for informational purposes only and
|
118
|
+
do not modify the License. You may add Your own attribution
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
121
|
+
that such additional attribution notices cannot be construed
|
122
|
+
as modifying the License.
|
123
|
+
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
125
|
+
may provide additional or different license terms and conditions
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
129
|
+
the conditions stated in this License.
|
130
|
+
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
134
|
+
this License, without any additional terms or conditions.
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
136
|
+
the terms of any separate license agreement you may have executed
|
137
|
+
with Licensor regarding such Contributions.
|
138
|
+
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
141
|
+
except as required for reasonable and customary use in describing the
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
143
|
+
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
153
|
+
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
159
|
+
incidental, or consequential damages of any character arising as a
|
160
|
+
result of this License or out of the use or inability to use the
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
163
|
+
other commercial damages or losses), even if such Contributor
|
164
|
+
has been advised of the possibility of such damages.
|
165
|
+
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
169
|
+
or other liability obligations and/or rights consistent with this
|
170
|
+
License. However, in accepting such obligations, You may act only
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
175
|
+
of your accepting any such warranty or additional liability.
|
176
|
+
|
177
|
+
END OF TERMS AND CONDITIONS
|
178
|
+
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
180
|
+
|
181
|
+
To apply the Apache License to your work, attach the following
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
183
|
+
replaced with your own identifying information. (Don't include
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
185
|
+
comment syntax for the file format. We also recommend that a
|
186
|
+
file or class name and description of purpose be included on the
|
187
|
+
same "printed page" as the copyright notice for easier
|
188
|
+
identification within third-party archives.
|
189
|
+
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
191
|
+
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
193
|
+
you may not use this file except in compliance with the License.
|
194
|
+
You may obtain a copy of the License at
|
195
|
+
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
197
|
+
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
201
|
+
See the License for the specific language governing permissions and
|
202
|
+
limitations under the License.
|
data/README.ad
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
= Dzslides::Sass
|
2
|
+
|
3
|
+
This gem includes DZSlide css core, done as a sass module. I may also add in the javascript as well eventually. DZSlides is originally from Paul Rouget. Some modifications have been done by myself and Dan Allen (mojavelinux).
|
4
|
+
|
5
|
+
== Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
----
|
10
|
+
gem 'dzslides-sass'
|
11
|
+
----
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
----
|
16
|
+
$ bundle
|
17
|
+
----
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
----
|
22
|
+
$ gem install dzslides-sass
|
23
|
+
----
|
24
|
+
|
25
|
+
== Usage
|
26
|
+
|
27
|
+
Within your scss file include:
|
28
|
+
|
29
|
+
----
|
30
|
+
@import 'dzslides-core'
|
31
|
+
----
|
32
|
+
|
33
|
+
That uses the defaults (which is what regular dzslides does anyway) and you're good to go with styling!
|
34
|
+
|
35
|
+
== Contributing
|
36
|
+
|
37
|
+
Should you feel so inclined to follow my workflow, I'm using http://nvie.com/posts/a-successful-git-branching-model/[git-flow]
|
38
|
+
|
39
|
+
1. Fork it
|
40
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
41
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
42
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
43
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'dzslides/sass/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "dzslides-sass"
|
8
|
+
spec.version = Dzslides::Sass::VERSION
|
9
|
+
spec.authors = ["LightGuard"]
|
10
|
+
spec.email = ["lightguard.jp@gmail.com"]
|
11
|
+
spec.description = %q{A SASS version of the dzslides css}
|
12
|
+
spec.summary = "DZSlides core css in a simple, easy to use sass gem"
|
13
|
+
spec.homepage = ""
|
14
|
+
spec.license = "ASL 2.0"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.require_paths = ["lib"]
|
18
|
+
|
19
|
+
spec.add_dependency "sass", [">= 3.2.7", "< 4.0"]
|
20
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
21
|
+
#spec.add_development_dependency "compass", "=> 0.12.2"
|
22
|
+
spec.add_development_dependency "rake"
|
23
|
+
end
|
@@ -0,0 +1,418 @@
|
|
1
|
+
// __ __ __ . __ ___ __
|
2
|
+
// | \ / /__` | | | \ |__ /__`
|
3
|
+
// |__/ /_ .__/ |___ | |__/ |___ .__/ core :€
|
4
|
+
//
|
5
|
+
var Dz = {
|
6
|
+
remoteWindows: [],
|
7
|
+
idx: -1,
|
8
|
+
step: 0,
|
9
|
+
html: null,
|
10
|
+
slides: null,
|
11
|
+
progressBar : null,
|
12
|
+
params: {
|
13
|
+
autoplay: "1"
|
14
|
+
}
|
15
|
+
};
|
16
|
+
|
17
|
+
Dz.init = function() {
|
18
|
+
document.body.className = "loaded";
|
19
|
+
this.slides = Array.prototype.slice.call($$("body > section"));
|
20
|
+
this.progressBar = $("#progress-bar");
|
21
|
+
if (!this.progressBar) {
|
22
|
+
this.progressBar = document.createElement('div');
|
23
|
+
this.progressBar.id = 'progress-bar';
|
24
|
+
document.body.appendChild(this.progressBar);
|
25
|
+
}
|
26
|
+
this.html = document.body.parentNode;
|
27
|
+
this.setupParams();
|
28
|
+
this.onhashchange();
|
29
|
+
this.setupTouchEvents();
|
30
|
+
this.onresize();
|
31
|
+
this.setupView();
|
32
|
+
}
|
33
|
+
|
34
|
+
Dz.setupParams = function() {
|
35
|
+
var p = window.location.search.substr(1).split('&');
|
36
|
+
p.forEach(function(e, i, a) {
|
37
|
+
var keyVal = e.split('=');
|
38
|
+
Dz.params[keyVal[0]] = decodeURIComponent(keyVal[1]);
|
39
|
+
});
|
40
|
+
// Specific params handling
|
41
|
+
if (!+this.params.autoplay)
|
42
|
+
$$.forEach($$("video"), function(v){ v.controls = true });
|
43
|
+
}
|
44
|
+
|
45
|
+
Dz.onkeydown = function(aEvent) {
|
46
|
+
// skip keystrokes in a content editable region
|
47
|
+
if (aEvent.target.isContentEditable) {
|
48
|
+
return;
|
49
|
+
}
|
50
|
+
|
51
|
+
// Don't intercept keyboard shortcuts
|
52
|
+
if (aEvent.altKey
|
53
|
+
|| aEvent.ctrlKey
|
54
|
+
|| aEvent.metaKey
|
55
|
+
|| aEvent.shiftKey) {
|
56
|
+
return;
|
57
|
+
}
|
58
|
+
if ( aEvent.keyCode == 37 // left arrow
|
59
|
+
|| aEvent.keyCode == 38 // up arrow
|
60
|
+
|| aEvent.keyCode == 33 // page up
|
61
|
+
|| aEvent.keyCode == 8 // backspace
|
62
|
+
|| aEvent.keyCode == 75 // k
|
63
|
+
) {
|
64
|
+
aEvent.preventDefault();
|
65
|
+
this.back();
|
66
|
+
}
|
67
|
+
else if ( aEvent.keyCode == 39 // right arrow
|
68
|
+
|| aEvent.keyCode == 40 // down arrow
|
69
|
+
|| aEvent.keyCode == 34 // page down
|
70
|
+
|| aEvent.keyCode == 32 // space
|
71
|
+
|| aEvent.keyCode == 74 // j
|
72
|
+
) {
|
73
|
+
aEvent.preventDefault();
|
74
|
+
this.forward();
|
75
|
+
}
|
76
|
+
else if (aEvent.keyCode == 35) { // end
|
77
|
+
aEvent.preventDefault();
|
78
|
+
this.goEnd();
|
79
|
+
}
|
80
|
+
else if (aEvent.keyCode == 36) { // home
|
81
|
+
aEvent.preventDefault();
|
82
|
+
this.goStart();
|
83
|
+
}
|
84
|
+
else if (aEvent.keyCode == 80) { // p
|
85
|
+
aEvent.preventDefault();
|
86
|
+
this.toggleContent();
|
87
|
+
}
|
88
|
+
else if (aEvent.keyCode == 70) { // f
|
89
|
+
aEvent.preventDefault();
|
90
|
+
this.goFullscreen();
|
91
|
+
}
|
92
|
+
else if (aEvent.keyCode == 79) { // o
|
93
|
+
aEvent.preventDefault();
|
94
|
+
this.toggleView();
|
95
|
+
}
|
96
|
+
}
|
97
|
+
|
98
|
+
/* Touch Events */
|
99
|
+
|
100
|
+
Dz.setupTouchEvents = function() {
|
101
|
+
var orgX, newX;
|
102
|
+
var tracking = false;
|
103
|
+
|
104
|
+
var db = document.body;
|
105
|
+
db.addEventListener("touchstart", start.bind(this), false);
|
106
|
+
db.addEventListener("touchmove", move.bind(this), false);
|
107
|
+
|
108
|
+
function start(aEvent) {
|
109
|
+
aEvent.preventDefault();
|
110
|
+
tracking = true;
|
111
|
+
orgX = aEvent.changedTouches[0].pageX;
|
112
|
+
}
|
113
|
+
|
114
|
+
function move(aEvent) {
|
115
|
+
if (!tracking) return;
|
116
|
+
newX = aEvent.changedTouches[0].pageX;
|
117
|
+
if (orgX - newX > 100) {
|
118
|
+
tracking = false;
|
119
|
+
this.forward();
|
120
|
+
} else {
|
121
|
+
if (orgX - newX < -100) {
|
122
|
+
tracking = false;
|
123
|
+
this.back();
|
124
|
+
}
|
125
|
+
}
|
126
|
+
}
|
127
|
+
}
|
128
|
+
|
129
|
+
Dz.setupView = function() {
|
130
|
+
document.body.addEventListener("click", function ( e ) {
|
131
|
+
if (!Dz.html.classList.contains("view")) return;
|
132
|
+
if (!e.target || e.target.nodeName != "SECTION") return;
|
133
|
+
|
134
|
+
Dz.html.classList.remove("view");
|
135
|
+
Dz.setCursor(Dz.slides.indexOf(e.target) + 1);
|
136
|
+
}, false);
|
137
|
+
}
|
138
|
+
|
139
|
+
/* Adapt the size of the slides to the window */
|
140
|
+
|
141
|
+
Dz.onresize = function() {
|
142
|
+
var db = document.body;
|
143
|
+
var sx = db.clientWidth / window.innerWidth;
|
144
|
+
var sy = db.clientHeight / window.innerHeight;
|
145
|
+
var transform = "scale(" + (1/Math.max(sx, sy)) + ")";
|
146
|
+
|
147
|
+
db.style.MozTransform = transform;
|
148
|
+
db.style.WebkitTransform = transform;
|
149
|
+
db.style.OTransform = transform;
|
150
|
+
db.style.msTransform = transform;
|
151
|
+
db.style.transform = transform;
|
152
|
+
}
|
153
|
+
|
154
|
+
Dz.getDetails = function(aIdx) {
|
155
|
+
var s = $("section:nth-of-type(" + aIdx + ")");
|
156
|
+
var d = s.$("details");
|
157
|
+
return d ? d.innerHTML : "";
|
158
|
+
}
|
159
|
+
|
160
|
+
Dz.getAspect = function() {
|
161
|
+
var match = document.documentElement.className.match(/\baspect-([0-9]+)-([0-9]+)\b/)
|
162
|
+
if (match)
|
163
|
+
return match[1] + ":" + match[2];
|
164
|
+
return "4:3";
|
165
|
+
}
|
166
|
+
|
167
|
+
Dz.onmessage = function(aEvent) {
|
168
|
+
var argv = aEvent.data.split(" "), argc = argv.length;
|
169
|
+
argv.forEach(function(e, i, a) { a[i] = decodeURIComponent(e) });
|
170
|
+
var win = aEvent.source;
|
171
|
+
if (argv[0] === "REGISTER" && argc === 1) {
|
172
|
+
this.remoteWindows.push(win);
|
173
|
+
this.postMsg(win, "REGISTERED", document.title, this.slides.length);
|
174
|
+
this.postMsg(win, "CURSOR", this.idx + "." + this.step);
|
175
|
+
return;
|
176
|
+
}
|
177
|
+
if (argv[0] === "BACK" && argc === 1)
|
178
|
+
this.back();
|
179
|
+
if (argv[0] === "FORWARD" && argc === 1)
|
180
|
+
this.forward();
|
181
|
+
if (argv[0] === "START" && argc === 1)
|
182
|
+
this.goStart();
|
183
|
+
if (argv[0] === "END" && argc === 1)
|
184
|
+
this.goEnd();
|
185
|
+
if (argv[0] === "TOGGLE_CONTENT" && argc === 1)
|
186
|
+
this.toggleContent();
|
187
|
+
if (argv[0] === "SET_CURSOR" && argc === 2)
|
188
|
+
window.location.hash = "#" + argv[1];
|
189
|
+
if (argv[0] === "GET_CURSOR" && argc === 1)
|
190
|
+
this.postMsg(win, "CURSOR", this.idx + "." + this.step);
|
191
|
+
if (argv[0] === "GET_NOTES" && argc === 1)
|
192
|
+
this.postMsg(win, "NOTES", this.getDetails(this.idx));
|
193
|
+
if (argv[0] === "GET_ASPECT" && argc === 1)
|
194
|
+
this.postMsg(win, "ASPECT", this.getAspect());
|
195
|
+
}
|
196
|
+
|
197
|
+
Dz.toggleContent = function() {
|
198
|
+
// If a Video is present in this new slide, play it.
|
199
|
+
// If a Video is present in the previous slide, stop it.
|
200
|
+
var s = $("section[aria-selected]");
|
201
|
+
if (s) {
|
202
|
+
var video = s.$("video");
|
203
|
+
if (video) {
|
204
|
+
if (video.ended || video.paused) {
|
205
|
+
video.play();
|
206
|
+
} else {
|
207
|
+
video.pause();
|
208
|
+
}
|
209
|
+
}
|
210
|
+
}
|
211
|
+
}
|
212
|
+
|
213
|
+
Dz.setCursor = function(aIdx, aStep) {
|
214
|
+
// If the user change the slide number in the URL bar, jump
|
215
|
+
// to this slide.
|
216
|
+
aStep = (aStep != 0 && typeof aStep !== "undefined") ? "." + aStep : ".0";
|
217
|
+
window.location.hash = "#" + aIdx + aStep;
|
218
|
+
}
|
219
|
+
|
220
|
+
Dz.onhashchange = function() {
|
221
|
+
var cursor = window.location.hash.split("#"),
|
222
|
+
newidx = 1,
|
223
|
+
newstep = 0;
|
224
|
+
if (cursor.length == 2) {
|
225
|
+
newidx = ~~cursor[1].split(".")[0];
|
226
|
+
newstep = ~~cursor[1].split(".")[1];
|
227
|
+
if (newstep > Dz.slides[newidx - 1].$$('.incremental > *').length) {
|
228
|
+
newstep = 0;
|
229
|
+
newidx++;
|
230
|
+
}
|
231
|
+
}
|
232
|
+
this.setProgress(newidx, newstep);
|
233
|
+
if (newidx != this.idx) {
|
234
|
+
this.setSlide(newidx);
|
235
|
+
}
|
236
|
+
if (newstep != this.step) {
|
237
|
+
this.setIncremental(newstep);
|
238
|
+
}
|
239
|
+
for (var i = 0; i < this.remoteWindows.length; i++) {
|
240
|
+
this.postMsg(this.remoteWindows[i], "CURSOR", this.idx + "." + this.step);
|
241
|
+
}
|
242
|
+
}
|
243
|
+
|
244
|
+
Dz.back = function() {
|
245
|
+
if (this.idx == 1 && this.step == 0) {
|
246
|
+
return;
|
247
|
+
}
|
248
|
+
if (this.step == 0) {
|
249
|
+
this.setCursor(this.idx - 1,
|
250
|
+
this.slides[this.idx - 2].$$('.incremental > *').length);
|
251
|
+
} else {
|
252
|
+
this.setCursor(this.idx, this.step - 1);
|
253
|
+
}
|
254
|
+
}
|
255
|
+
|
256
|
+
Dz.forward = function() {
|
257
|
+
if (this.idx >= this.slides.length &&
|
258
|
+
this.step >= this.slides[this.idx - 1].$$('.incremental > *').length) {
|
259
|
+
return;
|
260
|
+
}
|
261
|
+
if (this.step >= this.slides[this.idx - 1].$$('.incremental > *').length) {
|
262
|
+
this.setCursor(this.idx + 1, 0);
|
263
|
+
} else {
|
264
|
+
this.setCursor(this.idx, this.step + 1);
|
265
|
+
}
|
266
|
+
}
|
267
|
+
|
268
|
+
Dz.goStart = function() {
|
269
|
+
this.setCursor(1, 0);
|
270
|
+
}
|
271
|
+
|
272
|
+
Dz.goEnd = function() {
|
273
|
+
var lastIdx = this.slides.length;
|
274
|
+
var lastStep = this.slides[lastIdx - 1].$$('.incremental > *').length;
|
275
|
+
this.setCursor(lastIdx, lastStep);
|
276
|
+
}
|
277
|
+
|
278
|
+
Dz.toggleView = function() {
|
279
|
+
this.html.classList.toggle("view");
|
280
|
+
|
281
|
+
if (this.html.classList.contains("view")) {
|
282
|
+
$("section[aria-selected]").scrollIntoView(true);
|
283
|
+
}
|
284
|
+
}
|
285
|
+
|
286
|
+
Dz.setSlide = function(aIdx) {
|
287
|
+
this.idx = aIdx;
|
288
|
+
var old = $("section[aria-selected]");
|
289
|
+
var next = $("section:nth-of-type("+ this.idx +")");
|
290
|
+
if (old) {
|
291
|
+
var oldIncremental = old.$('.incremental > *[aria-selected]')
|
292
|
+
if (oldIncremental) {
|
293
|
+
oldIncremental.removeAttribute('aria-selected');
|
294
|
+
}
|
295
|
+
old.removeAttribute("aria-selected");
|
296
|
+
var video = old.$("video");
|
297
|
+
if (video) {
|
298
|
+
video.pause();
|
299
|
+
}
|
300
|
+
}
|
301
|
+
if (next) {
|
302
|
+
next.setAttribute("aria-selected", "true");
|
303
|
+
var video = next.$("video");
|
304
|
+
if (video && !!+this.params.autoplay) {
|
305
|
+
video.play();
|
306
|
+
}
|
307
|
+
} else {
|
308
|
+
// That should not happen
|
309
|
+
this.idx = -1;
|
310
|
+
// console.warn("Slide doesn't exist.");
|
311
|
+
}
|
312
|
+
}
|
313
|
+
|
314
|
+
Dz.setIncremental = function(aStep) {
|
315
|
+
this.step = aStep;
|
316
|
+
var old = this.slides[this.idx - 1].$('.incremental > *[aria-selected]');
|
317
|
+
if (old) {
|
318
|
+
old.removeAttribute('aria-selected');
|
319
|
+
}
|
320
|
+
var incrementals = $$('.incremental');
|
321
|
+
if (this.step <= 0) {
|
322
|
+
$$.forEach(incrementals, function(aNode) {
|
323
|
+
aNode.removeAttribute('active');
|
324
|
+
});
|
325
|
+
return;
|
326
|
+
}
|
327
|
+
var next = this.slides[this.idx - 1].$$('.incremental > *')[this.step - 1];
|
328
|
+
if (next) {
|
329
|
+
next.setAttribute('aria-selected', true);
|
330
|
+
next.parentNode.setAttribute('active', true);
|
331
|
+
var found = false;
|
332
|
+
$$.forEach(incrementals, function(aNode) {
|
333
|
+
if (aNode != next.parentNode)
|
334
|
+
if (found)
|
335
|
+
aNode.removeAttribute('active');
|
336
|
+
else
|
337
|
+
aNode.setAttribute('active', true);
|
338
|
+
else
|
339
|
+
found = true;
|
340
|
+
});
|
341
|
+
} else {
|
342
|
+
setCursor(this.idx, 0);
|
343
|
+
}
|
344
|
+
return next;
|
345
|
+
}
|
346
|
+
|
347
|
+
Dz.goFullscreen = function() {
|
348
|
+
var html = $('html'),
|
349
|
+
requestFullscreen = html.requestFullscreen || html.requestFullScreen || html.mozRequestFullScreen || html.webkitRequestFullScreen;
|
350
|
+
if (requestFullscreen) {
|
351
|
+
requestFullscreen.apply(html);
|
352
|
+
}
|
353
|
+
}
|
354
|
+
|
355
|
+
Dz.setProgress = function(aIdx, aStep) {
|
356
|
+
var slide = $("section:nth-of-type("+ aIdx +")");
|
357
|
+
if (!slide)
|
358
|
+
return;
|
359
|
+
var steps = slide.$$('.incremental > *').length + 1,
|
360
|
+
slideSize = 100 / (this.slides.length - 1),
|
361
|
+
stepSize = slideSize / steps;
|
362
|
+
this.progressBar.style.width = ((aIdx - 1) * slideSize + aStep * stepSize) + '%';
|
363
|
+
}
|
364
|
+
|
365
|
+
Dz.postMsg = function(aWin, aMsg) { // [arg0, [arg1...]]
|
366
|
+
aMsg = [aMsg];
|
367
|
+
for (var i = 2; i < arguments.length; i++)
|
368
|
+
aMsg.push(encodeURIComponent(arguments[i]));
|
369
|
+
aWin.postMessage(aMsg.join(" "), "*");
|
370
|
+
}
|
371
|
+
|
372
|
+
function init() {
|
373
|
+
Dz.init();
|
374
|
+
window.onkeydown = Dz.onkeydown.bind(Dz);
|
375
|
+
window.onresize = Dz.onresize.bind(Dz);
|
376
|
+
window.onhashchange = Dz.onhashchange.bind(Dz);
|
377
|
+
window.onmessage = Dz.onmessage.bind(Dz);
|
378
|
+
}
|
379
|
+
|
380
|
+
window.onload = init;
|
381
|
+
|
382
|
+
// Helpers
|
383
|
+
if (!Function.prototype.bind) {
|
384
|
+
Function.prototype.bind = function (oThis) {
|
385
|
+
|
386
|
+
// closest thing possible to the ECMAScript 5 internal IsCallable
|
387
|
+
// function
|
388
|
+
if (typeof this !== "function")
|
389
|
+
throw new TypeError(
|
390
|
+
"Function.prototype.bind - what is trying to be fBound is not callable"
|
391
|
+
);
|
392
|
+
|
393
|
+
var aArgs = Array.prototype.slice.call(arguments, 1),
|
394
|
+
fToBind = this,
|
395
|
+
fNOP = function () {},
|
396
|
+
fBound = function () {
|
397
|
+
return fToBind.apply( this instanceof fNOP ? this : oThis || window,
|
398
|
+
aArgs.concat(Array.prototype.slice.call(arguments)));
|
399
|
+
};
|
400
|
+
|
401
|
+
fNOP.prototype = this.prototype;
|
402
|
+
fBound.prototype = new fNOP();
|
403
|
+
|
404
|
+
return fBound;
|
405
|
+
};
|
406
|
+
}
|
407
|
+
|
408
|
+
var $ = (HTMLElement.prototype.$ = function(aQuery) {
|
409
|
+
return this.querySelector(aQuery);
|
410
|
+
}).bind(document);
|
411
|
+
|
412
|
+
var $$ = (HTMLElement.prototype.$$ = function(aQuery) {
|
413
|
+
return this.querySelectorAll(aQuery);
|
414
|
+
}).bind(document);
|
415
|
+
|
416
|
+
$$.forEach = function(nodeList, fun) {
|
417
|
+
Array.prototype.forEach.call(nodeList, fun);
|
418
|
+
}
|
data/lib/dzslides.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
// DZSlides by Paul Rouget, modified by Dan Allen and Jason Porter
|
2
|
+
// original at https://github.com/paulrouget/dzslides
|
3
|
+
// Original License WTFPL 2.0, relicensed to APL 2.0
|
4
|
+
|
5
|
+
@charset "UTF-8";
|
6
|
+
|
7
|
+
// All the files
|
8
|
+
@import
|
9
|
+
"dzslides/global",
|
10
|
+
"dzslides/components/reset",
|
11
|
+
"dzslides/components/aspect",
|
12
|
+
"dzslides/components/body",
|
13
|
+
"dzslides/components/details",
|
14
|
+
"dzslides/components/figure",
|
15
|
+
"dzslides/components/incremental",
|
16
|
+
"dzslides/components/progress-bar",
|
17
|
+
"dzslides/components/section",
|
18
|
+
"dzslides/components/view";
|
@@ -0,0 +1,41 @@
|
|
1
|
+
// Variables and functions
|
2
|
+
|
3
|
+
$em-base: 16 !default;
|
4
|
+
$position-top: 50% !default;
|
5
|
+
$position-left: 50% !default;
|
6
|
+
|
7
|
+
|
8
|
+
// Create em's off the pixel size passed in
|
9
|
+
@function emCalc($px) {
|
10
|
+
@return ($px / $em-base) * 1em;
|
11
|
+
}
|
12
|
+
|
13
|
+
// Create an rem based on the pixel size passed in
|
14
|
+
@function remCalc($px) {
|
15
|
+
@return ($px / $em-base) * 1rem;
|
16
|
+
}
|
17
|
+
|
18
|
+
//
|
19
|
+
// Changes the box model using standard and proprietary properties.
|
20
|
+
// @param $box-sizing The box model to use content-box, border-box, padding-box (moz only)
|
21
|
+
//
|
22
|
+
@mixin box-sizing($box-sizing) {
|
23
|
+
-moz-box-sizing: $box-sizing;
|
24
|
+
box-sizing: $box-sizing;
|
25
|
+
}
|
26
|
+
|
27
|
+
@mixin transform($transforms) {
|
28
|
+
-webkit-transform: $transforms;
|
29
|
+
-moz-transform: $transforms;
|
30
|
+
-ms-transform: $transforms;
|
31
|
+
-o-transform: $transforms;
|
32
|
+
transform: $transforms;
|
33
|
+
}
|
34
|
+
|
35
|
+
@mixin transition($transition) {
|
36
|
+
-webkit-transition: $transition;
|
37
|
+
-moz-transition: $transition;
|
38
|
+
-ms-transition: $transition;
|
39
|
+
transition: $transition;
|
40
|
+
}
|
41
|
+
|
@@ -0,0 +1,13 @@
|
|
1
|
+
//
|
2
|
+
// Mixin to create the proper aspect size
|
3
|
+
//
|
4
|
+
@mixin aspect-size($height, $aspect-factor, $margin-factor: -0.5, $include-width: true) {
|
5
|
+
$width: ($height * $aspect-factor);
|
6
|
+
height: remCalc($height);
|
7
|
+
margin-left: remCalc($width * $margin-factor);
|
8
|
+
margin-top: remCalc($height * $margin-factor);
|
9
|
+
@if ($include-width == true) {
|
10
|
+
width: remCalc($width);
|
11
|
+
}
|
12
|
+
}
|
13
|
+
|
@@ -0,0 +1,24 @@
|
|
1
|
+
@import 'dzslides/global';
|
2
|
+
|
3
|
+
.aspect-16-10 body {
|
4
|
+
@include aspect-size(500, (16/10));
|
5
|
+
}
|
6
|
+
|
7
|
+
.aspect-16-9 body {
|
8
|
+
@include aspect-size(450, (16/9));
|
9
|
+
}
|
10
|
+
|
11
|
+
body {
|
12
|
+
display: none;
|
13
|
+
position: absolute;
|
14
|
+
top: 50%;
|
15
|
+
left: 50%;
|
16
|
+
@include aspect-size(600, (4/3));
|
17
|
+
margin-left: remCalc(-400);
|
18
|
+
overflow: hidden;
|
19
|
+
|
20
|
+
&.loaded {
|
21
|
+
display: block;
|
22
|
+
}
|
23
|
+
}
|
24
|
+
|
@@ -0,0 +1,48 @@
|
|
1
|
+
@import 'dzslides/global';
|
2
|
+
|
3
|
+
.aspect-16-10 .view .section {
|
4
|
+
@include aspect-size(500, (16/10));
|
5
|
+
}
|
6
|
+
|
7
|
+
.aspect-16-9 .view .section {
|
8
|
+
@include aspect-size(450, (16/9));
|
9
|
+
}
|
10
|
+
|
11
|
+
.view {
|
12
|
+
body {
|
13
|
+
display: inline-block;
|
14
|
+
position: static;
|
15
|
+
width: 100%;
|
16
|
+
height: 100%;
|
17
|
+
margin: remCalc(0);
|
18
|
+
padding: remCalc(0);
|
19
|
+
overflow: visible;
|
20
|
+
overflow-x: hidden;
|
21
|
+
/* undo Dz.onresize */
|
22
|
+
@include transform(none !important);
|
23
|
+
}
|
24
|
+
head {
|
25
|
+
display: block;
|
26
|
+
> title {
|
27
|
+
display: block;
|
28
|
+
}
|
29
|
+
}
|
30
|
+
section {
|
31
|
+
position: static;
|
32
|
+
@include aspect-size(600, (4/3));
|
33
|
+
width: remCalc(800);
|
34
|
+
pointer-events: auto;
|
35
|
+
float: left;
|
36
|
+
opacity: 1;
|
37
|
+
@include transform(scale(0.4));
|
38
|
+
|
39
|
+
/* Next Slide */
|
40
|
+
&[aria-selected] ~ section {
|
41
|
+
opacity: 1;
|
42
|
+
}
|
43
|
+
}
|
44
|
+
#progress-bar {
|
45
|
+
display: none;
|
46
|
+
}
|
47
|
+
}
|
48
|
+
|
metadata
ADDED
@@ -0,0 +1,112 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: dzslides-sass
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- LightGuard
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-05-25 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: sass
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 3.2.7
|
20
|
+
- - "<"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '4.0'
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 3.2.7
|
30
|
+
- - "<"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '4.0'
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: bundler
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - "~>"
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '1.3'
|
40
|
+
type: :development
|
41
|
+
prerelease: false
|
42
|
+
version_requirements: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - "~>"
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '1.3'
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: rake
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - ">="
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - ">="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '0'
|
61
|
+
description: A SASS version of the dzslides css
|
62
|
+
email:
|
63
|
+
- lightguard.jp@gmail.com
|
64
|
+
executables: []
|
65
|
+
extensions: []
|
66
|
+
extra_rdoc_files: []
|
67
|
+
files:
|
68
|
+
- ".gitignore"
|
69
|
+
- Gemfile
|
70
|
+
- LICENSE.txt
|
71
|
+
- README.ad
|
72
|
+
- Rakefile
|
73
|
+
- dzslides-sass.gemspec
|
74
|
+
- js/dzslides/dzslides.js
|
75
|
+
- lib/dzslides.rb
|
76
|
+
- lib/dzslides/sass/version.rb
|
77
|
+
- scss/dzslides-core.scss
|
78
|
+
- scss/dzslides/_global.scss
|
79
|
+
- scss/dzslides/components/_aspect.scss
|
80
|
+
- scss/dzslides/components/_body.scss
|
81
|
+
- scss/dzslides/components/_details.scss
|
82
|
+
- scss/dzslides/components/_figure.scss
|
83
|
+
- scss/dzslides/components/_incremental.scss
|
84
|
+
- scss/dzslides/components/_progress-bar.scss
|
85
|
+
- scss/dzslides/components/_reset.scss
|
86
|
+
- scss/dzslides/components/_section.scss
|
87
|
+
- scss/dzslides/components/_view.scss
|
88
|
+
homepage: ''
|
89
|
+
licenses:
|
90
|
+
- ASL 2.0
|
91
|
+
metadata: {}
|
92
|
+
post_install_message:
|
93
|
+
rdoc_options: []
|
94
|
+
require_paths:
|
95
|
+
- lib
|
96
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
97
|
+
requirements:
|
98
|
+
- - ">="
|
99
|
+
- !ruby/object:Gem::Version
|
100
|
+
version: '0'
|
101
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
102
|
+
requirements:
|
103
|
+
- - ">="
|
104
|
+
- !ruby/object:Gem::Version
|
105
|
+
version: '0'
|
106
|
+
requirements: []
|
107
|
+
rubyforge_project:
|
108
|
+
rubygems_version: 2.2.2
|
109
|
+
signing_key:
|
110
|
+
specification_version: 4
|
111
|
+
summary: DZSlides core css in a simple, easy to use sass gem
|
112
|
+
test_files: []
|