Version Description
Enables larger viewing area, improved mobile experience and translations.
Download this release
Release Info
Developer | ulfben |
Plugin | WP jQuery Lightbox |
Version | 1.3 |
Comparing to | |
See all releases |
Code changes from version 1.2.2 to 1.3
- jquery.lightbox.js +188 -190
- jquery.lightbox.min.js +1 -1
- languages/howtouse-en_US.html +40 -0
- languages/howtouse.html +40 -0
- languages/jqlb-cs_CZ.mo +0 -0
- languages/jqlb-cs_CZ.po +102 -0
- languages/jqlb-de_DE.mo +0 -0
- languages/jqlb-ru_RU.mo +0 -0
- languages/jqlb-ru_RU.po +102 -0
- lightbox.css +4 -1
- lightbox.min.css +1 -1
- readme.txt +64 -28
- wp-jquery-lightbox.php +115 -74
jquery.lightbox.js
CHANGED
@@ -1,3 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
/**
|
2 |
* jQuery Lightbox
|
3 |
* Version 0.5 - 11/29/2007
|
@@ -8,34 +30,15 @@
|
|
8 |
*
|
9 |
* Based on Lightbox 2 by Lokesh Dhakar (http://www.huddletogether.com/projects/lightbox2/)
|
10 |
* Originally written to make use of the Prototype framework, and Script.acalo.us, now altered to use jQuery.
|
11 |
-
*
|
12 |
-
* This file was lightly modified by Ulf Benjaminsson (http://www.ulfben.com) for use in the WP jQuery Lightbox-
|
13 |
-
* plugin. (http://wordpress.org/extend/plugins/wp-jquery-lightbox/)
|
14 |
-
* Modifications include:
|
15 |
-
* 0. using no-conflict mode (for good measure)
|
16 |
-
* 1. improved the resizing code
|
17 |
-
* 2. using rel attribute instead of class
|
18 |
-
* 3. auto-lightboxing all links after page load
|
19 |
-
* 4. using WordPress API to localize script (with safe fallbacks)
|
20 |
-
* 5. replaced explicit IMG-urls with divs, styled through the CSS.
|
21 |
-
* 6. honors empty captions / titles
|
22 |
-
* 7. grabs image caption from WordPress [gallery] or media library output
|
23 |
-
* 8. grabs image title if the link lacks one
|
24 |
-
* 9. use only title if captions is identical
|
25 |
-
*
|
26 |
**/
|
27 |
(function(jQuery){
|
28 |
jQuery.fn.lightbox = function(options){
|
29 |
// build main options
|
30 |
-
var opts = jQuery.extend({}, jQuery.fn.lightbox.defaults, options);
|
31 |
-
|
32 |
-
return this.each(function(){
|
33 |
-
jQuery(this).click(function(){
|
34 |
-
// initalize the lightbox
|
35 |
initialize();
|
36 |
start(this);
|
37 |
return false;
|
38 |
-
});
|
39 |
});
|
40 |
|
41 |
/**
|
@@ -46,6 +49,11 @@
|
|
46 |
*/
|
47 |
|
48 |
function initialize() {
|
|
|
|
|
|
|
|
|
|
|
49 |
jQuery('#overlay').remove();
|
50 |
jQuery('#lightbox').remove();
|
51 |
opts.inprogress = false;
|
@@ -59,14 +67,11 @@
|
|
59 |
|
60 |
var outerImage = '<div id="outerImageContainer"><div id="imageContainer"><iframe id="lightboxIframe" /><img id="lightboxImage"><div id="hoverNav"><a href="javascript://" title="' + opts.strings.prevLinkTitle + '" id="prevLink"></a><a href="javascript://" id="nextLink" title="' + opts.strings.nextLinkTitle + '"></a></div><div id="loading"><a href="javascript://" id="loadingLink"><div id="jqlb_loading"></div></a></div></div></div>';
|
61 |
var imageData = '<div id="imageDataContainer" class="clearfix"><div id="imageData"><div id="imageDetails"><span id="caption"></span><span id="numberDisplay"></span></div><div id="bottomNav">';
|
62 |
-
|
63 |
if (opts.displayHelp){
|
64 |
imageData += '<span id="helpDisplay">' + opts.strings.help + '</span>';
|
65 |
}
|
66 |
imageData += '<a href="javascript://" id="bottomNavClose" title="' + opts.strings.closeTitle + '"><div id="jqlb_closelabel"></div></a></div></div></div>';
|
67 |
-
|
68 |
var string;
|
69 |
-
|
70 |
if (opts.navbarOnTop) {
|
71 |
string = '<div id="overlay"></div><div id="lightbox">' + imageData + outerImage + '</div>';
|
72 |
jQuery("body").append(string);
|
@@ -75,23 +80,27 @@
|
|
75 |
string = '<div id="overlay"></div><div id="lightbox">' + outerImage + imageData + '</div>';
|
76 |
jQuery("body").append(string);
|
77 |
}
|
78 |
-
|
79 |
jQuery("#overlay").click(function(){ end(); }).hide();
|
80 |
jQuery("#lightbox").click(function(){ end();}).hide();
|
81 |
jQuery("#loadingLink").click(function(){ end(); return false;});
|
82 |
jQuery("#bottomNavClose").click(function(){ end(); return false; });
|
83 |
jQuery('#outerImageContainer').width(opts.widthCurrent).height(opts.heightCurrent);
|
84 |
-
jQuery('#imageDataContainer').width(opts.widthCurrent);
|
85 |
-
|
86 |
if (!opts.imageClickClose) {
|
87 |
jQuery("#lightboxImage").click(function(){ return false; });
|
88 |
jQuery("#hoverNav").click(function(){ return false; });
|
89 |
}
|
90 |
};
|
91 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
92 |
function getPageSize() {
|
93 |
-
|
94 |
-
return jqueryPageSize;
|
95 |
};
|
96 |
|
97 |
function getPageScroll() {
|
@@ -106,27 +115,19 @@
|
|
106 |
yScroll = document.body.scrollTop;
|
107 |
xScroll = document.body.scrollLeft;
|
108 |
}
|
109 |
-
|
110 |
-
return arrayPageScroll;
|
111 |
-
};
|
112 |
-
|
113 |
-
function pause(ms) {
|
114 |
-
var date = new Date();
|
115 |
-
var curDate = null;
|
116 |
-
do{curDate = new Date();}
|
117 |
-
while(curDate - date < ms);
|
118 |
};
|
119 |
-
|
120 |
function start(imageLink) {
|
121 |
jQuery("select, embed, object").hide();
|
122 |
var arrayPageSize = getPageSize();
|
123 |
-
jQuery("#overlay").hide().css({width:
|
124 |
-
|
125 |
// if data is not provided by jsonData parameter
|
126 |
if(!opts.jsonData) {
|
127 |
opts.imageArray = [];
|
128 |
// if image is NOT part of a set..
|
129 |
-
if(!imageLink.rel || (imageLink.rel == '')){
|
130 |
// add single image to Lightbox.imageArray
|
131 |
var s = '';
|
132 |
if(imageLink.title){
|
@@ -174,8 +175,7 @@
|
|
174 |
}
|
175 |
});
|
176 |
}
|
177 |
-
}
|
178 |
-
|
179 |
if(opts.imageArray.length > 1) {
|
180 |
for(i = 0; i < opts.imageArray.length; i++){
|
181 |
for(j = opts.imageArray.length-1; j>i; j--){
|
@@ -186,86 +186,125 @@
|
|
186 |
}
|
187 |
while(opts.imageArray[imageNum][0] != imageLink.href) { imageNum++;}
|
188 |
}
|
189 |
-
|
190 |
// calculate top and left offset for the lightbox
|
191 |
var arrayPageScroll = getPageScroll();
|
192 |
-
|
193 |
-
|
194 |
-
jQuery('#lightbox').css({top: lightboxTop+'px', left: lightboxLeft+'px'}).show();
|
195 |
-
|
196 |
-
|
197 |
-
if (!opts.slideNavBar){
|
198 |
-
jQuery('#imageData').hide();
|
199 |
-
}
|
200 |
changeImage(imageNum);
|
201 |
};
|
202 |
-
|
203 |
function changeImage(imageNum) {
|
204 |
if(opts.inprogress == false){
|
205 |
opts.inprogress = true;
|
206 |
-
opts.activeImage = imageNum;
|
207 |
-
|
208 |
// hide elements during transition
|
209 |
jQuery('#loading').show();
|
210 |
jQuery('#lightboxImage').hide();
|
211 |
jQuery('#hoverNav').hide();
|
212 |
jQuery('#prevLink').hide();
|
213 |
jQuery('#nextLink').hide();
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
jQuery('#imageData').hide();
|
219 |
-
doChangeImage();
|
220 |
-
} else {
|
221 |
-
doChangeImage();
|
222 |
-
}
|
223 |
-
}
|
224 |
};
|
225 |
|
226 |
-
function doChangeImage() {
|
227 |
-
imgPreloader = new Image();
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
var maxWidth = arrayPageSize[2] - 3*opts.borderSize;//1 extra, to get some margins to the browser border.
|
235 |
-
var maxHeight = arrayPageSize[3] - 200;
|
236 |
-
var ratio = 1;
|
237 |
-
if(newHeight > maxHeight){
|
238 |
-
ratio = maxHeight/newHeight; //ex. 600/1024 = 0.58
|
239 |
-
}
|
240 |
-
newWidth = newWidth*ratio;
|
241 |
-
newHeight = newHeight*ratio;
|
242 |
-
ratio = 1;
|
243 |
-
if(newWidth > maxWidth){
|
244 |
-
ratio = maxWidth/newWidth; //ex. 800/1280 == 0.62
|
245 |
-
}
|
246 |
-
newWidth = newWidth*ratio;
|
247 |
-
newHeight = newHeight*ratio;
|
248 |
-
}
|
249 |
-
jQuery('#lightboxImage').attr('src', opts.imageArray[opts.activeImage][0])
|
250 |
-
.width(newWidth).height(newHeight);
|
251 |
-
resizeImageContainer(newWidth, newHeight);
|
252 |
-
};
|
253 |
-
|
254 |
-
imgPreloader.src = opts.imageArray[opts.activeImage][0];
|
255 |
};
|
256 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
257 |
function end() {
|
258 |
disableKeyboardNav();
|
259 |
jQuery('#lightbox').hide();
|
260 |
-
jQuery('#overlay').fadeOut(
|
261 |
jQuery('select, object, embed').show();
|
262 |
};
|
263 |
|
264 |
function preloadNeighborImages(){
|
265 |
if(opts.loopImages && opts.imageArray.length > 1) {
|
266 |
preloadNextImage = new Image();
|
267 |
-
preloadNextImage.src = opts.imageArray[(opts.activeImage == (opts.imageArray.length - 1)) ? 0 : opts.activeImage + 1][0]
|
268 |
-
|
269 |
preloadPrevImage = new Image();
|
270 |
preloadPrevImage.src = opts.imageArray[(opts.activeImage == 0) ? (opts.imageArray.length - 1) : opts.activeImage - 1][0]
|
271 |
} else {
|
@@ -279,102 +318,64 @@
|
|
279 |
}
|
280 |
}
|
281 |
};
|
282 |
-
|
283 |
-
function
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
var widthNew = Math.max(350, imgWidth + (opts.borderSize * 2));
|
290 |
-
var heightNew = (imgHeight + (opts.borderSize * 2));
|
291 |
-
|
292 |
-
// scalars based on change from old to new
|
293 |
-
opts.xScale = ( widthNew / opts.widthCurrent) * 100;
|
294 |
-
opts.yScale = ( heightNew / opts.heightCurrent) * 100;
|
295 |
-
|
296 |
-
// calculate size difference between new and old image, and resize if necessary
|
297 |
-
wDiff = opts.widthCurrent - widthNew;
|
298 |
-
hDiff = opts.heightCurrent - heightNew;
|
299 |
-
|
300 |
-
jQuery('#imageDataContainer').animate({width: widthNew},opts.resizeSpeed,'linear');
|
301 |
-
jQuery('#outerImageContainer').animate({width: widthNew},opts.resizeSpeed,'linear',function(){
|
302 |
-
jQuery('#outerImageContainer').animate({height: heightNew},opts.resizeSpeed,'linear',function(){
|
303 |
-
showImage();
|
304 |
-
});
|
305 |
-
});
|
306 |
-
|
307 |
-
// if new and old image are same size and no scaling transition is necessary,
|
308 |
-
// do a quick pause to prevent image flicker.
|
309 |
-
if((hDiff == 0) && (wDiff == 0)){
|
310 |
-
if (jQuery.browser.msie){ pause(250); } else { pause(100);}
|
311 |
-
}
|
312 |
-
|
313 |
-
jQuery('#prevLink').height(imgHeight);
|
314 |
-
jQuery('#nextLink').height(imgHeight);
|
315 |
-
};
|
316 |
-
|
317 |
-
function showImage() {
|
318 |
jQuery('#loading').hide();
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
|
|
323 |
opts.inprogress = false;
|
|
|
|
|
|
|
324 |
};
|
325 |
|
326 |
function updateDetails() {
|
327 |
-
jQuery('#numberDisplay').html('');
|
328 |
-
jQuery('#
|
329 |
-
jQuery('#caption').hide();
|
330 |
if(opts.imageArray[opts.activeImage][1]){
|
331 |
jQuery('#caption').html(opts.imageArray[opts.activeImage][1]).show();
|
332 |
}
|
333 |
// if image is part of set display 'Image x of x'
|
334 |
if(opts.imageArray.length > 1){
|
335 |
var nav_html;
|
336 |
-
|
337 |
nav_html = opts.strings.image + (opts.activeImage + 1) + opts.strings.of + opts.imageArray.length;
|
338 |
-
|
|
|
|
|
339 |
if (!opts.disableNavbarLinks) {
|
340 |
// display previous / next text links
|
341 |
if ((opts.activeImage) > 0 || opts.loopImages) {
|
342 |
nav_html = '<a title="' + opts.strings.prevLinkTitle + '" href="#" id="prevLinkText">' + opts.strings.prevLinkText + "</a>" + nav_html;
|
343 |
}
|
344 |
-
|
345 |
if (((opts.activeImage + 1) < opts.imageArray.length) || opts.loopImages) {
|
346 |
nav_html += '<a title="' + opts.strings.nextLinkTitle + '" href="#" id="nextLinkText">' + opts.strings.nextLinkText + "</a>";
|
347 |
}
|
348 |
-
}
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
if (opts.slideNavBar) {
|
354 |
-
jQuery("#imageData").slideDown(opts.navBarSlideSpeed);
|
355 |
-
} else {
|
356 |
-
jQuery("#imageData").show();
|
357 |
-
}
|
358 |
-
|
359 |
-
var arrayPageSize = getPageSize();
|
360 |
-
jQuery('#overlay').height(arrayPageSize[1]);
|
361 |
-
updateNav();
|
362 |
};
|
363 |
|
364 |
function updateNav() {
|
365 |
if(opts.imageArray.length > 1){
|
366 |
-
jQuery('#hoverNav').show();
|
367 |
-
|
368 |
// if loopImages is true, always show next and prev image buttons
|
369 |
if(opts.loopImages) {
|
370 |
jQuery('#prevLink,#prevLinkText').show().click(function(){
|
371 |
changeImage((opts.activeImage == 0) ? (opts.imageArray.length - 1) : opts.activeImage - 1); return false;
|
372 |
-
});
|
373 |
-
|
374 |
jQuery('#nextLink,#nextLinkText').show().click(function(){
|
375 |
changeImage((opts.activeImage == (opts.imageArray.length - 1)) ? 0 : opts.activeImage + 1); return false;
|
376 |
-
});
|
377 |
-
|
378 |
} else {
|
379 |
// if not first image in set, display prev image button
|
380 |
if(opts.activeImage != 0){
|
@@ -382,16 +383,13 @@
|
|
382 |
changeImage(opts.activeImage - 1); return false;
|
383 |
});
|
384 |
}
|
385 |
-
|
386 |
// if not last image in set, display next image button
|
387 |
if(opts.activeImage != (opts.imageArray.length - 1)){
|
388 |
jQuery('#nextLink,#nextLinkText').show().click(function(){
|
389 |
-
|
390 |
changeImage(opts.activeImage +1); return false;
|
391 |
});
|
392 |
}
|
393 |
-
}
|
394 |
-
|
395 |
enableKeyboardNav();
|
396 |
}
|
397 |
};
|
@@ -399,10 +397,8 @@
|
|
399 |
function keyboardAction(e) {
|
400 |
var o = e.data.opts
|
401 |
var keycode = e.keyCode;
|
402 |
-
var escapeKey = 27;
|
403 |
-
|
404 |
-
var key = String.fromCharCode(keycode).toLowerCase();
|
405 |
-
|
406 |
if((key == 'x') || (key == 'o') || (key == 'c') || (keycode == escapeKey)){ // close lightbox
|
407 |
end();
|
408 |
} else if((key == 'p') || (keycode == 37)){ // display previous image
|
@@ -424,25 +420,20 @@
|
|
424 |
changeImage(o.activeImage + 1);
|
425 |
}
|
426 |
}
|
427 |
-
};
|
428 |
-
|
429 |
function enableKeyboardNav() {
|
430 |
jQuery(document).bind('keydown', {opts: opts}, keyboardAction);
|
431 |
};
|
432 |
-
|
433 |
function disableKeyboardNav() {
|
434 |
jQuery(document).unbind('keydown');
|
435 |
-
};
|
436 |
-
|
437 |
};
|
438 |
|
439 |
jQuery.fn.lightbox.parseJsonData = function(data) {
|
440 |
-
var imageArray = [];
|
441 |
-
|
442 |
jQuery.each(data, function(){
|
443 |
imageArray.push(new Array(this.url, this.title));
|
444 |
-
});
|
445 |
-
|
446 |
return imageArray;
|
447 |
};
|
448 |
jQuery.fn.lightbox.defaults = {
|
@@ -457,10 +448,9 @@
|
|
457 |
xScale : 1,
|
458 |
yScale : 1,
|
459 |
displayTitle: true,
|
460 |
-
navbarOnTop: false,
|
461 |
-
slideNavBar: false, // slide nav bar up/down between image resizing transitions
|
462 |
-
navBarSlideSpeed: 250,
|
463 |
displayHelp: false,
|
|
|
464 |
strings : {
|
465 |
help: ' \u2190 / P - previous image\u00a0\u00a0\u00a0\u00a0\u2192 / N - next image\u00a0\u00a0\u00a0\u00a0ESC / X - close image gallery',
|
466 |
prevLinkTitle: 'previous image',
|
@@ -469,22 +459,30 @@
|
|
469 |
nextLinkText: 'Next »',
|
470 |
closeTitle: 'close image gallery',
|
471 |
image: 'Image ',
|
472 |
-
of: ' of '
|
|
|
473 |
},
|
474 |
-
fitToScreen:
|
475 |
disableNavbarLinks: true,
|
476 |
loopImages: true,
|
477 |
imageClickClose: true,
|
478 |
jsonData: null,
|
479 |
-
jsonDataParser: null
|
|
|
|
|
480 |
};
|
481 |
|
482 |
})(jQuery);
|
483 |
|
484 |
jQuery(document).ready(function(){
|
|
|
485 |
jQuery('a[rel^="lightbox"]').lightbox({
|
486 |
fitToScreen: (typeof JQLBSettings == 'object' && JQLBSettings.fitToScreen == '1') ? true : false,
|
487 |
-
resizeSpeed: (typeof JQLBSettings == 'object' && JQLBSettings.resizeSpeed
|
488 |
-
|
|
|
|
|
|
|
489 |
});
|
|
|
490 |
});
|
1 |
+
/**
|
2 |
+
* WP jQuery Lightbox
|
3 |
+
* Version 1.3 - 2011-05-01
|
4 |
+
* @author Ulf Benjaminsson (http://www.ulfben.com)
|
5 |
+
*
|
6 |
+
* This is a modified version of Warren Krevenkis Lightbox-port (see notice below) for use in the WP jQuery Lightbox-
|
7 |
+
* plugin (http://wordpress.org/extend/plugins/wp-jquery-lightbox/)
|
8 |
+
* Modifications include:
|
9 |
+
* . improved the resizing code to respect aspect ratio
|
10 |
+
* . improved scaling routines to maximize images while taking captions into account
|
11 |
+
* . added support for browser resizing and orientation changes
|
12 |
+
* . grabs image caption from WordPress [gallery] or media library output
|
13 |
+
* . using WordPress API to localize script (with safe fallbacks)
|
14 |
+
* . grabs image title if the link lacks one
|
15 |
+
* . using rel attribute instead of class
|
16 |
+
* . auto-lightboxing all links after page load
|
17 |
+
* . replaced explicit IMG-urls with divs, styled through the CSS.
|
18 |
+
* . honors empty captions / titles
|
19 |
+
* . use only title if captions is identical
|
20 |
+
* . added support for disabling all animations
|
21 |
+
* . using no-conflict mode (for good measure)
|
22 |
+
**/
|
23 |
/**
|
24 |
* jQuery Lightbox
|
25 |
* Version 0.5 - 11/29/2007
|
30 |
*
|
31 |
* Based on Lightbox 2 by Lokesh Dhakar (http://www.huddletogether.com/projects/lightbox2/)
|
32 |
* Originally written to make use of the Prototype framework, and Script.acalo.us, now altered to use jQuery.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
**/
|
34 |
(function(jQuery){
|
35 |
jQuery.fn.lightbox = function(options){
|
36 |
// build main options
|
37 |
+
var opts = jQuery.extend({}, jQuery.fn.lightbox.defaults, options);
|
38 |
+
return jQuery(this).live("click", function(){
|
|
|
|
|
|
|
39 |
initialize();
|
40 |
start(this);
|
41 |
return false;
|
|
|
42 |
});
|
43 |
|
44 |
/**
|
49 |
*/
|
50 |
|
51 |
function initialize() {
|
52 |
+
jQuery(window).bind('orientationchange', resizeListener);
|
53 |
+
jQuery(window).bind('resize', resizeListener);
|
54 |
+
/*if(opts.followScroll){
|
55 |
+
jQuery(window).bind('scroll', orientListener);
|
56 |
+
}*/
|
57 |
jQuery('#overlay').remove();
|
58 |
jQuery('#lightbox').remove();
|
59 |
opts.inprogress = false;
|
67 |
|
68 |
var outerImage = '<div id="outerImageContainer"><div id="imageContainer"><iframe id="lightboxIframe" /><img id="lightboxImage"><div id="hoverNav"><a href="javascript://" title="' + opts.strings.prevLinkTitle + '" id="prevLink"></a><a href="javascript://" id="nextLink" title="' + opts.strings.nextLinkTitle + '"></a></div><div id="loading"><a href="javascript://" id="loadingLink"><div id="jqlb_loading"></div></a></div></div></div>';
|
69 |
var imageData = '<div id="imageDataContainer" class="clearfix"><div id="imageData"><div id="imageDetails"><span id="caption"></span><span id="numberDisplay"></span></div><div id="bottomNav">';
|
|
|
70 |
if (opts.displayHelp){
|
71 |
imageData += '<span id="helpDisplay">' + opts.strings.help + '</span>';
|
72 |
}
|
73 |
imageData += '<a href="javascript://" id="bottomNavClose" title="' + opts.strings.closeTitle + '"><div id="jqlb_closelabel"></div></a></div></div></div>';
|
|
|
74 |
var string;
|
|
|
75 |
if (opts.navbarOnTop) {
|
76 |
string = '<div id="overlay"></div><div id="lightbox">' + imageData + outerImage + '</div>';
|
77 |
jQuery("body").append(string);
|
80 |
string = '<div id="overlay"></div><div id="lightbox">' + outerImage + imageData + '</div>';
|
81 |
jQuery("body").append(string);
|
82 |
}
|
|
|
83 |
jQuery("#overlay").click(function(){ end(); }).hide();
|
84 |
jQuery("#lightbox").click(function(){ end();}).hide();
|
85 |
jQuery("#loadingLink").click(function(){ end(); return false;});
|
86 |
jQuery("#bottomNavClose").click(function(){ end(); return false; });
|
87 |
jQuery('#outerImageContainer').width(opts.widthCurrent).height(opts.heightCurrent);
|
88 |
+
jQuery('#imageDataContainer').width(opts.widthCurrent);
|
|
|
89 |
if (!opts.imageClickClose) {
|
90 |
jQuery("#lightboxImage").click(function(){ return false; });
|
91 |
jQuery("#hoverNav").click(function(){ return false; });
|
92 |
}
|
93 |
};
|
94 |
+
//allow image to reposition & scale if orientation change or resize occurs.
|
95 |
+
function resizeListener(e){
|
96 |
+
if(opts.resizeTimeout){
|
97 |
+
clearTimeout(opts.resizeTimeout);
|
98 |
+
opts.resizeTimeout = false;
|
99 |
+
}
|
100 |
+
opts.resizeTimeout = setTimeout(function(){doScale(false);}, 15); //avoid duplicate event calls.
|
101 |
+
}
|
102 |
function getPageSize() {
|
103 |
+
return new Array(jQuery(document).width(),jQuery(document).height(), jQuery(window).width(), jQuery(window).height());
|
|
|
104 |
};
|
105 |
|
106 |
function getPageScroll() {
|
115 |
yScroll = document.body.scrollTop;
|
116 |
xScroll = document.body.scrollLeft;
|
117 |
}
|
118 |
+
return new Array(xScroll,yScroll);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
119 |
};
|
120 |
+
|
121 |
function start(imageLink) {
|
122 |
jQuery("select, embed, object").hide();
|
123 |
var arrayPageSize = getPageSize();
|
124 |
+
var overlay = jQuery("#overlay").hide().css({width: arrayPageSize[0]+"px", height: arrayPageSize[1]+'px', opacity : opts.overlayOpacity}).fadeIn(400);
|
125 |
+
imageNum = 0;
|
126 |
// if data is not provided by jsonData parameter
|
127 |
if(!opts.jsonData) {
|
128 |
opts.imageArray = [];
|
129 |
// if image is NOT part of a set..
|
130 |
+
if (!imageLink.rel || (imageLink.rel == '')) {
|
131 |
// add single image to Lightbox.imageArray
|
132 |
var s = '';
|
133 |
if(imageLink.title){
|
175 |
}
|
176 |
});
|
177 |
}
|
178 |
+
}
|
|
|
179 |
if(opts.imageArray.length > 1) {
|
180 |
for(i = 0; i < opts.imageArray.length; i++){
|
181 |
for(j = opts.imageArray.length-1; j>i; j--){
|
186 |
}
|
187 |
while(opts.imageArray[imageNum][0] != imageLink.href) { imageNum++;}
|
188 |
}
|
|
|
189 |
// calculate top and left offset for the lightbox
|
190 |
var arrayPageScroll = getPageScroll();
|
191 |
+
|
192 |
+
setLightBoxPos(arrayPageScroll[1], arrayPageScroll[0]).show();
|
|
|
|
|
|
|
|
|
|
|
|
|
193 |
changeImage(imageNum);
|
194 |
};
|
195 |
+
|
196 |
function changeImage(imageNum) {
|
197 |
if(opts.inprogress == false){
|
198 |
opts.inprogress = true;
|
199 |
+
opts.activeImage = imageNum;
|
|
|
200 |
// hide elements during transition
|
201 |
jQuery('#loading').show();
|
202 |
jQuery('#lightboxImage').hide();
|
203 |
jQuery('#hoverNav').hide();
|
204 |
jQuery('#prevLink').hide();
|
205 |
jQuery('#nextLink').hide();
|
206 |
+
// jQuery('#imageDataContainer').hide();
|
207 |
+
//jQuery('#imageData').hide();
|
208 |
+
doChangeImage();
|
209 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
210 |
};
|
211 |
|
212 |
+
function doChangeImage() {
|
213 |
+
opts.imgPreloader = new Image();
|
214 |
+
opts.imgPreloader.onload=function(){
|
215 |
+
preloadNeighborImages();
|
216 |
+
jQuery('#lightboxImage').attr('src', opts.imageArray[opts.activeImage][0]);
|
217 |
+
doScale(); // once image is preloaded, resize image container
|
218 |
+
};
|
219 |
+
opts.imgPreloader.src = opts.imageArray[opts.activeImage][0];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
220 |
};
|
221 |
|
222 |
+
function doScale(animate){
|
223 |
+
if(!opts.imgPreloader){
|
224 |
+
return;
|
225 |
+
}
|
226 |
+
if(animate == undefined){animate = opts.animate;}
|
227 |
+
var newWidth = opts.imgPreloader.width;
|
228 |
+
var newHeight = opts.imgPreloader.height;
|
229 |
+
var arrayPageSize = getPageSize();
|
230 |
+
updateDetails(); //order of calls is important! initializes height of imageDataContainer
|
231 |
+
var maxWidth = arrayPageSize[2] - 2*opts.borderSize;
|
232 |
+
var maxHeight = arrayPageSize[3] - (jQuery("#imageDataContainer").height()+(2*opts.borderSize));
|
233 |
+
if(opts.fitToScreen) {
|
234 |
+
var ratio = 1;
|
235 |
+
if(newHeight > maxHeight){
|
236 |
+
ratio = maxHeight/newHeight; //ex. 600/1024 = 0.58
|
237 |
+
}
|
238 |
+
newWidth = newWidth*ratio;
|
239 |
+
newHeight = newHeight*ratio;
|
240 |
+
ratio = 1;
|
241 |
+
if(newWidth > maxWidth){
|
242 |
+
ratio = maxWidth/newWidth; //ex. 800/1280 == 0.62
|
243 |
+
}
|
244 |
+
newWidth = parseInt(newWidth*ratio);
|
245 |
+
newHeight = parseInt(newHeight*ratio);
|
246 |
+
}
|
247 |
+
var arrayPageScroll = getPageScroll();
|
248 |
+
var centerY = arrayPageScroll[1]+(maxHeight*0.5);
|
249 |
+
var newTop = centerY - newHeight*0.5;
|
250 |
+
jQuery('#lightboxImage').width(newWidth).height(newHeight);
|
251 |
+
resizeImageContainer(newWidth, newHeight, newTop, animate);
|
252 |
+
}
|
253 |
+
|
254 |
+
function resizeImageContainer(imgWidth, imgHeight, lightboxTop, animate) {
|
255 |
+
if(animate == undefined){animate = opts.animate;}
|
256 |
+
opts.widthCurrent = jQuery("#outerImageContainer").outerWidth();
|
257 |
+
opts.heightCurrent = jQuery("#outerImageContainer").outerHeight();
|
258 |
+
var widthNew = Math.max(350, imgWidth + (opts.borderSize * 2));
|
259 |
+
var heightNew = (imgHeight + (opts.borderSize * 2));
|
260 |
+
// scalars based on change from old to new
|
261 |
+
opts.xScale = (widthNew / opts.widthCurrent) * 100;
|
262 |
+
opts.yScale = (heightNew / opts.heightCurrent) * 100;
|
263 |
+
// calculate size difference between new and old image, and resize only if necessary
|
264 |
+
wDiff = opts.widthCurrent - widthNew;
|
265 |
+
hDiff = opts.heightCurrent - heightNew;
|
266 |
+
setLightBoxPos(lightboxTop, null, animate);
|
267 |
+
if(animate && (hDiff != 0 && wDiff != 0)){
|
268 |
+
jQuery('#imageDataContainer').animate({width: widthNew},opts.resizeSpeed,'linear');
|
269 |
+
jQuery('#outerImageContainer').animate({width: widthNew},opts.resizeSpeed,'linear',function(){
|
270 |
+
jQuery('#outerImageContainer').animate({height: heightNew},opts.resizeSpeed,'linear',function(){
|
271 |
+
showImage();
|
272 |
+
});
|
273 |
+
});
|
274 |
+
} else {
|
275 |
+
jQuery('#imageDataContainer').width(widthNew);
|
276 |
+
jQuery('#outerImageContainer').width(widthNew);
|
277 |
+
jQuery('#outerImageContainer').height(heightNew);
|
278 |
+
showImage();
|
279 |
+
}
|
280 |
+
jQuery('#prevLink').height(imgHeight);
|
281 |
+
jQuery('#nextLink').height(imgHeight);
|
282 |
+
};
|
283 |
+
|
284 |
+
function setLightBoxPos(top, left, animate){
|
285 |
+
if(animate == undefined){animate = opts.animate;}
|
286 |
+
if(left == undefined || left == null){
|
287 |
+
var arrayPageScroll = getPageScroll();
|
288 |
+
left = arrayPageScroll[0];
|
289 |
+
}
|
290 |
+
if(animate){
|
291 |
+
jQuery('#lightbox').animate({top: top}, 250,'linear');
|
292 |
+
return jQuery('#lightbox').animate({left: left}, 250,'linear');
|
293 |
+
}
|
294 |
+
return jQuery('#lightbox').css({top: top+'px', left: left+'px'});
|
295 |
+
}
|
296 |
+
|
297 |
function end() {
|
298 |
disableKeyboardNav();
|
299 |
jQuery('#lightbox').hide();
|
300 |
+
jQuery('#overlay').fadeOut();
|
301 |
jQuery('select, object, embed').show();
|
302 |
};
|
303 |
|
304 |
function preloadNeighborImages(){
|
305 |
if(opts.loopImages && opts.imageArray.length > 1) {
|
306 |
preloadNextImage = new Image();
|
307 |
+
preloadNextImage.src = opts.imageArray[(opts.activeImage == (opts.imageArray.length - 1)) ? 0 : opts.activeImage + 1][0]
|
|
|
308 |
preloadPrevImage = new Image();
|
309 |
preloadPrevImage.src = opts.imageArray[(opts.activeImage == 0) ? (opts.imageArray.length - 1) : opts.activeImage - 1][0]
|
310 |
} else {
|
318 |
}
|
319 |
}
|
320 |
};
|
321 |
+
|
322 |
+
function showImage() {
|
323 |
+
//assumes updateDetails have been called earlier!
|
324 |
+
jQuery("#imageData").show();
|
325 |
+
jQuery('#caption').show();
|
326 |
+
//jQuery('#imageDataContainer').slideDown(400);
|
327 |
+
//jQuery("#imageDetails").hide().fadeIn(400);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
328 |
jQuery('#loading').hide();
|
329 |
+
if(opts.animate){
|
330 |
+
jQuery('#lightboxImage').fadeIn("fast");
|
331 |
+
}else{
|
332 |
+
jQuery('#lightboxImage').show();
|
333 |
+
}
|
334 |
opts.inprogress = false;
|
335 |
+
var arrayPageSize = getPageSize();
|
336 |
+
jQuery("#overlay").css({width: arrayPageSize[0]+"px", height: arrayPageSize[1]+'px'});
|
337 |
+
updateNav();
|
338 |
};
|
339 |
|
340 |
function updateDetails() {
|
341 |
+
jQuery('#numberDisplay').html('');
|
342 |
+
jQuery('#caption').html('').hide();
|
|
|
343 |
if(opts.imageArray[opts.activeImage][1]){
|
344 |
jQuery('#caption').html(opts.imageArray[opts.activeImage][1]).show();
|
345 |
}
|
346 |
// if image is part of set display 'Image x of x'
|
347 |
if(opts.imageArray.length > 1){
|
348 |
var nav_html;
|
|
|
349 |
nav_html = opts.strings.image + (opts.activeImage + 1) + opts.strings.of + opts.imageArray.length;
|
350 |
+
if (opts.displayDownloadLink) {
|
351 |
+
nav_html += '<a href="' + opts.imageArray[opts.activeImage][0] + '" id="downloadLink">' + opts.strings.download + '</a>';
|
352 |
+
}
|
353 |
if (!opts.disableNavbarLinks) {
|
354 |
// display previous / next text links
|
355 |
if ((opts.activeImage) > 0 || opts.loopImages) {
|
356 |
nav_html = '<a title="' + opts.strings.prevLinkTitle + '" href="#" id="prevLinkText">' + opts.strings.prevLinkText + "</a>" + nav_html;
|
357 |
}
|
|
|
358 |
if (((opts.activeImage + 1) < opts.imageArray.length) || opts.loopImages) {
|
359 |
nav_html += '<a title="' + opts.strings.nextLinkTitle + '" href="#" id="nextLinkText">' + opts.strings.nextLinkText + "</a>";
|
360 |
}
|
361 |
+
}
|
362 |
+
jQuery('#numberDisplay').html(nav_html).show();
|
363 |
+
}
|
364 |
+
jQuery("#imageData").show();
|
365 |
+
updateNav();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
366 |
};
|
367 |
|
368 |
function updateNav() {
|
369 |
if(opts.imageArray.length > 1){
|
370 |
+
jQuery('#hoverNav').show();
|
|
|
371 |
// if loopImages is true, always show next and prev image buttons
|
372 |
if(opts.loopImages) {
|
373 |
jQuery('#prevLink,#prevLinkText').show().click(function(){
|
374 |
changeImage((opts.activeImage == 0) ? (opts.imageArray.length - 1) : opts.activeImage - 1); return false;
|
375 |
+
});
|
|
|
376 |
jQuery('#nextLink,#nextLinkText').show().click(function(){
|
377 |
changeImage((opts.activeImage == (opts.imageArray.length - 1)) ? 0 : opts.activeImage + 1); return false;
|
378 |
+
});
|
|
|
379 |
} else {
|
380 |
// if not first image in set, display prev image button
|
381 |
if(opts.activeImage != 0){
|
383 |
changeImage(opts.activeImage - 1); return false;
|
384 |
});
|
385 |
}
|
|
|
386 |
// if not last image in set, display next image button
|
387 |
if(opts.activeImage != (opts.imageArray.length - 1)){
|
388 |
jQuery('#nextLink,#nextLinkText').show().click(function(){
|
|
|
389 |
changeImage(opts.activeImage +1); return false;
|
390 |
});
|
391 |
}
|
392 |
+
}
|
|
|
393 |
enableKeyboardNav();
|
394 |
}
|
395 |
};
|
397 |
function keyboardAction(e) {
|
398 |
var o = e.data.opts
|
399 |
var keycode = e.keyCode;
|
400 |
+
var escapeKey = 27;
|
401 |
+
var key = String.fromCharCode(keycode).toLowerCase();
|
|
|
|
|
402 |
if((key == 'x') || (key == 'o') || (key == 'c') || (keycode == escapeKey)){ // close lightbox
|
403 |
end();
|
404 |
} else if((key == 'p') || (keycode == 37)){ // display previous image
|
420 |
changeImage(o.activeImage + 1);
|
421 |
}
|
422 |
}
|
423 |
+
};
|
|
|
424 |
function enableKeyboardNav() {
|
425 |
jQuery(document).bind('keydown', {opts: opts}, keyboardAction);
|
426 |
};
|
|
|
427 |
function disableKeyboardNav() {
|
428 |
jQuery(document).unbind('keydown');
|
429 |
+
};
|
|
|
430 |
};
|
431 |
|
432 |
jQuery.fn.lightbox.parseJsonData = function(data) {
|
433 |
+
var imageArray = [];
|
|
|
434 |
jQuery.each(data, function(){
|
435 |
imageArray.push(new Array(this.url, this.title));
|
436 |
+
});
|
|
|
437 |
return imageArray;
|
438 |
};
|
439 |
jQuery.fn.lightbox.defaults = {
|
448 |
xScale : 1,
|
449 |
yScale : 1,
|
450 |
displayTitle: true,
|
451 |
+
navbarOnTop: false,
|
|
|
|
|
452 |
displayHelp: false,
|
453 |
+
displayDownloadLink: true,
|
454 |
strings : {
|
455 |
help: ' \u2190 / P - previous image\u00a0\u00a0\u00a0\u00a0\u2192 / N - next image\u00a0\u00a0\u00a0\u00a0ESC / X - close image gallery',
|
456 |
prevLinkTitle: 'previous image',
|
459 |
nextLinkText: 'Next »',
|
460 |
closeTitle: 'close image gallery',
|
461 |
image: 'Image ',
|
462 |
+
of: ' of ',
|
463 |
+
download: 'Download'
|
464 |
},
|
465 |
+
fitToScreen: true, // resize images if they are bigger than window
|
466 |
disableNavbarLinks: true,
|
467 |
loopImages: true,
|
468 |
imageClickClose: true,
|
469 |
jsonData: null,
|
470 |
+
jsonDataParser: null,
|
471 |
+
animate: true,
|
472 |
+
followScroll: false
|
473 |
};
|
474 |
|
475 |
})(jQuery);
|
476 |
|
477 |
jQuery(document).ready(function(){
|
478 |
+
if(typeof JQLBSettings == 'object' && JQLBSettings.resizeSpeed){JQLBSettings.resizeSpeed = parseInt(JQLBSettings.resizeSpeed);}
|
479 |
jQuery('a[rel^="lightbox"]').lightbox({
|
480 |
fitToScreen: (typeof JQLBSettings == 'object' && JQLBSettings.fitToScreen == '1') ? true : false,
|
481 |
+
resizeSpeed: (typeof JQLBSettings == 'object' && JQLBSettings.resizeSpeed >= 0) ? JQLBSettings.resizeSpeed : 250,
|
482 |
+
animate: (typeof JQLBSettings == 'object' && JQLBSettings.resizeSpeed == 0) ? false : true,
|
483 |
+
displayDownloadLink: (typeof JQLBSettings == 'object' && JQLBSettings.displayDownloadLink == '0') ? false : true,
|
484 |
+
//followScroll: (typeof JQLBSettings == 'object' && JQLBSettings.followScroll == '0') ? false : true,
|
485 |
+
strings: JQLBSettings
|
486 |
});
|
487 |
+
|
488 |
});
|
jquery.lightbox.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
(function(a){a.fn.lightbox=function(h){var s=a.extend({},a.fn.lightbox.defaults,h);return this.each(function(){a(this).click(function(){e();n(this);return false})});function e(){a("#overlay").remove();a("#lightbox").remove();s.inprogress=false;if(s.jsonData&&s.jsonData.length>0){var y=s.jsonDataParser?s.jsonDataParser:a.fn.lightbox.parseJsonData;s.imageArray=[];s.imageArray=y(s.jsonData)}var v='<div id="outerImageContainer"><div id="imageContainer"><iframe id="lightboxIframe" /><img id="lightboxImage"><div id="hoverNav"><a href="javascript://" title="'+s.strings.prevLinkTitle+'" id="prevLink"></a><a href="javascript://" id="nextLink" title="'+s.strings.nextLinkTitle+'"></a></div><div id="loading"><a href="javascript://" id="loadingLink"><div id="jqlb_loading"></div></a></div></div></div>';var x='<div id="imageDataContainer" class="clearfix"><div id="imageData"><div id="imageDetails"><span id="caption"></span><span id="numberDisplay"></span></div><div id="bottomNav">';if(s.displayHelp){x+='<span id="helpDisplay">'+s.strings.help+"</span>"}x+='<a href="javascript://" id="bottomNavClose" title="'+s.strings.closeTitle+'"><div id="jqlb_closelabel"></div></a></div></div></div>';var w;if(s.navbarOnTop){w='<div id="overlay"></div><div id="lightbox">'+x+v+"</div>";a("body").append(w);a("#imageDataContainer").addClass("ontop")}else{w='<div id="overlay"></div><div id="lightbox">'+v+x+"</div>";a("body").append(w)}a("#overlay").click(function(){l()}).hide();a("#lightbox").click(function(){l()}).hide();a("#loadingLink").click(function(){l();return false});a("#bottomNavClose").click(function(){l();return false});a("#outerImageContainer").width(s.widthCurrent).height(s.heightCurrent);a("#imageDataContainer").width(s.widthCurrent);if(!s.imageClickClose){a("#lightboxImage").click(function(){return false});a("#hoverNav").click(function(){return false})}}function u(){var v=new Array(a(document).width(),a(document).height(),a(window).width(),a(window).height());return v}function g(){var x,v;if(self.pageYOffset){v=self.pageYOffset;x=self.pageXOffset}else{if(document.documentElement&&document.documentElement.scrollTop){v=document.documentElement.scrollTop;x=document.documentElement.scrollLeft}else{if(document.body){v=document.body.scrollTop;x=document.body.scrollLeft}}}var w=new Array(x,v);return w}function o(x){var w=new Date();var v=null;do{v=new Date()}while(v-w<x)}function n(A){a("select, embed, object").hide();var w=u();a("#overlay").hide().css({width:"100%",height:w[1]+"px",opacity:s.overlayOpacity}).fadeIn(400);imageNum=0;if(!s.jsonData){s.imageArray=[];if(!A.rel||(A.rel=="")){var x="";if(A.title){x=A.title}else{if(a(this).children(":first-child").attr("title")){x=a(this).children(":first-child").attr("title")}}s.imageArray.push(new Array(A.href,s.displayTitle?x:""))}else{a("a").each(function(){if(this.href&&(this.rel==A.rel)){var E="";var C="";var G="";var B=a(this);if(this.title){E=this.title}else{if(B.children("img:first-child").attr("title")){E=B.children("img:first-child").attr("title")}}if(B.parent().next(".gallery-caption").html()){var F=B.parent().next(".gallery-caption");C=F.html();G=F.text()}else{if(B.next(".wp-caption-text").html()){C=B.next(".wp-caption-text").html();G=B.next(".wp-caption-text").text()}}E=a.trim(E);G=a.trim(G);if(E.toLowerCase()==G.toLowerCase()){E=C;C=""}var D="";if(E!=""&&C!=""){D=E+"<br />"+C}else{if(E!=""){D=E}else{if(C!=""){D=C}}}s.imageArray.push(new Array(this.href,s.displayTitle?D:""))}})}}if(s.imageArray.length>1){for(i=0;i<s.imageArray.length;i++){for(j=s.imageArray.length-1;j>i;j--){if(s.imageArray[i][0]==s.imageArray[j][0]){s.imageArray.splice(j,1)}}}while(s.imageArray[imageNum][0]!=A.href){imageNum++}}var v=g();var z=v[1]+(w[3]/10);var y=v[0];a("#lightbox").css({top:z+"px",left:y+"px"}).show();if(!s.slideNavBar){a("#imageData").hide()}t(imageNum)}function t(v){if(s.inprogress==false){s.inprogress=true;s.activeImage=v;a("#loading").show();a("#lightboxImage").hide();a("#hoverNav").hide();a("#prevLink").hide();a("#nextLink").hide();if(s.slideNavBar){a("#imageDataContainer").hide();a("#imageData").hide();k()}else{k()}}}function k(){imgPreloader=new Image();imgPreloader.onload=function(){var A=imgPreloader.width;var v=imgPreloader.height;if(s.fitToScreen){var w=u();var z=w[2]-3*s.borderSize;var y=w[3]-200;var x=1;if(v>y){x=y/v}A=A*x;v=v*x;x=1;if(A>z){x=z/A}A=A*x;v=v*x}a("#lightboxImage").attr("src",s.imageArray[s.activeImage][0]).width(A).height(v);m(A,v)};imgPreloader.src=s.imageArray[s.activeImage][0]}function l(){p();a("#lightbox").hide();a("#overlay").fadeOut(250);a("select, object, embed").show()}function f(){if(s.loopImages&&s.imageArray.length>1){preloadNextImage=new Image();preloadNextImage.src=s.imageArray[(s.activeImage==(s.imageArray.length-1))?0:s.activeImage+1][0];preloadPrevImage=new Image();preloadPrevImage.src=s.imageArray[(s.activeImage==0)?(s.imageArray.length-1):s.activeImage-1][0]}else{if((s.imageArray.length-1)>s.activeImage){preloadNextImage=new Image();preloadNextImage.src=s.imageArray[s.activeImage+1][0]}if(s.activeImage>0){preloadPrevImage=new Image();preloadPrevImage.src=s.imageArray[s.activeImage-1][0]}}}function m(y,w){s.widthCurrent=a("#outerImageContainer").outerWidth();s.heightCurrent=a("#outerImageContainer").outerHeight();var v=Math.max(350,y+(s.borderSize*2));var x=(w+(s.borderSize*2));s.xScale=(v/s.widthCurrent)*100;s.yScale=(x/s.heightCurrent)*100;wDiff=s.widthCurrent-v;hDiff=s.heightCurrent-x;a("#imageDataContainer").animate({width:v},s.resizeSpeed,"linear");a("#outerImageContainer").animate({width:v},s.resizeSpeed,"linear",function(){a("#outerImageContainer").animate({height:x},s.resizeSpeed,"linear",function(){d()})});if((hDiff==0)&&(wDiff==0)){if(a.browser.msie){o(250)}else{o(100)}}a("#prevLink").height(w);a("#nextLink").height(w)}function d(){a("#loading").hide();a("#lightboxImage").fadeIn(400);c();f();s.inprogress=false}function c(){a("#numberDisplay").html("");a("#imageDataContainer").slideDown("fast");a("#caption").hide();if(s.imageArray[s.activeImage][1]){a("#caption").html(s.imageArray[s.activeImage][1]).show()}if(s.imageArray.length>1){var w;w=s.strings.image+(s.activeImage+1)+s.strings.of+s.imageArray.length;if(!s.disableNavbarLinks){if((s.activeImage)>0||s.loopImages){w='<a title="'+s.strings.prevLinkTitle+'" href="#" id="prevLinkText">'+s.strings.prevLinkText+"</a>"+w}if(((s.activeImage+1)<s.imageArray.length)||s.loopImages){w+='<a title="'+s.strings.nextLinkTitle+'" href="#" id="nextLinkText">'+s.strings.nextLinkText+"</a>"}}a("#numberDisplay").html(w).show()}if(s.slideNavBar){a("#imageData").slideDown(s.navBarSlideSpeed)}else{a("#imageData").show()}var v=u();a("#overlay").height(v[1]);q()}function q(){if(s.imageArray.length>1){a("#hoverNav").show();if(s.loopImages){a("#prevLink,#prevLinkText").show().click(function(){t((s.activeImage==0)?(s.imageArray.length-1):s.activeImage-1);return false});a("#nextLink,#nextLinkText").show().click(function(){t((s.activeImage==(s.imageArray.length-1))?0:s.activeImage+1);return false})}else{if(s.activeImage!=0){a("#prevLink,#prevLinkText").show().click(function(){t(s.activeImage-1);return false})}if(s.activeImage!=(s.imageArray.length-1)){a("#nextLink,#nextLinkText").show().click(function(){t(s.activeImage+1);return false})}}b()}}function r(y){var z=y.data.opts;var v=y.keyCode;var w=27;var x=String.fromCharCode(v).toLowerCase();if((x=="x")||(x=="o")||(x=="c")||(v==w)){l()}else{if((x=="p")||(v==37)){if(z.loopImages){p();t((z.activeImage==0)?(z.imageArray.length-1):z.activeImage-1)}else{if(z.activeImage!=0){p();t(z.activeImage-1)}}}else{if((x=="n")||(v==39)){if(s.loopImages){p();t((z.activeImage==(z.imageArray.length-1))?0:z.activeImage+1)}else{if(z.activeImage!=(z.imageArray.length-1)){p();t(z.activeImage+1)}}}}}}function b(){a(document).bind("keydown",{opts:s},r)}function p(){a(document).unbind("keydown")}};a.fn.lightbox.parseJsonData=function(c){var b=[];a.each(c,function(){b.push(new Array(this.url,this.title))});return b};a.fn.lightbox.defaults={overlayOpacity:0.8,borderSize:10,imageArray:new Array,activeImage:null,inprogress:false,resizeSpeed:250,widthCurrent:250,heightCurrent:250,xScale:1,yScale:1,displayTitle:true,navbarOnTop:false,slideNavBar:false,navBarSlideSpeed:250,displayHelp:false,strings:{help:" \u2190 / P - previous image\u00a0\u00a0\u00a0\u00a0\u2192 / N - next image\u00a0\u00a0\u00a0\u00a0ESC / X - close image gallery",prevLinkTitle:"previous image",nextLinkTitle:"next image",prevLinkText:"« Previous",nextLinkText:"Next »",closeTitle:"close image gallery",image:"Image ",of:" of "},fitToScreen:false,disableNavbarLinks:true,loopImages:true,imageClickClose:true,jsonData:null,jsonDataParser:null}})(jQuery);jQuery(document).ready(function(){jQuery('a[rel^="lightbox"]').lightbox({fitToScreen:(typeof JQLBSettings=="object"&&JQLBSettings.fitToScreen=="1")?true:false,resizeSpeed:(typeof JQLBSettings=="object"&&JQLBSettings.resizeSpeed>0)?JQLBSettings.resizeSpeed:250,imageClickClose:true})});
|
1 |
+
(function(a){a.fn.lightbox=function(h){var t=a.extend({},a.fn.lightbox.defaults,h);return a(this).live("click",function(){e();o(this);return false;});function e(){a(window).bind("orientationchange",p);a(window).bind("resize",p);a("#overlay").remove();a("#lightbox").remove();t.inprogress=false;if(t.jsonData&&t.jsonData.length>0){var A=t.jsonDataParser?t.jsonDataParser:a.fn.lightbox.parseJsonData;t.imageArray=[];t.imageArray=A(t.jsonData);}var x='<div id="outerImageContainer"><div id="imageContainer"><iframe id="lightboxIframe" /><img id="lightboxImage"><div id="hoverNav"><a href="javascript://" title="'+t.strings.prevLinkTitle+'" id="prevLink"></a><a href="javascript://" id="nextLink" title="'+t.strings.nextLinkTitle+'"></a></div><div id="loading"><a href="javascript://" id="loadingLink"><div id="jqlb_loading"></div></a></div></div></div>';var z='<div id="imageDataContainer" class="clearfix"><div id="imageData"><div id="imageDetails"><span id="caption"></span><span id="numberDisplay"></span></div><div id="bottomNav">';if(t.displayHelp){z+='<span id="helpDisplay">'+t.strings.help+"</span>";}z+='<a href="javascript://" id="bottomNavClose" title="'+t.strings.closeTitle+'"><div id="jqlb_closelabel"></div></a></div></div></div>';var y;if(t.navbarOnTop){y='<div id="overlay"></div><div id="lightbox">'+z+x+"</div>";a("body").append(y);a("#imageDataContainer").addClass("ontop");}else{y='<div id="overlay"></div><div id="lightbox">'+x+z+"</div>";a("body").append(y);}a("#overlay").click(function(){l();}).hide();a("#lightbox").click(function(){l();}).hide();a("#loadingLink").click(function(){l();return false;});a("#bottomNavClose").click(function(){l();return false;});a("#outerImageContainer").width(t.widthCurrent).height(t.heightCurrent);a("#imageDataContainer").width(t.widthCurrent);if(!t.imageClickClose){a("#lightboxImage").click(function(){return false;});a("#hoverNav").click(function(){return false;});}}function p(x){if(t.resizeTimeout){clearTimeout(t.resizeTimeout);t.resizeTimeout=false;}t.resizeTimeout=setTimeout(function(){w(false);},15);}function v(){return new Array(a(document).width(),a(document).height(),a(window).width(),a(window).height());}function g(){var y,x;if(self.pageYOffset){x=self.pageYOffset;y=self.pageXOffset;}else{if(document.documentElement&&document.documentElement.scrollTop){x=document.documentElement.scrollTop;y=document.documentElement.scrollLeft;}else{if(document.body){x=document.body.scrollTop;y=document.body.scrollLeft;}}}return new Array(y,x);}function o(B){a("select, embed, object").hide();var z=v();var y=a("#overlay").hide().css({width:z[0]+"px",height:z[1]+"px",opacity:t.overlayOpacity}).fadeIn(400);imageNum=0;if(!t.jsonData){t.imageArray=[];if(!B.rel||(B.rel=="")){var A="";if(B.title){A=B.title;}else{if(a(this).children(":first-child").attr("title")){A=a(this).children(":first-child").attr("title");}}t.imageArray.push(new Array(B.href,t.displayTitle?A:""));}else{a("a").each(function(){if(this.href&&(this.rel==B.rel)){var F="";var D="";var H="";var C=a(this);if(this.title){F=this.title;}else{if(C.children("img:first-child").attr("title")){F=C.children("img:first-child").attr("title");}}if(C.parent().next(".gallery-caption").html()){var G=C.parent().next(".gallery-caption");D=G.html();H=G.text();}else{if(C.next(".wp-caption-text").html()){D=C.next(".wp-caption-text").html();H=C.next(".wp-caption-text").text();}}F=a.trim(F);H=a.trim(H);if(F.toLowerCase()==H.toLowerCase()){F=D;D="";}var E="";if(F!=""&&D!=""){E=F+"<br />"+D;}else{if(F!=""){E=F;}else{if(D!=""){E=D;}}}t.imageArray.push(new Array(this.href,t.displayTitle?E:""));}});}}if(t.imageArray.length>1){for(i=0;i<t.imageArray.length;i++){for(j=t.imageArray.length-1;j>i;j--){if(t.imageArray[i][0]==t.imageArray[j][0]){t.imageArray.splice(j,1);}}}while(t.imageArray[imageNum][0]!=B.href){imageNum++;}}var x=g();m(x[1],x[0]).show();u(imageNum);}function u(x){if(t.inprogress==false){t.inprogress=true;t.activeImage=x;a("#loading").show();a("#lightboxImage").hide();a("#hoverNav").hide();a("#prevLink").hide();a("#nextLink").hide();k();}}function k(){t.imgPreloader=new Image();t.imgPreloader.onload=function(){f();a("#lightboxImage").attr("src",t.imageArray[t.activeImage][0]);w();};t.imgPreloader.src=t.imageArray[t.activeImage][0];}function w(y){if(!t.imgPreloader){return;}if(y==undefined){y=t.animate;}var A=t.imgPreloader.width;var x=t.imgPreloader.height;var B=v();c();var F=B[2]-2*t.borderSize;var G=B[3]-(a("#imageDataContainer").height()+(2*t.borderSize));if(t.fitToScreen){var D=1;if(x>G){D=G/x;}A=A*D;x=x*D;D=1;if(A>F){D=F/A;}A=parseInt(A*D);x=parseInt(x*D);}var C=g();var z=C[1]+(G*0.5);var E=z-x*0.5;a("#lightboxImage").width(A).height(x);n(A,x,E,y);}function n(B,y,C,A){if(A==undefined){A=t.animate;}t.widthCurrent=a("#outerImageContainer").outerWidth();t.heightCurrent=a("#outerImageContainer").outerHeight();var x=Math.max(350,B+(t.borderSize*2));var z=(y+(t.borderSize*2));t.xScale=(x/t.widthCurrent)*100;t.yScale=(z/t.heightCurrent)*100;wDiff=t.widthCurrent-x;hDiff=t.heightCurrent-z;m(C,null,A);if(A&&(hDiff!=0&&wDiff!=0)){a("#imageDataContainer").animate({width:x},t.resizeSpeed,"linear");a("#outerImageContainer").animate({width:x},t.resizeSpeed,"linear",function(){a("#outerImageContainer").animate({height:z},t.resizeSpeed,"linear",function(){d();});});}else{a("#imageDataContainer").width(x);a("#outerImageContainer").width(x);a("#outerImageContainer").height(z);d();}a("#prevLink").height(y);a("#nextLink").height(y);}function m(A,z,y){if(y==undefined){y=t.animate;}if(z==undefined||z==null){var x=g();z=x[0];}if(y){a("#lightbox").animate({top:A},250,"linear");return a("#lightbox").animate({left:z},250,"linear");}return a("#lightbox").css({top:A+"px",left:z+"px"});}function l(){q();a("#lightbox").hide();a("#overlay").fadeOut();a("select, object, embed").show();}function f(){if(t.loopImages&&t.imageArray.length>1){preloadNextImage=new Image();preloadNextImage.src=t.imageArray[(t.activeImage==(t.imageArray.length-1))?0:t.activeImage+1][0];preloadPrevImage=new Image();preloadPrevImage.src=t.imageArray[(t.activeImage==0)?(t.imageArray.length-1):t.activeImage-1][0];}else{if((t.imageArray.length-1)>t.activeImage){preloadNextImage=new Image();preloadNextImage.src=t.imageArray[t.activeImage+1][0];}if(t.activeImage>0){preloadPrevImage=new Image();preloadPrevImage.src=t.imageArray[t.activeImage-1][0];}}}function d(){a("#imageData").show();a("#caption").show();a("#loading").hide();if(t.animate){a("#lightboxImage").fadeIn("fast");}else{a("#lightboxImage").show();}t.inprogress=false;var x=v();a("#overlay").css({width:x[0]+"px",height:x[1]+"px"});r();}function c(){a("#numberDisplay").html("");a("#caption").html("").hide();if(t.imageArray[t.activeImage][1]){a("#caption").html(t.imageArray[t.activeImage][1]).show();}if(t.imageArray.length>1){var x;x=t.strings.image+(t.activeImage+1)+t.strings.of+t.imageArray.length;if(t.displayDownloadLink){x+='<a href="'+t.imageArray[t.activeImage][0]+'" id="downloadLink">'+t.strings.download+"</a>";}if(!t.disableNavbarLinks){if((t.activeImage)>0||t.loopImages){x='<a title="'+t.strings.prevLinkTitle+'" href="#" id="prevLinkText">'+t.strings.prevLinkText+"</a>"+x;}if(((t.activeImage+1)<t.imageArray.length)||t.loopImages){x+='<a title="'+t.strings.nextLinkTitle+'" href="#" id="nextLinkText">'+t.strings.nextLinkText+"</a>";}}a("#numberDisplay").html(x).show();}a("#imageData").show();r();}function r(){if(t.imageArray.length>1){a("#hoverNav").show();if(t.loopImages){a("#prevLink,#prevLinkText").show().click(function(){u((t.activeImage==0)?(t.imageArray.length-1):t.activeImage-1);return false;});a("#nextLink,#nextLinkText").show().click(function(){u((t.activeImage==(t.imageArray.length-1))?0:t.activeImage+1);return false;});}else{if(t.activeImage!=0){a("#prevLink,#prevLinkText").show().click(function(){u(t.activeImage-1);return false;});}if(t.activeImage!=(t.imageArray.length-1)){a("#nextLink,#nextLinkText").show().click(function(){u(t.activeImage+1);return false;});}}b();}}function s(A){var B=A.data.opts;var x=A.keyCode;var y=27;var z=String.fromCharCode(x).toLowerCase();if((z=="x")||(z=="o")||(z=="c")||(x==y)){l();}else{if((z=="p")||(x==37)){if(B.loopImages){q();u((B.activeImage==0)?(B.imageArray.length-1):B.activeImage-1);}else{if(B.activeImage!=0){q();u(B.activeImage-1);}}}else{if((z=="n")||(x==39)){if(t.loopImages){q();u((B.activeImage==(B.imageArray.length-1))?0:B.activeImage+1);}else{if(B.activeImage!=(B.imageArray.length-1)){q();u(B.activeImage+1);}}}}}}function b(){a(document).bind("keydown",{opts:t},s);}function q(){a(document).unbind("keydown");}};a.fn.lightbox.parseJsonData=function(c){var b=[];a.each(c,function(){b.push(new Array(this.url,this.title));});return b;};a.fn.lightbox.defaults={overlayOpacity:0.8,borderSize:10,imageArray:new Array,activeImage:null,inprogress:false,resizeSpeed:250,widthCurrent:250,heightCurrent:250,xScale:1,yScale:1,displayTitle:true,navbarOnTop:false,displayHelp:false,displayDownloadLink:true,strings:{help:" \u2190 / P - previous image\u00a0\u00a0\u00a0\u00a0\u2192 / N - next image\u00a0\u00a0\u00a0\u00a0ESC / X - close image gallery",prevLinkTitle:"previous image",nextLinkTitle:"next image",prevLinkText:"« Previous",nextLinkText:"Next »",closeTitle:"close image gallery",image:"Image ",of:" of ",download:"Download"},fitToScreen:true,disableNavbarLinks:true,loopImages:true,imageClickClose:true,jsonData:null,jsonDataParser:null,animate:true,followScroll:false};})(jQuery);jQuery(document).ready(function(){if(typeof JQLBSettings=="object"&&JQLBSettings.resizeSpeed){JQLBSettings.resizeSpeed=parseInt(JQLBSettings.resizeSpeed);}jQuery('a[rel^="lightbox"]').lightbox({fitToScreen:(typeof JQLBSettings=="object"&&JQLBSettings.fitToScreen=="1")?true:false,resizeSpeed:(typeof JQLBSettings=="object"&&JQLBSettings.resizeSpeed>=0)?JQLBSettings.resizeSpeed:250,animate:(typeof JQLBSettings=="object"&&JQLBSettings.resizeSpeed==0)?false:true,displayDownloadLink:(typeof JQLBSettings=="object"&&JQLBSettings.displayDownloadLink=="0")?false:true,strings:JQLBSettings});});
|
languages/howtouse-en_US.html
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<h2>How to Use:</h2>
|
2 |
+
<ol>
|
3 |
+
<li>You can use WordPress image galleries and have them grouped and auto-lightboxed: <a href="http://codex.wordpress.org/Gallery_Shortcode"><code>[gallery link="file"]</code></a></li>
|
4 |
+
<li>You can also add a <code>rel="lightbox"</code> attribute to any link tag to activate the lightbox. For example:
|
5 |
+
<pre><code> <a href="images/image-1.jpg" rel="lightbox" title="my caption">image #1</a></code></pre>
|
6 |
+
<em>Optional:</em> Use the <code>title</code> attribute if you want to show a caption.
|
7 |
+
</li>
|
8 |
+
<li>If you have a set of related images that you would like to group, simply include a group name in the rel attribute. For example:
|
9 |
+
<pre><code> <a href="images/image-1.jpg" rel="lightbox[roadtrip]">image #1</a>
|
10 |
+
<a href="images/image-2.jpg" rel="lightbox[roadtrip]">image #2</a>
|
11 |
+
<a href="images/image-3.jpg" rel="lightbox[roadtrip]">image #3</a></code></pre>
|
12 |
+
No limits to the number of image sets per page or how many images are allowed in each set. Go nuts!</li>
|
13 |
+
</ol>
|
14 |
+
<h2>For developers:</h2>
|
15 |
+
<ol>
|
16 |
+
<li>Always have <code>wp_footer();</code> just before the closing </body> tag of your theme, or you will break many plugins, which generally use this hook to reference JavaScript files</li>
|
17 |
+
<li>Apply lightbox to any content by running <code>jqlb_apply_lightbox($your_content, "any ID");</code> It returns a string with all image links lightboxed, grouped by "any id"</li>
|
18 |
+
</ol>
|
19 |
+
<h2>Credits</h2><ul style="list-style-type: circle;margin-left: 24px;">
|
20 |
+
<li>wp-jquery-lightbox was created by <a href="http://www.ulfben.com">Ulf Benjaminsson</a> (who <a href="http://amzn.com/w/2QB6SQ5XX2U0N">appreciates books</a>). :)</li>
|
21 |
+
<li>wp-jquery-lightbox borrowed the regexp from <a href="http://stimuli.ca/lightbox/">LightBox-2 by Rupert Morris</a> to apply lightbox-rel without clobbering manual inputs.</li>
|
22 |
+
<li>wp-jquery-lightbox uses a modified (see below) <a href="http://github.com/krewenki/jquery-lightbox/">jQuery Lightbox</a> by <a href="http://warren.mesozen.com/jquery-lightbox/">Warren Krewenki</a></li>
|
23 |
+
<li><a href="http://github.com/krewenki/jquery-lightbox/">jQuery Lightbox</a> is based on <a href="http://www.huddletogether.com/projects/lightbox2/">Lightbox 2 by Lokesh Dhakar</a></li>
|
24 |
+
<li>Translation support (and german language files) added by <a href="http://sukimashita.com/">Martin S</a></li>
|
25 |
+
<li>Translation for admin pages (and Russian and Czech languages) added by Denis N. Voituk</li>
|
26 |
+
</ul>
|
27 |
+
|
28 |
+
<h2>Changes to Lightbox-script:</h2><p style="margin-left: 24px;">
|
29 |
+
Resizing code manages <strong>both</strong> height and width and never destroy aspect ratio.<br />
|
30 |
+
Scaling routines now maximize images fully while taking captions into account.<br />
|
31 |
+
Added support for browser resizing and orientation changes - allowing images to <em>remain</em> optimally scaled and centered.<br />
|
32 |
+
WP jQuery Lightbox rely on <code>rel="lightbox"</code> instead of <code>class="lightbox"</code>, since rel is what all the previous *box-scripts used.<br />
|
33 |
+
Replaced explicit IMG-urls with divs styled through the CSS. (see: <code>jqlb_loading</code> and <code>jqlb_closelabel</code> divs).<br />
|
34 |
+
Can grab titles and captions from the WordPress Media Gallery-output (<a href="http://codex.wordpress.org/Gallery_Shortcode">[gallery]</a>, "insert attachments" etc).<br />
|
35 |
+
Grabs image title if the link lacks one<br />
|
36 |
+
Honors empty titles.<br />
|
37 |
+
Can disable all animation effects (set speed to 0).<br />
|
38 |
+
Uses WordPress API to localize script (with safe fallbacks).<br />
|
39 |
+
</p>
|
40 |
+
|
languages/howtouse.html
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<h2>How to Use:</h2>
|
2 |
+
<ol>
|
3 |
+
<li>You can use WordPress image galleries and have them grouped and auto-lightboxed: <a href="http://codex.wordpress.org/Gallery_Shortcode"><code>[gallery link="file"]</code></a></li>
|
4 |
+
<li>You can also add a <code>rel="lightbox"</code> attribute to any link tag to activate the lightbox. For example:
|
5 |
+
<pre><code> <a href="images/image-1.jpg" rel="lightbox" title="my caption">image #1</a></code></pre>
|
6 |
+
<em>Optional:</em> Use the <code>title</code> attribute if you want to show a caption.
|
7 |
+
</li>
|
8 |
+
<li>If you have a set of related images that you would like to group, simply include a group name in the rel attribute. For example:
|
9 |
+
<pre><code> <a href="images/image-1.jpg" rel="lightbox[roadtrip]">image #1</a>
|
10 |
+
<a href="images/image-2.jpg" rel="lightbox[roadtrip]">image #2</a>
|
11 |
+
<a href="images/image-3.jpg" rel="lightbox[roadtrip]">image #3</a></code></pre>
|
12 |
+
No limits to the number of image sets per page or how many images are allowed in each set. Go nuts!</li>
|
13 |
+
</ol>
|
14 |
+
<h2>For developers:</h2>
|
15 |
+
<ol>
|
16 |
+
<li>Always have <code>wp_footer();</code> just before the closing </body> tag of your theme, or you will break many plugins, which generally use this hook to reference JavaScript files</li>
|
17 |
+
<li>Apply lightbox to any content by running <code>jqlb_apply_lightbox($your_content, "any ID");</code> It returns a string with all image links lightboxed, grouped by "any id"</li>
|
18 |
+
</ol>
|
19 |
+
<h2>Credits</h2><ul style="list-style-type: circle;margin-left: 24px;">
|
20 |
+
<li>wp-jquery-lightbox was created by <a href="http://www.ulfben.com">Ulf Benjaminsson</a> (who <a href="http://amzn.com/w/2QB6SQ5XX2U0N">appreciates books</a>). :)</li>
|
21 |
+
<li>wp-jquery-lightbox borrowed the regexp from <a href="http://stimuli.ca/lightbox/">LightBox-2 by Rupert Morris</a> to apply lightbox-rel without clobbering manual inputs.</li>
|
22 |
+
<li>wp-jquery-lightbox uses a modified (see below) <a href="http://github.com/krewenki/jquery-lightbox/">jQuery Lightbox</a> by <a href="http://warren.mesozen.com/jquery-lightbox/">Warren Krewenki</a></li>
|
23 |
+
<li><a href="http://github.com/krewenki/jquery-lightbox/">jQuery Lightbox</a> is based on <a href="http://www.huddletogether.com/projects/lightbox2/">Lightbox 2 by Lokesh Dhakar</a></li>
|
24 |
+
<li>Translation support (and german language files) added by <a href="http://sukimashita.com/">Martin S</a></li>
|
25 |
+
<li>Translation for admin pages (and Russian and Czech languages) added by Denis N. Voituk</li>
|
26 |
+
</ul>
|
27 |
+
|
28 |
+
<h2>Changes to Lightbox-script:</h2><p style="margin-left: 24px;">
|
29 |
+
Resizing code manages <strong>both</strong> height and width and never destroy aspect ratio.<br />
|
30 |
+
Scaling routines now maximize images fully while taking captions into account.<br />
|
31 |
+
Added support for browser resizing and orientation changes - allowing images to <em>remain</em> optimally scaled and centered.<br />
|
32 |
+
WP jQuery Lightbox rely on <code>rel="lightbox"</code> instead of <code>class="lightbox"</code>, since rel is what all the previous *box-scripts used.<br />
|
33 |
+
Replaced explicit IMG-urls with divs styled through the CSS. (see: <code>jqlb_loading</code> and <code>jqlb_closelabel</code> divs).<br />
|
34 |
+
Can grab titles and captions from the WordPress Media Gallery-output (<a href="http://codex.wordpress.org/Gallery_Shortcode">[gallery]</a>, "insert attachments" etc).<br />
|
35 |
+
Grabs image title if the link lacks one<br />
|
36 |
+
Honors empty titles.<br />
|
37 |
+
Can disable all animation effects (set speed to 0).<br />
|
38 |
+
Uses WordPress API to localize script (with safe fallbacks).<br />
|
39 |
+
</p>
|
40 |
+
|
languages/jqlb-cs_CZ.mo
ADDED
Binary file
|
languages/jqlb-cs_CZ.po
ADDED
@@ -0,0 +1,102 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
msgid ""
|
2 |
+
msgstr ""
|
3 |
+
"Project-Id-Version: WP JQuery Lightbox\n"
|
4 |
+
"Report-Msgid-Bugs-To: \n"
|
5 |
+
"POT-Creation-Date: 2011-02-20 15:12+0100\n"
|
6 |
+
"PO-Revision-Date: 2011-02-20 16:51+0100\n"
|
7 |
+
"Last-Translator: ArtPrima.cz <ask@artprima.cz>\n"
|
8 |
+
"Language-Team: ArtPrima.cz <ask@artprima.cz>\n"
|
9 |
+
"MIME-Version: 1.0\n"
|
10 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
+
"Content-Transfer-Encoding: 8bit\n"
|
12 |
+
"X-Poedit-KeywordsList: __;_e;_c;__ngettext:1,2\n"
|
13 |
+
"X-Poedit-Basepath: .\n"
|
14 |
+
"X-Poedit-Language: Czech\n"
|
15 |
+
"X-Poedit-Country: CZECH REPUBLIC\n"
|
16 |
+
"X-Poedit-SourceCharset: utf-8\n"
|
17 |
+
"Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2\n"
|
18 |
+
"X-Poedit-SearchPath-0: C:\\_work\\svn\\artprima\\trunk\\wp-content\\plugins\\wp-jquery-lightbox\n"
|
19 |
+
|
20 |
+
#: C:\_work\svn\artprima\trunk\wp-content\plugins\wp-jquery-lightbox/wp-jquery-lightbox.php:44
|
21 |
+
msgid "Settings"
|
22 |
+
msgstr "Nastavení"
|
23 |
+
|
24 |
+
#: C:\_work\svn\artprima\trunk\wp-content\plugins\wp-jquery-lightbox/wp-jquery-lightbox.php:80
|
25 |
+
#: C:\_work\svn\artprima\trunk\wp-content\plugins\wp-jquery-lightbox/wp-jquery-lightbox.php:81
|
26 |
+
msgid "previous image"
|
27 |
+
msgstr "předchozí obrázek"
|
28 |
+
|
29 |
+
#: C:\_work\svn\artprima\trunk\wp-content\plugins\wp-jquery-lightbox/wp-jquery-lightbox.php:80
|
30 |
+
#: C:\_work\svn\artprima\trunk\wp-content\plugins\wp-jquery-lightbox/wp-jquery-lightbox.php:82
|
31 |
+
msgid "next image"
|
32 |
+
msgstr "další obrázek"
|
33 |
+
|
34 |
+
#: C:\_work\svn\artprima\trunk\wp-content\plugins\wp-jquery-lightbox/wp-jquery-lightbox.php:80
|
35 |
+
#: C:\_work\svn\artprima\trunk\wp-content\plugins\wp-jquery-lightbox/wp-jquery-lightbox.php:85
|
36 |
+
msgid "close image gallery"
|
37 |
+
msgstr "zavřít galerii"
|
38 |
+
|
39 |
+
#: C:\_work\svn\artprima\trunk\wp-content\plugins\wp-jquery-lightbox/wp-jquery-lightbox.php:83
|
40 |
+
msgid "« Previous"
|
41 |
+
msgstr "« Předchozí"
|
42 |
+
|
43 |
+
#: C:\_work\svn\artprima\trunk\wp-content\plugins\wp-jquery-lightbox/wp-jquery-lightbox.php:84
|
44 |
+
msgid "Next »"
|
45 |
+
msgstr "Další »"
|
46 |
+
|
47 |
+
#: C:\_work\svn\artprima\trunk\wp-content\plugins\wp-jquery-lightbox/wp-jquery-lightbox.php:86
|
48 |
+
msgid "Image "
|
49 |
+
msgstr "Obrázek "
|
50 |
+
|
51 |
+
#: C:\_work\svn\artprima\trunk\wp-content\plugins\wp-jquery-lightbox/wp-jquery-lightbox.php:87
|
52 |
+
msgid " of "
|
53 |
+
msgstr " z "
|
54 |
+
|
55 |
+
#: C:\_work\svn\artprima\trunk\wp-content\plugins\wp-jquery-lightbox/wp-jquery-lightbox.php:107
|
56 |
+
msgid "Cheatin’ uh?"
|
57 |
+
msgstr "Nepodvádíte?"
|
58 |
+
|
59 |
+
#: C:\_work\svn\artprima\trunk\wp-content\plugins\wp-jquery-lightbox/wp-jquery-lightbox.php:117
|
60 |
+
msgid "Auto-lightbox image links"
|
61 |
+
msgstr "Používat lightbox automaticky"
|
62 |
+
|
63 |
+
#: C:\_work\svn\artprima\trunk\wp-content\plugins\wp-jquery-lightbox/wp-jquery-lightbox.php:121
|
64 |
+
msgid "Let the plugin add necessary html to image links"
|
65 |
+
msgstr "Dovolit pluginu přidat potřebný html do obrázkových odkazů"
|
66 |
+
|
67 |
+
#: C:\_work\svn\artprima\trunk\wp-content\plugins\wp-jquery-lightbox/wp-jquery-lightbox.php:125
|
68 |
+
msgid "Shrink large images to fit smaller screens"
|
69 |
+
msgstr "Zmenšit velké obrázky, aby se vešly na obrazovku"
|
70 |
+
|
71 |
+
#: C:\_work\svn\artprima\trunk\wp-content\plugins\wp-jquery-lightbox/wp-jquery-lightbox.php:129
|
72 |
+
msgid "Note: <u>Excessively large images</u> waste bandwidth!"
|
73 |
+
msgstr "Poznámka: <u>Příliš velké obrázky</u> plýtvají šířkou pásma!"
|
74 |
+
|
75 |
+
#: C:\_work\svn\artprima\trunk\wp-content\plugins\wp-jquery-lightbox/wp-jquery-lightbox.php:133
|
76 |
+
msgid "Animation speed (in milliseconds)"
|
77 |
+
msgstr "Rychlost animace (v milisekundách)"
|
78 |
+
|
79 |
+
#: C:\_work\svn\artprima\trunk\wp-content\plugins\wp-jquery-lightbox/wp-jquery-lightbox.php:140
|
80 |
+
msgid "Save Changes"
|
81 |
+
msgstr "Uložit změny"
|
82 |
+
|
83 |
+
#~ msgid "(more...)"
|
84 |
+
#~ msgstr "(dále...)"
|
85 |
+
|
86 |
+
#~ msgid "Contacts"
|
87 |
+
#~ msgstr "Kontakty"
|
88 |
+
|
89 |
+
#~ msgid "Contact Us"
|
90 |
+
#~ msgstr "Kontaktujte nás"
|
91 |
+
|
92 |
+
#~ msgid "Read more..."
|
93 |
+
#~ msgstr "Číst dále..."
|
94 |
+
|
95 |
+
#~ msgid "Contact Us..."
|
96 |
+
#~ msgstr "Kontaktujte nás..."
|
97 |
+
|
98 |
+
#~ msgid "Order..."
|
99 |
+
#~ msgstr "Objednat..."
|
100 |
+
|
101 |
+
#~ msgid "Search..."
|
102 |
+
#~ msgstr "Hledat..."
|
languages/jqlb-de_DE.mo
ADDED
Binary file
|
languages/jqlb-ru_RU.mo
ADDED
Binary file
|
languages/jqlb-ru_RU.po
ADDED
@@ -0,0 +1,102 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
msgid ""
|
2 |
+
msgstr ""
|
3 |
+
"Project-Id-Version: WP JQuery Lightbox\n"
|
4 |
+
"Report-Msgid-Bugs-To: \n"
|
5 |
+
"POT-Creation-Date: 2011-02-20 15:05+0100\n"
|
6 |
+
"PO-Revision-Date: 2011-02-20 15:10+0100\n"
|
7 |
+
"Last-Translator: ArtPrima.cz <ask@artprima.cz>\n"
|
8 |
+
"Language-Team: ArtPrima.cz <ask@artprima.cz>\n"
|
9 |
+
"MIME-Version: 1.0\n"
|
10 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
+
"Content-Transfer-Encoding: 8bit\n"
|
12 |
+
"X-Poedit-KeywordsList: __;_e;_c;__ngettext:1,2\n"
|
13 |
+
"X-Poedit-Basepath: .\n"
|
14 |
+
"X-Poedit-Language: Russian\n"
|
15 |
+
"X-Poedit-Country: RUSSIAN FEDERATION\n"
|
16 |
+
"X-Poedit-SourceCharset: utf-8\n"
|
17 |
+
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2)\n"
|
18 |
+
"X-Poedit-SearchPath-0: C:\\_work\\svn\\artprima\\trunk\\wp-content\\plugins\\wp-jquery-lightbox\n"
|
19 |
+
|
20 |
+
#: C:\_work\svn\artprima\trunk\wp-content\plugins\wp-jquery-lightbox/wp-jquery-lightbox.php:44
|
21 |
+
msgid "Settings"
|
22 |
+
msgstr "Настройки"
|
23 |
+
|
24 |
+
#: C:\_work\svn\artprima\trunk\wp-content\plugins\wp-jquery-lightbox/wp-jquery-lightbox.php:80
|
25 |
+
#: C:\_work\svn\artprima\trunk\wp-content\plugins\wp-jquery-lightbox/wp-jquery-lightbox.php:81
|
26 |
+
msgid "previous image"
|
27 |
+
msgstr "предыдущее изображение"
|
28 |
+
|
29 |
+
#: C:\_work\svn\artprima\trunk\wp-content\plugins\wp-jquery-lightbox/wp-jquery-lightbox.php:80
|
30 |
+
#: C:\_work\svn\artprima\trunk\wp-content\plugins\wp-jquery-lightbox/wp-jquery-lightbox.php:82
|
31 |
+
msgid "next image"
|
32 |
+
msgstr "следующее изображение"
|
33 |
+
|
34 |
+
#: C:\_work\svn\artprima\trunk\wp-content\plugins\wp-jquery-lightbox/wp-jquery-lightbox.php:80
|
35 |
+
#: C:\_work\svn\artprima\trunk\wp-content\plugins\wp-jquery-lightbox/wp-jquery-lightbox.php:85
|
36 |
+
msgid "close image gallery"
|
37 |
+
msgstr "закрыть галерею"
|
38 |
+
|
39 |
+
#: C:\_work\svn\artprima\trunk\wp-content\plugins\wp-jquery-lightbox/wp-jquery-lightbox.php:83
|
40 |
+
msgid "« Previous"
|
41 |
+
msgstr "« Предыдущее"
|
42 |
+
|
43 |
+
#: C:\_work\svn\artprima\trunk\wp-content\plugins\wp-jquery-lightbox/wp-jquery-lightbox.php:84
|
44 |
+
msgid "Next »"
|
45 |
+
msgstr "Следующее »"
|
46 |
+
|
47 |
+
#: C:\_work\svn\artprima\trunk\wp-content\plugins\wp-jquery-lightbox/wp-jquery-lightbox.php:86
|
48 |
+
msgid "Image "
|
49 |
+
msgstr "Изображение "
|
50 |
+
|
51 |
+
#: C:\_work\svn\artprima\trunk\wp-content\plugins\wp-jquery-lightbox/wp-jquery-lightbox.php:87
|
52 |
+
msgid " of "
|
53 |
+
msgstr " из "
|
54 |
+
|
55 |
+
#: C:\_work\svn\artprima\trunk\wp-content\plugins\wp-jquery-lightbox/wp-jquery-lightbox.php:107
|
56 |
+
msgid "Cheatin’ uh?"
|
57 |
+
msgstr "Жульничаем?"
|
58 |
+
|
59 |
+
#: C:\_work\svn\artprima\trunk\wp-content\plugins\wp-jquery-lightbox/wp-jquery-lightbox.php:117
|
60 |
+
msgid "Auto-lightbox image links"
|
61 |
+
msgstr "Использовать lightbox автоматически"
|
62 |
+
|
63 |
+
#: C:\_work\svn\artprima\trunk\wp-content\plugins\wp-jquery-lightbox/wp-jquery-lightbox.php:121
|
64 |
+
msgid "Let the plugin add necessary html to image links"
|
65 |
+
msgstr "Позволить плагину добавлять необходимый html к ссылкам на изображения"
|
66 |
+
|
67 |
+
#: C:\_work\svn\artprima\trunk\wp-content\plugins\wp-jquery-lightbox/wp-jquery-lightbox.php:125
|
68 |
+
msgid "Shrink large images to fit smaller screens"
|
69 |
+
msgstr "Подгонять размер изображения под экран"
|
70 |
+
|
71 |
+
#: C:\_work\svn\artprima\trunk\wp-content\plugins\wp-jquery-lightbox/wp-jquery-lightbox.php:129
|
72 |
+
msgid "Note: <u>Excessively large images</u> waste bandwidth!"
|
73 |
+
msgstr "Внимание: <u>Слишком большие изображения</u> впустую забивают канал!"
|
74 |
+
|
75 |
+
#: C:\_work\svn\artprima\trunk\wp-content\plugins\wp-jquery-lightbox/wp-jquery-lightbox.php:133
|
76 |
+
msgid "Animation speed (in milliseconds)"
|
77 |
+
msgstr "Скорость анимации (в милисекундах)"
|
78 |
+
|
79 |
+
#: C:\_work\svn\artprima\trunk\wp-content\plugins\wp-jquery-lightbox/wp-jquery-lightbox.php:140
|
80 |
+
msgid "Save Changes"
|
81 |
+
msgstr "Сохранить изменения"
|
82 |
+
|
83 |
+
#~ msgid "(more...)"
|
84 |
+
#~ msgstr "(далее...)"
|
85 |
+
|
86 |
+
#~ msgid "Contacts"
|
87 |
+
#~ msgstr "Контакты"
|
88 |
+
|
89 |
+
#~ msgid "Contact Us"
|
90 |
+
#~ msgstr "Связаться с нами"
|
91 |
+
|
92 |
+
#~ msgid "Read more..."
|
93 |
+
#~ msgstr "Читать далее..."
|
94 |
+
|
95 |
+
#~ msgid "Contact Us..."
|
96 |
+
#~ msgstr "Связаться с нами..."
|
97 |
+
|
98 |
+
#~ msgid "Order..."
|
99 |
+
#~ msgstr "Заказать..."
|
100 |
+
|
101 |
+
#~ msgid "Search..."
|
102 |
+
#~ msgstr "Поиск..."
|
lightbox.css
CHANGED
@@ -19,7 +19,7 @@
|
|
19 |
background-repeat:no-repeat;
|
20 |
background-position:center center;
|
21 |
}
|
22 |
-
|
23 |
#lightbox a img{ border: none; }
|
24 |
|
25 |
#outerImageContainer{
|
@@ -77,6 +77,9 @@ padding-left: 20px;
|
|
77 |
#prevLinkText{
|
78 |
padding-right: 20px;
|
79 |
}
|
|
|
|
|
|
|
80 |
/*** END : next / previous text links ***/
|
81 |
/*** START : added padding when navbar is on top ***/
|
82 |
|
19 |
background-repeat:no-repeat;
|
20 |
background-position:center center;
|
21 |
}
|
22 |
+
|
23 |
#lightbox a img{ border: none; }
|
24 |
|
25 |
#outerImageContainer{
|
77 |
#prevLinkText{
|
78 |
padding-right: 20px;
|
79 |
}
|
80 |
+
#downloadLink{
|
81 |
+
margin-left: 10px;
|
82 |
+
}
|
83 |
/*** END : next / previous text links ***/
|
84 |
/*** START : added padding when navbar is on top ***/
|
85 |
|
lightbox.min.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
#lightbox{position:absolute;left:0;width:100%;z-index:100;text-align:center;line-height:0}#jqlb_loading{height:32px;background-image:url('./images/loading.gif');background-repeat:no-repeat;background-position:center center}#jqlb_closelabel{height:22px;background-image:url('./images/closelabel.gif');background-repeat:no-repeat;background-position:center center}#lightbox a img{border:none}#outerImageContainer{position:relative;background-color:#fff;width:250px;height:250px;margin:0 auto}#imageContainer{padding:10px}#loading{position:absolute;top:40%;left:0;height:25%;width:100%;text-align:center;line-height:0}#hoverNav{position:absolute;top:0;left:0;height:100%;width:100%;z-index:10}#imageContainer>#hoverNav{left:0}#hoverNav a{outline:none}#prevLink,#nextLink{width:49%;height:100%;background:transparent url('./images/blank.gif') no-repeat;display:block}#prevLink{left:0;float:left}#nextLink{right:0;float:right}#prevLink:hover,#prevLink:visited:hover{background:url('./images/prev.gif') left 50% no-repeat}#nextLink:hover,#nextLink:visited:hover{background:url('./images/next.gif') right 50% no-repeat}#nextLinkText,#prevLinkText{color:#ff9834;font-weight:bold;text-decoration:none}#nextLinkText{padding-left:20px}#prevLinkText{padding-right:20px}.ontop #imageData{padding-top:5px}#imageDataContainer{font:10px Verdana,Helvetica,sans-serif;background-color:#fff;margin:0 auto;line-height:1.4em}#imageData{padding:0 10px}#imageData #imageDetails{width:70%;float:left;text-align:left}#imageData #caption{font-weight:bold}#imageData #numberDisplay{display:block;clear:left;padding-bottom:1.0em}#imageData #bottomNavClose{width:66px;float:right;padding-bottom:.7em}#imageData #helpDisplay{clear:left;float:left;display:block}#overlay{position:absolute;top:0;left:0;z-index:90;width:100%;height:500px;background-color:#000;filter:alpha(opacity=60);-moz-opacity:.6;opacity:.6;display:none}.clearfix:after{content:".";display:block;height:0;clear:both;visibility:hidden}* html>body .clearfix{display:inline-block;width:100%}* html .clearfix{/*\*/height:1%;/**/}#lightboxIframe{display:none}
|
1 |
+
#lightbox{position:absolute;left:0;width:100%;z-index:100;text-align:center;line-height:0}#jqlb_loading{height:32px;background-image:url('./images/loading.gif');background-repeat:no-repeat;background-position:center center}#jqlb_closelabel{height:22px;background-image:url('./images/closelabel.gif');background-repeat:no-repeat;background-position:center center}#lightbox a img{border:none}#outerImageContainer{position:relative;background-color:#fff;width:250px;height:250px;margin:0 auto}#imageContainer{padding:10px}#loading{position:absolute;top:40%;left:0;height:25%;width:100%;text-align:center;line-height:0}#hoverNav{position:absolute;top:0;left:0;height:100%;width:100%;z-index:10}#imageContainer>#hoverNav{left:0}#hoverNav a{outline:none}#prevLink,#nextLink{width:49%;height:100%;background:transparent url('./images/blank.gif') no-repeat;display:block}#prevLink{left:0;float:left}#nextLink{right:0;float:right}#prevLink:hover,#prevLink:visited:hover{background:url('./images/prev.gif') left 50% no-repeat}#nextLink:hover,#nextLink:visited:hover{background:url('./images/next.gif') right 50% no-repeat}#nextLinkText,#prevLinkText{color:#ff9834;font-weight:bold;text-decoration:none}#nextLinkText{padding-left:20px}#prevLinkText{padding-right:20px}#downloadLink{margin-left:10px}.ontop #imageData{padding-top:5px}#imageDataContainer{font:10px Verdana,Helvetica,sans-serif;background-color:#fff;margin:0 auto;line-height:1.4em}#imageData{padding:0 10px}#imageData #imageDetails{width:70%;float:left;text-align:left}#imageData #caption{font-weight:bold}#imageData #numberDisplay{display:block;clear:left;padding-bottom:1.0em}#imageData #bottomNavClose{width:66px;float:right;padding-bottom:.7em}#imageData #helpDisplay{clear:left;float:left;display:block}#overlay{position:absolute;top:0;left:0;z-index:90;width:100%;height:500px;background-color:#000;filter:alpha(opacity=60);-moz-opacity:.6;opacity:.6;display:none}.clearfix:after{content:".";display:block;height:0;clear:both;visibility:hidden}* html>body .clearfix{display:inline-block;width:100%}* html .clearfix{/*\*/height:1%;/**/}#lightboxIframe{display:none}
|
readme.txt
CHANGED
@@ -3,36 +3,38 @@ Contributors: ulfben
|
|
3 |
Donate link: http://amzn.com/w/2QB6SQ5XX2U0N
|
4 |
Tags: lightbox, jquery, nodal, image, display, ulfben
|
5 |
Requires at least: 2.9.2
|
6 |
-
Tested up to: 3.1.
|
7 |
-
Stable tag: 1.
|
8 |
|
9 |
-
A drop-in replacement for Lightbox 2 and similar plugins, shedding the bulk of Prototype and Scriptaculous.
|
10 |
|
11 |
== Description ==
|
12 |
|
13 |
This plugin lets you keep [the awesome Lightbox 2](http://www.huddletogether.com/projects/lightbox2/)-functionality, but sheds the bulk of the Prototype Framework **and** Scriptaculous Effects Library.
|
14 |
|
15 |
-
Warren Krewenki [ported Lightbox
|
16 |
-
It provides an admin panel for configuration, (optional) auto-boxing of your image links and support for WordPress galleries, *including* [media library](http://codex.wordpress.org/Media_Library_SubPanel) titles and captions.
|
17 |
|
18 |
-
|
|
|
|
|
|
|
|
|
|
|
19 |
|
20 |
See the plugin in action here: [http://game.hgo.se/blog/motion-capture/](http://game.hgo.se/blog/motion-capture/)
|
21 |
|
22 |
-
|
23 |
|
24 |
-
|
25 |
-
* Use WordPress bundled jQuery instead of forcing the Google CDN.
|
26 |
-
* Fixed the settings link on the Plugins page.
|
27 |
|
28 |
-
= 1.
|
29 |
-
*
|
30 |
-
*
|
31 |
-
|
32 |
-
|
33 |
-
* Added support for
|
34 |
-
*
|
35 |
-
*
|
36 |
|
37 |
[Older changelogs moved here.](http://wordpress.org/extend/plugins/wp-jquery-lightbox/changelog/)
|
38 |
|
@@ -41,13 +43,16 @@ See the plugin in action here: [http://game.hgo.se/blog/motion-capture/](http://
|
|
41 |
1. Upload the `wp-jquery-lightbox`-folder to the `/wp-content/plugins/` directory
|
42 |
1. Activate the plugin through the 'Plugins' menu in WordPress
|
43 |
1. Check out the jQuery Lightbox-panel in your admin interface for usage details and configuration.
|
|
|
44 |
|
45 |
= How to Use: =
|
46 |
-
1.
|
47 |
-
1.
|
48 |
|
49 |
`<a href="image-1.jpg" rel="lightbox" title="my caption">image #1</a>`
|
50 |
-
|
|
|
|
|
51 |
1. If you have a set of related images that you would like to group, follow step one but additionally include a group name in the rel attribute. For example:
|
52 |
|
53 |
`<a href="image-1.jpg" rel="lightbox[roadtrip]">image #1</a>`
|
@@ -56,14 +61,25 @@ See the plugin in action here: [http://game.hgo.se/blog/motion-capture/](http://
|
|
56 |
|
57 |
`<a href="image-3.jpg" rel="lightbox[roadtrip]">image #3</a>`
|
58 |
|
59 |
-
|
60 |
|
61 |
-
You can navigate the images with your keyboard: Arrows, P(revious)/N(ext) and X/C/ESC for close.
|
62 |
|
63 |
-
|
|
|
|
|
64 |
|
65 |
== Changelog ==
|
66 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
67 |
= 1.2.2 (2011-04-14) =
|
68 |
* Use WordPress bundled jQuery instead of forcing the Google CDN
|
69 |
* Fixed the settings link on the Plugins page
|
@@ -80,13 +96,16 @@ No limits to the number of image sets per page or how many images are allowed in
|
|
80 |
= 1.1 (2010-10-09) =
|
81 |
* Honors empty captions.
|
82 |
* Fixed typos on admin page.
|
83 |
-
*
|
84 |
|
85 |
= 1.0 (2010-04-11) =
|
86 |
* Release.
|
87 |
|
88 |
== Upgrade Notice ==
|
89 |
|
|
|
|
|
|
|
90 |
= 1.2.2 =
|
91 |
Use WordPress bundled jQuery instead of forcing the Google CDN
|
92 |
|
@@ -104,12 +123,29 @@ First release.
|
|
104 |
|
105 |
== Frequently Asked Questions ==
|
106 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
107 |
= Must fade-in and animation of all *box-scripts be so slow? =
|
108 |
|
109 |
-
WP-jQuery Lightbox lets you configure the animation
|
110 |
|
111 |
= Can I help you in any way? =
|
112 |
|
113 |
-
|
|
|
|
|
114 |
|
115 |
-
|
3 |
Donate link: http://amzn.com/w/2QB6SQ5XX2U0N
|
4 |
Tags: lightbox, jquery, nodal, image, display, ulfben
|
5 |
Requires at least: 2.9.2
|
6 |
+
Tested up to: 3.1.2
|
7 |
+
Stable tag: 1.3
|
8 |
|
9 |
+
A drop-in replacement for Lightbox 2 and similar plugins, shedding the bulk of Prototype and Scriptaculous. Improved for mobile devices.
|
10 |
|
11 |
== Description ==
|
12 |
|
13 |
This plugin lets you keep [the awesome Lightbox 2](http://www.huddletogether.com/projects/lightbox2/)-functionality, but sheds the bulk of the Prototype Framework **and** Scriptaculous Effects Library.
|
14 |
|
15 |
+
Warren Krewenki [ported Lightbox to jQuery](http://warren.mesozen.com/jquery-lightbox/) and this plugin is mostly a wrapper to his work: providing an admin panel for configuration, (optional) auto-boxing of your image links and support for [WordPress galleries](http://codex.wordpress.org/Gallery_Shortcode), *including* [media library](http://codex.wordpress.org/Media_Library_SubPanel) titles and captions.
|
|
|
16 |
|
17 |
+
This version is also better suited for mobile devices;
|
18 |
+
|
19 |
+
* Improved scaling *maximizes* use of screen space
|
20 |
+
* Live adjustment to the browser window and orientation of your phone
|
21 |
+
* Animations can be disabled entirely
|
22 |
+
* Optional download link to display images in native app.
|
23 |
|
24 |
See the plugin in action here: [http://game.hgo.se/blog/motion-capture/](http://game.hgo.se/blog/motion-capture/)
|
25 |
|
26 |
+
You can navigate the images with your keyboard: Arrows, P(revious)/N(ext) and X/C/ESC for close.
|
27 |
|
28 |
+
*If you value [my plugins](http://profiles.wordpress.org/users/ulfben/) please consider [sending me a book](http://amzn.com/w/2QB6SQ5XX2U0N)!*
|
|
|
|
|
29 |
|
30 |
+
= 1.3 (2011-05-01) =
|
31 |
+
* Improved scaling to *maximize* display area.
|
32 |
+
* Supports orientation / resize changes - Lightbox reflows with site.
|
33 |
+
* Added translation support (Thanks; [Martin S](http://sukimashita.com/) & Denis N. Voituk).
|
34 |
+
* Added option to display download link.
|
35 |
+
* Added support for disabling all animations (set duration to 0).
|
36 |
+
* Fixed "duration" not having an effect.
|
37 |
+
* [For Developers: public method to apply Lightbox to any string.](http://wordpress.org/extend/plugins/wp-jquery-lightbox/installation/)
|
38 |
|
39 |
[Older changelogs moved here.](http://wordpress.org/extend/plugins/wp-jquery-lightbox/changelog/)
|
40 |
|
43 |
1. Upload the `wp-jquery-lightbox`-folder to the `/wp-content/plugins/` directory
|
44 |
1. Activate the plugin through the 'Plugins' menu in WordPress
|
45 |
1. Check out the jQuery Lightbox-panel in your admin interface for usage details and configuration.
|
46 |
+
1. Note: [the gallery shortcode](http://codex.wordpress.org/Gallery_Shortcode) is *only* lightboxed if you set `[gallery link="file"]`
|
47 |
|
48 |
= How to Use: =
|
49 |
+
1. [WordPress built-in gallery](http://codex.wordpress.org/Gallery_Shortcode) can be auto-lightboxed thusly: [`[gallery link="file"]`](http://codex.wordpress.org/Gallery_Shortcode)
|
50 |
+
1. Adding a `rel="lightbox"` attribute to any link tag also activate the lightbox. For example:
|
51 |
|
52 |
`<a href="image-1.jpg" rel="lightbox" title="my caption">image #1</a>`
|
53 |
+
|
54 |
+
Note the use of title-attribute to set a caption
|
55 |
+
|
56 |
1. If you have a set of related images that you would like to group, follow step one but additionally include a group name in the rel attribute. For example:
|
57 |
|
58 |
`<a href="image-1.jpg" rel="lightbox[roadtrip]">image #1</a>`
|
61 |
|
62 |
`<a href="image-3.jpg" rel="lightbox[roadtrip]">image #3</a>`
|
63 |
|
64 |
+
Post galleries are grouped in sets automatically.
|
65 |
|
66 |
+
1. You can navigate the images with your keyboard: Arrows, P(revious)/N(ext) and X/C/ESC for close. Clicking in the center of a picture also closes the lightbox.
|
67 |
|
68 |
+
= For developers: =
|
69 |
+
1. Always have `wp_footer();` just before the closing `</body>` tag of your theme, or you will break many plugins, which generally use this hook to reference JavaScript files.
|
70 |
+
1. Apply lightbox to any content by running `jqlb_apply_lightbox($your_content, "any ID");` It returns a string with all image links lightboxed, grouped by `"any id"`.
|
71 |
|
72 |
== Changelog ==
|
73 |
|
74 |
+
= 1.3 (2011-05-01) =
|
75 |
+
* Improved scaling to make maximum use of display area.
|
76 |
+
* Supports orientation / resize changes - Lightbox reflows with site.
|
77 |
+
* Added translation support (Thanks; [Martin S](http://sukimashita.com/) & Denis N. Voituk).
|
78 |
+
* Added option to display download link.
|
79 |
+
* Added support for disabling all animations (set duration to 0).
|
80 |
+
* Fixed "duration" not having an effect.
|
81 |
+
* [For Developers: public method to apply Lightbox to any string.](http://wordpress.org/extend/plugins/wp-jquery-lightbox/installation/)
|
82 |
+
|
83 |
= 1.2.2 (2011-04-14) =
|
84 |
* Use WordPress bundled jQuery instead of forcing the Google CDN
|
85 |
* Fixed the settings link on the Plugins page
|
96 |
= 1.1 (2010-10-09) =
|
97 |
* Honors empty captions.
|
98 |
* Fixed typos on admin page.
|
99 |
+
* [thanks, josephknight!](http://tinyurl.com/3677p6r)
|
100 |
|
101 |
= 1.0 (2010-04-11) =
|
102 |
* Release.
|
103 |
|
104 |
== Upgrade Notice ==
|
105 |
|
106 |
+
= 1.3 =
|
107 |
+
Enables larger viewing area, improved mobile experience and translations.
|
108 |
+
|
109 |
= 1.2.2 =
|
110 |
Use WordPress bundled jQuery instead of forcing the Google CDN
|
111 |
|
123 |
|
124 |
== Frequently Asked Questions ==
|
125 |
|
126 |
+
= I can see elements of my site through the overlay =
|
127 |
+
|
128 |
+
It's a problem of [z-index](http://www.w3schools.com/Css/pr_pos_z-index.asp). Check [the z-index property](http://www.w3schools.com/Css/pr_pos_z-index.asp) for the problematic elements, and force them to be less than 100. (Thanks [dway](http://wordpress.org/support/topic/plugin-wp-jquery-lightbox-title-captions-bug-found-solved-and-fix-proposed?replies=20#post-2052340)!)
|
129 |
+
|
130 |
+
= How do I add images to a post? =
|
131 |
+
|
132 |
+
[Inserting Images into Posts and Pages](http://codex.wordpress.org/Inserting_Images_into_Posts_and_Pages)
|
133 |
+
|
134 |
+
= How do I create a thumbnail gallery? =
|
135 |
+
|
136 |
+
Upload images to a post (see previous question) and use [WordPress' built-in gallery shortcode](http://codex.wordpress.org/Gallery_Shortcode): `[gallery link="file"]`
|
137 |
+
|
138 |
+
Note the `link="file"` - this is crucial! By default the gallery will link your humbnails to a page displaying your image. With `link="file"` the thumbnails links
|
139 |
+
directly to the image files - allowing Lightbox to function.
|
140 |
+
|
141 |
= Must fade-in and animation of all *box-scripts be so slow? =
|
142 |
|
143 |
+
WP-jQuery Lightbox lets you configure the animation duration and disable image resizing from the admin panel. Set duration to 0 to disable animations entirely.
|
144 |
|
145 |
= Can I help you in any way? =
|
146 |
|
147 |
+
Indeed you can!
|
148 |
+
|
149 |
+
Translations and help with implementing them would be nice. A read through and comments on my WordPress API usage would also be most welcome, as I'm not really able to keep on top of the frequent WordPress releases anymore.
|
150 |
|
151 |
+
And of course; [a book or two](http://www.amazon.com/gp/registry/wishlist/2QB6SQ5XX2U0N/105-3209188-5640446?reveal=unpurchased&filter=all&sort=priority&layout=standard&x) always brightens my day! (used ones are fine!)
|
wp-jquery-lightbox.php
CHANGED
@@ -3,27 +3,33 @@
|
|
3 |
Plugin Name: wp-jquery-lightbox
|
4 |
Plugin URI: http://wordpress.org/extend/plugins/wp-jquery-lightbox/
|
5 |
Description: A drop in replacement for LightBox-2 and similar plugins. Uses jQuery to save you from the JS-library mess in your header. :)
|
6 |
-
Version: 1.
|
7 |
Author: Ulf Benjaminsson
|
8 |
Author URI: http://www.ulfben.com
|
9 |
*/
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
}
|
16 |
-
define('JQLB_DONATE_URL', 'http://www.amazon.com/gp/registry/wishlist/2QB6SQ5XX2U0N/105-3209188-5640446?reveal=unpurchased&filter=all&sort=priority&layout=standard&x=21&y=17');
|
17 |
-
define('JQLB_BASENAME', plugin_basename(__FILE__));
|
18 |
-
define('JQLB_URL', WP_PLUGIN_URL.'/wp-jquery-lightbox/');
|
19 |
-
define('JQLB_SCRIPT_URL', JQLB_URL.'jquery.lightbox.min.js');
|
20 |
-
define('JQLB_STYLE_URL', JQLB_URL.'lightbox.min.css');
|
21 |
-
add_action('admin_init', 'jqlb_register_settings');
|
22 |
-
add_action('admin_menu', 'jqlb_register_menu_item');
|
23 |
-
add_action('wp_print_styles', 'jqlb_css');
|
24 |
-
add_action('wp_print_scripts', 'jqlb_js');
|
25 |
-
add_filter('plugin_row_meta', 'jqlb_set_plugin_meta', 2, 10);
|
26 |
-
add_filter('the_content', 'jqlb_autoexpand_rel_wlightbox', 99);
|
27 |
function jqlb_set_plugin_meta( $links, $file ) { // Add a link to this plugin's settings page
|
28 |
static $this_plugin;
|
29 |
if(!$this_plugin) $this_plugin = plugin_basename(__FILE__);
|
@@ -37,49 +43,97 @@ function jqlb_add_admin_footer(){ //shows some plugin info in the footer of the
|
|
37 |
$plugin_data = get_plugin_data(__FILE__);
|
38 |
printf('%1$s by %2$s (who <a href="'.JQLB_DONATE_URL.'">appreciates books</a>) :)<br />', $plugin_data['Title'].' '.$plugin_data['Version'], $plugin_data['Author']);
|
39 |
}
|
40 |
-
|
41 |
function jqlb_register_settings(){
|
42 |
-
register_setting( 'jqlb-settings-group', 'jqlb_automate');
|
43 |
-
register_setting( 'jqlb-settings-group', 'jqlb_resize_on_demand');
|
|
|
44 |
register_setting( 'jqlb-settings-group', 'jqlb_resize_speed', 'jqlb_pos_intval');
|
|
|
45 |
add_option('jqlb_automate', 1); //default is to auto-lightbox.
|
46 |
add_option('jqlb_resize_on_demand', 1); //default is to resize
|
47 |
-
add_option('
|
|
|
|
|
48 |
}
|
49 |
function jqlb_register_menu_item() {
|
50 |
add_options_page('jQuery Lightbox Options', 'jQuery Lightbox', 'manage_options', 'jquery-lightbox-options', 'jqlb_options_panel');
|
51 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
function jqlb_css(){
|
53 |
if(is_admin() || is_feed()){return;}
|
54 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
}
|
56 |
function jqlb_js() {
|
57 |
if(is_admin() || is_feed()){return;}
|
58 |
-
wp_enqueue_script('jquery', '', array(),
|
59 |
-
wp_enqueue_script('wp-jquery-lightbox', JQLB_SCRIPT_URL, Array('jquery'), '1.
|
60 |
wp_localize_script('wp-jquery-lightbox', 'JQLBSettings', array(
|
61 |
'fitToScreen' => get_option('jqlb_resize_on_demand'),
|
62 |
-
'resizeSpeed' => get_option('jqlb_resize_speed')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
63 |
));
|
64 |
}
|
65 |
-
|
66 |
-
if there are already rel="lightbox[something]" attributes, they are not clobbered.
|
67 |
-
Michael Tyson, you are a regular expressions god! - http://atastypixel.com */
|
68 |
function jqlb_autoexpand_rel_wlightbox($content) {
|
69 |
if(get_option('jqlb_automate') == 1){
|
70 |
global $post;
|
71 |
-
$
|
72 |
-
$replacement = '$1 rel="lightbox['.$post->ID.']">';
|
73 |
-
$content = preg_replace($pattern, $replacement, $content);
|
74 |
}
|
75 |
-
return
|
76 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
77 |
function jqlb_pos_intval($v){
|
78 |
return abs(intval($v));
|
79 |
}
|
80 |
function jqlb_options_panel(){
|
81 |
if(!function_exists('current_user_can') || !current_user_can('manage_options')){
|
82 |
-
die(__('Cheatin’ uh?'));
|
83 |
}
|
84 |
add_action('in_admin_footer', 'jqlb_add_admin_footer');
|
85 |
?>
|
@@ -89,25 +143,30 @@ function jqlb_options_panel(){
|
|
89 |
<table>
|
90 |
<?php settings_fields('jqlb-settings-group'); ?>
|
91 |
<tr valign="baseline">
|
92 |
-
<th scope="row"><?php _e('Auto-lightbox image links', 'jqlb') ?></th>
|
93 |
<td>
|
94 |
<?php $check = get_option('jqlb_automate') ? ' checked="yes" ' : ''; ?>
|
95 |
-
<input type="checkbox" name="jqlb_automate" value="1" <?php echo $check; ?>/>
|
96 |
-
<
|
97 |
</td>
|
98 |
</tr>
|
99 |
<tr valign="baseline">
|
100 |
-
<th scope="row"><?php _e('Shrink large images to fit smaller screens', 'jqlb') ?></th>
|
101 |
<td>
|
102 |
-
<?php $check = get_option('
|
103 |
-
<input type="checkbox" name="
|
104 |
-
<
|
105 |
</td>
|
106 |
</tr>
|
107 |
<tr valign="baseline">
|
108 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
109 |
<td>
|
110 |
-
<input type="text" name="jqlb_resize_speed" value="<?php echo intval(get_option('jqlb_resize_speed')) ?>" />
|
|
|
111 |
</td>
|
112 |
</tr>
|
113 |
</table>
|
@@ -115,35 +174,17 @@ function jqlb_options_panel(){
|
|
115 |
<input type="submit" name="Submit" value="<?php _e('Save Changes', 'jqlb') ?>" />
|
116 |
</p>
|
117 |
</form>
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
</
|
131 |
-
|
132 |
-
<h2>Credits</h2><ul style="list-style-type: circle;margin-left: 24px;">
|
133 |
-
<li>wp-jquery-lightbox was created by <a href="http://www.ulfben.com">Ulf Benjaminsson</a> (who <a href="http://amzn.com/w/2QB6SQ5XX2U0N">appreciates books</a>). :)</li>
|
134 |
-
<li>wp-jquery-lightbox borrowed code from <a href="http://stimuli.ca/lightbox/">LightBox-2 by Rupert Morris</a></li>
|
135 |
-
<li>wp-jquery-lightbox uses a slightly modified (see below) <a href="http://github.com/krewenki/jquery-lightbox/">jQuery Lightbox</a> by <a href="http://warren.mesozen.com/jquery-lightbox/">Warren Krewenki</a></li>
|
136 |
-
<li><a href="http://github.com/krewenki/jquery-lightbox/">jQuery Lightbox</a> is based on <a href="http://www.huddletogether.com/projects/lightbox2/">Lightbox 2 by Lokesh Dhakar</a></li>
|
137 |
-
</ul>
|
138 |
-
|
139 |
-
<h2>Notes to self:</h2><p style="margin-left: 24px;">
|
140 |
-
I've changed the behaviour of jQuery Lightbox to rely on <code>rel="lightbox"</code> instead of <code>class="lightbox"</code>, since rel is what all the previous *box-scripts used.<br />
|
141 |
-
I rewrote the jQuery Lightbox resizing code, to take into account <strong>both</strong> height and width and never destroy aspect ratio.<br />
|
142 |
-
I replaced the <code>fileLoadingImage</code>-setting with a <code>jqlb_loading</code>-div, feeding an image from CSS instead of parameterizing the javascript.<br />
|
143 |
-
I did the same thing with <code>fileBottomNavCloseImage</code> (replaced with <code>jqlb_closelabel</code>-div)<br />
|
144 |
-
I borrowed the regular expression from LightBox-2, to automatically insert rel="lightbox[post_id]" without clobbering manual inputs.<br />
|
145 |
-
I've added support to grab titles and captions from the WordPress Media Gallery-output (<code>[gallery]</code>, "insert attachments" etc)<br />
|
146 |
-
I've fixed the bug of ignoring empty titles (now honored)
|
147 |
-
</p>
|
148 |
-
</div>
|
149 |
-
<?php } ?>
|
3 |
Plugin Name: wp-jquery-lightbox
|
4 |
Plugin URI: http://wordpress.org/extend/plugins/wp-jquery-lightbox/
|
5 |
Description: A drop in replacement for LightBox-2 and similar plugins. Uses jQuery to save you from the JS-library mess in your header. :)
|
6 |
+
Version: 1.3
|
7 |
Author: Ulf Benjaminsson
|
8 |
Author URI: http://www.ulfben.com
|
9 |
*/
|
10 |
+
add_action( 'plugins_loaded', 'jqlb_init' );
|
11 |
+
function jqlb_init() {
|
12 |
+
if(!defined('WP_CONTENT_URL')){
|
13 |
+
define('WP_CONTENT_URL', get_option('siteurl').'/wp-content');
|
14 |
+
}
|
15 |
+
if(!defined('WP_PLUGIN_URL')){
|
16 |
+
define('WP_PLUGIN_URL', WP_CONTENT_URL.'/plugins');
|
17 |
+
}
|
18 |
+
define('JQLB_PLUGIN_DIR', dirname( __FILE__ ) . '/');
|
19 |
+
define('JQLB_DONATE_URL', 'http://www.amazon.com/gp/registry/wishlist/2QB6SQ5XX2U0N/105-3209188-5640446?reveal=unpurchased&filter=all&sort=priority&layout=standard&x=21&y=17');
|
20 |
+
define('JQLB_BASENAME', plugin_basename(__FILE__));
|
21 |
+
define('JQLB_URL', WP_PLUGIN_URL.'/wp-jquery-lightbox/');
|
22 |
+
define('JQLB_SCRIPT_URL', JQLB_URL.'jquery.lightbox.min.js');
|
23 |
+
define('JQLB_STYLE_URL', JQLB_URL.'lightbox.min.css');
|
24 |
+
define('JQLB_LANGUAGES_DIR', JQLB_PLUGIN_DIR . 'languages/');
|
25 |
+
load_plugin_textdomain('jqlb', false, JQLB_LANGUAGES_DIR);
|
26 |
+
add_action('admin_init', 'jqlb_register_settings');
|
27 |
+
add_action('admin_menu', 'jqlb_register_menu_item');
|
28 |
+
add_action('wp_print_styles', 'jqlb_css');
|
29 |
+
add_action('wp_print_scripts', 'jqlb_js');
|
30 |
+
add_filter('plugin_row_meta', 'jqlb_set_plugin_meta', 2, 10);
|
31 |
+
add_filter('the_content', 'jqlb_autoexpand_rel_wlightbox', 99);
|
32 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
function jqlb_set_plugin_meta( $links, $file ) { // Add a link to this plugin's settings page
|
34 |
static $this_plugin;
|
35 |
if(!$this_plugin) $this_plugin = plugin_basename(__FILE__);
|
43 |
$plugin_data = get_plugin_data(__FILE__);
|
44 |
printf('%1$s by %2$s (who <a href="'.JQLB_DONATE_URL.'">appreciates books</a>) :)<br />', $plugin_data['Title'].' '.$plugin_data['Version'], $plugin_data['Author']);
|
45 |
}
|
|
|
46 |
function jqlb_register_settings(){
|
47 |
+
register_setting( 'jqlb-settings-group', 'jqlb_automate', 'jqlb_bool_intval');
|
48 |
+
register_setting( 'jqlb-settings-group', 'jqlb_resize_on_demand', 'jqlb_bool_intval');
|
49 |
+
register_setting( 'jqlb-settings-group', 'jqlb_show_download', 'jqlb_bool_intval');
|
50 |
register_setting( 'jqlb-settings-group', 'jqlb_resize_speed', 'jqlb_pos_intval');
|
51 |
+
//register_setting( 'jqlb-settings-group', 'jqlb_follow_scroll', 'jqlb_bool_intval');
|
52 |
add_option('jqlb_automate', 1); //default is to auto-lightbox.
|
53 |
add_option('jqlb_resize_on_demand', 1); //default is to resize
|
54 |
+
add_option('jqlb_show_download', 0);
|
55 |
+
add_option('jqlb_resize_speed', 400);
|
56 |
+
//add_option('jqlb_follow_scroll', 0);
|
57 |
}
|
58 |
function jqlb_register_menu_item() {
|
59 |
add_options_page('jQuery Lightbox Options', 'jQuery Lightbox', 'manage_options', 'jquery-lightbox-options', 'jqlb_options_panel');
|
60 |
}
|
61 |
+
function jqlb_get_locale(){
|
62 |
+
//$lang_locales and ICL_LANGUAGE_CODE are defined in the WPML plugin (http://wpml.org/)
|
63 |
+
global $lang_locales;
|
64 |
+
if (isset($lang_locales[ICL_LANGUAGE_CODE])){
|
65 |
+
$locale = $lang_locales[ICL_LANGUAGE_CODE];
|
66 |
+
} else {
|
67 |
+
$locale = get_locale();
|
68 |
+
}
|
69 |
+
return $locale;
|
70 |
+
}
|
71 |
function jqlb_css(){
|
72 |
if(is_admin() || is_feed()){return;}
|
73 |
+
$locale = jqlb_get_locale();
|
74 |
+
$cssfile = 'lightbox.min.' . $locale . '.css';
|
75 |
+
if(is_readable(JQLB_PLUGIN_DIR . $cssfile)){
|
76 |
+
wp_enqueue_style('jquery.lightbox.min.css', JQLB_URL . $cssfile, false, '1.3');
|
77 |
+
}else{
|
78 |
+
wp_enqueue_style('jquery.lightbox.min.css', JQLB_STYLE_URL, false, '1.3');
|
79 |
+
}
|
80 |
}
|
81 |
function jqlb_js() {
|
82 |
if(is_admin() || is_feed()){return;}
|
83 |
+
wp_enqueue_script('jquery', '', array(), false, true);
|
84 |
+
wp_enqueue_script('wp-jquery-lightbox', JQLB_SCRIPT_URL, Array('jquery'), '1.3', true);
|
85 |
wp_localize_script('wp-jquery-lightbox', 'JQLBSettings', array(
|
86 |
'fitToScreen' => get_option('jqlb_resize_on_demand'),
|
87 |
+
'resizeSpeed' => get_option('jqlb_resize_speed'),
|
88 |
+
'displayDownloadLink' => get_option('jqlb_show_download'),
|
89 |
+
//'followScroll' => get_option('jqlb_follow_scroll'),
|
90 |
+
/* translation */
|
91 |
+
'help' => __(' \u2190 / P - previous image\u00a0\u00a0\u00a0\u00a0\u2192 / N - next image\u00a0\u00a0\u00a0\u00a0ESC / X - close image gallery', 'jqlb'),
|
92 |
+
'prevLinkTitle' => __('previous image', 'jqlb'),
|
93 |
+
'nextLinkTitle' => __('next image', 'jqlb'),
|
94 |
+
'prevLinkText' => __('« Previous', 'jqlb'),
|
95 |
+
'nextLinkText' => __('Next »', 'jqlb'),
|
96 |
+
'closeTitle' => __('close image gallery', 'jqlb'),
|
97 |
+
'image' => __('Image ', 'jqlb'),
|
98 |
+
'of' => __(' of ', 'jqlb'),
|
99 |
+
'download' => __('Download', 'jqlb')
|
100 |
));
|
101 |
}
|
102 |
+
|
|
|
|
|
103 |
function jqlb_autoexpand_rel_wlightbox($content) {
|
104 |
if(get_option('jqlb_automate') == 1){
|
105 |
global $post;
|
106 |
+
$content = jqlb_do_regexp($content, $post->ID);
|
|
|
|
|
107 |
}
|
108 |
+
return $content;
|
109 |
}
|
110 |
+
function jqlb_apply_lightbox($content, $id = -1){
|
111 |
+
if($id === -1){
|
112 |
+
$id = time().rand(0, 32768);
|
113 |
+
}
|
114 |
+
return jqlb_do_regexp($content, $id);
|
115 |
+
}
|
116 |
+
|
117 |
+
/* automatically insert rel="lightbox[nameofpost]" to every image with no manual work.
|
118 |
+
if there are already rel="lightbox[something]" attributes, they are not clobbered.
|
119 |
+
Michael Tyson, you are a regular expressions god! - http://atastypixel.com */
|
120 |
+
function jqlb_do_regexp($content, $id){
|
121 |
+
$id = esc_attr($id);
|
122 |
+
$pattern = "/(<a(?![^>]*?rel=['\"]lightbox.*)[^>]*?href=['\"][^'\"]+?\.(?:bmp|gif|jpg|jpeg|png)['\"][^\>]*)>/i";
|
123 |
+
$replacement = '$1 rel="lightbox['.$id.']">';
|
124 |
+
return preg_replace($pattern, $replacement, $content);
|
125 |
+
}
|
126 |
+
|
127 |
+
function jqlb_bool_intval($v){
|
128 |
+
return $v == 1 ? '1' : '0';
|
129 |
+
}
|
130 |
+
|
131 |
function jqlb_pos_intval($v){
|
132 |
return abs(intval($v));
|
133 |
}
|
134 |
function jqlb_options_panel(){
|
135 |
if(!function_exists('current_user_can') || !current_user_can('manage_options')){
|
136 |
+
die(__('Cheatin’ uh?', 'jqlb'));
|
137 |
}
|
138 |
add_action('in_admin_footer', 'jqlb_add_admin_footer');
|
139 |
?>
|
143 |
<table>
|
144 |
<?php settings_fields('jqlb-settings-group'); ?>
|
145 |
<tr valign="baseline">
|
|
|
146 |
<td>
|
147 |
<?php $check = get_option('jqlb_automate') ? ' checked="yes" ' : ''; ?>
|
148 |
+
<input type="checkbox" id="jqlb_automate" name="jqlb_automate" value="1" <?php echo $check; ?>/>
|
149 |
+
<label for="jqlb_automate" title="<?php _e('Let the plugin add necessary html to image links', 'jqlb') ?>"> <?php _e('Auto-lightbox image links', 'jqlb') ?></label>
|
150 |
</td>
|
151 |
</tr>
|
152 |
<tr valign="baseline">
|
|
|
153 |
<td>
|
154 |
+
<?php $check = get_option('jqlb_show_download') ? ' checked="yes" ' : ''; ?>
|
155 |
+
<input type="checkbox" id="jqlb_show_download" name="jqlb_show_download" value="1" <?php echo $check; ?> />
|
156 |
+
<label for="jqlb_show_download"> <?php _e('Show download link', 'jqlb') ?> </label>
|
157 |
</td>
|
158 |
</tr>
|
159 |
<tr valign="baseline">
|
160 |
+
<td>
|
161 |
+
<?php $check = get_option('jqlb_resize_on_demand') ? ' checked="yes" ' : ''; ?>
|
162 |
+
<input type="checkbox" id="jqlb_resize_on_demand" name="jqlb_resize_on_demand" value="1" <?php echo $check; ?> />
|
163 |
+
<label for="jqlb_resize_on_demand"><?php _e('Shrink large images to fit smaller screens', 'jqlb') ?></label>
|
164 |
+
</td>
|
165 |
+
</tr>
|
166 |
+
<tr valign="baseline">
|
167 |
<td>
|
168 |
+
<input type="text" id="jqlb_resize_speed" name="jqlb_resize_speed" value="<?php echo intval(get_option('jqlb_resize_speed')) ?>" />
|
169 |
+
<label for="jqlb_resize_speed"><?php _e('Animation duration (in milliseconds)', 'jqlb') ?></label>
|
170 |
</td>
|
171 |
</tr>
|
172 |
</table>
|
174 |
<input type="submit" name="Submit" value="<?php _e('Save Changes', 'jqlb') ?>" />
|
175 |
</p>
|
176 |
</form>
|
177 |
+
<?php
|
178 |
+
$locale = jqlb_get_locale();
|
179 |
+
$diskfile = JQLB_LANGUAGES_DIR . "howtouse-" . $locale . ".html";
|
180 |
+
if (!file_exists($diskfile))
|
181 |
+
$diskfile = JQLB_LANGUAGES_DIR . "howtouse.html";
|
182 |
+
if ( function_exists('file_get_contents') ) {
|
183 |
+
$text = file_get_contents($diskfile);
|
184 |
+
} else {
|
185 |
+
$text = implode("", file($diskfile));
|
186 |
+
}
|
187 |
+
echo $text;
|
188 |
+
?>
|
189 |
+
</div>
|
190 |
+
<?php }?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|