reveal.js-appearance 1.1.3 → 1.2.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.
- package/CHANGELOG.md +16 -0
- package/LICENSE +1 -1
- package/README.md +141 -52
- package/css/demo.css +106 -4
- package/demo-markdown.html +62 -0
- package/demo.html +312 -92
- package/img/5.jpg +0 -0
- package/markdown.md +156 -0
- package/package.json +7 -2
- package/plugin/appearance/appearance.css +32 -4
- package/plugin/appearance/appearance.esm.js +259 -162
- package/plugin/appearance/appearance.js +487 -390
- package/plugin/appearance/plugin-src.js +225 -34
- package/screenshot.png +0 -0
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* https://github.com/Martinomagnifico
|
|
5
5
|
*
|
|
6
6
|
* Appearance.js for Reveal.js
|
|
7
|
-
* Version 1.1
|
|
7
|
+
* Version 1.2.1
|
|
8
8
|
*
|
|
9
9
|
* @license
|
|
10
10
|
* MIT licensed
|
|
@@ -15,84 +15,26 @@
|
|
|
15
15
|
******************************************************************/
|
|
16
16
|
|
|
17
17
|
|
|
18
|
-
function _slicedToArray(arr, i) {
|
|
19
|
-
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
20
|
-
}
|
|
21
18
|
|
|
22
|
-
|
|
23
|
-
if (Array.isArray(arr)) return arr;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
function _iterableToArrayLimit(arr, i) {
|
|
27
|
-
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
28
|
-
|
|
29
|
-
if (_i == null) return;
|
|
30
|
-
var _arr = [];
|
|
31
|
-
var _n = true;
|
|
32
|
-
var _d = false;
|
|
33
|
-
|
|
34
|
-
var _s, _e;
|
|
35
|
-
|
|
36
|
-
try {
|
|
37
|
-
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
|
|
38
|
-
_arr.push(_s.value);
|
|
39
|
-
|
|
40
|
-
if (i && _arr.length === i) break;
|
|
41
|
-
}
|
|
42
|
-
} catch (err) {
|
|
43
|
-
_d = true;
|
|
44
|
-
_e = err;
|
|
45
|
-
} finally {
|
|
46
|
-
try {
|
|
47
|
-
if (!_n && _i["return"] != null) _i["return"]();
|
|
48
|
-
} finally {
|
|
49
|
-
if (_d) throw _e;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
return _arr;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
function _unsupportedIterableToArray(o, minLen) {
|
|
57
|
-
if (!o) return;
|
|
58
|
-
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
59
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
60
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
61
|
-
if (n === "Map" || n === "Set") return Array.from(o);
|
|
62
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
function _arrayLikeToArray(arr, len) {
|
|
66
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
67
|
-
|
|
68
|
-
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
69
|
-
|
|
70
|
-
return arr2;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
function _nonIterableRest() {
|
|
74
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
var Plugin = function Plugin() {
|
|
19
|
+
const Plugin = () => {
|
|
78
20
|
// Scope support polyfill
|
|
79
21
|
try {
|
|
80
22
|
document.querySelector(":scope *");
|
|
81
23
|
} catch (t) {
|
|
82
24
|
!function (t) {
|
|
83
|
-
|
|
25
|
+
let e = /:scope(?![\w-])/gi,
|
|
84
26
|
r = u(t.querySelector);
|
|
85
27
|
|
|
86
28
|
t.querySelector = function (t) {
|
|
87
29
|
return r.apply(this, arguments);
|
|
88
30
|
};
|
|
89
31
|
|
|
90
|
-
|
|
32
|
+
let c = u(t.querySelectorAll);
|
|
91
33
|
|
|
92
34
|
if (t.querySelectorAll = function (t) {
|
|
93
35
|
return c.apply(this, arguments);
|
|
94
36
|
}, t.matches) {
|
|
95
|
-
|
|
37
|
+
let n = u(t.matches);
|
|
96
38
|
|
|
97
39
|
t.matches = function (t) {
|
|
98
40
|
return n.apply(this, arguments);
|
|
@@ -100,7 +42,7 @@ var Plugin = function Plugin() {
|
|
|
100
42
|
}
|
|
101
43
|
|
|
102
44
|
if (t.closest) {
|
|
103
|
-
|
|
45
|
+
let o = u(t.closest);
|
|
104
46
|
|
|
105
47
|
t.closest = function (t) {
|
|
106
48
|
return o.apply(this, arguments);
|
|
@@ -110,13 +52,10 @@ var Plugin = function Plugin() {
|
|
|
110
52
|
function u(t) {
|
|
111
53
|
return function (r) {
|
|
112
54
|
if (r && e.test(r)) {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
var _n = t.apply(this, arguments);
|
|
118
|
-
|
|
119
|
-
return this.removeAttribute(_c), _n;
|
|
55
|
+
let c = "q" + Math.floor(9e6 * Math.random()) + 1e6;
|
|
56
|
+
arguments[0] = r.replace(e, "[" + c + "]"), this.setAttribute(c, "");
|
|
57
|
+
let n = t.apply(this, arguments);
|
|
58
|
+
return this.removeAttribute(c), n;
|
|
120
59
|
}
|
|
121
60
|
|
|
122
61
|
return t.apply(this, arguments);
|
|
@@ -125,14 +64,14 @@ var Plugin = function Plugin() {
|
|
|
125
64
|
}(Element.prototype);
|
|
126
65
|
}
|
|
127
66
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
67
|
+
const loadStyle = function (url, type, callback) {
|
|
68
|
+
let head = document.querySelector('head');
|
|
69
|
+
let style;
|
|
131
70
|
style = document.createElement('link');
|
|
132
71
|
style.rel = 'stylesheet';
|
|
133
72
|
style.href = url;
|
|
134
73
|
|
|
135
|
-
|
|
74
|
+
let finish = function () {
|
|
136
75
|
if (typeof callback === 'function') {
|
|
137
76
|
callback.call();
|
|
138
77
|
callback = null;
|
|
@@ -150,34 +89,207 @@ var Plugin = function Plugin() {
|
|
|
150
89
|
head.appendChild(style);
|
|
151
90
|
};
|
|
152
91
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
92
|
+
const isJSON = str => {
|
|
93
|
+
try {
|
|
94
|
+
return JSON.parse(str) && !!str;
|
|
95
|
+
} catch (e) {
|
|
96
|
+
return false;
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
const selectionArray = function (container, selectors) {
|
|
101
|
+
let selections = container.querySelectorAll(selectors);
|
|
102
|
+
let selectionarray = Array.prototype.slice.call(selections);
|
|
156
103
|
return selectionarray;
|
|
157
104
|
};
|
|
158
105
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
106
|
+
const isStack = function (section) {
|
|
107
|
+
let isStack = false;
|
|
108
|
+
|
|
109
|
+
for (let i = 0; i < section.childNodes.length; i++) {
|
|
110
|
+
if (section.childNodes[i].tagName == "SECTION") {
|
|
111
|
+
isStack = true;
|
|
112
|
+
break;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
return isStack;
|
|
117
|
+
};
|
|
166
118
|
|
|
167
|
-
|
|
119
|
+
function copyDataAttributes(source, target, not) {
|
|
120
|
+
[...source.attributes].filter(attr => attr.nodeName.indexOf('data') > -1).forEach(attr => {
|
|
121
|
+
if (not && attr.nodeName !== not || !not) {
|
|
122
|
+
target.setAttribute(attr.nodeName, attr.nodeValue);
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
const appear = function (deck, options) {
|
|
128
|
+
let baseclass = 'animate__animated';
|
|
129
|
+
let viewport = deck.getRevealElement().tagName == "BODY" ? document : deck.getRevealElement();
|
|
130
|
+
let appearanceSelector = options.compatibility ? `.${options.compatibilitybaseclass}` : `.${baseclass}`;
|
|
131
|
+
let fragmentSelector = ".fragment";
|
|
132
|
+
let speedClasses = ['slower', 'slow', 'fast', 'faster'];
|
|
133
|
+
speedClasses.push(...speedClasses.map(speed => `animate__${speed}`));
|
|
134
|
+
document.querySelector('[name=generator]');
|
|
135
|
+
const sections = selectionArray(viewport, "section");
|
|
136
|
+
const regularSections = sections.filter(section => !isStack(section) && section.dataset.visibility != "hidden");
|
|
137
|
+
const fragments = deck.getRevealElement().querySelectorAll(fragmentSelector);
|
|
138
|
+
let animatecss = '[class^="animate__"],[class*=" animate__"]';
|
|
139
|
+
|
|
140
|
+
const debugLog = function (text) {
|
|
168
141
|
if (options.debug) console.log(text);
|
|
169
142
|
};
|
|
170
143
|
|
|
171
|
-
|
|
144
|
+
let url = new URL(window.location);
|
|
145
|
+
let urlparams = new URLSearchParams(url.search);
|
|
146
|
+
|
|
147
|
+
if (urlparams.has('receiver')) {
|
|
148
|
+
viewport.classList.add('sv');
|
|
149
|
+
console.log(viewport);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
const assignAutoClass = (section, str, kind) => {
|
|
153
|
+
let index = [...section.parentElement.children].filter(s => s.tagName == "SECTION").indexOf(section) + 1;
|
|
154
|
+
let warning = kind == 'global' ? `JSON Parse error, please try to correct the global "autoelements" option.` : `JSON Parse error, please try to correct the "data-autoappear" attribute on section ${index}`;
|
|
155
|
+
if (typeof str === "string") str = str.replace(/[“”]/g, '"').replace(/[‘’]/g, "'");
|
|
156
|
+
let strJSON = isJSON(str) ? str : typeof str === "object" ? JSON.stringify(str, null, 2) : str.trim().replace(/'/g, '"').charAt(0) === "{" ? str.trim().replace(/'/g, '"') : `{${str.trim().replace(/'/g, '"')}}`;
|
|
157
|
+
|
|
158
|
+
if (!isJSON(strJSON)) {
|
|
159
|
+
console.log(warning);
|
|
160
|
+
} else {
|
|
161
|
+
let elementsToAnimate = JSON.parse(strJSON);
|
|
162
|
+
|
|
163
|
+
for (const [element, assignables] of Object.entries(elementsToAnimate)) {
|
|
164
|
+
let elementsInSection = section.querySelectorAll(element);
|
|
165
|
+
elementsInSection.forEach(elementInSection => {
|
|
166
|
+
if (!elementInSection.classList.contains(baseclass) || elementInSection.dataset["autoappear"]) {
|
|
167
|
+
elementInSection.dataset["autoappear"] = true;
|
|
168
|
+
let newClasses = [],
|
|
169
|
+
newDelay = null,
|
|
170
|
+
speedClass = false;
|
|
171
|
+
|
|
172
|
+
if (Array.isArray(assignables)) {
|
|
173
|
+
newClasses = assignables[0].split(/[ ,]+/);
|
|
174
|
+
newDelay = assignables[1];
|
|
175
|
+
} else if (typeof assignables == "string") {
|
|
176
|
+
newClasses = assignables.split(/[ ,]+/);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
speedClasses.forEach(speed => {
|
|
180
|
+
if (elementInSection.classList.contains(speed)) {
|
|
181
|
+
speedClass = speed;
|
|
182
|
+
}
|
|
183
|
+
});
|
|
184
|
+
let classesToRemove = [];
|
|
185
|
+
elementInSection.classList.forEach(currentClass => {
|
|
186
|
+
if (String(currentClass).includes("animate__")) {
|
|
187
|
+
classesToRemove.push(currentClass);
|
|
188
|
+
}
|
|
189
|
+
});
|
|
190
|
+
classesToRemove.forEach(currentClass => {
|
|
191
|
+
elementInSection.classList.remove(currentClass);
|
|
192
|
+
});
|
|
193
|
+
newClasses.forEach(newClass => {
|
|
194
|
+
if (speedClasses.includes(newClass)) {
|
|
195
|
+
// There is a speed class from JSON to be assigned
|
|
196
|
+
if (speedClass) {
|
|
197
|
+
speedClass = newClass;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
});
|
|
201
|
+
newClasses.forEach(newClass => {
|
|
202
|
+
elementInSection.classList.add(newClass);
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
if (speedClass) {
|
|
206
|
+
elementInSection.classList.add(speedClass);
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
if (newDelay) {
|
|
210
|
+
elementInSection.dataset.delay = newDelay;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
elementInSection.classList.add(baseclass);
|
|
214
|
+
}
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
const findAppearancesIn = function (container, includeClass, excludeClass) {
|
|
172
221
|
if (!isStack(container)) {
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
222
|
+
let appearances = selectionArray(container, `:scope ${includeClass}`);
|
|
223
|
+
appearances.forEach(appearance => {
|
|
224
|
+
let convertListItem = appearance => {
|
|
225
|
+
let from = appearance,
|
|
226
|
+
to = appearance.parentNode;
|
|
227
|
+
if (!to) return;
|
|
228
|
+
|
|
229
|
+
for (let sibling of to.children) {
|
|
230
|
+
if (sibling !== appearance) {
|
|
231
|
+
if (sibling.dataset.appearParent) return;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
to.classList = from.classList;
|
|
236
|
+
copyDataAttributes(from, to, "data-appear-parent");
|
|
237
|
+
to.innerHTML = from.innerHTML;
|
|
238
|
+
}; // Conversion of list items with Appearance classes to the parent, needs manual attribute
|
|
239
|
+
// Relates to Quarto wrapping list content in a span.
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
if (appearance.hasAttribute("data-appear-parent")) {
|
|
243
|
+
convertListItem(appearance);
|
|
244
|
+
} // Automatic conversion of list items which directly contain spans.
|
|
245
|
+
// Relates to Quarto wrapping list content in a span.
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
if (options.appearparents) {
|
|
249
|
+
if (appearance.parentNode && appearance.parentNode.tagName) {
|
|
250
|
+
if (appearance.tagName == "SPAN" && appearance.parentNode.tagName == "LI") {
|
|
251
|
+
let spanLength = String(appearance.outerHTML).length;
|
|
252
|
+
let liContentLength = String(appearance.parentNode.innerHTML).length;
|
|
253
|
+
|
|
254
|
+
if (spanLength == liContentLength) {
|
|
255
|
+
convertListItem(appearance);
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
});
|
|
261
|
+
appearances = selectionArray(container, `:scope ${includeClass}`);
|
|
262
|
+
let excludes = selectionArray(container, `:scope ${excludeClass} ${includeClass}`);
|
|
263
|
+
let delay = 0;
|
|
176
264
|
appearances.filter(function (appearance, index) {
|
|
177
265
|
if (!(excludes.indexOf(appearance) > -1)) {
|
|
178
266
|
if (index == 0 && appearance.dataset.delay || index != 0) {
|
|
179
|
-
|
|
180
|
-
|
|
267
|
+
let elementDelay = options.delay;
|
|
268
|
+
|
|
269
|
+
if (appearance.dataset && appearance.dataset.delay) {
|
|
270
|
+
elementDelay = parseInt(appearance.dataset.delay);
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
delay = delay + elementDelay; // Allow fragments to be Appearance items
|
|
274
|
+
|
|
275
|
+
if (appearance.classList.contains("fragment")) {
|
|
276
|
+
delay = 0;
|
|
277
|
+
|
|
278
|
+
if (appearance.querySelectorAll(`.${baseclass}`)) {
|
|
279
|
+
let firstNestedAppearance = appearance.querySelectorAll(`.${baseclass}`)[0];
|
|
280
|
+
|
|
281
|
+
if (firstNestedAppearance) {
|
|
282
|
+
let elementDelay = options.delay;
|
|
283
|
+
|
|
284
|
+
if (firstNestedAppearance.dataset && firstNestedAppearance.dataset.delay) {
|
|
285
|
+
elementDelay = parseInt(firstNestedAppearance.dataset.delay);
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
firstNestedAppearance.dataset.delay = elementDelay;
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
|
|
181
293
|
appearance.style.setProperty('animation-delay', delay + "ms");
|
|
182
294
|
}
|
|
183
295
|
}
|
|
@@ -185,49 +297,35 @@ var Plugin = function Plugin() {
|
|
|
185
297
|
}
|
|
186
298
|
};
|
|
187
299
|
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
autoelement = _Object$entries$_i[0],
|
|
193
|
-
autoanimation = _Object$entries$_i[1];
|
|
300
|
+
const autoAdd = function () {
|
|
301
|
+
regularSections.forEach(section => {
|
|
302
|
+
if (section.hasAttribute("data-autoappear")) {
|
|
303
|
+
let sectDataAppear = section.dataset.autoappear;
|
|
194
304
|
|
|
195
|
-
if (
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
var autoAppearances = deck.getRevealElement().querySelectorAll(".slides ".concat(autosection).concat(autoelement));
|
|
201
|
-
|
|
202
|
-
if (autoAppearances.length > 0) {
|
|
203
|
-
autoAppearances.forEach(function (autoAppearance) {
|
|
204
|
-
if (!autoAppearance.classList.contains(baseclass)) {
|
|
205
|
-
autoAppearance.classList.add(baseclass);
|
|
206
|
-
autoAppearance.classList.add(autoanimation);
|
|
305
|
+
if (sectDataAppear == "auto" || sectDataAppear == "" || sectDataAppear.length < 1 || sectDataAppear == "true") {
|
|
306
|
+
// This section should get the global autoappear classes on its objects
|
|
307
|
+
if (options.autoelements) {
|
|
308
|
+
if (!options.autoelements) {
|
|
309
|
+
return console.log(`Please add some elements in the option "autoelements"`);
|
|
207
310
|
}
|
|
208
|
-
});
|
|
209
|
-
}
|
|
210
|
-
};
|
|
211
311
|
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
312
|
+
assignAutoClass(section, options.autoelements, 'global');
|
|
313
|
+
}
|
|
314
|
+
} else if (sectDataAppear.length > 0) {
|
|
315
|
+
// This section should get the local data-autoappear classes on its objects
|
|
316
|
+
assignAutoClass(section, sectDataAppear, 'local'); //section.removeAttribute("data-autoappear");
|
|
317
|
+
}
|
|
318
|
+
} else {
|
|
319
|
+
if (options.autoappear) {
|
|
320
|
+
if (!options.autoelements) {
|
|
321
|
+
return console.log(`Please add some elements in the option "autoelements"`);
|
|
322
|
+
} // This section should get the global autoappear classes on its objects
|
|
219
323
|
|
|
220
|
-
var isStack = function isStack(section) {
|
|
221
|
-
var isStack = false;
|
|
222
324
|
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
isStack = true;
|
|
226
|
-
break;
|
|
325
|
+
assignAutoClass(section, options.autoelements, 'global');
|
|
326
|
+
}
|
|
227
327
|
}
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
return isStack;
|
|
328
|
+
});
|
|
231
329
|
};
|
|
232
330
|
|
|
233
331
|
if (options.compatibility) {
|
|
@@ -235,32 +333,32 @@ var Plugin = function Plugin() {
|
|
|
235
333
|
baseclass = options.compatibilitybaseclass;
|
|
236
334
|
}
|
|
237
335
|
|
|
238
|
-
|
|
239
|
-
allappearances.forEach(
|
|
336
|
+
let allappearances = deck.getRevealElement().querySelectorAll(animatecss);
|
|
337
|
+
allappearances.forEach(appearance => {
|
|
240
338
|
if (!appearance.classList.contains(baseclass)) {
|
|
241
339
|
appearance.classList.add(baseclass);
|
|
242
340
|
}
|
|
243
341
|
});
|
|
244
342
|
autoAdd();
|
|
245
|
-
sections.forEach(
|
|
343
|
+
sections.forEach(section => {
|
|
246
344
|
findAppearancesIn(section, appearanceSelector, fragmentSelector);
|
|
247
345
|
});
|
|
248
|
-
fragments.forEach(
|
|
346
|
+
fragments.forEach(fragment => {
|
|
249
347
|
findAppearancesIn(fragment, appearanceSelector, fragmentSelector);
|
|
250
348
|
});
|
|
251
349
|
|
|
252
|
-
|
|
253
|
-
|
|
350
|
+
const fromTo = function (event) {
|
|
351
|
+
let slides = {};
|
|
254
352
|
slides.from = event.fromSlide ? event.fromSlide : event.previousSlide ? event.previousSlide : null;
|
|
255
353
|
slides.to = event.toSlide ? event.toSlide : event.currentSlide ? event.currentSlide : null;
|
|
256
354
|
return slides;
|
|
257
355
|
};
|
|
258
356
|
|
|
259
|
-
|
|
357
|
+
const showHideSlide = function (event) {
|
|
260
358
|
var _slides$to;
|
|
261
359
|
|
|
262
|
-
|
|
263
|
-
|
|
360
|
+
let etype = event.type;
|
|
361
|
+
let slides = fromTo(event);
|
|
264
362
|
debugLog(etype);
|
|
265
363
|
|
|
266
364
|
if (((_slides$to = slides.to) === null || _slides$to === void 0 ? void 0 : _slides$to.dataset.appearevent) == "auto") {
|
|
@@ -276,7 +374,7 @@ var Plugin = function Plugin() {
|
|
|
276
374
|
}
|
|
277
375
|
|
|
278
376
|
if (slides.to) {
|
|
279
|
-
|
|
377
|
+
let appearevent = slides.to.dataset.appearevent ? slides.to.dataset.appearevent : options.appearevent;
|
|
280
378
|
|
|
281
379
|
if (etype == appearevent || etype == "slidetransitionend" && appearevent == "autoanimate") {
|
|
282
380
|
slides.to.dataset.appearanceCanStart = true;
|
|
@@ -289,10 +387,10 @@ var Plugin = function Plugin() {
|
|
|
289
387
|
delete slides.from.dataset.appearanceCanStart;
|
|
290
388
|
}
|
|
291
389
|
|
|
292
|
-
|
|
390
|
+
let fromFragments = slides.from.querySelectorAll(`.fragment.visible`);
|
|
293
391
|
|
|
294
392
|
if (fromFragments) {
|
|
295
|
-
fromFragments.forEach(
|
|
393
|
+
fromFragments.forEach(fragment => {
|
|
296
394
|
fragment.classList.remove('visible');
|
|
297
395
|
});
|
|
298
396
|
}
|
|
@@ -327,17 +425,15 @@ var Plugin = function Plugin() {
|
|
|
327
425
|
}
|
|
328
426
|
};
|
|
329
427
|
|
|
330
|
-
|
|
331
|
-
eventnames.forEach(
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
});
|
|
335
|
-
});
|
|
428
|
+
const eventnames = ['ready', 'slidechanged', 'slidetransitionend', 'autoanimate', 'overviewhidden'];
|
|
429
|
+
eventnames.forEach(eventname => deck.on(eventname, event => {
|
|
430
|
+
showHideSlide(event);
|
|
431
|
+
}));
|
|
336
432
|
};
|
|
337
433
|
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
434
|
+
const init = function (deck) {
|
|
435
|
+
let es5Filename = "appearance.js";
|
|
436
|
+
let defaultOptions = {
|
|
341
437
|
baseclass: 'animate__animated',
|
|
342
438
|
hideagain: true,
|
|
343
439
|
delay: 300,
|
|
@@ -345,29 +441,30 @@ var Plugin = function Plugin() {
|
|
|
345
441
|
appearevent: 'slidetransitionend',
|
|
346
442
|
autoappear: false,
|
|
347
443
|
autoelements: false,
|
|
444
|
+
appearparents: false,
|
|
348
445
|
csspath: '',
|
|
349
446
|
animatecsspath: {
|
|
350
447
|
link: 'https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css',
|
|
351
|
-
compat: 'https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.
|
|
448
|
+
compat: 'https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.compat.css'
|
|
352
449
|
},
|
|
353
450
|
compatibility: false,
|
|
354
451
|
compatibilitybaseclass: 'animated'
|
|
355
452
|
};
|
|
356
453
|
|
|
357
|
-
|
|
358
|
-
for (
|
|
454
|
+
const defaults = function (options, defaultOptions) {
|
|
455
|
+
for (let i in defaultOptions) {
|
|
359
456
|
if (!options.hasOwnProperty(i)) {
|
|
360
457
|
options[i] = defaultOptions[i];
|
|
361
458
|
}
|
|
362
459
|
}
|
|
363
460
|
};
|
|
364
461
|
|
|
365
|
-
|
|
462
|
+
let options = deck.getConfig().appearance || {};
|
|
366
463
|
defaults(options, defaultOptions);
|
|
367
464
|
|
|
368
465
|
function pluginPath() {
|
|
369
|
-
|
|
370
|
-
|
|
466
|
+
let path;
|
|
467
|
+
let pluginScript = document.querySelector(`script[src$="${es5Filename}"]`);
|
|
371
468
|
|
|
372
469
|
if (pluginScript) {
|
|
373
470
|
path = pluginScript.getAttribute("src").slice(0, -1 * es5Filename.length);
|
|
@@ -378,14 +475,14 @@ var Plugin = function Plugin() {
|
|
|
378
475
|
return path;
|
|
379
476
|
}
|
|
380
477
|
|
|
381
|
-
|
|
382
|
-
|
|
478
|
+
let AppearanceStylePath = options.csspath.appearance ? options.csspath.appearance : `${pluginPath()}appearance.css` || 'plugin/appearance/appearance.css';
|
|
479
|
+
let AnimateCSSPath = !options.compatibility ? options.animatecsspath.link : options.animatecsspath.compat;
|
|
383
480
|
|
|
384
481
|
if (options.debug) {
|
|
385
|
-
console.log(
|
|
386
|
-
console.log(
|
|
387
|
-
console.log(
|
|
388
|
-
console.log(
|
|
482
|
+
console.log(`Plugin path = ${pluginPath()}`);
|
|
483
|
+
console.log(`Compatibility mode: ${options.compatibility}`);
|
|
484
|
+
console.log(`Appearance CSS path = ${AppearanceStylePath}`);
|
|
485
|
+
console.log(`AnimateCSS CSS path = ${AnimateCSSPath}`);
|
|
389
486
|
}
|
|
390
487
|
|
|
391
488
|
loadStyle(AnimateCSSPath, 'stylesheet', function () {
|