Responsive Lightbox - Version 1.3.2

Version Description

Download this release

Release Info

Developer subhansanjaya
Plugin Icon 128x128 Responsive Lightbox
Version 1.3.2
Comparing to
See all releases

Code changes from version 1.3.1 to 1.3.2

assets/nivo-lightbox/nivo-lightbox.css CHANGED
@@ -1,5 +1,5 @@
1
  /*
2
- * Nivo Lightbox v1.1
3
  * http://dev7studios.com/nivo-lightbox
4
  *
5
  * Copyright 2013, Dev7studios
@@ -202,4 +202,4 @@
202
  -moz-transform: translateZ(0);
203
  -ms-transform: translateZ(0);
204
  transform: translateZ(0);
205
- }
1
  /*
2
+ * Nivo Lightbox v1.2.0
3
  * http://dev7studios.com/nivo-lightbox
4
  *
5
  * Copyright 2013, Dev7studios
202
  -moz-transform: translateZ(0);
203
  -ms-transform: translateZ(0);
204
  transform: translateZ(0);
205
+ }
assets/nivo-lightbox/nivo-lightbox.js CHANGED
@@ -1,5 +1,5 @@
1
  /*
2
- * Nivo Lightbox v1.1
3
  * http://dev7studios.com/nivo-lightbox
4
  *
5
  * Copyright 2013, Dev7studios
@@ -11,18 +11,18 @@
11
 
12
  var pluginName = 'nivoLightbox',
13
  defaults = {
14
- effect: 'fade',
15
- theme: 'default',
16
- keyboardNav: true,
17
- clickOverlayToClose: true,
18
- onInit: function(){},
19
- beforeShowLightbox: function(){},
20
- afterShowLightbox: function(lightbox){},
21
- beforeHideLightbox: function(){},
22
- afterHideLightbox: function(){},
23
- onPrev: function(element){},
24
- onNext: function(element){},
25
- errorMessage: 'The requested content cannot be loaded. Please try again later.'
26
  };
27
 
28
  function NivoLightbox(element, options){
@@ -48,20 +48,19 @@
48
 
49
  // Setup the click
50
  this.$el.on('click', function(e){
51
- e.preventDefault();
52
- $this.showLightbox();
53
  });
54
 
55
  // keyboardNav
56
- if(this.options.keyboardNav){
57
- $('body').off('keyup').on('keyup', function(e){
58
- var code = (e.keyCode ? e.keyCode : e.which);
59
- // Escape
60
- if(code == 27) $this.destructLightbox();
61
- // Left
62
- if(code == 37) $('.nivo-lightbox-prev').trigger('click');
63
- // Right
64
- if(code == 39) $('.nivo-lightbox-next').trigger('click');
65
  });
66
  }
67
 
@@ -69,70 +68,104 @@
69
 
70
  },
71
 
72
- showLightbox: function(){
73
- var $this = this;
74
- this.options.beforeShowLightbox.call(this);
75
 
 
 
 
 
 
 
76
  var lightbox = this.constructLightbox();
77
  if(!lightbox) return;
78
  var content = lightbox.find('.nivo-lightbox-content');
79
  if(!content) return;
80
- var currentLink = this.$el;
81
  $('body').addClass('nivo-lightbox-body-effect-'+ this.options.effect);
82
 
83
- // Add content
84
- this.processContent(content, currentLink);
85
 
86
- // Nav
87
- if(this.$el.attr('data-lightbox-gallery')){
88
- var $this = this,
89
- galleryItems = $('[data-lightbox-gallery="'+ this.$el.attr('data-lightbox-gallery') +'"]');
90
 
91
- $('.nivo-lightbox-nav').show();
92
 
93
  // Prev
94
- $('.nivo-lightbox-prev').off('click').on('click', function(e){
95
- e.preventDefault();
96
- var index = galleryItems.index(currentLink);
97
- currentLink = galleryItems.eq(index - 1);
98
- if(!$(currentLink).length) currentLink = galleryItems.last();
99
- $this.processContent(content, currentLink);
100
- $this.options.onPrev.call(this, [ currentLink ]);
101
- });
102
-
103
- // Next
104
- $('.nivo-lightbox-next').off('click').on('click', function(e){
105
- e.preventDefault();
106
- var index = galleryItems.index(currentLink);
107
- currentLink = galleryItems.eq(index + 1);
108
- if(!$(currentLink).length) currentLink = galleryItems.first();
109
- $this.processContent(content, currentLink);
110
- $this.options.onNext.call(this, [ currentLink ]);
111
- });
112
- }
113
-
114
- setTimeout(function(){
115
- lightbox.addClass('nivo-lightbox-open');
116
- $this.options.afterShowLightbox.call(this, [ lightbox ]);
117
- }, 1); // For CSS transitions
118
  },
119
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
120
  processContent: function(content, link){
121
- var $this = this;
122
- var href = link.attr('href');
123
- content.html('').addClass('nivo-lightbox-loading');
124
-
125
- // Is HiDPI?
126
- if(this.isHidpi() && link.attr('data-lightbox-hidpi')){
127
- href = link.attr('data-lightbox-hidpi');
128
- }
129
-
130
- // Image
131
- if(href.match(/\.(jpeg|jpg|gif|png)$/i) != null){
132
- var img = $('<img>', { src: href });
133
- img.one('load', function() {
 
 
134
  var wrap = $('<div class="nivo-lightbox-image" />');
135
- wrap.append(img);
136
  content.html(wrap).removeClass('nivo-lightbox-loading');
137
 
138
  // Vertically center images
@@ -152,43 +185,42 @@
152
 
153
  img.error(function() {
154
  var wrap = $('<div class="nivo-lightbox-error"><p>'+ $this.options.errorMessage +'</p></div>');
155
- content.html(wrap).removeClass('nivo-lightbox-loading');
156
  });
157
- }
158
- // Video (Youtube/Vimeo)
159
- else if(video = href.match(/(youtube|youtu|vimeo)\.(com|be)\/(watch\?v=([\w-]+)|([\w-]+))/)){
160
- var src = '',
161
- classTerm = 'nivo-lightbox-video';
162
-
163
- if(video[1] == 'youtube'){
164
- src = 'http://www.youtube.com/v/'+ video[4];
165
- classTerm = 'nivo-lightbox-youtube';
166
- }
167
- if(video[1] == 'youtu'){
168
- src = 'http://www.youtube.com/v/'+ video[3];
169
- classTerm = 'nivo-lightbox-youtube';
170
- }
171
- if(video[1] == 'vimeo'){
172
- src = 'http://player.vimeo.com/video/'+ video[3];
173
- classTerm = 'nivo-lightbox-vimeo';
174
- }
175
-
176
- if(src){
177
- var iframe = $('<iframe>', {
178
- src: src,
179
- 'class': classTerm,
180
- frameborder: 0,
181
- vspace: 0,
182
- hspace: 0,
183
- scrolling: 'auto'
184
- });
185
- content.html(iframe);
186
- iframe.load(function(){ content.removeClass('nivo-lightbox-loading'); });
187
- }
188
- }
189
- // AJAX
190
- else if(link.attr('data-lightbox-type') == 'ajax'){
191
- var $this = this;
192
  $.ajax({
193
  url: href,
194
  cache: false,
@@ -217,18 +249,18 @@
217
  },
218
  error: function(){
219
  var wrap = $('<div class="nivo-lightbox-error"><p>'+ $this.options.errorMessage +'</p></div>');
220
- content.html(wrap).removeClass('nivo-lightbox-loading');
221
  }
222
  });
223
- }
224
- // Inline HTML
225
- else if(href.substring(0, 1) == '#'){
226
- if($(href).length){
227
- var wrap = $('<div class="nivo-lightbox-inline" />');
228
  wrap.append($(href).clone().show());
229
- content.html(wrap).removeClass('nivo-lightbox-loading');
230
 
231
- // Vertically center html
232
  if(wrap.outerHeight() < content.height()){
233
  wrap.css({
234
  'position': 'relative',
@@ -246,101 +278,103 @@
246
  }
247
  });
248
  } else {
249
- var wrap = $('<div class="nivo-lightbox-error"><p>'+ $this.options.errorMessage +'</p></div>');
250
- content.html(wrap).removeClass('nivo-lightbox-loading');
251
  }
252
- }
253
- // iFrame (default)
254
- else {
255
- var iframe = $('<iframe>', {
256
- src: href,
257
- 'class': 'nivo-lightbox-item',
258
- frameborder: 0,
259
- vspace: 0,
260
- hspace: 0,
261
- scrolling: 'auto'
262
- });
263
- content.html(iframe);
264
- iframe.load(function(){ content.removeClass('nivo-lightbox-loading'); });
265
- }
266
-
267
- // Set the title
268
- if(link.attr('title')){
269
- var titleWrap = $('<span>', { 'class': 'nivo-lightbox-title' });
270
- titleWrap.text(link.attr('title'));
271
- $('.nivo-lightbox-title-wrap').html(titleWrap);
272
- } else {
273
- $('.nivo-lightbox-title-wrap').html('');
274
- }
 
 
275
  },
276
 
277
  constructLightbox: function(){
278
- if($('.nivo-lightbox-overlay').length) return $('.nivo-lightbox-overlay');
279
-
280
- var overlay = $('<div>', { 'class': 'nivo-lightbox-overlay nivo-lightbox-theme-'+ this.options.theme +' nivo-lightbox-effect-'+ this.options.effect });
281
- var wrap = $('<div>', { 'class': 'nivo-lightbox-wrap' });
282
- var content = $('<div>', { 'class': 'nivo-lightbox-content' });
283
- var nav = $('<a href="#" class="nivo-lightbox-nav nivo-lightbox-prev">Previous</a><a href="#" class="nivo-lightbox-nav nivo-lightbox-next">Next</a>');
284
- var close = $('<a href="#" class="nivo-lightbox-close" title="Close">Close</a>');
285
- var title = $('<div>', { 'class': 'nivo-lightbox-title-wrap' });
286
-
287
- var isMSIE = /*@cc_on!@*/0;
288
- if(isMSIE) overlay.addClass('nivo-lightbox-ie');
289
-
290
- wrap.append(content);
291
- wrap.append(title);
292
- overlay.append(wrap);
293
- overlay.append(nav);
294
- overlay.append(close);
295
- $('body').append(overlay);
296
-
297
- var $this = this;
298
- if($this.options.clickOverlayToClose){
299
- overlay.on('click', function(e){
300
- if(e.target === this ||
301
- $(e.target).hasClass('nivo-lightbox-content') ||
302
- $(e.target).hasClass('nivo-lightbox-image')) $this.destructLightbox();
303
- });
304
- }
305
-
306
- close.on('click', function(e){
307
- e.preventDefault();
308
- $this.destructLightbox();
309
- });
310
-
311
- return overlay;
312
  },
