helios 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +93 -71
  3. data/README.md +150 -127
  4. data/helios.gemspec +5 -4
  5. data/lib/helios/backend/push-notification.rb +1 -0
  6. data/lib/helios/commands/link.rb +2 -0
  7. data/lib/helios/commands/new.rb +1 -0
  8. data/lib/helios/frontend/javascripts/vendor/foundation.js +163 -47
  9. data/lib/helios/frontend/javascripts/vendor/foundation/foundation.alerts.js +6 -4
  10. data/lib/helios/frontend/javascripts/vendor/foundation/foundation.clearing.js +70 -32
  11. data/lib/helios/frontend/javascripts/vendor/foundation/foundation.dropdown.js +87 -31
  12. data/lib/helios/frontend/javascripts/vendor/foundation/foundation.forms.js +360 -238
  13. data/lib/helios/frontend/javascripts/vendor/foundation/foundation.interchange.js +271 -0
  14. data/lib/helios/frontend/javascripts/vendor/foundation/foundation.joyride.js +279 -48
  15. data/lib/helios/frontend/javascripts/vendor/foundation/foundation.magellan.js +8 -4
  16. data/lib/helios/frontend/javascripts/vendor/foundation/foundation.orbit.js +59 -24
  17. data/lib/helios/frontend/javascripts/vendor/foundation/foundation.placeholder.js +21 -1
  18. data/lib/helios/frontend/javascripts/vendor/foundation/foundation.reveal.js +100 -42
  19. data/lib/helios/frontend/javascripts/vendor/foundation/foundation.section.js +299 -60
  20. data/lib/helios/frontend/javascripts/vendor/foundation/foundation.tooltips.js +26 -13
  21. data/lib/helios/frontend/javascripts/vendor/foundation/foundation.topbar.js +154 -59
  22. data/lib/helios/frontend/javascripts/vendor/foundation/index.js +17 -0
  23. data/lib/helios/frontend/stylesheets/screen.sass +0 -1
  24. data/lib/helios/frontend/templates/push-notification/devices.jst.tpl +0 -3
  25. data/lib/helios/templates/.gitignore.erb +32 -0
  26. data/lib/helios/version.rb +1 -1
  27. metadata +31 -14
@@ -5,7 +5,7 @@ require "helios/version"
5
5
  Gem::Specification.new do |s|
6
6
  s.name = "helios"
7
7
  s.authors = ["Mattt Thompson"]
8
- s.email = "mattt@heroku.com"
8
+ s.email = "m@mattt.me"
9
9
  s.license = "MIT"
10
10
  s.homepage = "http://helios.io"
11
11
  s.version = Helios::VERSION
@@ -20,8 +20,9 @@ Gem::Specification.new do |s|
20
20
  s.add_dependency "rack-in-app-purchase", "~> 0.1"
21
21
  s.add_dependency "rack-passbook", "~> 0.1"
22
22
  s.add_dependency "rack-newsstand", "~> 0.1"
23
- s.add_dependency "rack-scaffold", ">= 0.0.3"
24
- s.add_dependency "core_data"
23
+ s.add_dependency "rack-scaffold", "~> 0.2"
24
+ s.add_dependency "core_data", "~> 0.1"
25
+ s.add_dependency "pg", "~> 0.17"
25
26
  s.add_dependency "json", "~> 1.7"
26
27
  s.add_dependency "coffee-script", "~> 2.2"
27
28
  s.add_dependency "sinatra", "~> 1.3"
@@ -35,7 +36,7 @@ Gem::Specification.new do |s|
35
36
  s.add_dependency "zurb-foundation", "4.1.2"
36
37
  s.add_dependency "rails-database-url", "~> 1.0"
37
38
  s.add_dependency "fog", "~> 1.10"
38
- s.add_dependency "houston", "~> 0.2"
39
+ s.add_dependency "houston", "~> 2.2"
39
40
 
40
41
  s.add_development_dependency "rake"
41
42
  s.add_development_dependency "rspec"
