aightbox-rails 0.1.2 → 0.1.3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 02b13015f94d98263eaa1827c93f4023db4bb4d8
4
- data.tar.gz: bfc0fc7b73d8ec34675aa440576740eeb4777b7c
3
+ metadata.gz: 8f3ce0fae238baf7297a3233b2567366b92685ac
4
+ data.tar.gz: b386a3ef14b21d02bb72cee6459631adec675db4
5
5
  SHA512:
6
- metadata.gz: e1cbab2ae68e83c193c3b26d15da909426716649176d6c143a508e750c562aec4595d571cc3b96734807901625e09318903a0b0594af57452938c506dcdcdd39
7
- data.tar.gz: 48460191a96109b192535db6d44068d0f64681c73c007d27e32126f120fc95c10f774f5e2e057b375f8eb58844113adfefe66e1d45516afbb3d29da2bcb71dad
6
+ metadata.gz: 0cef4dfda231d484a4482d76c6d50a88327594be869231d8b01b902b867df487c5f74b89bb11a7c87f076e320896a92d557aefa3f5488a0c7d5d27624cd9f9eb
7
+ data.tar.gz: a3ec8cc135ff3f5ea16012eef4c65a5cf42279b49c496da82940b5bd11348aa13ce2175a206ceb32ff6a88ee8b0a7ae2ec524edaac604e29a690677c00908130
@@ -1,5 +1,5 @@
1
1
  module Aightbox
2
2
  module Rails
3
- VERSION = "0.1.2"
3
+ VERSION = "0.1.3"
4
4
  end
5
5
  end