313
 
314
  destructLightbox: function(){
315
- var $this = this;
316
- this.options.beforeHideLightbox.call(this);
317
-
318
- $('.nivo-lightbox-overlay').removeClass('nivo-lightbox-open');
319
- $('.nivo-lightbox-nav').hide();
320
- $('body').removeClass('nivo-lightbox-body-effect-'+ $this.options.effect);
321
-
322
- // For IE
323
- var isMSIE = /*@cc_on!@*/0;
324
- if(isMSIE){
325
- $('.nivo-lightbox-overlay iframe').attr("src", " ");
326
- $('.nivo-lightbox-overlay iframe').remove();
327
- }
328
 
329
- // Remove click handlers
330
- $('.nivo-lightbox-prev').off('click');
331
- $('.nivo-lightbox-next').off('click');
332
 
333
- // Empty content (for videos)
334
- $('.nivo-lightbox-content').empty();
335
 
336
- this.options.afterHideLightbox.call(this);
337
  },
338
 
339
  isHidpi: function(){
340
  var mediaQuery = "(-webkit-min-device-pixel-ratio: 1.5),\
341
- (min--moz-device-pixel-ratio: 1.5),\
342
- (-o-min-device-pixel-ratio: 3/2),\
343
- (min-resolution: 1.5dppx)";
344
  if(window.devicePixelRatio > 1) return true;
345
  if(window.matchMedia && window.matchMedia(mediaQuery).matches) return true;
346
  return false;
@@ -356,4 +390,4 @@
356
  });
