@ntlab/ntjs-assets 2.0.2 → 2.0.3

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.
Files changed (235) hide show
  1. package/assets/js/bootstrap-icons/bootstrap-icons.svg +1 -1
  2. package/assets/js/bootstrap-icons/folder-plus.svg +2 -2
  3. package/assets/js/bootstrap-icons/font/bootstrap-icons.css +1981 -0
  4. package/assets/js/bootstrap-icons/font/bootstrap-icons.json +1955 -0
  5. package/assets/js/bootstrap-icons/font/bootstrap-icons.min.css +5 -0
  6. package/assets/js/bootstrap-icons/font/bootstrap-icons.scss +1993 -0
  7. package/assets/js/bootstrap-icons/font/fonts/bootstrap-icons.woff +0 -0
  8. package/assets/js/bootstrap-icons/font/fonts/bootstrap-icons.woff2 +0 -0
  9. package/assets/js/bootstrap-icons/postcard-heart-fill.svg +1 -1
  10. package/assets/js/bootstrap-icons/trash.svg +2 -2
  11. package/assets/js/jquery/jquery.js +840 -1045
  12. package/assets/js/jquery/jquery.min.js +2 -2
  13. package/assets/js/jquery/jquery.min.map +1 -1
  14. package/assets/js/jquery/jquery.slim.js +834 -1039
  15. package/assets/js/jquery/jquery.slim.min.js +2 -2
  16. package/assets/js/jquery/jquery.slim.min.map +1 -1
  17. package/assets/js/popper.js/cjs/enums.js +1 -1
  18. package/assets/js/popper.js/cjs/popper-base.js +12 -170
  19. package/assets/js/popper.js/cjs/popper-base.js.map +1 -1
  20. package/assets/js/popper.js/cjs/popper-lite.js +14 -184
  21. package/assets/js/popper.js/cjs/popper-lite.js.map +1 -1
  22. package/assets/js/popper.js/cjs/popper.js +14 -197
  23. package/assets/js/popper.js/cjs/popper.js.map +1 -1
  24. package/assets/js/popper.js/esm/createPopper.js +6 -66
  25. package/assets/js/popper.js/esm/modifiers/arrow.js +1 -12
  26. package/assets/js/popper.js/esm/modifiers/computeStyles.js +2 -14
  27. package/assets/js/popper.js/esm/utils/computeAutoPlacement.js +0 -4
  28. package/assets/js/popper.js/esm/utils/userAgent.js +1 -1
  29. package/assets/js/popper.js/umd/enums.js +1 -1
  30. package/assets/js/popper.js/umd/enums.min.js +1 -1
  31. package/assets/js/popper.js/umd/popper-base.js +12 -170
  32. package/assets/js/popper.js/umd/popper-base.js.map +1 -1
  33. package/assets/js/popper.js/umd/popper-base.min.js +2 -2
  34. package/assets/js/popper.js/umd/popper-base.min.js.map +1 -1
  35. package/assets/js/popper.js/umd/popper-lite.js +14 -184
  36. package/assets/js/popper.js/umd/popper-lite.js.map +1 -1
  37. package/assets/js/popper.js/umd/popper-lite.min.js +2 -2
  38. package/assets/js/popper.js/umd/popper-lite.min.js.map +1 -1
  39. package/assets/js/popper.js/umd/popper.js +14 -197
  40. package/assets/js/popper.js/umd/popper.js.map +1 -1
  41. package/assets/js/popper.js/umd/popper.min.js +2 -2
  42. package/assets/js/popper.js/umd/popper.min.js.map +1 -1
  43. package/assets/js/semantic-ui/components/accordion.css +196 -74
  44. package/assets/js/semantic-ui/components/accordion.js +570 -591
  45. package/assets/js/semantic-ui/components/accordion.min.css +4 -4
  46. package/assets/js/semantic-ui/components/accordion.min.js +6 -6
  47. package/assets/js/semantic-ui/components/ad.css +40 -51
  48. package/assets/js/semantic-ui/components/ad.min.css +4 -4
  49. package/assets/js/semantic-ui/components/api.js +1154 -1117
  50. package/assets/js/semantic-ui/components/api.min.js +6 -6
  51. package/assets/js/semantic-ui/components/breadcrumb.css +7 -7
  52. package/assets/js/semantic-ui/components/breadcrumb.min.css +4 -4
  53. package/assets/js/semantic-ui/components/button.css +895 -1227
  54. package/assets/js/semantic-ui/components/button.min.css +4 -4
  55. package/assets/js/semantic-ui/components/calendar.css +60 -33
  56. package/assets/js/semantic-ui/components/calendar.js +1952 -1575
  57. package/assets/js/semantic-ui/components/calendar.min.css +4 -4
  58. package/assets/js/semantic-ui/components/calendar.min.js +6 -6
  59. package/assets/js/semantic-ui/components/card.css +1004 -441
  60. package/assets/js/semantic-ui/components/card.min.css +4 -4
  61. package/assets/js/semantic-ui/components/checkbox.css +275 -303
  62. package/assets/js/semantic-ui/components/checkbox.js +863 -855
  63. package/assets/js/semantic-ui/components/checkbox.min.css +4 -4
  64. package/assets/js/semantic-ui/components/checkbox.min.js +6 -6
  65. package/assets/js/semantic-ui/components/comment.css +45 -63
  66. package/assets/js/semantic-ui/components/comment.min.css +4 -4
  67. package/assets/js/semantic-ui/components/container.css +98 -4
  68. package/assets/js/semantic-ui/components/container.min.css +4 -4
  69. package/assets/js/semantic-ui/components/dimmer.css +95 -196
  70. package/assets/js/semantic-ui/components/dimmer.js +698 -717
  71. package/assets/js/semantic-ui/components/dimmer.min.css +4 -4
  72. package/assets/js/semantic-ui/components/dimmer.min.js +6 -6
  73. package/assets/js/semantic-ui/components/divider.css +75 -93
  74. package/assets/js/semantic-ui/components/divider.min.css +4 -4
  75. package/assets/js/semantic-ui/components/dropdown.css +490 -413
  76. package/assets/js/semantic-ui/components/dropdown.js +4203 -4068
  77. package/assets/js/semantic-ui/components/dropdown.min.css +4 -4
  78. package/assets/js/semantic-ui/components/dropdown.min.js +6 -6
  79. package/assets/js/semantic-ui/components/embed.css +27 -38
  80. package/assets/js/semantic-ui/components/embed.js +647 -673
  81. package/assets/js/semantic-ui/components/embed.min.css +4 -4
  82. package/assets/js/semantic-ui/components/embed.min.js +6 -6
  83. package/assets/js/semantic-ui/components/emoji.css +11156 -9192
  84. package/assets/js/semantic-ui/components/emoji.min.css +3 -3
  85. package/assets/js/semantic-ui/components/feed.css +56 -78
  86. package/assets/js/semantic-ui/components/feed.min.css +4 -4
  87. package/assets/js/semantic-ui/components/flag.css +1037 -929
  88. package/assets/js/semantic-ui/components/flag.min.css +4 -4
  89. package/assets/js/semantic-ui/components/flyout.css +552 -0
  90. package/assets/js/semantic-ui/components/flyout.js +1567 -0
  91. package/assets/js/semantic-ui/components/flyout.min.css +9 -0
  92. package/assets/js/semantic-ui/components/flyout.min.js +11 -0
  93. package/assets/js/semantic-ui/components/form.css +536 -530
  94. package/assets/js/semantic-ui/components/form.js +2037 -1945
  95. package/assets/js/semantic-ui/components/form.min.css +4 -4
  96. package/assets/js/semantic-ui/components/form.min.js +6 -6
  97. package/assets/js/semantic-ui/components/grid.css +218 -345
  98. package/assets/js/semantic-ui/components/grid.min.css +4 -4
  99. package/assets/js/semantic-ui/components/header.css +137 -154
  100. package/assets/js/semantic-ui/components/header.min.css +4 -4
  101. package/assets/js/semantic-ui/components/icon.css +3000 -2750
  102. package/assets/js/semantic-ui/components/icon.min.css +4 -4
  103. package/assets/js/semantic-ui/components/image.css +54 -49
  104. package/assets/js/semantic-ui/components/image.min.css +4 -4
  105. package/assets/js/semantic-ui/components/input.css +1081 -227
  106. package/assets/js/semantic-ui/components/input.min.css +4 -4
  107. package/assets/js/semantic-ui/components/item.css +91 -138
  108. package/assets/js/semantic-ui/components/item.min.css +4 -4
  109. package/assets/js/semantic-ui/components/label.css +470 -481
  110. package/assets/js/semantic-ui/components/label.min.css +4 -4
  111. package/assets/js/semantic-ui/components/list.css +93 -114
  112. package/assets/js/semantic-ui/components/list.min.css +4 -4
  113. package/assets/js/semantic-ui/components/loader.css +452 -536
  114. package/assets/js/semantic-ui/components/loader.min.css +4 -4
  115. package/assets/js/semantic-ui/components/menu.css +408 -510
  116. package/assets/js/semantic-ui/components/menu.min.css +9 -1
  117. package/assets/js/semantic-ui/components/message.css +188 -213
  118. package/assets/js/semantic-ui/components/message.min.css +4 -4
  119. package/assets/js/semantic-ui/components/modal.css +174 -166
  120. package/assets/js/semantic-ui/components/modal.js +1558 -1146
  121. package/assets/js/semantic-ui/components/modal.min.css +4 -4
  122. package/assets/js/semantic-ui/components/modal.min.js +6 -6
  123. package/assets/js/semantic-ui/components/nag.css +183 -41
  124. package/assets/js/semantic-ui/components/nag.js +527 -467
  125. package/assets/js/semantic-ui/components/nag.min.css +4 -4
  126. package/assets/js/semantic-ui/components/nag.min.js +6 -6
  127. package/assets/js/semantic-ui/components/placeholder.css +62 -76
  128. package/assets/js/semantic-ui/components/placeholder.min.css +4 -4
  129. package/assets/js/semantic-ui/components/popup.css +681 -312
  130. package/assets/js/semantic-ui/components/popup.js +1470 -1463
  131. package/assets/js/semantic-ui/components/popup.min.css +4 -4
  132. package/assets/js/semantic-ui/components/popup.min.js +6 -6
  133. package/assets/js/semantic-ui/components/progress.css +149 -217
  134. package/assets/js/semantic-ui/components/progress.js +945 -1002
  135. package/assets/js/semantic-ui/components/progress.min.css +4 -4
  136. package/assets/js/semantic-ui/components/progress.min.js +6 -6
  137. package/assets/js/semantic-ui/components/rail.css +17 -22
  138. package/assets/js/semantic-ui/components/rail.min.css +3 -3
  139. package/assets/js/semantic-ui/components/rating.css +89 -184
  140. package/assets/js/semantic-ui/components/rating.js +509 -521
  141. package/assets/js/semantic-ui/components/rating.min.css +4 -4
  142. package/assets/js/semantic-ui/components/rating.min.js +6 -6
  143. package/assets/js/semantic-ui/components/reset.css +12 -17
  144. package/assets/js/semantic-ui/components/reset.min.css +4 -4
  145. package/assets/js/semantic-ui/components/reveal.css +46 -85
  146. package/assets/js/semantic-ui/components/reveal.min.css +4 -4
  147. package/assets/js/semantic-ui/components/search.css +157 -96
  148. package/assets/js/semantic-ui/components/search.js +1522 -1479
  149. package/assets/js/semantic-ui/components/search.min.css +4 -4
  150. package/assets/js/semantic-ui/components/search.min.js +6 -6
  151. package/assets/js/semantic-ui/components/segment.css +317 -249
  152. package/assets/js/semantic-ui/components/segment.min.css +4 -4
  153. package/assets/js/semantic-ui/components/shape.css +16 -32
  154. package/assets/js/semantic-ui/components/shape.js +763 -812
  155. package/assets/js/semantic-ui/components/shape.min.css +4 -4
  156. package/assets/js/semantic-ui/components/shape.min.js +6 -6
  157. package/assets/js/semantic-ui/components/sidebar.css +128 -216
  158. package/assets/js/semantic-ui/components/sidebar.js +1042 -1003
  159. package/assets/js/semantic-ui/components/sidebar.min.css +4 -4
  160. package/assets/js/semantic-ui/components/sidebar.min.js +6 -6
  161. package/assets/js/semantic-ui/components/site.css +123 -48
  162. package/assets/js/semantic-ui/components/site.js +438 -478
  163. package/assets/js/semantic-ui/components/site.min.css +4 -4
  164. package/assets/js/semantic-ui/components/site.min.js +6 -6
  165. package/assets/js/semantic-ui/components/slider.css +133 -141
  166. package/assets/js/semantic-ui/components/slider.js +1312 -1274
  167. package/assets/js/semantic-ui/components/slider.min.css +9 -1
  168. package/assets/js/semantic-ui/components/slider.min.js +6 -6
  169. package/assets/js/semantic-ui/components/state.js +640 -659
  170. package/assets/js/semantic-ui/components/state.min.js +6 -6
  171. package/assets/js/semantic-ui/components/statistic.css +83 -124
  172. package/assets/js/semantic-ui/components/statistic.min.css +4 -4
  173. package/assets/js/semantic-ui/components/step.css +118 -184
  174. package/assets/js/semantic-ui/components/step.min.css +4 -4
  175. package/assets/js/semantic-ui/components/sticky.css +3 -8
  176. package/assets/js/semantic-ui/components/sticky.js +849 -892
  177. package/assets/js/semantic-ui/components/sticky.min.css +4 -4
  178. package/assets/js/semantic-ui/components/sticky.min.js +6 -6
  179. package/assets/js/semantic-ui/components/tab.css +16 -20
  180. package/assets/js/semantic-ui/components/tab.js +896 -941
  181. package/assets/js/semantic-ui/components/tab.min.css +4 -4
  182. package/assets/js/semantic-ui/components/tab.min.js +6 -6
  183. package/assets/js/semantic-ui/components/table.css +2073 -884
  184. package/assets/js/semantic-ui/components/table.min.css +4 -4
  185. package/assets/js/semantic-ui/components/text.css +51 -30
  186. package/assets/js/semantic-ui/components/text.min.css +4 -4
  187. package/assets/js/semantic-ui/components/toast.css +200 -137
  188. package/assets/js/semantic-ui/components/toast.js +912 -832
  189. package/assets/js/semantic-ui/components/toast.min.css +4 -4
  190. package/assets/js/semantic-ui/components/toast.min.js +6 -6
  191. package/assets/js/semantic-ui/components/transition.css +371 -1282
  192. package/assets/js/semantic-ui/components/transition.js +999 -1074
  193. package/assets/js/semantic-ui/components/transition.min.css +4 -4
  194. package/assets/js/semantic-ui/components/transition.min.js +6 -6
  195. package/assets/js/semantic-ui/components/visibility.js +1215 -1247
  196. package/assets/js/semantic-ui/components/visibility.min.js +6 -6
  197. package/assets/js/semantic-ui/semantic.css +43777 -37429
  198. package/assets/js/semantic-ui/semantic.js +29152 -26694
  199. package/assets/js/semantic-ui/semantic.min.css +6 -399
  200. package/assets/js/semantic-ui/semantic.min.js +6 -6
  201. package/assets/js/semantic-ui/themes/basic/assets/fonts/icons.woff2 +0 -0
  202. package/assets/js/semantic-ui/themes/default/assets/fonts/Lato-Bold.woff +0 -0
  203. package/assets/js/semantic-ui/themes/default/assets/fonts/Lato-Bold.woff2 +0 -0
  204. package/assets/js/semantic-ui/themes/default/assets/fonts/Lato-BoldItalic.woff +0 -0
  205. package/assets/js/semantic-ui/themes/default/assets/fonts/Lato-BoldItalic.woff2 +0 -0
  206. package/assets/js/semantic-ui/themes/default/assets/fonts/Lato-Italic.woff +0 -0
  207. package/assets/js/semantic-ui/themes/default/assets/fonts/Lato-Italic.woff2 +0 -0
  208. package/assets/js/semantic-ui/themes/default/assets/fonts/Lato-Regular.woff +0 -0
  209. package/assets/js/semantic-ui/themes/default/assets/fonts/Lato-Regular.woff2 +0 -0
  210. package/assets/js/semantic-ui/themes/default/assets/fonts/LatoLatin-Bold.woff +0 -0
  211. package/assets/js/semantic-ui/themes/default/assets/fonts/LatoLatin-Bold.woff2 +0 -0
  212. package/assets/js/semantic-ui/themes/default/assets/fonts/LatoLatin-BoldItalic.woff +0 -0
  213. package/assets/js/semantic-ui/themes/default/assets/fonts/LatoLatin-BoldItalic.woff2 +0 -0
  214. package/assets/js/semantic-ui/themes/default/assets/fonts/LatoLatin-Italic.woff +0 -0
  215. package/assets/js/semantic-ui/themes/default/assets/fonts/LatoLatin-Italic.woff2 +0 -0
  216. package/assets/js/semantic-ui/themes/default/assets/fonts/LatoLatin-Regular.woff +0 -0
  217. package/assets/js/semantic-ui/themes/default/assets/fonts/LatoLatin-Regular.woff2 +0 -0
  218. package/assets/js/semantic-ui/themes/default/assets/fonts/brand-icons.woff +0 -0
  219. package/assets/js/semantic-ui/themes/default/assets/fonts/brand-icons.woff2 +0 -0
  220. package/assets/js/semantic-ui/themes/default/assets/fonts/icons.woff +0 -0
  221. package/assets/js/semantic-ui/themes/default/assets/fonts/icons.woff2 +0 -0
  222. package/assets/js/semantic-ui/themes/default/assets/fonts/outline-icons.woff +0 -0
  223. package/assets/js/semantic-ui/themes/default/assets/fonts/outline-icons.woff2 +0 -0
  224. package/assets/js/semantic-ui/themes/famfamfam/assets/images/flags.png +0 -0
  225. package/assets/js/semantic-ui/themes/github/assets/fonts/octicons.woff2 +0 -0
  226. package/assets/js/socket.io/socket.io.esm.min.js +3 -3
  227. package/assets/js/socket.io/socket.io.esm.min.js.map +1 -1
  228. package/assets/js/socket.io/socket.io.js +841 -333
  229. package/assets/js/socket.io/socket.io.js.map +1 -1
  230. package/assets/js/socket.io/socket.io.min.js +3 -3
  231. package/assets/js/socket.io/socket.io.min.js.map +1 -1
  232. package/assets/js/socket.io/socket.io.msgpack.min.js +3 -3
  233. package/assets/js/socket.io/socket.io.msgpack.min.js.map +1 -1
  234. package/cdn.json +19 -4
  235. package/package.json +1 -1