@@ -73,6 +73,7 @@ class Helios::Backend::PushNotification < Sinatra::Base
73
73
  options[:alert] = options["aps"]["alert"]
74
74
  options[:badge] = options["aps"]["badge"]
75
75
  options[:sound] = options["aps"]["sound"]
76
+ options[:'content-available'] = options["aps"]["content-available"]
76
77
  options.delete("aps")
77
78
 
78
79
  begin
@@ -8,6 +8,8 @@ command :link do |c|
8
8
  say_error "Missing argument: path/to/Model.xcdatamodel" and abort if args.empty?
9
9
  path = args.first
10
10
 
11
+ say_error "Cannot link to a .xcdatamodeld file" and abort if File.extname(path) == ".xcdatamodeld"
12
+
11
13
  begin
12
14
  File.link(path, File.basename(path))
13
15
  say_ok "Xcode data model successfully linked"
@@ -37,6 +37,7 @@ command :new do |c|
37
37
  erb = ERB.new(File.read(template))
38
38
 
39
39
  next if file === "Gemfile" and options.skip_gemfile
40
+ next if file === ".gitignore" and options.skip_git
40
41
 
41
42
  if File.exist?(file)
42
43
  if options.force and not options.skip
@@ -8,7 +8,69 @@
8
8
 
9
9
  /*jslint unparam: true, browser: true, indent: 2 */
10
10
 
