fomantic-ui-sass 2.9.0 → 2.9.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/fonts/semantic-ui/Lato-Bold.woff +0 -0
- data/app/assets/fonts/semantic-ui/Lato-Bold.woff2 +0 -0
- data/app/assets/fonts/semantic-ui/Lato-BoldItalic.woff +0 -0
- data/app/assets/fonts/semantic-ui/Lato-BoldItalic.woff2 +0 -0
- data/app/assets/fonts/semantic-ui/Lato-Italic.woff +0 -0
- data/app/assets/fonts/semantic-ui/Lato-Italic.woff2 +0 -0
- data/app/assets/fonts/semantic-ui/Lato-Regular.woff +0 -0
- data/app/assets/fonts/semantic-ui/Lato-Regular.woff2 +0 -0
- data/app/assets/fonts/semantic-ui/LatoLatin-Bold.woff +0 -0
- data/app/assets/fonts/semantic-ui/LatoLatin-Bold.woff2 +0 -0
- data/app/assets/fonts/semantic-ui/LatoLatin-BoldItalic.woff +0 -0
- data/app/assets/fonts/semantic-ui/LatoLatin-BoldItalic.woff2 +0 -0
- data/app/assets/fonts/semantic-ui/LatoLatin-Italic.woff +0 -0
- data/app/assets/fonts/semantic-ui/LatoLatin-Italic.woff2 +0 -0
- data/app/assets/fonts/semantic-ui/LatoLatin-Regular.woff +0 -0
- data/app/assets/fonts/semantic-ui/LatoLatin-Regular.woff2 +0 -0
- data/app/assets/fonts/semantic-ui/brand-icons.woff +0 -0
- data/app/assets/fonts/semantic-ui/brand-icons.woff2 +0 -0
- data/app/assets/fonts/semantic-ui/icons.woff +0 -0
- data/app/assets/fonts/semantic-ui/icons.woff2 +0 -0
- data/app/assets/fonts/semantic-ui/outline-icons.woff +0 -0
- data/app/assets/fonts/semantic-ui/outline-icons.woff2 +0 -0
- data/app/assets/javascripts/semantic-ui/accordion.js +569 -596
- data/app/assets/javascripts/semantic-ui/api.js +1158 -1180
- data/app/assets/javascripts/semantic-ui/calendar.js +1935 -1810
- data/app/assets/javascripts/semantic-ui/checkbox.js +843 -842
- data/app/assets/javascripts/semantic-ui/dimmer.js +707 -738
- data/app/assets/javascripts/semantic-ui/dropdown.js +4196 -4237
- data/app/assets/javascripts/semantic-ui/embed.js +646 -676
- data/app/assets/javascripts/semantic-ui/flyout.js +1515 -1466
- data/app/assets/javascripts/semantic-ui/form.js +2023 -2005
- data/app/assets/javascripts/semantic-ui/modal.js +1545 -1487
- data/app/assets/javascripts/semantic-ui/nag.js +521 -527
- data/app/assets/javascripts/semantic-ui/popup.js +1457 -1457
- data/app/assets/javascripts/semantic-ui/progress.js +970 -998
- data/app/assets/javascripts/semantic-ui/rating.js +508 -524
- data/app/assets/javascripts/semantic-ui/search.js +1521 -1535
- data/app/assets/javascripts/semantic-ui/shape.js +784 -811
- data/app/assets/javascripts/semantic-ui/sidebar.js +1062 -1100
- data/app/assets/javascripts/semantic-ui/site.js +437 -477
- data/app/assets/javascripts/semantic-ui/slider.js +1311 -1312
- data/app/assets/javascripts/semantic-ui/state.js +639 -658
- data/app/assets/javascripts/semantic-ui/sticky.js +848 -902
- data/app/assets/javascripts/semantic-ui/tab.js +903 -967
- data/app/assets/javascripts/semantic-ui/toast.js +911 -885
- data/app/assets/javascripts/semantic-ui/transition.js +1049 -1078
- data/app/assets/javascripts/semantic-ui/visibility.js +1214 -1246
- data/app/assets/stylesheets/semantic-ui/collections/_breadcrumb.scss +7 -7
- data/app/assets/stylesheets/semantic-ui/collections/_form.scss +246 -341
- data/app/assets/stylesheets/semantic-ui/collections/_grid.scss +185 -331
- data/app/assets/stylesheets/semantic-ui/collections/_menu.scss +272 -433
- data/app/assets/stylesheets/semantic-ui/collections/_message.scss +127 -199
- data/app/assets/stylesheets/semantic-ui/collections/_table.scss +549 -776
- data/app/assets/stylesheets/semantic-ui/elements/_button.scss +711 -1123
- data/app/assets/stylesheets/semantic-ui/elements/_container.scss +9 -8
- data/app/assets/stylesheets/semantic-ui/elements/_divider.scss +45 -63
- data/app/assets/stylesheets/semantic-ui/elements/_emoji.scss +3556 -3556
- data/app/assets/stylesheets/semantic-ui/elements/_flag.scss +272 -270
- data/app/assets/stylesheets/semantic-ui/elements/_header.scss +120 -144
- data/app/assets/stylesheets/semantic-ui/elements/_icon.scss +667 -747
- data/app/assets/stylesheets/semantic-ui/elements/_image.scss +41 -65
- data/app/assets/stylesheets/semantic-ui/elements/_input.scss +358 -276
- data/app/assets/stylesheets/semantic-ui/elements/_label.scss +361 -412
- data/app/assets/stylesheets/semantic-ui/elements/_list.scss +51 -72
- data/app/assets/stylesheets/semantic-ui/elements/_loader.scss +69 -157
- data/app/assets/stylesheets/semantic-ui/elements/_placeholder.scss +24 -44
- data/app/assets/stylesheets/semantic-ui/elements/_rail.scss +17 -22
- data/app/assets/stylesheets/semantic-ui/elements/_reveal.scss +46 -85
- data/app/assets/stylesheets/semantic-ui/elements/_segment.scss +150 -226
- data/app/assets/stylesheets/semantic-ui/elements/_step.scss +79 -152
- data/app/assets/stylesheets/semantic-ui/elements/_text.scss +33 -33
- data/app/assets/stylesheets/semantic-ui/globals/_reset.scss +10 -15
- data/app/assets/stylesheets/semantic-ui/globals/_site.scss +30 -43
- data/app/assets/stylesheets/semantic-ui/modules/_accordion.scss +37 -55
- data/app/assets/stylesheets/semantic-ui/modules/_calendar.scss +26 -29
- data/app/assets/stylesheets/semantic-ui/modules/_checkbox.scss +122 -193
- data/app/assets/stylesheets/semantic-ui/modules/_dimmer.scss +55 -174
- data/app/assets/stylesheets/semantic-ui/modules/_dropdown.scss +254 -388
- data/app/assets/stylesheets/semantic-ui/modules/_embed.scss +20 -31
- data/app/assets/stylesheets/semantic-ui/modules/_flyout.scss +97 -143
- data/app/assets/stylesheets/semantic-ui/modules/_modal.scss +122 -156
- data/app/assets/stylesheets/semantic-ui/modules/_nag.scss +55 -65
- data/app/assets/stylesheets/semantic-ui/modules/_popup.scss +426 -204
- data/app/assets/stylesheets/semantic-ui/modules/_progress.scss +108 -213
- data/app/assets/stylesheets/semantic-ui/modules/_rating.scss +83 -124
- data/app/assets/stylesheets/semantic-ui/modules/_search.scss +71 -100
- data/app/assets/stylesheets/semantic-ui/modules/_shape.scss +16 -32
- data/app/assets/stylesheets/semantic-ui/modules/_sidebar.scss +105 -208
- data/app/assets/stylesheets/semantic-ui/modules/_slider.scss +93 -121
- data/app/assets/stylesheets/semantic-ui/modules/_sticky.scss +3 -7
- data/app/assets/stylesheets/semantic-ui/modules/_tab.scss +12 -16
- data/app/assets/stylesheets/semantic-ui/modules/_toast.scss +71 -149
- data/app/assets/stylesheets/semantic-ui/modules/_transition.scss +371 -1282
- data/app/assets/stylesheets/semantic-ui/views/_ad.scss +36 -47
- data/app/assets/stylesheets/semantic-ui/views/_card.scss +221 -367
- data/app/assets/stylesheets/semantic-ui/views/_comment.scss +43 -61
- data/app/assets/stylesheets/semantic-ui/views/_feed.scss +37 -59
- data/app/assets/stylesheets/semantic-ui/views/_item.scss +86 -133
- data/app/assets/stylesheets/semantic-ui/views/_statistic.scss +77 -118
- data/lib/fomantic/ui/sass/version.rb +2 -2
- data/tasks/converter.rb +1 -1
- metadata +17 -1
@@ -1,848 +1,821 @@
|
|
1
1
|
/*!
|
2
2
|
* # Fomantic-UI - Shape
|
3
|
-
*
|
3
|
+
* https://github.com/fomantic/Fomantic-UI/
|
4
4
|
*
|
5
5
|
*
|
6
6
|
* Released under the MIT license
|
7
|
-
*
|
7
|
+
* https://opensource.org/licenses/MIT
|
8
8
|
*
|
9
9
|
*/
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
'use strict';
|
14
|
-
|
15
|
-
$.isFunction = $.isFunction || function(obj) {
|
16
|
-
return typeof obj === "function" && typeof obj.nodeType !== "number";
|
17
|
-
};
|
18
|
-
|
19
|
-
window = (typeof window != 'undefined' && window.Math == Math)
|
20
|
-
? window
|
21
|
-
: (typeof self != 'undefined' && self.Math == Math)
|
22
|
-
? self
|
23
|
-
: Function('return this')()
|
24
|
-
;
|
25
|
-
|
26
|
-
$.fn.shape = function(parameters) {
|
27
|
-
var
|
28
|
-
$allModules = $(this),
|
29
|
-
|
30
|
-
time = new Date().getTime(),
|
31
|
-
performance = [],
|
32
|
-
|
33
|
-
query = arguments[0],
|
34
|
-
methodInvoked = (typeof query == 'string'),
|
35
|
-
queryArguments = [].slice.call(arguments, 1),
|
36
|
-
|
37
|
-
requestAnimationFrame = window.requestAnimationFrame
|
38
|
-
|| window.mozRequestAnimationFrame
|
39
|
-
|| window.webkitRequestAnimationFrame
|
40
|
-
|| window.msRequestAnimationFrame
|
41
|
-
|| function(callback) { setTimeout(callback, 0); },
|
42
|
-
|
43
|
-
returnedValue
|
44
|
-
;
|
45
|
-
|
46
|
-
$allModules
|
47
|
-
.each(function() {
|
48
|
-
var
|
49
|
-
moduleSelector = $allModules.selector || '',
|
50
|
-
settings = ( $.isPlainObject(parameters) )
|
51
|
-
? $.extend(true, {}, $.fn.shape.settings, parameters)
|
52
|
-
: $.extend({}, $.fn.shape.settings),
|
53
|
-
|
54
|
-
// internal aliases
|
55
|
-
namespace = settings.namespace,
|
56
|
-
selector = settings.selector,
|
57
|
-
error = settings.error,
|
58
|
-
className = settings.className,
|
59
|
-
|
60
|
-
// define namespaces for modules
|
61
|
-
eventNamespace = '.' + namespace,
|
62
|
-
moduleNamespace = 'module-' + namespace,
|
63
|
-
|
64
|
-
// selector cache
|
65
|
-
$module = $(this),
|
66
|
-
$sides = $module.find('>' + selector.sides),
|
67
|
-
$side = $sides.find('>' + selector.side),
|
68
|
-
|
69
|
-
// private variables
|
70
|
-
nextIndex = false,
|
71
|
-
$activeSide,
|
72
|
-
$nextSide,
|
73
|
-
|
74
|
-
// standard module
|
75
|
-
element = this,
|
76
|
-
instance = $module.data(moduleNamespace),
|
77
|
-
module
|
78
|
-
;
|
79
|
-
|
80
|
-
module = {
|
81
|
-
|
82
|
-
initialize: function() {
|
83
|
-
module.verbose('Initializing module for', element);
|
84
|
-
module.set.defaultSide();
|
85
|
-
module.instantiate();
|
86
|
-
},
|
11
|
+
(function ($, window, document) {
|
12
|
+
'use strict';
|
87
13
|
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
$module
|
92
|
-
.data(moduleNamespace, instance)
|
93
|
-
;
|
94
|
-
},
|
14
|
+
function isFunction(obj) {
|
15
|
+
return typeof obj === 'function' && typeof obj.nodeType !== 'number';
|
16
|
+
}
|
95
17
|
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
.removeData(moduleNamespace)
|
100
|
-
.off(eventNamespace)
|
101
|
-
;
|
102
|
-
},
|
18
|
+
window = window !== undefined && window.Math === Math
|
19
|
+
? window
|
20
|
+
: globalThis;
|
103
21
|
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
$sides = $(this).find(selector.sides);
|
108
|
-
$side = $(this).find(selector.side);
|
109
|
-
},
|
22
|
+
$.fn.shape = function (parameters) {
|
23
|
+
var
|
24
|
+
$allModules = $(this),
|
110
25
|
|
111
|
-
|
112
|
-
|
113
|
-
var
|
114
|
-
shape = $sides[0] || document.createElement('div'),
|
115
|
-
fakeAssignment = shape.offsetWidth
|
116
|
-
;
|
117
|
-
},
|
26
|
+
time = Date.now(),
|
27
|
+
performance = [],
|
118
28
|
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
module.verbose('Executing animation callback');
|
123
|
-
if(event !== undefined) {
|
124
|
-
event.stopPropagation();
|
125
|
-
}
|
126
|
-
module.reset();
|
127
|
-
module.set.active();
|
128
|
-
};
|
129
|
-
settings.onBeforeChange.call($nextSide[0]);
|
130
|
-
if(module.get.transitionEvent()) {
|
131
|
-
module.verbose('Starting CSS animation');
|
132
|
-
$module
|
133
|
-
.addClass(className.animating)
|
134
|
-
;
|
135
|
-
$sides
|
136
|
-
.css(propertyObject)
|
137
|
-
.one(module.get.transitionEvent(), callback)
|
138
|
-
;
|
139
|
-
module.set.duration(settings.duration);
|
140
|
-
requestAnimationFrame(function() {
|
141
|
-
$module
|
142
|
-
.addClass(className.animating)
|
143
|
-
;
|
144
|
-
$activeSide
|
145
|
-
.addClass(className.hidden)
|
146
|
-
;
|
147
|
-
});
|
148
|
-
}
|
149
|
-
else {
|
150
|
-
callback();
|
151
|
-
}
|
152
|
-
},
|
153
|
-
|
154
|
-
queue: function(method) {
|
155
|
-
module.debug('Queueing animation of', method);
|
156
|
-
$sides
|
157
|
-
.one(module.get.transitionEvent(), function() {
|
158
|
-
module.debug('Executing queued animation');
|
159
|
-
setTimeout(function(){
|
160
|
-
$module.shape(method);
|
161
|
-
}, 0);
|
162
|
-
})
|
163
|
-
;
|
164
|
-
},
|
29
|
+
query = arguments[0],
|
30
|
+
methodInvoked = typeof query === 'string',
|
31
|
+
queryArguments = [].slice.call(arguments, 1),
|
165
32
|
|
166
|
-
|
167
|
-
|
168
|
-
$module
|
169
|
-
.removeClass(className.animating)
|
170
|
-
.attr('style', '')
|
171
|
-
.removeAttr('style')
|
172
|
-
;
|
173
|
-
// removeAttr style does not consistently work in safari
|
174
|
-
$sides
|
175
|
-
.attr('style', '')
|
176
|
-
.removeAttr('style')
|
177
|
-
;
|
178
|
-
$side
|
179
|
-
.attr('style', '')
|
180
|
-
.removeAttr('style')
|
181
|
-
.removeClass(className.hidden)
|
182
|
-
;
|
183
|
-
$nextSide
|
184
|
-
.removeClass(className.animating)
|
185
|
-
.attr('style', '')
|
186
|
-
.removeAttr('style')
|
187
|
-
;
|
188
|
-
},
|
33
|
+
returnedValue
|
34
|
+
;
|
189
35
|
|
190
|
-
|
191
|
-
complete: function() {
|
192
|
-
return ($side.filter('.' + className.active)[0] == $nextSide[0]);
|
193
|
-
},
|
194
|
-
animating: function() {
|
195
|
-
return $module.hasClass(className.animating);
|
196
|
-
},
|
197
|
-
hidden: function() {
|
198
|
-
return $module.closest(':hidden').length > 0;
|
199
|
-
}
|
200
|
-
},
|
201
|
-
|
202
|
-
set: {
|
203
|
-
|
204
|
-
defaultSide: function() {
|
205
|
-
$activeSide = $side.filter('.' + settings.className.active);
|
206
|
-
$nextSide = ( $activeSide.next(selector.side).length > 0 )
|
207
|
-
? $activeSide.next(selector.side)
|
208
|
-
: $side.first()
|
209
|
-
;
|
210
|
-
nextIndex = false;
|
211
|
-
module.verbose('Active side set to', $activeSide);
|
212
|
-
module.verbose('Next side set to', $nextSide);
|
213
|
-
},
|
214
|
-
|
215
|
-
duration: function(duration) {
|
216
|
-
duration = duration || settings.duration;
|
217
|
-
duration = (typeof duration == 'number')
|
218
|
-
? duration + 'ms'
|
219
|
-
: duration
|
220
|
-
;
|
221
|
-
module.verbose('Setting animation duration', duration);
|
222
|
-
if(settings.duration || settings.duration === 0) {
|
223
|
-
$sides.add($side)
|
224
|
-
.css({
|
225
|
-
'-webkit-transition-duration': duration,
|
226
|
-
'-moz-transition-duration': duration,
|
227
|
-
'-ms-transition-duration': duration,
|
228
|
-
'-o-transition-duration': duration,
|
229
|
-
'transition-duration': duration
|
230
|
-
})
|
231
|
-
;
|
232
|
-
}
|
233
|
-
},
|
234
|
-
|
235
|
-
currentStageSize: function() {
|
36
|
+
$allModules.each(function () {
|
236
37
|
var
|
237
|
-
|
238
|
-
|
239
|
-
|
38
|
+
moduleSelector = $allModules.selector || '',
|
39
|
+
settings = $.isPlainObject(parameters)
|
40
|
+
? $.extend(true, {}, $.fn.shape.settings, parameters)
|
41
|
+
: $.extend({}, $.fn.shape.settings),
|
42
|
+
|
43
|
+
// internal aliases
|
44
|
+
namespace = settings.namespace,
|
45
|
+
selector = settings.selector,
|
46
|
+
error = settings.error,
|
47
|
+
className = settings.className,
|
48
|
+
|
49
|
+
// define namespaces for modules
|
50
|
+
eventNamespace = '.' + namespace,
|
51
|
+
moduleNamespace = 'module-' + namespace,
|
52
|
+
|
53
|
+
// selector cache
|
54
|
+
$module = $(this),
|
55
|
+
$sides = $module.find('>' + selector.sides),
|
56
|
+
$side = $sides.find('>' + selector.side),
|
57
|
+
|
58
|
+
// private variables
|
59
|
+
nextIndex = false,
|
60
|
+
$activeSide,
|
61
|
+
$nextSide,
|
62
|
+
|
63
|
+
// standard module
|
64
|
+
element = this,
|
65
|
+
instance = $module.data(moduleNamespace),
|
66
|
+
module
|
240
67
|
;
|
241
|
-
$module
|
242
|
-
.css({
|
243
|
-
width: width,
|
244
|
-
height: height
|
245
|
-
})
|
246
|
-
;
|
247
|
-
},
|
248
68
|
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
69
|
+
module = {
|
70
|
+
|
71
|
+
initialize: function () {
|
72
|
+
module.verbose('Initializing module for', element);
|
73
|
+
module.set.defaultSide();
|
74
|
+
module.instantiate();
|
75
|
+
},
|
76
|
+
|
77
|
+
instantiate: function () {
|
78
|
+
module.verbose('Storing instance of module', module);
|
79
|
+
instance = module;
|
80
|
+
$module
|
81
|
+
.data(moduleNamespace, instance)
|
82
|
+
;
|
83
|
+
},
|
84
|
+
|
85
|
+
destroy: function () {
|
86
|
+
module.verbose('Destroying previous module for', element);
|
87
|
+
$module
|
88
|
+
.removeData(moduleNamespace)
|
89
|
+
.off(eventNamespace)
|
90
|
+
;
|
91
|
+
},
|
92
|
+
|
93
|
+
refresh: function () {
|
94
|
+
module.verbose('Refreshing selector cache for', element);
|
95
|
+
$module = $(element);
|
96
|
+
$sides = $(this).find(selector.sides);
|
97
|
+
$side = $(this).find(selector.side);
|
98
|
+
},
|
99
|
+
|
100
|
+
repaint: function () {
|
101
|
+
module.verbose('Forcing repaint event');
|
102
|
+
var
|
103
|
+
shape = $sides[0] || document.createElement('div'),
|
104
|
+
fakeAssignment = shape.offsetWidth
|
105
|
+
;
|
106
|
+
},
|
107
|
+
|
108
|
+
animate: function (propertyObject, callback) {
|
109
|
+
module.verbose('Animating box with properties', propertyObject);
|
110
|
+
callback = callback || function (event) {
|
111
|
+
module.verbose('Executing animation callback');
|
112
|
+
if (event !== undefined) {
|
113
|
+
event.stopPropagation();
|
114
|
+
}
|
115
|
+
module.reset();
|
116
|
+
module.set.active();
|
117
|
+
};
|
118
|
+
settings.onBeforeChange.call($nextSide[0]);
|
119
|
+
if (module.get.transitionEvent()) {
|
120
|
+
module.verbose('Starting CSS animation');
|
121
|
+
$module
|
122
|
+
.addClass(className.animating)
|
123
|
+
;
|
124
|
+
$sides
|
125
|
+
.css(propertyObject)
|
126
|
+
.one(module.get.transitionEvent(), callback)
|
127
|
+
;
|
128
|
+
module.set.duration(settings.duration);
|
129
|
+
requestAnimationFrame(function () {
|
130
|
+
$module
|
131
|
+
.addClass(className.animating)
|
132
|
+
;
|
133
|
+
$activeSide
|
134
|
+
.addClass(className.hidden)
|
135
|
+
;
|
136
|
+
});
|
137
|
+
} else {
|
138
|
+
callback();
|
139
|
+
}
|
140
|
+
},
|
141
|
+
|
142
|
+
queue: function (method) {
|
143
|
+
module.debug('Queueing animation of', method);
|
144
|
+
$sides
|
145
|
+
.one(module.get.transitionEvent(), function () {
|
146
|
+
module.debug('Executing queued animation');
|
147
|
+
setTimeout(function () {
|
148
|
+
$module.shape(method);
|
149
|
+
}, 0);
|
150
|
+
})
|
151
|
+
;
|
152
|
+
},
|
153
|
+
|
154
|
+
reset: function () {
|
155
|
+
module.verbose('Animating states reset');
|
156
|
+
$module
|
157
|
+
.removeClass(className.animating)
|
158
|
+
.attr('style', '')
|
159
|
+
.removeAttr('style')
|
160
|
+
;
|
161
|
+
// removeAttr style does not consistently work in safari
|
162
|
+
$sides
|
163
|
+
.attr('style', '')
|
164
|
+
.removeAttr('style')
|
165
|
+
;
|
166
|
+
$side
|
167
|
+
.attr('style', '')
|
168
|
+
.removeAttr('style')
|
169
|
+
.removeClass(className.hidden)
|
170
|
+
;
|
171
|
+
$nextSide
|
172
|
+
.removeClass(className.animating)
|
173
|
+
.attr('style', '')
|
174
|
+
.removeAttr('style')
|
175
|
+
;
|
176
|
+
},
|
177
|
+
|
178
|
+
is: {
|
179
|
+
complete: function () {
|
180
|
+
return $side.filter('.' + className.active)[0] === $nextSide[0];
|
181
|
+
},
|
182
|
+
animating: function () {
|
183
|
+
return $module.hasClass(className.animating);
|
184
|
+
},
|
185
|
+
hidden: function () {
|
186
|
+
return $module.closest(':hidden').length > 0;
|
187
|
+
},
|
188
|
+
},
|
189
|
+
|
190
|
+
set: {
|
191
|
+
|
192
|
+
defaultSide: function () {
|
193
|
+
$activeSide = $side.filter('.' + settings.className.active);
|
194
|
+
$nextSide = $activeSide.next(selector.side).length > 0
|
195
|
+
? $activeSide.next(selector.side)
|
196
|
+
: $side.first();
|
197
|
+
nextIndex = false;
|
198
|
+
module.verbose('Active side set to', $activeSide);
|
199
|
+
module.verbose('Next side set to', $nextSide);
|
200
|
+
},
|
201
|
+
|
202
|
+
duration: function (duration) {
|
203
|
+
duration = duration || settings.duration;
|
204
|
+
duration = typeof duration === 'number'
|
205
|
+
? duration + 'ms'
|
206
|
+
: duration;
|
207
|
+
module.verbose('Setting animation duration', duration);
|
208
|
+
if (settings.duration || settings.duration === 0) {
|
209
|
+
$sides.add($side)
|
210
|
+
.css({
|
211
|
+
'transition-duration': duration,
|
212
|
+
})
|
213
|
+
;
|
214
|
+
}
|
215
|
+
},
|
216
|
+
|
217
|
+
currentStageSize: function () {
|
218
|
+
var
|
219
|
+
$activeSide = $side.filter('.' + settings.className.active),
|
220
|
+
width = $activeSide.outerWidth(true),
|
221
|
+
height = $activeSide.outerHeight(true)
|
222
|
+
;
|
223
|
+
$module
|
224
|
+
.css({
|
225
|
+
width: width,
|
226
|
+
height: height,
|
227
|
+
})
|
228
|
+
;
|
229
|
+
},
|
230
|
+
|
231
|
+
stageSize: function () {
|
232
|
+
var
|
233
|
+
$clone = $module.clone().addClass(className.loading),
|
234
|
+
$side = $clone.find('>' + selector.sides + '>' + selector.side),
|
235
|
+
$activeSide = $side.filter('.' + settings.className.active),
|
236
|
+
$nextSide = nextIndex
|
237
|
+
? $side.eq(nextIndex)
|
238
|
+
: ($activeSide.next(selector.side).length > 0
|
239
|
+
? $activeSide.next(selector.side)
|
240
|
+
: $side.first()),
|
241
|
+
newWidth = settings.width === 'next'
|
242
|
+
? $nextSide.outerWidth(true)
|
243
|
+
: (settings.width === 'initial'
|
244
|
+
? $module.width()
|
245
|
+
: settings.width),
|
246
|
+
newHeight = settings.height === 'next'
|
247
|
+
? $nextSide.outerHeight(true)
|
248
|
+
: (settings.height === 'initial'
|
249
|
+
? $module.height()
|
250
|
+
: settings.height)
|
251
|
+
;
|
252
|
+
$activeSide.removeClass(className.active);
|
253
|
+
$nextSide.addClass(className.active);
|
254
|
+
$clone.insertAfter($module);
|
255
|
+
$clone.remove();
|
256
|
+
if (settings.width !== 'auto') {
|
257
|
+
$module.css('width', newWidth + settings.jitter);
|
258
|
+
module.verbose('Specifying width during animation', newWidth);
|
259
|
+
}
|
260
|
+
if (settings.height !== 'auto') {
|
261
|
+
$module.css('height', newHeight + settings.jitter);
|
262
|
+
module.verbose('Specifying height during animation', newHeight);
|
263
|
+
}
|
264
|
+
},
|
265
|
+
|
266
|
+
nextSide: function (selector) {
|
267
|
+
nextIndex = selector;
|
268
|
+
$nextSide = $side.filter(selector);
|
269
|
+
nextIndex = $side.index($nextSide);
|
270
|
+
if ($nextSide.length === 0) {
|
271
|
+
module.set.defaultSide();
|
272
|
+
module.error(error.side);
|
273
|
+
}
|
274
|
+
module.verbose('Next side manually set to', $nextSide);
|
275
|
+
},
|
276
|
+
|
277
|
+
active: function () {
|
278
|
+
module.verbose('Setting new side to active', $nextSide);
|
279
|
+
$side
|
280
|
+
.removeClass(className.active)
|
281
|
+
;
|
282
|
+
$nextSide
|
283
|
+
.addClass(className.active)
|
284
|
+
;
|
285
|
+
settings.onChange.call($nextSide[0]);
|
286
|
+
module.set.defaultSide();
|
287
|
+
},
|
288
|
+
},
|
289
|
+
|
290
|
+
flip: {
|
291
|
+
to: function (type, stage) {
|
292
|
+
if (module.is.hidden()) {
|
293
|
+
module.debug('Module not visible', $nextSide);
|
294
|
+
|
295
|
+
return;
|
296
|
+
}
|
297
|
+
if (module.is.complete() && !module.is.animating() && !settings.allowRepeats) {
|
298
|
+
module.debug('Side already visible', $nextSide);
|
299
|
+
|
300
|
+
return;
|
301
|
+
}
|
302
|
+
var
|
303
|
+
transform = module.get.transform[type]()
|
304
|
+
;
|
305
|
+
if (!module.is.animating()) {
|
306
|
+
module.debug('Flipping ' + type, $nextSide);
|
307
|
+
module.set.stageSize();
|
308
|
+
module.stage[stage]();
|
309
|
+
module.animate(transform);
|
310
|
+
} else {
|
311
|
+
module.queue('flip ' + type);
|
312
|
+
}
|
313
|
+
},
|
314
|
+
|
315
|
+
up: function () {
|
316
|
+
module.flip.to('up', 'above');
|
317
|
+
},
|
318
|
+
|
319
|
+
down: function () {
|
320
|
+
module.flip.to('down', 'below');
|
321
|
+
},
|
322
|
+
|
323
|
+
left: function () {
|
324
|
+
module.flip.to('left', 'left');
|
325
|
+
},
|
326
|
+
|
327
|
+
right: function () {
|
328
|
+
module.flip.to('right', 'right');
|
329
|
+
},
|
330
|
+
|
331
|
+
over: function () {
|
332
|
+
module.flip.to('over', 'behind');
|
333
|
+
},
|
334
|
+
|
335
|
+
back: function () {
|
336
|
+
module.flip.to('back', 'behind');
|
337
|
+
},
|
338
|
+
|
339
|
+
},
|
340
|
+
|
341
|
+
get: {
|
342
|
+
|
343
|
+
transform: {
|
344
|
+
up: function () {
|
345
|
+
var
|
346
|
+
translateZ = $activeSide.outerHeight(true) / 2,
|
347
|
+
translateY = $nextSide.outerHeight(true) - translateZ
|
348
|
+
;
|
349
|
+
|
350
|
+
return {
|
351
|
+
transform: 'translateY(' + translateY + 'px) translateZ(-' + translateZ + 'px) rotateX(-90deg)',
|
352
|
+
};
|
353
|
+
},
|
354
|
+
|
355
|
+
down: function () {
|
356
|
+
var
|
357
|
+
translate = {
|
358
|
+
z: $activeSide.outerHeight(true) / 2,
|
359
|
+
}
|
360
|
+
;
|
361
|
+
|
362
|
+
return {
|
363
|
+
transform: 'translateY(-' + translate.z + 'px) translateZ(-' + translate.z + 'px) rotateX(90deg)',
|
364
|
+
};
|
365
|
+
},
|
366
|
+
|
367
|
+
left: function () {
|
368
|
+
var
|
369
|
+
translateZ = $activeSide.outerWidth(true) / 2,
|
370
|
+
translateX = $nextSide.outerWidth(true) - translateZ
|
371
|
+
;
|
372
|
+
|
373
|
+
return {
|
374
|
+
transform: 'translateX(' + translateX + 'px) translateZ(-' + translateZ + 'px) rotateY(90deg)',
|
375
|
+
};
|
376
|
+
},
|
377
|
+
|
378
|
+
right: function () {
|
379
|
+
var
|
380
|
+
translate = {
|
381
|
+
z: $activeSide.outerWidth(true) / 2,
|
382
|
+
}
|
383
|
+
;
|
384
|
+
|
385
|
+
return {
|
386
|
+
transform: 'translateX(-' + translate.z + 'px) translateZ(-' + translate.z + 'px) rotateY(-90deg)',
|
387
|
+
};
|
388
|
+
},
|
389
|
+
|
390
|
+
over: function () {
|
391
|
+
var
|
392
|
+
translate = {
|
393
|
+
x: -(($activeSide.outerWidth(true) - $nextSide.outerWidth(true)) / 2),
|
394
|
+
}
|
395
|
+
;
|
396
|
+
|
397
|
+
return {
|
398
|
+
transform: 'translateX(' + translate.x + 'px) rotateY(180deg)',
|
399
|
+
};
|
400
|
+
},
|
401
|
+
|
402
|
+
back: function () {
|
403
|
+
var
|
404
|
+
translate = {
|
405
|
+
x: -(($activeSide.outerWidth(true) - $nextSide.outerWidth(true)) / 2),
|
406
|
+
}
|
407
|
+
;
|
408
|
+
|
409
|
+
return {
|
410
|
+
transform: 'translateX(' + translate.x + 'px) rotateY(-180deg)',
|
411
|
+
};
|
412
|
+
},
|
413
|
+
},
|
414
|
+
|
415
|
+
transitionEvent: function () {
|
416
|
+
var
|
417
|
+
element = document.createElement('element'),
|
418
|
+
transitions = {
|
419
|
+
transition: 'transitionend',
|
420
|
+
OTransition: 'oTransitionEnd',
|
421
|
+
MozTransition: 'transitionend',
|
422
|
+
WebkitTransition: 'webkitTransitionEnd',
|
423
|
+
},
|
424
|
+
transition
|
425
|
+
;
|
426
|
+
for (transition in transitions) {
|
427
|
+
if (element.style[transition] !== undefined) {
|
428
|
+
return transitions[transition];
|
429
|
+
}
|
430
|
+
}
|
431
|
+
},
|
432
|
+
|
433
|
+
nextSide: function () {
|
434
|
+
return $activeSide.next(selector.side).length > 0
|
435
|
+
? $activeSide.next(selector.side)
|
436
|
+
: $side.first();
|
437
|
+
},
|
438
|
+
|
439
|
+
},
|
440
|
+
|
441
|
+
stage: {
|
442
|
+
|
443
|
+
above: function () {
|
444
|
+
var
|
445
|
+
box = {
|
446
|
+
origin: ($activeSide.outerHeight(true) - $nextSide.outerHeight(true)) / 2,
|
447
|
+
depth: {
|
448
|
+
active: $nextSide.outerHeight(true) / 2,
|
449
|
+
next: $activeSide.outerHeight(true) / 2,
|
450
|
+
},
|
451
|
+
}
|
452
|
+
;
|
453
|
+
module.verbose('Setting the initial animation position as above', $nextSide, box);
|
454
|
+
$activeSide
|
455
|
+
.css({
|
456
|
+
transform: 'rotateX(0deg)',
|
457
|
+
})
|
458
|
+
;
|
459
|
+
$nextSide
|
460
|
+
.addClass(className.animating)
|
461
|
+
.css({
|
462
|
+
top: box.origin + 'px',
|
463
|
+
transform: 'rotateX(90deg) translateZ(' + box.depth.next + 'px) translateY(-' + box.depth.active + 'px)',
|
464
|
+
})
|
465
|
+
;
|
466
|
+
},
|
467
|
+
|
468
|
+
below: function () {
|
469
|
+
var
|
470
|
+
box = {
|
471
|
+
origin: ($activeSide.outerHeight(true) - $nextSide.outerHeight(true)) / 2,
|
472
|
+
depth: {
|
473
|
+
active: $nextSide.outerHeight(true) / 2,
|
474
|
+
next: $activeSide.outerHeight(true) / 2,
|
475
|
+
},
|
476
|
+
}
|
477
|
+
;
|
478
|
+
module.verbose('Setting the initial animation position as below', $nextSide, box);
|
479
|
+
$activeSide
|
480
|
+
.css({
|
481
|
+
transform: 'rotateX(0deg)',
|
482
|
+
})
|
483
|
+
;
|
484
|
+
$nextSide
|
485
|
+
.addClass(className.animating)
|
486
|
+
.css({
|
487
|
+
top: box.origin + 'px',
|
488
|
+
transform: 'rotateX(-90deg) translateZ(' + box.depth.next + 'px) translateY(' + box.depth.active + 'px)',
|
489
|
+
})
|
490
|
+
;
|
491
|
+
},
|
492
|
+
|
493
|
+
left: function () {
|
494
|
+
var
|
495
|
+
height = {
|
496
|
+
active: $activeSide.outerWidth(true),
|
497
|
+
next: $nextSide.outerWidth(true),
|
498
|
+
},
|
499
|
+
box = {
|
500
|
+
origin: (height.active - height.next) / 2,
|
501
|
+
depth: {
|
502
|
+
active: height.next / 2,
|
503
|
+
next: height.active / 2,
|
504
|
+
},
|
505
|
+
}
|
506
|
+
;
|
507
|
+
module.verbose('Setting the initial animation position as left', $nextSide, box);
|
508
|
+
$activeSide
|
509
|
+
.css({
|
510
|
+
transform: 'rotateY(0deg)',
|
511
|
+
})
|
512
|
+
;
|
513
|
+
$nextSide
|
514
|
+
.addClass(className.animating)
|
515
|
+
.css({
|
516
|
+
left: box.origin + 'px',
|
517
|
+
transform: 'rotateY(-90deg) translateZ(' + box.depth.next + 'px) translateX(-' + box.depth.active + 'px)',
|
518
|
+
})
|
519
|
+
;
|
520
|
+
},
|
521
|
+
|
522
|
+
right: function () {
|
523
|
+
var
|
524
|
+
height = {
|
525
|
+
active: $activeSide.outerWidth(true),
|
526
|
+
next: $nextSide.outerWidth(true),
|
527
|
+
},
|
528
|
+
box = {
|
529
|
+
origin: (height.active - height.next) / 2,
|
530
|
+
depth: {
|
531
|
+
active: height.next / 2,
|
532
|
+
next: height.active / 2,
|
533
|
+
},
|
534
|
+
}
|
535
|
+
;
|
536
|
+
module.verbose('Setting the initial animation position as right', $nextSide, box);
|
537
|
+
$activeSide
|
538
|
+
.css({
|
539
|
+
transform: 'rotateY(0deg)',
|
540
|
+
})
|
541
|
+
;
|
542
|
+
$nextSide
|
543
|
+
.addClass(className.animating)
|
544
|
+
.css({
|
545
|
+
left: box.origin + 'px',
|
546
|
+
transform: 'rotateY(90deg) translateZ(' + box.depth.next + 'px) translateX(' + box.depth.active + 'px)',
|
547
|
+
})
|
548
|
+
;
|
549
|
+
},
|
550
|
+
|
551
|
+
behind: function () {
|
552
|
+
var
|
553
|
+
height = {
|
554
|
+
active: $activeSide.outerWidth(true),
|
555
|
+
next: $nextSide.outerWidth(true),
|
556
|
+
},
|
557
|
+
box = {
|
558
|
+
origin: (height.active - height.next) / 2,
|
559
|
+
depth: {
|
560
|
+
active: height.next / 2,
|
561
|
+
next: height.active / 2,
|
562
|
+
},
|
563
|
+
}
|
564
|
+
;
|
565
|
+
module.verbose('Setting the initial animation position as behind', $nextSide, box);
|
566
|
+
$activeSide
|
567
|
+
.css({
|
568
|
+
transform: 'rotateY(0deg)',
|
569
|
+
})
|
570
|
+
;
|
571
|
+
$nextSide
|
572
|
+
.addClass(className.animating)
|
573
|
+
.css({
|
574
|
+
left: box.origin + 'px',
|
575
|
+
transform: 'rotateY(-180deg)',
|
576
|
+
})
|
577
|
+
;
|
578
|
+
},
|
579
|
+
},
|
580
|
+
setting: function (name, value) {
|
581
|
+
module.debug('Changing setting', name, value);
|
582
|
+
if ($.isPlainObject(name)) {
|
583
|
+
$.extend(true, settings, name);
|
584
|
+
} else if (value !== undefined) {
|
585
|
+
if ($.isPlainObject(settings[name])) {
|
586
|
+
$.extend(true, settings[name], value);
|
587
|
+
} else {
|
588
|
+
settings[name] = value;
|
589
|
+
}
|
590
|
+
} else {
|
591
|
+
return settings[name];
|
592
|
+
}
|
593
|
+
},
|
594
|
+
internal: function (name, value) {
|
595
|
+
if ($.isPlainObject(name)) {
|
596
|
+
$.extend(true, module, name);
|
597
|
+
} else if (value !== undefined) {
|
598
|
+
module[name] = value;
|
599
|
+
} else {
|
600
|
+
return module[name];
|
601
|
+
}
|
602
|
+
},
|
603
|
+
debug: function () {
|
604
|
+
if (!settings.silent && settings.debug) {
|
605
|
+
if (settings.performance) {
|
606
|
+
module.performance.log(arguments);
|
607
|
+
} else {
|
608
|
+
module.debug = Function.prototype.bind.call(console.info, console, settings.name + ':');
|
609
|
+
module.debug.apply(console, arguments);
|
610
|
+
}
|
611
|
+
}
|
612
|
+
},
|
613
|
+
verbose: function () {
|
614
|
+
if (!settings.silent && settings.verbose && settings.debug) {
|
615
|
+
if (settings.performance) {
|
616
|
+
module.performance.log(arguments);
|
617
|
+
} else {
|
618
|
+
module.verbose = Function.prototype.bind.call(console.info, console, settings.name + ':');
|
619
|
+
module.verbose.apply(console, arguments);
|
620
|
+
}
|
621
|
+
}
|
622
|
+
},
|
623
|
+
error: function () {
|
624
|
+
if (!settings.silent) {
|
625
|
+
module.error = Function.prototype.bind.call(console.error, console, settings.name + ':');
|
626
|
+
module.error.apply(console, arguments);
|
627
|
+
}
|
628
|
+
},
|
629
|
+
performance: {
|
630
|
+
log: function (message) {
|
631
|
+
var
|
632
|
+
currentTime,
|
633
|
+
executionTime,
|
634
|
+
previousTime
|
635
|
+
;
|
636
|
+
if (settings.performance) {
|
637
|
+
currentTime = Date.now();
|
638
|
+
previousTime = time || currentTime;
|
639
|
+
executionTime = currentTime - previousTime;
|
640
|
+
time = currentTime;
|
641
|
+
performance.push({
|
642
|
+
Name: message[0],
|
643
|
+
Arguments: [].slice.call(message, 1) || '',
|
644
|
+
Element: element,
|
645
|
+
'Execution Time': executionTime,
|
646
|
+
});
|
647
|
+
}
|
648
|
+
clearTimeout(module.performance.timer);
|
649
|
+
module.performance.timer = setTimeout(module.performance.display, 500);
|
650
|
+
},
|
651
|
+
display: function () {
|
652
|
+
var
|
653
|
+
title = settings.name + ':',
|
654
|
+
totalTime = 0
|
655
|
+
;
|
656
|
+
time = false;
|
657
|
+
clearTimeout(module.performance.timer);
|
658
|
+
$.each(performance, function (index, data) {
|
659
|
+
totalTime += data['Execution Time'];
|
660
|
+
});
|
661
|
+
title += ' ' + totalTime + 'ms';
|
662
|
+
if (moduleSelector) {
|
663
|
+
title += ' \'' + moduleSelector + '\'';
|
664
|
+
}
|
665
|
+
if ($allModules.length > 1) {
|
666
|
+
title += ' (' + $allModules.length + ')';
|
667
|
+
}
|
668
|
+
if (performance.length > 0) {
|
669
|
+
console.groupCollapsed(title);
|
670
|
+
if (console.table) {
|
671
|
+
console.table(performance);
|
672
|
+
} else {
|
673
|
+
$.each(performance, function (index, data) {
|
674
|
+
console.log(data.Name + ': ' + data['Execution Time'] + 'ms');
|
675
|
+
});
|
676
|
+
}
|
677
|
+
console.groupEnd();
|
678
|
+
}
|
679
|
+
performance = [];
|
680
|
+
},
|
681
|
+
},
|
682
|
+
invoke: function (query, passedArguments, context) {
|
683
|
+
var
|
684
|
+
object = instance,
|
685
|
+
maxDepth,
|
686
|
+
found,
|
687
|
+
response
|
688
|
+
;
|
689
|
+
passedArguments = passedArguments || queryArguments;
|
690
|
+
context = context || element;
|
691
|
+
if (typeof query === 'string' && object !== undefined) {
|
692
|
+
query = query.split(/[ .]/);
|
693
|
+
maxDepth = query.length - 1;
|
694
|
+
$.each(query, function (depth, value) {
|
695
|
+
var camelCaseValue = depth !== maxDepth
|
696
|
+
? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
|
697
|
+
: query
|
698
|
+
;
|
699
|
+
if ($.isPlainObject(object[camelCaseValue]) && (depth !== maxDepth)) {
|
700
|
+
object = object[camelCaseValue];
|
701
|
+
} else if (object[camelCaseValue] !== undefined) {
|
702
|
+
found = object[camelCaseValue];
|
703
|
+
|
704
|
+
return false;
|
705
|
+
} else if ($.isPlainObject(object[value]) && (depth !== maxDepth)) {
|
706
|
+
object = object[value];
|
707
|
+
} else if (object[value] !== undefined) {
|
708
|
+
found = object[value];
|
709
|
+
|
710
|
+
return false;
|
711
|
+
} else {
|
712
|
+
module.error(error.method, query);
|
713
|
+
|
714
|
+
return false;
|
715
|
+
}
|
716
|
+
});
|
717
|
+
}
|
718
|
+
if (isFunction(found)) {
|
719
|
+
response = found.apply(context, passedArguments);
|
720
|
+
} else if (found !== undefined) {
|
721
|
+
response = found;
|
722
|
+
}
|
723
|
+
if (Array.isArray(returnedValue)) {
|
724
|
+
returnedValue.push(response);
|
725
|
+
} else if (returnedValue !== undefined) {
|
726
|
+
returnedValue = [returnedValue, response];
|
727
|
+
} else if (response !== undefined) {
|
728
|
+
returnedValue = response;
|
729
|
+
}
|
730
|
+
|
731
|
+
return found;
|
732
|
+
},
|
733
|
+
};
|
734
|
+
|
735
|
+
if (methodInvoked) {
|
736
|
+
if (instance === undefined) {
|
737
|
+
module.initialize();
|
738
|
+
}
|
739
|
+
var $inputs = $module.find('input');
|
740
|
+
if ($inputs.length > 0) {
|
741
|
+
$inputs.trigger('blur');
|
742
|
+
setTimeout(function () {
|
743
|
+
module.invoke(query);
|
744
|
+
}, 150);
|
745
|
+
} else {
|
746
|
+
module.invoke(query);
|
747
|
+
}
|
748
|
+
} else {
|
749
|
+
if (instance !== undefined) {
|
750
|
+
instance.invoke('destroy');
|
751
|
+
}
|
752
|
+
module.initialize();
|
291
753
|
}
|
292
|
-
|
293
|
-
},
|
754
|
+
});
|
294
755
|
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
;
|
300
|
-
$nextSide
|
301
|
-
.addClass(className.active)
|
302
|
-
;
|
303
|
-
settings.onChange.call($nextSide[0]);
|
304
|
-
module.set.defaultSide();
|
305
|
-
}
|
306
|
-
},
|
756
|
+
return returnedValue !== undefined
|
757
|
+
? returnedValue
|
758
|
+
: this;
|
759
|
+
};
|
307
760
|
|
308
|
-
|
309
|
-
to: function(type,stage){
|
310
|
-
if(module.is.hidden()) {
|
311
|
-
module.debug('Module not visible', $nextSide);
|
312
|
-
return;
|
313
|
-
}
|
314
|
-
if(module.is.complete() && !module.is.animating() && !settings.allowRepeats) {
|
315
|
-
module.debug('Side already visible', $nextSide);
|
316
|
-
return;
|
317
|
-
}
|
318
|
-
var
|
319
|
-
transform = module.get.transform[type]()
|
320
|
-
;
|
321
|
-
if( !module.is.animating()) {
|
322
|
-
module.debug('Flipping '+type, $nextSide);
|
323
|
-
module.set.stageSize();
|
324
|
-
module.stage[stage]();
|
325
|
-
module.animate(transform);
|
326
|
-
}
|
327
|
-
else {
|
328
|
-
module.queue('flip '+type);
|
329
|
-
}
|
330
|
-
},
|
761
|
+
$.fn.shape.settings = {
|
331
762
|
|
332
|
-
|
333
|
-
|
334
|
-
},
|
763
|
+
// module info
|
764
|
+
name: 'Shape',
|
335
765
|
|
336
|
-
|
337
|
-
|
338
|
-
},
|
766
|
+
// hide all debug content
|
767
|
+
silent: false,
|
339
768
|
|
340
|
-
|
341
|
-
|
342
|
-
},
|
769
|
+
// debug content outputted to console
|
770
|
+
debug: false,
|
343
771
|
|
344
|
-
|
345
|
-
|
346
|
-
},
|
772
|
+
// verbose debug output
|
773
|
+
verbose: false,
|
347
774
|
|
348
|
-
|
349
|
-
|
350
|
-
},
|
775
|
+
// fudge factor in pixels when swapping from 2d to 3d (can be useful to correct rounding errors)
|
776
|
+
jitter: 0,
|
351
777
|
|
352
|
-
|
353
|
-
|
354
|
-
}
|
778
|
+
// performance data output
|
779
|
+
performance: true,
|
355
780
|
|
356
|
-
|
781
|
+
// event namespace
|
782
|
+
namespace: 'shape',
|
357
783
|
|
358
|
-
|
359
|
-
|
360
|
-
transform: {
|
361
|
-
up: function() {
|
362
|
-
var
|
363
|
-
translateZ = $activeSide.outerHeight(true) / 2,
|
364
|
-
translateY = $nextSide.outerHeight(true) - translateZ
|
365
|
-
;
|
366
|
-
return {
|
367
|
-
transform: 'translateY(' + translateY + 'px) translateZ(-'+ translateZ + 'px) rotateX(-90deg)'
|
368
|
-
};
|
369
|
-
},
|
370
|
-
|
371
|
-
down: function() {
|
372
|
-
var
|
373
|
-
translate = {
|
374
|
-
z: $activeSide.outerHeight(true) / 2
|
375
|
-
}
|
376
|
-
;
|
377
|
-
return {
|
378
|
-
transform: 'translateY(-' + translate.z + 'px) translateZ(-'+ translate.z + 'px) rotateX(90deg)'
|
379
|
-
};
|
380
|
-
},
|
381
|
-
|
382
|
-
left: function() {
|
383
|
-
var
|
384
|
-
translateZ = $activeSide.outerWidth(true) / 2,
|
385
|
-
translateX = $nextSide.outerWidth(true) - translateZ
|
386
|
-
;
|
387
|
-
return {
|
388
|
-
transform: 'translateX(' + translateX + 'px) translateZ(-' + translateZ + 'px) rotateY(90deg)'
|
389
|
-
};
|
390
|
-
},
|
391
|
-
|
392
|
-
right: function() {
|
393
|
-
var
|
394
|
-
translate = {
|
395
|
-
z : $activeSide.outerWidth(true) / 2
|
396
|
-
}
|
397
|
-
;
|
398
|
-
return {
|
399
|
-
transform: 'translateX(-' + translate.z + 'px) translateZ(-' + translate.z + 'px) rotateY(-90deg)'
|
400
|
-
};
|
401
|
-
},
|
402
|
-
|
403
|
-
over: function() {
|
404
|
-
var
|
405
|
-
translate = {
|
406
|
-
x : -(($activeSide.outerWidth(true) - $nextSide.outerWidth(true)) / 2)
|
407
|
-
}
|
408
|
-
;
|
409
|
-
return {
|
410
|
-
transform: 'translateX(' + translate.x + 'px) rotateY(180deg)'
|
411
|
-
};
|
412
|
-
},
|
413
|
-
|
414
|
-
back: function() {
|
415
|
-
var
|
416
|
-
translate = {
|
417
|
-
x : -(($activeSide.outerWidth(true) - $nextSide.outerWidth(true)) / 2)
|
418
|
-
}
|
419
|
-
;
|
420
|
-
return {
|
421
|
-
transform: 'translateX(' + translate.x + 'px) rotateY(-180deg)'
|
422
|
-
};
|
423
|
-
}
|
424
|
-
},
|
784
|
+
// width during animation, can be set to 'auto', initial', 'next' or pixel amount
|
785
|
+
width: 'initial',
|
425
786
|
|
426
|
-
|
427
|
-
|
428
|
-
element = document.createElement('element'),
|
429
|
-
transitions = {
|
430
|
-
'transition' :'transitionend',
|
431
|
-
'OTransition' :'oTransitionEnd',
|
432
|
-
'MozTransition' :'transitionend',
|
433
|
-
'WebkitTransition' :'webkitTransitionEnd'
|
434
|
-
},
|
435
|
-
transition
|
436
|
-
;
|
437
|
-
for(transition in transitions){
|
438
|
-
if( element.style[transition] !== undefined ){
|
439
|
-
return transitions[transition];
|
440
|
-
}
|
441
|
-
}
|
442
|
-
},
|
787
|
+
// height during animation, can be set to 'auto', 'initial', 'next' or pixel amount
|
788
|
+
height: 'initial',
|
443
789
|
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
: $side.first()
|
448
|
-
;
|
449
|
-
}
|
790
|
+
// callback occurs on side change
|
791
|
+
onBeforeChange: function () {},
|
792
|
+
onChange: function () {},
|
450
793
|
|
451
|
-
|
794
|
+
// allow animation to same side
|
795
|
+
allowRepeats: false,
|
452
796
|
|
453
|
-
|
797
|
+
// animation duration
|
798
|
+
duration: false,
|
454
799
|
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
depth : {
|
460
|
-
active : ($nextSide.outerHeight(true) / 2),
|
461
|
-
next : ($activeSide.outerHeight(true) / 2)
|
462
|
-
}
|
463
|
-
}
|
464
|
-
;
|
465
|
-
module.verbose('Setting the initial animation position as above', $nextSide, box);
|
466
|
-
$activeSide
|
467
|
-
.css({
|
468
|
-
'transform' : 'rotateX(0deg)'
|
469
|
-
})
|
470
|
-
;
|
471
|
-
$nextSide
|
472
|
-
.addClass(className.animating)
|
473
|
-
.css({
|
474
|
-
'top' : box.origin + 'px',
|
475
|
-
'transform' : 'rotateX(90deg) translateZ(' + box.depth.next + 'px) translateY(-' + box.depth.active + 'px)'
|
476
|
-
})
|
477
|
-
;
|
478
|
-
},
|
479
|
-
|
480
|
-
below: function() {
|
481
|
-
var
|
482
|
-
box = {
|
483
|
-
origin : (($activeSide.outerHeight(true) - $nextSide.outerHeight(true)) / 2),
|
484
|
-
depth : {
|
485
|
-
active : ($nextSide.outerHeight(true) / 2),
|
486
|
-
next : ($activeSide.outerHeight(true) / 2)
|
487
|
-
}
|
488
|
-
}
|
489
|
-
;
|
490
|
-
module.verbose('Setting the initial animation position as below', $nextSide, box);
|
491
|
-
$activeSide
|
492
|
-
.css({
|
493
|
-
'transform' : 'rotateX(0deg)'
|
494
|
-
})
|
495
|
-
;
|
496
|
-
$nextSide
|
497
|
-
.addClass(className.animating)
|
498
|
-
.css({
|
499
|
-
'top' : box.origin + 'px',
|
500
|
-
'transform' : 'rotateX(-90deg) translateZ(' + box.depth.next + 'px) translateY(' + box.depth.active + 'px)'
|
501
|
-
})
|
502
|
-
;
|
503
|
-
},
|
504
|
-
|
505
|
-
left: function() {
|
506
|
-
var
|
507
|
-
height = {
|
508
|
-
active : $activeSide.outerWidth(true),
|
509
|
-
next : $nextSide.outerWidth(true)
|
510
|
-
},
|
511
|
-
box = {
|
512
|
-
origin : ( ( height.active - height.next ) / 2),
|
513
|
-
depth : {
|
514
|
-
active : (height.next / 2),
|
515
|
-
next : (height.active / 2)
|
516
|
-
}
|
517
|
-
}
|
518
|
-
;
|
519
|
-
module.verbose('Setting the initial animation position as left', $nextSide, box);
|
520
|
-
$activeSide
|
521
|
-
.css({
|
522
|
-
'transform' : 'rotateY(0deg)'
|
523
|
-
})
|
524
|
-
;
|
525
|
-
$nextSide
|
526
|
-
.addClass(className.animating)
|
527
|
-
.css({
|
528
|
-
'left' : box.origin + 'px',
|
529
|
-
'transform' : 'rotateY(-90deg) translateZ(' + box.depth.next + 'px) translateX(-' + box.depth.active + 'px)'
|
530
|
-
})
|
531
|
-
;
|
532
|
-
},
|
533
|
-
|
534
|
-
right: function() {
|
535
|
-
var
|
536
|
-
height = {
|
537
|
-
active : $activeSide.outerWidth(true),
|
538
|
-
next : $nextSide.outerWidth(true)
|
539
|
-
},
|
540
|
-
box = {
|
541
|
-
origin : ( ( height.active - height.next ) / 2),
|
542
|
-
depth : {
|
543
|
-
active : (height.next / 2),
|
544
|
-
next : (height.active / 2)
|
545
|
-
}
|
546
|
-
}
|
547
|
-
;
|
548
|
-
module.verbose('Setting the initial animation position as right', $nextSide, box);
|
549
|
-
$activeSide
|
550
|
-
.css({
|
551
|
-
'transform' : 'rotateY(0deg)'
|
552
|
-
})
|
553
|
-
;
|
554
|
-
$nextSide
|
555
|
-
.addClass(className.animating)
|
556
|
-
.css({
|
557
|
-
'left' : box.origin + 'px',
|
558
|
-
'transform' : 'rotateY(90deg) translateZ(' + box.depth.next + 'px) translateX(' + box.depth.active + 'px)'
|
559
|
-
})
|
560
|
-
;
|
561
|
-
},
|
562
|
-
|
563
|
-
behind: function() {
|
564
|
-
var
|
565
|
-
height = {
|
566
|
-
active : $activeSide.outerWidth(true),
|
567
|
-
next : $nextSide.outerWidth(true)
|
568
|
-
},
|
569
|
-
box = {
|
570
|
-
origin : ( ( height.active - height.next ) / 2),
|
571
|
-
depth : {
|
572
|
-
active : (height.next / 2),
|
573
|
-
next : (height.active / 2)
|
574
|
-
}
|
575
|
-
}
|
576
|
-
;
|
577
|
-
module.verbose('Setting the initial animation position as behind', $nextSide, box);
|
578
|
-
$activeSide
|
579
|
-
.css({
|
580
|
-
'transform' : 'rotateY(0deg)'
|
581
|
-
})
|
582
|
-
;
|
583
|
-
$nextSide
|
584
|
-
.addClass(className.animating)
|
585
|
-
.css({
|
586
|
-
'left' : box.origin + 'px',
|
587
|
-
'transform' : 'rotateY(-180deg)'
|
588
|
-
})
|
589
|
-
;
|
590
|
-
}
|
591
|
-
},
|
592
|
-
setting: function(name, value) {
|
593
|
-
module.debug('Changing setting', name, value);
|
594
|
-
if( $.isPlainObject(name) ) {
|
595
|
-
$.extend(true, settings, name);
|
596
|
-
}
|
597
|
-
else if(value !== undefined) {
|
598
|
-
if($.isPlainObject(settings[name])) {
|
599
|
-
$.extend(true, settings[name], value);
|
600
|
-
}
|
601
|
-
else {
|
602
|
-
settings[name] = value;
|
603
|
-
}
|
604
|
-
}
|
605
|
-
else {
|
606
|
-
return settings[name];
|
607
|
-
}
|
608
|
-
},
|
609
|
-
internal: function(name, value) {
|
610
|
-
if( $.isPlainObject(name) ) {
|
611
|
-
$.extend(true, module, name);
|
612
|
-
}
|
613
|
-
else if(value !== undefined) {
|
614
|
-
module[name] = value;
|
615
|
-
}
|
616
|
-
else {
|
617
|
-
return module[name];
|
618
|
-
}
|
619
|
-
},
|
620
|
-
debug: function() {
|
621
|
-
if(!settings.silent && settings.debug) {
|
622
|
-
if(settings.performance) {
|
623
|
-
module.performance.log(arguments);
|
624
|
-
}
|
625
|
-
else {
|
626
|
-
module.debug = Function.prototype.bind.call(console.info, console, settings.name + ':');
|
627
|
-
module.debug.apply(console, arguments);
|
628
|
-
}
|
629
|
-
}
|
630
|
-
},
|
631
|
-
verbose: function() {
|
632
|
-
if(!settings.silent && settings.verbose && settings.debug) {
|
633
|
-
if(settings.performance) {
|
634
|
-
module.performance.log(arguments);
|
635
|
-
}
|
636
|
-
else {
|
637
|
-
module.verbose = Function.prototype.bind.call(console.info, console, settings.name + ':');
|
638
|
-
module.verbose.apply(console, arguments);
|
639
|
-
}
|
640
|
-
}
|
800
|
+
// possible errors
|
801
|
+
error: {
|
802
|
+
side: 'You tried to switch to a side that does not exist.',
|
803
|
+
method: 'The method you called is not defined',
|
641
804
|
},
|
642
|
-
|
643
|
-
|
644
|
-
|
645
|
-
|
646
|
-
|
805
|
+
|
806
|
+
// classnames used
|
807
|
+
className: {
|
808
|
+
animating: 'animating',
|
809
|
+
hidden: 'hidden',
|
810
|
+
loading: 'loading',
|
811
|
+
active: 'active',
|
647
812
|
},
|
648
|
-
|
649
|
-
|
650
|
-
|
651
|
-
|
652
|
-
|
653
|
-
previousTime
|
654
|
-
;
|
655
|
-
if(settings.performance) {
|
656
|
-
currentTime = new Date().getTime();
|
657
|
-
previousTime = time || currentTime;
|
658
|
-
executionTime = currentTime - previousTime;
|
659
|
-
time = currentTime;
|
660
|
-
performance.push({
|
661
|
-
'Name' : message[0],
|
662
|
-
'Arguments' : [].slice.call(message, 1) || '',
|
663
|
-
'Element' : element,
|
664
|
-
'Execution Time' : executionTime
|
665
|
-
});
|
666
|
-
}
|
667
|
-
clearTimeout(module.performance.timer);
|
668
|
-
module.performance.timer = setTimeout(module.performance.display, 500);
|
669
|
-
},
|
670
|
-
display: function() {
|
671
|
-
var
|
672
|
-
title = settings.name + ':',
|
673
|
-
totalTime = 0
|
674
|
-
;
|
675
|
-
time = false;
|
676
|
-
clearTimeout(module.performance.timer);
|
677
|
-
$.each(performance, function(index, data) {
|
678
|
-
totalTime += data['Execution Time'];
|
679
|
-
});
|
680
|
-
title += ' ' + totalTime + 'ms';
|
681
|
-
if(moduleSelector) {
|
682
|
-
title += ' \'' + moduleSelector + '\'';
|
683
|
-
}
|
684
|
-
if($allModules.length > 1) {
|
685
|
-
title += ' ' + '(' + $allModules.length + ')';
|
686
|
-
}
|
687
|
-
if( (console.group !== undefined || console.table !== undefined) && performance.length > 0) {
|
688
|
-
console.groupCollapsed(title);
|
689
|
-
if(console.table) {
|
690
|
-
console.table(performance);
|
691
|
-
}
|
692
|
-
else {
|
693
|
-
$.each(performance, function(index, data) {
|
694
|
-
console.log(data['Name'] + ': ' + data['Execution Time']+'ms');
|
695
|
-
});
|
696
|
-
}
|
697
|
-
console.groupEnd();
|
698
|
-
}
|
699
|
-
performance = [];
|
700
|
-
}
|
813
|
+
|
814
|
+
// selectors used
|
815
|
+
selector: {
|
816
|
+
sides: '.sides',
|
817
|
+
side: '.side',
|
701
818
|
},
|
702
|
-
|
703
|
-
|
704
|
-
|
705
|
-
maxDepth,
|
706
|
-
found,
|
707
|
-
response
|
708
|
-
;
|
709
|
-
passedArguments = passedArguments || queryArguments;
|
710
|
-
context = context || element;
|
711
|
-
if(typeof query == 'string' && object !== undefined) {
|
712
|
-
query = query.split(/[\. ]/);
|
713
|
-
maxDepth = query.length - 1;
|
714
|
-
$.each(query, function(depth, value) {
|
715
|
-
var camelCaseValue = (depth != maxDepth)
|
716
|
-
? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
|
717
|
-
: query
|
718
|
-
;
|
719
|
-
if( $.isPlainObject( object[camelCaseValue] ) && (depth != maxDepth) ) {
|
720
|
-
object = object[camelCaseValue];
|
721
|
-
}
|
722
|
-
else if( object[camelCaseValue] !== undefined ) {
|
723
|
-
found = object[camelCaseValue];
|
724
|
-
return false;
|
725
|
-
}
|
726
|
-
else if( $.isPlainObject( object[value] ) && (depth != maxDepth) ) {
|
727
|
-
object = object[value];
|
728
|
-
}
|
729
|
-
else if( object[value] !== undefined ) {
|
730
|
-
found = object[value];
|
731
|
-
return false;
|
732
|
-
}
|
733
|
-
else {
|
734
|
-
return false;
|
735
|
-
}
|
736
|
-
});
|
737
|
-
}
|
738
|
-
if ( $.isFunction( found ) ) {
|
739
|
-
response = found.apply(context, passedArguments);
|
740
|
-
}
|
741
|
-
else if(found !== undefined) {
|
742
|
-
response = found;
|
743
|
-
}
|
744
|
-
if(Array.isArray(returnedValue)) {
|
745
|
-
returnedValue.push(response);
|
746
|
-
}
|
747
|
-
else if(returnedValue !== undefined) {
|
748
|
-
returnedValue = [returnedValue, response];
|
749
|
-
}
|
750
|
-
else if(response !== undefined) {
|
751
|
-
returnedValue = response;
|
752
|
-
}
|
753
|
-
return found;
|
754
|
-
}
|
755
|
-
};
|
756
|
-
|
757
|
-
if(methodInvoked) {
|
758
|
-
if(instance === undefined) {
|
759
|
-
module.initialize();
|
760
|
-
}
|
761
|
-
var $inputs = $module.find('input');
|
762
|
-
if( $inputs.length > 0) {
|
763
|
-
$inputs.blur();
|
764
|
-
setTimeout(function(){
|
765
|
-
module.invoke(query);
|
766
|
-
}, 150);
|
767
|
-
} else {
|
768
|
-
module.invoke(query);
|
769
|
-
}
|
770
|
-
}
|
771
|
-
else {
|
772
|
-
if(instance !== undefined) {
|
773
|
-
instance.invoke('destroy');
|
774
|
-
}
|
775
|
-
module.initialize();
|
776
|
-
}
|
777
|
-
})
|
778
|
-
;
|
779
|
-
|
780
|
-
return (returnedValue !== undefined)
|
781
|
-
? returnedValue
|
782
|
-
: this
|
783
|
-
;
|
784
|
-
};
|
785
|
-
|
786
|
-
$.fn.shape.settings = {
|
787
|
-
|
788
|
-
// module info
|
789
|
-
name : 'Shape',
|
790
|
-
|
791
|
-
// hide all debug content
|
792
|
-
silent : false,
|
793
|
-
|
794
|
-
// debug content outputted to console
|
795
|
-
debug : false,
|
796
|
-
|
797
|
-
// verbose debug output
|
798
|
-
verbose : false,
|
799
|
-
|
800
|
-
// fudge factor in pixels when swapping from 2d to 3d (can be useful to correct rounding errors)
|
801
|
-
jitter : 0,
|
802
|
-
|
803
|
-
// performance data output
|
804
|
-
performance: true,
|
805
|
-
|
806
|
-
// event namespace
|
807
|
-
namespace : 'shape',
|
808
|
-
|
809
|
-
// width during animation, can be set to 'auto', initial', 'next' or pixel amount
|
810
|
-
width: 'initial',
|
811
|
-
|
812
|
-
// height during animation, can be set to 'auto', 'initial', 'next' or pixel amount
|
813
|
-
height: 'initial',
|
814
|
-
|
815
|
-
// callback occurs on side change
|
816
|
-
onBeforeChange : function() {},
|
817
|
-
onChange : function() {},
|
818
|
-
|
819
|
-
// allow animation to same side
|
820
|
-
allowRepeats: false,
|
821
|
-
|
822
|
-
// animation duration
|
823
|
-
duration : false,
|
824
|
-
|
825
|
-
// possible errors
|
826
|
-
error: {
|
827
|
-
side : 'You tried to switch to a side that does not exist.',
|
828
|
-
method : 'The method you called is not defined'
|
829
|
-
},
|
830
|
-
|
831
|
-
// classnames used
|
832
|
-
className : {
|
833
|
-
animating : 'animating',
|
834
|
-
hidden : 'hidden',
|
835
|
-
loading : 'loading',
|
836
|
-
active : 'active'
|
837
|
-
},
|
838
|
-
|
839
|
-
// selectors used
|
840
|
-
selector : {
|
841
|
-
sides : '.sides',
|
842
|
-
side : '.side'
|
843
|
-
}
|
844
|
-
|
845
|
-
};
|
846
|
-
|
847
|
-
|
848
|
-
})( jQuery, window, document );
|
819
|
+
|
820
|
+
};
|
821
|
+
})(jQuery, window, document);
|