@simhub2/justflipit 3.0.0
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/README.md +305 -0
- package/dist/justFlipIt-modern.js +483 -0
- package/dist/justFlipIt-modern.min.js +1 -0
- package/dist/justFlipIt-vanilla.js +329 -0
- package/dist/justFlipIt-vanilla.min.js +1 -0
- package/dist/justFlipIt.js +377 -0
- package/dist/justFlipIt.min.js +1 -0
- package/dist/types/justFlipIt.d.ts +43 -0
- package/package.json +91 -0
- package/src/justFlipIt-combined.js +377 -0
- package/src/justFlipIt-combined.min.js +1 -0
- package/src/justFlipIt-modern.js +483 -0
- package/src/justFlipIt-modern.min.js +1 -0
- package/src/justFlipIt-vanilla.js +329 -0
- package/src/justFlipIt-vanilla.min.js +1 -0
- package/src/justFlipIt.d.ts +43 -0
|
@@ -0,0 +1,377 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* justFlipIt v3.0.0
|
|
3
|
+
* https://github.com/SimHub/justFlipIt
|
|
4
|
+
*
|
|
5
|
+
* Copyright simon Lackmann
|
|
6
|
+
* Released under the MIT license
|
|
7
|
+
*
|
|
8
|
+
* Date: 2023
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
(function (root, factory) {
|
|
12
|
+
if (typeof define === "function" && define.amd) {
|
|
13
|
+
define(["jquery"], function (jQuery) {
|
|
14
|
+
return factory(jQuery || root.jQuery || root.$);
|
|
15
|
+
});
|
|
16
|
+
} else if (typeof module === "object" && module.exports) {
|
|
17
|
+
var jQuery = typeof window !== "undefined" ? window.jQuery : undefined;
|
|
18
|
+
if (!jQuery) {
|
|
19
|
+
try {
|
|
20
|
+
jQuery = require("jquery");
|
|
21
|
+
} catch (e) {
|
|
22
|
+
jQuery = null;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
module.exports = factory(jQuery);
|
|
26
|
+
} else {
|
|
27
|
+
root.justFlipIt = factory(root.jQuery || root.$);
|
|
28
|
+
}
|
|
29
|
+
})(typeof self !== "undefined" ? self : this, function (jQuery) {
|
|
30
|
+
"use strict";
|
|
31
|
+
|
|
32
|
+
// PATCH: Verbesserte Style-Kopierfunktion
|
|
33
|
+
function copyStyles(src, dest) {
|
|
34
|
+
const computed = window.getComputedStyle(src);
|
|
35
|
+
const properties = [
|
|
36
|
+
"background",
|
|
37
|
+
"backgroundColor",
|
|
38
|
+
"backgroundImage",
|
|
39
|
+
"backgroundPosition",
|
|
40
|
+
"backgroundRepeat",
|
|
41
|
+
"backgroundSize",
|
|
42
|
+
"borderRadius",
|
|
43
|
+
"borderTopLeftRadius",
|
|
44
|
+
"borderTopRightRadius",
|
|
45
|
+
"borderBottomLeftRadius",
|
|
46
|
+
"borderBottomRightRadius",
|
|
47
|
+
"border",
|
|
48
|
+
"borderTop",
|
|
49
|
+
"borderRight",
|
|
50
|
+
"borderBottom",
|
|
51
|
+
"borderLeft",
|
|
52
|
+
"boxShadow",
|
|
53
|
+
"color",
|
|
54
|
+
"opacity",
|
|
55
|
+
];
|
|
56
|
+
properties.forEach(function (prop) {
|
|
57
|
+
if (
|
|
58
|
+
computed[prop] &&
|
|
59
|
+
computed[prop] !== "none" &&
|
|
60
|
+
computed[prop] !== "initial" &&
|
|
61
|
+
computed[prop] !== ""
|
|
62
|
+
) {
|
|
63
|
+
dest.style[prop] = computed[prop];
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// NEU: Funktion zur Anwendung der benutzerdefinierten Animationseinstellungen
|
|
69
|
+
function applyAnimationSettings(element, duration, easing) {
|
|
70
|
+
const transitionValue = `all ${duration / 1000}s ${easing}`;
|
|
71
|
+
element.style.transition = transitionValue;
|
|
72
|
+
element.style.WebkitTransition = transitionValue;
|
|
73
|
+
element.style.MozTransition = transitionValue;
|
|
74
|
+
element.style.msTransition = transitionValue;
|
|
75
|
+
element.style.OTransition = transitionValue;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function addStyles() {
|
|
79
|
+
if (document.querySelector('[data-justflipitstyle="justFlipIt_One"]')) {
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
const styleX = document.createElement("style");
|
|
83
|
+
styleX.setAttribute("data-justflipitstyle", "justFlipIt_One");
|
|
84
|
+
styleX.textContent =
|
|
85
|
+
"._justFlipIt_panel {perspective:1000px;-webkit-perspective:1000px;-moz-perspective:1000px;}" +
|
|
86
|
+
"._justFlipIt_panel .front{height:inherit;width:inherit;position:absolute;top:0;z-index:900;-webkit-transform:rotateX(0) rotateX(0);-moz-transform:rotateX(0) rotateX(0);-webkit-transform-style:preserve-3d;-moz-transform-style:preserve-3d;-webkit-backface-visibility:hidden;-moz-backface-visibility:hidden;-webkit-transition:all .4s ease-in-out;-moz-transition:all .4s ease-in-out;-ms-transition:all .4s ease-in-out;-o-transition:all .4s ease-in-out;transition:all .4s ease-in-out}" +
|
|
87
|
+
"._justFlipIt_panel .back{height:inherit;width:inherit;position:absolute;top:0;z-index:1000;-webkit-transform:rotateX(-180deg);-moz-transform:rotateX(-180deg);-webkit-transform-style:preserve-3d;-moz-transform-style:preserve-3d;-webkit-backface-visibility:hidden;-moz-backface-visibility:hidden;-webkit-transition:all .4s ease-in-out;-moz-transition:all .4s ease-in-out;-ms-transition:all .4s ease-in-out;-o-transition:all .4s ease-in-out;transition:all .4s ease-in-out}" +
|
|
88
|
+
"._justFlipIt_panel._flip_ .front{z-index:900;-webkit-transform:rotateX(180deg);-moz-transform:rotateX(180deg)}" +
|
|
89
|
+
"._justFlipIt_panel._flip_ .back{z-index:1000;-webkit-transform:rotateX(0) rotateX(0);-moz-transform:rotateX(0) rotateX(0)}";
|
|
90
|
+
const styleY = document.createElement("style");
|
|
91
|
+
styleY.setAttribute("data-justflipitstyle", "justFlipIt_Two");
|
|
92
|
+
styleY.textContent =
|
|
93
|
+
"._justFlipIt_panel .backY{height:inherit;width:inherit;position:absolute;top:0;z-index:1000;-webkit-transform:rotateY(-180deg);-moz-transform:rotateY(-180deg);-webkit-transform-style:preserve-3d;-moz-transform-style:preserve-3d;-webkit-backface-visibility:hidden;-moz-backface-visibility:hidden;-webkit-transition:all .4s ease-in-out;-moz-transition:all .4s ease-in-out;-ms-transition:all .4s ease-in-out;-o-transition:all .4s ease-in-out;transition:all .4s ease-in-out}" +
|
|
94
|
+
"._justFlipIt_panel._flipY_ .front{z-index:900;-webkit-transform:rotateY(180deg);-moz-transform:rotateY(180deg)}" +
|
|
95
|
+
"._justFlipIt_panel._flipY_ .backY{z-index:1000;-webkit-transform:rotateX(0) rotateY(0);-moz-transform:rotateX(0) rotateY(0)}";
|
|
96
|
+
const styleTransparent = document.createElement("style");
|
|
97
|
+
styleTransparent.setAttribute(
|
|
98
|
+
"data-justflipitstyle",
|
|
99
|
+
"justFlipIt_Transparent",
|
|
100
|
+
);
|
|
101
|
+
styleTransparent.textContent =
|
|
102
|
+
"._justFlipIt_panel {background: transparent !important; box-shadow: none !important;}" +
|
|
103
|
+
"._justFlipIt_panel > * {box-sizing: border-box;}";
|
|
104
|
+
document.head.appendChild(styleX);
|
|
105
|
+
document.head.appendChild(styleY);
|
|
106
|
+
document.head.appendChild(styleTransparent);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
function getStyle(element, property) {
|
|
110
|
+
return window.getComputedStyle(element, null).getPropertyValue(property);
|
|
111
|
+
}
|
|
112
|
+
function addClass(element, className) {
|
|
113
|
+
if (element.classList) {
|
|
114
|
+
element.classList.add(className);
|
|
115
|
+
} else {
|
|
116
|
+
element.className += " " + className;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
function removeClass(element, className) {
|
|
120
|
+
if (element.classList) {
|
|
121
|
+
element.classList.remove(className);
|
|
122
|
+
} else {
|
|
123
|
+
element.className = element.className.replace(
|
|
124
|
+
new RegExp(
|
|
125
|
+
"(^|\\b)" + className.split(" ").join("|") + "(\\b|$)",
|
|
126
|
+
"gi",
|
|
127
|
+
),
|
|
128
|
+
" ",
|
|
129
|
+
);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
function toggleClass(element, className) {
|
|
133
|
+
if (element.classList) {
|
|
134
|
+
element.classList.toggle(className);
|
|
135
|
+
} else {
|
|
136
|
+
var classes = element.className.split(" ");
|
|
137
|
+
var existingIndex = classes.indexOf(className);
|
|
138
|
+
if (existingIndex >= 0) {
|
|
139
|
+
classes.splice(existingIndex, 1);
|
|
140
|
+
} else {
|
|
141
|
+
classes.push(className);
|
|
142
|
+
}
|
|
143
|
+
element.className = classes.join(" ");
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
function hasClass(element, className) {
|
|
147
|
+
if (element.classList) {
|
|
148
|
+
return element.classList.contains(className);
|
|
149
|
+
} else {
|
|
150
|
+
return new RegExp("(^| )" + className + "( |$)", "gi").test(
|
|
151
|
+
element.className,
|
|
152
|
+
);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
const instanceMap = new WeakMap();
|
|
157
|
+
|
|
158
|
+
class JustFlipIt {
|
|
159
|
+
constructor(element, options = {}) {
|
|
160
|
+
addStyles();
|
|
161
|
+
this.element = element;
|
|
162
|
+
this.settings = Object.assign(
|
|
163
|
+
{},
|
|
164
|
+
{
|
|
165
|
+
Template: "",
|
|
166
|
+
Click: false,
|
|
167
|
+
FlipX: false,
|
|
168
|
+
Style: [],
|
|
169
|
+
// NEU: Standard-Animationsoptionen
|
|
170
|
+
Duration: 400,
|
|
171
|
+
Easing: "ease-in-out",
|
|
172
|
+
},
|
|
173
|
+
options,
|
|
174
|
+
);
|
|
175
|
+
this.elementWidth = getStyle(element, "width");
|
|
176
|
+
this.elementHeight = getStyle(element, "height");
|
|
177
|
+
this.elementBackgroundColor = getStyle(element, "background-color");
|
|
178
|
+
this.originalClassName = element.className;
|
|
179
|
+
this.originalTagName = element.tagName.toLowerCase();
|
|
180
|
+
this.originalId = element.id || "";
|
|
181
|
+
if (this.settings.FlipX === true) {
|
|
182
|
+
this.flipClass = "_flip_";
|
|
183
|
+
this.backClass = "back";
|
|
184
|
+
} else {
|
|
185
|
+
this.flipClass = "_flipY_";
|
|
186
|
+
this.backClass = "backY";
|
|
187
|
+
}
|
|
188
|
+
this._init();
|
|
189
|
+
instanceMap.set(element, this);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
_init() {
|
|
193
|
+
const originalElement = this.element;
|
|
194
|
+
const originalClassName = this.originalClassName;
|
|
195
|
+
const hoverPanel = document.createElement(this.originalTagName);
|
|
196
|
+
addClass(hoverPanel, "hover");
|
|
197
|
+
addClass(hoverPanel, "_justFlipIt_panel");
|
|
198
|
+
const frontWrapper = document.createElement("div");
|
|
199
|
+
addClass(frontWrapper, "front");
|
|
200
|
+
const clone = originalElement.cloneNode(true);
|
|
201
|
+
clone.className = "";
|
|
202
|
+
const backWrapper = document.createElement("div");
|
|
203
|
+
addClass(backWrapper, this.backClass);
|
|
204
|
+
if (originalClassName) {
|
|
205
|
+
originalClassName.split(" ").forEach((cls) => {
|
|
206
|
+
if (cls) addClass(backWrapper, cls);
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
// PATCH: Styles übernehmen und Original komplett transparent machen
|
|
211
|
+
copyStyles(originalElement, frontWrapper);
|
|
212
|
+
copyStyles(originalElement, backWrapper);
|
|
213
|
+
originalElement.style.all = "inherit";
|
|
214
|
+
originalElement.style.background = "transparent";
|
|
215
|
+
originalElement.style.backgroundColor = "transparent";
|
|
216
|
+
originalElement.style.backgroundImage = "none";
|
|
217
|
+
originalElement.style.border = "none";
|
|
218
|
+
originalElement.style.borderRadius = "0";
|
|
219
|
+
originalElement.style.boxShadow = "none";
|
|
220
|
+
originalElement.style.outline = "none";
|
|
221
|
+
|
|
222
|
+
// NEU: Wende benutzerdefinierte Animationseinstellungen an
|
|
223
|
+
applyAnimationSettings(
|
|
224
|
+
frontWrapper,
|
|
225
|
+
this.settings.Duration,
|
|
226
|
+
this.settings.Easing,
|
|
227
|
+
);
|
|
228
|
+
applyAnimationSettings(
|
|
229
|
+
backWrapper,
|
|
230
|
+
this.settings.Duration,
|
|
231
|
+
this.settings.Easing,
|
|
232
|
+
);
|
|
233
|
+
|
|
234
|
+
if (this.settings.Template) {
|
|
235
|
+
backWrapper.innerHTML = this.settings.Template;
|
|
236
|
+
} else {
|
|
237
|
+
backWrapper.appendChild(clone);
|
|
238
|
+
}
|
|
239
|
+
originalElement.parentNode.insertBefore(hoverPanel, originalElement);
|
|
240
|
+
frontWrapper.appendChild(originalElement);
|
|
241
|
+
hoverPanel.appendChild(frontWrapper);
|
|
242
|
+
hoverPanel.appendChild(backWrapper);
|
|
243
|
+
if (originalClassName) {
|
|
244
|
+
originalClassName.split(" ").forEach((cls) => {
|
|
245
|
+
if (cls) addClass(hoverPanel, cls);
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
hoverPanel.style.width = this.elementWidth;
|
|
249
|
+
hoverPanel.style.height = this.elementHeight;
|
|
250
|
+
if (this.settings.Style && this.settings.Style.length) {
|
|
251
|
+
this.settings.Style.forEach((styleObj) => {
|
|
252
|
+
if (styleObj.el) {
|
|
253
|
+
if (styleObj.el.toLowerCase() === "self") {
|
|
254
|
+
Object.assign(hoverPanel.style, styleObj.style);
|
|
255
|
+
} else {
|
|
256
|
+
const targetElements = hoverPanel.querySelectorAll(styleObj.el);
|
|
257
|
+
targetElements.forEach((el) => {
|
|
258
|
+
Object.assign(el.style, styleObj.style);
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
this._setupEvents(hoverPanel);
|
|
265
|
+
this.hoverPanel = hoverPanel;
|
|
266
|
+
this.frontWrapper = frontWrapper;
|
|
267
|
+
this.backWrapper = backWrapper;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
_setupEvents(hoverPanel) {
|
|
271
|
+
if (this.settings.Click === true) {
|
|
272
|
+
hoverPanel.addEventListener("click", (e) => {
|
|
273
|
+
e.preventDefault();
|
|
274
|
+
toggleClass(hoverPanel, this.flipClass);
|
|
275
|
+
});
|
|
276
|
+
} else if (typeof this.settings.Click === "string") {
|
|
277
|
+
const clickElements = hoverPanel.querySelectorAll(this.settings.Click);
|
|
278
|
+
clickElements.forEach((el) => {
|
|
279
|
+
el.addEventListener("click", () => {
|
|
280
|
+
toggleClass(hoverPanel, this.flipClass);
|
|
281
|
+
});
|
|
282
|
+
});
|
|
283
|
+
} else {
|
|
284
|
+
hoverPanel.addEventListener("mouseenter", () => {
|
|
285
|
+
addClass(hoverPanel, this.flipClass);
|
|
286
|
+
});
|
|
287
|
+
hoverPanel.addEventListener("mouseleave", () => {
|
|
288
|
+
removeClass(hoverPanel, this.flipClass);
|
|
289
|
+
});
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
destroy() {
|
|
294
|
+
const hoverPanel = this.hoverPanel;
|
|
295
|
+
const originalElement = hoverPanel.querySelector(".front > *");
|
|
296
|
+
originalElement.className = this.originalClassName;
|
|
297
|
+
hoverPanel.parentNode.insertBefore(originalElement, hoverPanel);
|
|
298
|
+
hoverPanel.parentNode.removeChild(hoverPanel);
|
|
299
|
+
instanceMap.delete(this.element);
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
// Vanilla/JS API
|
|
304
|
+
function justFlipIt(selector, options = {}) {
|
|
305
|
+
if (typeof selector === "string") {
|
|
306
|
+
const elements = document.querySelectorAll(selector);
|
|
307
|
+
return Array.from(elements).map((el) => new JustFlipIt(el, options));
|
|
308
|
+
} else if (selector instanceof Element) {
|
|
309
|
+
return new JustFlipIt(selector, options);
|
|
310
|
+
} else if (selector.length) {
|
|
311
|
+
return Array.from(selector).map((el) => new JustFlipIt(el, options));
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
justFlipIt.destroy = function (selector) {
|
|
316
|
+
if (typeof selector === "string") {
|
|
317
|
+
const elements = document.querySelectorAll(selector);
|
|
318
|
+
Array.from(elements).forEach((el) => {
|
|
319
|
+
const instance = instanceMap.get(el);
|
|
320
|
+
if (instance) instance.destroy();
|
|
321
|
+
});
|
|
322
|
+
} else if (selector instanceof Element) {
|
|
323
|
+
const instance = instanceMap.get(selector);
|
|
324
|
+
if (instance) instance.destroy();
|
|
325
|
+
} else if (selector.length) {
|
|
326
|
+
Array.from(selector).forEach((el) => {
|
|
327
|
+
const instance = instanceMap.get(el);
|
|
328
|
+
if (instance) instance.destroy();
|
|
329
|
+
});
|
|
330
|
+
}
|
|
331
|
+
};
|
|
332
|
+
|
|
333
|
+
// jQuery-Plugin API
|
|
334
|
+
if (jQuery) {
|
|
335
|
+
jQuery.fn.justFlipIt = function (options) {
|
|
336
|
+
return this.each(function () {
|
|
337
|
+
if (!jQuery.data(this, "plugin_justFlipIt")) {
|
|
338
|
+
jQuery.data(this, "plugin_justFlipIt", new JustFlipIt(this, options));
|
|
339
|
+
}
|
|
340
|
+
});
|
|
341
|
+
};
|
|
342
|
+
|
|
343
|
+
jQuery.fn.destroy = function () {
|
|
344
|
+
return this.each(function () {
|
|
345
|
+
const instance = instanceMap.get(this);
|
|
346
|
+
if (instance) {
|
|
347
|
+
instance.destroy();
|
|
348
|
+
jQuery.removeData(this, "plugin_justFlipIt");
|
|
349
|
+
}
|
|
350
|
+
});
|
|
351
|
+
};
|
|
352
|
+
|
|
353
|
+
// jQuery-API als Haupt-Export
|
|
354
|
+
var api = function (selector, options) {
|
|
355
|
+
if (typeof selector === "string") {
|
|
356
|
+
return jQuery(selector).justFlipIt(options);
|
|
357
|
+
} else if (selector instanceof Element) {
|
|
358
|
+
return jQuery(selector).justFlipIt(options);
|
|
359
|
+
} else if (selector instanceof jQuery) {
|
|
360
|
+
return selector.justFlipIt(options);
|
|
361
|
+
}
|
|
362
|
+
};
|
|
363
|
+
api.destroy = function (selector) {
|
|
364
|
+
if (typeof selector === "string") {
|
|
365
|
+
jQuery(selector).destroy();
|
|
366
|
+
} else if (selector instanceof Element) {
|
|
367
|
+
jQuery(selector).destroy();
|
|
368
|
+
} else if (selector instanceof jQuery) {
|
|
369
|
+
selector.destroy();
|
|
370
|
+
}
|
|
371
|
+
};
|
|
372
|
+
return api;
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
// Vanilla-API als Fallback
|
|
376
|
+
return justFlipIt;
|
|
377
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
((e,i)=>{if("function"==typeof define&&define.amd)define(["jquery"],function(t){return i(t||e.jQuery||e.$)});else if("object"==typeof module&&module.exports){var s="undefined"!=typeof window?window.jQuery:void 0;if(!s)try{s=require("jquery")}catch(t){s=null}module.exports=i(s)}else e.justFlipIt=i(e.jQuery||e.$)})("undefined"!=typeof self?self:this,function(i){function o(t,e){let i=window.getComputedStyle(t);["background","backgroundColor","backgroundImage","backgroundPosition","backgroundRepeat","backgroundSize","borderRadius","borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius","border","borderTop","borderRight","borderBottom","borderLeft","boxShadow","color","opacity"].forEach(function(t){i[t]&&"none"!==i[t]&&"initial"!==i[t]&&""!==i[t]&&(e.style[t]=i[t])})}function r(t,e,i){e=`all ${e/1e3}s `+i;t.style.transition=e,t.style.WebkitTransition=e,t.style.MozTransition=e,t.style.msTransition=e,t.style.OTransition=e}function a(t,e){return window.getComputedStyle(t,null).getPropertyValue(e)}function l(t,e){t.classList?t.classList.add(e):t.className+=" "+e}function e(t,e){var i,s;t.classList?t.classList.toggle(e):(0<=(s=(i=t.className.split(" ")).indexOf(e))?i.splice(s,1):i.push(e),t.className=i.join(" "))}let d=new WeakMap;class s{constructor(t,e={}){var i,s,n;document.querySelector('[data-justflipitstyle="justFlipIt_One"]')||((i=document.createElement("style")).setAttribute("data-justflipitstyle","justFlipIt_One"),i.textContent="._justFlipIt_panel {perspective:1000px;-webkit-perspective:1000px;-moz-perspective:1000px;}._justFlipIt_panel .front{height:inherit;width:inherit;position:absolute;top:0;z-index:900;-webkit-transform:rotateX(0) rotateX(0);-moz-transform:rotateX(0) rotateX(0);-webkit-transform-style:preserve-3d;-moz-transform-style:preserve-3d;-webkit-backface-visibility:hidden;-moz-backface-visibility:hidden;-webkit-transition:all .4s ease-in-out;-moz-transition:all .4s ease-in-out;-ms-transition:all .4s ease-in-out;-o-transition:all .4s ease-in-out;transition:all .4s ease-in-out}._justFlipIt_panel .back{height:inherit;width:inherit;position:absolute;top:0;z-index:1000;-webkit-transform:rotateX(-180deg);-moz-transform:rotateX(-180deg);-webkit-transform-style:preserve-3d;-moz-transform-style:preserve-3d;-webkit-backface-visibility:hidden;-moz-backface-visibility:hidden;-webkit-transition:all .4s ease-in-out;-moz-transition:all .4s ease-in-out;-ms-transition:all .4s ease-in-out;-o-transition:all .4s ease-in-out;transition:all .4s ease-in-out}._justFlipIt_panel._flip_ .front{z-index:900;-webkit-transform:rotateX(180deg);-moz-transform:rotateX(180deg)}._justFlipIt_panel._flip_ .back{z-index:1000;-webkit-transform:rotateX(0) rotateX(0);-moz-transform:rotateX(0) rotateX(0)}",(s=document.createElement("style")).setAttribute("data-justflipitstyle","justFlipIt_Two"),s.textContent="._justFlipIt_panel .backY{height:inherit;width:inherit;position:absolute;top:0;z-index:1000;-webkit-transform:rotateY(-180deg);-moz-transform:rotateY(-180deg);-webkit-transform-style:preserve-3d;-moz-transform-style:preserve-3d;-webkit-backface-visibility:hidden;-moz-backface-visibility:hidden;-webkit-transition:all .4s ease-in-out;-moz-transition:all .4s ease-in-out;-ms-transition:all .4s ease-in-out;-o-transition:all .4s ease-in-out;transition:all .4s ease-in-out}._justFlipIt_panel._flipY_ .front{z-index:900;-webkit-transform:rotateY(180deg);-moz-transform:rotateY(180deg)}._justFlipIt_panel._flipY_ .backY{z-index:1000;-webkit-transform:rotateX(0) rotateY(0);-moz-transform:rotateX(0) rotateY(0)}",(n=document.createElement("style")).setAttribute("data-justflipitstyle","justFlipIt_Transparent"),n.textContent="._justFlipIt_panel {background: transparent !important; box-shadow: none !important;}._justFlipIt_panel > * {box-sizing: border-box;}",document.head.appendChild(i),document.head.appendChild(s),document.head.appendChild(n)),this.element=t,this.settings=Object.assign({},{Template:"",Click:!1,FlipX:!1,Style:[],Duration:400,Easing:"ease-in-out"},e),this.elementWidth=a(t,"width"),this.elementHeight=a(t,"height"),this.elementBackgroundColor=a(t,"background-color"),this.originalClassName=t.className,this.originalTagName=t.tagName.toLowerCase(),this.originalId=t.id||"",!0===this.settings.FlipX?(this.flipClass="_flip_",this.backClass="back"):(this.flipClass="_flipY_",this.backClass="backY"),this._init(),d.set(t,this)}_init(){var t=this.element,e=this.originalClassName;let i=document.createElement(this.originalTagName);l(i,"hover"),l(i,"_justFlipIt_panel");var s=document.createElement("div"),n=(l(s,"front"),t.cloneNode(!0));n.className="";let a=document.createElement("div");l(a,this.backClass),e&&e.split(" ").forEach(t=>{t&&l(a,t)}),o(t,s),o(t,a),t.style.all="inherit",t.style.background="transparent",t.style.backgroundColor="transparent",t.style.backgroundImage="none",t.style.border="none",t.style.borderRadius="0",t.style.boxShadow="none",t.style.outline="none",r(s,this.settings.Duration,this.settings.Easing),r(a,this.settings.Duration,this.settings.Easing),this.settings.Template?a.innerHTML=this.settings.Template:a.appendChild(n),t.parentNode.insertBefore(i,t),s.appendChild(t),i.appendChild(s),i.appendChild(a),e&&e.split(" ").forEach(t=>{t&&l(i,t)}),i.style.width=this.elementWidth,i.style.height=this.elementHeight,this.settings.Style&&this.settings.Style.length&&this.settings.Style.forEach(e=>{e.el&&("self"===e.el.toLowerCase()?Object.assign(i.style,e.style):i.querySelectorAll(e.el).forEach(t=>{Object.assign(t.style,e.style)}))}),this._setupEvents(i),this.hoverPanel=i,this.frontWrapper=s,this.backWrapper=a}_setupEvents(i){!0===this.settings.Click?i.addEventListener("click",t=>{t.preventDefault(),e(i,this.flipClass)}):"string"==typeof this.settings.Click?i.querySelectorAll(this.settings.Click).forEach(t=>{t.addEventListener("click",()=>{e(i,this.flipClass)})}):(i.addEventListener("mouseenter",()=>{l(i,this.flipClass)}),i.addEventListener("mouseleave",()=>{var t,e;t=i,e=this.flipClass,t.classList?t.classList.remove(e):t.className=t.className.replace(new RegExp("(^|\\b)"+e.split(" ").join("|")+"(\\b|$)","gi")," ")}))}destroy(){var t=this.hoverPanel,e=t.querySelector(".front > *");e.className=this.originalClassName,t.parentNode.insertBefore(e,t),t.parentNode.removeChild(t),d.delete(this.element)}}function t(t,e={}){var i;return"string"==typeof t?(i=document.querySelectorAll(t),Array.from(i).map(t=>new s(t,e))):t instanceof Element?new s(t,e):t.length?Array.from(t).map(t=>new s(t,e)):void 0}var n;return t.destroy=function(t){var e;"string"==typeof t?(e=document.querySelectorAll(t),Array.from(e).forEach(t=>{t=d.get(t);t&&t.destroy()})):t instanceof Element?(e=d.get(t))&&e.destroy():t.length&&Array.from(t).forEach(t=>{t=d.get(t);t&&t.destroy()})},i?(i.fn.justFlipIt=function(t){return this.each(function(){i.data(this,"plugin_justFlipIt")||i.data(this,"plugin_justFlipIt",new s(this,t))})},i.fn.destroy=function(){return this.each(function(){var t=d.get(this);t&&(t.destroy(),i.removeData(this,"plugin_justFlipIt"))})},(n=function(t,e){return"string"==typeof t||t instanceof Element?i(t).justFlipIt(e):t instanceof i?t.justFlipIt(e):void 0}).destroy=function(t){"string"==typeof t||t instanceof Element?i(t).destroy():t instanceof i&&t.destroy()},n):t});
|