@@ -1,848 +1,799 @@
1
1
  /*!
2
- * # Fomantic-UI - Shape
3
- * http://github.com/fomantic/Fomantic-UI/
2
+ * # Fomantic-UI 2.9.2 - Shape
3
+ * https://github.com/fomantic/Fomantic-UI/
4
4
  *
5
5
  *
6
6
  * Released under the MIT license
7
- * http://opensource.org/licenses/MIT
7
+ * https://opensource.org/licenses/MIT
8
8
  *
9
9
  */
10
10
 
11
- ;(function ($, window, document, undefined) {
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
- instantiate: function() {
89
- module.verbose('Storing instance of module', module);
90
- instance = module;
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
- destroy: function() {
97
- module.verbose('Destroying previous module for', element);
98
- $module
99
- .removeData(moduleNamespace)
100
- .off(eventNamespace)
101
- ;
102
- },
18
+ window = window !== undefined && window.Math === Math
19
+ ? window
20
+ : globalThis;
103
21
 
104
- refresh: function() {
105
- module.verbose('Refreshing selector cache for', element);
106
- $module = $(element);
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
- repaint: function() {
112
- module.verbose('Forcing repaint event');
113
- var
114
- shape = $sides[0] || document.createElement('div'),
115
- fakeAssignment = shape.offsetWidth
116
- ;
117
- },
26
+ time = Date.now(),
27
+ performance = [],
118
28
 
119
- animate: function(propertyObject, callback) {
120
- module.verbose('Animating box with properties', propertyObject);
121
- callback = callback || function(event) {
122
- module.verbose('Executing animation callback');
123
- if(event !== undefined) {
124
- event.stopPropagation();
125
- }
126
- module.reset();
127
- module.set.active();
128
- };
129
- settings.beforeChange.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
- reset: function() {
167
- module.verbose('Animating states reset');
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
- is: {
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
- $activeSide = $side.filter('.' + settings.className.active),
238
- width = $activeSide.outerWidth(true),
239
- height = $activeSide.outerHeight(true)
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
- stageSize: function() {
250
- var
251
- $clone = $module.clone().addClass(className.loading),
252
- $side = $clone.find('>' + selector.sides + '>' + selector.side),
253
- $activeSide = $side.filter('.' + settings.className.active),
254
- $nextSide = (nextIndex)
255
- ? $side.eq(nextIndex)
256
- : ( $activeSide.next(selector.side).length > 0 )
257
- ? $activeSide.next(selector.side)
258
- : $side.first(),
259
- newWidth = (settings.width === 'next')
260
- ? $nextSide.outerWidth(true)
261
- : (settings.width === 'initial')
262
- ? $module.width()
263
- : settings.width,
264
- newHeight = (settings.height === 'next')
265
- ? $nextSide.outerHeight(true)
266
- : (settings.height === 'initial')
267
- ? $module.height()
268
- : settings.height
269
- ;
270
- $activeSide.removeClass(className.active);
271
- $nextSide.addClass(className.active);
272
- $clone.insertAfter($module);
273
- $clone.remove();
274
- if(settings.width !== 'auto') {
275
- $module.css('width', newWidth + settings.jitter);
276
- module.verbose('Specifying width during animation', newWidth);
277
- }
278
- if(settings.height !== 'auto') {
279
- $module.css('height', newHeight + settings.jitter);
280
- module.verbose('Specifying height during animation', newHeight);
281
- }
282
- },
283
-
284
- nextSide: function(selector) {
285
- nextIndex = selector;
286
- $nextSide = $side.filter(selector);
287
- nextIndex = $side.index($nextSide);
288
- if($nextSide.length === 0) {
289
- module.set.defaultSide();
290
- module.error(error.side);
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
+ module.verbose('Starting CSS animation');
120
+ $module
121
+ .addClass(className.animating)
122
+ ;
123
+ $sides
124
+ .css(propertyObject)
125
+ .one('transitionend', callback)
126
+ ;
127
+ module.set.duration(settings.duration);
128
+ requestAnimationFrame(function () {
129
+ $module
130
+ .addClass(className.animating)
131
+ ;
132
+ $activeSide
133
+ .addClass(className.hidden)
134
+ ;
135
+ });
136
+ },
137
+
138
+ queue: function (method) {
139
+ module.debug('Queueing animation of', method);
140
+ $sides
141
+ .one('transitionend', function () {
142
+ module.debug('Executing queued animation');
143
+ setTimeout(function () {
144
+ $module.shape(method);
145
+ }, 0);
146
+ })
147
+ ;
148
+ },
149
+
150
+ reset: function () {
151
+ module.verbose('Animating states reset');
152
+ $module
153
+ .removeClass(className.animating)
154
+ .attr('style', '')
155
+ .removeAttr('style')
156
+ ;
157
+ // removeAttr style does not consistently work in safari
158
+ $sides
159
+ .attr('style', '')
160
+ .removeAttr('style')
161
+ ;
162
+ $side
163
+ .attr('style', '')
164
+ .removeAttr('style')
165
+ .removeClass(className.hidden)
166
+ ;
167
+ $nextSide
168
+ .removeClass(className.animating)
169
+ .attr('style', '')
170
+ .removeAttr('style')
171
+ ;
172
+ },
173
+
174
+ is: {
175
+ complete: function () {
176
+ return $side.filter('.' + className.active)[0] === $nextSide[0];
177
+ },
178
+ animating: function () {
179
+ return $module.hasClass(className.animating);
180
+ },
181
+ hidden: function () {
182
+ return $module.closest(':hidden').length > 0;
183
+ },
184
+ },
185
+
186
+ set: {
187
+
188
+ defaultSide: function () {
189
+ $activeSide = $side.filter('.' + settings.className.active);
190
+ $nextSide = $activeSide.next(selector.side).length > 0
191
+ ? $activeSide.next(selector.side)
192
+ : $side.first();
193
+ nextIndex = false;
194
+ module.verbose('Active side set to', $activeSide);
195
+ module.verbose('Next side set to', $nextSide);
196
+ },
197
+
198
+ duration: function (duration) {
199
+ duration = duration || settings.duration;
200
+ duration = typeof duration === 'number'
201
+ ? duration + 'ms'
202
+ : duration;
203
+ module.verbose('Setting animation duration', duration);
204
+ if (settings.duration || settings.duration === 0) {
205
+ $sides.add($side)
206
+ .css({
207
+ 'transition-duration': duration,
208
+ })
209
+ ;
210
+ }
211
+ },
212
+
213
+ currentStageSize: function () {
214
+ var
215
+ $activeSide = $side.filter('.' + settings.className.active),
216
+ width = $activeSide.outerWidth(true),
217
+ height = $activeSide.outerHeight(true)
218
+ ;
219
+ $module
220
+ .css({
221
+ width: width,
222
+ height: height,
223
+ })
224
+ ;
225
+ },
226
+
227
+ stageSize: function () {
228
+ var
229
+ $clone = $module.clone().addClass(className.loading),
230
+ $side = $clone.find('>' + selector.sides + '>' + selector.side),
231
+ $activeSide = $side.filter('.' + settings.className.active),
232
+ $nextSide = nextIndex
233
+ ? $side.eq(nextIndex)
234
+ : ($activeSide.next(selector.side).length > 0
235
+ ? $activeSide.next(selector.side)
236
+ : $side.first()),
237
+ newWidth = settings.width === 'next'
238
+ ? $nextSide.outerWidth(true)
239
+ : (settings.width === 'initial'
240
+ ? $module.width()
241
+ : settings.width),
242
+ newHeight = settings.height === 'next'
243
+ ? $nextSide.outerHeight(true)
244
+ : (settings.height === 'initial'
245
+ ? $module.height()
246
+ : settings.height)
247
+ ;
248
+ $activeSide.removeClass(className.active);
249
+ $nextSide.addClass(className.active);
250
+ $clone.insertAfter($module);
251
+ $clone.remove();
252
+ if (settings.width !== 'auto') {
253
+ $module.css('width', newWidth + settings.jitter);
254
+ module.verbose('Specifying width during animation', newWidth);
255
+ }
256
+ if (settings.height !== 'auto') {
257
+ $module.css('height', newHeight + settings.jitter);
258
+ module.verbose('Specifying height during animation', newHeight);
259
+ }
260
+ },
261
+
262
+ nextSide: function (selector) {
263
+ nextIndex = selector;
264
+ $nextSide = $side.filter(selector);
265
+ nextIndex = $side.index($nextSide);
266
+ if ($nextSide.length === 0) {
267
+ module.set.defaultSide();
268
+ module.error(error.side);
269
+ }
270
+ module.verbose('Next side manually set to', $nextSide);
271
+ },
272
+
273
+ active: function () {
274
+ module.verbose('Setting new side to active', $nextSide);
275
+ $side
276
+ .removeClass(className.active)
277
+ ;
278
+ $nextSide
279
+ .addClass(className.active)
280
+ ;
281
+ settings.onChange.call($nextSide[0]);
282
+ module.set.defaultSide();
283
+ },
284
+ },
285
+
286
+ flip: {
287
+ to: function (type, stage) {
288
+ if (module.is.hidden()) {
289
+ module.debug('Module not visible', $nextSide);
290
+
291
+ return;
292
+ }
293
+ if (module.is.complete() && !module.is.animating() && !settings.allowRepeats) {
294
+ module.debug('Side already visible', $nextSide);
295
+
296
+ return;
297
+ }
298
+ var
299
+ transform = module.get.transform[type]()
300
+ ;
301
+ if (!module.is.animating()) {
302
+ module.debug('Flipping ' + type, $nextSide);
303
+ module.set.stageSize();
304
+ module.stage[stage]();
305
+ module.animate(transform);
306
+ } else {
307
+ module.queue('flip ' + type);
308
+ }
309
+ },
310
+
311
+ up: function () {
312
+ module.flip.to('up', 'above');
313
+ },
314
+
315
+ down: function () {
316
+ module.flip.to('down', 'below');
317
+ },
318
+
319
+ left: function () {
320
+ module.flip.to('left', 'left');
321
+ },
322
+
323
+ right: function () {
324
+ module.flip.to('right', 'right');
325
+ },
326
+
327
+ over: function () {
328
+ module.flip.to('over', 'behind');
329
+ },
330
+
331
+ back: function () {
332
+ module.flip.to('back', 'behind');
333
+ },
334
+
335
+ },
336
+
337
+ get: {
338
+
339
+ transform: {
340
+ up: function () {
341
+ var
342
+ translateZ = $activeSide.outerHeight(true) / 2,
343
+ translateY = $nextSide.outerHeight(true) - translateZ
344
+ ;
345
+
346
+ return {
347
+ transform: 'translateY(' + translateY + 'px) translateZ(-' + translateZ + 'px) rotateX(-90deg)',
348
+ };
349
+ },
350
+
351
+ down: function () {
352
+ var
353
+ translate = {
354
+ z: $activeSide.outerHeight(true) / 2,
355
+ }
356
+ ;
357
+
358
+ return {
359
+ transform: 'translateY(-' + translate.z + 'px) translateZ(-' + translate.z + 'px) rotateX(90deg)',
360
+ };
361
+ },
362
+
363
+ left: function () {
364
+ var
365
+ translateZ = $activeSide.outerWidth(true) / 2,
366
+ translateX = $nextSide.outerWidth(true) - translateZ
367
+ ;
368
+
369
+ return {
370
+ transform: 'translateX(' + translateX + 'px) translateZ(-' + translateZ + 'px) rotateY(90deg)',
371
+ };
372
+ },
373
+
374
+ right: function () {
375
+ var
376
+ translate = {
377
+ z: $activeSide.outerWidth(true) / 2,
378
+ }
379
+ ;
380
+
381
+ return {
382
+ transform: 'translateX(-' + translate.z + 'px) translateZ(-' + translate.z + 'px) rotateY(-90deg)',
383
+ };
384
+ },
385
+
386
+ over: function () {
387
+ var
388
+ translate = {
389
+ x: -(($activeSide.outerWidth(true) - $nextSide.outerWidth(true)) / 2),
390
+ }
391
+ ;
392
+
393
+ return {
394
+ transform: 'translateX(' + translate.x + 'px) rotateY(180deg)',
395
+ };
396
+ },
397
+
398
+ back: function () {
399
+ var
400
+ translate = {
401
+ x: -(($activeSide.outerWidth(true) - $nextSide.outerWidth(true)) / 2),
402
+ }
403
+ ;
404
+
405
+ return {
406
+ transform: 'translateX(' + translate.x + 'px) rotateY(-180deg)',
407
+ };
408
+ },
409
+ },
410
+
411
+ nextSide: function () {
412
+ return $activeSide.next(selector.side).length > 0
413
+ ? $activeSide.next(selector.side)
414
+ : $side.first();
415
+ },
416
+
417
+ },
418
+
419
+ stage: {
420
+
421
+ above: function () {
422
+ var
423
+ box = {
424
+ origin: ($activeSide.outerHeight(true) - $nextSide.outerHeight(true)) / 2,
425
+ depth: {
426
+ active: $nextSide.outerHeight(true) / 2,
427
+ next: $activeSide.outerHeight(true) / 2,
428
+ },
429
+ }
430
+ ;
431
+ module.verbose('Setting the initial animation position as above', $nextSide, box);
432
+ $activeSide
433
+ .css({
434
+ transform: 'rotateX(0deg)',
435
+ })
436
+ ;
437
+ $nextSide
438
+ .addClass(className.animating)
439
+ .css({
440
+ top: box.origin + 'px',
441
+ transform: 'rotateX(90deg) translateZ(' + box.depth.next + 'px) translateY(-' + box.depth.active + 'px)',
442
+ })
443
+ ;
444
+ },
445
+
446
+ below: function () {
447
+ var
448
+ box = {
449
+ origin: ($activeSide.outerHeight(true) - $nextSide.outerHeight(true)) / 2,
450
+ depth: {
451
+ active: $nextSide.outerHeight(true) / 2,
452
+ next: $activeSide.outerHeight(true) / 2,
453
+ },
454
+ }
455
+ ;
456
+ module.verbose('Setting the initial animation position as below', $nextSide, box);
457
+ $activeSide
458
+ .css({
459
+ transform: 'rotateX(0deg)',
460
+ })
461
+ ;
462
+ $nextSide
463
+ .addClass(className.animating)
464
+ .css({
465
+ top: box.origin + 'px',
466
+ transform: 'rotateX(-90deg) translateZ(' + box.depth.next + 'px) translateY(' + box.depth.active + 'px)',
467
+ })
468
+ ;
469
+ },
470
+
471
+ left: function () {
472
+ var
473
+ height = {
474
+ active: $activeSide.outerWidth(true),
475
+ next: $nextSide.outerWidth(true),
476
+ },
477
+ box = {
478
+ origin: (height.active - height.next) / 2,
479
+ depth: {
480
+ active: height.next / 2,
481
+ next: height.active / 2,
482
+ },
483
+ }
484
+ ;
485
+ module.verbose('Setting the initial animation position as left', $nextSide, box);
486
+ $activeSide
487
+ .css({
488
+ transform: 'rotateY(0deg)',
489
+ })
490
+ ;
491
+ $nextSide
492
+ .addClass(className.animating)
493
+ .css({
494
+ left: box.origin + 'px',
495
+ transform: 'rotateY(-90deg) translateZ(' + box.depth.next + 'px) translateX(-' + box.depth.active + 'px)',
496
+ })
497
+ ;
498
+ },
499
+
500
+ right: function () {
501
+ var
502
+ height = {
503
+ active: $activeSide.outerWidth(true),
504
+ next: $nextSide.outerWidth(true),
505
+ },
506
+ box = {
507
+ origin: (height.active - height.next) / 2,
508
+ depth: {
509
+ active: height.next / 2,
510
+ next: height.active / 2,
511
+ },
512
+ }
513
+ ;
514
+ module.verbose('Setting the initial animation position as right', $nextSide, box);
515
+ $activeSide
516
+ .css({
517
+ transform: 'rotateY(0deg)',
518
+ })
519
+ ;
520
+ $nextSide
521
+ .addClass(className.animating)
522
+ .css({
523
+ left: box.origin + 'px',
524
+ transform: 'rotateY(90deg) translateZ(' + box.depth.next + 'px) translateX(' + box.depth.active + 'px)',
525
+ })
526
+ ;
527
+ },
528
+
529
+ behind: function () {
530
+ var
531
+ height = {
532
+ active: $activeSide.outerWidth(true),
533
+ next: $nextSide.outerWidth(true),
534
+ },
535
+ box = {
536
+ origin: (height.active - height.next) / 2,
537
+ depth: {
538
+ active: height.next / 2,
539
+ next: height.active / 2,
540
+ },
541
+ }
542
+ ;
543
+ module.verbose('Setting the initial animation position as behind', $nextSide, box);
544
+ $activeSide
545
+ .css({
546
+ transform: 'rotateY(0deg)',
547
+ })
548
+ ;
549
+ $nextSide
550
+ .addClass(className.animating)
551
+ .css({
552
+ left: box.origin + 'px',
553
+ transform: 'rotateY(-180deg)',
554
+ })
555
+ ;
556
+ },
557
+ },
558
+ setting: function (name, value) {
559
+ module.debug('Changing setting', name, value);
560
+ if ($.isPlainObject(name)) {
561
+ $.extend(true, settings, name);
562
+ } else if (value !== undefined) {
563
+ if ($.isPlainObject(settings[name])) {
564
+ $.extend(true, settings[name], value);
565
+ } else {
566
+ settings[name] = value;
567
+ }
568
+ } else {
569
+ return settings[name];
570
+ }
571
+ },
572
+ internal: function (name, value) {
573
+ if ($.isPlainObject(name)) {
574
+ $.extend(true, module, name);
575
+ } else if (value !== undefined) {
576
+ module[name] = value;
577
+ } else {
578
+ return module[name];
579
+ }
580
+ },
581
+ debug: function () {
582
+ if (!settings.silent && settings.debug) {
583
+ if (settings.performance) {
584
+ module.performance.log(arguments);
585
+ } else {
586
+ module.debug = Function.prototype.bind.call(console.info, console, settings.name + ':');
587
+ module.debug.apply(console, arguments);
588
+ }
589
+ }
590
+ },
591
+ verbose: function () {
592
+ if (!settings.silent && settings.verbose && settings.debug) {
593
+ if (settings.performance) {
594
+ module.performance.log(arguments);
595
+ } else {
596
+ module.verbose = Function.prototype.bind.call(console.info, console, settings.name + ':');
597
+ module.verbose.apply(console, arguments);
598
+ }
599
+ }
600
+ },
601
+ error: function () {
602
+ if (!settings.silent) {
603
+ module.error = Function.prototype.bind.call(console.error, console, settings.name + ':');
604
+ module.error.apply(console, arguments);
605
+ }
606
+ },
607
+ performance: {
608
+ log: function (message) {
609
+ var
610
+ currentTime,
611
+ executionTime,
612
+ previousTime
613
+ ;
614
+ if (settings.performance) {
615
+ currentTime = Date.now();
616
+ previousTime = time || currentTime;
617
+ executionTime = currentTime - previousTime;
618
+ time = currentTime;
619
+ performance.push({
620
+ Name: message[0],
621
+ Arguments: [].slice.call(message, 1) || '',
622
+ Element: element,
623
+ 'Execution Time': executionTime,
624
+ });
625
+ }
626
+ clearTimeout(module.performance.timer);
627
+ module.performance.timer = setTimeout(module.performance.display, 500);
628
+ },
629
+ display: function () {
630
+ var
631
+ title = settings.name + ':',
632
+ totalTime = 0
633
+ ;
634
+ time = false;
635
+ clearTimeout(module.performance.timer);
636
+ $.each(performance, function (index, data) {
637
+ totalTime += data['Execution Time'];
638
+ });
639
+ title += ' ' + totalTime + 'ms';
640
+ if (moduleSelector) {
641
+ title += ' \'' + moduleSelector + '\'';
642
+ }
643
+ if ($allModules.length > 1) {
644
+ title += ' (' + $allModules.length + ')';
645
+ }
646
+ if (performance.length > 0) {
647
+ console.groupCollapsed(title);
648
+ if (console.table) {
649
+ console.table(performance);
650
+ } else {
651
+ $.each(performance, function (index, data) {
652
+ console.log(data.Name + ': ' + data['Execution Time'] + 'ms');
653
+ });
654
+ }
655
+ console.groupEnd();
656
+ }
657
+ performance = [];
658
+ },
659
+ },
660
+ invoke: function (query, passedArguments, context) {
661
+ var
662
+ object = instance,
663
+ maxDepth,
664
+ found,
665
+ response
666
+ ;
667
+ passedArguments = passedArguments || queryArguments;
668
+ context = context || element;
669
+ if (typeof query === 'string' && object !== undefined) {
670
+ query = query.split(/[ .]/);
671
+ maxDepth = query.length - 1;
672
+ $.each(query, function (depth, value) {
673
+ var camelCaseValue = depth !== maxDepth
674
+ ? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
675
+ : query
676
+ ;
677
+ if ($.isPlainObject(object[camelCaseValue]) && (depth !== maxDepth)) {
678
+ object = object[camelCaseValue];
679
+ } else if (object[camelCaseValue] !== undefined) {
680
+ found = object[camelCaseValue];
681
+
682
+ return false;
683
+ } else if ($.isPlainObject(object[value]) && (depth !== maxDepth)) {
684
+ object = object[value];
685
+ } else if (object[value] !== undefined) {
686
+ found = object[value];
687
+
688
+ return false;
689
+ } else {
690
+ module.error(error.method, query);
691
+
692
+ return false;
693
+ }
694
+ });
695
+ }
696
+ if (isFunction(found)) {
697
+ response = found.apply(context, passedArguments);
698
+ } else if (found !== undefined) {
699
+ response = found;
700
+ }
701
+ if (Array.isArray(returnedValue)) {
702
+ returnedValue.push(response);
703
+ } else if (returnedValue !== undefined) {
704
+ returnedValue = [returnedValue, response];
705
+ } else if (response !== undefined) {
706
+ returnedValue = response;
707
+ }
708
+
709
+ return found;
710
+ },
711
+ };
712
+
713
+ if (methodInvoked) {
714
+ if (instance === undefined) {
715
+ module.initialize();
716
+ }
717
+ var $inputs = $module.find('input');
718
+ if ($inputs.length > 0) {
719
+ $inputs.trigger('blur');
720
+ setTimeout(function () {
721
+ module.invoke(query);
722
+ }, 150);
723
+ } else {
724
+ module.invoke(query);
725
+ }
726
+ } else {
727
+ if (instance !== undefined) {
728
+ instance.invoke('destroy');
729
+ }
730
+ module.initialize();
291
731
  }
292
- module.verbose('Next side manually set to', $nextSide);
293
- },
732
+ });
294
733
 
295
- active: function() {
296
- module.verbose('Setting new side to active', $nextSide);
297
- $side
298
- .removeClass(className.active)
299
- ;
300
- $nextSide
301
- .addClass(className.active)
302
- ;
303
- settings.onChange.call($nextSide[0]);
304
- module.set.defaultSide();
305
- }
306
- },
734
+ return returnedValue !== undefined
735
+ ? returnedValue
736
+ : this;
737
+ };
307
738
 
308
- flip: {
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
- },
739
+ $.fn.shape.settings = {
331
740
 
332
- up: function() {
333
- module.flip.to('up','above');
334
- },
741
+ // module info
742
+ name: 'Shape',
335
743
 
336
- down: function() {
337
- module.flip.to('down','below');
338
- },
744
+ // hide all debug content
745
+ silent: false,
339
746
 
340
- left: function() {
341
- module.flip.to('left','left');
342
- },
747
+ // debug content outputted to console
748
+ debug: false,
343
749
 
344
- right: function() {
345
- module.flip.to('right','right');
346
- },
750
+ // verbose debug output
751
+ verbose: false,
347
752
 
348
- over: function() {
349
- module.flip.to('over','behind');
350
- },
753
+ // fudge factor in pixels when swapping from 2d to 3d (can be useful to correct rounding errors)
754
+ jitter: 0,
351
755
 
352
- back: function() {
353
- module.flip.to('back','behind');
354
- }
756
+ // performance data output
757
+ performance: true,
355
758
 
356
- },
759
+ // event namespace
760
+ namespace: 'shape',
357
761
 
358
- get: {
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
- },
762
+ // width during animation, can be set to 'auto', initial', 'next' or pixel amount
763
+ width: 'initial',
425
764
 
426
- transitionEvent: function() {
427
- var
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
- },
765
+ // height during animation, can be set to 'auto', 'initial', 'next' or pixel amount
766
+ height: 'initial',
443
767
 
444
- nextSide: function() {
445
- return ( $activeSide.next(selector.side).length > 0 )
446
- ? $activeSide.next(selector.side)
447
- : $side.first()
448
- ;
449
- }
768
+ // callback occurs on side change
769
+ onBeforeChange: function () {},
770
+ onChange: function () {},
450
771
 
451
- },
772
+ // allow animation to same side
773
+ allowRepeats: false,
452
774
 
453
- stage: {
775
+ // animation duration
776
+ duration: false,
454
777
 
455
- above: function() {
456
- var
457
- box = {
458
- origin : (($activeSide.outerHeight(true) - $nextSide.outerHeight(true)) / 2),
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
- }
778
+ // possible errors
779
+ error: {
780
+ side: 'You tried to switch to a side that does not exist.',
781
+ method: 'The method you called is not defined',
641
782
  },
642
- error: function() {
643
- if(!settings.silent) {
644
- module.error = Function.prototype.bind.call(console.error, console, settings.name + ':');
645
- module.error.apply(console, arguments);
646
- }
783
+
784
+ // classnames used
785
+ className: {
786
+ animating: 'animating',
787
+ hidden: 'hidden',
788
+ loading: 'loading',
789
+ active: 'active',
647
790
  },
648
- performance: {
649
- log: function(message) {
650
- var
651
- currentTime,
652
- executionTime,
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
- }
791
+
792
+ // selectors used
793
+ selector: {
794
+ sides: '.sides',
795
+ side: '.side',
701
796
  },
702
- invoke: function(query, passedArguments, context) {
703
- var
704
- object = instance,
705
- maxDepth,
706
- found,
707
- response
708
- ;
709
- passedArguments = passedArguments || queryArguments;
710
- context = element || context;
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
- beforeChange : 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 );
797
+
798
+ };
799
+ })(jQuery, window, document);