357
  };
358
 
359
- })(jQuery, window, document);
1
  /*
2
+ * Nivo Lightbox v1.2.0
3
  * http://dev7studios.com/nivo-lightbox
4
  *
5
  * Copyright 2013, Dev7studios
11
 
12
  var pluginName = 'nivoLightbox',
13
  defaults = {
14
+ effect: 'fade',
15
+ theme: 'default',
16
+ keyboardNav: true,
17
+ clickOverlayToClose: true,
18
+ onInit: function(){},
19
+ beforeShowLightbox: function(){},
20
+ afterShowLightbox: function(lightbox){},
21
+ beforeHideLightbox: function(){},
22
+ afterHideLightbox: function(){},
23
+ onPrev: function(element){},
24
+ onNext: function(element){},
25
+ errorMessage: 'The requested content cannot be loaded. Please try again later.'
26
  };
27
 
28
  function NivoLightbox(element, options){
48
 
49
  // Setup the click
50
  this.$el.on('click', function(e){
51
+ $this.showLightbox(e);
 
52
  });
53
 
54
  // keyboardNav
55
+ if(this.options.keyboardNav){
56
+ $('body').off('keyup').on('keyup', function(e){
57
+ var code = (e.keyCode ? e.keyCode : e.which);
58
+ // Escape
59
+ if(code == 27) $this.destructLightbox();
60
+ // Left
61
+ if(code == 37) $('.nivo-lightbox-prev').trigger('click');
62
+ // Right
63
+ if(code == 39) $('.nivo-lightbox-next').trigger('click');
64
  });
65
  }
66
 
68
 
69
  },
70
 
71
+ showLightbox: function(e){
72
+ var $this = this,
73
+ currentLink = this.$el;
74
 
75
+ // Check content
76
+ var check = this.checkContent(currentLink);
77
+ if(!check) return;
78
+
79
+ e.preventDefault();
80
+ this.options.beforeShowLightbox.call(this);
81
  var lightbox = this.constructLightbox();
82
  if(!lightbox) return;
83
  var content = lightbox.find('.nivo-lightbox-content');
84
  if(!content) return;
85
+
86
  $('body').addClass('nivo-lightbox-body-effect-'+ this.options.effect);
87
 
88
+ this.processContent( content, currentLink );
 
89
 
90
+ // Nav
91
+ if(this.$el.attr('data-lightbox-gallery')){
92
+ var galleryItems = $('[data-lightbox-gallery="'+ this.$el.attr('data-lightbox-gallery') +'"]');
 
93
 
94
+ $('.nivo-lightbox-nav').show();
95
 
96
  // Prev
97
+ $('.nivo-lightbox-prev').off('click').on('click', function(e){
98
+ e.preventDefault();
99
+ var index = galleryItems.index(currentLink);
100
+ currentLink = galleryItems.eq(index - 1);
101
+ if(!$(currentLink).length) currentLink = galleryItems.last();
102
+ $this.processContent(content, currentLink);
103
+ $this.options.onPrev.call(this, [ currentLink ]);
104
+ });
105
+
106
+ // Next
107
+ $('.nivo-lightbox-next').off('click').on('click', function(e){
108
+ e.preventDefault();
109
+ var index = galleryItems.index(currentLink);
110
+ currentLink = galleryItems.eq(index + 1);
111
+ if(!$(currentLink).length) currentLink = galleryItems.first();
112
+ $this.processContent(content, currentLink);
113
+ $this.options.onNext.call(this, [ currentLink ]);
114
+ });
115
+ }
116
+
117
+ setTimeout(function(){
118
+ lightbox.addClass('nivo-lightbox-open');
119
+ $this.options.afterShowLightbox.call(this, [ lightbox ]);
120
+ }, 1); // For CSS transitions
121
  },
122
 
123
+ checkContent: function( link ) {
124
+ var $this = this,
125
+ href = link.attr('href'),
126
+ video = href.match(/(youtube|youtu|vimeo)\.(com|be)\/(watch\?v=([\w-]+)|([\w-]+))/);
127
+
128
+ if(href.match(/\.(jpeg|jpg|gif|png)$/i) !== null){
129
+ return true;
130
+ }
131
+ // Video (Youtube/Vimeo)
132
+ else if(video){
133
+ return true;
134
+ }
135
+ // AJAX
136
+ else if(link.attr('data-lightbox-type') == 'ajax'){
137
+ return true;
138
+ }
139
+ // Inline HTML
140
+ else if(href.substring(0, 1) == '#' && link.attr('data-lightbox-type') == 'inline'){
141
+ return true;
142
+ }
143
+ // iFrame (default)
144
+ else if(link.attr('data-lightbox-type') == 'iframe'){
145
+ return true;
146
+ }
147
+
148
+ return false;
149
+ },
150
+
151
  processContent: function(content, link){
152
+ var $this = this,
153
+ href = link.attr('href'),
154
+ video = href.match(/(youtube|youtu|vimeo)\.(com|be)\/(watch\?v=([\w-]+)|([\w-]+))/);
155
+
156
+ content.html('').addClass('nivo-lightbox-loading');
157
+
158
+ // Is HiDPI?
159
+ if(this.isHidpi() && link.attr('data-lightbox-hidpi')){
160
+ href = link.attr('data-lightbox-hidpi');
161
+ }
162
+
163
+ // Image
164
+ if(href.match(/\.(jpeg|jpg|gif|png)$/i) !== null){
165
+ var img = $('<img>', { src: href });
166
+ img.one('load', function() {
167
  var wrap = $('<div class="nivo-lightbox-image" />');
168
+ wrap.append(img);
169
  content.html(wrap).removeClass('nivo-lightbox-loading');
170
 
171
  // Vertically center images
185
 
186
  img.error(function() {
187
  var wrap = $('<div class="nivo-lightbox-error"><p>'+ $this.options.errorMessage +'</p></div>');
188
+ content.html(wrap).removeClass('nivo-lightbox-loading');
189
  });
190
+ }
191
+ // Video (Youtube/Vimeo)
192
+ else if(video){
193
+ var src = '',
194
+ classTerm = 'nivo-lightbox-video';
195
+
196
+ if(video[1] == 'youtube'){
197
+ src = 'http://www.youtube.com/embed/'+ video[4];
198
+ classTerm = 'nivo-lightbox-youtube';
199
+ }
200
+ if(video[1] == 'youtu'){
201
+ src = 'http://www.youtube.com/embed/'+ video[3];
202
+ classTerm = 'nivo-lightbox-youtube';
203
+ }
204
+ if(video[1] == 'vimeo'){
205
+ src = 'http://player.vimeo.com/video/'+ video[3];
206
+ classTerm = 'nivo-lightbox-vimeo';
207
+ }
208
+
209
+ if(src){
210
+ var iframeVideo = $('<iframe>', {
211
+ src: src,
212
+ 'class': classTerm,
213
+ frameborder: 0,
214
+ vspace: 0,
215
+ hspace: 0,
216
+ scrolling: 'auto'
217
+ });
218
+ content.html(iframeVideo);
219
+ iframeVideo.load(function(){ content.removeClass('nivo-lightbox-loading'); });
220
+ }
221
+ }
222
+ // AJAX
223
+ else if(link.attr('data-lightbox-type') == 'ajax'){
 
224
  $.ajax({
225
  url: href,
226
  cache: false,
249
  },
250
  error: function(){
251
  var wrap = $('<div class="nivo-lightbox-error"><p>'+ $this.options.errorMessage +'</p></div>');
252
+ content.html(wrap).removeClass('nivo-lightbox-loading');
253
  }
254
  });
255
+ }
256
+ // Inline HTML
257
+ else if(href.substring(0, 1) == '#' && link.attr('data-lightbox-type') == 'inline'){
258
+ if($(href).length){
259
+ var wrap = $('<div class="nivo-lightbox-inline" />');
260
  wrap.append($(href).clone().show());
261
+ content.html(wrap).removeClass('nivo-lightbox-loading');
262
 
263
+ // Vertically center html
264
  if(wrap.outerHeight() < content.height()){
265
  wrap.css({
266
  'position': 'relative',
278
  }
279
  });
280
  } else {
281
+ var wrapError = $('<div class="nivo-lightbox-error"><p>'+ $this.options.errorMessage +'</p></div>');
282
+ content.html(wrapError).removeClass('nivo-lightbox-loading');
283
  }
284
+ }
285
+ // iFrame (default)
286
+ else if(link.attr('data-lightbox-type') == 'iframe'){
287
+ var iframe = $('<iframe>', {
288
+ src: href,
289
+ 'class': 'nivo-lightbox-item',
290
+ frameborder: 0,
291
+ vspace: 0,
292
+ hspace: 0,
293
+ scrolling: 'auto'
294
+ });
295
+ content.html(iframe);
296
+ iframe.load(function(){ content.removeClass('nivo-lightbox-loading'); });
297
+ } else {
298
+ return false;
299
+ }
300
+
301
+ // Set the title
302
+ if(link.attr('title')){
303
+ var titleWrap = $('<span>', { 'class': 'nivo-lightbox-title' });
304
+ titleWrap.text(link.attr('title'));
305
+ $('.nivo-lightbox-title-wrap').html(titleWrap);
306
+ } else {
307
+ $('.nivo-lightbox-title-wrap').html('');
308
+ }
309
  },
310
 
311
  constructLightbox: function(){
312
+ if($('.nivo-lightbox-overlay').length) return $('.nivo-lightbox-overlay');
313
+
314
+ var overlay = $('<div>', { 'class': 'nivo-lightbox-overlay nivo-lightbox-theme-'+ this.options.theme +' nivo-lightbox-effect-'+ this.options.effect });
315
+ var wrap = $('<div>', { 'class': 'nivo-lightbox-wrap' });
316
+ var content = $('<div>', { 'class': 'nivo-lightbox-content' });
317
+ var nav = $('<a href="#" class="nivo-lightbox-nav nivo-lightbox-prev">Previous</a><a href="#" class="nivo-lightbox-nav nivo-lightbox-next">Next</a>');
318
+ var close = $('<a href="#" class="nivo-lightbox-close" title="Close">Close</a>');
319
+ var title = $('<div>', { 'class': 'nivo-lightbox-title-wrap' });
320
+
321
+ var isMSIE = /*@cc_on!@*/0;
322
+ if(isMSIE) overlay.addClass('nivo-lightbox-ie');
323
+
324
+ wrap.append(content);
325
+ wrap.append(title);
326
+ overlay.append(wrap);
327
+ overlay.append(nav);
328
+ overlay.append(close);
329
+ $('body').append(overlay);
330
+
331
+ var $this = this;
332
+ if($this.options.clickOverlayToClose){
333
+ overlay.on('click', function(e){
334
+ if(e.target === this || $(e.target).hasClass('nivo-lightbox-content') || $(e.target).hasClass('nivo-lightbox-image')){
335
+ $this.destructLightbox();
336
+ }
337
+ });
338
+ }
339
+
340
+ close.on('click', function(e){
341
+ e.preventDefault();
342
+ $this.destructLightbox();
343
+ });
344
+
345
+ return overlay;
346
  },
