oridomi-rails 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +18 -0
  3. data/.ruby-gemset +1 -0
  4. data/.ruby-version +1 -0
  5. data/Gemfile +4 -0
  6. data/LICENSE.txt +20 -0
  7. data/README.md +99 -0
  8. data/Rakefile +2 -0
  9. data/app/assets/javascripts/oridomi-development.js +1355 -0
  10. data/app/assets/javascripts/oridomi.js +1 -0
  11. data/lib/oridomi-rails.rb +1 -0
  12. data/lib/oridomi/rails.rb +6 -0
  13. data/lib/oridomi/rails/engine.rb +7 -0
  14. data/lib/oridomi/rails/version.rb +6 -0
  15. data/oridomi-rails.gemspec +25 -0
  16. data/test/dummy/README.rdoc +28 -0
  17. data/test/dummy/Rakefile +6 -0
  18. data/test/dummy/app/assets/images/.keep +0 -0
  19. data/test/dummy/app/assets/javascripts/application.js +14 -0
  20. data/test/dummy/app/assets/stylesheets/application.css +13 -0
  21. data/test/dummy/app/controllers/application_controller.rb +5 -0
  22. data/test/dummy/app/controllers/concerns/.keep +0 -0
  23. data/test/dummy/app/helpers/application_helper.rb +2 -0
  24. data/test/dummy/app/mailers/.keep +0 -0
  25. data/test/dummy/app/models/.keep +0 -0
  26. data/test/dummy/app/models/concerns/.keep +0 -0
  27. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  28. data/test/dummy/bin/bundle +3 -0
  29. data/test/dummy/bin/rails +4 -0
  30. data/test/dummy/bin/rake +4 -0
  31. data/test/dummy/config.ru +4 -0
  32. data/test/dummy/config/application.rb +21 -0
  33. data/test/dummy/config/boot.rb +5 -0
  34. data/test/dummy/config/database.yml +8 -0
  35. data/test/dummy/config/environment.rb +5 -0
  36. data/test/dummy/config/environments/development.rb +29 -0
  37. data/test/dummy/config/environments/production.rb +80 -0
  38. data/test/dummy/config/environments/test.rb +36 -0
  39. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  40. data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  41. data/test/dummy/config/initializers/inflections.rb +16 -0
  42. data/test/dummy/config/initializers/mime_types.rb +5 -0
  43. data/test/dummy/config/initializers/secret_token.rb +12 -0
  44. data/test/dummy/config/initializers/session_store.rb +3 -0
  45. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  46. data/test/dummy/config/locales/en.yml +23 -0
  47. data/test/dummy/config/routes.rb +56 -0
  48. data/test/dummy/db/test.sqlite3 +0 -0
  49. data/test/dummy/lib/assets/.keep +0 -0
  50. data/test/dummy/log/.keep +0 -0
  51. data/test/dummy/log/test.log +26 -0
  52. data/test/dummy/public/404.html +58 -0
  53. data/test/dummy/public/422.html +58 -0
  54. data/test/dummy/public/500.html +57 -0
  55. data/test/dummy/public/favicon.ico +0 -0
  56. data/test/integration/oridomi_rails_integration_test.rb +13 -0
  57. data/test/test_helper.rb +13 -0
  58. metadata +225 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: f8aadb7c0d79baac6fd38bd54ca091875d16374b
