reveal.js-appearance 1.0.9 → 1.1.2
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 +62 -0
- package/LICENSE +1 -1
- package/README.md +105 -43
- package/css/demo.css +79 -5
- package/demo.html +97 -56
- package/img/1.jpg +0 -0
- package/img/2.jpg +0 -0
- package/img/3.jpg +0 -0
- package/img/4.jpg +0 -0
- package/img/5.jpg +0 -0
- package/package.json +7 -7
- package/plugin/appearance/appearance.css +172 -343
- package/plugin/appearance/appearance.esm.js +253 -100
- package/plugin/appearance/appearance.js +388 -235
- package/plugin/appearance/plugin-src.js +178 -95
- 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.
|
|
7
|
+
* Version 1.1.2
|
|
8
8
|
*
|
|
9
9
|
* @license
|
|
10
10
|
* MIT licensed
|
|
@@ -16,237 +16,390 @@
|
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
(function (global, factory) {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}(this, (function () { 'use strict';
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
19
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
|
20
|
+
typeof define === 'function' && define.amd ? define(factory) :
|
|
21
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Appearance = factory());
|
|
22
|
+
})(this, (function () { 'use strict';
|
|
23
|
+
|
|
24
|
+
function _slicedToArray(arr, i) {
|
|
25
|
+
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function _arrayWithHoles(arr) {
|
|
29
|
+
if (Array.isArray(arr)) return arr;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function _iterableToArrayLimit(arr, i) {
|
|
33
|
+
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
34
|
+
|
|
35
|
+
if (_i == null) return;
|
|
36
|
+
var _arr = [];
|
|
37
|
+
var _n = true;
|
|
38
|
+
var _d = false;
|
|
39
|
+
|
|
40
|
+
var _s, _e;
|
|
41
|
+
|
|
42
|
+
try {
|
|
43
|
+
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
|
|
44
|
+
_arr.push(_s.value);
|
|
45
|
+
|
|
46
|
+
if (i && _arr.length === i) break;
|
|
47
|
+
}
|
|
48
|
+
} catch (err) {
|
|
49
|
+
_d = true;
|
|
50
|
+
_e = err;
|
|
51
|
+
} finally {
|
|
52
|
+
try {
|
|
53
|
+
if (!_n && _i["return"] != null) _i["return"]();
|
|
54
|
+
} finally {
|
|
55
|
+
if (_d) throw _e;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return _arr;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function _unsupportedIterableToArray(o, minLen) {
|
|
63
|
+
if (!o) return;
|
|
64
|
+
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
65
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
66
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
67
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
68
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function _arrayLikeToArray(arr, len) {
|
|
72
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
73
|
+
|
|
74
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
75
|
+
|
|
76
|
+
return arr2;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function _nonIterableRest() {
|
|
80
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
var Plugin = function Plugin() {
|
|
84
|
+
// Scope support polyfill
|
|
85
|
+
try {
|
|
86
|
+
document.querySelector(":scope *");
|
|
87
|
+
} catch (t) {
|
|
88
|
+
!function (t) {
|
|
89
|
+
var e = /:scope(?![\w-])/gi,
|
|
90
|
+
r = u(t.querySelector);
|
|
91
|
+
|
|
92
|
+
t.querySelector = function (t) {
|
|
93
|
+
return r.apply(this, arguments);
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
var c = u(t.querySelectorAll);
|
|
97
|
+
|
|
98
|
+
if (t.querySelectorAll = function (t) {
|
|
99
|
+
return c.apply(this, arguments);
|
|
100
|
+
}, t.matches) {
|
|
101
|
+
var n = u(t.matches);
|
|
102
|
+
|
|
103
|
+
t.matches = function (t) {
|
|
104
|
+
return n.apply(this, arguments);
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
if (t.closest) {
|
|
109
|
+
var o = u(t.closest);
|
|
110
|
+
|
|
111
|
+
t.closest = function (t) {
|
|
112
|
+
return o.apply(this, arguments);
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
function u(t) {
|
|
117
|
+
return function (r) {
|
|
118
|
+
if (r && e.test(r)) {
|
|
119
|
+
var _c = "q" + Math.floor(9e6 * Math.random()) + 1e6;
|
|
120
|
+
|
|
121
|
+
arguments[0] = r.replace(e, "[" + _c + "]"), this.setAttribute(_c, "");
|
|
122
|
+
|
|
123
|
+
var _n = t.apply(this, arguments);
|
|
124
|
+
|
|
125
|
+
return this.removeAttribute(_c), _n;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
return t.apply(this, arguments);
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
}(Element.prototype);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
var loadStyle = function loadStyle(url, type, callback) {
|
|
135
|
+
var head = document.querySelector('head');
|
|
136
|
+
var style;
|
|
137
|
+
style = document.createElement('link');
|
|
138
|
+
style.rel = 'stylesheet';
|
|
139
|
+
style.href = url;
|
|
140
|
+
|
|
141
|
+
var finish = function finish() {
|
|
142
|
+
if (typeof callback === 'function') {
|
|
143
|
+
callback.call();
|
|
144
|
+
callback = null;
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
style.onload = finish;
|
|
149
|
+
|
|
150
|
+
style.onreadystatechange = function () {
|
|
151
|
+
if (this.readyState === 'loaded') {
|
|
152
|
+
finish();
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
head.appendChild(style);
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
var selectionArray = function selectionArray(container, selectors) {
|
|
160
|
+
var selections = container.querySelectorAll(selectors);
|
|
161
|
+
var selectionarray = Array.prototype.slice.call(selections);
|
|
162
|
+
return selectionarray;
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
var appear = function appear(deck, options) {
|
|
166
|
+
var baseclass = 'animate__animated';
|
|
167
|
+
var appearanceSelector = options.compatibility ? ".".concat(options.compatibilitybaseclass) : ".".concat(baseclass);
|
|
168
|
+
var fragmentSelector = ".fragment";
|
|
169
|
+
var sections = deck.getRevealElement().querySelectorAll(".slides section");
|
|
170
|
+
var fragments = deck.getRevealElement().querySelectorAll(fragmentSelector);
|
|
171
|
+
var animatecss = '[class^="animate__"],[class*=" animate__"]';
|
|
172
|
+
|
|
173
|
+
var debugLog = function debugLog(text) {
|
|
174
|
+
if (options.debug) console.log(text);
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
var findAppearancesIn = function findAppearancesIn(container, includeClass, excludeClass) {
|
|
178
|
+
if (!isStack(container)) {
|
|
179
|
+
var appearances = selectionArray(container, ":scope ".concat(includeClass));
|
|
180
|
+
var excludes = selectionArray(container, ":scope ".concat(excludeClass, " ").concat(includeClass));
|
|
181
|
+
var delay = 0;
|
|
182
|
+
appearances.filter(function (appearance, index) {
|
|
183
|
+
if (!(excludes.indexOf(appearance) > -1)) {
|
|
184
|
+
if (index == 0 && appearance.dataset.delay || index != 0) {
|
|
185
|
+
var elementDelay = appearance.dataset.delay ? parseInt(appearance.dataset.delay) : options.delay;
|
|
186
|
+
delay = delay + elementDelay;
|
|
187
|
+
appearance.style.setProperty('animation-delay', delay + "ms");
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
var autoAdd = function autoAdd() {
|
|
195
|
+
if (options.autoelements) {
|
|
196
|
+
var _loop = function _loop() {
|
|
197
|
+
var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2),
|
|
198
|
+
autoelement = _Object$entries$_i[0],
|
|
199
|
+
autoanimation = _Object$entries$_i[1];
|
|
200
|
+
|
|
201
|
+
if (options.autoappear) {
|
|
202
|
+
debugLog("All \"".concat(autoelement, "\"\" elements will animate with ").concat(autoanimation));
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
var autosection = options.autoappear ? "" : "[data-autoappear] ";
|
|
206
|
+
var autoAppearances = deck.getRevealElement().querySelectorAll(".slides ".concat(autosection).concat(autoelement));
|
|
207
|
+
|
|
208
|
+
if (autoAppearances.length > 0) {
|
|
209
|
+
autoAppearances.forEach(function (autoAppearance) {
|
|
210
|
+
if (!autoAppearance.classList.contains(baseclass)) {
|
|
211
|
+
autoAppearance.classList.add(baseclass);
|
|
212
|
+
autoAppearance.classList.add(autoanimation);
|
|
213
|
+
}
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
};
|
|
217
|
+
|
|
218
|
+
for (var _i = 0, _Object$entries = Object.entries(options.autoelements); _i < _Object$entries.length; _i++) {
|
|
219
|
+
_loop();
|
|
220
|
+
}
|
|
221
|
+
} else if (options.autoappear) {
|
|
222
|
+
console.log("Please set an \"autoelements\" object.");
|
|
223
|
+
}
|
|
224
|
+
};
|
|
225
|
+
|
|
226
|
+
var isStack = function isStack(section) {
|
|
227
|
+
var isStack = false;
|
|
228
|
+
|
|
229
|
+
for (var i = 0; i < section.childNodes.length; i++) {
|
|
230
|
+
if (section.childNodes[i].tagName == "SECTION") {
|
|
231
|
+
isStack = true;
|
|
232
|
+
break;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
return isStack;
|
|
237
|
+
};
|
|
238
|
+
|
|
239
|
+
if (options.compatibility) {
|
|
240
|
+
animatecss = '.backInDown, .backInLeft, .backInRight, .backInUp, .bounceIn, .bounceInDown, .bounceInLeft, .bounceInRight, .bounceInUp, .fadeIn, .fadeInDown, .fadeInDownBig, .fadeInLeft, .fadeInLeftBig, .fadeInRight, .fadeInRightBig, .fadeInUp, .fadeInUpBig, .fadeInTopLeft, .fadeInTopRight, .fadeInBottomLeft, .fadeInBottomRight, .flipInX, .flipInY, .lightSpeedInRight, .lightSpeedInLeft, .rotateIn, .rotateInDownLeft, .rotateInDownRight, .rotateInUpLeft, .rotateInUpRight, .jackInTheBox, .rollIn, .zoomIn, .zoomInDown, .zoomInLeft, .zoomInRight, .zoomInUp, .slideInDown, .slideInLeft, .slideInRight, .slideInUp, .skidLeft, .skidLeftBig, .skidRight, .skidRightBig, .shrinkIn, .shrinkInBlur';
|
|
241
|
+
baseclass = options.compatibilitybaseclass;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
var allappearances = deck.getRevealElement().querySelectorAll(animatecss);
|
|
245
|
+
allappearances.forEach(function (appearance) {
|
|
246
|
+
if (!appearance.classList.contains(baseclass)) {
|
|
247
|
+
appearance.classList.add(baseclass);
|
|
248
|
+
}
|
|
249
|
+
});
|
|
250
|
+
autoAdd();
|
|
251
|
+
sections.forEach(function (section) {
|
|
252
|
+
findAppearancesIn(section, appearanceSelector, fragmentSelector);
|
|
253
|
+
});
|
|
254
|
+
fragments.forEach(function (fragment) {
|
|
255
|
+
findAppearancesIn(fragment, appearanceSelector, fragmentSelector);
|
|
256
|
+
});
|
|
257
|
+
|
|
258
|
+
var fromTo = function fromTo(event) {
|
|
259
|
+
var slides = {};
|
|
260
|
+
slides.from = event.fromSlide ? event.fromSlide : event.previousSlide ? event.previousSlide : null;
|
|
261
|
+
slides.to = event.toSlide ? event.toSlide : event.currentSlide ? event.currentSlide : null;
|
|
262
|
+
return slides;
|
|
263
|
+
};
|
|
264
|
+
|
|
265
|
+
var showHideSlide = function showHideSlide(event) {
|
|
266
|
+
var _slides$to;
|
|
267
|
+
|
|
268
|
+
var etype = event.type;
|
|
269
|
+
var slides = fromTo(event);
|
|
270
|
+
debugLog(etype);
|
|
271
|
+
|
|
272
|
+
if (((_slides$to = slides.to) === null || _slides$to === void 0 ? void 0 : _slides$to.dataset.appearevent) == "auto") {
|
|
273
|
+
slides.to.dataset.appearevent = "autoanimate";
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
if (options.appearevent == "auto") {
|
|
277
|
+
options.appearevent = "autoanimate";
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
if (etype == "ready") {
|
|
281
|
+
slides.to.dataset.appearanceCanStart = true;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
if (slides.to) {
|
|
285
|
+
var appearevent = slides.to.dataset.appearevent ? slides.to.dataset.appearevent : options.appearevent;
|
|
286
|
+
|
|
287
|
+
if (etype == appearevent || etype == "slidetransitionend" && appearevent == "autoanimate") {
|
|
288
|
+
slides.to.dataset.appearanceCanStart = true;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
if (etype == "slidetransitionend") {
|
|
292
|
+
if (options.hideagain) {
|
|
293
|
+
var _slides$from;
|
|
294
|
+
|
|
295
|
+
(_slides$from = slides.from) === null || _slides$from === void 0 ? true : delete _slides$from.dataset.appearanceCanStart;
|
|
296
|
+
var fromFragments = slides.from.querySelectorAll(".fragment.visible");
|
|
297
|
+
fromFragments.forEach(function (fragment) {
|
|
298
|
+
fragment.classList.remove('visible');
|
|
299
|
+
});
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
if (event.type == 'slidechanged' && document.body.dataset.exitoverview) {
|
|
304
|
+
if (options.hideagain) {
|
|
305
|
+
var _slides$from2;
|
|
306
|
+
|
|
307
|
+
(_slides$from2 = slides.from) === null || _slides$from2 === void 0 ? true : delete _slides$from2.dataset.appearanceCanStart;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
slides.to.dataset.appearanceCanStart = true;
|
|
311
|
+
} else if (event.type == 'overviewhidden') {
|
|
312
|
+
document.body.dataset.exitoverview = true;
|
|
313
|
+
setTimeout(function () {
|
|
314
|
+
document.body.removeAttribute('data-exitoverview');
|
|
315
|
+
}, 500);
|
|
316
|
+
|
|
317
|
+
if (event.currentSlide) {
|
|
318
|
+
if (options.hideagain) {
|
|
319
|
+
var _slides$from3;
|
|
320
|
+
|
|
321
|
+
(_slides$from3 = slides.from) === null || _slides$from3 === void 0 ? true : delete _slides$from3.dataset.appearanceCanStart;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
slides.to.dataset.appearanceCanStart = true;
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
};
|
|
329
|
+
|
|
330
|
+
var eventnames = ['ready', 'slidechanged', 'slidetransitionend', 'autoanimate', 'overviewhidden'];
|
|
331
|
+
eventnames.forEach(function (eventname) {
|
|
332
|
+
return deck.on(eventname, function (event) {
|
|
333
|
+
showHideSlide(event);
|
|
334
|
+
});
|
|
335
|
+
});
|
|
336
|
+
};
|
|
337
|
+
|
|
338
|
+
var init = function init(deck) {
|
|
339
|
+
var es5Filename = "appearance.js";
|
|
340
|
+
var defaultOptions = {
|
|
341
|
+
baseclass: 'animate__animated',
|
|
342
|
+
hideagain: true,
|
|
343
|
+
delay: 300,
|
|
344
|
+
debug: false,
|
|
345
|
+
appearevent: 'slidetransitionend',
|
|
346
|
+
autoappear: false,
|
|
347
|
+
autoelements: false,
|
|
348
|
+
csspath: '',
|
|
349
|
+
animatecsspath: {
|
|
350
|
+
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.0.0/animate.compat.css'
|
|
352
|
+
},
|
|
353
|
+
compatibility: false,
|
|
354
|
+
compatibilitybaseclass: 'animated'
|
|
355
|
+
};
|
|
356
|
+
|
|
357
|
+
var defaults = function defaults(options, defaultOptions) {
|
|
358
|
+
for (var i in defaultOptions) {
|
|
359
|
+
if (!options.hasOwnProperty(i)) {
|
|
360
|
+
options[i] = defaultOptions[i];
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
};
|
|
364
|
+
|
|
365
|
+
var options = deck.getConfig().appearance || {};
|
|
366
|
+
defaults(options, defaultOptions);
|
|
367
|
+
|
|
368
|
+
function pluginPath() {
|
|
369
|
+
var path;
|
|
370
|
+
var pluginScript = document.querySelector("script[src$=\"".concat(es5Filename, "\"]"));
|
|
371
|
+
|
|
372
|
+
if (pluginScript) {
|
|
373
|
+
path = pluginScript.getAttribute("src").slice(0, -1 * es5Filename.length);
|
|
374
|
+
} else {
|
|
375
|
+
path = (typeof document === 'undefined' && typeof location === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : typeof document === 'undefined' ? location.href : (document.currentScript && document.currentScript.src || new URL('appearance.js', document.baseURI).href)).slice(0, (typeof document === 'undefined' && typeof location === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : typeof document === 'undefined' ? location.href : (document.currentScript && document.currentScript.src || new URL('appearance.js', document.baseURI).href)).lastIndexOf('/') + 1);
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
return path;
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
var AppearanceStylePath = options.csspath.appearance ? options.csspath.appearance : "".concat(pluginPath(), "appearance.css") || 'plugin/appearance/appearance.css';
|
|
382
|
+
var AnimateCSSPath = !options.compatibility ? options.animatecsspath.link : options.animatecsspath.compat;
|
|
383
|
+
|
|
384
|
+
if (options.debug) {
|
|
385
|
+
console.log("Plugin path = ".concat(pluginPath()));
|
|
386
|
+
console.log("Compatibility mode: ".concat(options.compatibility));
|
|
387
|
+
console.log("Appearance CSS path = ".concat(AppearanceStylePath));
|
|
388
|
+
console.log("AnimateCSS CSS path = ".concat(AnimateCSSPath));
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
loadStyle(AnimateCSSPath, 'stylesheet', function () {
|
|
392
|
+
loadStyle(AppearanceStylePath, 'stylesheet');
|
|
393
|
+
});
|
|
394
|
+
appear(deck, options);
|
|
395
|
+
};
|
|
396
|
+
|
|
397
|
+
return {
|
|
398
|
+
id: 'appearance',
|
|
399
|
+
init: init
|
|
400
|
+
};
|
|
401
|
+
};
|
|
402
|
+
|
|
403
|
+
return Plugin;
|
|
404
|
+
|
|
405
|
+
}));
|