olay-rails 0.1.8 → 0.1.9
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.
- checksums.yaml +5 -5
- data/lib/olay/rails/version.rb +2 -2
- data/vendor/assets/javascripts/olay.js +31 -24
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
SHA1:
|
3
|
-
metadata.gz: d865996f1310571f34aaaf0ef4b6fcd43890fbaf
|
4
|
-
data.tar.gz: 0d23f8982d580c25398fadb25d9c00f5e5f1087a
|
5
2
|
SHA512:
|
6
|
-
|
7
|
-
|
3
|
+
data.tar.gz: a7e9f507d8e88291ea0a25c42a36d6df462d03f430f90ec025a9b7a6f41a65e97d1a27512813db75859feaf571ca09661d7f37ba772650fcf6093ee1bf541b5d
|
4
|
+
metadata.gz: 66fd18e3cef5ae793b346d378be1b9c278a82c3977c3e0416dc706fc98ee5c4d48fd18cd7394c19c159e4b33a51e5b9cd545bbb8b6ced17d273287d7fee8c660
|
5
|
+
SHA1:
|
6
|
+
data.tar.gz: a0e3d42af15820af64d51f81ae18a555dcb8875e
|
7
|
+
metadata.gz: 96550cafdbc971374c92b50aa54a18eece53fe76
|
data/lib/olay/rails/version.rb
CHANGED
@@ -4,13 +4,16 @@
|
|
4
4
|
// Store a local reference to jQuery.
|
5
5
|
var $ = window.jQuery;
|
6
6
|
|
7
|
-
// This private function will be used to stop event propagation in $content.
|
8
|
-
var stopPropagation = function (ev) { ev.stopPropagation(); };
|
9
|
-
|
10
7
|
// Selector for tabbable elements.
|
11
8
|
var tabbable =
|
12
9
|
':input, [tabindex], [contenteditable], [href], iframe, object, embed';
|
13
10
|
|
11
|
+
// Convenience method for `off`/`on`ing in jQuery.
|
12
|
+
var delegate = function ($el, ev, selector, cb) {
|
13
|
+
$el.off.call($el, ev, selector, cb);
|
14
|
+
$el.on.call($el, ev, selector, cb);
|
15
|
+
};
|
16
|
+
|
14
17
|
// Listen for keydown events.
|
15
18
|
$(document).keydown(function (ev) {
|
16
19
|
var $olay = $('.js-olay-container').last();
|
@@ -33,14 +36,19 @@
|
|
33
36
|
// Extend the instance with its options.
|
34
37
|
for (var name in options) this[name] = options[name];
|
35
38
|
|
36
|
-
// Store
|
39
|
+
// Store bound listeners to be used for callbacks. This is also used to
|
37
40
|
// ensure event callbacks can be removed consistently.
|
38
41
|
var self = this;
|
39
42
|
this._hide = function () { return self.hide(); };
|
43
|
+
var event;
|
44
|
+
this._$containerClick = function (ev) {
|
45
|
+
if (self.hideOnClick && event !== ev.originalEvent) self.hide();
|
46
|
+
};
|
47
|
+
this._$contentClick = function (ev) { event = ev.originalEvent; };
|
40
48
|
|
41
49
|
// Create the necessary DOM nodes.
|
42
50
|
this.$container = $('<div>')
|
43
|
-
.addClass('js-olay-container')
|
51
|
+
.addClass('js-olay-container ')
|
44
52
|
.addClass(this.transition)
|
45
53
|
.append(
|
46
54
|
this.$table = $('<div>')
|
@@ -51,8 +59,7 @@
|
|
51
59
|
.append(
|
52
60
|
this.$content = $('<div>')
|
53
61
|
.addClass('js-olay-content')
|
54
|
-
.attr({role: 'alertdialog', 'aria-label': this.ariaLabel})
|
55
|
-
.on('click', '.js-olay-hide', this._hide))));
|
62
|
+
.attr({role: 'alertdialog', 'aria-label': this.ariaLabel}))));
|
56
63
|
|
57
64
|
// Finally, set the element.
|
58
65
|
this.setElement(el);
|
@@ -94,19 +101,20 @@
|
|
94
101
|
clearTimeout(this._timeout);
|
95
102
|
if (!inDom) this._append();
|
96
103
|
|
97
|
-
// Force a redraw before
|
98
|
-
//
|
99
|
-
//
|
104
|
+
// Force a redraw before adding the transition class. Not doing this will
|
105
|
+
// apply the end result of the transition instantly, which is not
|
106
|
+
// desirable in a transition...
|
100
107
|
this.$container.data('olay', this).height();
|
101
|
-
this.$container.addClass('js-olay-show')
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
108
|
+
this.$container.addClass('js-olay-show');
|
109
|
+
|
110
|
+
// Delegate events, ensuring no double-binding.
|
111
|
+
delegate(this.$container, 'click', this._$containerClick);
|
112
|
+
delegate(this.$content, 'click', this._$contentClick);
|
113
|
+
delegate(this.$content, 'click', '.js-olay-hide', this._hide);
|
114
|
+
|
107
115
|
this.$el.trigger('show');
|
108
116
|
var duration = this.duration;
|
109
|
-
if (!duration) return this;
|
117
|
+
if (!this.duration) return this;
|
110
118
|
duration += this.transitionDuration;
|
111
119
|
this._timeout = setTimeout(this._hide, duration);
|
112
120
|
return this;
|
@@ -128,6 +136,7 @@
|
|
128
136
|
// Use this method to set or update `$el`.
|
129
137
|
setElement: function (el) {
|
130
138
|
this.$content.empty().append(this.$el = el instanceof $ ? el : $(el));
|
139
|
+
return this;
|
131
140
|
},
|
132
141
|
|
133
142
|
// Completely remove the `$container` element and its children and all of
|
@@ -143,15 +152,13 @@
|
|
143
152
|
var $body = $('body');
|
144
153
|
var $olays = $('.js-olay-container');
|
145
154
|
var active = document.activeElement;
|
146
|
-
|
147
|
-
|
148
|
-
$olays.last() :
|
149
|
-
$(active);
|
155
|
+
var useLast = $olays.length && active === $body[0];
|
156
|
+
this._$active = useLast ? $olays.last() : $(active);
|
150
157
|
$(tabbable).each(function () {
|
151
158
|
if ('olayTabindex' in this) return;
|
152
|
-
var $
|
153
|
-
this.olayTabindex = $
|
154
|
-
$
|
159
|
+
var $self = $(this);
|
160
|
+
this.olayTabindex = $self.attr('tabindex') || null;
|
161
|
+
$self.attr('tabindex', -1);
|
155
162
|
});
|
156
163
|
$body.addClass('js-olay-visible').append(this.$container);
|
157
164
|
this.$content.attr('tabindex', 0).focus().removeAttr('tabindex');
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: olay-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Casey Foster
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2013-03-
|
13
|
+
date: 2013-03-11 00:00:00 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
prerelease: false
|
@@ -22,7 +22,7 @@ dependencies:
|
|
22
22
|
version: "3.1"
|
23
23
|
type: :runtime
|
24
24
|
version_requirements: *id001
|
25
|
-
description: Places Olay 0.1.
|
25
|
+
description: Places Olay 0.1.9 in the Rails asset pipeline.
|
26
26
|
email:
|
27
27
|
- c@sey.me
|
28
28
|
executables: []
|