lazybox 0.1.7 → 0.1.8
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 +2 -1
- data/lib/lazybox/version.rb +1 -1
- data/vendor/assets/javascripts/lazybox.js +15 -12
- metadata +6 -5
data/README.md
CHANGED
@@ -156,8 +156,9 @@ Options
|
|
156
156
|
esc: true|false //default true. Close lazybox on esc press
|
157
157
|
close: true|false //default true. Show close lazybox button
|
158
158
|
niceClose: true|false //default true. Show nice close button like in fancybox(IE always shows simple close button)
|
159
|
-
closeImg: true|false //default false. Use image for close link
|
160
159
|
modal: true|false //default true. Close lazybox on overlay click
|
160
|
+
closeImg: true|false //default false. Use image for close link
|
161
|
+
onTop: true|false //default false. Show lazybox on top instead of on center. It will use slide animation instead of fade.
|
161
162
|
opacity: 0.6 //default 0.3. Set opacity for lazybox overlay
|
162
163
|
klass: 'class' // Set class for lazybox. <div id='lazybox' class='class'>...</div>
|
163
164
|
//confirmation options
|
data/lib/lazybox/version.rb
CHANGED
@@ -1,26 +1,28 @@
|
|
1
1
|
(function($){
|
2
|
-
var defaults = {overlay: true, esc: true, close: true, niceClose: true, modal: true, opacity: 0.3, cancelText: 'Cancel', cancelClass: 'button', submitText: 'Ok', submitClass: 'button'}
|
3
|
-
$.lazybox = function(html){ $.lazybox.show(html) }
|
2
|
+
var defaults = {overlay: true, esc: true, close: true, niceClose: true, modal: true, opacity: 0.3, onTop: false, cancelText: 'Cancel', cancelClass: 'button', submitText: 'Ok', submitClass: 'button'}, effect, y
|
3
|
+
$.lazybox = function(html, options){ $.lazybox.show(html, options) }
|
4
4
|
$.extend($.lazybox, {
|
5
5
|
settings: $.extend({}, defaults),
|
6
6
|
show: function(content, options){
|
7
|
-
init(options)
|
7
|
+
var onTop = init(options).onTop
|
8
8
|
$('#lazybox_body').html(content)
|
9
|
-
$.lazybox.center()
|
10
|
-
|
9
|
+
$.lazybox.center(onTop);
|
10
|
+
(onTop) ? effect = 'slideDown' : effect = 'fadeIn'
|
11
|
+
$('#lazybox')[effect](300)
|
11
12
|
},
|
12
13
|
close: function(){
|
13
|
-
$('#lazybox').
|
14
|
+
($('#lazybox').position().top == 0) ? effect = 'slideUp' : effect = 'fadeOut'
|
15
|
+
$('#lazybox')[effect](300)
|
14
16
|
$('#lazybox_overlay').fadeOut(500)
|
15
17
|
},
|
16
|
-
center: function(){
|
17
|
-
|
18
|
-
$('#lazybox').css({ top: ((
|
18
|
+
center: function(onTop){
|
19
|
+
(onTop) ? y = 0 : y = (($(window).height()-$('#lazybox').outerHeight())/2)+$(window).scrollTop()
|
20
|
+
$('#lazybox').css({ top: ((y < 20 && !onTop) ? 20 : y), left:(($(window).width()-$('#lazybox').outerWidth())/2)+$(window).scrollLeft()})
|
19
21
|
},
|
20
22
|
confirm: function(element){
|
21
23
|
var options = $.extend(defaults, $.lazybox.settings)
|
22
24
|
var message = element.data('confirm')
|
23
|
-
if (!message)
|
25
|
+
if (!message) return true
|
24
26
|
$.lazybox.show('<p>'+message+'</p><div class="lazy_buttons"><div>', {klass: 'confirm'})
|
25
27
|
element.clone().attr('class', options.submitClass).removeAttr('data-confirm').text(options.submitText).appendTo('.lazy_buttons')
|
26
28
|
$('.lazy_buttons').append(' ')
|
@@ -32,7 +34,7 @@
|
|
32
34
|
var a = $(this), href = a.attr('href'), imagesRegexp = new RegExp('\\.(png|jpg|jpeg|gif)(\\?.*)?$', 'i')
|
33
35
|
e.preventDefault()
|
34
36
|
if (href.match(imagesRegexp)){
|
35
|
-
var img = new Image()
|
37
|
+
var img = new Image(), nextLink
|
36
38
|
img.onload = function(element){
|
37
39
|
$.lazybox.show(img, options);
|
38
40
|
(a.is(':last-child')) ? nextLink = a.siblings('a[rel*=lazybox]:first') : nextLink = a.next('a[rel*=lazybox]:first')
|
@@ -54,11 +56,12 @@
|
|
54
56
|
if (options.close) {
|
55
57
|
$('#lazybox:not(:has(#lazybox_close))').prepend($("<a id='lazybox_close' title='close'></a>"));
|
56
58
|
(options.closeImg) ? $('#lazybox_close').attr('class', 'img').text('') : $('#lazybox_close').removeClass().text('×')
|
57
|
-
if (!$.browser.msie && options.niceClose && !options.closeImg) $('#lazybox_close').attr('class', 'nice')
|
59
|
+
if (!$.browser.msie && options.niceClose && !options.closeImg && !options.onTop) $('#lazybox_close').attr('class', 'nice')
|
58
60
|
} else $('#lazybox_close').remove();
|
59
61
|
(!options.modal && options.overlay) ? $('#lazybox_overlay').bind('click', function(){ $.lazybox.close() }) : $('#lazybox_overlay').unbind()
|
60
62
|
$(document).keyup(function(e) { if (e.keyCode == 27 && options.esc) $.lazybox.close() })
|
61
63
|
$('#lazybox_close, #lazybox_body .lazy_buttons a').live('click', function(e){ $.lazybox.close(); e.preventDefault() })
|
64
|
+
return options
|
62
65
|
}
|
63
66
|
|
64
67
|
})(jQuery);
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lazybox
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 11
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 8
|
10
|
+
version: 0.1.8
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Alex Galushka
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-04-
|
18
|
+
date: 2012-04-04 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: rails
|
@@ -94,9 +94,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
94
94
|
requirements: []
|
95
95
|
|
96
96
|
rubyforge_project:
|
97
|
-
rubygems_version: 1.8.
|
97
|
+
rubygems_version: 1.8.21
|
98
98
|
signing_key:
|
99
99
|
specification_version: 3
|
100
100
|
summary: Use LazyBox for popup windows with Rails
|
101
101
|
test_files: []
|
102
102
|
|
103
|
+
has_rdoc:
|