lazybox 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +1 -1
- data/app/assets/javascripts/lazybox.js.coffee +5 -2
- data/lib/lazybox/version.rb +1 -1
- metadata +12 -13
- data/app/assets/javascripts/lazybox.js.js +0 -130
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
LazyBox [![Build Status](https://travis-ci.org/
|
1
|
+
LazyBox [![Build Status](https://travis-ci.org/activebridge/lazybox.png?branch=master)](https://travis-ci.org/galulex/lazybox) [![Gem Version](https://badge.fury.io/rb/lazybox.png)](http://badge.fury.io/rb/webhostinghub-glyphs-rails) [![endorse](http://api.coderwall.com/galulex/endorsecount.png)](http://coderwall.com/galulex)
|
2
2
|
=
|
3
3
|
|
4
4
|
[Live Demo](http://lazybox.herokuapp.com/)
|
@@ -57,14 +57,17 @@
|
|
57
57
|
box = $('#lazybox')
|
58
58
|
overlay = $('#lazy_overlay')
|
59
59
|
close = $('#lazy_close')
|
60
|
-
box.click (e) -> e.stopPropagation()
|
61
60
|
if options.klass then box.attr('class', options.klass) else box.removeClass()
|
62
61
|
if options.onTop then overlay.addClass('top') else overlay.removeClass('top')
|
63
62
|
if options.close
|
64
63
|
if options.closeImg then close.addClass('img') else close.removeClass('img')
|
65
64
|
else
|
66
65
|
close.removeClass()
|
67
|
-
if options.modal
|
66
|
+
if options.modal
|
67
|
+
overlay.unbind()
|
68
|
+
else
|
69
|
+
overlay.bind 'click', (e) ->
|
70
|
+
$.lazybox.close() if e.target == @
|
68
71
|
$(document).keyup (e) -> $.lazybox.close() if e.keyCode == 27 and options.esc
|
69
72
|
box.on 'click', '#lazy_close, .lazy_buttons a.cancel', (e) ->
|
70
73
|
$.lazybox.close()
|
data/lib/lazybox/version.rb
CHANGED
metadata
CHANGED
@@ -1,32 +1,32 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lazybox
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.1
|
4
5
|
prerelease:
|
5
|
-
version: 1.0.0
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Alex Galushka
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-04-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
|
-
|
15
|
+
name: jquery-rails
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
16
18
|
requirements:
|
17
19
|
- - ! '>='
|
18
20
|
- !ruby/object:Gem::Version
|
19
21
|
version: '0'
|
20
|
-
none: false
|
21
|
-
prerelease: false
|
22
22
|
type: :development
|
23
|
-
|
24
|
-
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
25
26
|
requirements:
|
26
27
|
- - ! '>='
|
27
28
|
- !ruby/object:Gem::Version
|
28
29
|
version: '0'
|
29
|
-
none: false
|
30
30
|
description: Lazybox is a jQuery-based, lightbox that can display entire remote pages,
|
31
31
|
images and confirmation dialogs. Replace standard rails confirmations with lazybox
|
32
32
|
just added several rows to your project. Use lazybox with rails assets pipeline.
|
@@ -39,9 +39,8 @@ files:
|
|
39
39
|
- README.md
|
40
40
|
- lib/lazybox/version.rb
|
41
41
|
- lib/lazybox.rb
|
42
|
-
- app/assets/javascripts/lazybox.js.coffee
|
43
|
-
- app/assets/javascripts/lazybox.js.js
|
44
42
|
- app/assets/stylesheets/lazybox.css.scss
|
43
|
+
- app/assets/javascripts/lazybox.js.coffee
|
45
44
|
homepage: https://github.com/galulex/lazybox
|
46
45
|
licenses: []
|
47
46
|
post_install_message:
|
@@ -49,20 +48,20 @@ rdoc_options: []
|
|
49
48
|
require_paths:
|
50
49
|
- lib
|
51
50
|
required_ruby_version: !ruby/object:Gem::Requirement
|
51
|
+
none: false
|
52
52
|
requirements:
|
53
53
|
- - ! '>='
|
54
54
|
- !ruby/object:Gem::Version
|
55
55
|
version: '0'
|
56
|
-
none: false
|
57
56
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
58
|
requirements:
|
59
59
|
- - ! '>='
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
|
-
none: false
|
63
62
|
requirements: []
|
64
63
|
rubyforge_project:
|
65
|
-
rubygems_version: 1.8.
|
64
|
+
rubygems_version: 1.8.23
|
66
65
|
signing_key:
|
67
66
|
specification_version: 3
|
68
67
|
summary: Use LazyBox for popup windows with Rails
|
@@ -1,130 +0,0 @@
|
|
1
|
-
// Generated by CoffeeScript 1.4.0
|
2
|
-
(function() {
|
3
|
-
|
4
|
-
(function($) {
|
5
|
-
var box, close, defaults, html, init, overlay;
|
6
|
-
defaults = {
|
7
|
-
esc: true,
|
8
|
-
close: true,
|
9
|
-
modal: true,
|
10
|
-
onTop: false,
|
11
|
-
cancelText: 'Cancel',
|
12
|
-
cancelClass: 'btn',
|
13
|
-
submitText: 'Ok',
|
14
|
-
submitClass: 'btn'
|
15
|
-
};
|
16
|
-
html = "<div id='lazy_overlay'><div id='lazybox'><a id='lazy_close' href=''></a><div id='lazy_body'></div></div></div>";
|
17
|
-
box = overlay = close = null;
|
18
|
-
$.lazybox = function(html, options) {
|
19
|
-
return $.lazybox.show(html, options);
|
20
|
-
};
|
21
|
-
$.extend($.lazybox, {
|
22
|
-
settings: $.extend({}, defaults),
|
23
|
-
show: function(content, options) {
|
24
|
-
options = init(options);
|
25
|
-
$('#lazy_body').html(content);
|
26
|
-
setTimeout((function() {
|
27
|
-
return overlay.addClass('visible');
|
28
|
-
}), 1);
|
29
|
-
if (options.close && !box.hasClass('visible')) {
|
30
|
-
return close.addClass('visible');
|
31
|
-
}
|
32
|
-
},
|
33
|
-
close: function() {
|
34
|
-
return overlay.removeClass('visible');
|
35
|
-
},
|
36
|
-
confirm: function(element) {
|
37
|
-
var message, options;
|
38
|
-
options = $.extend(defaults, $.lazybox.settings);
|
39
|
-
message = element.data('confirm');
|
40
|
-
if (!message) {
|
41
|
-
return true;
|
42
|
-
}
|
43
|
-
$.lazybox.show('<p>' + message + '</p><div class="lazy_buttons"></div>', {
|
44
|
-
klass: 'confirm'
|
45
|
-
});
|
46
|
-
element.clone().attr('class', options.submitClass).removeAttr('data-confirm').text(options.submitText).appendTo('.lazy_buttons');
|
47
|
-
$('.lazy_buttons').append(' ');
|
48
|
-
$('<a>', {
|
49
|
-
href: '',
|
50
|
-
text: options.cancelText,
|
51
|
-
'class': 'cancel ' + options.cancelClass
|
52
|
-
}).appendTo('.lazy_buttons');
|
53
|
-
return false;
|
54
|
-
}
|
55
|
-
});
|
56
|
-
$.fn.lazybox = function(options) {
|
57
|
-
return $(document).on('click', this.selector, function(e) {
|
58
|
-
var a, href, imagesRegexp, img;
|
59
|
-
a = $(e.currentTarget);
|
60
|
-
href = a.attr('href');
|
61
|
-
imagesRegexp = new RegExp('\\.(png|jpg|jpeg|gif)(\\?.*)?$', 'i');
|
62
|
-
e.preventDefault();
|
63
|
-
if (href.match(imagesRegexp)) {
|
64
|
-
img = new Image();
|
65
|
-
img.onload = function(element) {
|
66
|
-
return $.lazybox.show(img, options);
|
67
|
-
};
|
68
|
-
return $(img).attr({
|
69
|
-
'class': 'lazy-img',
|
70
|
-
src: href
|
71
|
-
});
|
72
|
-
} else {
|
73
|
-
return $.ajax({
|
74
|
-
url: href,
|
75
|
-
success: function(data) {
|
76
|
-
return $.lazybox.show(data, options);
|
77
|
-
},
|
78
|
-
error: function() {
|
79
|
-
return $.lazybox.close();
|
80
|
-
}
|
81
|
-
});
|
82
|
-
}
|
83
|
-
});
|
84
|
-
};
|
85
|
-
return init = function(options) {
|
86
|
-
options = $.extend({}, defaults, $.lazybox.settings, options);
|
87
|
-
$('body:not(:has(#lazybox))').append(html);
|
88
|
-
box = $('#lazybox');
|
89
|
-
overlay = $('#lazy_overlay');
|
90
|
-
close = $('#lazy_close');
|
91
|
-
if (options.klass) {
|
92
|
-
box.attr('class', options.klass);
|
93
|
-
} else {
|
94
|
-
box.removeClass();
|
95
|
-
}
|
96
|
-
if (options.onTop) {
|
97
|
-
overlay.addClass('top');
|
98
|
-
} else {
|
99
|
-
overlay.removeClass('top');
|
100
|
-
}
|
101
|
-
if (options.close) {
|
102
|
-
if (options.closeImg) {
|
103
|
-
close.addClass('img');
|
104
|
-
} else {
|
105
|
-
close.removeClass('img');
|
106
|
-
}
|
107
|
-
} else {
|
108
|
-
close.removeClass();
|
109
|
-
}
|
110
|
-
if (options.modal) {
|
111
|
-
overlay.unbind();
|
112
|
-
} else {
|
113
|
-
overlay.bind('click', function() {
|
114
|
-
return $.lazybox.close();
|
115
|
-
});
|
116
|
-
}
|
117
|
-
$(document).keyup(function(e) {
|
118
|
-
if (e.keyCode === 27 && options.esc) {
|
119
|
-
return $.lazybox.close();
|
120
|
-
}
|
121
|
-
});
|
122
|
-
box.on('click', '#lazy_close, .lazy_buttons a.cancel', function(e) {
|
123
|
-
$.lazybox.close();
|
124
|
-
return e.preventDefault();
|
125
|
-
});
|
126
|
-
return options;
|
127
|
-
};
|
128
|
-
})(jQuery);
|
129
|
-
|
130
|
-
}).call(this);
|