4
+ data.tar.gz: 2cec3733701168fc37eed15936e5d9338ed593e4
5
+ SHA512:
6
+ metadata.gz: cd091c7d138f819ae12a91668e48380c3097062ba7fe02ce18247feb01876636d118d3acbeb5abd79e62890c115a31a2560f95da7f1af249ebbd39e0c9da37c5
7
+ data.tar.gz: f710058215dcb05a5ba9ba6ef07ac0125a135fd1efa559c1234894f7bb885a927c70008111beefb16ce5f95d4196fbda4db6e4b34c5840b4bafdfa7e6302c178
@@ -0,0 +1,18 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ test/log
18
+ tmp
@@ -0,0 +1 @@
1
+ sugar-rails
@@ -0,0 +1 @@
1
+ 2.0.0-p247
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in oridomi-rails.gemspec
4
+ gemspec
@@ -0,0 +1,20 @@
1
+ The MIT License (MIT)
2
+ Copyright © 2013 Sean Williamson <supernullset@wpw.so>
3
+
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ of this software and associated documentation files (the “Software”), to deal
6
+ in the Software without restriction, including without limitation the rights
7
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the Software is
9
+ furnished to do so, subject to the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be included in
12
+ all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20
+ THE SOFTWARE.
@@ -0,0 +1,99 @@
1
+ # oridomi-rails
2
+
3
+ ## Description
4
+
5
+ [OriDomi](http://oridomi.com/) bundled for the Rails 3.0 and up.
6
+
7
+
8
+ ## Requirements
9
+
10
+ This gem requires Rails 3.0+ and has been tested on the following versions:
11
+
12
+ * 4.0
13
+ * 4.0.1
14
+
15
+ This gem has been tested against the following Ruby versions:
16
+
17
+ * MRI 2.0.0
18
+
19
+ ## Installation
20
+
21
+ Add this line to your application's Gemfile:
22
+
23
+ ```ruby
24
+ gem "oridomi-rails"
25
+ ```
26
+
27
+ And then execute:
28
+
29
+ ```
30
+ $ bundle
31
+ ```
32
+
33
+ Or install it yourself as:
34
+
35
+ ```
36
+ $ gem install oridomi-rails
37
+ ```
38
+
39
+ ### Rails 3.1+
40
+
41
+ For Rails 3.1 and greater, the files will be added to the asset pipeline and available for you to use.
42
+
43
+ To enable:
44
+
45
+ * Add the following line to the file `app/assets/javascripts/application.js` (or other [sprockets](https://github.com/sstephenson/sprockets) manifest):
46
+
47
+ ``` javascript
48
+ //= require oridomi
49
+ ```
50
+
51
+ The following default builds are available:
52
+
53
+ * `oridomi` (default minified package)
54
+ * `oridomi-development` (full development package)
55
+
56
+
57
+ ### Rails 3.0
58
+
59
+ This gem adds an installation generator to Rails 3, `oridomi:install`. Running the generator will install the JavaScript file (default minified package) necessary to use Sugar.
60
+
61
+ * Invoke the generator:
62
+
63
+ ```
64
+ $ rails generate oridomi:install
65
+ ```
66
+
67
+ * Add the following to your layout or view files:
68
+
69
+ ```erb
70
+ <%= javascript_include_tag "oridomi" %>
71
+ ```
72
+
73
+
74
+ ## Contributing
75
+
76
+ 1. [Fork it](https://github.com/supernullset/oridomi-rails/fork_select)
77
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
78
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
79
+ 4. Push to the branch (`git push origin my-new-feature`)
80
+ 5. [Create a Pull Request](hhttps://github.com/supernullset/oridomi-rails/pull/new)
81
+
82
+
83
+ ## Contributors
84
+ ## License
85
+
86
+ **oridomi-rails**
87
+
88
+ * Freely distributable and licensed under the [MIT license](http://phlipper.mit-license.org/2011-2012/license.html).
89
+
90
+
91
+ **Oridomi**
92
+
93
+ * Freely distributable and licensed under the MIT-style license.
94
+ * Copyright (c) 2012 Dan Motzenbecker
95
+ * http://oridomi.com/
96
+
97
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sub-license, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
98
+ The above copyright notice, and every other copyright notice found in this software, and all the attributions in every file, and this permission notice shall be included in all copies or substantial portions of the Software.
99
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
@@ -0,0 +1,1355 @@
1
+ // Generated by CoffeeScript 1.6.3
2
+ (function() {
3
+ 'use strict';
4
+ var $, OriDomi, addStyle, anchorList, anchorListH, anchorListV, baseName, capitalize, cloneEl, createEl, css, defaults, defer, elClasses, getGradient, hideEl, isSupported, k, noOp, prefixList, prep, showEl, styleBuffer, supportWarning, testEl, testProp, v, _ref,
5
+ __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
6
+ __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; },
7
+ __slice = [].slice;
8
+
9
+ isSupported = true;
10
+
11
+ supportWarning = function(prop) {
12
+ if (typeof console !== "undefined" && console !== null) {
13
+ console.warn("OriDomi: Missing support for `" + prop + "`.");
14
+ }
15
+ return isSupported = false;
16
+ };
17
+
18
+ testProp = function(prop) {
19
+ var full, prefix, _i, _len;
20
+ for (_i = 0, _len = prefixList.length; _i < _len; _i++) {
21
+ prefix = prefixList[_i];
22
+ if (testEl.style[(full = prefix + capitalize(prop))] != null) {
23
+ return full;
24
+ }
25
+ }
26
+ if (testEl.style[prop] != null) {
27
+ return prop;
28
+ }
29
+ return false;
30
+ };
31
+
32
+ addStyle = function(selector, rules) {
33
+ var prop, style, val;
34
+ style = "." + selector + "{";
35
+ for (prop in rules) {
36
+ val = rules[prop];
37
+ if (prop in css) {
38
+ prop = css[prop];
39
+ if (prop.match(/^(webkit|moz|ms)/i)) {
40
+ prop = '-' + prop;
41
+ }
42
+ }
43
+ style += "" + (prop.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase()) + ":" + val + ";";
44
+ }
45
+ return styleBuffer += style + '}';
46
+ };
47
+
48
+ getGradient = function(anchor) {
49
+ return "" + css.gradientProp + "(" + anchor + ", rgba(0, 0, 0, .5) 0%, rgba(255, 255, 255, .35) 100%)";
50
+ };
51
+
52
+ capitalize = function(s) {
53
+ return s[0].toUpperCase() + s.slice(1);
54
+ };
55
+
56
+ createEl = function(className) {
57
+ var el;
58
+ el = document.createElement('div');
59
+ el.className = elClasses[className];
60
+ return el;
61
+ };
62
+
63
+ cloneEl = function(parent, deep, className) {
64
+ var el;
65
+ el = parent.cloneNode(deep);
66
+ el.classList.add(elClasses[className]);
67
+ return el;
68
+ };
69
+
70
+ hideEl = function(el) {
71
+ return el.style[css.transform] = 'translate3d(-99999px, 0, 0)';
72
+ };
73
+
74
+ showEl = function(el) {
75
+ return el.style[css.transform] = 'translate3d(0, 0, 0)';
76
+ };
77
+
78
+ prep = function(fn) {
79
+ return function() {
80
+ var a0, a1, a2, anchor, angle, opt;
81
+ if (this._touchStarted) {
82
+ return fn.apply(this, arguments);
83
+ } else {
84
+ a0 = arguments[0], a1 = arguments[1], a2 = arguments[2];
85
+ opt = {};
86
+ angle = anchor = null;
87
+ switch (fn.length) {
88
+ case 1:
89
+ opt.callback = a0;
90
+ if (!this.isFoldedUp) {
91
+ return typeof opt.callback === "function" ? opt.callback() : void 0;
92
+ }
93
+ break;
94
+ case 2:
95
+ if (typeof a0 === 'function') {
96
+ opt.callback = a0;
97
+ } else {
98
+ anchor = a0;
99
+ opt.callback = a1;
100
+ }
101
+ break;
102
+ case 3:
103
+ angle = a0;
104
+ if (arguments.length === 2) {
105
+ if (typeof a1 === 'object') {
106
+ opt = a1;
107
+ } else if (typeof a1 === 'function') {
108
+ opt.callback = a1;
109
+ } else {
110
+ anchor = a1;
111
+ }
112
+ } else if (arguments.length === 3) {
113
+ anchor = a1;
114
+ if (typeof a2 === 'object') {
115
+ opt = a2;
116
+ } else if (typeof a2 === 'function') {
117
+ opt.callback = a2;
118
+ }
119
+ }
120
+ }
121
+ if (angle == null) {
122
+ angle = this._lastOp.angle || 0;
123
+ }
124
+ anchor || (anchor = this._lastOp.anchor);
125
+ this._queue.push([fn, this._normalizeAngle(angle), this._getLonghandAnchor(anchor), opt]);
126
+ this._step();
127
+ return this;
128
+ }
129
+ };
130
+ };
131
+
132
+ defer = function(fn) {
133
+ return setTimeout(fn, 0);
134
+ };
135
+
136
+ noOp = function() {};
137
+
138
+ $ = ((_ref = window.jQuery || window.$) != null ? _ref.data : void 0) ? window.$ : null;
139
+
140
+ anchorList = ['left', 'right', 'top', 'bottom'];
141
+
142
+ anchorListV = anchorList.slice(0, 2);
143
+
144
+ anchorListH = anchorList.slice(2);
145
+
146
+ testEl = document.createElement('div');
147
+
148
+ styleBuffer = '';
149
+
150
+ prefixList = ['Webkit', 'Moz', 'ms'];
151
+
152
+ baseName = 'oridomi';
153
+
154
+ elClasses = {
155
+ active: 'active',
156
+ clone: 'clone',
157
+ holder: 'holder',
158
+ stage: 'stage',
159
+ stageLeft: 'stage-left',
160
+ stageRight: 'stage-right',
161
+ stageTop: 'stage-top',
162
+ stageBottom: 'stage-bottom',
163
+ content: 'content',
164
+ mask: 'mask',
165
+ maskH: 'mask-h',
166
+ maskV: 'mask-v',
167
+ panel: 'panel',
168
+ panelH: 'panel-h',
169
+ panelV: 'panel-v',
170
+ shader: 'shader',
171
+ shaderLeft: 'shader-left',
172
+ shaderRight: 'shader-right',
173
+ shaderTop: 'shader-top',
174
+ shaderBottom: 'shader-bottom'
175
+ };
176
+
177
+ for (k in elClasses) {
178
+ v = elClasses[k];
179
+ elClasses[k] = "" + baseName + "-" + v;
180
+ }
181
+
182
+ css = new function() {
183
+ var key, _i, _len, _ref1;
184
+ _ref1 = ['transform', 'transformOrigin', 'transformStyle', 'transitionProperty', 'transitionDuration', 'transitionDelay', 'transitionTimingFunction', 'perspective', 'perspectiveOrigin', 'backfaceVisibility', 'boxSizing', 'mask'];
185
+ for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
186
+ key = _ref1[_i];
187
+ this[key] = key;
188
+ }
189
+ return this;
190
+ };
191
+
192
+ (function() {
193
+ var anchor, key, p3d, styleEl, value, _i, _len, _ref1, _ref2;
194
+ for (key in css) {
195
+ value = css[key];
196
+ css[key] = testProp(value);
197
+ if (!css[key]) {
198
+ return supportWarning(value);
199
+ }
200
+ }
201
+ p3d = 'preserve-3d';
202
+ testEl.style[css.transformStyle] = p3d;
203
+ if (testEl.style[css.transformStyle] !== p3d) {
204
+ return supportWarning(p3d);
205
+ }
206
+ css.gradientProp = (function() {
207
+ var hyphenated, prefix, _i, _len;
208
+ for (_i = 0, _len = prefixList.length; _i < _len; _i++) {
209
+ prefix = prefixList[_i];
210
+ hyphenated = "-" + (prefix.toLowerCase()) + "-linear-gradient";
211
+ testEl.style.backgroundImage = "" + hyphenated + "(left, #000, #fff)";
212
+ if (testEl.style.backgroundImage.indexOf('gradient') !== -1) {
213
+ return hyphenated;
214
+ }
215
+ }
216
+ return 'linear-gradient';
217
+ })();
218
+ _ref1 = (function() {
219
+ var grabValue, plainGrab, prefix, _i, _len;
220
+ for (_i = 0, _len = prefixList.length; _i < _len; _i++) {
221
+ prefix = prefixList[_i];
222
+ plainGrab = 'grab';
223
+ testEl.style.cursor = (grabValue = "-" + (prefix.toLowerCase()) + "-" + plainGrab);
224
+ if (testEl.style.cursor === grabValue) {
225
+ return [grabValue, "-" + (prefix.toLowerCase()) + "-grabbing"];
226
+ }
227
+ }
228
+ testEl.style.cursor = plainGrab;
229
+ if (testEl.style.cursor === plainGrab) {
230
+ return [plainGrab, 'grabbing'];
231
+ } else {
232
+ return ['move', 'move'];
233
+ }
234
+ })(), css.grab = _ref1[0], css.grabbing = _ref1[1];
235
+ css.transformProp = (function() {
236
+ var prefix;
237
+ if (prefix = css.transform.match(/(\w+)Transform/i)) {
238
+ return "-" + (prefix[1].toLowerCase()) + "-transform";
239
+ } else {
240
+ return 'transform';
241
+ }
242
+ })();
243
+ css.transitionEnd = (function() {
244
+ switch (css.transitionProperty.toLowerCase()) {
245
+ case 'transitionproperty':
246
+ return 'transitionEnd';
247
+ case 'webkittransitionproperty':
248
+ return 'webkitTransitionEnd';
249
+ case 'moztransitionproperty':
250
+ return 'transitionend';
251
+ case 'mstransitionproperty':
252
+ return 'msTransitionEnd';
253
+ }
254
+ })();
255
+ addStyle(elClasses.active, {
256
+ backgroundColor: 'transparent !important',
257
+ backgroundImage: 'none !important',
258
+ boxSizing: 'border-box !important',
259
+ border: 'none !important',
260
+ outline: 'none !important',
261
+ padding: '0 !important',
262
+ position: 'relative',
263
+ transformStyle: p3d + ' !important',
264
+ mask: 'none !important'
265
+ });
266
+ addStyle(elClasses.clone, {
267
+ margin: '0 !important',
268
+ boxSizing: 'border-box !important',
269
+ overflow: 'hidden !important',
270
+ display: 'block !important'
271
+ });
272
+ addStyle(elClasses.holder, {
273
+ width: '100%',
274
+ position: 'absolute',
275
+ top: '0',
276
+ bottom: '0',
277
+ transformStyle: p3d
278
+ });
279
+ addStyle(elClasses.stage, {
280
+ width: '100%',
281
+ height: '100%',
282
+ position: 'absolute',
283
+ transform: 'translate3d(-9999px, 0, 0)',
284
+ margin: '0',
285
+ padding: '0',
286
+ transformStyle: p3d
287
+ });
288
+ _ref2 = {
289
+ Left: '0% 50%',
290
+ Right: '100% 50%',
291
+ Top: '50% 0%',
292
+ Bottom: '50% 100%'
293
+ };
294
+ for (k in _ref2) {
295
+ v = _ref2[k];
296
+ addStyle(elClasses['stage' + k], {
297
+ perspectiveOrigin: v
298
+ });
299
+ }
300
+ addStyle(elClasses.shader, {
301
+ width: '100%',
302
+ height: '100%',
303
+ position: 'absolute',
304
+ opacity: '0',
305
+ top: '0',
306
+ left: '0',
307
+ pointerEvents: 'none',
308
+ transitionProperty: 'opacity'
309
+ });
310
+ for (_i = 0, _len = anchorList.length; _i < _len; _i++) {
311
+ anchor = anchorList[_i];
312
+ addStyle(elClasses['shader' + capitalize(anchor)], {
313
+ background: getGradient(anchor)
314
+ });
315
+ }
316
+ addStyle(elClasses.content, {
317
+ margin: '0 !important',
318
+ position: 'relative !important',
319
+ float: 'none !important',
320
+ boxSizing: 'border-box !important',
321
+ overflow: 'hidden !important'
322
+ });
323
+ addStyle(elClasses.mask, {
324
+ width: '100%',
325
+ height: '100%',
326
+ position: 'absolute',
327
+ overflow: 'hidden',
328
+ transform: 'translate3d(0, 0, 0)'
329
+ });
330
+ addStyle(elClasses.panel, {
331
+ width: '100%',
332
+ height: '100%',
333
+ padding: '0',
334
+ position: 'relative',
335
+ transitionProperty: css.transformProp,
336
+ transformOrigin: 'left',
337
+ transformStyle: p3d
338
+ });
339
+ addStyle(elClasses.panelH, {
340
+ transformOrigin: 'top'
341
+ });
342
+ addStyle("" + elClasses.stageRight + " ." + elClasses.panel, {
343
+ transformOrigin: 'right'
344
+ });
345
+ addStyle("" + elClasses.stageBottom + " ." + elClasses.panel, {
346
+ transformOrigin: 'bottom'
347
+ });
348
+ styleEl = document.createElement('style');
349
+ styleEl.type = 'text/css';
350
+ if (styleEl.styleSheet) {
351
+ styleEl.styleSheet.cssText = styleBuffer;
352
+ } else {
353
+ styleEl.appendChild(document.createTextNode(styleBuffer));
354
+ }
355
+ return document.head.appendChild(styleEl);
356
+ })();
357
+
358
+ defaults = {
359
+ vPanels: 3,
360
+ hPanels: 3,
361
+ perspective: 1000,
362
+ shading: 'hard',
363
+ speed: 700,
364
+ maxAngle: 90,
365
+ ripple: 0,
366
+ oriDomiClass: 'oridomi',
367
+ shadingIntensity: 1,
368
+ easingMethod: '',
369
+ touchEnabled: true,
370
+ touchSensitivity: .25,
371
+ touchStartCallback: noOp,
372
+ touchMoveCallback: noOp,
373
+ touchEndCallback: noOp
374
+ };
375
+
376
+ OriDomi = (function() {
377
+ function OriDomi(el, options) {
378
+ var a, anchor, anchorSet, axis, classSuffix, content, contentHolder, count, i, mask, maskProto, metric, n, panel, panelN, panelProto, percent, proto, shaderProto, shaderProtos, side, stageProto, _i, _j, _k, _l, _len, _len1, _len2, _len3, _len4, _len5, _len6, _len7, _m, _n, _o, _p, _q, _ref1;
379
+ this.el = el;
380
+ if (options == null) {
381
+ options = {};
382
+ }
383
+ this._onMouseOut = __bind(this._onMouseOut, this);
384
+ this._onTouchLeave = __bind(this._onTouchLeave, this);
385
+ this._onTouchEnd = __bind(this._onTouchEnd, this);
386
+ this._onTouchMove = __bind(this._onTouchMove, this);
387
+ this._onTouchStart = __bind(this._onTouchStart, this);
388
+ this._stageReset = __bind(this._stageReset, this);
389
+ this._conclude = __bind(this._conclude, this);
390
+ this._onTransitionEnd = __bind(this._onTransitionEnd, this);
391
+ this._step = __bind(this._step, this);
392
+ if (!isSupported) {
393
+ return;
394
+ }
395
+ if (!(this instanceof OriDomi)) {
396
+ return (function(func, args, ctor) {
397
+ ctor.prototype = func.prototype;
398
+ var child = new ctor, result = func.apply(child, args);
399
+ return Object(result) === result ? result : child;
400
+ })(OriDomi, arguments, function(){});
401
+ }
402
+ if (typeof this.el === 'string') {
403
+ this.el = document.querySelector(this.el);
404
+ }
405
+ if (!(this.el && this.el.nodeType === 1)) {
406
+ if (typeof console !== "undefined" && console !== null) {
407
+ console.warn('OriDomi: First argument must be a DOM element');
408
+ }
409
+ return;
410
+ }
411
+ this._config = new function() {
412
+ for (k in defaults) {
413
+ v = defaults[k];
414
+ if (options[k] != null) {
415
+ this[k] = options[k];
416
+ } else {
417
+ this[k] = v;
418
+ }
419
+ }
420
+ return this;
421
+ };
422
+ this._config.ripple = Number(this._config.ripple);
423
+ this._queue = [];
424
+ this._panels = {};
425
+ this._stages = {};
426
+ this._lastOp = {
427
+ anchor: anchorList[0]
428
+ };
429
+ this._shading = this._config.shading;
430
+ if (this._shading === true) {
431
+ this._shading = 'hard';
432
+ }
433
+ if (this._shading) {
434
+ this._shaders = {};
435
+ shaderProtos = {};
436
+ shaderProto = createEl('shader');
437
+ shaderProto.style[css.transitionDuration] = this._config.speed + 'ms';
438
+ shaderProto.style[css.transitionTimingFunction] = this._config.easingMethod;
439
+ }
440
+ stageProto = createEl('stage');
441
+ stageProto.style[css.perspective] = this._config.perspective + 'px';
442
+ for (_i = 0, _len = anchorList.length; _i < _len; _i++) {
443
+ anchor = anchorList[_i];
444
+ this._panels[anchor] = [];
445
+ this._stages[anchor] = cloneEl(stageProto, false, 'stage' + capitalize(anchor));
446
+ if (this._shading) {
447
+ this._shaders[anchor] = {};
448
+ if (__indexOf.call(anchorListV, anchor) >= 0) {
449
+ for (_j = 0, _len1 = anchorListV.length; _j < _len1; _j++) {
450
+ side = anchorListV[_j];
451
+ this._shaders[anchor][side] = [];
452
+ }
453
+ } else {
454
+ for (_k = 0, _len2 = anchorListH.length; _k < _len2; _k++) {
455
+ side = anchorListH[_k];
456
+ this._shaders[anchor][side] = [];
457
+ }
458
+ }
459
+ shaderProtos[anchor] = cloneEl(shaderProto, false, 'shader' + capitalize(anchor));
460
+ }
461
+ }
462
+ contentHolder = cloneEl(this.el, true, 'content');
463
+ maskProto = createEl('mask');
464
+ maskProto.appendChild(contentHolder);
465
+ panelProto = createEl('panel');
466
+ panelProto.style[css.transitionDuration] = this._config.speed + 'ms';
467
+ panelProto.style[css.transitionTimingFunction] = this._config.easingMethod;
468
+ _ref1 = ['x', 'y'];
469
+ for (_l = 0, _len3 = _ref1.length; _l < _len3; _l++) {
470
+ axis = _ref1[_l];
471
+ if (axis === 'x') {
472
+ anchorSet = anchorListV;
473
+ count = this._config.vPanels;
474
+ metric = 'width';
475
+ classSuffix = 'V';
476
+ } else {
477
+ anchorSet = anchorListH;
478
+ count = this._config.hPanels;
479
+ metric = 'height';
480
+ classSuffix = 'H';
481
+ }
482
+ percent = 100 / count;
483
+ mask = cloneEl(maskProto, true, 'mask' + classSuffix);
484
+ content = mask.children[0];
485
+ content.style.width = content.style.height = '100%';
486
+ content.style[metric] = content.style['max' + capitalize(metric)] = count * 100 + '%';
487
+ if (this._shading) {
488
+ for (_m = 0, _len4 = anchorSet.length; _m < _len4; _m++) {
489
+ anchor = anchorSet[_m];
490
+ mask.appendChild(shaderProtos[anchor]);
491
+ }
492
+ }
493
+ proto = cloneEl(panelProto, false, 'panel' + classSuffix);
494
+ proto.appendChild(mask);
495
+ for (n = _n = 0, _len5 = anchorSet.length; _n < _len5; n = ++_n) {
496
+ anchor = anchorSet[n];
497
+ for (panelN = _o = 0; 0 <= count ? _o < count : _o > count; panelN = 0 <= count ? ++_o : --_o) {
498
+ panel = proto.cloneNode(true);
499
+ if (panelN === 0) {
500
+ panel.style[metric] = percent + '%';
501
+ }
502
+ content = panel.children[0].children[0];
503
+ if (n === 0) {
504
+ content.style[anchor] = -panelN * 100 + '%';
505
+ if (panelN === 0) {
506
+ panel.style[anchor] = '0';
507
+ } else {
508
+ panel.style[anchor] = '100%';
509
+ }
510
+ } else {
511
+ content.style[anchorSet[0]] = (count - panelN - 1) * -100 + '%';
512
+ panel.style[css.origin] = anchor;
513
+ if (panelN === 0) {
514
+ panel.style[anchorSet[0]] = 100 - percent + '%';
515
+ } else {
516
+ panel.style[anchorSet[0]] = '-100%';
517
+ }
518
+ }
519
+ if (this._shading) {
520
+ for (i = _p = 0, _len6 = anchorSet.length; _p < _len6; i = ++_p) {
521
+ a = anchorSet[i];
522
+ this._shaders[anchor][a][panelN] = panel.children[0].children[i + 1];
523
+ }
524
+ }
525
+ this._panels[anchor][panelN] = panel;
526
+ if (panelN !== 0) {
527
+ this._panels[anchor][panelN - 1].appendChild(panel);
528
+ }
529
+ }
530
+ this._stages[anchor].appendChild(this._panels[anchor][0]);
531
+ }
532
+ }
533
+ this._stageHolder = createEl('holder');
534
+ for (_q = 0, _len7 = anchorList.length; _q < _len7; _q++) {
535
+ anchor = anchorList[_q];
536
+ this._stageHolder.appendChild(this._stages[anchor]);
537
+ }
538
+ if (window.getComputedStyle(this.el).position === 'absolute') {
539
+ this.el.style.position = 'absolute';
540
+ }
541
+ this.el.classList.add(elClasses.active);
542
+ showEl(this._stages.left);
543
+ this._cloneEl = cloneEl(this.el, true, 'clone');
544
+ this._cloneEl.classList.remove(elClasses.active);
545
+ hideEl(this._cloneEl);
546
+ this.el.innerHTML = '';
547
+ this.el.appendChild(this._cloneEl);
548
+ this.el.appendChild(this._stageHolder);
549
+ this.el.parentNode.style[css.transformStyle] = 'preserve-3d';
550
+ this.accordion(0);
551
+ if (this._config.ripple) {
552
+ this.setRipple(this._config.ripple);
553
+ }
554
+ if (this._config.touchEnabled) {
555
+ this.enableTouch();
556
+ }
557
+ }
558
+
559
+ OriDomi.prototype._step = function() {
560
+ var anchor, angle, fn, next, options, _ref1,
561
+ _this = this;
562
+ if (this._inTrans || !this._queue.length) {
563
+ return;
564
+ }
565
+ this._inTrans = true;
566
+ _ref1 = this._queue.shift(), fn = _ref1[0], angle = _ref1[1], anchor = _ref1[2], options = _ref1[3];
567
+ if (this.isFrozen) {
568
+ this.unfreeze();
569
+ }
570
+ next = function() {
571
+ var args;
572
+ _this._setCallback({
573
+ angle: angle,
574
+ anchor: anchor,
575
+ options: options,
576
+ fn: fn
577
+ });
578
+ args = [angle, anchor, options];
579
+ if (fn.length < 3) {
580
+ args.shift();
581
+ }
582
+ return fn.apply(_this, args);
583
+ };
584
+ if (this.isFoldedUp) {
585
+ if (fn.length === 2) {
586
+ return next();
587
+ } else {
588
+ return this._unfold(next);
589
+ }
590
+ } else if (anchor !== this._lastOp.anchor) {
591
+ return this._stageReset(anchor, next);
592
+ } else {
593
+ return next();
594
+ }
595
+ };
596
+
597
+ OriDomi.prototype._isIdenticalOperation = function(op) {
598
+ var key, _i, _len, _ref1, _ref2;
599
+ if (!this._lastOp.fn) {
600
+ return true;
601
+ }
602
+ if (this._lastOp.reset) {
603
+ return false;
604
+ }
605
+ _ref1 = ['angle', 'anchor', 'fn'];
606
+ for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
607
+ key = _ref1[_i];
608
+ if (this._lastOp[key] !== op[key]) {
609
+ return false;
610
+ }
611
+ }
612
+ _ref2 = op.options;
613
+ for (k in _ref2) {
614
+ v = _ref2[k];
615
+ if (v !== this._lastOp.options[k] && k !== 'callback') {
616
+ return false;
617
+ }
618
+ }
619
+ return true;
620
+ };
621
+
622
+ OriDomi.prototype._setCallback = function(operation) {
623
+ if (this._isIdenticalOperation(operation)) {
624
+ this._conclude(operation.options.callback);
625
+ } else {
626
+ this._panels[this._lastOp.anchor][0].addEventListener(css.transitionEnd, this._onTransitionEnd, false);
627
+ }
628
+ return (this._lastOp = operation).reset = false;
629
+ };
630
+
631
+ OriDomi.prototype._onTransitionEnd = function(e) {
632
+ e.currentTarget.removeEventListener(css.transitionEnd, this._onTransitionEnd, false);
633
+ return this._conclude(this._lastOp.options.callback, e);
634
+ };
635
+
636
+ OriDomi.prototype._conclude = function(cb, event) {
637
+ var _this = this;
638
+ return defer(function() {
639
+ _this._inTrans = false;
640
+ _this._step();
641
+ return typeof cb === "function" ? cb(event, _this) : void 0;
642
+ });
643
+ };
644
+
645
+ OriDomi.prototype._transformPanel = function(el, angle, anchor, fracture) {
646
+ var translate, x, y, z;
647
+ x = y = z = 0;
648
+ switch (anchor) {
649
+ case 'left':
650
+ y = angle;
651
+ translate = 'X(-1';
652
+ break;
653
+ case 'right':
654
+ y = -angle;
655
+ translate = 'X(1';
656
+ break;
657
+ case 'top':
658
+ x = -angle;
659
+ translate = 'Y(-1';
660
+ break;
661
+ case 'bottom':
662
+ x = angle;
663
+ translate = 'Y(1';
664
+ }
665
+ if (fracture) {
666
+ x = y = z = angle;
667
+ }
668
+ return el.style[css.transform] = "rotateX(" + x + "deg)\nrotateY(" + y + "deg)\nrotateZ(" + z + "deg)\ntranslate" + translate + "px)";
669
+ };
670
+
671
+ OriDomi.prototype._normalizeAngle = function(angle) {
672
+ var max;
673
+ angle = parseFloat(angle, 10);
674
+ max = this._config.maxAngle;
675
+ if (isNaN(angle)) {
676
+ return 0;
677
+ } else if (angle > max) {
678
+ return max;
679
+ } else if (angle < -max) {
680
+ return -max;
681
+ } else {
682
+ return angle;
683
+ }
684
+ };
685
+
686
+ OriDomi.prototype._setTrans = function(duration, delay, anchor) {
687
+ var _this = this;
688
+ if (anchor == null) {
689
+ anchor = this._lastOp.anchor;
690
+ }
691
+ return this._iterate(anchor, function(panel, i, len) {
692
+ return _this._setPanelTrans.apply(_this, [anchor].concat(__slice.call(arguments), [duration], [delay]));
693
+ });
694
+ };
695
+
696
+ OriDomi.prototype._setPanelTrans = function(anchor, panel, i, len, duration, delay) {
697
+ var delayMs, shader, side, _i, _len, _ref1,
698
+ _this = this;
699
+ delayMs = (function() {
700
+ switch (delay) {
701
+ case 0:
702
+ return 0;
703
+ case 1:
704
+ return _this._config.speed / len * i;
705
+ case 2:
706
+ return _this._config.speed / len * (len - i - 1);
707
+ }
708
+ })();
709
+ panel.style[css.transitionDuration] = duration + 'ms';
710
+ panel.style[css.transitionDelay] = delayMs + 'ms';
711
+ if (this._shading) {
712
+ _ref1 = (__indexOf.call(anchorListV, anchor) >= 0 ? anchorListV : anchorListH);
713
+ for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
714
+ side = _ref1[_i];
715
+ shader = this._shaders[anchor][side][i];
716
+ shader.style[css.transitionDuration] = duration + 'ms';
717
+ shader.style[css.transitionDelay] = delayMs + 'ms';
718
+ }
719
+ }
720
+ return delayMs;
721
+ };
722
+
723
+ OriDomi.prototype._setShader = function(n, anchor, angle) {
724
+ var a, abs, b, opacity;
725
+ abs = Math.abs(angle);
726
+ opacity = abs / 90 * this._config.shadingIntensity;
727
+ if (this._shading === 'hard') {
728
+ opacity *= .15;
729
+ if (this._lastOp.angle < 0) {
730
+ angle = abs;
731
+ } else {
732
+ angle = -abs;
733
+ }
734
+ } else {
735
+ opacity *= .4;
736
+ }
737
+ if (__indexOf.call(anchorListV, anchor) >= 0) {
738
+ if (angle < 0) {
739
+ a = opacity;
740
+ b = 0;
741
+ } else {
742
+ a = 0;
743
+ b = opacity;
744
+ }
745
+ this._shaders[anchor].left[n].style.opacity = a;
746
+ return this._shaders[anchor].right[n].style.opacity = b;
747
+ } else {
748
+ if (angle < 0) {
749
+ a = 0;
750
+ b = opacity;
751
+ } else {
752
+ a = opacity;
753
+ b = 0;
754
+ }
755
+ this._shaders[anchor].top[n].style.opacity = a;
756
+ return this._shaders[anchor].bottom[n].style.opacity = b;
757
+ }
758
+ };
759
+
760
+ OriDomi.prototype._showStage = function(anchor) {
761
+ var _this = this;
762
+ if (anchor !== this._lastOp.anchor) {
763
+ hideEl(this._stages[this._lastOp.anchor]);
764
+ this._lastOp.anchor = anchor;
765
+ this._lastOp.reset = true;
766
+ return this._stages[anchor].style[css.transform] = 'translate3d(' + (function() {
767
+ switch (anchor) {
768
+ case 'left':
769
+ return '0, 0, 0)';
770
+ case 'right':
771
+ return "-" + (_this._config.vPanels * 1) + "px, 0, 0)";
772
+ case 'top':
773
+ return '0, 0, 0)';
774
+ case 'bottom':
775
+ return "0, -" + ((_this._config.hPanels + 2) * 1) + "px, 0)";
776
+ }
777
+ })();
778
+ }
779
+ };
780
+
781
+ OriDomi.prototype._stageReset = function(anchor, cb) {
782
+ var fn,
783
+ _this = this;
784
+ fn = function(e) {
785
+ if (e) {
786
+ e.currentTarget.removeEventListener(css.transitionEnd, fn, false);
787
+ }
788
+ _this._showStage(anchor);
789
+ return defer(cb);
790
+ };
791
+ if (this._lastOp.angle === 0) {
792
+ return fn();
793
+ }
794
+ this._panels[this._lastOp.anchor][0].addEventListener(css.transitionEnd, fn, false);
795
+ return this._iterate(this._lastOp.anchor, function(panel, i) {
796
+ _this._transformPanel(panel, 0, _this._lastOp.anchor);
797
+ if (_this._shading) {
798
+ return _this._setShader(i, _this._lastOp.anchor, 0);
799
+ }
800
+ });
801
+ };
802
+
803
+ OriDomi.prototype._getLonghandAnchor = function(shorthand) {
804
+ switch (shorthand.toString()) {
805
+ case 'left':
806
+ case 'l':
807
+ case '4':
808
+ return 'left';
809
+ case 'right':
810
+ case 'r':
811
+ case '2':
812
+ return 'right';
813
+ case 'top':
814
+ case 't':
815
+ case '1':
816
+ return 'top';
817
+ case 'bottom':
818
+ case 'b':
819
+ case '3':
820
+ return 'bottom';
821
+ default:
822
+ return 'left';
823
+ }
824
+ };
825
+
826
+ OriDomi.prototype._setCursor = function(bool) {
827
+ if (bool == null) {
828
+ bool = this._touchEnabled;
829
+ }
830
+ if (bool) {
831
+ return this.el.style.cursor = css.grab;
832
+ } else {
833
+ return this.el.style.cursor = 'default';
834
+ }
835
+ };
836
+
837
+ OriDomi.prototype._setTouch = function(toggle) {
838
+ var eString, eventPair, eventPairs, listenFn, mouseLeaveSupport, _i, _j, _len, _len1;
839
+ if (toggle) {
840
+ if (this._touchEnabled) {
841
+ return this;
842
+ }
843
+ listenFn = 'addEventListener';
844
+ } else {
845
+ if (!this._touchEnabled) {
846
+ return this;
847
+ }
848
+ listenFn = 'removeEventListener';
849
+ }
850
+ this._touchEnabled = toggle;
851
+ this._setCursor();
852
+ eventPairs = [['TouchStart', 'MouseDown'], ['TouchEnd', 'MouseUp'], ['TouchMove', 'MouseMove'], ['TouchLeave', 'MouseLeave']];
853
+ mouseLeaveSupport = 'onmouseleave' in window;
854
+ for (_i = 0, _len = eventPairs.length; _i < _len; _i++) {
855
+ eventPair = eventPairs[_i];
856
+ for (_j = 0, _len1 = eventPair.length; _j < _len1; _j++) {
857
+ eString = eventPair[_j];
858
+ if (!(eString === 'TouchLeave' && !mouseLeaveSupport)) {
859
+ this.el[listenFn](eString.toLowerCase(), this['_on' + eventPair[0]], false);
860
+ } else {
861
+ this.el[listenFn]('mouseout', this._onMouseOut, false);
862
+ break;
863
+ }
864
+ }
865
+ }
866
+ return this;
867
+ };
868
+
869
+ OriDomi.prototype._onTouchStart = function(e) {
870
+ var axis1, _ref1;
871
+ if (!this._touchEnabled || this.isFoldedUp) {
872
+ return;
873
+ }
874
+ e.preventDefault();
875
+ this.emptyQueue();
876
+ this._touchStarted = true;
877
+ this.el.style.cursor = css.grabbing;
878
+ this._setTrans(0, 0);
879
+ this._touchAxis = (_ref1 = this._lastOp.anchor, __indexOf.call(anchorListV, _ref1) >= 0) ? 'x' : 'y';
880
+ this["_" + this._touchAxis + "Last"] = this._lastOp.angle;
881
+ axis1 = "_" + this._touchAxis + "1";
882
+ if (e.type === 'mousedown') {
883
+ this[axis1] = e["page" + (this._touchAxis.toUpperCase())];
884
+ } else {
885
+ this[axis1] = e.targetTouches[0]["page" + (this._touchAxis.toUpperCase())];
886
+ }
887
+ return this._config.touchStartCallback(this[axis1], e);
888
+ };
889
+
890
+ OriDomi.prototype._onTouchMove = function(e) {
891
+ var current, delta, distance;
892
+ if (!(this._touchEnabled && this._touchStarted)) {
893
+ return;
894
+ }
895
+ e.preventDefault();
896
+ if (e.type === 'mousemove') {
897
+ current = e["page" + (this._touchAxis.toUpperCase())];
898
+ } else {
899
+ current = e.targetTouches[0]["page" + (this._touchAxis.toUpperCase())];
900
+ }
901
+ distance = (current - this["_" + this._touchAxis + "1"]) * this._config.touchSensitivity;
902
+ if (this._lastOp.angle < 0) {
903
+ if (this._lastOp.anchor === 'right' || this._lastOp.anchor === 'bottom') {
904
+ delta = this["_" + this._touchAxis + "Last"] - distance;
905
+ } else {
906
+ delta = this["_" + this._touchAxis + "Last"] + distance;
907
+ }
908
+ if (delta > 0) {
909
+ delta = 0;
910
+ }
911
+ } else {
912
+ if (this._lastOp.anchor === 'right' || this._lastOp.anchor === 'bottom') {
913
+ delta = this["_" + this._touchAxis + "Last"] + distance;
914
+ } else {
915
+ delta = this["_" + this._touchAxis + "Last"] - distance;
916
+ }
917
+ if (delta < 0) {
918
+ delta = 0;
919
+ }
920
+ }
921
+ this._lastOp.angle = delta = this._normalizeAngle(delta);
922
+ this._lastOp.fn.call(this, delta, this._lastOp.anchor, this._lastOp.options);
923
+ return this._config.touchMoveCallback(delta, e);
924
+ };
925
+
926
+ OriDomi.prototype._onTouchEnd = function(e) {
927
+ if (!this._touchEnabled) {
928
+ return;
929
+ }
930
+ this._touchStarted = this._inTrans = false;
931
+ this.el.style.cursor = css.grab;
932
+ this._setTrans(this._config.speed, this._config.ripple);
933
+ return this._config.touchEndCallback(this["_" + this._touchAxis + "Last"], e);
934
+ };
935
+
936
+ OriDomi.prototype._onTouchLeave = function(e) {
937
+ if (!(this._touchEnabled && this._touchStarted)) {
938
+ return;
939
+ }
940
+ return this._onTouchEnd(e);
941
+ };
942
+
943
+ OriDomi.prototype._onMouseOut = function(e) {
944
+ if (!(this._touchEnabled && this._touchStarted)) {
945
+ return;
946
+ }
947
+ if (e.toElement && !this.el.contains(e.toElement)) {
948
+ return this._onTouchEnd(e);
949
+ }
950
+ };
951
+
952
+ OriDomi.prototype._unfold = function(callback) {
953
+ var anchor,
954
+ _this = this;
955
+ this._inTrans = true;
956
+ anchor = this._lastOp.anchor;
957
+ return this._iterate(anchor, function(panel, i, len) {
958
+ var delay;
959
+ delay = _this._setPanelTrans.apply(_this, [anchor].concat(__slice.call(arguments), [_this._config.speed], [1]));
960
+ return (function(panel, i, delay) {
961
+ return defer(function() {
962
+ _this._transformPanel(panel, 0, _this._lastOp.anchor);
963
+ return setTimeout(function() {
964
+ showEl(panel.children[0]);
965
+ if (i === len - 1) {
966
+ _this._inTrans = _this.isFoldedUp = false;
967
+ if (typeof callback === "function") {
968
+ callback();
969
+ }
970
+ _this._lastOp.fn = _this.accordion;
971
+ _this._lastOp.angle = 0;
972
+ }
973
+ return defer(function() {
974
+ return panel.style[css.transitionDuration] = _this._config.speed;
975
+ });
976
+ }, delay + _this._config.speed * .25);
977
+ });
978
+ })(panel, i, delay);
979
+ });
980
+ };
981
+
982
+ OriDomi.prototype._iterate = function(anchor, fn) {
983
+ var i, panel, panels, _i, _len, _ref1, _results;
984
+ _ref1 = panels = this._panels[anchor];
985
+ _results = [];
986
+ for (i = _i = 0, _len = _ref1.length; _i < _len; i = ++_i) {
987
+ panel = _ref1[i];
988
+ _results.push(fn.call(this, panel, i, panels.length));
989
+ }
990
+ return _results;
991
+ };
992
+
993
+ OriDomi.prototype.enableTouch = function() {
994
+ return this._setTouch(true);
995
+ };
996
+
997
+ OriDomi.prototype.disableTouch = function() {
998
+ return this._setTouch(false);
999
+ };
1000
+
1001
+ OriDomi.prototype.setSpeed = function(speed) {
1002
+ var anchor, _i, _len;
1003
+ for (_i = 0, _len = anchorList.length; _i < _len; _i++) {
1004
+ anchor = anchorList[_i];
1005
+ this._setTrans((this._config.speed = speed), this._config.ripple, anchor);
1006
+ }
1007
+ return this;
1008
+ };
1009
+
1010
+ OriDomi.prototype.freeze = function(callback) {
1011
+ var _this = this;
1012
+ if (this.isFrozen) {
1013
+ if (typeof callback === "function") {
1014
+ callback();
1015
+ }
1016
+ } else {
1017
+ this._stageReset(this._lastOp.anchor, function() {
1018
+ _this.isFrozen = true;
1019
+ hideEl(_this._stageHolder);
1020
+ showEl(_this._cloneEl);
1021
+ _this._setCursor(false);
1022
+ return typeof callback === "function" ? callback() : void 0;
1023
+ });
1024
+ }
1025
+ return this;
1026
+ };
1027
+
1028
+ OriDomi.prototype.unfreeze = function() {
1029
+ if (this.isFrozen) {
1030
+ this.isFrozen = false;
1031
+ hideEl(this._cloneEl);
1032
+ showEl(this._stageHolder);
1033
+ this._setCursor();
1034
+ this._lastOp.angle = 0;
1035
+ }
1036
+ return this;
1037
+ };
1038
+
1039
+ OriDomi.prototype.destroy = function(callback) {
1040
+ var _this = this;
1041
+ this.freeze(function() {
1042
+ _this._setTouch(false);
1043
+ if ($) {
1044
+ $.data(_this.el, baseName, null);
1045
+ }
1046
+ _this.el.innerHTML = _this._cloneEl.innerHTML;
1047
+ _this.el.classList.remove(elClasses.active);
1048
+ return typeof callback === "function" ? callback() : void 0;
1049
+ });
1050
+ return null;
1051
+ };
1052
+
1053
+ OriDomi.prototype.emptyQueue = function() {
1054
+ var _this = this;
1055
+ this._queue = [];
1056
+ defer(function() {
1057
+ return _this._inTrans = false;
1058
+ });
1059
+ return this;
1060
+ };
1061
+
1062
+ OriDomi.prototype.setRipple = function(dir) {
1063
+ if (dir == null) {
1064
+ dir = 1;
1065
+ }
1066
+ this._config.ripple = Number(dir);
1067
+ this.setSpeed(this._config.speed);
1068
+ return this;
1069
+ };
1070
+
1071
+ OriDomi.prototype.constrainAngle = function(angle) {
1072
+ this._config.maxAngle = parseFloat(angle, 10) || defaults.maxAngle;
1073
+ return this;
1074
+ };
1075
+
1076
+ OriDomi.prototype.wait = function(ms) {
1077
+ var fn,
1078
+ _this = this;
1079
+ fn = function() {
1080
+ return setTimeout(_this._conclude, ms);
1081
+ };
1082
+ if (this._inTrans) {
1083
+ this._queue.push([fn, this._lastOp.angle, this._lastOp.anchor, this._lastOp.options]);
1084
+ } else {
1085
+ fn();
1086
+ }
1087
+ return this;
1088
+ };
1089
+
1090
+ OriDomi.prototype.modifyContent = function(fn) {
1091
+ var anchor, i, panel, selectors, set, _i, _j, _len, _len1, _ref1;
1092
+ if (typeof fn !== 'function') {
1093
+ selectors = fn;
1094
+ set = function(el, content, style) {
1095
+ var key, value;
1096
+ if (content) {
1097
+ el.innerHTML = content;
1098
+ }
1099
+ if (style) {
1100
+ for (key in style) {
1101
+ value = style[key];
1102
+ el.style[key] = value;
1103
+ }
1104
+ return null;
1105
+ }
1106
+ };
1107
+ fn = function(el) {
1108
+ var content, match, selector, style, value, _i, _len, _ref1;
1109
+ for (selector in selectors) {
1110
+ value = selectors[selector];
1111
+ content = style = null;
1112
+ if (typeof value === 'string') {
1113
+ content = value;
1114
+ } else {
1115
+ content = value.content, style = value.style;
1116
+ }
1117
+ if (selector === '') {
1118
+ set(el, content, style);
1119
+ continue;
1120
+ }
1121
+ _ref1 = el.querySelectorAll(selector);
1122
+ for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
1123
+ match = _ref1[_i];
1124
+ set(match, content, style);
1125
+ }
1126
+ }
1127
+ return null;
1128
+ };
1129
+ }
1130
+ for (_i = 0, _len = anchorList.length; _i < _len; _i++) {
1131
+ anchor = anchorList[_i];
1132
+ _ref1 = this._panels[anchor];
1133
+ for (i = _j = 0, _len1 = _ref1.length; _j < _len1; i = ++_j) {
1134
+ panel = _ref1[i];
1135
+ fn(panel.children[0].children[0], i, anchor);
1136
+ }
1137
+ }
1138
+ return this;
1139
+ };
1140
+
1141
+ OriDomi.prototype.accordion = prep(function(angle, anchor, options) {
1142
+ var _this = this;
1143
+ return this._iterate(anchor, function(panel, i) {
1144
+ var deg;
1145
+ if (i % 2 !== 0 && !options.twist) {
1146
+ deg = -angle;
1147
+ } else {
1148
+ deg = angle;
1149
+ }
1150
+ if (options.sticky) {
1151
+ if (i === 0) {
1152
+ deg = 0;
1153
+ } else if (i > 1 || options.stairs) {
1154
+ deg *= 2;
1155
+ }
1156
+ } else {
1157
+ if (i !== 0) {
1158
+ deg *= 2;
1159
+ }
1160
+ }
1161
+ if (options.stairs) {
1162
+ deg *= -1;
1163
+ }
1164
+ _this._transformPanel(panel, deg, anchor, options.fracture);
1165
+ if (_this._shading && !(i === 0 && options.sticky) && Math.abs(deg) !== 180) {
1166
+ return _this._setShader(i, anchor, deg);
1167
+ }
1168
+ });
1169
+ });
1170
+
1171
+ OriDomi.prototype.curl = prep(function(angle, anchor, options) {
1172
+ var _this = this;
1173
+ angle /= __indexOf.call(anchorListV, anchor) >= 0 ? this._config.vPanels : this._config.hPanels;
1174
+ return this._iterate(anchor, function(panel, i) {
1175
+ _this._transformPanel(panel, angle, anchor);
1176
+ if (_this._shading) {
1177
+ return _this._setShader(i, anchor, 0);
1178
+ }
1179
+ });
1180
+ });
1181
+
1182
+ OriDomi.prototype.ramp = prep(function(angle, anchor, options) {
1183
+ var _this = this;
1184
+ this._transformPanel(this._panels[anchor][1], angle, anchor);
1185
+ return this._iterate(anchor, function(panel, i) {
1186
+ if (i !== 1) {
1187
+ _this._transformPanel(panel, 0, anchor);
1188
+ }
1189
+ if (_this._shading) {
1190
+ return _this._setShader(i, anchor, 0);
1191
+ }
1192
+ });
1193
+ });
1194
+
1195
+ OriDomi.prototype.foldUp = prep(function(anchor, callback) {
1196
+ var _this = this;
1197
+ if (this.isFoldedUp) {
1198
+ return typeof callback === "function" ? callback() : void 0;
1199
+ }
1200
+ return this._stageReset(anchor, function() {
1201
+ _this._inTrans = _this.isFoldedUp = true;
1202
+ return _this._iterate(anchor, function(panel, i, len) {
1203
+ var delay, duration;
1204
+ duration = _this._config.speed;
1205
+ if (i === 0) {
1206
+ duration /= 2;
1207
+ }
1208
+ delay = _this._setPanelTrans.apply(_this, [anchor].concat(__slice.call(arguments), [duration], [2]));
1209
+ return (function(panel, i, delay) {
1210
+ return defer(function() {
1211
+ _this._transformPanel(panel, (i === 0 ? 90 : 170), anchor);
1212
+ return setTimeout(function() {
1213
+ if (i === 0) {
1214
+ _this._inTrans = false;
1215
+ return typeof callback === "function" ? callback() : void 0;
1216
+ } else {
1217
+ return hideEl(panel.children[0]);
1218
+ }
1219
+ }, delay + _this._config.speed * .25);
1220
+ });
1221
+ })(panel, i, delay);
1222
+ });
1223
+ });
1224
+ });
1225
+
1226
+ OriDomi.prototype.unfold = prep(function(callback) {
1227
+ return this._unfold.apply(this, arguments);
1228
+ });
1229
+
1230
+ OriDomi.prototype.map = function(fn) {
1231
+ var _this = this;
1232
+ return prep(function(angle, anchor, options) {
1233
+ return _this._iterate(anchor, function(panel, i, len) {
1234
+ return _this._transformPanel(panel, fn(angle, i, len), anchor, options.fracture);
1235
+ });
1236
+ }).bind(this);
1237
+ };
1238
+
1239
+ OriDomi.prototype.reset = function(callback) {
1240
+ return this.accordion(0, {
1241
+ callback: callback
1242
+ });
1243
+ };
1244
+
1245
+ OriDomi.prototype.reveal = function(angle, anchor, options) {
1246
+ if (options == null) {
1247
+ options = {};
1248
+ }
1249
+ options.sticky = true;
1250
+ return this.accordion(angle, anchor, options);
1251
+ };
1252
+
1253
+ OriDomi.prototype.stairs = function(angle, anchor, options) {
1254
+ if (options == null) {
1255
+ options = {};
1256
+ }
1257
+ options.stairs = options.sticky = true;
1258
+ return this.accordion(angle, anchor, options);
1259
+ };
1260
+
1261
+ OriDomi.prototype.fracture = function(angle, anchor, options) {
1262
+ if (options == null) {
1263
+ options = {};
1264
+ }
1265
+ options.fracture = true;
1266
+ return this.accordion(angle, anchor, options);
1267
+ };
1268
+
1269
+ OriDomi.prototype.twist = function(angle, anchor, options) {
1270
+ if (options == null) {
1271
+ options = {};
1272
+ }
1273
+ options.fracture = options.twist = true;
1274
+ return this.accordion(angle / 10, anchor, options);
1275
+ };
1276
+
1277
+ OriDomi.prototype.collapse = function(anchor, options) {
1278
+ if (options == null) {
1279
+ options = {};
1280
+ }
1281
+ options.sticky = false;
1282
+ return this.accordion(-this._config.maxAngle, anchor, options);
1283
+ };
1284
+
1285
+ OriDomi.prototype.collapseAlt = function(anchor, options) {
1286
+ if (options == null) {
1287
+ options = {};
1288
+ }
1289
+ options.sticky = false;
1290
+ return this.accordion(this._config.maxAngle, anchor, options);
1291
+ };
1292
+
1293
+ OriDomi.VERSION = '1.0.2';
1294
+
1295
+ OriDomi.isSupported = isSupported;
1296
+
1297
+ return OriDomi;
1298
+
1299
+ })();
1300
+
1301
+ if (typeof module !== "undefined" && module !== null ? module.exports : void 0) {
1302
+ module.exports = OriDomi;
1303
+ } else if (typeof define !== "undefined" && define !== null ? define.amd : void 0) {
1304
+ define(function() {
1305
+ return OriDomi;
1306
+ });
1307
+ } else {
1308
+ window.OriDomi = OriDomi;
1309
+ }
1310
+
1311
+ if (!$) {
1312
+ return;
1313
+ }
1314
+
1315
+ $.prototype.oriDomi = function(options) {
1316
+ var el, instance, method, methodName, _i, _j, _len, _len1;
1317
+ if (!isSupported) {
1318
+ return this;
1319
+ }
1320
+ if (options === true) {
1321
+ return $.data(this[0], baseName);
1322
+ }
1323
+ if (typeof options === 'string') {
1324
+ methodName = options;
1325
+ if (typeof (method = OriDomi.prototype[methodName]) !== 'function') {
1326
+ if (typeof console !== "undefined" && console !== null) {
1327
+ console.warn("OriDomi: No such method `" + methodName + "`");
1328
+ }
1329
+ return this;
1330
+ }
1331
+ for (_i = 0, _len = this.length; _i < _len; _i++) {
1332
+ el = this[_i];
1333
+ if (!(instance = $.data(el, baseName))) {
1334
+ instance = $.data(el, baseName, new OriDomi(el, options));
1335
+ }
1336
+ method.apply(instance, Array.prototype.slice.call(arguments).slice(1));
1337
+ }
1338
+ } else {
1339
+ for (_j = 0, _len1 = this.length; _j < _len1; _j++) {
1340
+ el = this[_j];
1341
+ if (instance = $.data(el, baseName)) {
1342
+ continue;
1343
+ } else {
1344
+ $.data(el, baseName, new OriDomi(el, options));
1345
+ }
1346
+ }
1347
+ }
1348
+ return this;
1349
+ };
1350
+
1351
+ }).call(this);
1352
+
1353
+ /*
1354
+ //@ sourceMappingURL=oridomi.map
1355
+ */