locomotivecms_wagon 2.2.0.beta1 → 2.2.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (219) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +2 -1
  3. data/generators/blank/config/metafields_schema.yml +1 -1
  4. data/generators/bootstrap/config/metafields_schema.yml +1 -1
  5. data/generators/{foundation5 → foundation}/Gemfile.tt +1 -1
  6. data/generators/{foundation5 → foundation}/Guardfile +0 -0
  7. data/generators/foundation/app/content_types/.gitkeep +0 -0
  8. data/generators/foundation/app/views/pages/404.liquid +11 -0
  9. data/generators/{foundation5 → foundation}/app/views/pages/404.liquid.haml +4 -3
  10. data/generators/{foundation5 → foundation}/app/views/pages/index.liquid +54 -78
  11. data/generators/foundation/app/views/pages/index.liquid.haml +144 -0
  12. data/generators/foundation/app/views/snippets/.gitkeep +0 -0
  13. data/generators/{foundation5 → foundation}/config/deploy.yml +2 -1
  14. data/generators/{foundation5 → foundation}/config/metafields_schema.yml +1 -1
  15. data/generators/{foundation5/config/site.yml.tt → foundation/config/site.yml} +2 -2
  16. data/generators/{foundation5 → foundation}/config/translations.yml +0 -0
  17. data/generators/foundation/data/.gitkeep +0 -0
  18. data/generators/foundation/log/.gitkeep +0 -0
  19. data/generators/foundation/public/images/.gitkeep +0 -0
  20. data/generators/foundation/public/javascripts/app.js +1 -0
  21. data/generators/foundation/public/javascripts/vendor/foundation.js +7472 -0
  22. data/generators/foundation/public/javascripts/vendor/foundation.min.js +3 -0
  23. data/generators/foundation/public/javascripts/vendor/what-input.js +212 -0
  24. data/generators/foundation/public/javascripts/vendor/what-input.min.js +1 -0
  25. data/generators/foundation/public/stylesheets/_settings.scss +529 -0
  26. data/generators/foundation/public/stylesheets/app.css +3 -0
  27. data/generators/foundation/public/stylesheets/app.scss +43 -0
  28. data/generators/foundation/public/stylesheets/foundation.css +3499 -0
  29. data/generators/foundation/public/stylesheets/foundation6/_global.scss +197 -0
  30. data/generators/foundation/public/stylesheets/foundation6/components/_accordion-menu.scss +28 -0
  31. data/generators/foundation/public/stylesheets/foundation6/components/_accordion.scss +112 -0
  32. data/generators/foundation/public/stylesheets/foundation6/components/_badge.scss +55 -0
  33. data/generators/foundation/public/stylesheets/foundation6/components/_breadcrumbs.scss +94 -0
  34. data/generators/foundation/public/stylesheets/foundation6/components/_button-group.scss +115 -0
  35. data/generators/foundation/public/stylesheets/foundation6/components/_button.scss +264 -0
  36. data/generators/foundation/public/stylesheets/foundation6/components/_callout.scss +115 -0
  37. data/generators/foundation/public/stylesheets/foundation6/components/_close-button.scss +61 -0
  38. data/generators/foundation/public/stylesheets/foundation6/components/_drilldown.scss +67 -0
  39. data/generators/foundation/public/stylesheets/foundation6/components/_dropdown-menu.scss +123 -0
  40. data/generators/foundation/public/stylesheets/foundation6/components/_dropdown.scss +64 -0
  41. data/generators/foundation/public/stylesheets/foundation6/components/_flex-video.scss +68 -0
  42. data/generators/foundation/public/stylesheets/foundation6/components/_float.scss +27 -0
  43. data/generators/foundation/public/stylesheets/foundation6/components/_label.scss +56 -0
  44. data/generators/foundation/public/stylesheets/foundation6/components/_media-object.scss +74 -0
  45. data/generators/foundation/public/stylesheets/foundation6/components/_menu.scss +213 -0
  46. data/generators/foundation/public/stylesheets/foundation6/components/_off-canvas.scss +170 -0
  47. data/generators/foundation/public/stylesheets/foundation6/components/_orbit.scss +186 -0
  48. data/generators/foundation/public/stylesheets/foundation6/components/_pagination.scss +161 -0
  49. data/generators/foundation/public/stylesheets/foundation6/components/_progress-bar.scss +83 -0
  50. data/generators/foundation/public/stylesheets/foundation6/components/_reveal.scss +155 -0
  51. data/generators/foundation/public/stylesheets/foundation6/components/_slider.scss +158 -0
  52. data/generators/foundation/public/stylesheets/foundation6/components/_sticky.scss +38 -0
  53. data/generators/foundation/public/stylesheets/foundation6/components/_switch.scss +231 -0
  54. data/generators/foundation/public/stylesheets/foundation6/components/_table.scss +212 -0
  55. data/generators/foundation/public/stylesheets/foundation6/components/_tabs.scss +137 -0
  56. data/generators/foundation/public/stylesheets/foundation6/components/_thumbnail.scss +54 -0
  57. data/generators/foundation/public/stylesheets/foundation6/components/_title-bar.scss +44 -0
  58. data/generators/foundation/public/stylesheets/foundation6/components/_tooltip.scss +110 -0
  59. data/generators/foundation/public/stylesheets/foundation6/components/_top-bar.scss +57 -0
  60. data/generators/foundation/public/stylesheets/foundation6/components/_visibility.scss +131 -0
  61. data/generators/foundation/public/stylesheets/foundation6/forms/_checkbox.scss +36 -0
  62. data/generators/foundation/public/stylesheets/foundation6/forms/_error.scss +81 -0
  63. data/generators/foundation/public/stylesheets/foundation6/forms/_fieldset.scss +53 -0
  64. data/generators/foundation/public/stylesheets/foundation6/forms/_forms.scss +32 -0
  65. data/generators/foundation/public/stylesheets/foundation6/forms/_help-text.scss +30 -0
  66. data/generators/foundation/public/stylesheets/foundation6/forms/_input-group.scss +70 -0
  67. data/generators/foundation/public/stylesheets/foundation6/forms/_label.scss +48 -0
  68. data/generators/foundation/public/stylesheets/foundation6/forms/_select.scss +64 -0
  69. data/generators/foundation/public/stylesheets/foundation6/forms/_text.scss +153 -0
  70. data/generators/foundation/public/stylesheets/foundation6/foundation.scss +91 -0
  71. data/generators/foundation/public/stylesheets/foundation6/grid/_classes.scss +132 -0
  72. data/generators/foundation/public/stylesheets/foundation6/grid/_column.scss +112 -0
  73. data/generators/foundation/public/stylesheets/foundation6/grid/_flex-grid.scss +191 -0
  74. data/generators/foundation/public/stylesheets/foundation6/grid/_grid.scss +33 -0
  75. data/generators/foundation/public/stylesheets/foundation6/grid/_gutter.scss +31 -0
  76. data/generators/foundation/public/stylesheets/foundation6/grid/_layout.scss +32 -0
  77. data/generators/foundation/public/stylesheets/foundation6/grid/_position.scss +71 -0
  78. data/generators/foundation/public/stylesheets/foundation6/grid/_row.scss +72 -0
  79. data/generators/foundation/public/stylesheets/foundation6/grid/_size.scss +24 -0
  80. data/generators/foundation/public/stylesheets/foundation6/motion-ui/_classes.scss +102 -0
  81. data/generators/foundation/public/stylesheets/foundation6/motion-ui/_settings.scss +61 -0
  82. data/generators/foundation/public/stylesheets/foundation6/motion-ui/effects/_fade.scss +29 -0
  83. data/generators/foundation/public/stylesheets/foundation6/motion-ui/effects/_hinge.scss +65 -0
  84. data/generators/foundation/public/stylesheets/foundation6/motion-ui/effects/_shake.scss +15 -0
  85. data/generators/foundation/public/stylesheets/foundation6/motion-ui/effects/_slide.scss +41 -0
  86. data/generators/foundation/public/stylesheets/foundation6/motion-ui/effects/_spin.scss +28 -0
  87. data/generators/foundation/public/stylesheets/foundation6/motion-ui/effects/_wiggle.scss +13 -0
  88. data/generators/foundation/public/stylesheets/foundation6/motion-ui/effects/_zoom.scss +15 -0
  89. data/generators/foundation/public/stylesheets/foundation6/motion-ui/motion-ui.scss +29 -0
  90. data/generators/foundation/public/stylesheets/foundation6/motion-ui/transitions/_fade.scss +28 -0
  91. data/generators/foundation/public/stylesheets/foundation6/motion-ui/transitions/_hinge.scss +43 -0
  92. data/generators/foundation/public/stylesheets/foundation6/motion-ui/transitions/_slide.scss +42 -0
  93. data/generators/foundation/public/stylesheets/foundation6/motion-ui/transitions/_spin.scss +39 -0
  94. data/generators/foundation/public/stylesheets/foundation6/motion-ui/transitions/_zoom.scss +39 -0
  95. data/generators/foundation/public/stylesheets/foundation6/motion-ui/util/_animation.scss +7 -0
  96. data/generators/foundation/public/stylesheets/foundation6/motion-ui/util/_args.scss +15 -0
  97. data/generators/foundation/public/stylesheets/foundation6/motion-ui/util/_keyframe.scss +136 -0
  98. data/generators/foundation/public/stylesheets/foundation6/motion-ui/util/_selector.scss +23 -0
  99. data/generators/foundation/public/stylesheets/foundation6/motion-ui/util/_series.scss +54 -0
  100. data/generators/foundation/public/stylesheets/foundation6/motion-ui/util/_transition.scss +45 -0
  101. data/generators/foundation/public/stylesheets/foundation6/motion-ui/util/_unit.scss +7 -0
  102. data/generators/foundation/public/stylesheets/foundation6/motion-ui.scss +4 -0
  103. data/generators/foundation/public/stylesheets/foundation6/settings/_settings.scss +531 -0
  104. data/generators/foundation/public/stylesheets/foundation6/typography/_alignment.scss +21 -0
  105. data/generators/foundation/public/stylesheets/foundation6/typography/_base.scss +436 -0
  106. data/generators/foundation/public/stylesheets/foundation6/typography/_helpers.scss +77 -0
  107. data/generators/foundation/public/stylesheets/foundation6/typography/_print.scss +73 -0
  108. data/generators/foundation/public/stylesheets/foundation6/typography/_typography.scss +28 -0
  109. data/generators/foundation/public/stylesheets/foundation6/util/_breakpoint.scss +182 -0
  110. data/generators/foundation/public/stylesheets/foundation6/util/_color.scss +41 -0
  111. data/generators/foundation/public/stylesheets/foundation6/util/_mixins.scss +190 -0
  112. data/generators/foundation/public/stylesheets/foundation6/util/_selector.scss +39 -0
  113. data/generators/foundation/public/stylesheets/foundation6/util/_unit.scss +69 -0
  114. data/generators/foundation/public/stylesheets/foundation6/util/_util.scss +15 -0
  115. data/generators/foundation/public/stylesheets/foundation6/util/_value.scss +117 -0
  116. data/generators/{foundation5/public/stylesheets/normalize.css.scss → foundation/public/stylesheets/foundation6/vendor/normalize.scss} +8 -11
  117. data/generators/site_metafields/schema.yml.tt +1 -1
  118. data/lib/locomotive/wagon/commands/push_command.rb +1 -0
  119. data/lib/locomotive/wagon/commands/serve_command.rb +1 -0
  120. data/lib/locomotive/wagon/decorators/concerns/persist_assets_concern.rb +3 -3
  121. data/lib/locomotive/wagon/decorators/content_type_decorator.rb +5 -1
  122. data/lib/locomotive/wagon/generators/site/{foundation5.rb → foundation.rb} +8 -12
  123. data/lib/locomotive/wagon/generators/site.rb +1 -1
  124. data/lib/locomotive/wagon/version.rb +1 -1
  125. data/locomotivecms_wagon.gemspec +3 -2
  126. data/spec/fixtures/cassettes/authenticate.yml +38 -38
  127. data/spec/fixtures/cassettes/delete.yml +211 -211
  128. data/spec/fixtures/cassettes/push.yml +1333 -1374
  129. data/spec/integration/cli_spec.rb +1 -1
  130. data/spec/unit/decorators/content_entry_decorator_spec.rb +23 -0
  131. metadata +133 -104
  132. data/generators/foundation5/app/content_types/.empty_directory +0 -1
  133. data/generators/foundation5/app/views/pages/404.liquid +0 -10
  134. data/generators/foundation5/app/views/pages/index.liquid.haml +0 -157
  135. data/generators/foundation5/data/.empty_directory +0 -1
  136. data/generators/foundation5/icon.png +0 -0
  137. data/generators/foundation5/public/fonts/.empty_directory +0 -1
  138. data/generators/foundation5/public/images/.empty_directory +0 -1
  139. data/generators/foundation5/public/javascripts/foundation/foundation.abide.js +0 -299
  140. data/generators/foundation5/public/javascripts/foundation/foundation.accordion.js +0 -59
  141. data/generators/foundation5/public/javascripts/foundation/foundation.alert.js +0 -43
  142. data/generators/foundation5/public/javascripts/foundation/foundation.clearing.js +0 -534
  143. data/generators/foundation5/public/javascripts/foundation/foundation.dropdown.js +0 -311
  144. data/generators/foundation5/public/javascripts/foundation/foundation.equalizer.js +0 -74
  145. data/generators/foundation5/public/javascripts/foundation/foundation.interchange.js +0 -331
  146. data/generators/foundation5/public/javascripts/foundation/foundation.joyride.js +0 -843
  147. data/generators/foundation5/public/javascripts/foundation/foundation.js +0 -611
  148. data/generators/foundation5/public/javascripts/foundation/foundation.magellan.js +0 -178
  149. data/generators/foundation5/public/javascripts/foundation/foundation.offcanvas.js +0 -108
  150. data/generators/foundation5/public/javascripts/foundation/foundation.orbit.js +0 -610
  151. data/generators/foundation5/public/javascripts/foundation/foundation.reveal.js +0 -437
  152. data/generators/foundation5/public/javascripts/foundation/foundation.slider.js +0 -199
  153. data/generators/foundation5/public/javascripts/foundation/foundation.tab.js +0 -167
  154. data/generators/foundation5/public/javascripts/foundation/foundation.tooltip.js +0 -298
  155. data/generators/foundation5/public/javascripts/foundation/foundation.topbar.js +0 -425
  156. data/generators/foundation5/public/javascripts/foundation.js +0 -4161
  157. data/generators/foundation5/public/javascripts/foundation.min.js +0 -10
  158. data/generators/foundation5/public/javascripts/vendor/custom.modernizr.js +0 -4
  159. data/generators/foundation5/public/javascripts/vendor/custom.modernizr.min.js +0 -1
  160. data/generators/foundation5/public/javascripts/vendor/fastclick.js +0 -9
  161. data/generators/foundation5/public/javascripts/vendor/fastclick.min.js +0 -11
  162. data/generators/foundation5/public/javascripts/vendor/jquery.autocomplete.js +0 -645
  163. data/generators/foundation5/public/javascripts/vendor/jquery.autocomplete.min.js +0 -1
  164. data/generators/foundation5/public/javascripts/vendor/jquery.cookie.js +0 -8
  165. data/generators/foundation5/public/javascripts/vendor/jquery.cookie.min.js +0 -8
  166. data/generators/foundation5/public/javascripts/vendor/jquery.js +0 -26
  167. data/generators/foundation5/public/javascripts/vendor/jquery.min.js +0 -27
  168. data/generators/foundation5/public/javascripts/vendor/modernizr.js +0 -8
  169. data/generators/foundation5/public/javascripts/vendor/modernizr.min.js +0 -1
  170. data/generators/foundation5/public/javascripts/vendor/placeholder.js +0 -2
  171. data/generators/foundation5/public/javascripts/vendor/placeholder.min.js +0 -1
  172. data/generators/foundation5/public/samples/.empty_directory +0 -1
  173. data/generators/foundation5/public/stylesheets/application.css +0 -2
  174. data/generators/foundation5/public/stylesheets/application.css.scss +0 -3
  175. data/generators/foundation5/public/stylesheets/foundation/_functions.scss +0 -102
  176. data/generators/foundation5/public/stylesheets/foundation/_settings.scss +0 -1441
  177. data/generators/foundation5/public/stylesheets/foundation/components/_accordion.scss +0 -157
  178. data/generators/foundation5/public/stylesheets/foundation/components/_alert-boxes.scss +0 -128
  179. data/generators/foundation5/public/stylesheets/foundation/components/_block-grid.scss +0 -132
  180. data/generators/foundation5/public/stylesheets/foundation/components/_breadcrumbs.scss +0 -132
  181. data/generators/foundation5/public/stylesheets/foundation/components/_button-groups.scss +0 -197
  182. data/generators/foundation5/public/stylesheets/foundation/components/_buttons.scss +0 -259
  183. data/generators/foundation5/public/stylesheets/foundation/components/_clearing.scss +0 -247
  184. data/generators/foundation5/public/stylesheets/foundation/components/_dropdown-buttons.scss +0 -130
  185. data/generators/foundation5/public/stylesheets/foundation/components/_dropdown.scss +0 -262
  186. data/generators/foundation5/public/stylesheets/foundation/components/_flex-video.scss +0 -51
  187. data/generators/foundation5/public/stylesheets/foundation/components/_forms.scss +0 -585
  188. data/generators/foundation5/public/stylesheets/foundation/components/_global.scss +0 -460
  189. data/generators/foundation5/public/stylesheets/foundation/components/_grid.scss +0 -275
  190. data/generators/foundation5/public/stylesheets/foundation/components/_icon-bar.scss +0 -293
  191. data/generators/foundation5/public/stylesheets/foundation/components/_inline-lists.scss +0 -57
  192. data/generators/foundation5/public/stylesheets/foundation/components/_joyride.scss +0 -222
  193. data/generators/foundation5/public/stylesheets/foundation/components/_keystrokes.scss +0 -61
  194. data/generators/foundation5/public/stylesheets/foundation/components/_labels.scss +0 -106
  195. data/generators/foundation5/public/stylesheets/foundation/components/_magellan.scss +0 -34
  196. data/generators/foundation5/public/stylesheets/foundation/components/_offcanvas.scss +0 -513
  197. data/generators/foundation5/public/stylesheets/foundation/components/_orbit.scss +0 -368
  198. data/generators/foundation5/public/stylesheets/foundation/components/_pagination.scss +0 -162
  199. data/generators/foundation5/public/stylesheets/foundation/components/_panels.scss +0 -95
  200. data/generators/foundation5/public/stylesheets/foundation/components/_pricing-tables.scss +0 -150
  201. data/generators/foundation5/public/stylesheets/foundation/components/_progress-bars.scss +0 -79
  202. data/generators/foundation5/public/stylesheets/foundation/components/_range-slider.scss +0 -168
  203. data/generators/foundation5/public/stylesheets/foundation/components/_reveal.scss +0 -222
  204. data/generators/foundation5/public/stylesheets/foundation/components/_side-nav.scss +0 -116
  205. data/generators/foundation5/public/stylesheets/foundation/components/_split-buttons.scss +0 -191
  206. data/generators/foundation5/public/stylesheets/foundation/components/_sub-nav.scss +0 -123
  207. data/generators/foundation5/public/stylesheets/foundation/components/_switches.scss +0 -230
  208. data/generators/foundation5/public/stylesheets/foundation/components/_tables.scss +0 -135
  209. data/generators/foundation5/public/stylesheets/foundation/components/_tabs.scss +0 -123
  210. data/generators/foundation5/public/stylesheets/foundation/components/_thumbs.scss +0 -66
  211. data/generators/foundation5/public/stylesheets/foundation/components/_toolbar.scss +0 -70
  212. data/generators/foundation5/public/stylesheets/foundation/components/_tooltips.scss +0 -142
  213. data/generators/foundation5/public/stylesheets/foundation/components/_top-bar.scss +0 -685
  214. data/generators/foundation5/public/stylesheets/foundation/components/_type.scss +0 -525
  215. data/generators/foundation5/public/stylesheets/foundation/components/_visibility.scss +0 -408
  216. data/generators/foundation5/public/stylesheets/foundation.css +0 -6138
  217. data/generators/foundation5/public/stylesheets/foundation.css.scss +0 -45
  218. data/generators/foundation5/public/stylesheets/normalize.css +0 -357
  219. data/lib/locomotive/wagon/generators/site/foundation4.rb +0 -34