11
- (function () {
11
+ // Accommodate running jQuery or Zepto in noConflict() mode by
12
+ // using an anonymous function to redefine the $ shorthand name.
13
+ // See http://docs.jquery.com/Using_jQuery_with_Other_Libraries
14
+ // and http://zeptojs.com/
15
+ var libFuncName = null;
16
+
17
+ if (typeof jQuery === "undefined" &&
18
+ typeof Zepto === "undefined" &&
19
+ typeof $ === "function") {
20
+ libFuncName = $;
21
+ } else if (typeof jQuery === "function") {
22
+ libFuncName = jQuery;
23
+ } else if (typeof Zepto === "function") {
24
+ libFuncName = Zepto;
25
+ } else {
26
+ throw new TypeError();
27
+ }
28
+
29
+ (function ($, window, document, undefined) {
30
+ 'use strict';
31
+
32
+ /*
33
+ matchMedia() polyfill - Test a CSS media
34
+ type/query in JS. Authors & copyright (c) 2012:
35
+ Scott Jehl, Paul Irish, Nicholas Zakas.
36
+ Dual MIT/BSD license
37
+
38
+ https://github.com/paulirish/matchMedia.js
39
+ */
40
+
41
+ window.matchMedia = window.matchMedia || (function( doc, undefined ) {
42
+
43
+ "use strict";
44
+
45
+ var bool,
46
+ docElem = doc.documentElement,
47
+ refNode = docElem.firstElementChild || docElem.firstChild,
48
+ // fakeBody required for <FF4 when executed in <head>
49
+ fakeBody = doc.createElement( "body" ),
50
+ div = doc.createElement( "div" );
51
+
52
+ div.id = "mq-test-1";
53
+ div.style.cssText = "position:absolute;top:-100em";
54
+ fakeBody.style.background = "none";
55
+ fakeBody.appendChild(div);
56
+
57
+ return function(q){
58
+
59
+ div.innerHTML = "&shy;<style media=\"" + q + "\"> #mq-test-1 { width: 42px; }</style>";
60
+
61
+ docElem.insertBefore( fakeBody, refNode );
62
+ bool = div.offsetWidth === 42;
63
+ docElem.removeChild( fakeBody );
64
+
65
+ return {
66
+ matches: bool,
67
+ media: q
68
+ };
69
+
70
+ };
71
+
72
+ }( document ));
73
+
12
74
  // add dusty browser stuff
13
75
  if (!Array.prototype.filter) {
14
76
  Array.prototype.filter = function(fun /*, thisp */) {
@@ -17,17 +79,13 @@
17
79
  if (this == null) {
18
80
  throw new TypeError();
19
81
  }
20
-
82
+
21
83
  var t = Object(this),
22
84
  len = t.length >>> 0;
23
- if (typeof fun != "function") {
24
- try {
25
- throw new TypeError();
26
- } catch (e) {
85
+ if (typeof fun !== "function") {
27
86
  return;
28
- }
29
87
  }
30
-
88
+
31
89
  var res = [],
32
90
  thisp = arguments[1];
33
91
  for (var i = 0; i < len; i++) {
@@ -38,32 +96,65 @@
38
96
  }
39
97
  }
40
98
  }
41
-
99
+
42
100
  return res;
101
+ }
102
+ }
103
+
104
+ if (!Function.prototype.bind) {
105
+ Function.prototype.bind = function (oThis) {
106
+ if (typeof this !== "function") {
107
+ // closest thing possible to the ECMAScript 5 internal IsCallable function
108
+ throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");
109
+ }
110
+
111
+ var aArgs = Array.prototype.slice.call(arguments, 1),
112
+ fToBind = this,
113
+ fNOP = function () {},
114
+ fBound = function () {
115
+ return fToBind.apply(this instanceof fNOP && oThis
116
+ ? this
117
+ : oThis,
118
+ aArgs.concat(Array.prototype.slice.call(arguments)));
119
+ };
120
+
121
+ fNOP.prototype = this.prototype;
122
+ fBound.prototype = new fNOP();
123
+
124
+ return fBound;
43
125
  };
126
+ }
44
127
 
45
- if (!Function.prototype.bind) {
46
- Function.prototype.bind = function (oThis) {
47
- if (typeof this !== "function") {
48
- // closest thing possible to the ECMAScript 5 internal IsCallable function
49
- throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");
128
+ if (!Array.prototype.indexOf) {
129
+ Array.prototype.indexOf = function (searchElement /*, fromIndex */ ) {
130
+ "use strict";
131
+ if (this == null) {
132
+ throw new TypeError();
133
+ }
134
+ var t = Object(this);
135
+ var len = t.length >>> 0;
136
+ if (len === 0) {
137
+ return -1;
138
+ }
139
+ var n = 0;
140
+ if (arguments.length > 1) {
141
+ n = Number(arguments[1]);
142
+ if (n != n) { // shortcut for verifying if it's NaN
143
+ n = 0;
144
+ } else if (n != 0 && n != Infinity && n != -Infinity) {
145
+ n = (n > 0 || -1) * Math.floor(Math.abs(n));
50
146
  }
51
-
52
- var aArgs = Array.prototype.slice.call(arguments, 1),
53
- fToBind = this,
54
- fNOP = function () {},
55
- fBound = function () {
56
- return fToBind.apply(this instanceof fNOP && oThis
57
- ? this
58
- : oThis,
59
- aArgs.concat(Array.prototype.slice.call(arguments)));
60
- };
61
-
62
- fNOP.prototype = this.prototype;
63
- fBound.prototype = new fNOP();
64
-
65
- return fBound;
66
- };
147
+ }
148
+ if (n >= len) {
149
+ return -1;
150
+ }
151
+ var k = n >= 0 ? n : Math.max(len - Math.abs(n), 0);
152
+ for (; k < len; k++) {
153
+ if (k in t && t[k] === searchElement) {
154
+ return k;
155
+ }
156
+ }
157
+ return -1;
67
158
  }
68
159
  }
69
160
 
@@ -71,17 +162,12 @@
71
162
  $.fn.stop = $.fn.stop || function() {
72
163
  return this;
73
164
  };
74
- }());
75
-
76
- ;(function (window, document, undefined) {
77
- 'use strict';
78
165
 
79
166
  window.Foundation = {
80
167
  name : 'Foundation',
81
168
 
82
- version : '4.0.0',
169
+ version : '4.2.3',
83
170
 
84
- // global Foundation cache object
85
171
  cache : {},
86
172
 
87
173
  init : function (scope, libraries, method, options, response, /* internal */ nc) {
@@ -94,10 +180,13 @@
94
180
  // used for development only
95
181
  if (nc) this.nc = nc;
96
182
 
183
+ // check RTL
184
+ this.rtl = /rtl/i.test($('html').attr('dir'));
185
+
97
186
  // set foundation global scope
98
187
  this.scope = scope || this.scope;
99
188
 
100
- if (libraries && typeof libraries === 'string') {
189
+ if (libraries && typeof libraries === 'string' && !/reflow/i.test(libraries)) {
101
190
  if (/off/i.test(libraries)) return this.off();
102
191
 
103
192
  library_arr = libraries.split(' ');
@@ -108,6 +197,8 @@
108
197
  }
109
198
  }
110
199
  } else {
200
+ if (/reflow/i.test(libraries)) args[1] = 'reflow';
201
+
111
202
  for (var lib in this.libs) {
112
203
  responses.push(this.init_lib(lib, args));
113
204
  }
@@ -122,9 +213,9 @@
122
213
  },
123
214
 
124
215
  response_obj : function (response_arr, args) {
125
- for (var callback in args) {
126
- if (typeof args[callback] === 'function') {
127
- return args[callback]({
216
+ for (var i = 0, len = args.length; i < len; i++) {
217
+ if (typeof args[i] === 'function') {
218
+ return args[i]({
128
219
  errors: response_arr.filter(function (s) {
129
220
  if (typeof s === 'string') return s;
130
221
  })
@@ -141,6 +232,9 @@
141
232
  this.patch(this.libs[lib]);
142
233
  return this.libs[lib].init.apply(this.libs[lib], args);
143
234
  }
235
+ else {
236
+ return function () {};
237
+ }
144
238
  }.bind(this), lib);
145
239
  },
146
240
 
@@ -158,6 +252,8 @@
158
252
 
159
253
  patch : function (lib) {
160
254
  this.fix_outer(lib);
255
+ lib.scope = this.scope;
256
+ lib.rtl = this.rtl;
161
257
  },
162
258
 
163
259
  inherit : function (scope, methods) {
@@ -170,16 +266,31 @@
170
266
  }
171
267
  },
172
268
 
269
+ random_str : function (length) {
270
+ var chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.split('');
271
+
272
+ if (!length) {
273
+ length = Math.floor(Math.random() * chars.length);
274
+ }
275
+
276
+ var str = '';
277
+ for (var i = 0; i < length; i++) {
278
+ str += chars[Math.floor(Math.random() * chars.length)];
279
+ }
280
+ return str;
281
+ },
282
+
173
283
  libs : {},
174
284
 
175
285
  // methods that can be inherited in libraries
176
286
  lib_methods : {
177
287
  set_data : function (node, data) {
178
288
  // this.name references the name of the library calling this method
179
- var id = this.name + (+new Date());
289
+ var id = [this.name,+new Date(),Foundation.random_str(5)].join('-');
180
290
 
181
291
  Foundation.cache[id] = data;
182
292
  node.attr('data-' + this.name + '-id', id);
293
+ return data;
183
294
  },
184
295
 
185
296
  get_data : function (node) {
@@ -209,13 +320,17 @@
209
320
  };
210
321
  },
211
322
 
212
- // parses dat-options attribute on page nodes and turns
323
+ // parses data-options attribute on nodes and turns
213
324
  // them into an object
214
325
  data_options : function (el) {
215
326
  var opts = {}, ii, p,
216
327
  opts_arr = (el.attr('data-options') || ':').split(';'),
217
328
  opts_len = opts_arr.length;
218
329
 
330
+ function isNumber (o) {
331
+ return ! isNaN (o-0) && o !== null && o !== "" && o !== false && o !== true;
332
+ }
333
+
219
334
  function trim(str) {
220
335
  if (typeof str === 'string') return $.trim(str);
221
336
  return str;
@@ -227,8 +342,9 @@
227
342
 
228
343
  if (/true/i.test(p[1])) p[1] = true;
229
344
  if (/false/i.test(p[1])) p[1] = false;
345
+ if (isNumber(p[1])) p[1] = parseInt(p[1], 10);
230
346
 
231
- if (p.length === 2) {
347
+ if (p.length === 2 && p[0].length > 0) {
232
348
  opts[trim(p[0])] = trim(p[1]);
233
349
  }
234
350
  }
@@ -311,13 +427,13 @@
311
427
  },
312
428
 
313
429
  zj : function () {
314
- try {
430
+ if (typeof Zepto !== 'undefined') {
315
431
  return Zepto;
316
- } catch (e) {
432
+ } else {
317
433
  return jQuery;
318
434
  }
319
435
  }()
320
- },
436
+ };
321
437
 
322
438
  $.fn.foundation = function () {
323
439
  var args = Array.prototype.slice.call(arguments, 0);
@@ -328,4 +444,4 @@
328
444
  });
329
445
  };
330
446
 
331
- }(this, this.document));
447
+ }(libFuncName, this, this.document));
@@ -6,7 +6,7 @@
6
6
  Foundation.libs.alerts = {
7
7
  name : 'alerts',
8
8
 
9
- version : '4.0.0',
9
+ version : '4.2.2',
10
10
 
11
11
  settings : {
12
12
  speed: 300, // fade out speed
@@ -20,8 +20,8 @@
20
20
  $.extend(true, this.settings, method);
21
21
  }
22
22
 
23
- if (typeof method != 'string') {
24
- if (!this.settings.init) this.events();
23
+ if (typeof method !== 'string') {
24
+ if (!this.settings.init) { this.events(); }
25
25
 
26
26
  return this.settings.init;
27
27
  } else {
@@ -45,6 +45,8 @@
45
45
 
46
46
  off : function () {
47
47
  $(this.scope).off('.fndtn.alerts');
48
- }
48
+ },
49
+
50
+ reflow : function () {}
49
51
  };
50
52
  }(Foundation.zj, this, this.document));
@@ -6,14 +6,14 @@
6
6
  Foundation.libs.clearing = {
7
7
  name : 'clearing',
8
8
 
9
- version : '4.0.0',
9
+ version : '4.2.2',
10
10
 
11
11
  settings : {
12
12
  templates : {
13
13
  viewing : '<a href="#" class="clearing-close">&times;</a>' +
14
14
  '<div class="visible-img" style="display: none"><img src="//:0">' +
15
- '<p class="clearing-caption"></p><a href="#" class="clearing-main-left"><span></span></a>' +
16
- '<a href="#" class="clearing-main-right"><span></span></a></div>'
15
+ '<p class="clearing-caption"></p><a href="#" class="clearing-main-prev"><span></span></a>' +
16
+ '<a href="#" class="clearing-main-next"><span></span></a></div>'
17
17
  },
18
18
 
19
19
  // comma delimited list of selectors that, on click, will close clearing,
@@ -26,24 +26,24 @@
26
26
  },
27
27
 
28
28
  init : function (scope, method, options) {
29
- this.scope = this.scope || scope;
30
- Foundation.inherit(this, 'set_data get_data remove_data throttle');
29
+ var self = this;
30
+ Foundation.inherit(this, 'set_data get_data remove_data throttle data_options');
31
31
 
32
32
  if (typeof method === 'object') {
33
33
  options = $.extend(true, this.settings, method);
34
34
  }
35
35
 
36
- if (typeof method != 'string') {
36
+ if (typeof method !== 'string') {
37
37
  $(this.scope).find('ul[data-clearing]').each(function () {
38
- var self = Foundation.libs.clearing,
39
- $el = $(this),
38
+ var $el = $(this),
40
39
  options = options || {},
40
+ lis = $el.find('li'),
41
41
  settings = self.get_data($el);
42
42
 
43
- if (!settings) {
43
+ if (!settings && lis.length > 0) {
44
44
  options.$parent = $el.parent();
45
45
 
46
- self.set_data($el, $.extend(true, self.settings, options));
46
+ self.set_data($el, $.extend({}, self.settings, options, self.data_options($el)));
47
47
 
48
48
  self.assemble($el.find('li'));
49
49
 
@@ -70,19 +70,30 @@
70
70
  function (e, current, target) {
71
71
  var current = current || $(this),
72
72
  target = target || current,
73
- settings = self.get_data(current.parent());
73
+ next = current.next('li'),
74
+ settings = self.get_data(current.parent()),
75
+ image = $(e.target);
74
76
 
75
77
  e.preventDefault();
76
78
  if (!settings) self.init();
77
79
 
80
+ // if clearing is open and the current image is
81
+ // clicked, go to the next image in sequence
82
+ if (target.hasClass('visible') &&
83
+ current[0] === target[0] &&
84
+ next.length > 0 && self.is_open(current)) {
85
+ target = next;
86
+ image = target.find('img');
87
+ }
88
+
78
89
  // set current and target to the clicked li if not otherwise defined.
79
- self.open($(e.target), current, target);
90
+ self.open(image, current, target);
80
91
  self.update_paddles(target);
81
92
  })
82
93
 
83
- .on('click.fndtn.clearing', '.clearing-main-right',
94
+ .on('click.fndtn.clearing', '.clearing-main-next',
84
95
  function (e) { this.nav(e, 'next') }.bind(this))
85
- .on('click.fndtn.clearing', '.clearing-main-left',
96
+ .on('click.fndtn.clearing', '.clearing-main-prev',
86
97
  function (e) { this.nav(e, 'prev') }.bind(this))
87
98
  .on('click.fndtn.clearing', this.settings.close_selectors,
88
99
  function (e) { Foundation.libs.clearing.close(e, this) })
@@ -90,7 +101,7 @@
90
101
  function (e) { this.keydown(e) }.bind(this));
91
102
 
92
103
  $(window).on('resize.fndtn.clearing',
93
- function (e) { this.resize() }.bind(this));
104
+ function () { this.resize() }.bind(this));
94
105
 
95
106
  this.settings.init = true;
96
107
  return this;
@@ -101,6 +112,7 @@
101
112
 
102
113
  $(this.scope)
103
114
  .on('touchstart.fndtn.clearing', '.visible-img', function(e) {
115
+ if (!e.touches) { e = e.originalEvent; }
104
116
  var data = {
105
117
  start_page_x: e.touches[0].pageX,
106
118
  start_page_y: e.touches[0].pageY,
@@ -113,6 +125,7 @@
113
125
  e.stopPropagation();
114
126
  })
115
127
  .on('touchmove.fndtn.clearing', '.visible-img', function(e) {
128
+ if (!e.touches) { e = e.originalEvent; }
116
129
  // Ignore pinch/zoom events
117
130
  if(e.touches.length > 1 || e.scale && e.scale !== 1) return;
118
131
 
@@ -142,7 +155,10 @@
142
155
  },
143
156
 
144
157
  assemble : function ($li) {
145
- var $el = $li.parent(),
158
+ var $el = $li.parent();
159
+ $el.after('<div id="foundationClearingHolder"></div>');
160
+
161
+ var holder = $('#foundationClearingHolder'),
146
162
  settings = this.get_data($el),
147
163
  grid = $el.detach(),
148
164
  data = {
@@ -152,7 +168,7 @@
152
168
  wrapper = '<div class="clearing-assembled"><div>' + data.viewing +
153
169
  data.grid + '</div></div>';
154
170
 
155
- return settings.$parent.append(wrapper);
171
+ return holder.after(wrapper).remove();
156
172
  },
157
173
 
158
174
  // event callbacks
@@ -165,9 +181,12 @@
165
181
 
166
182
  if (!this.locked()) {
167
183
  // set the image to the selected thumbnail
168
- image.attr('src', this.load($image));
184
+ image
185
+ .attr('src', this.load($image))
186
+ .css('visibility', 'hidden');
169
187
 
170
188
  this.loaded(image, function () {
189
+ image.css('visibility', 'visible');
171
190
  // toggle the gallery
172
191
  root.addClass('clearing-blackout');
173
192
  container.addClass('clearing-container');
@@ -195,7 +214,7 @@
195
214
  }($(el))), container, visible_image;
196
215
 
197
216
  if (el === e.target && root) {
198
- container = root.find('div').first(),
217
+ container = root.find('div').first();
199
218
  visible_image = container.find('.visible-img');
200
219
  this.settings.prev_index = 0;
201
220
  root.find('ul[data-clearing]')
@@ -208,6 +227,10 @@
208
227
  return false;
209
228
  },
210
229
 
230
+ is_open : function (current) {
231
+ return current.parent().attr('style').length > 0;
232
+ },
233
+
211
234
  keydown : function (e) {
212
235
  var clearing = $('.clearing-blackout').find('ul[data-clearing]');
213
236
 
@@ -255,39 +278,50 @@
255
278
  .closest('.carousel')
256
279
  .siblings('.visible-img');
257
280
 
258
- if (target.next().length) {
281
+ if (target.next().length > 0) {
259
282
  visible_image
260
- .find('.clearing-main-right')
283
+ .find('.clearing-main-next')
261
284
  .removeClass('disabled');
262
285
  } else {
263
286
  visible_image
264
- .find('.clearing-main-right')
287
+ .find('.clearing-main-next')
265
288
  .addClass('disabled');
266
289
  }
267
290
 
268
- if (target.prev().length) {
291
+ if (target.prev().length > 0) {
269
292
  visible_image
270
- .find('.clearing-main-left')
293
+ .find('.clearing-main-prev')
271
294
  .removeClass('disabled');
272
295
  } else {
273
296
  visible_image
274
- .find('.clearing-main-left')
297
+ .find('.clearing-main-prev')
275
298
  .addClass('disabled');
276
299
  }
277
300
  },
278
301
 
279
302
  center : function (target) {
280
- target.css({
281
- marginLeft : -(this.outerWidth(target) / 2),
282
- marginTop : -(this.outerHeight(target) / 2)
283
- });
303
+ if (!this.rtl) {
304
+ target.css({
305
+ marginLeft : -(this.outerWidth(target) / 2),
306
+ marginTop : -(this.outerHeight(target) / 2)
307
+ });
308
+ } else {
309
+ target.css({
310
+ marginRight : -(this.outerWidth(target) / 2),
311
+ marginTop : -(this.outerHeight(target) / 2)
312
+ });
313
+ }
284
314
  return this;
285
315
  },
286
316
 
287
317
  // image loading and preloading
288
318
 
289
319
  load : function ($image) {
290
- var href = $image.parent().attr('href');
320
+ if ($image[0].nodeName === "A") {
321
+ var href = $image.attr('href');
322
+ } else {
323
+ var href = $image.parent().attr('href');
324
+ }
291
325
 
292
326
  this.preload($image);
293
327
 
@@ -326,7 +360,7 @@
326
360
  return;
327
361
  }
328
362
 
329
- if (this.complete || this.readyState === 4) {
363
+ if (image[0].complete || image[0].readyState === 4) {
330
364
  loaded();
331
365
  } else {
332
366
  bindLoad.call(image);
@@ -354,7 +388,7 @@
354
388
 
355
389
  if (caption) {
356
390
  container
357
- .text(caption)
391
+ .html(caption)
358
392
  .show();
359
393
  } else {
360
394
  container
@@ -472,6 +506,10 @@
472
506
  $(window).off('.fndtn.clearing');
473
507
  this.remove_data(); // empty settings cache
474
508
  this.settings.init = false;
509
+ },
510
+
511
+ reflow : function () {
512
+ this.init();
475
513
  }
476
514
  };
477
515