347
 
348
  destructLightbox: function(){
349
+ var $this = this;
350
+ this.options.beforeHideLightbox.call(this);
351
+
352
+ $('.nivo-lightbox-overlay').removeClass('nivo-lightbox-open');
353
+ $('.nivo-lightbox-nav').hide();
354
+ $('body').removeClass('nivo-lightbox-body-effect-'+ $this.options.effect);
355
+
356
+ // For IE
357
+ var isMSIE = /*@cc_on!@*/0;
358
+ if(isMSIE){
359
+ $('.nivo-lightbox-overlay iframe').attr("src", " ");
360
+ $('.nivo-lightbox-overlay iframe').remove();
361
+ }
362
 
363
+ // Remove click handlers
364
+ $('.nivo-lightbox-prev').off('click');
365
+ $('.nivo-lightbox-next').off('click');
366
 
367
+ // Empty content (for videos)
368
+ $('.nivo-lightbox-content').empty();
369
 
370
+ this.options.afterHideLightbox.call(this);
371
  },
372
 
373
  isHidpi: function(){
374
  var mediaQuery = "(-webkit-min-device-pixel-ratio: 1.5),\
375
+ (min--moz-device-pixel-ratio: 1.5),\
376
+ (-o-min-device-pixel-ratio: 3/2),\
377
+ (min-resolution: 1.5dppx)";
378
  if(window.devicePixelRatio > 1) return true;
379
  if(window.matchMedia && window.matchMedia(mediaQuery).matches) return true;
380
  return false;
390
  });
