lazybox 1.1.3 → 1.1.4
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f7fa2b1d4a7040bc1171038eeeb9ab436255f3c4
|
4
|
+
data.tar.gz: 072994ec343545806ead183c145d182b386bbc8c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1389d78c35035be6658c38f73250b32e7d956938611df5f6f78a3c8f109d08a06379266cf4467ac9affdd5444012c8ccabc4085489ce8d2eba5ffc8004f373e5
|
7
|
+
data.tar.gz: c5e1311c4800d7ad349cf23c745b591b780aae9b804bc3a54b04630b63b31ef6aa62bf7a4daeb079fefab90354455c12ad3aa343067a892c251dea8f65771a4a
|
File without changes
|
File without changes
|
data/lib/lazybox/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lazybox
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alex Galushka
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-02-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jquery-rails
|
@@ -34,9 +34,8 @@ extensions: []
|
|
34
34
|
extra_rdoc_files: []
|
35
35
|
files:
|
36
36
|
- README.md
|
37
|
-
- app/assets/javascripts/lazybox.
|
38
|
-
- app/assets/
|
39
|
-
- app/assets/stylesheets/lazybox.css.scss
|
37
|
+
- app/assets/javascripts/lazybox.coffee
|
38
|
+
- app/assets/stylesheets/lazybox.scss
|
40
39
|
- lib/lazybox.rb
|
41
40
|
- lib/lazybox/version.rb
|
42
41
|
homepage: https://github.com/galulex/lazybox
|
@@ -1,96 +0,0 @@
|
|
1
|
-
// Generated by CoffeeScript 1.4.0
|
2
|
-
(function() {
|
3
|
-
|
4
|
-
(function($) {
|
5
|
-
var defaults, init;
|
6
|
-
defaults = {
|
7
|
-
esc: true,
|
8
|
-
close: true,
|
9
|
-
modal: false,
|
10
|
-
klass: '',
|
11
|
-
cancelText: 'Cancel',
|
12
|
-
cancelClass: 'btn',
|
13
|
-
submitText: 'Ok',
|
14
|
-
submitClass: 'btn'
|
15
|
-
};
|
16
|
-
$.lazybox = function(html, options) {
|
17
|
-
return $.lazybox.show(html, options);
|
18
|
-
};
|
19
|
-
$.extend($.lazybox, {
|
20
|
-
settings: $.extend({}, defaults),
|
21
|
-
show: function(content, options) {
|
22
|
-
options = init(options);
|
23
|
-
$('#lazy_body').html(content);
|
24
|
-
return $('#lazy_overlay').addClass('active');
|
25
|
-
},
|
26
|
-
close: function() {
|
27
|
-
return $('#lazy_overlay').removeClass();
|
28
|
-
},
|
29
|
-
confirm: function(element) {
|
30
|
-
var message, options;
|
31
|
-
options = $.extend(defaults, $.lazybox.settings);
|
32
|
-
message = element.data('confirm');
|
33
|
-
if (!message) {
|
34
|
-
return true;
|
35
|
-
}
|
36
|
-
$.lazybox.show('<p>' + message + '</p><div class="lazy_buttons"></div>', {
|
37
|
-
klass: 'confirm'
|
38
|
-
});
|
39
|
-
element.clone().attr('class', options.submitClass).removeAttr('data-confirm').text(options.submitText).appendTo('.lazy_buttons');
|
40
|
-
$('.lazy_buttons').append(' ');
|
41
|
-
$('<button>', {
|
42
|
-
text: options.cancelText,
|
43
|
-
'class': 'cancel ' + options.cancelClass
|
44
|
-
}).appendTo('.lazy_buttons');
|
45
|
-
return false;
|
46
|
-
}
|
47
|
-
});
|
48
|
-
$.fn.lazybox = function(options) {
|
49
|
-
return $(document).on('click', this.selector, function(e) {
|
50
|
-
var a, href, imagesRegexp, img;
|
51
|
-
a = $(e.currentTarget);
|
52
|
-
href = a.attr('href');
|
53
|
-
imagesRegexp = new RegExp('\\.(png|jpg|jpeg|gif)(\\?.*)?$', 'i');
|
54
|
-
e.preventDefault();
|
55
|
-
if (href.match(imagesRegexp)) {
|
56
|
-
img = new Image();
|
57
|
-
img.onload = function(element) {
|
58
|
-
return $.lazybox.show(img, options);
|
59
|
-
};
|
60
|
-
return $(img).attr({
|
61
|
-
'class': 'lazy-img',
|
62
|
-
src: href
|
63
|
-
});
|
64
|
-
} else {
|
65
|
-
return $.ajax({
|
66
|
-
url: href,
|
67
|
-
success: function(data) {
|
68
|
-
return $.lazybox.show(data, options);
|
69
|
-
},
|
70
|
-
error: function() {
|
71
|
-
return $.lazybox.close();
|
72
|
-
}
|
73
|
-
});
|
74
|
-
}
|
75
|
-
});
|
76
|
-
};
|
77
|
-
return init = function(options) {
|
78
|
-
options = $.extend({}, defaults, $.lazybox.settings, options);
|
79
|
-
$('#lazybox').attr('class', options.klass);
|
80
|
-
$('#lazy_close').toggleClass('visible', options.close);
|
81
|
-
if (!options.modal) {
|
82
|
-
$('#lazy_overlay').one('click', $.lazybox.close);
|
83
|
-
}
|
84
|
-
$(document).on('keyup.lazy', function(e) {
|
85
|
-
if (e.keyCode === 27 && options.esc) {
|
86
|
-
$.lazybox.close();
|
87
|
-
return $(document).off('keyup.lazy');
|
88
|
-
}
|
89
|
-
});
|
90
|
-
return options;
|
91
|
-
};
|
92
|
-
})(jQuery);
|
93
|
-
|
94
|
-
$(document).on('click', '#lazy_close, .lazy_buttons .cancel', $.lazybox.close);
|
95
|
-
|
96
|
-
}).call(this);
|