lazybox 0.2.4 → 0.2.5

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
@@ -1,7 +1,5 @@
1
- LazyBox
2
- =======
3
-
4
- [Live Demo](http://lazybox.herokuapp.com/)
1
+ LazyBox [![Build Status](https://travis-ci.org/galulex/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
+ =
5
3
 
6
4
  [Demo Source](https://github.com/galulex/lazybox_demo)
7
5
 
@@ -26,11 +24,7 @@ Then run `bundle install` to update your application's bundle.
26
24
  Include in your `application.css`:
27
25
 
28
26
  ```css
29
- /*
30
- * ...
31
27
  *= require lazybox
32
- * ...
33
- */
34
28
  ```
35
29
 
36
30
  And in `application.js`:
@@ -1,3 +1,3 @@
1
1
  module Lazybox
2
- VERSION = "0.2.4"
2
+ VERSION = "0.2.5"
3
3
  end
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
4
+ version: 0.2.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,24 +9,8 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-10 00:00:00.000000000 Z
12
+ date: 2013-03-17 00:00:00.000000000 Z
13
13
  dependencies:
14
- - !ruby/object:Gem::Dependency
15
- name: rails
16
- requirement: !ruby/object:Gem::Requirement
17
- none: false
18
- requirements:
19
- - - ~>
20
- - !ruby/object:Gem::Version
21
- version: '3.1'
22
- type: :development
23
- prerelease: false
24
- version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
- requirements:
27
- - - ~>
28
- - !ruby/object:Gem::Version
29
- version: '3.1'
30
14
  - !ruby/object:Gem::Dependency
31
15
  name: jquery-rails
32
16
  requirement: !ruby/object:Gem::Requirement
@@ -55,9 +39,8 @@ files:
55
39
  - README.md
56
40
  - lib/lazybox.rb
57
41
  - lib/lazybox/version.rb
58
- - vendor/assets/javascripts/lazybox.js.js
59
- - vendor/assets/javascripts/lazybox.js.coffee
60
- - vendor/assets/stylesheets/lazybox.css.scss
42
+ - app/assets/javascripts/lazybox.js.coffee
43
+ - app/assets/stylesheets/lazybox.css.scss
61
44
  homepage: https://github.com/galulex/lazybox
62
45
  licenses: []
63
46
  post_install_message:
@@ -1,188 +0,0 @@
1
- // Generated by CoffeeScript 1.4.0
2
- (function() {
3
-
4
- (function($) {
5
- var box, close, defaults, html, init, overlay,
6
- _this = this;
7
- defaults = {
8
- overlay: true,
9
- esc: true,
10
- close: true,
11
- modal: true,
12
- opacity: 0.3,
13
- onTop: false,
14
- speed: 300,
15
- fixed: false,
16
- cancelText: 'Cancel',
17
- cancelClass: 'button',
18
- submitText: 'Ok',
19
- submitClass: 'button'
20
- };
21
- html = "<div id='lazybox'><div id='lazybox_body'></div></div>";
22
- box = $('#lazybox');
23
- overlay = $('#lazybox_overlay');
24
- close = $('#lazybox_close');
25
- $.lazybox = function(html, options) {
26
- return $.lazybox.show(html, options);
27
- };
28
- $.extend($.lazybox, {
29
- settings: $.extend({}, defaults),
30
- show: function(content, options) {
31
- var effect;
32
- options = init(options);
33
- $('#lazybox_body').html(content);
34
- $.lazybox.center(options.onTop, options.fixed);
35
- effect = options.onTop ? 'slideDown' : 'fadeIn';
36
- box[effect](options.speed);
37
- return options;
38
- },
39
- close: function(speed) {
40
- var effect;
41
- speed = speed || defaults.speed;
42
- effect = box.position().top - window.scrollY === 0 ? 'slideUp' : 'fadeOut';
43
- box[effect](speed);
44
- return overlay.fadeOut(speed + 200);
45
- },
46
- center: function(onTop, fixed) {
47
- var y;
48
- if (fixed) {
49
- y = onTop ? 0 : (box.outerHeight()) / 2;
50
- if (y < 20 && !onTop) {
51
- y = 20;
52
- }
53
- return box.css({
54
- 'margin-left': -box.outerWidth() / 2,
55
- 'margin-top': -y,
56
- top: (onTop ? 0 : '49%'),
57
- position: 'fixed',
58
- left: '49%'
59
- });
60
- } else {
61
- y = onTop ? 0 : (($(window).height() - $('#lazybox').outerHeight()) / 2) + $(window).scrollTop();
62
- if (y < 20 && !onTop) {
63
- y = 20;
64
- }
65
- return box.css({
66
- top: y,
67
- left: (($(window).width() - box.outerWidth()) / 2) + $(window).scrollLeft(),
68
- position: 'absolute',
69
- margin: 0
70
- });
71
- }
72
- },
73
- confirm: function(element) {
74
- var message, options;
75
- options = $.extend(defaults, $.lazybox.settings);
76
- message = element.data('confirm');
77
- if (!message) {
78
- return true;
79
- }
80
- $.lazybox.show('<p>' + message + '</p><div class="lazy_buttons"></div>', {
81
- klass: 'confirm'
82
- });
83
- element.clone().attr('class', options.submitClass).removeAttr('data-confirm').text(options.submitText).appendTo('.lazy_buttons');
84
- $('.lazy_buttons').append(' ');
85
- $('<a>', {
86
- href: '',
87
- text: options.cancelText,
88
- 'class': options.cancelClass
89
- }).appendTo('.lazy_buttons');
90
- return false;
91
- }
92
- });
93
- $.fn.lazybox = function(options) {
94
- var _this = this;
95
- return $(document).on('click', this.selector, function(e) {
96
- var a, href, imagesRegexp, img;
97
- a = $(e.currentTarget);
98
- href = a.attr('href');
99
- imagesRegexp = new RegExp('\\.(png|jpg|jpeg|gif)(\\?.*)?$', 'i');
100
- e.preventDefault();
101
- if (href.match(imagesRegexp)) {
102
- img = new Image();
103
- img.onload = function(element) {
104
- var nextLink, prevLink;
105
- options = $.lazybox.show(img, options);
106
- nextLink = a.is(':last-child') ? a.siblings('a[rel*=lazybox]:first') : a.next('a[rel*=lazybox]:first');
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();
112
- return box.fadeOut(options.speed, function() {
113
- if (event.currentTarget.id === 'next_lazy_img') {
114
- return nextLink.click();
115
- } else {
116
- return prevLink.click();
117
- }
118
- });
119
- });
120
- }
121
- };
122
- return $(img).attr({
123
- 'class': 'lazy_img',
124
- src: href
125
- });
126
- } else {
127
- return $.ajax({
128
- url: href,
129
- success: function(data) {
130
- return $.lazybox.show(data, options);
131
- },
132
- error: function() {
133
- return $.lazybox.close(options.speed);
134
- }
135
- });
136
- }
137
- });
138
- };
139
- return init = function(options) {
140
- var _this = this;
141
- options = $.extend($.extend({}, defaults), $.lazybox.settings, options);
142
- if (options.overlay) {
143
- $('body:not(:has(#lazybox_overlay))').append("<div id='lazybox_overlay'></div>");
144
- overlay = $('#lazybox_overlay');
145
- overlay.css({
146
- filter: 'alpha(opacity=' + options.opacity * 100 + ')',
147
- opacity: options.opacity
148
- }).fadeIn(options.speed + 200);
149
- }
150
- $('body:not(:has(#lazybox))').append(html);
151
- box = $('#lazybox');
152
- if (options.klass) {
153
- box.attr('class', options.klass);
154
- } else {
155
- box.removeClass();
156
- }
157
- if (options.close) {
158
- box.not(':has(#lazybox_close)').prepend($("<a id='lazybox_close' title='close'></a>"));
159
- close = $('#lazybox_close');
160
- if (options.closeImg) {
161
- close.attr('class', 'img').text('');
162
- } else {
163
- close.removeClass().text('×');
164
- }
165
- } else {
166
- close.remove();
167
- }
168
- if (!options.modal && options.overlay) {
169
- overlay.bind('click', function() {
170
- return $.lazybox.close(options.speed);
171
- });
172
- } else {
173
- overlay.unbind();
174
- }
175
- $(document).keyup(function(e) {
176
- if (e.keyCode === 27 && options.esc) {
177
- return $.lazybox.close(options.speed);
178
- }
179
- });
180
- box.on('click', '#lazybox_close, .lazy_buttons a', function(e) {
181
- $.lazybox.close(options.speed);
182
- return e.preventDefault();
183
- });
184
- return options;
185
- };
186
- })(jQuery);
187
-
188
- }).call(this);