391
  };
392
 
393
+ })(jQuery, window, document);
assets/nivo-lightbox/nivo-lightbox.min.js ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Nivo Lightbox v1.2.0
3
+ * http://dev7studios.com/nivo-lightbox
4
+ *
5
+ * Copyright 2013, Dev7studios
6
+ * Free to use and abuse under the MIT license.
7
+ * http://www.opensource.org/licenses/mit-license.php
8
+ */
9
+ (function(e,t,n,r){function o(t,n){this.el=t;this.$el=e(this.el);this.options=e.extend({},s,n);this._defaults=s;this._name=i;this.init()}var i="nivoLightbox",s={effect:"fade",theme:"default",keyboardNav:true,clickOverlayToClose:true,onInit:function(){},beforeShowLightbox:function(){},afterShowLightbox:function(e){},beforeHideLightbox:function(){},afterHideLightbox:function(){},onPrev:function(e){},onNext:function(e){},errorMessage:"The requested content cannot be loaded. Please try again later."};o.prototype={init:function(){var t=this;if(!e("html").hasClass("nivo-lightbox-notouch"))e("html").addClass("nivo-lightbox-notouch");if("ontouchstart"in n)e("html").removeClass("nivo-lightbox-notouch");this.$el.on("click",function(e){t.showLightbox(e)});if(this.options.keyboardNav){e("body").off("keyup").on("keyup",function(n){var r=n.keyCode?n.keyCode:n.which;if(r==27)t.destructLightbox();if(r==37)e(".nivo-lightbox-prev").trigger("click");if(r==39)e(".nivo-lightbox-next").trigger("click")})}this.options.onInit.call(this)},showLightbox:function(t){var n=this,r=this.$el;var i=this.checkContent(r);if(!i)return;t.preventDefault();this.options.beforeShowLightbox.call(this);var s=this.constructLightbox();if(!s)return;var o=s.find(".nivo-lightbox-content");if(!o)return;e("body").addClass("nivo-lightbox-body-effect-"+this.options.effect);this.processContent(o,r);if(this.$el.attr("data-lightbox-gallery")){var u=e('[data-lightbox-gallery="'+this.$el.attr("data-lightbox-gallery")+'"]');e(".nivo-lightbox-nav").show();e(".nivo-lightbox-prev").off("click").on("click",function(t){t.preventDefault();var i=u.index(r);r=u.eq(i-1);if(!e(r).length)r=u.last();n.processContent(o,r);n.options.onPrev.call(this,[r])});e(".nivo-lightbox-next").off("click").on("click",function(t){t.preventDefault();var i=u.index(r);r=u.eq(i+1);if(!e(r).length)r=u.first();n.processContent(o,r);n.options.onNext.call(this,[r])})}setTimeout(function(){s.addClass("nivo-lightbox-open");n.options.afterShowLightbox.call(this,[s])},1)},checkContent:function(e){var t=this,n=e.attr("href"),r=n.match(/(youtube|youtu|vimeo)\.(com|be)\/(watch\?v=([\w-]+)|([\w-]+))/);if(n.match(/\.(jpeg|jpg|gif|png)$/i)!==null){return true}else if(r){return true}else if(e.attr("data-lightbox-type")=="ajax"){return true}else if(n.substring(0,1)=="#"&&e.attr("data-lightbox-type")=="inline"){return true}else if(e.attr("data-lightbox-type")=="iframe"){return true}return false},processContent:function(n,r){var i=this,s=r.attr("href"),o=s.match(/(youtube|youtu|vimeo)\.(com|be)\/(watch\?v=([\w-]+)|([\w-]+))/);n.html("").addClass("nivo-lightbox-loading");if(this.isHidpi()&&r.attr("data-lightbox-hidpi")){s=r.attr("data-lightbox-hidpi")}if(s.match(/\.(jpeg|jpg|gif|png)$/i)!==null){var u=e("<img>",{src:s});u.one("load",function(){var r=e('<div class="nivo-lightbox-image" />');r.append(u);n.html(r).removeClass("nivo-lightbox-loading");r.css({"line-height":e(".nivo-lightbox-content").height()+"px",height:e(".nivo-lightbox-content").height()+"px"});e(t).resize(function(){r.css({"line-height":e(".nivo-lightbox-content").height()+"px",height:e(".nivo-lightbox-content").height()+"px"})})}).each(function(){if(this.complete)e(this).load()});u.error(function(){var t=e('<div class="nivo-lightbox-error"><p>'+i.options.errorMessage+"</p></div>");n.html(t).removeClass("nivo-lightbox-loading")})}else if(o){var a="",f="nivo-lightbox-video";if(o[1]=="youtube"){a="//www.youtube.com/embed/"+o[4];f="nivo-lightbox-youtube"}if(o[1]=="youtu"){a="//www.youtube.com/embed/"+o[3];f="nivo-lightbox-youtube"}if(o[1]=="vimeo"){a="//player.vimeo.com/video/"+o[3];f="nivo-lightbox-vimeo"}if(a){var l=e("<iframe>",{src:a,"class":f,frameborder:0,vspace:0,hspace:0,scrolling:"auto"});n.html(l);l.load(function(){n.removeClass("nivo-lightbox-loading")})}}else if(r.attr("data-lightbox-type")=="ajax"){e.ajax({url:s,cache:false,success:function(r){var i=e('<div class="nivo-lightbox-ajax" />');i.append(r);n.html(i).removeClass("nivo-lightbox-loading");if(i.outerHeight()<n.height()){i.css({position:"relative",top:"50%","margin-top":-(i.outerHeight()/2)+"px"})}e(t).resize(function(){if(i.outerHeight()<n.height()){i.css({position:"relative",top:"50%","margin-top":-(i.outerHeight()/2)+"px"})}})},error:function(){var t=e('<div class="nivo-lightbox-error"><p>'+i.options.errorMessage+"</p></div>");n.html(t).removeClass("nivo-lightbox-loading")}})}else if(s.substring(0,1)=="#"&&r.attr("data-lightbox-type")=="inline"){if(e(s).length){var c=e('<div class="nivo-lightbox-inline" />');c.append(e(s).clone().show());n.html(c).removeClass("nivo-lightbox-loading");if(c.outerHeight()<n.height()){c.css({position:"relative",top:"50%","margin-top":-(c.outerHeight()/2)+"px"})}e(t).resize(function(){if(c.outerHeight()<n.height()){c.css({position:"relative",top:"50%","margin-top":-(c.outerHeight()/2)+"px"})}})}else{var h=e('<div class="nivo-lightbox-error"><p>'+i.options.errorMessage+"</p></div>");n.html(h).removeClass("nivo-lightbox-loading")}}else if(r.attr("data-lightbox-type")=="iframe"){var p=e("<iframe>",{src:s,"class":"nivo-lightbox-item",frameborder:0,vspace:0,hspace:0,scrolling:"auto"});n.html(p);p.load(function(){n.removeClass("nivo-lightbox-loading")})}else{return false}if(r.attr("title")){var d=e("<span>",{"class":"nivo-lightbox-title"});d.text(r.attr("title"));e(".nivo-lightbox-title-wrap").html(d)}else{e(".nivo-lightbox-title-wrap").html("")}},constructLightbox:function(){if(e(".nivo-lightbox-overlay").length)return e(".nivo-lightbox-overlay");var t=e("<div>",{"class":"nivo-lightbox-overlay nivo-lightbox-theme-"+this.options.theme+" nivo-lightbox-effect-"+this.options.effect});var n=e("<div>",{"class":"nivo-lightbox-wrap"});var r=e("<div>",{"class":"nivo-lightbox-content"});var i=e('<a href="#" class="nivo-lightbox-nav nivo-lightbox-prev">Previous</a><a href="#" class="nivo-lightbox-nav nivo-lightbox-next">Next</a>');var s=e('<a href="#" class="nivo-lightbox-close" title="Close">Close</a>');var o=e("<div>",{"class":"nivo-lightbox-title-wrap"});var u=0;if(u)t.addClass("nivo-lightbox-ie");n.append(r);n.append(o);t.append(n);t.append(i);t.append(s);e("body").append(t);var a=this;if(a.options.clickOverlayToClose){t.on("click",function(t){if(t.target===this||e(t.target).hasClass("nivo-lightbox-content")||e(t.target).hasClass("nivo-lightbox-image")){a.destructLightbox()}})}s.on("click",function(e){e.preventDefault();a.destructLightbox()});return t},destructLightbox:function(){var t=this;this.options.beforeHideLightbox.call(this);e(".nivo-lightbox-overlay").removeClass("nivo-lightbox-open");e(".nivo-lightbox-nav").hide();e("body").removeClass("nivo-lightbox-body-effect-"+t.options.effect);var n=0;if(n){e(".nivo-lightbox-overlay iframe").attr("src"," ");e(".nivo-lightbox-overlay iframe").remove()}e(".nivo-lightbox-prev").off("click");e(".nivo-lightbox-next").off("click");e(".nivo-lightbox-content").empty();this.options.afterHideLightbox.call(this)},isHidpi:function(){var e="(-webkit-min-device-pixel-ratio: 1.5), (min--moz-device-pixel-ratio: 1.5), (-o-min-device-pixel-ratio: 3/2), (min-resolution: 1.5dppx)";if(t.devicePixelRatio>1)return true;if(t.matchMedia&&t.matchMedia(e).matches)return true;return false}};e.fn[i]=function(t){return this.each(function(){if(!e.data(this,i)){e.data(this,i,new o(this,t))}})}})(jQuery,window,document)
readme.txt CHANGED
@@ -1,69 +1,44 @@
1
- ===Responsive Lightbox===
2
- Contributors: subhansanjaya
3
- Author: subhansanjaya
4
- Author URI: http://weaveapps.com
5
- Plugin URI: http://wordpress.org/plugins/responsive-lightbox-lite/
6
- Donate link:https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=BXBCGCKDD74UE
7
- Tags: responsive Lightbox, Lightbox, Nivo Lightbox, pop up, modal window, modal dialog, pop-up, light box, lightbox for youtube, nivo, wp lightbox,iframe pop up,pop up, wordpress lightbox
8
- Requires at least: 3.0
9
- Tested up to: 4.0.1
10
- Stable tag: 1.3.1
11
- License: GPLv2 or later
12
- License URI: http://www.gnu.org/licenses/gpl-2.0.html
13
-
14
- This plugin offers a nice and elegant way to add Lightbox functionality for images, html content and media on your webpages.
15
-
16
- == Description ==
17
  Responsive Lightbox Wordpress plugin adds Lightbox functionality for images, html content and media on your webpages.