@@ -1,296 +1 @@
1
- (function($, window, document, undefined) {
2
-
3
- 'use strict';
4
-
5
- $.fn.aightbox = function(options) {
6
-
7
- var init,
8
- index,
9
- setNextImage,
10
- setNextGroupImage,
11
- getGroupList,
12
- firstSetup,
13
- $imageLinks,
14
- $imageDesc,
15
- $backdrop,
16
- $wrapper,
17
- $container,
18
- $currentImage,
19
- $spinner,
20
- bindEvents,
21
- bindControls,
22
- createImageContainer,
23
- that,
24
- config,
25
- template,
26
- singleImage = false;
27
-
28
- that = this;
29
-
30
- config = $.extend({
31
-
32
- backdrop: 'aight-backdrop',
33
- closeButton: 'aight-close',
34
- carousel: false,
35
- carouselGroup: true,
36
- closeCharacter: 'x',
37
- imageContainer: 'aight-container',
38
- imageDescription: 'aight-description',
39
- nextButton: 'aight-next',
40
- nextCharacter: '>',
41
- prevCharacter: '<',
42
- prevButton: 'aight-prev',
43
- spinnerClass: 'aight-progress small',
44
- wrapper: 'aight-wrapper'
45
-
46
- }, options);
47
-
48
-
49
- // @desc basic html structure of the lightbox
50
- // id's are generated from the config data
51
-
52
- template = '<div id="' + config.backdrop + '"></div>'+
53
- '<div id="' + config.wrapper + '">'+
54
- '<div id="' + config.imageContainer + '">' +
55
- '<div id="' + config.nextButton + '" >' +
56
- '<a href="#">'+ config.nextCharacter +'</a>'+
57
- '</div>' +
58
- '<div id="' + config.prevButton + '">' +
59
- '<a href="#">' + config.prevCharacter +'</a>'+
60
- '</div>' +
61
- '<div id="' + config.closeButton + '">' +
62
- '<a href="#">' + config.closeCharacter + '</a>'+
63
- '</div>' +
64
- '<img src="" alt=""/>' +
65
- '<p id="' + config.imageDescription + '"></p>'+
66
- '<div class="' + config.spinnerClass +'" style="display: none;"><div>Loading…</div></div>' +
67
- '</div>' +
68
- '</div>';
69
-
70
-
71
- // @desc finds the closest 'ul' node to the current image
72
- // returns an array of all link elements inside this node
73
- // returns an empty array if the current image is not in the list clostest to it
74
-
75
- getGroupList = function() {
76
- var list = $currentImage.closest('ul').find('a');
77
-
78
- if(list.length > 1 && list.index($currentImage) >= 0) {
79
- return list;
80
- } else {
81
- return [];
82
- }
83
-
84
- };
85
-
86
- // @desc sets the next image
87
- // @param dir - 'prev' dicreases the index anything else increases it
88
-
89
- setNextImage = function(dir) {
90
-
91
- if(dir === 'prev') {
92
- index = index > 0 ? index - 1 : $imageLinks.length - 1;
93
- } else {
94
- index = index < $imageLinks.length-1 ? index + 1 : 0;
95
- }
96
-
97
- $currentImage = $($imageLinks[index]);
98
-
99
- };
100
-
101
- // @desc sets the next image of a group
102
- // @param dir - 'prev' dicreases the index anything else increases it
103
-
104
- setNextGroupImage = function(dir) {
105
-
106
- var groupIndex,
107
- groupList;
108
-
109
- groupList = getGroupList();
110
-
111
- if(groupList.length > 0) {
112
-
113
- groupIndex = groupList.index($currentImage);
114
-
115
- if(dir === 'prev') {
116
- groupIndex = groupIndex > 0 ? groupIndex - 1 : groupList.length -1;
117
- } else {
118
- groupIndex = groupIndex < groupList.length - 1 ? groupIndex + 1 : 0;
119
- }
120
-
121
- $currentImage = $(groupList[groupIndex]);
122
-
123
- }
124
-
125
- return $currentImage;
126
-
127
- };
128
-
129
- // @desc sets click events for the lightbox
130
- // get initiated after the first time a link is clicked
131
-
132
- bindControls = function() {
133
-
134
- if(!singleImage) {
135
-
136
- $('#' + config.prevButton).unbind('click').click(function(e){
137
- e.preventDefault();
138
-
139
- if(config.carouselGroup){
140
- setNextGroupImage('prev');
141
- } else if (config.carousel) {
142
- setNextImage('prev');
143
- }
144
-
145
- createImageContainer();
146
- });
147
-
148
- $('#' + config.nextButton).unbind('click').click(function(e){
149
- e.preventDefault();
150
-
151
- if(config.carouselGroup){
152
- setNextGroupImage('next');
153
- } else if (config.carousel) {
154
- setNextImage('next');
155
- }
156
-
157
- createImageContainer();
158
-
159
- });
160
-
161
- }
162
-
163
-
164
- $('#' + config.closeButton).on('click', function(e){
165
-
166
- e.preventDefault();
167
- $wrapper.fadeOut('slow');
168
- $backdrop.hide();
169
-
170
- });
171
-
172
-
173
- $('#' + config.backdrop).unbind('click').click(function(e){
174
- e.preventDefault();
175
- $wrapper.fadeOut('slow');
176
- $backdrop.hide();
177
- });
178
-
179
- };
180
-
181
-
182
- firstSetup = function() {
183
-
184
- $('body').append(template);
185
-
186
- $backdrop = $('#' + config.backdrop);
187
- $wrapper = $('#' + config.wrapper);
188
- $container = $('#' + config.imageContainer);
189
- $imageDesc = $('#' + config.imageDescription);
190
- $spinner = $('#' + config.imageContainer + ' .' + config.spinnerClass.split(' ')[0] );
191
-
192
- if($imageLinks.length === 1) {
193
- $('#' + config.prevButton).hide();
194
- $('#' + config.nextButton).hide();
195
- singleImage = true;
196
- }
197
-
198
- };
199
-
200
-
201
- bindEvents = function() {
202
-
203
- $imageLinks.on('click', function(e){
204
-
205
- e.preventDefault();
206
-
207
- var list;
208
-
209
- $currentImage = $(this);
210
-
211
- list = getGroupList();
212
-
213
- if(list.length > 1 ){
214
- $('#' + config.prevButton).show();
215
- $('#' + config.nextButton).show();
216
- } else {
217
- $('#' + config.prevButton).hide();
218
- $('#' + config.nextButton).hide();
219
- }
220
-
221
- index = $imageLinks.index($currentImage);
222
- createImageContainer();
223
- });
224
-
225
- };
226
-
227
- createImageContainer = function() {
228
-
229
- var $containerImage = $('#' + config.imageContainer + ' img'),
230
- firstRun = false,
231
- imgUrl = $currentImage.prop('href'),
232
- imgDescription = $currentImage.find('img').prop('alt');
233
-
234
- if($containerImage.length === 0){
235
- firstSetup();
236
- $('#' + config.imageContainer + ' img').prop('src', imgUrl);
237
- $('#' + config.imageContainer + ' img').prop('alt', imgDescription);
238
- $('#aight-description').text(imgDescription);
239
- firstRun = true;
240
- } else {
241
- $containerImage.prop('src', imgUrl);
242
- $containerImage.prop('alt', imgDescription);
243
- $('#aight-description').text(imgDescription);
244
- }
245
-
246
- $containerImage = $('#' + config.imageContainer + ' img');
247
- $container = $('#' + config.imageContainer);
248
-
249
- if(firstRun){
250
-
251
- bindControls();
252
-
253
- if(getGroupList() <= 1){
254
- $('#' + config.prevButton).hide();
255
- $('#' + config.nextButton).hide();
256
- }
257
-
258
- }
259
-
260
- $imageDesc.hide();
261
-
262
- $containerImage.hide();
263
- $wrapper.fadeIn('slow');
264
- $spinner.show();
265
-
266
- $containerImage.one('load',function(){
267
-
268
- $spinner.hide();
269
- $containerImage.show();
270
-
271
- if(imgDescription !== ''){
272
- $imageDesc.show();
273
- }
274
-
275
- $container.animate({
276
- 'margin-left':-($containerImage.width()/2),
277
- 'margin-top': -($containerImage.height()/2)
278
- });
279
-
280
- });
281
-
282
- $backdrop.fadeIn(200);
283
-
284
- };
285
-
286
- init = function() {
287
- $imageLinks = $(that.selector);
288
- bindEvents();
289
- };
290
-
291
- init();
292
- return that;
293
-
294
- };
295
-
296
- } (jQuery, window, document));
1
+ !function(e){"use strict";e.fn.aightbox=function(t){var i,n,a,r,o,p,d,c,l,s,u,h,g,v,f,m,x,w,C,B,k=!1;return w=this,C=e.extend({animate:!1,backdrop:"aight-backdrop",closeButton:"aight-close",carousel:!1,carouselGroup:!0,closeCharacter:"x",imageContainer:"aight-container",imageDescription:"aight-description",imageWrapper:"aight-image-wrapper",nextButton:"aight-next",nextCharacter:">",prevCharacter:"<",prevButton:"aight-prev",preloadImages:!1,spinnerClass:"aight-progress small",wrapper:"aight-wrapper"},t),B='<div id="'+C.backdrop+'"></div><div id="'+C.wrapper+'"><div id="'+C.imageContainer+'"><div id="'+C.nextButton+'" ><a href="#">'+C.nextCharacter+'</a></div><div id="'+C.prevButton+'"><a href="#">'+C.prevCharacter+'</a></div><div id="'+C.closeButton+'"><a href="#">'+C.closeCharacter+'</a></div><div id="'+C.imageWrapper+'"><img src="" alt=""/></div><p id="'+C.imageDescription+'"></p><div class="'+C.spinnerClass+'" style="display: none;"><div>Loading…</div></div></div></div>',o=function(){var e=h.closest("ul").find("a");return e.length>1&&e.index(h)>=0?e:[]},a=function(t){n="prev"===t?n>0?n-1:d.length-1:n<d.length-1?n+1:0,h=e(d[n])},r=function(t){var i,n;return n=o(),n.length>0&&(i=n.index(h),i="prev"===t?i>0?i-1:n.length-1:i<n.length-1?i+1:0,h=e(n[i])),h},f=function(){k||(e("#"+C.prevButton).unbind("click").click(function(e){e.preventDefault(),C.carouselGroup?r("prev"):C.carousel&&a("prev"),m()}),e("#"+C.nextButton).unbind("click").click(function(e){e.preventDefault(),C.carouselGroup?r("next"):C.carousel&&a("next"),m()})),e("#"+C.closeButton).on("click",function(e){e.preventDefault(),s.fadeOut("slow"),l.hide()}),e("#"+C.backdrop).unbind("click").click(function(e){e.preventDefault(),s.fadeOut("slow"),l.hide()})},p=function(){e("body").append(B),l=e("#"+C.backdrop),s=e("#"+C.wrapper),u=e("#"+C.imageContainer),c=e("#"+C.imageDescription),g=e("#"+C.imageContainer+" ."+C.spinnerClass.split(" ")[0]),1===d.length&&(e("#"+C.prevButton).hide(),e("#"+C.nextButton).hide(),k=!0)},v=function(){d.on("click",function(t){t.preventDefault();var i;h=e(this),i=o(),i.length>1?(e("#"+C.prevButton).show(),e("#"+C.nextButton).show()):(e("#"+C.prevButton).hide(),e("#"+C.nextButton).hide()),n=d.index(h),m()})},m=function(){var t=e("#"+C.imageContainer+" img"),i=!1,n=h.prop("href"),a=h.find("img").prop("alt");0===t.length?(p(),e("#"+C.imageContainer+" img").prop("src",n),e("#"+C.imageContainer+" img").prop("alt",a),e("#aight-description").text(a),i=!0):(t.prop("src",n),t.prop("alt",a),e("#aight-description").text(a)),t=e("#"+C.imageContainer+" img"),u=e("#"+C.imageContainer),i&&(f(),o()<=1&&(e("#"+C.prevButton).hide(),e("#"+C.nextButton).hide())),c.hide(),t.hide(),s.fadeIn("slow"),g.show(),t.one("load",function(){g.hide(),t.show(),""!==a&&c.show(),C.animate===!0?u.animate({"margin-left":-(t.width()/2),"margin-top":-(t.height()/2)}):u.css({"margin-left":-(t.width()/2),"margin-top":-(t.height()/2)})}),l.fadeIn(200)},x=function(){var t='<div id="aight-preload" style="display: none;"></div>',i=[];e("body").append(t),d.each(function(){var e=new Image;e.src=this.href,i.push(e)}),e("#aight-preload").append(i)},i=function(){d=e(w.selector),C.preloadImages===!0&&x(),v()},i(),w}}(jQuery,window,document);
@@ -95,7 +95,7 @@
95
95
  display: inline-block;