@@ -1,534 +0,0 @@
1
- ;(function ($, window, document, undefined) {
2
- 'use strict';
3
-
4
- Foundation.libs.clearing = {
5
- name : 'clearing',
6
-
7
- version: '5.2.3',
8
-
9
- settings : {
10
- templates : {
11
- viewing : '<a href="#" class="clearing-close">&times;</a>' +
12
- '<div class="visible-img" style="display: none"><div class="clearing-touch-label"></div><img src="data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs%3D" alt="" />' +
13
- '<p class="clearing-caption"></p><a href="#" class="clearing-main-prev"><span></span></a>' +
14
- '<a href="#" class="clearing-main-next"><span></span></a></div>'
15
- },
16
-
17
- // comma delimited list of selectors that, on click, will close clearing,
18
- // add 'div.clearing-blackout, div.visible-img' to close on background click
19
- close_selectors : '.clearing-close',
20
-
21
- touch_label : '',
22
-
23
- // event initializers and locks
24
- init : false,
25
- locked : false
26
- },
27
-
28
- init : function (scope, method, options) {
29
- var self = this;
30
- Foundation.inherit(this, 'throttle image_loaded');
31
-
32
- this.bindings(method, options);
33
-
34
- if (self.S(this.scope).is('[' + this.attr_name() + ']')) {
35
- this.assemble(self.S('li', this.scope));
36
- } else {
37
- self.S('[' + this.attr_name() + ']', this.scope).each(function () {
38
- self.assemble(self.S('li', this));
39
- });
40
- }
41
- },
42
-
43
- events : function (scope) {
44
- var self = this,
45
- S = self.S,
46
- $scroll_container = $('.scroll-container');
47
-
48
- if ($scroll_container.length > 0) {
49
- this.scope = $scroll_container;
50
- }
51
-
52
- S(this.scope)
53
- .off('.clearing')
54
- .on('click.fndtn.clearing', 'ul[' + this.attr_name() + '] li',
55
- function (e, current, target) {
56
- var current = current || S(this),
57
- target = target || current,
58
- next = current.next('li'),
59
- settings = current.closest('[' + self.attr_name() + ']').data(self.attr_name(true) + '-init'),
60
- image = S(e.target);
61
-
62
- e.preventDefault();
63
-
64
- if (!settings) {
65
- self.init();
66
- settings = current.closest('[' + self.attr_name() + ']').data(self.attr_name(true) + '-init');
67
- }
68
-
69
- // if clearing is open and the current image is
70
- // clicked, go to the next image in sequence
71
- if (target.hasClass('visible') &&
72
- current[0] === target[0] &&
73
- next.length > 0 && self.is_open(current)) {
74
- target = next;
75
- image = S('img', target);
76
- }
77
-
78
- // set current and target to the clicked li if not otherwise defined.
79
- self.open(image, current, target);
80
- self.update_paddles(target);
81
- })
82
-
83
- .on('click.fndtn.clearing', '.clearing-main-next',
84
- function (e) { self.nav(e, 'next') })
85
- .on('click.fndtn.clearing', '.clearing-main-prev',
86
- function (e) { self.nav(e, 'prev') })
87
- .on('click.fndtn.clearing', this.settings.close_selectors,
88
- function (e) { Foundation.libs.clearing.close(e, this) });
89
-
90
- $(document).on('keydown.fndtn.clearing',
91
- function (e) { self.keydown(e) });
92
-
93
- S(window).off('.clearing').on('resize.fndtn.clearing',
94
- function () { self.resize() });
95
-
96
- this.swipe_events(scope);
97
- },
98
-
99
- swipe_events : function (scope) {
100
- var self = this,
101
- S = self.S;
102
-
103
- S(this.scope)
104
- .on('touchstart.fndtn.clearing', '.visible-img', function(e) {
105
- if (!e.touches) { e = e.originalEvent; }
106
- var data = {
107
- start_page_x: e.touches[0].pageX,
108
- start_page_y: e.touches[0].pageY,
109
- start_time: (new Date()).getTime(),
110
- delta_x: 0,
111
- is_scrolling: undefined
112
- };
113
-
114
- S(this).data('swipe-transition', data);
115
- e.stopPropagation();
116
- })
117
- .on('touchmove.fndtn.clearing', '.visible-img', function(e) {
118
- if (!e.touches) { e = e.originalEvent; }
119
- // Ignore pinch/zoom events
120
- if(e.touches.length > 1 || e.scale && e.scale !== 1) return;
121
-
122
- var data = S(this).data('swipe-transition');
123
-
124
- if (typeof data === 'undefined') {
125
- data = {};
126
- }
127
-
128
- data.delta_x = e.touches[0].pageX - data.start_page_x;
129
-
130
- if ( typeof data.is_scrolling === 'undefined') {
131
- data.is_scrolling = !!( data.is_scrolling || Math.abs(data.delta_x) < Math.abs(e.touches[0].pageY - data.start_page_y) );
132
- }
133
-
134
- if (!data.is_scrolling && !data.active) {
135
- e.preventDefault();
136
- var direction = (data.delta_x < 0) ? 'next' : 'prev';
137
- data.active = true;
138
- self.nav(e, direction);
139
- }
140
- })
141
- .on('touchend.fndtn.clearing', '.visible-img', function(e) {
142
- S(this).data('swipe-transition', {});
143
- e.stopPropagation();
144
- });
145
- },
146
-
147
- assemble : function ($li) {
148
- var $el = $li.parent();
149
-
150
- if ($el.parent().hasClass('carousel')) {
151
- return;
152
- }
153
-
154
- $el.after('<div id="foundationClearingHolder"></div>');
155
-
156
- var grid = $el.detach(),
157
- grid_outerHTML = '';
158
-
159
- if (grid[0] == null) {
160
- return;
161
- } else {
162
- grid_outerHTML = grid[0].outerHTML;
163
- }
164
-
165
- var holder = this.S('#foundationClearingHolder'),
166
- settings = $el.data(this.attr_name(true) + '-init'),
167
- data = {
168
- grid: '<div class="carousel">' + grid_outerHTML + '</div>',
169
- viewing: settings.templates.viewing
170
- },
171
- wrapper = '<div class="clearing-assembled"><div>' + data.viewing +
172
- data.grid + '</div></div>',
173
- touch_label = this.settings.touch_label;
174
-
175
- if (Modernizr.touch) {
176
- wrapper = $(wrapper).find('.clearing-touch-label').html(touch_label).end();
177
- }
178
-
179
- holder.after(wrapper).remove();
180
- },
181
-
182
- open : function ($image, current, target) {
183
- var self = this,
184
- body = $(document.body),
185
- root = target.closest('.clearing-assembled'),
186
- container = self.S('div', root).first(),
187
- visible_image = self.S('.visible-img', container),
188
- image = self.S('img', visible_image).not($image),
189
- label = self.S('.clearing-touch-label', container),
190
- error = false;
191
-
192
- image.error(function () {
193
- error = true;
194
- });
195
-
196
- function startLoad() {
197
- setTimeout(function () {
198
- this.image_loaded(image, function () {
199
- if (image.outerWidth() === 1 && !error) {
200
- startLoad.call(this);
201
- } else {
202
- cb.call(this, image);
203
- }
204
- }.bind(this));
205
- }.bind(this), 50);
206
- }
207
-
208
- function cb (image) {
209
- var $image = $(image);
210
- $image.css('visibility', 'visible');
211
- // toggle the gallery
212
- body.css('overflow', 'hidden');
213
- root.addClass('clearing-blackout');
214
- container.addClass('clearing-container');
215
- visible_image.show();
216
- this.fix_height(target)
217
- .caption(self.S('.clearing-caption', visible_image), self.S('img', target))
218
- .center_and_label(image, label)
219
- .shift(current, target, function () {
220
- target.siblings().removeClass('visible');
221
- target.addClass('visible');
222
- });
223
- visible_image.trigger('opened.fndtn.clearing')
224
- }
225
-
226
- if (!this.locked()) {
227
- visible_image.trigger('open.fndtn.clearing');
228
- // set the image to the selected thumbnail
229
- image
230
- .attr('src', this.load($image))
231
- .css('visibility', 'hidden');
232
-
233
- startLoad.call(this);
234
- }
235
- },
236
-
237
- close : function (e, el) {
238
- e.preventDefault();
239
-
240
- var root = (function (target) {
241
- if (/blackout/.test(target.selector)) {
242
- return target;
243
- } else {
244
- return target.closest('.clearing-blackout');
245
- }
246
- }($(el))),
247
- body = $(document.body), container, visible_image;
248
-
249
- if (el === e.target && root) {
250
- body.css('overflow', '');
251
- container = $('div', root).first();
252
- visible_image = $('.visible-img', container);
253
- visible_image.trigger('close.fndtn.clearing');
254
- this.settings.prev_index = 0;
255
- $('ul[' + this.attr_name() + ']', root)
256
- .attr('style', '').closest('.clearing-blackout')
257
- .removeClass('clearing-blackout');
258
- container.removeClass('clearing-container');
259
- visible_image.hide();
260
- visible_image.trigger('closed.fndtn.clearing');
261
- }
262
-
263
- return false;
264
- },
265
-
266
- is_open : function (current) {
267
- return current.parent().prop('style').length > 0;
268
- },
269
-
270
- keydown : function (e) {
271
- var clearing = $('.clearing-blackout ul[' + this.attr_name() + ']'),
272
- NEXT_KEY = this.rtl ? 37 : 39,
273
- PREV_KEY = this.rtl ? 39 : 37,
274
- ESC_KEY = 27;
275
-
276
- if (e.which === NEXT_KEY) this.go(clearing, 'next');
277
- if (e.which === PREV_KEY) this.go(clearing, 'prev');
278
- if (e.which === ESC_KEY) this.S('a.clearing-close').trigger('click');
279
- },
280
-
281
- nav : function (e, direction) {
282
- var clearing = $('ul[' + this.attr_name() + ']', '.clearing-blackout');
283
-
284
- e.preventDefault();
285
- this.go(clearing, direction);
286
- },
287
-
288
- resize : function () {
289
- var image = $('img', '.clearing-blackout .visible-img'),
290
- label = $('.clearing-touch-label', '.clearing-blackout');
291
-
292
- if (image.length) {
293
- this.center_and_label(image, label);
294
- image.trigger('resized.fndtn.clearing')
295
- }
296
- },
297
-
298
- // visual adjustments
299
- fix_height : function (target) {
300
- var lis = target.parent().children(),
301
- self = this;
302
-
303
- lis.each(function () {
304
- var li = self.S(this),
305
- image = li.find('img');
306
-
307
- if (li.height() > image.outerHeight()) {
308
- li.addClass('fix-height');
309
- }
310
- })
311
- .closest('ul')
312
- .width(lis.length * 100 + '%');
313
-
314
- return this;
315
- },
316
-
317
- update_paddles : function (target) {
318
- var visible_image = target
319
- .closest('.carousel')
320
- .siblings('.visible-img');
321
-
322
- if (target.next().length > 0) {
323
- this.S('.clearing-main-next', visible_image).removeClass('disabled');
324
- } else {
325
- this.S('.clearing-main-next', visible_image).addClass('disabled');
326
- }
327
-
328
- if (target.prev().length > 0) {
329
- this.S('.clearing-main-prev', visible_image).removeClass('disabled');
330
- } else {
331
- this.S('.clearing-main-prev', visible_image).addClass('disabled');
332
- }
333
- },
334
-
335
- center_and_label : function (target, label) {
336
- if (!this.rtl) {
337
- target.css({
338
- marginLeft : -(target.outerWidth() / 2),
339
- marginTop : -(target.outerHeight() / 2)
340
- });
341
-
342
- if (label.length > 0) {
343
- label.css({
344
- marginLeft : -(label.outerWidth() / 2),
345
- marginTop : -(target.outerHeight() / 2)-label.outerHeight()-10
346
- });
347
- }
348
- } else {
349
- target.css({
350
- marginRight : -(target.outerWidth() / 2),
351
- marginTop : -(target.outerHeight() / 2),
352
- left: 'auto',
353
- right: '50%'
354
- });
355
-
356
- if (label.length > 0) {
357
- label.css({
358
- marginRight : -(label.outerWidth() / 2),
359
- marginTop : -(target.outerHeight() / 2)-label.outerHeight()-10,
360
- left: 'auto',
361
- right: '50%'
362
- });
363
- }
364
- }
365
- return this;
366
- },
367
-
368
- // image loading and preloading
369
-
370
- load : function ($image) {
371
- var href;
372
-
373
- if ($image[0].nodeName === "A") {
374
- href = $image.attr('href');
375
- } else {
376
- href = $image.parent().attr('href');
377
- }
378
-
379
- this.preload($image);
380
-
381
- if (href) return href;
382
- return $image.attr('src');
383
- },
384
-
385
- preload : function ($image) {
386
- this
387
- .img($image.closest('li').next())
388
- .img($image.closest('li').prev());
389
- },
390
-
391
- img : function (img) {
392
- if (img.length) {
393
- var new_img = new Image(),
394
- new_a = this.S('a', img);
395
-
396
- if (new_a.length) {
397
- new_img.src = new_a.attr('href');
398
- } else {
399
- new_img.src = this.S('img', img).attr('src');
400
- }
401
- }
402
- return this;
403
- },
404
-
405
- // image caption
406
-
407
- caption : function (container, $image) {
408
- var caption = $image.attr('data-caption');
409
-
410
- if (caption) {
411
- container
412
- .html(caption)
413
- .show();
414
- } else {
415
- container
416
- .text('')
417
- .hide();
418
- }
419
- return this;
420
- },
421
-
422
- // directional methods
423
-
424
- go : function ($ul, direction) {
425
- var current = this.S('.visible', $ul),
426
- target = current[direction]();
427
-
428
- if (target.length) {
429
- this.S('img', target)
430
- .trigger('click', [current, target])
431
- .trigger('change.fndtn.clearing');
432
- }
433
- },
434
-
435
- shift : function (current, target, callback) {
436
- var clearing = target.parent(),
437
- old_index = this.settings.prev_index || target.index(),
438
- direction = this.direction(clearing, current, target),
439
- dir = this.rtl ? 'right' : 'left',
440
- left = parseInt(clearing.css('left'), 10),
441
- width = target.outerWidth(),
442
- skip_shift;
443
-
444
- var dir_obj = {};
445
-
446
- // we use jQuery animate instead of CSS transitions because we
447
- // need a callback to unlock the next animation
448
- // needs support for RTL **
449
- if (target.index() !== old_index && !/skip/.test(direction)){
450
- if (/left/.test(direction)) {
451
- this.lock();
452
- dir_obj[dir] = left + width;
453
- clearing.animate(dir_obj, 300, this.unlock());
454
- } else if (/right/.test(direction)) {
455
- this.lock();
456
- dir_obj[dir] = left - width;
457
- clearing.animate(dir_obj, 300, this.unlock());
458
- }
459
- } else if (/skip/.test(direction)) {
460
- // the target image is not adjacent to the current image, so
461
- // do we scroll right or not
462
- skip_shift = target.index() - this.settings.up_count;
463
- this.lock();
464
-
465
- if (skip_shift > 0) {
466
- dir_obj[dir] = -(skip_shift * width);
467
- clearing.animate(dir_obj, 300, this.unlock());
468
- } else {
469
- dir_obj[dir] = 0;
470
- clearing.animate(dir_obj, 300, this.unlock());
471
- }
472
- }
473
-
474
- callback();
475
- },
476
-
477
- direction : function ($el, current, target) {
478
- var lis = this.S('li', $el),
479
- li_width = lis.outerWidth() + (lis.outerWidth() / 4),
480
- up_count = Math.floor(this.S('.clearing-container').outerWidth() / li_width) - 1,
481
- target_index = lis.index(target),
482
- response;
483
-
484
- this.settings.up_count = up_count;
485
-
486
- if (this.adjacent(this.settings.prev_index, target_index)) {
487
- if ((target_index > up_count) && target_index > this.settings.prev_index) {
488
- response = 'right';
489
- } else if ((target_index > up_count - 1) && target_index <= this.settings.prev_index) {
490
- response = 'left';
491
- } else {
492
- response = false;
493
- }
494
- } else {
495
- response = 'skip';
496
- }
497
-
498
- this.settings.prev_index = target_index;
499
-
500
- return response;
501
- },
502
-
503
- adjacent : function (current_index, target_index) {
504
- for (var i = target_index + 1; i >= target_index - 1; i--) {
505
- if (i === current_index) return true;
506
- }
507
- return false;
508
- },
509
-
510
- // lock management
511
-
512
- lock : function () {
513
- this.settings.locked = true;
514
- },
515
-
516
- unlock : function () {
517
- this.settings.locked = false;
518
- },
519
-
520
- locked : function () {
521
- return this.settings.locked;
522
- },
523
-
524
- off : function () {
525
- this.S(this.scope).off('.fndtn.clearing');
526
- this.S(window).off('.fndtn.clearing');
527
- },
528
-
529
- reflow : function () {
530
- this.init();
531
- }
532
- };
533
-
534
- }(jQuery, window, window.document));