18
 
19
- [Live demo](http://weaveapps.com/shop/wordpress-plugins/responsive-lightbox-lite/).
20
-
21
- = Features of this plugin =
22
- * Responsive.
23
- * Light weight.
24
- * Option to set automatically add Lightbox to your images, gallery, videos etc.
25
  * Customisable through settings and CSS.
26
 
27
- = Responsive LightBox - Pro =
28
- Please, click [here](http://weaveapps.com/shop/wordpress-plugins/responsive-lightbox-wordpress-plugin/). to check the pro version.
29
-
30
- = Features of the pro version of the plugin =
31
- * Fully responsive and HiDPI compatible.
32
- * Touch enabled and mobile friendly.
33
- * Option to add LightBox functionality automatically to your images, gallery, videos etc.
34
- * 7 built in CSS powered effects (Fade, Slide, Fall etc.).
35
- * Show image captions automatically.
36
- * Add LightBox functionality for any type of content such as images, image galleries, AJAX, iFrame, Flash, Youtube or Vimeo videos, another website, inline content, HTML etc.
37
- * Easy to use standard admin interface with more than 15 options.
38
- * 2 built in themes and simple templating system add your own theme easily.
39
- * Translation ready.
40
- * Multisite support.
41
- * Search engine optimised.
42
- * Light weight. (Smaller file size which load faster.).
43
- * Support all browsers: Firefox, Chrome, IE, Safari etc.
44
- * Compatible with any theme.
45
- * Developed in best practices of CSS3 and HTML5.
46
- * Easy to customise through settings and custom option to override styles, if necessary without editing the css files.
47
- * Change default colors with color pickers.
48
- * Integrated with automatic updates.
49
-
50
-
51
-
52
- == Installation ==
53
-
54
- **Installation Instruction & Configuration**
55
-
56
- 1.You can use the built-in installer. OR
57
- Download the zip file and extract the contents. Upload the ‘responsive-lightbox-lite’ folder to your plugins directory (wp-content/plugins/).
58
-
59
- 2.Activate the plugin through the 'Plugins' menu in WordPress.
60
-
61
  3.Log into Admin panel and go to Settings > responsive lightbox lite to change values.
62
 
63
- == Frequently Asked Questions ==
64
-
65
- = How to add Lightbox functionality manually? =
66
-
67
  If you would prefer to add Lightbox manually, first you need to disable automatically add option from the backend (Settings > Responsive Lightbox) and add rel and data-type attributes to your links accordingly.
68
 
69
  1. **Single Images**
@@ -88,12 +63,16 @@ rel="lightbox" data-lightbox-type="iframe"
88
  rel="lightbox" data-lightbox-type="ajax"
89
 
90
  8. **Inline**
91
- rel="lightbox" data-lightbox-type="inline"
92
-
93
  ==changelog==
 
 
 
 
94
  **Version 1.2**
95
 
96
- Bug fixes for improved quality and performance.
97
-
98
- == Screenshots ==
99
- 1. http://www.backraw.com/plugins/rll/images/screenshot-1.jpg
1
+ ===Responsive Lightbox===
2
+ Contributors: subhansanjaya
3
+ Author: subhansanjaya
4
+ Author URI: http://weaveapps.com
5
+ Plugin URI: http://wordpress.org/plugins/responsive-lightbox-lite/
6
+ Donate link:https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=BXBCGCKDD74UE
7
+ Tags: responsive Lightbox, Lightbox, Nivo Lightbox, pop up, modal window, modal dialog, pop-up, light box, lightbox for youtube, nivo, wp lightbox,iframe pop up,pop up, wordpress lightbox
8
+ Requires at least: 3.5
9
+ Tested up to: 4.9
10
+ Stable tag: 1.3.2
11
+ License: GPLv2 or later
12
+ License URI: http://www.gnu.org/licenses/gpl-2.0.html
13
+
14
+ This plugin offers a nice and elegant way to add Lightbox functionality for images, html content and media on your webpages.
15
+
16
+ == Description ==
17
  Responsive Lightbox Wordpress plugin adds Lightbox functionality for images, html content and media on your webpages.
18
 
19
+ [Live demo](http://weaveapps.com/shop/wordpress-plugins/responsive-lightbox-lite/).
20
+
21
+ = Features of this plugin =
22
+ * Responsive.
23
+ * Light weight.
24
+ * Option to set automatically add Lightbox to your images, gallery, videos etc.
25
  * Customisable through settings and CSS.
26
 
27
+ == Installation ==
28
+
29
+ **Installation Instruction & Configuration**
30
+
31
+ 1.You can use the built-in installer. OR
32
+ Download the zip file and extract the contents. Upload the ‘responsive-lightbox-lite’ folder to your plugins directory (wp-content/plugins/).
33
+
34
+ 2.Activate the plugin through the 'Plugins' menu in WordPress.
35
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
  3.Log into Admin panel and go to Settings > responsive lightbox lite to change values.
37
 
38
+ == Frequently Asked Questions ==
39
+
40
+ = How to add Lightbox functionality manually? =
41
+
42
  If you would prefer to add Lightbox manually, first you need to disable automatically add option from the backend (Settings > Responsive Lightbox) and add rel and data-type attributes to your links accordingly.
43
 
44
  1. **Single Images**
63
  rel="lightbox" data-lightbox-type="ajax"
64
 
65
  8. **Inline**
66
+ rel="lightbox" data-lightbox-type="inline"
67
+
68
  ==changelog==
69
+ **Version 1.3.2**
70
+
71
+ Added missing script file.
72
+
73
  **Version 1.2**
74
 
75
+ Bug fixes for improved quality and performance.
76
+
77
+ == Screenshots ==
78
+ 1. http://www.backraw.com/plugins/rll/images/screenshot-1.jpg
responsive-lightbox-lite.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Responsive Lightbox
4
  * Description: This plugin offers a nice and elegant way to add Lightbox functionality for images, html content and media on your webpages.
5
  * Author: subhansanjaya
6
- * Version: 1.3.1
7
  * Plugin URI: http://wordpress.org/plugins/responsive-lightbox-lite/
8
  * Author URI: http://weaveapps.com
9
  * Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=BXBCGCKDD74UE
3
  * Plugin Name: Responsive Lightbox
4
  * Description: This plugin offers a nice and elegant way to add Lightbox functionality for images, html content and media on your webpages.
5
  * Author: subhansanjaya
6
+ * Version: 1.3.2
7
  * Plugin URI: http://wordpress.org/plugins/responsive-lightbox-lite/
8
  * Author URI: http://weaveapps.com
9
  * Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=BXBCGCKDD74UE