96
96
  width: 5em;
97
97
  height: 5em;
98
- margin: 0 .5em;
98
+ margin: 0 0.5em;
99
99
  font-size: 12px;
100
100
  text-indent: 999em;
101
101
  overflow: hidden;
@@ -110,18 +110,15 @@
110
110
  .large.aight-progress {
111
111
  font-size: 24px; }
112
112
 
113
- .aight-progress:before,
114
- .aight-progress:after,
115
- .aight-progress > div:before,
116
- .aight-progress > div:after {
113
+ .aight-progress:before, .aight-progress:after, .aight-progress > div:before, .aight-progress > div:after {
117
114
  content: '';
118
115
  position: absolute;
119
116
  top: 0;
120
117
  left: 2.25em;
121
118
  /* (container width - part width)/2 */
122
- width: .5em;
119
+ width: 0.5em;
123
120
  height: 1.5em;
124
- border-radius: .2em;
121
+ border-radius: 0.2em;
125
122
  background: #eee;
126
123
  box-shadow: 0 3.5em #eee;
127
124
  /* container height - part height */
metadata CHANGED
@@ -1,83 +1,83 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aightbox-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Markus Waitl
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-19 00:00:00.000000000 Z
11
+ date: 2014-03-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.5'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.5'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rails
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: '4.0'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ~>
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '4.0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: jquery-rails
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - '>='
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - '>='
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: railties
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ~>
73
+ - - "~>"
74
74
  - !ruby/object:Gem::Version
75
75
  version: '4.0'
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ~>
80
+ - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: '4.0'
83
83
  description: Display single or group images in a lightbox.
@@ -105,12 +105,12 @@ require_paths:
105
105
  - lib
106
106
  required_ruby_version: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - '>='
108
+ - - ">="
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
111
  required_rubygems_version: !ruby/object:Gem::Requirement
112
112
  requirements:
113
- - - '>='
113
+ - - ">="
114
114
  - !ruby/object:Gem::Version
115
115
  version: '0'
116
116
  requirements: []