lazybox 0.2.3 → 0.2.4
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.
data/README.md
CHANGED
@@ -3,7 +3,7 @@ LazyBox
|
|
3
3
|
|
4
4
|
[Live Demo](http://lazybox.herokuapp.com/)
|
5
5
|
|
6
|
-
[Demo Source](https://github.com/
|
6
|
+
[Demo Source](https://github.com/galulex/lazybox_demo)
|
7
7
|
|
8
8
|
Lazybox is a jQuery-based, lightbox that can display entire remote pages, images and confirmation dialogs.
|
9
9
|
Replace standard rails confirmations with lazybox just added several rows to your project. Use lazybox with rails assets pipeline.
|
data/lib/lazybox/version.rb
CHANGED
@@ -34,7 +34,7 @@
|
|
34
34
|
|
35
35
|
close: (speed) ->
|
36
36
|
speed = speed || defaults.speed
|
37
|
-
effect = if box.position().top == 0 then 'slideUp' else 'fadeOut'
|
37
|
+
effect = if (box.position().top - window.scrollY == 0) then 'slideUp' else 'fadeOut'
|
38
38
|
box[effect](speed)
|
39
39
|
overlay.fadeOut(speed+200)
|
40
40
|
|
@@ -69,9 +69,13 @@
|
|
69
69
|
img.onload = (element) ->
|
70
70
|
options = $.lazybox.show(img, options)
|
71
71
|
nextLink = if a.is(':last-child') then a.siblings('a[rel*=lazybox]:first') else a.next('a[rel*=lazybox]:first')
|
72
|
-
if
|
73
|
-
|
74
|
-
|
72
|
+
prevLink = if a.is(':first-child') then a.siblings('a[rel*=lazybox]:last') else a.prev('a[rel*=lazybox]:first')
|
73
|
+
if nextLink.length and prevLink.length
|
74
|
+
$('#lazybox_body:not(:has(a#next_lazy_img))').append("<a id='prev_lazy_img' href=''><b>‹</b></a><a id='next_lazy_img' href=''><b>›</b></a>")
|
75
|
+
$('#next_lazy_img, #prev_lazy_img').bind 'click', (event) ->
|
76
|
+
event.preventDefault()
|
77
|
+
box.fadeOut options.speed, () ->
|
78
|
+
if event.currentTarget.id == 'next_lazy_img' then nextLink.click() else prevLink.click()
|
75
79
|
$(img).attr({ 'class': 'lazy_img', src: href })
|
76
80
|
else
|
77
81
|
$.ajax({
|
@@ -1,3 +1,4 @@
|
|
1
|
+
// Generated by CoffeeScript 1.4.0
|
1
2
|
(function() {
|
2
3
|
|
3
4
|
(function($) {
|
@@ -38,7 +39,7 @@
|
|
38
39
|
close: function(speed) {
|
39
40
|
var effect;
|
40
41
|
speed = speed || defaults.speed;
|
41
|
-
effect = box.position().top === 0 ? 'slideUp' : 'fadeOut';
|
42
|
+
effect = box.position().top - window.scrollY === 0 ? 'slideUp' : 'fadeOut';
|
42
43
|
box[effect](speed);
|
43
44
|
return overlay.fadeOut(speed + 200);
|
44
45
|
},
|
@@ -46,7 +47,9 @@
|
|
46
47
|
var y;
|
47
48
|
if (fixed) {
|
48
49
|
y = onTop ? 0 : (box.outerHeight()) / 2;
|
49
|
-
if (y < 20 && !onTop)
|
50
|
+
if (y < 20 && !onTop) {
|
51
|
+
y = 20;
|
52
|
+
}
|
50
53
|
return box.css({
|
51
54
|
'margin-left': -box.outerWidth() / 2,
|
52
55
|
'margin-top': -y,
|
@@ -56,7 +59,9 @@
|
|
56
59
|
});
|
57
60
|
} else {
|
58
61
|
y = onTop ? 0 : (($(window).height() - $('#lazybox').outerHeight()) / 2) + $(window).scrollTop();
|
59
|
-
if (y < 20 && !onTop)
|
62
|
+
if (y < 20 && !onTop) {
|
63
|
+
y = 20;
|
64
|
+
}
|
60
65
|
return box.css({
|
61
66
|
top: y,
|
62
67
|
left: (($(window).width() - box.outerWidth()) / 2) + $(window).scrollLeft(),
|
@@ -69,7 +74,9 @@
|
|
69
74
|
var message, options;
|
70
75
|
options = $.extend(defaults, $.lazybox.settings);
|
71
76
|
message = element.data('confirm');
|
72
|
-
if (!message)
|
77
|
+
if (!message) {
|
78
|
+
return true;
|
79
|
+
}
|
73
80
|
$.lazybox.show('<p>' + message + '</p><div class="lazy_buttons"></div>', {
|
74
81
|
klass: 'confirm'
|
75
82
|
});
|
@@ -94,14 +101,20 @@
|
|
94
101
|
if (href.match(imagesRegexp)) {
|
95
102
|
img = new Image();
|
96
103
|
img.onload = function(element) {
|
97
|
-
var nextLink,
|
98
|
-
_this = this;
|
104
|
+
var nextLink, prevLink;
|
99
105
|
options = $.lazybox.show(img, options);
|
100
106
|
nextLink = a.is(':last-child') ? a.siblings('a[rel*=lazybox]:first') : a.next('a[rel*=lazybox]:first');
|
101
|
-
|
102
|
-
|
107
|
+
prevLink = a.is(':first-child') ? a.siblings('a[rel*=lazybox]:last') : a.prev('a[rel*=lazybox]:first');
|
108
|
+
if (nextLink.length && prevLink.length) {
|
109
|
+
$('#lazybox_body:not(:has(a#next_lazy_img))').append("<a id='prev_lazy_img' href=''><b>‹</b></a><a id='next_lazy_img' href=''><b>›</b></a>");
|
110
|
+
return $('#next_lazy_img, #prev_lazy_img').bind('click', function(event) {
|
111
|
+
event.preventDefault();
|
103
112
|
return box.fadeOut(options.speed, function() {
|
104
|
-
|
113
|
+
if (event.currentTarget.id === 'next_lazy_img') {
|
114
|
+
return nextLink.click();
|
115
|
+
} else {
|
116
|
+
return prevLink.click();
|
117
|
+
}
|
105
118
|
});
|
106
119
|
});
|
107
120
|
}
|
@@ -160,7 +173,9 @@
|
|
160
173
|
overlay.unbind();
|
161
174
|
}
|
162
175
|
$(document).keyup(function(e) {
|
163
|
-
if (e.keyCode === 27 && options.esc)
|
176
|
+
if (e.keyCode === 27 && options.esc) {
|
177
|
+
return $.lazybox.close(options.speed);
|
178
|
+
}
|
164
179
|
});
|
165
180
|
box.on('click', '#lazybox_close, .lazy_buttons a', function(e) {
|
166
181
|
$.lazybox.close(options.speed);
|
@@ -22,14 +22,15 @@
|
|
22
22
|
z-index: 1001;
|
23
23
|
&.confirm { max-width: 300px; }
|
24
24
|
.lazy_buttons { margin-top: 15px; text-align: right; }
|
25
|
-
img.lazy_img {
|
25
|
+
img.lazy_img { display: block; }
|
26
|
+
#lazybox_body { position: relative; }
|
26
27
|
}
|
27
28
|
|
28
29
|
a#lazybox_close {
|
29
30
|
background: transparent;
|
30
31
|
color: gray;
|
31
32
|
cursor: pointer;
|
32
|
-
font: bold 26px/100% Arial, Helvetica, sans-serif
|
33
|
+
font: bold 26px/100% Arial, Helvetica, sans-serif;
|
33
34
|
height: 25px;
|
34
35
|
position: absolute;
|
35
36
|
right: 0;
|
@@ -38,3 +39,28 @@ a#lazybox_close {
|
|
38
39
|
width: 25px;
|
39
40
|
&:hover { color: black; }
|
40
41
|
}
|
42
|
+
|
43
|
+
a#prev_lazy_img, a#next_lazy_img {
|
44
|
+
background: rgba(0, 0, 0, 0);
|
45
|
+
height: 100%;
|
46
|
+
outline: none;
|
47
|
+
position: absolute;
|
48
|
+
top: 0;
|
49
|
+
text-decoration: none;
|
50
|
+
width: 33px;
|
51
|
+
&:hover {
|
52
|
+
background: rgba(0, 0, 0, 0.3);
|
53
|
+
b { opacity: 0.8; }
|
54
|
+
}
|
55
|
+
b {
|
56
|
+
color: whiteSmoke;
|
57
|
+
font: bold 96px/100% Arial, Helvetica, sans-serif;
|
58
|
+
height: 100px;
|
59
|
+
opacity: 0.3;
|
60
|
+
position: absolute;
|
61
|
+
top: 50%;
|
62
|
+
margin-top: -50px;
|
63
|
+
}
|
64
|
+
}
|
65
|
+
|
66
|
+
a#next_lazy_img { right: 0; }
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lazybox
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-10
|
12
|
+
date: 2012-12-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
16
|
-
requirement:
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,15 @@ dependencies:
|
|
21
21
|
version: '3.1'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '3.1'
|
25
30
|
- !ruby/object:Gem::Dependency
|
26
31
|
name: jquery-rails
|
27
|
-
requirement:
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
28
33
|
none: false
|
29
34
|
requirements:
|
30
35
|
- - ! '>='
|
@@ -32,7 +37,12 @@ dependencies:
|
|
32
37
|
version: '0'
|
33
38
|
type: :development
|
34
39
|
prerelease: false
|
35
|
-
version_requirements:
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
36
46
|
description: Lazybox is a jQuery-based, lightbox that can display entire remote pages,
|
37
47
|
images and confirmation dialogs. Replace standard rails confirmations with lazybox
|
38
48
|
just added several rows to your project. Use lazybox with rails assets pipeline.
|
@@ -45,8 +55,8 @@ files:
|
|
45
55
|
- README.md
|
46
56
|
- lib/lazybox.rb
|
47
57
|
- lib/lazybox/version.rb
|
48
|
-
- vendor/assets/javascripts/lazybox.js.coffee
|
49
58
|
- vendor/assets/javascripts/lazybox.js.js
|
59
|
+
- vendor/assets/javascripts/lazybox.js.coffee
|
50
60
|
- vendor/assets/stylesheets/lazybox.css.scss
|
51
61
|
homepage: https://github.com/galulex/lazybox
|
52
62
|
licenses: []
|
@@ -68,7 +78,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
68
78
|
version: '0'
|
69
79
|
requirements: []
|
70
80
|
rubyforge_project:
|
71
|
-
rubygems_version: 1.8.
|
81
|
+
rubygems_version: 1.8.23
|
72
82
|
signing_key:
|
73
83
|
specification_version: 3
|
74
84
|
summary: Use LazyBox for popup windows with Rails
|