Version Description
Bugfix release: video autoplay and https; default enqueue priority; possible max stack reached by image preloader.
=
Download this release
Release Info
Developer | RavanH |
Plugin | Easy FancyBox |
Version | 1.8.2 |
Comparing to | |
See all releases |
Code changes from version 1.8 to 1.8.2
- easy-fancybox.php +3 -3
- fancybox/jquery.fancybox.js +22 -8
- fancybox/jquery.fancybox.min.js +1 -1
- inc/class-easyfancybox-options.php +7 -6
- inc/class-easyfancybox.php +39 -37
- readme.txt +30 -20
easy-fancybox.php
CHANGED
@@ -5,7 +5,7 @@ Plugin URI: http://status301.net/wordpress-plugins/easy-fancybox/
|
|
5 |
Description: Easily enable the <a href="http://fancybox.net/">FancyBox jQuery extension</a> on all image, SWF, PDF, YouTube, Dailymotion and Vimeo links. Also supports iFrame and inline content.
|
6 |
Text Domain: easy-fancybox
|
7 |
Domain Path: languages
|
8 |
-
Version: 1.8
|
9 |
Author: RavanH
|
10 |
Author URI: http://status301.net/
|
11 |
*/
|
@@ -37,8 +37,8 @@ if ( ! defined( 'ABSPATH' ) ) exit;
|
|
37 |
* CONSTANTS
|
38 |
**************/
|
39 |
|
40 |
-
define( 'EASY_FANCYBOX_VERSION', '1.8' );
|
41 |
-
define( 'FANCYBOX_VERSION', '1.3.
|
42 |
define( 'MOUSEWHEEL_VERSION', '3.1.13' );
|
43 |
define( 'EASING_VERSION', '1.4.1' );
|
44 |
define( 'METADATA_VERSION', '2.22.1' );
|
5 |
Description: Easily enable the <a href="http://fancybox.net/">FancyBox jQuery extension</a> on all image, SWF, PDF, YouTube, Dailymotion and Vimeo links. Also supports iFrame and inline content.
|
6 |
Text Domain: easy-fancybox
|
7 |
Domain Path: languages
|
8 |
+
Version: 1.8.2
|
9 |
Author: RavanH
|
10 |
Author URI: http://status301.net/
|
11 |
*/
|
37 |
* CONSTANTS
|
38 |
**************/
|
39 |
|
40 |
+
define( 'EASY_FANCYBOX_VERSION', '1.8.2' );
|
41 |
+
define( 'FANCYBOX_VERSION', '1.3.16' );
|
42 |
define( 'MOUSEWHEEL_VERSION', '3.1.13' );
|
43 |
define( 'EASING_VERSION', '1.4.1' );
|
44 |
define( 'METADATA_VERSION', '2.22.1' );
|
fancybox/jquery.fancybox.js
CHANGED
@@ -7,7 +7,7 @@
|
|
7 |
* Copyright (c) 2008 - 2010 Janis Skarnelis
|
8 |
* That said, it is hardly a one-person project. Many people have submitted bugs, code, and offered their advice freely. Their support is greatly appreciated.
|
9 |
*
|
10 |
-
* Version: 1.3.
|
11 |
* Requires: jQuery v1.7+
|
12 |
*
|
13 |
* Dual licensed under the MIT and GPL licenses:
|
@@ -452,7 +452,7 @@
|
|
452 |
.css({
|
453 |
'border-width' : currentOpts.padding,
|
454 |
'width' : final_pos.width - currentOpts.padding * 2,
|
455 |
-
'height' :
|
456 |
});
|
457 |
|
458 |
if (equal) {
|
@@ -635,7 +635,7 @@
|
|
635 |
wrap.css('filter', 0);
|
636 |
}
|
637 |
|
638 |
-
if (
|
639 |
content.css('height','auto');
|
640 |
}
|
641 |
|
@@ -681,7 +681,7 @@
|
|
681 |
if (currentOpts.type == 'iframe') {
|
682 |
$('<iframe id="fancybox-frame" name="fancybox-frame' + new Date().getTime() + '"' + (navigator.userAgent.match(/msie [6]/i) ? ' allowtransparency="true""' : '')
|
683 |
+ ' style="border:0;margin:0;overflow:' + (selectedOpts.scrolling == 'auto' ? 'auto' : (selectedOpts.scrolling == 'yes' ? 'scroll' : 'hidden')) + '" src="'
|
684 |
-
+ currentOpts.href + '"' + (false === currentOpts.allowfullscreen ? '' : ' allowfullscreen') + ' tabindex="999"></iframe>')
|
685 |
.appendTo(content).load(function() {
|
686 |
$.fancybox.hideActivity();
|
687 |
}).focus();
|
@@ -704,7 +704,7 @@
|
|
704 |
_preload_next = function() {
|
705 |
var pos = typeof arguments[0] == 'number' ? arguments[0] : currentIndex + 1;
|
706 |
|
707 |
-
if (pos >= currentArray.length) {
|
708 |
if (currentOpts.cyclic) {
|
709 |
pos = 0;
|
710 |
} else {
|
@@ -712,6 +712,13 @@
|
|
712 |
}
|
713 |
}
|
714 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
715 |
if ( _preload_image( pos ) ) {
|
716 |
return;
|
717 |
} else {
|
@@ -722,7 +729,7 @@
|
|
722 |
_preload_prev = function() {
|
723 |
var pos = typeof arguments[0] == 'number' ? arguments[0] : currentIndex - 1;
|
724 |
|
725 |
-
if (pos < 0) {
|
726 |
if (currentOpts.cyclic) {
|
727 |
pos = currentArray.length - 1;
|
728 |
} else {
|
@@ -730,6 +737,13 @@
|
|
730 |
}
|
731 |
}
|
732 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
733 |
if ( _preload_image( pos ) ) {
|
734 |
return;
|
735 |
} else {
|
@@ -993,7 +1007,7 @@
|
|
993 |
|
994 |
obj = currentArray[pos];
|
995 |
|
996 |
-
if ( typeof obj !== 'undefined' && typeof obj.href !== 'undefined' && obj.href === currentOpts.href ) {
|
997 |
$.fancybox.next( pos + 1 );
|
998 |
} else {
|
999 |
$.fancybox.pos( pos );
|
@@ -1015,7 +1029,7 @@
|
|
1015 |
|
1016 |
obj = currentArray[pos];
|
1017 |
|
1018 |
-
if ( typeof obj !== 'undefined' && typeof obj.href !== 'undefined' && obj.href === currentOpts.href ) {
|
1019 |
$.fancybox.prev( pos - 1 );
|
1020 |
} else {
|
1021 |
$.fancybox.pos( pos );
|
7 |
* Copyright (c) 2008 - 2010 Janis Skarnelis
|
8 |
* That said, it is hardly a one-person project. Many people have submitted bugs, code, and offered their advice freely. Their support is greatly appreciated.
|
9 |
*
|
10 |
+
* Version: 1.3.16 (2018/05/03)
|
11 |
* Requires: jQuery v1.7+
|
12 |
*
|
13 |
* Dual licensed under the MIT and GPL licenses:
|
452 |
.css({
|
453 |
'border-width' : currentOpts.padding,
|
454 |
'width' : final_pos.width - currentOpts.padding * 2,
|
455 |
+
'height' : currentOpts.autoDimensions ? 'auto' : final_pos.height - titleHeight - currentOpts.padding * 2
|
456 |
});
|
457 |
|
458 |
if (equal) {
|
635 |
wrap.css('filter', 0);
|
636 |
}
|
637 |
|
638 |
+
if (currentOpts.autoDimensions) {
|
639 |
content.css('height','auto');
|
640 |
}
|
641 |
|
681 |
if (currentOpts.type == 'iframe') {
|
682 |
$('<iframe id="fancybox-frame" name="fancybox-frame' + new Date().getTime() + '"' + (navigator.userAgent.match(/msie [6]/i) ? ' allowtransparency="true""' : '')
|
683 |
+ ' style="border:0;margin:0;overflow:' + (selectedOpts.scrolling == 'auto' ? 'auto' : (selectedOpts.scrolling == 'yes' ? 'scroll' : 'hidden')) + '" src="'
|
684 |
+
+ currentOpts.href + '"' + (false === currentOpts.allowfullscreen ? '' : ' allowfullscreen') + ' allow="autoplay; encrypted-media" tabindex="999"></iframe>')
|
685 |
.appendTo(content).load(function() {
|
686 |
$.fancybox.hideActivity();
|
687 |
}).focus();
|
704 |
_preload_next = function() {
|
705 |
var pos = typeof arguments[0] == 'number' ? arguments[0] : currentIndex + 1;
|
706 |
|
707 |
+
if ( pos >= currentArray.length ) {
|
708 |
if (currentOpts.cyclic) {
|
709 |
pos = 0;
|
710 |
} else {
|
712 |
}
|
713 |
}
|
714 |
|
715 |
+
if ( pos == currentIndex ) {
|
716 |
+
currentOpts.enableKeyboardNav = false;
|
717 |
+
wrap.off('mousewheel.fb');
|
718 |
+
nav_right.hide();
|
719 |
+
return;
|
720 |
+
}
|
721 |
+
|
722 |
if ( _preload_image( pos ) ) {
|
723 |
return;
|
724 |
} else {
|
729 |
_preload_prev = function() {
|
730 |
var pos = typeof arguments[0] == 'number' ? arguments[0] : currentIndex - 1;
|
731 |
|
732 |
+
if ( pos < 0 ) {
|
733 |
if (currentOpts.cyclic) {
|
734 |
pos = currentArray.length - 1;
|
735 |
} else {
|
737 |
}
|
738 |
}
|
739 |
|
740 |
+
if ( pos == currentIndex ) {
|
741 |
+
currentOpts.enableKeyboardNav = false;
|
742 |
+
wrap.off('mousewheel.fb');
|
743 |
+
nav_left.hide();
|
744 |
+
return;
|
745 |
+
}
|
746 |
+
|
747 |
if ( _preload_image( pos ) ) {
|
748 |
return;
|
749 |
} else {
|
1007 |
|
1008 |
obj = currentArray[pos];
|
1009 |
|
1010 |
+
if ( pos != currentIndex && typeof obj !== 'undefined' && typeof obj.href !== 'undefined' && obj.href === currentOpts.href ) {
|
1011 |
$.fancybox.next( pos + 1 );
|
1012 |
} else {
|
1013 |
$.fancybox.pos( pos );
|
1029 |
|
1030 |
obj = currentArray[pos];
|
1031 |
|
1032 |
+
if ( pos != currentIndex && typeof obj !== 'undefined' && typeof obj.href !== 'undefined' && obj.href === currentOpts.href ) {
|
1033 |
$.fancybox.prev( pos - 1 );
|
1034 |
} else {
|
1035 |
$.fancybox.pos( pos );
|
fancybox/jquery.fancybox.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
(function(l){var D,j,B,r,c,z,w,H,v,i,F,g=0,y={},h=[],d=0,a={},e=[],k=null,E=new Image(),u=/\.(jpg|gif|png|bmp|jpeg|webp)(.*)?$/i,p=/[^\.]\.(swf)\s*$/i,A=/[^\.]\.(svg)\s*$/i,G=/[^\.]\.(pdf)\s*$/i,m,o=1,q=0,b="",t,n,C=false,f=l.extend(l("<div/>")[0],{prop:0}),x=navigator.userAgent.match(/msie [6]/i)&&!window.XMLHttpRequest,s=document.createTouch!==undefined;_abort=function(){l.fancybox.hideActivity();E.onerror=E.onload=null;if(k){k.abort()}D.empty()},_error=function(I){if(false===y.onError(h,g,y)){l.fancybox.hideActivity();C=false;return}if(typeof I==="undefined"){I="Please try again later."}y.titleShow=false;y.width="auto";y.height="auto";D.html('<p id="fancybox-error">The requested content cannot be loaded.<br />'+I+"</p>");_process_inline()},_start=function(){var M=h[g],J,L,O,N,I,K;_abort();y=l.extend({},l.fn.fancybox.defaults,(typeof l(M).data("fancybox")=="undefined"?y:l(M).data("fancybox")));if(document.documentElement.clientWidth<y.minViewportWidth){C=false;return}K=y.onStart(h,g,y);if(K===false){C=false;return}else{if(typeof K=="object"){y=l.extend(y,K)}}O=y.title||(M.nodeName?l(M).attr("title"):M.title)||"";if(M.nodeName&&!y.orig){y.orig=l(M).find("img:first").length?l(M).find("img:first"):l(M)}if(O===""&&y.orig){O=y.orig.attr("title")||(y.titleFromAlt?y.orig.attr("alt"):"")}J=y.href||(M.nodeName?l(M).attr("href"):M.href)||null;if((/^(?:javascript)/i).test(J)||J=="#"){J=null}if(y.type){L=y.type;if(!J){J=y.content}}else{if(y.content){L="html"}else{if(l(M).hasClass("iframe")){L="iframe"}else{if(J){if(J.match(u)||l(M).hasClass("image")){L="image"}else{if(J.match(p)){L="swf"}else{if(J.match(A)){L="svg"}else{if(J.match(G)){L="pdf"}else{if(J.indexOf("#")===0){L="inline"}else{L="ajax"}}}}}}}}}if(!L){_error("No content type found.");return}if(l(M).hasClass("modal")){y.modal=true}if(L=="inline"){M=J.substr(J.indexOf("#"));L=l(M).length>0?"inline":"ajax"}y.type=L;y.href=J;y.title=O;if(y.autoDimensions){if(y.type=="html"||y.type=="inline"||y.type=="ajax"){y.width="auto";y.height="auto"}else{y.autoDimensions=false}}if(y.modal){y.overlayShow=true;y.hideOnOverlayClick=false;y.hideOnContentClick=false;y.enableEscapeButton=false;y.showCloseButton=false}y.padding=parseInt(y.padding,10);y.margin=parseInt(y.margin,10);D.css("padding",(y.padding+y.margin));l(".fancybox-inline-tmp").off("fancybox-cancel").on("fancybox-change",function(){l(this).replaceWith(z.children())});switch(L){case"html":D.html(y.content);_process_inline();break;case"inline":if(l(M).parent().is("#fancybox-content")===true){C=false;return}l('<div class="fancybox-inline-tmp" />').hide().insertBefore(l(M)).on("fancybox-cleanup",function(){l(this).replaceWith(z.children("div:first"))}).on("fancybox-cancel",function(){l(this).replaceWith(D.children("div:first"))});l(M).appendTo(D);_process_inline();break;case"image":y.keepRatio=true;C=false;l.fancybox.showActivity();E=new Image();E.onerror=function(){_error("No image found.")};E.onload=function(){C=true;E.onerror=E.onload=null;_process_image()};E.src=J;break;case"swf":y.scrolling="no";y.keepRatio=true;N='<object type="application/x-shockwave-flash" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+y.width+'" height="'+y.height+'"><param name="movie" value="'+J+'"></param>';I="";l.each(y.swf,function(P,Q){N+='<param name="'+P+'" value="'+Q+'"></param>';I+=" "+P+'="'+Q+'"'});N+='<embed src="'+J+'" type="application/x-shockwave-flash" width="'+y.width+'" height="'+y.height+'"'+I+"></embed></object>";D.html(N);_process_inline();break;case"svg":y.scrolling="no";y.keepRatio=true;N='<object type="image/svg+xml" width="'+y.width+'" height="'+y.height+'" data="'+J+'"></object>';D.html(N);_process_inline();break;case"pdf":y.scrolling="no";N='<object type="application/pdf" width="100%" height="100%" data="'+J+'"><a href="'+J+'" style="display:block;position:absolute;top:48%;width:100%;text-align:center">'+l(M).html()+"</a></object>";D.html(N);_process_inline();break;case"ajax":C=false;l.fancybox.showActivity();y.ajax.win=y.ajax.success;k=l.ajax(l.extend({},y.ajax,{url:J,data:y.ajax.data||{},error:function(P,R,Q){if(P.status>0){_error(Q)}},success:function(Q,S,P){var R=typeof P=="object"?P:k;if(R.status==200){if(typeof y.ajax.win=="function"){K=y.ajax.win(J,Q,S,P);if(K===false){l.fancybox.hideActivity();return}else{if(typeof K=="string"||typeof K=="object"){Q=K}}}if(Q.indexOf("<!DOCTYPE")>-1||Q.indexOf("<html")>-1||Q.indexOf("<body")>-1){_error("Unexpected response.")}else{D.html(Q);_process_inline()}}}}));break;case"iframe":l.fancybox.showActivity();_show();break}},_process_inline=function(){var J=y.width,K=y.height,L=l(window).width()==0?window.innerWidth:l(window).width(),I=l(window).height()==0?window.innerHeight:l(window).height();if(J.toString().indexOf("%")>-1){J=parseInt((L-(y.margin*2))*parseFloat(J)/100,10)+"px"}else{J=J=="auto"?"auto":J+"px"}if(K.toString().indexOf("%")>-1){K=parseInt((I-(y.margin*2))*parseFloat(K)/100,10)+"px"}else{K=K=="auto"?"auto":K+"px"}D.wrapInner('<div style="width:'+J+";height:"+K+";overflow: "+(y.scrolling=="auto"?"auto":(y.scrolling=="yes"?"scroll":"hidden"))+';position:relative;"></div>');y.width=D.width();y.height=D.height();_show()},_process_image=function(){y.width=E.width;y.height=E.height;l("<img />").attr({id:"fancybox-img",src:E.src,alt:y.title}).appendTo(D);_show()},_show=function(){var J,I;if(y.type!=="iframe"){l.fancybox.hideActivity()}if(r.is(":visible")&&false===a.onCleanup(e,d,a)){l(".fancybox-inline-tmp").trigger("fancybox-cancel");C=false;return}C=true;l(z.add(B)).off();l(window).off("orientationchange.fb resize.fb scroll.fb");l(document).off("keydown.fb");if(r.is(":visible")&&a.titlePosition!=="outside"){r.css("height",r.height())}e=h;d=g;a=y;if(a.overlayShow){B.css({"background-color":a.overlayColor,opacity:a.overlayOpacity,cursor:a.hideOnOverlayClick?"pointer":"auto",height:l(document).height()});if(!B.is(":visible")){if(x){l("select:not(#fancybox-tmp select)").filter(function(){return this.style.visibility!=="hidden"}).css({visibility:"hidden"}).one("fancybox-cleanup",function(){this.style.visibility="inherit"})}B.show()}}else{B.hide()}n=_get_zoom_to();_process_title();if(r.is(":visible")){l(w.add(v).add(i)).hide();J=r.position(),t={top:J.top,left:J.left,width:r.width(),height:r.height()};I=(t.width==n.width&&t.height==n.height);z.fadeTo(a.changeFade,0.3,function(){var K=function(){z.html(D.contents()).fadeTo(a.changeFade,1,_finish)};l(".fancybox-inline-tmp").trigger("fancybox-change");z.empty().removeAttr("filter").css({"border-width":a.padding,width:n.width-a.padding*2,height:y.autoDimensions?"auto":n.height-q-a.padding*2});if(I){K()}else{f.prop=0;l(f).animate({prop:1},{duration:a.changeSpeed,easing:a.easingChange,step:_draw,complete:K})}});return}r.removeAttr("style");z.css("border-width",a.padding);if(a.transitionIn=="elastic"){t=_get_zoom_from();z.html(D.contents());r.show();if(a.opacity){n.opacity=0}f.prop=0;l(f).animate({prop:1},{duration:a.speedIn,easing:a.easingIn,step:_draw,complete:_finish});return}if(a.titlePosition=="inside"&&q>0){H.show()}z.css({width:n.width-a.padding*2,height:y.autoDimensions?"auto":n.height-q-a.padding*2}).html(D.contents());r.css(n).fadeIn(a.transitionIn=="none"?0:a.speedIn,_finish)},_format_title=function(I){if(I&&I.length){if(a.titlePosition=="float"){return'<table id="fancybox-title-float-wrap" style="border-spacing:0;border-collapse:collapse"><tr><td id="fancybox-title-float-left"></td><td id="fancybox-title-float-main">'+I+'</td><td id="fancybox-title-float-right"></td></tr></table>'}return'<div id="fancybox-title-'+a.titlePosition+'">'+I+"</div>"}return false},_process_title=function(){b=a.title||"";q=0;H.empty().removeAttr("style").removeClass();if(a.titleShow===false){H.hide();return}b=l.isFunction(a.titleFormat)?a.titleFormat(b,e,d,a):_format_title(b);if(!b||b===""){H.hide();return}H.addClass("fancybox-title-"+a.titlePosition).html(b).appendTo("body").show();switch(a.titlePosition){case"inside":H.css({width:n.width-(a.padding*2),marginLeft:a.padding,marginRight:a.padding}).appendTo(c);q=H.outerHeight(true);n.height+=q;break;case"over":H.css({marginLeft:a.padding,width:n.width-(a.padding*2),bottom:a.padding}).appendTo(c);break;case"float":H.css("left",parseInt((H.width()-n.width)/2,10)*-1).appendTo(c);break;default:H.css({width:n.width-(a.padding*2),paddingLeft:a.padding,paddingRight:a.padding}).appendTo(r);break}H.hide()},_set_navigation=function(){if(a.enableEscapeButton||a.enableKeyboardNav){l(document).on("keydown.fb",function(I){if(I.keyCode==27&&a.enableEscapeButton){I.preventDefault();l.fancybox.close()}else{if((I.keyCode==37||I.keyCode==39)&&a.enableKeyboardNav&&I.target.tagName!=="INPUT"&&I.target.tagName!=="TEXTAREA"&&I.target.tagName!=="SELECT"){I.preventDefault();l.fancybox[I.keyCode==37?"prev":"next"]()}else{if((I.keyCode==9)&&a.enableKeyboardNav&&I.target.tagName!=="INPUT"&&I.target.tagName!=="TEXTAREA"&&I.target.tagName!=="SELECT"){I.preventDefault();l.fancybox[I.shiftKey?"prev":"next"]()}}}})}if(!a.showNavArrows){v.hide();i.hide();return}if((a.cyclic&&e.length>1)||d!==0){v.show()}if((a.cyclic&&e.length>1)||d!=(e.length-1)){i.show()}},_finish=function(){if(!l.support.opacity){z.css("filter",0);r.css("filter",0)}if(y.autoDimensions){z.css("height","auto")}r.css("height","auto");if(b&&b.length){H.show()}if(a.showCloseButton){w.show()}_set_navigation();if(a.hideOnContentClick){z.on("click",l.fancybox.close)}if(a.hideOnOverlayClick){B.on("click",l.fancybox.close)}if(a.autoResize){l(window).on("resize.fb",l.fancybox.resize)}if(a.centerOnScroll&&!s){l(window).on("scroll.fb",l.fancybox.center)}if(l.fn.mousewheel){r.on("mousewheel.fb",function(I,J){if(C){I.preventDefault()}else{if(a.type=="image"&&(l(I.target).outerHeight()==0||l(I.target).prop("scrollHeight")===l(I.target).outerHeight())){I.preventDefault();l.fancybox[J>0?"prev":"next"]()}}})}if(a.type=="iframe"){l('<iframe id="fancybox-frame" name="fancybox-frame'+new Date().getTime()+'"'+(navigator.userAgent.match(/msie [6]/i)?' allowtransparency="true""':"")+' style="border:0;margin:0;overflow:'+(y.scrolling=="auto"?"auto":(y.scrolling=="yes"?"scroll":"hidden"))+'" src="'+a.href+'"'+(false===a.allowfullscreen?"":" allowfullscreen")+' tabindex="999"></iframe>').appendTo(z).load(function(){l.fancybox.hideActivity()}).focus()}r.show();C=false;l.fancybox.center();a.onComplete(e,d,a);if(e.length>1){_preload_next();_preload_prev()}},_preload_next=function(){var I=typeof arguments[0]=="number"?arguments[0]:d+1;if(I>=e.length){if(a.cyclic){I=0}else{return}}if(_preload_image(I)){return}else{_preload_next(I+1)}},_preload_prev=function(){var I=typeof arguments[0]=="number"?arguments[0]:d-1;if(I<0){if(a.cyclic){I=e.length-1}else{return}}if(_preload_image(I)){return}else{_preload_prev(I-1)}},_preload_image=function(K){var J,I=e[K];if(typeof I!=="undefined"&&typeof I.href!=="undefined"&&I.href!==a.href&&(I.href.match(u)||l(I).hasClass("image"))){J=new Image();J.src=I.href;return true}else{return false}},_draw=function(J){var I={width:parseInt(t.width+(n.width-t.width)*J,10),height:parseInt(t.height+(n.height-t.height)*J,10),top:parseInt(t.top+(n.top-t.top)*J,10),left:parseInt(t.left+(n.left-t.left)*J,10)};if(typeof n.opacity!=="undefined"){I.opacity=J<0.5?0.5:J}r.css(I);z.css({width:I.width-a.padding*2,height:I.height-(q*J)-a.padding*2})},_get_viewport=function(){var I=!s&&window.innerWidth&&document.documentElement.clientWidth?Math.min(window.innerWidth,document.documentElement.clientWidth):window.innerWidth||document.documentElement.clientWidth||document.getElementsByTagName("body")[0].clientWidth,J=!s&&window.innerHeight&&document.documentElement.clientHeight?Math.min(window.innerHeight,document.documentElement.clientHeight):window.innerHeight||document.documentElement.clientHeight||document.getElementsByTagName("body")[0].clientHeight;return[I-(a.margin*2),J-(a.margin*2),l(document).scrollLeft()+a.margin,l(document).scrollTop()+a.margin]},_get_zoom_to=function(){var I=_get_viewport(),L={},J=a.padding*2,K;if(a.width.toString().indexOf("%")>-1){L.width=parseInt((I[0]*parseFloat(a.width))/100,10)}else{L.width=a.width+J}if(a.height.toString().indexOf("%")>-1){L.height=parseInt((I[1]*parseFloat(a.height))/100,10)}else{L.height=a.height+J}if(a.autoScale&&(L.width>I[0]||L.height>I[1])){if(a.keepRatio){K=a.width/a.height;if((L.width)>I[0]){L.width=I[0];L.height=parseInt(((L.width-J)/K)+J,10)}if((L.height)>I[1]){L.height=I[1];L.width=parseInt(((L.height-J)*K)+J,10)}}else{L.width=Math.min(L.width,I[0]);L.height=Math.min(L.height,I[1])}}L.top=parseInt(Math.max(I[3]-20,I[3]+((I[1]-L.height-40)*0.5)),10);L.left=parseInt(Math.max(I[2]-20,I[2]+((I[0]-L.width-40)*0.5)),10);return L},_get_obj_pos=function(I){var J=I.offset();J.top+=parseInt(I.css("paddingTop"),10)||0;J.left+=parseInt(I.css("paddingLeft"),10)||0;J.top+=parseInt(I.css("border-top-width"),10)||0;J.left+=parseInt(I.css("border-left-width"),10)||0;J.width=I.width();J.height=I.height();return J},_get_zoom_from=function(){var L=y.orig?l(y.orig):false,K={},J,I;if(L&&L.length){J=_get_obj_pos(L);K={width:J.width+(a.padding*2),height:J.height+(a.padding*2),top:J.top-a.padding-20,left:J.left-a.padding-20}}else{I=_get_viewport();K={width:a.padding*2,height:a.padding*2,top:parseInt((I[3]+I[1])*0.5,10),left:parseInt((I[2]+I[0])*0.5,10)}}return K},_animate_loading=function(){if(!j.is(":visible")){clearInterval(m);return}l("div",j).css("top",(o*-40)+"px");o=(o+1)%12};l.fn.fancybox=function(I){if(!l(this).length){return this}l(this).data("fancybox",l.extend({},I,(l.metadata?l(this).metadata():{}))).off("click.fb").on("click.fb",function(K){K.preventDefault();if(C){return}C=true;l(this).blur();h=[];g=0;var J=l(this).attr("rel")||"";if(J==""||J.replace(/alternate|external|help|license|nofollow|noreferrer|noopener|\s+/gi,"")==""){h.push(this)}else{h=l('a[rel="'+J+'"], area[rel="'+J+'"]');g=h.index(this)}_start();return});return this};l.fancybox=function(L){var K;if(C){return}C=true;K=typeof arguments[1]!=="undefined"?arguments[1]:{};h=[];g=parseInt(K.index,10)||0;if(l.isArray(L)){for(var J=0,I=L.length;J<I;J++){if(typeof L[J]=="object"){l(L[J]).data("fancybox",l.extend({},K,L[J]))}else{L[J]=l({}).data("fancybox",l.extend({content:L[J]},K))}}h=jQuery.merge(h,L)}else{if(typeof L=="object"){l(L).data("fancybox",l.extend({},K,L))}else{L=l({}).data("fancybox",l.extend({content:L},K))}h.push(L)}if(g>h.length||g<0){g=0}_start()};l.fancybox.showActivity=function(){clearInterval(m);j.show();m=setInterval(_animate_loading,66)};l.fancybox.hideActivity=function(){j.hide()};l.fancybox.next=function(){var I,J=typeof arguments[0]=="number"?arguments[0]:d+1;if(J>=e.length){if(a.cyclic){J=0}else{return}}I=e[J];if(typeof I!=="undefined"&&typeof I.href!=="undefined"&&I.href===a.href){l.fancybox.next(J+1)}else{l.fancybox.pos(J)}return};l.fancybox.prev=function(){var I,J=typeof arguments[0]=="number"?arguments[0]:d-1;if(J<0){if(a.cyclic){J=e.length-1}else{return}}I=e[J];if(typeof I!=="undefined"&&typeof I.href!=="undefined"&&I.href===a.href){l.fancybox.prev(J-1)}else{l.fancybox.pos(J)}return};l.fancybox.pos=function(I){if(C){return}I=parseInt(I);h=e;if(I>-1&&I<e.length){g=I;_start()}return};l.fancybox.cancel=function(){if(C){return}C=true;l(".fancybox-inline-tmp").trigger("fancybox-cancel");_abort();y.onCancel(h,g,y);C=false};l.fancybox.close=function(){if(C||r.is(":hidden")){return}C=true;if(a&&false===a.onCleanup(e,d,a)){C=false;return}_abort();l(w.add(v).add(i)).hide();l(z.add(B)).off();l(window).off("orientationchange.fb resize.fb scroll.fb mousewheel.fb");l(document).off("keydown.fb");z.find("iframe#fancybox-frame").attr("src",x&&/^https/i.test(window.location.href||"")?"javascript:void(false)":"about:blank");if(a.titlePosition!=="inside"){H.empty()}r.stop();function I(){B.fadeOut("fast");H.empty().hide();r.hide();l(".fancybox-inline-tmp").trigger("fancybox-cleanup");z.empty();a.onClosed(e,d,a);e=y=[];d=g=0;a=y={};C=false}if(a.transitionOut=="elastic"){t=_get_zoom_from();var J=r.position();n={top:J.top,left:J.left,width:r.width(),height:r.height()};if(a.opacity){n.opacity=1}H.empty().hide();f.prop=1;l(f).animate({prop:0},{duration:a.speedOut,easing:a.easingOut,step:_draw,complete:I})}else{r.fadeOut(a.transitionOut=="none"?0:a.speedOut,I)}};l.fancybox.resize=function(){var I;clearTimeout(F);F=setTimeout(function(){var J=function(){if(y.autoDimensions){z.css("height","auto")}r.css("height","auto");if(b&&b.length){H.show()}C=false;l.fancybox.center(true)};if(B.is(":visible")){B.css("height",l(document).height())}I=r.position(),t={top:I.top,left:I.left,width:r.width(),height:r.height()};n=_get_zoom_to();C=true;_process_title();f.prop=0;l(f).animate({prop:1},{duration:a.changeSpeed,easing:a.easingChange,step:_draw,complete:J})},500)};l.fancybox.center=function(){var I,J;if(C){return}J=arguments[0]===true?1:0;I=_get_viewport();if(!J&&(r.width()>I[0]||r.height()>I[1])){return}r.stop().animate({top:parseInt(Math.max(I[3]-20,I[3]+((I[1]-z.height()-40)*0.5)-a.padding)),left:parseInt(Math.max(I[2]-20,I[2]+((I[0]-z.width()-40)*0.5)-a.padding))},typeof arguments[0]=="number"?arguments[0]:300)};l.fancybox.init=function(){if(l("#fancybox-wrap").length){return}l("body").append(D=l('<div id="fancybox-tmp"></div>'),j=l('<div id="fancybox-loading"><div></div></div>'),B=l('<div id="fancybox-overlay"></div>'),r=l('<div id="fancybox-wrap"></div>'));c=l('<div id="fancybox-outer"></div>').append('<div class="fancybox-bg" id="fancybox-bg-n"></div><div class="fancybox-bg" id="fancybox-bg-ne"></div><div class="fancybox-bg" id="fancybox-bg-e"></div><div class="fancybox-bg" id="fancybox-bg-se"></div><div class="fancybox-bg" id="fancybox-bg-s"></div><div class="fancybox-bg" id="fancybox-bg-sw"></div><div class="fancybox-bg" id="fancybox-bg-w"></div><div class="fancybox-bg" id="fancybox-bg-nw"></div>').appendTo(r);c.append(z=l('<div id="fancybox-content"></div>'),w=l('<a id="fancybox-close"></a>'),H=l('<div id="fancybox-title"></div>'),v=l('<a href="javascript:;" id="fancybox-left"><span class="fancy-ico" id="fancybox-left-ico"></span></a>'),i=l('<a href="javascript:;" id="fancybox-right"><span class="fancy-ico" id="fancybox-right-ico"></span></a>'));w.click(l.fancybox.close);j.click(l.fancybox.cancel);v.click(function(I){I.preventDefault();l.fancybox.prev()});i.click(function(I){I.preventDefault();l.fancybox.next()});if(!l.support.opacity){r.addClass("fancybox-ie")}if(x){j.addClass("fancybox-ie6");r.addClass("fancybox-ie6");l('<iframe id="fancybox-hide-sel-frame" src="'+(/^https/i.test(window.location.href||"")?"javascript:void(false)":"about:blank")+'" style="overflow:hidden;border:0" tabindex="-1"></iframe>').prependTo(c)}};l.fn.fancybox.defaults={padding:10,margin:40,opacity:false,modal:false,cyclic:false,allowfullscreen:false,scrolling:"auto",width:560,height:340,autoScale:true,autoDimensions:true,centerOnScroll:false,autoResize:true,keepRatio:false,minViewportWidth:0,ajax:{},swf:{wmode:"opaque"},svg:{wmode:"opaque"},hideOnOverlayClick:true,hideOnContentClick:false,overlayShow:true,overlayOpacity:0.7,overlayColor:"#777",titleShow:true,titlePosition:"float",titleFormat:null,titleFromAlt:true,transitionIn:"fade",transitionOut:"fade",speedIn:300,speedOut:300,changeSpeed:300,changeFade:"fast",easingIn:"swing",easingOut:"swing",showCloseButton:true,showNavArrows:true,enableEscapeButton:true,enableKeyboardNav:true,onStart:function(){},onCancel:function(){},onComplete:function(){},onCleanup:function(){},onClosed:function(){},onError:function(){}};l(document).ready(function(){l.fancybox.init()})})(jQuery);
|
1 |
+
(function(l){var D,j,B,r,c,z,w,H,v,i,F,g=0,y={},h=[],d=0,a={},e=[],k=null,E=new Image(),u=/\.(jpg|gif|png|bmp|jpeg|webp)(.*)?$/i,p=/[^\.]\.(swf)\s*$/i,A=/[^\.]\.(svg)\s*$/i,G=/[^\.]\.(pdf)\s*$/i,m,o=1,q=0,b="",t,n,C=false,f=l.extend(l("<div/>")[0],{prop:0}),x=navigator.userAgent.match(/msie [6]/i)&&!window.XMLHttpRequest,s=document.createTouch!==undefined;_abort=function(){l.fancybox.hideActivity();E.onerror=E.onload=null;if(k){k.abort()}D.empty()},_error=function(I){if(false===y.onError(h,g,y)){l.fancybox.hideActivity();C=false;return}if(typeof I==="undefined"){I="Please try again later."}y.titleShow=false;y.width="auto";y.height="auto";D.html('<p id="fancybox-error">The requested content cannot be loaded.<br />'+I+"</p>");_process_inline()},_start=function(){var M=h[g],J,L,O,N,I,K;_abort();y=l.extend({},l.fn.fancybox.defaults,(typeof l(M).data("fancybox")=="undefined"?y:l(M).data("fancybox")));if(document.documentElement.clientWidth<y.minViewportWidth){C=false;return}K=y.onStart(h,g,y);if(K===false){C=false;return}else{if(typeof K=="object"){y=l.extend(y,K)}}O=y.title||(M.nodeName?l(M).attr("title"):M.title)||"";if(M.nodeName&&!y.orig){y.orig=l(M).find("img:first").length?l(M).find("img:first"):l(M)}if(O===""&&y.orig){O=y.orig.attr("title")||(y.titleFromAlt?y.orig.attr("alt"):"")}J=y.href||(M.nodeName?l(M).attr("href"):M.href)||null;if((/^(?:javascript)/i).test(J)||J=="#"){J=null}if(y.type){L=y.type;if(!J){J=y.content}}else{if(y.content){L="html"}else{if(l(M).hasClass("iframe")){L="iframe"}else{if(J){if(J.match(u)||l(M).hasClass("image")){L="image"}else{if(J.match(p)){L="swf"}else{if(J.match(A)){L="svg"}else{if(J.match(G)){L="pdf"}else{if(J.indexOf("#")===0){L="inline"}else{L="ajax"}}}}}}}}}if(!L){_error("No content type found.");return}if(l(M).hasClass("modal")){y.modal=true}if(L=="inline"){M=J.substr(J.indexOf("#"));L=l(M).length>0?"inline":"ajax"}y.type=L;y.href=J;y.title=O;if(y.autoDimensions){if(y.type=="html"||y.type=="inline"||y.type=="ajax"){y.width="auto";y.height="auto"}else{y.autoDimensions=false}}if(y.modal){y.overlayShow=true;y.hideOnOverlayClick=false;y.hideOnContentClick=false;y.enableEscapeButton=false;y.showCloseButton=false}y.padding=parseInt(y.padding,10);y.margin=parseInt(y.margin,10);D.css("padding",(y.padding+y.margin));l(".fancybox-inline-tmp").off("fancybox-cancel").on("fancybox-change",function(){l(this).replaceWith(z.children())});switch(L){case"html":D.html(y.content);_process_inline();break;case"inline":if(l(M).parent().is("#fancybox-content")===true){C=false;return}l('<div class="fancybox-inline-tmp" />').hide().insertBefore(l(M)).on("fancybox-cleanup",function(){l(this).replaceWith(z.children("div:first"))}).on("fancybox-cancel",function(){l(this).replaceWith(D.children("div:first"))});l(M).appendTo(D);_process_inline();break;case"image":y.keepRatio=true;C=false;l.fancybox.showActivity();E=new Image();E.onerror=function(){_error("No image found.")};E.onload=function(){C=true;E.onerror=E.onload=null;_process_image()};E.src=J;break;case"swf":y.scrolling="no";y.keepRatio=true;N='<object type="application/x-shockwave-flash" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+y.width+'" height="'+y.height+'"><param name="movie" value="'+J+'"></param>';I="";l.each(y.swf,function(P,Q){N+='<param name="'+P+'" value="'+Q+'"></param>';I+=" "+P+'="'+Q+'"'});N+='<embed src="'+J+'" type="application/x-shockwave-flash" width="'+y.width+'" height="'+y.height+'"'+I+"></embed></object>";D.html(N);_process_inline();break;case"svg":y.scrolling="no";y.keepRatio=true;N='<object type="image/svg+xml" width="'+y.width+'" height="'+y.height+'" data="'+J+'"></object>';D.html(N);_process_inline();break;case"pdf":y.scrolling="no";N='<object type="application/pdf" width="100%" height="100%" data="'+J+'"><a href="'+J+'" style="display:block;position:absolute;top:48%;width:100%;text-align:center">'+l(M).html()+"</a></object>";D.html(N);_process_inline();break;case"ajax":C=false;l.fancybox.showActivity();y.ajax.win=y.ajax.success;k=l.ajax(l.extend({},y.ajax,{url:J,data:y.ajax.data||{},error:function(P,R,Q){if(P.status>0){_error(Q)}},success:function(Q,S,P){var R=typeof P=="object"?P:k;if(R.status==200){if(typeof y.ajax.win=="function"){K=y.ajax.win(J,Q,S,P);if(K===false){l.fancybox.hideActivity();return}else{if(typeof K=="string"||typeof K=="object"){Q=K}}}if(Q.indexOf("<!DOCTYPE")>-1||Q.indexOf("<html")>-1||Q.indexOf("<body")>-1){_error("Unexpected response.")}else{D.html(Q);_process_inline()}}}}));break;case"iframe":l.fancybox.showActivity();_show();break}},_process_inline=function(){var J=y.width,K=y.height,L=l(window).width()==0?window.innerWidth:l(window).width(),I=l(window).height()==0?window.innerHeight:l(window).height();if(J.toString().indexOf("%")>-1){J=parseInt((L-(y.margin*2))*parseFloat(J)/100,10)+"px"}else{J=J=="auto"?"auto":J+"px"}if(K.toString().indexOf("%")>-1){K=parseInt((I-(y.margin*2))*parseFloat(K)/100,10)+"px"}else{K=K=="auto"?"auto":K+"px"}D.wrapInner('<div style="width:'+J+";height:"+K+";overflow: "+(y.scrolling=="auto"?"auto":(y.scrolling=="yes"?"scroll":"hidden"))+';position:relative;"></div>');y.width=D.width();y.height=D.height();_show()},_process_image=function(){y.width=E.width;y.height=E.height;l("<img />").attr({id:"fancybox-img",src:E.src,alt:y.title}).appendTo(D);_show()},_show=function(){var J,I;if(y.type!=="iframe"){l.fancybox.hideActivity()}if(r.is(":visible")&&false===a.onCleanup(e,d,a)){l(".fancybox-inline-tmp").trigger("fancybox-cancel");C=false;return}C=true;l(z.add(B)).off();l(window).off("orientationchange.fb resize.fb scroll.fb");l(document).off("keydown.fb");if(r.is(":visible")&&a.titlePosition!=="outside"){r.css("height",r.height())}e=h;d=g;a=y;if(a.overlayShow){B.css({"background-color":a.overlayColor,opacity:a.overlayOpacity,cursor:a.hideOnOverlayClick?"pointer":"auto",height:l(document).height()});if(!B.is(":visible")){if(x){l("select:not(#fancybox-tmp select)").filter(function(){return this.style.visibility!=="hidden"}).css({visibility:"hidden"}).one("fancybox-cleanup",function(){this.style.visibility="inherit"})}B.show()}}else{B.hide()}n=_get_zoom_to();_process_title();if(r.is(":visible")){l(w.add(v).add(i)).hide();J=r.position(),t={top:J.top,left:J.left,width:r.width(),height:r.height()};I=(t.width==n.width&&t.height==n.height);z.fadeTo(a.changeFade,0.3,function(){var K=function(){z.html(D.contents()).fadeTo(a.changeFade,1,_finish)};l(".fancybox-inline-tmp").trigger("fancybox-change");z.empty().removeAttr("filter").css({"border-width":a.padding,width:n.width-a.padding*2,height:a.autoDimensions?"auto":n.height-q-a.padding*2});if(I){K()}else{f.prop=0;l(f).animate({prop:1},{duration:a.changeSpeed,easing:a.easingChange,step:_draw,complete:K})}});return}r.removeAttr("style");z.css("border-width",a.padding);if(a.transitionIn=="elastic"){t=_get_zoom_from();z.html(D.contents());r.show();if(a.opacity){n.opacity=0}f.prop=0;l(f).animate({prop:1},{duration:a.speedIn,easing:a.easingIn,step:_draw,complete:_finish});return}if(a.titlePosition=="inside"&&q>0){H.show()}z.css({width:n.width-a.padding*2,height:y.autoDimensions?"auto":n.height-q-a.padding*2}).html(D.contents());r.css(n).fadeIn(a.transitionIn=="none"?0:a.speedIn,_finish)},_format_title=function(I){if(I&&I.length){if(a.titlePosition=="float"){return'<table id="fancybox-title-float-wrap" style="border-spacing:0;border-collapse:collapse"><tr><td id="fancybox-title-float-left"></td><td id="fancybox-title-float-main">'+I+'</td><td id="fancybox-title-float-right"></td></tr></table>'}return'<div id="fancybox-title-'+a.titlePosition+'">'+I+"</div>"}return false},_process_title=function(){b=a.title||"";q=0;H.empty().removeAttr("style").removeClass();if(a.titleShow===false){H.hide();return}b=l.isFunction(a.titleFormat)?a.titleFormat(b,e,d,a):_format_title(b);if(!b||b===""){H.hide();return}H.addClass("fancybox-title-"+a.titlePosition).html(b).appendTo("body").show();switch(a.titlePosition){case"inside":H.css({width:n.width-(a.padding*2),marginLeft:a.padding,marginRight:a.padding}).appendTo(c);q=H.outerHeight(true);n.height+=q;break;case"over":H.css({marginLeft:a.padding,width:n.width-(a.padding*2),bottom:a.padding}).appendTo(c);break;case"float":H.css("left",parseInt((H.width()-n.width)/2,10)*-1).appendTo(c);break;default:H.css({width:n.width-(a.padding*2),paddingLeft:a.padding,paddingRight:a.padding}).appendTo(r);break}H.hide()},_set_navigation=function(){if(a.enableEscapeButton||a.enableKeyboardNav){l(document).on("keydown.fb",function(I){if(I.keyCode==27&&a.enableEscapeButton){I.preventDefault();l.fancybox.close()}else{if((I.keyCode==37||I.keyCode==39)&&a.enableKeyboardNav&&I.target.tagName!=="INPUT"&&I.target.tagName!=="TEXTAREA"&&I.target.tagName!=="SELECT"){I.preventDefault();l.fancybox[I.keyCode==37?"prev":"next"]()}else{if((I.keyCode==9)&&a.enableKeyboardNav&&I.target.tagName!=="INPUT"&&I.target.tagName!=="TEXTAREA"&&I.target.tagName!=="SELECT"){I.preventDefault();l.fancybox[I.shiftKey?"prev":"next"]()}}}})}if(!a.showNavArrows){v.hide();i.hide();return}if((a.cyclic&&e.length>1)||d!==0){v.show()}if((a.cyclic&&e.length>1)||d!=(e.length-1)){i.show()}},_finish=function(){if(!l.support.opacity){z.css("filter",0);r.css("filter",0)}if(a.autoDimensions){z.css("height","auto")}r.css("height","auto");if(b&&b.length){H.show()}if(a.showCloseButton){w.show()}_set_navigation();if(a.hideOnContentClick){z.on("click",l.fancybox.close)}if(a.hideOnOverlayClick){B.on("click",l.fancybox.close)}if(a.autoResize){l(window).on("resize.fb",l.fancybox.resize)}if(a.centerOnScroll&&!s){l(window).on("scroll.fb",l.fancybox.center)}if(l.fn.mousewheel){r.on("mousewheel.fb",function(I,J){if(C){I.preventDefault()}else{if(a.type=="image"&&(l(I.target).outerHeight()==0||l(I.target).prop("scrollHeight")===l(I.target).outerHeight())){I.preventDefault();l.fancybox[J>0?"prev":"next"]()}}})}if(a.type=="iframe"){l('<iframe id="fancybox-frame" name="fancybox-frame'+new Date().getTime()+'"'+(navigator.userAgent.match(/msie [6]/i)?' allowtransparency="true""':"")+' style="border:0;margin:0;overflow:'+(y.scrolling=="auto"?"auto":(y.scrolling=="yes"?"scroll":"hidden"))+'" src="'+a.href+'"'+(false===a.allowfullscreen?"":" allowfullscreen")+' allow="autoplay; encrypted-media" tabindex="999"></iframe>').appendTo(z).load(function(){l.fancybox.hideActivity()}).focus()}r.show();C=false;l.fancybox.center();a.onComplete(e,d,a);if(e.length>1){_preload_next();_preload_prev()}},_preload_next=function(){var I=typeof arguments[0]=="number"?arguments[0]:d+1;if(I>=e.length){if(a.cyclic){I=0}else{return}}if(I==d){a.enableKeyboardNav=false;r.off("mousewheel.fb");i.hide();return}if(_preload_image(I)){return}else{_preload_next(I+1)}},_preload_prev=function(){var I=typeof arguments[0]=="number"?arguments[0]:d-1;if(I<0){if(a.cyclic){I=e.length-1}else{return}}if(I==d){a.enableKeyboardNav=false;r.off("mousewheel.fb");v.hide();return}if(_preload_image(I)){return}else{_preload_prev(I-1)}},_preload_image=function(K){var J,I=e[K];if(typeof I!=="undefined"&&typeof I.href!=="undefined"&&I.href!==a.href&&(I.href.match(u)||l(I).hasClass("image"))){J=new Image();J.src=I.href;return true}else{return false}},_draw=function(J){var I={width:parseInt(t.width+(n.width-t.width)*J,10),height:parseInt(t.height+(n.height-t.height)*J,10),top:parseInt(t.top+(n.top-t.top)*J,10),left:parseInt(t.left+(n.left-t.left)*J,10)};if(typeof n.opacity!=="undefined"){I.opacity=J<0.5?0.5:J}r.css(I);z.css({width:I.width-a.padding*2,height:I.height-(q*J)-a.padding*2})},_get_viewport=function(){var I=!s&&window.innerWidth&&document.documentElement.clientWidth?Math.min(window.innerWidth,document.documentElement.clientWidth):window.innerWidth||document.documentElement.clientWidth||document.getElementsByTagName("body")[0].clientWidth,J=!s&&window.innerHeight&&document.documentElement.clientHeight?Math.min(window.innerHeight,document.documentElement.clientHeight):window.innerHeight||document.documentElement.clientHeight||document.getElementsByTagName("body")[0].clientHeight;return[I-(a.margin*2),J-(a.margin*2),l(document).scrollLeft()+a.margin,l(document).scrollTop()+a.margin]},_get_zoom_to=function(){var I=_get_viewport(),L={},J=a.padding*2,K;if(a.width.toString().indexOf("%")>-1){L.width=parseInt((I[0]*parseFloat(a.width))/100,10)}else{L.width=a.width+J}if(a.height.toString().indexOf("%")>-1){L.height=parseInt((I[1]*parseFloat(a.height))/100,10)}else{L.height=a.height+J}if(a.autoScale&&(L.width>I[0]||L.height>I[1])){if(a.keepRatio){K=a.width/a.height;if((L.width)>I[0]){L.width=I[0];L.height=parseInt(((L.width-J)/K)+J,10)}if((L.height)>I[1]){L.height=I[1];L.width=parseInt(((L.height-J)*K)+J,10)}}else{L.width=Math.min(L.width,I[0]);L.height=Math.min(L.height,I[1])}}L.top=parseInt(Math.max(I[3]-20,I[3]+((I[1]-L.height-40)*0.5)),10);L.left=parseInt(Math.max(I[2]-20,I[2]+((I[0]-L.width-40)*0.5)),10);return L},_get_obj_pos=function(I){var J=I.offset();J.top+=parseInt(I.css("paddingTop"),10)||0;J.left+=parseInt(I.css("paddingLeft"),10)||0;J.top+=parseInt(I.css("border-top-width"),10)||0;J.left+=parseInt(I.css("border-left-width"),10)||0;J.width=I.width();J.height=I.height();return J},_get_zoom_from=function(){var L=y.orig?l(y.orig):false,K={},J,I;if(L&&L.length){J=_get_obj_pos(L);K={width:J.width+(a.padding*2),height:J.height+(a.padding*2),top:J.top-a.padding-20,left:J.left-a.padding-20}}else{I=_get_viewport();K={width:a.padding*2,height:a.padding*2,top:parseInt((I[3]+I[1])*0.5,10),left:parseInt((I[2]+I[0])*0.5,10)}}return K},_animate_loading=function(){if(!j.is(":visible")){clearInterval(m);return}l("div",j).css("top",(o*-40)+"px");o=(o+1)%12};l.fn.fancybox=function(I){if(!l(this).length){return this}l(this).data("fancybox",l.extend({},I,(l.metadata?l(this).metadata():{}))).off("click.fb").on("click.fb",function(K){K.preventDefault();if(C){return}C=true;l(this).blur();h=[];g=0;var J=l(this).attr("rel")||"";if(J==""||J.replace(/alternate|external|help|license|nofollow|noreferrer|noopener|\s+/gi,"")==""){h.push(this)}else{h=l('a[rel="'+J+'"], area[rel="'+J+'"]');g=h.index(this)}_start();return});return this};l.fancybox=function(L){var K;if(C){return}C=true;K=typeof arguments[1]!=="undefined"?arguments[1]:{};h=[];g=parseInt(K.index,10)||0;if(l.isArray(L)){for(var J=0,I=L.length;J<I;J++){if(typeof L[J]=="object"){l(L[J]).data("fancybox",l.extend({},K,L[J]))}else{L[J]=l({}).data("fancybox",l.extend({content:L[J]},K))}}h=jQuery.merge(h,L)}else{if(typeof L=="object"){l(L).data("fancybox",l.extend({},K,L))}else{L=l({}).data("fancybox",l.extend({content:L},K))}h.push(L)}if(g>h.length||g<0){g=0}_start()};l.fancybox.showActivity=function(){clearInterval(m);j.show();m=setInterval(_animate_loading,66)};l.fancybox.hideActivity=function(){j.hide()};l.fancybox.next=function(){var I,J=typeof arguments[0]=="number"?arguments[0]:d+1;if(J>=e.length){if(a.cyclic){J=0}else{return}}I=e[J];if(J!=d&&typeof I!=="undefined"&&typeof I.href!=="undefined"&&I.href===a.href){l.fancybox.next(J+1)}else{l.fancybox.pos(J)}return};l.fancybox.prev=function(){var I,J=typeof arguments[0]=="number"?arguments[0]:d-1;if(J<0){if(a.cyclic){J=e.length-1}else{return}}I=e[J];if(J!=d&&typeof I!=="undefined"&&typeof I.href!=="undefined"&&I.href===a.href){l.fancybox.prev(J-1)}else{l.fancybox.pos(J)}return};l.fancybox.pos=function(I){if(C){return}I=parseInt(I);h=e;if(I>-1&&I<e.length){g=I;_start()}return};l.fancybox.cancel=function(){if(C){return}C=true;l(".fancybox-inline-tmp").trigger("fancybox-cancel");_abort();y.onCancel(h,g,y);C=false};l.fancybox.close=function(){if(C||r.is(":hidden")){return}C=true;if(a&&false===a.onCleanup(e,d,a)){C=false;return}_abort();l(w.add(v).add(i)).hide();l(z.add(B)).off();l(window).off("orientationchange.fb resize.fb scroll.fb mousewheel.fb");l(document).off("keydown.fb");z.find("iframe#fancybox-frame").attr("src",x&&/^https/i.test(window.location.href||"")?"javascript:void(false)":"about:blank");if(a.titlePosition!=="inside"){H.empty()}r.stop();function I(){B.fadeOut("fast");H.empty().hide();r.hide();l(".fancybox-inline-tmp").trigger("fancybox-cleanup");z.empty();a.onClosed(e,d,a);e=y=[];d=g=0;a=y={};C=false}if(a.transitionOut=="elastic"){t=_get_zoom_from();var J=r.position();n={top:J.top,left:J.left,width:r.width(),height:r.height()};if(a.opacity){n.opacity=1}H.empty().hide();f.prop=1;l(f).animate({prop:0},{duration:a.speedOut,easing:a.easingOut,step:_draw,complete:I})}else{r.fadeOut(a.transitionOut=="none"?0:a.speedOut,I)}};l.fancybox.resize=function(){var I;clearTimeout(F);F=setTimeout(function(){var J=function(){if(y.autoDimensions){z.css("height","auto")}r.css("height","auto");if(b&&b.length){H.show()}C=false;l.fancybox.center(true)};if(B.is(":visible")){B.css("height",l(document).height())}I=r.position(),t={top:I.top,left:I.left,width:r.width(),height:r.height()};n=_get_zoom_to();C=true;_process_title();f.prop=0;l(f).animate({prop:1},{duration:a.changeSpeed,easing:a.easingChange,step:_draw,complete:J})},500)};l.fancybox.center=function(){var I,J;if(C){return}J=arguments[0]===true?1:0;I=_get_viewport();if(!J&&(r.width()>I[0]||r.height()>I[1])){return}r.stop().animate({top:parseInt(Math.max(I[3]-20,I[3]+((I[1]-z.height()-40)*0.5)-a.padding)),left:parseInt(Math.max(I[2]-20,I[2]+((I[0]-z.width()-40)*0.5)-a.padding))},typeof arguments[0]=="number"?arguments[0]:300)};l.fancybox.init=function(){if(l("#fancybox-wrap").length){return}l("body").append(D=l('<div id="fancybox-tmp"></div>'),j=l('<div id="fancybox-loading"><div></div></div>'),B=l('<div id="fancybox-overlay"></div>'),r=l('<div id="fancybox-wrap"></div>'));c=l('<div id="fancybox-outer"></div>').append('<div class="fancybox-bg" id="fancybox-bg-n"></div><div class="fancybox-bg" id="fancybox-bg-ne"></div><div class="fancybox-bg" id="fancybox-bg-e"></div><div class="fancybox-bg" id="fancybox-bg-se"></div><div class="fancybox-bg" id="fancybox-bg-s"></div><div class="fancybox-bg" id="fancybox-bg-sw"></div><div class="fancybox-bg" id="fancybox-bg-w"></div><div class="fancybox-bg" id="fancybox-bg-nw"></div>').appendTo(r);c.append(z=l('<div id="fancybox-content"></div>'),w=l('<a id="fancybox-close"></a>'),H=l('<div id="fancybox-title"></div>'),v=l('<a href="javascript:;" id="fancybox-left"><span class="fancy-ico" id="fancybox-left-ico"></span></a>'),i=l('<a href="javascript:;" id="fancybox-right"><span class="fancy-ico" id="fancybox-right-ico"></span></a>'));w.click(l.fancybox.close);j.click(l.fancybox.cancel);v.click(function(I){I.preventDefault();l.fancybox.prev()});i.click(function(I){I.preventDefault();l.fancybox.next()});if(!l.support.opacity){r.addClass("fancybox-ie")}if(x){j.addClass("fancybox-ie6");r.addClass("fancybox-ie6");l('<iframe id="fancybox-hide-sel-frame" src="'+(/^https/i.test(window.location.href||"")?"javascript:void(false)":"about:blank")+'" style="overflow:hidden;border:0" tabindex="-1"></iframe>').prependTo(c)}};l.fn.fancybox.defaults={padding:10,margin:40,opacity:false,modal:false,cyclic:false,allowfullscreen:false,scrolling:"auto",width:560,height:340,autoScale:true,autoDimensions:true,centerOnScroll:false,autoResize:true,keepRatio:false,minViewportWidth:0,ajax:{},swf:{wmode:"opaque"},svg:{wmode:"opaque"},hideOnOverlayClick:true,hideOnContentClick:false,overlayShow:true,overlayOpacity:0.7,overlayColor:"#777",titleShow:true,titlePosition:"float",titleFormat:null,titleFromAlt:true,transitionIn:"fade",transitionOut:"fade",speedIn:300,speedOut:300,changeSpeed:300,changeFade:"fast",easingIn:"swing",easingOut:"swing",showCloseButton:true,showNavArrows:true,enableEscapeButton:true,enableKeyboardNav:true,onStart:function(){},onCancel:function(){},onComplete:function(){},onCleanup:function(){},onClosed:function(){},onError:function(){}};l(document).ready(function(){l.fancybox.init()})})(jQuery);
|
inc/class-easyfancybox-options.php
CHANGED
@@ -9,7 +9,8 @@ class easyFancyBox_Options extends easyFancyBox {
|
|
9 |
|
10 |
$url = "https://premium.status301.net/downloads/easy-fancybox-pro/";
|
11 |
|
12 |
-
parent::$options
|
|
|
13 |
|
14 |
'Global' => array(
|
15 |
'title' => __('Global settings','easy-fancybox'),
|
@@ -426,7 +427,7 @@ class easyFancyBox_Options extends easyFancyBox {
|
|
426 |
'label_for' => 'fancybox_scriptPriority',
|
427 |
'input' => 'number',
|
428 |
'step' => '1',
|
429 |
-
'min' => '
|
430 |
'max' => '999',
|
431 |
'sanitize_callback' => 'intval',
|
432 |
'class' => 'small-text',
|
@@ -1255,8 +1256,8 @@ class easyFancyBox_Options extends easyFancyBox {
|
|
1255 |
'onStart' => array (
|
1256 |
'noquotes' => true,
|
1257 |
'default' => get_option( 'fancybox_YoutubenoCookie' ) ?
|
1258 |
-
'function(a,i,o){o.href=a[i].href.replace(
|
1259 |
-
'function(a,i,o){o.href=a[i].href.replace(
|
1260 |
)
|
1261 |
)
|
1262 |
),
|
@@ -1359,7 +1360,7 @@ class easyFancyBox_Options extends easyFancyBox {
|
|
1359 |
),
|
1360 |
'onStart' => array (
|
1361 |
'noquotes' => true,
|
1362 |
-
'default' => 'function(a,i,o){o.href=a[i].href.replace(
|
1363 |
)
|
1364 |
)
|
1365 |
),
|
@@ -1462,7 +1463,7 @@ class easyFancyBox_Options extends easyFancyBox {
|
|
1462 |
),
|
1463 |
'onStart' => array (
|
1464 |
'noquotes' => true,
|
1465 |
-
'default' => 'function(a,i,o){o.href=a[i].href.replace(
|
1466 |
)
|
1467 |
)
|
1468 |
),
|
9 |
|
10 |
$url = "https://premium.status301.net/downloads/easy-fancybox-pro/";
|
11 |
|
12 |
+
if ( empty(parent::$options) )
|
13 |
+
parent::$options = array (
|
14 |
|
15 |
'Global' => array(
|
16 |
'title' => __('Global settings','easy-fancybox'),
|
427 |
'label_for' => 'fancybox_scriptPriority',
|
428 |
'input' => 'number',
|
429 |
'step' => '1',
|
430 |
+
'min' => '-999',
|
431 |
'max' => '999',
|
432 |
'sanitize_callback' => 'intval',
|
433 |
'class' => 'small-text',
|
1256 |
'onStart' => array (
|
1257 |
'noquotes' => true,
|
1258 |
'default' => get_option( 'fancybox_YoutubenoCookie' ) ?
|
1259 |
+
'function(a,i,o){o.href=a[i].href.replace(/https?:\/\/youtu\.be/gi,"https://www.youtube-nocookie.com/embed").replace(/https?:\/\/(?:www\.)?youtube\.com\/watch\?(.*)v=([a-z0-9\_\-]+)(?:&|&|\?)?(.*)/gi,"https://www.youtube-nocookie.com/embed/$2?$1$3");var splitOn=o.href.indexOf("?");var urlParms=(splitOn>-1)?o.href.substring(splitOn):"";o.allowfullscreen=(urlParms.indexOf("fs=0")>-1)?false:true}' :
|
1260 |
+
'function(a,i,o){o.href=a[i].href.replace(/https?:\/\/youtu\.be/gi,"https://www.youtube.com/embed").replace(/https?:\/\/(?:www\.)?youtube\.com\/watch\?(.*)v=([a-z0-9\_\-]+)(?:&|&|\?)?(.*)/gi,"https://www.youtube.com/embed/$2?$1$3");var splitOn=o.href.indexOf("?");var urlParms=(splitOn>-1)?o.href.substring(splitOn):"";o.allowfullscreen=(urlParms.indexOf("fs=0")>-1)?false:true}'
|
1261 |
)
|
1262 |
)
|
1263 |
),
|
1360 |
),
|
1361 |
'onStart' => array (
|
1362 |
'noquotes' => true,
|
1363 |
+
'default' => 'function(a,i,o){o.href=a[i].href.replace(/https?:\/\/(?:www\.)?vimeo\.com\/([0-9]+)(?:&|&|\?)?(.*)/gi,"https://player.vimeo.com/video/$1?$2");var splitOn=o.href.indexOf("?");var urlParms=(splitOn>-1)?o.href.substring(splitOn):"";o.allowfullscreen=(urlParms.indexOf("fullscreen=0")>-1)?false:true}'
|
1364 |
)
|
1365 |
)
|
1366 |
),
|
1463 |
),
|
1464 |
'onStart' => array (
|
1465 |
'noquotes' => true,
|
1466 |
+
'default' => 'function(a,i,o){o.href=a[i].href.replace(/^https?:\/\/(?:www\.)dailymotion.com\/video\/(.*)/gi,"https://www.dailymotion.com/embed/video/$1");var splitOn=o.href.indexOf("?");var urlParms=(splitOn>-1)?o.href.substring(splitOn):"";o.allowfullscreen=(urlParms.indexOf("fullscreen=0")>-1)?false:true}'
|
1467 |
)
|
1468 |
)
|
1469 |
),
|
inc/class-easyfancybox.php
CHANGED
@@ -15,6 +15,8 @@ class easyFancyBox {
|
|
15 |
|
16 |
private static $inline_style_ie;
|
17 |
|
|
|
|
|
18 |
public static $onready_auto = false;
|
19 |
|
20 |
public static $add_scripts = false;
|
@@ -24,13 +26,12 @@ class easyFancyBox {
|
|
24 |
public static $events = array( 'post-load' );
|
25 |
|
26 |
/**********************
|
27 |
-
MAIN SCRIPT
|
28 |
**********************/
|
29 |
|
30 |
-
|
31 |
|
32 |
-
|
33 |
-
return;
|
34 |
|
35 |
// check for any enabled sections
|
36 |
foreach ( self::$options['Global']['options']['Enable']['options'] as $value )
|
@@ -41,7 +42,7 @@ class easyFancyBox {
|
|
41 |
|
42 |
// and abort when none are active
|
43 |
if ( !self::$add_scripts )
|
44 |
-
return;
|
45 |
|
46 |
// begin building output FancyBox settings
|
47 |
$script = 'var fb_timeout, fb_opts={';
|
@@ -248,32 +249,31 @@ var easy_fancybox_auto=function(){setTimeout(function(){jQuery(\'a[class*="'.$tr
|
|
248 |
|
249 |
// customized styles
|
250 |
$styles = '';
|
251 |
-
if ( isset($overlaySpotlight) && 'true' == $overlaySpotlight )
|
252 |
$styles .= '#fancybox-overlay{background-attachment:fixed;background-image:url("' . self::$plugin_url . 'images/light-mask.png");background-position:center;background-repeat:no-repeat;background-size:100% 100%}';
|
253 |
-
|
254 |
-
if ( !empty($borderRadius) )
|
255 |
$styles .= '#fancybox-outer,#fancybox-content{border-radius:'.$borderRadius.'px}.fancybox-title-inside{padding-top:'.$borderRadius.'px;margin-top:-'.$borderRadius.'px !important;border-radius: 0 0 '.$borderRadius.'px '.$borderRadius.'px}';
|
256 |
-
|
257 |
$content_style = '';
|
258 |
-
if ( !empty($backgroundColor) )
|
259 |
$content_style .= 'background:'.$backgroundColor.';';
|
260 |
-
|
261 |
-
if ( !empty($paddingColor) )
|
262 |
$content_style .= 'border-color:'.$paddingColor.';';
|
263 |
-
|
264 |
if ( !empty($textColor) ) {
|
265 |
$content_style .= 'color:'.$textColor.';';
|
266 |
$styles .= '#fancybox-outer{background:'.$paddingColor.'}'; //.fancybox-title-inside{background-color:'.$paddingColor.';margin-left:0 !important;margin-right:0 !important;width:100% !important;}
|
267 |
}
|
268 |
-
if ( !empty($content_style) )
|
269 |
$styles .= '#fancybox-content{'.$content_style.'}';
|
270 |
-
|
271 |
-
if ( !empty($titleColor) )
|
272 |
$styles .= '#fancybox-title,#fancybox-title-float-main{color:'.$titleColor.'}';
|
273 |
-
|
274 |
-
if ( !empty($styles) )
|
275 |
self::$inline_style = $styles;
|
276 |
-
}
|
277 |
|
278 |
// running our IE alphaimageloader relative path styles here
|
279 |
if ( isset($compatIE8) && 'true' == $compatIE8 ) {
|
@@ -300,8 +300,9 @@ var easy_fancybox_auto=function(){setTimeout(function(){jQuery(\'a[class*="'.$tr
|
|
300 |
if ( isset($overlaySpotlight) && 'true' == $overlaySpotlight )
|
301 |
self::$inline_style_ie .= '
|
302 |
#fancybox-overlay{filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src="'.self::$plugin_url.'images/light-mask.png",sizingMethod="scale")}';
|
303 |
-
|
304 |
}
|
|
|
|
|
305 |
}
|
306 |
|
307 |
/***********************
|
@@ -309,12 +310,13 @@ var easy_fancybox_auto=function(){setTimeout(function(){jQuery(\'a[class*="'.$tr
|
|
309 |
***********************/
|
310 |
|
311 |
public static function enqueue_scripts() {
|
|
|
312 |
// make sure whe actually need to do anything
|
313 |
if ( !self::$add_scripts )
|
314 |
return;
|
315 |
|
316 |
global $wp_styles;
|
317 |
-
$min = ( defined('WP_DEBUG') &&
|
318 |
|
319 |
// ENQUEUE STYLE
|
320 |
wp_enqueue_style( 'fancybox', self::$plugin_url.'fancybox/jquery.fancybox'.$min.'.css', false, FANCYBOX_VERSION, 'screen' );
|
@@ -324,8 +326,8 @@ var easy_fancybox_auto=function(){setTimeout(function(){jQuery(\'a[class*="'.$tr
|
|
324 |
}
|
325 |
|
326 |
// ENQUEUE SCRIPTS
|
327 |
-
$footer = get_option( 'fancybox_noFooter', false ) ? false : true;
|
328 |
$dep = get_option( 'fancybox_nojQuery', false ) ? array() : array('jquery');
|
|
|
329 |
|
330 |
// register main fancybox script
|
331 |
wp_enqueue_script( 'jquery-fancybox', self::$plugin_url.'fancybox/jquery.fancybox'.$min.'.js', $dep, FANCYBOX_VERSION, $footer );
|
@@ -361,13 +363,12 @@ var easy_fancybox_auto=function(){setTimeout(function(){jQuery(\'a[class*="'.$tr
|
|
361 |
|
362 |
if ( get_option( 'fancybox_pre45Compat', false ) || !function_exists( 'wp_add_inline_script' ) ) {
|
363 |
// do it the old way
|
364 |
-
$priority = intval( get_option( 'fancybox_scriptPriority', 10 ) ) + 1;
|
365 |
if ( !empty(self::$inline_style) )
|
366 |
add_action( 'wp_head', array(__CLASS__, 'print_inline_style'), 11 );
|
367 |
if ( !empty(self::$inline_style_ie) )
|
368 |
add_action( 'wp_head', array(__CLASS__, 'print_inline_style_ie'), 12 );
|
369 |
if ( !empty(self::$inline_script) )
|
370 |
-
add_action( $footer ? 'wp_footer' : 'wp_head', array(__CLASS__, 'print_inline_script'),
|
371 |
} else {
|
372 |
if ( !empty(self::$inline_style) )
|
373 |
wp_add_inline_style( 'fancybox', self::$inline_style );
|
@@ -376,6 +377,8 @@ var easy_fancybox_auto=function(){setTimeout(function(){jQuery(\'a[class*="'.$tr
|
|
376 |
if ( !empty(self::$inline_script) )
|
377 |
wp_add_inline_script( 'jquery-fancybox', self::$inline_script );
|
378 |
}
|
|
|
|
|
379 |
}
|
380 |
|
381 |
// fallback methods for WordPress pre-4.5
|
@@ -430,21 +433,19 @@ var easy_fancybox_auto=function(){setTimeout(function(){jQuery(\'a[class*="'.$tr
|
|
430 |
public static function init() {
|
431 |
$version = get_option('easy_fancybox_version', 0);
|
432 |
|
433 |
-
if ( version_compare( EASY_FANCYBOX_VERSION, $version, '>' ) )
|
434 |
self::upgrade($version);
|
435 |
-
}
|
436 |
-
|
437 |
-
easyFancyBox_Options::load_defaults();
|
438 |
-
|
439 |
-
$priority = intval( get_option( 'fancybox_scriptPriority', 11 ) );
|
440 |
|
441 |
-
//
|
442 |
-
|
443 |
-
|
|
|
444 |
|
445 |
-
|
446 |
-
|
447 |
-
|
|
|
|
|
448 |
}
|
449 |
|
450 |
/**********************
|
@@ -458,6 +459,7 @@ var easy_fancybox_auto=function(){setTimeout(function(){jQuery(\'a[class*="'.$tr
|
|
458 |
|
459 |
require_once dirname(__FILE__) . '/class-easyfancybox-options.php';
|
460 |
|
461 |
-
add_action( '
|
|
|
462 |
}
|
463 |
}
|
15 |
|
16 |
private static $inline_style_ie;
|
17 |
|
18 |
+
public static $priority = 10;
|
19 |
+
|
20 |
public static $onready_auto = false;
|
21 |
|
22 |
public static $add_scripts = false;
|
26 |
public static $events = array( 'post-load' );
|
27 |
|
28 |
/**********************
|
29 |
+
MAIN INLINE SCRIPT
|
30 |
**********************/
|
31 |
|
32 |
+
private static function main() {
|
33 |
|
34 |
+
easyFancyBox_Options::load_defaults();
|
|
|
35 |
|
36 |
// check for any enabled sections
|
37 |
foreach ( self::$options['Global']['options']['Enable']['options'] as $value )
|
42 |
|
43 |
// and abort when none are active
|
44 |
if ( !self::$add_scripts )
|
45 |
+
return false;
|
46 |
|
47 |
// begin building output FancyBox settings
|
48 |
$script = 'var fb_timeout, fb_opts={';
|
249 |
|
250 |
// customized styles
|
251 |
$styles = '';
|
252 |
+
if ( isset($overlaySpotlight) && 'true' == $overlaySpotlight )
|
253 |
$styles .= '#fancybox-overlay{background-attachment:fixed;background-image:url("' . self::$plugin_url . 'images/light-mask.png");background-position:center;background-repeat:no-repeat;background-size:100% 100%}';
|
254 |
+
|
255 |
+
if ( !empty($borderRadius) )
|
256 |
$styles .= '#fancybox-outer,#fancybox-content{border-radius:'.$borderRadius.'px}.fancybox-title-inside{padding-top:'.$borderRadius.'px;margin-top:-'.$borderRadius.'px !important;border-radius: 0 0 '.$borderRadius.'px '.$borderRadius.'px}';
|
257 |
+
|
258 |
$content_style = '';
|
259 |
+
if ( !empty($backgroundColor) )
|
260 |
$content_style .= 'background:'.$backgroundColor.';';
|
261 |
+
|
262 |
+
if ( !empty($paddingColor) )
|
263 |
$content_style .= 'border-color:'.$paddingColor.';';
|
264 |
+
|
265 |
if ( !empty($textColor) ) {
|
266 |
$content_style .= 'color:'.$textColor.';';
|
267 |
$styles .= '#fancybox-outer{background:'.$paddingColor.'}'; //.fancybox-title-inside{background-color:'.$paddingColor.';margin-left:0 !important;margin-right:0 !important;width:100% !important;}
|
268 |
}
|
269 |
+
if ( !empty($content_style) )
|
270 |
$styles .= '#fancybox-content{'.$content_style.'}';
|
271 |
+
|
272 |
+
if ( !empty($titleColor) )
|
273 |
$styles .= '#fancybox-title,#fancybox-title-float-main{color:'.$titleColor.'}';
|
274 |
+
|
275 |
+
if ( !empty($styles) )
|
276 |
self::$inline_style = $styles;
|
|
|
277 |
|
278 |
// running our IE alphaimageloader relative path styles here
|
279 |
if ( isset($compatIE8) && 'true' == $compatIE8 ) {
|
300 |
if ( isset($overlaySpotlight) && 'true' == $overlaySpotlight )
|
301 |
self::$inline_style_ie .= '
|
302 |
#fancybox-overlay{filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src="'.self::$plugin_url.'images/light-mask.png",sizingMethod="scale")}';
|
|
|
303 |
}
|
304 |
+
|
305 |
+
return true;
|
306 |
}
|
307 |
|
308 |
/***********************
|
310 |
***********************/
|
311 |
|
312 |
public static function enqueue_scripts() {
|
313 |
+
|
314 |
// make sure whe actually need to do anything
|
315 |
if ( !self::$add_scripts )
|
316 |
return;
|
317 |
|
318 |
global $wp_styles;
|
319 |
+
$min = ( defined('WP_DEBUG') && WP_DEBUG ) ? '' : '.min';
|
320 |
|
321 |
// ENQUEUE STYLE
|
322 |
wp_enqueue_style( 'fancybox', self::$plugin_url.'fancybox/jquery.fancybox'.$min.'.css', false, FANCYBOX_VERSION, 'screen' );
|
326 |
}
|
327 |
|
328 |
// ENQUEUE SCRIPTS
|
|
|
329 |
$dep = get_option( 'fancybox_nojQuery', false ) ? array() : array('jquery');
|
330 |
+
$footer = get_option( 'fancybox_noFooter', false ) ? false : true;
|
331 |
|
332 |
// register main fancybox script
|
333 |
wp_enqueue_script( 'jquery-fancybox', self::$plugin_url.'fancybox/jquery.fancybox'.$min.'.js', $dep, FANCYBOX_VERSION, $footer );
|
363 |
|
364 |
if ( get_option( 'fancybox_pre45Compat', false ) || !function_exists( 'wp_add_inline_script' ) ) {
|
365 |
// do it the old way
|
|
|
366 |
if ( !empty(self::$inline_style) )
|
367 |
add_action( 'wp_head', array(__CLASS__, 'print_inline_style'), 11 );
|
368 |
if ( !empty(self::$inline_style_ie) )
|
369 |
add_action( 'wp_head', array(__CLASS__, 'print_inline_style_ie'), 12 );
|
370 |
if ( !empty(self::$inline_script) )
|
371 |
+
add_action( $footer ? 'wp_footer' : 'wp_head', array(__CLASS__, 'print_inline_script'), self::$priority + 1 );
|
372 |
} else {
|
373 |
if ( !empty(self::$inline_style) )
|
374 |
wp_add_inline_style( 'fancybox', self::$inline_style );
|
377 |
if ( !empty(self::$inline_script) )
|
378 |
wp_add_inline_script( 'jquery-fancybox', self::$inline_script );
|
379 |
}
|
380 |
+
|
381 |
+
do_action( 'easy_fancybox_enqueue_scripts', array($min,$dep,$footer) );
|
382 |
}
|
383 |
|
384 |
// fallback methods for WordPress pre-4.5
|
433 |
public static function init() {
|
434 |
$version = get_option('easy_fancybox_version', 0);
|
435 |
|
436 |
+
if ( version_compare( EASY_FANCYBOX_VERSION, $version, '>' ) )
|
437 |
self::upgrade($version);
|
|
|
|
|
|
|
|
|
|
|
438 |
|
439 |
+
// Treat settings and prepare inline scripts and styles, or log debug message
|
440 |
+
if ( self::main() ) {
|
441 |
+
$priority = get_option( 'fancybox_scriptPriority' );
|
442 |
+
if ( is_numeric($priority) ) self::$priority = $priority;
|
443 |
|
444 |
+
add_action( 'wp_enqueue_scripts', array(__CLASS__,'enqueue_scripts'), self::$priority );
|
445 |
+
add_filter( 'embed_oembed_html', array(__CLASS__,'add_video_wmode_opaque'), 10, 3 );
|
446 |
+
} elseif ( defined('WP_DEBUG') && WP_DEBUG ) {
|
447 |
+
error_log('No active Easy FancyBox media types set.');
|
448 |
+
}
|
449 |
}
|
450 |
|
451 |
/**********************
|
459 |
|
460 |
require_once dirname(__FILE__) . '/class-easyfancybox-options.php';
|
461 |
|
462 |
+
add_action( 'init', array(__CLASS__, 'init'), 9 );
|
463 |
+
add_filter( 'easy_fancybox_inline_script', array(__CLASS__,'onready_callback') );
|
464 |
}
|
465 |
}
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=ravan
|
|
4 |
Tags: fancybox, lightbox, gallery, image, photo, video, flash, overlay, youtube, vimeo, dailymotion, pdf, svg, iframe, swf, jquery, webp
|
5 |
Requires at least: 3.3
|
6 |
Tested up to: 4.9
|
7 |
-
Stable tag: 1.8
|
8 |
|
9 |
Easily enable the FancyBox jQuery extension on just about all media links. Multi-Site compatible. Supports iFrame and Flash movies.
|
10 |
|
@@ -56,7 +56,7 @@ Visit [FancyBox](http://fancybox.net/) for more information and examples.
|
|
56 |
- Priority support on dedicated forum
|
57 |
- Slideshow effect for galleries (autorotation)
|
58 |
- Spotlight effect for the light box overlay
|
59 |
-
-
|
60 |
- More styling options: rounded corners, inline content background and text colors
|
61 |
- More automatic popup options: triggered by URL hash, first link by media type, hide popup after first visit
|
62 |
- Pass dedicated light box setting per media link via link class (see [Metadata instructions in the FAQs](https://wordpress.org/plugins/easy-fancybox#how%20do%20i%20show%20content%20with%20different%20sizes%3F))
|
@@ -78,7 +78,7 @@ If you wish to help build this plugin, you're very welcome to [translate Easy Fa
|
|
78 |
|
79 |
= Wordpress =
|
80 |
|
81 |
-
Quick installation: [Install now](
|
82 |
|
83 |
… OR …
|
84 |
|
@@ -126,12 +126,12 @@ The same thing goes for WordPress Galleries. Choose **Link To: Media File** when
|
|
126 |
|
127 |
= Where is the settings page? =
|
128 |
|
129 |
-
There is no new settings page but there are many options you can change. You will find a new **FancyBox** section on **Settings > Media**. To see the default, check out the example under [Screenshots](
|
130 |
|
131 |
|
132 |
= Help! It does not work... =
|
133 |
|
134 |
-
Please follow the trouble shooting steps near the end of the plugin description above to determine the cause. If that fails, ask for support on the [Easy FancyBox WordPress forum](
|
135 |
|
136 |
|
137 |
= ADVANCED =
|
@@ -205,7 +205,7 @@ General steps:
|
|
205 |
1. Use imagebrowser effect: No
|
206 |
1. Add hidden images: Yes
|
207 |
|
208 |
-
**C.** Optional: add the following new CSS rule to your theme stylesheet (or install [Custom CSS](
|
209 |
`
|
210 |
.ngg-navigation {
|
211 |
display:none;
|
@@ -220,7 +220,7 @@ If you have disabled Auto-detection, give the link a class attribute like `class
|
|
220 |
|
221 |
Both YouTube and Vimeo movies can be made to play immediately after opening by adding the paramer `autoplay=1` to the URL. For example, a short-url YouTube link that should play in HD mode, have the full screen button and auto-start on open, would look like:
|
222 |
`
|
223 |
-
<a href="
|
224 |
`
|
225 |
|
226 |
|
@@ -260,24 +260,24 @@ This script snippet will scan the image titles and if it finds a Youtube URL the
|
|
260 |
|
261 |
You could do this manually by uploading individual thumbnails that you can retrieve by using the unique movie ID in these URLs for three different sizes:
|
262 |
`
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
`
|
267 |
Other locations might be
|
268 |
`
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
etc...
|
275 |
|
276 |
`
|
277 |
|
278 |
But an easier method is this one, shared by Shashank Shekhar (thanks!) :
|
279 |
|
280 |
-
To create Youtube thumbnail galleries, install
|
281 |
|
282 |
|
283 |
= Can I display web pages or HTML files in a FancyBox overlay? =
|
@@ -305,7 +305,7 @@ If you don't have *Auto-detect* checked under **SWF** on Settings > Media admin
|
|
305 |
|
306 |
FancyBox tries to detect the size of the content automatically but if it can not find a size, it will default to the settings for that particular content type as set on the Settings > Media page.
|
307 |
|
308 |
-
The **[Pro extension](
|
309 |
|
310 |
For example, a Flash movie with different size:
|
311 |
|
@@ -414,6 +414,7 @@ You can trigger the event like this:
|
|
414 |
`
|
415 |
jQuery(document.body).trigger('post-load');
|
416 |
`
|
|
|
417 |
Note: It completely depends on the AJAX script where this code snippet should be placed. Optimally, right _after_ the DOM modification where content is added or modified. In most cases at the end of the AJAX Success handler.
|
418 |
|
419 |
|
@@ -447,7 +448,7 @@ Yes. Designed to work with **Network Activate** and does not require manual acti
|
|
447 |
- The **Mystique** theme has two options called "Lightbox" and "Optimize website for faster loading" that will break Easy FancyBox. Disable both in Mystique's options > Advanced.
|
448 |
- **Imbalance** and other themes that uses the Photo Galleria jQuery extension: turn of the JSGallery option.
|
449 |
- Themes like **Envisioned**, **Chameleon** and many others have FancyBox baked in. There is no solution other than stripping the theme of all FancyBox related code or better: disable the plugin and use the theme provided version...
|
450 |
-
- Themes based on the **Thesis** framework might see issues in IE 8, for which [a hack has been proposed](
|
451 |
|
452 |
|
453 |
= Other =
|
@@ -496,12 +497,21 @@ If you still do not get to see your images in FancyBox, ask on the [Easy FancyBo
|
|
496 |
|
497 |
== Upgrade Notice ==
|
498 |
|
499 |
-
= 1.8 =
|
500 |
-
|
501 |
|
502 |
|
503 |
== Changelog ==
|
504 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
505 |
= 1.8 =
|
506 |
* NEW: Google Docs Viewer for PDF
|
507 |
* NEW: Youtube privacy-enhanced embed
|
4 |
Tags: fancybox, lightbox, gallery, image, photo, video, flash, overlay, youtube, vimeo, dailymotion, pdf, svg, iframe, swf, jquery, webp
|
5 |
Requires at least: 3.3
|
6 |
Tested up to: 4.9
|
7 |
+
Stable tag: 1.8.2
|
8 |
|
9 |
Easily enable the FancyBox jQuery extension on just about all media links. Multi-Site compatible. Supports iFrame and Flash movies.
|
10 |
|
56 |
- Priority support on dedicated forum
|
57 |
- Slideshow effect for galleries (autorotation)
|
58 |
- Spotlight effect for the light box overlay
|
59 |
+
- FacetWP, Gravity Forms and TablePress compatibility
|
60 |
- More styling options: rounded corners, inline content background and text colors
|
61 |
- More automatic popup options: triggered by URL hash, first link by media type, hide popup after first visit
|
62 |
- Pass dedicated light box setting per media link via link class (see [Metadata instructions in the FAQs](https://wordpress.org/plugins/easy-fancybox#how%20do%20i%20show%20content%20with%20different%20sizes%3F))
|
78 |
|
79 |
= Wordpress =
|
80 |
|
81 |
+
Quick installation: [Install now](https://coveredwebservices.com/wp-plugin-install/?plugin=easy-fancybox) !
|
82 |
|
83 |
… OR …
|
84 |
|
126 |
|
127 |
= Where is the settings page? =
|
128 |
|
129 |
+
There is no new settings page but there are many options you can change. You will find a new **FancyBox** section on **Settings > Media**. To see the default, check out the example under [Screenshots](https://wordpress.org/plugins/easy-fancybox/screenshots/) ...
|
130 |
|
131 |
|
132 |
= Help! It does not work... =
|
133 |
|
134 |
+
Please follow the trouble shooting steps near the end of the plugin description above to determine the cause. If that fails, ask for support on the [Easy FancyBox WordPress forum](https://wordpress.org/support/plugin/easy-fancybox) or go to the [development site](https://status301.net/wordpress-plugins/easy-fancybox/)
|
135 |
|
136 |
|
137 |
= ADVANCED =
|
205 |
1. Use imagebrowser effect: No
|
206 |
1. Add hidden images: Yes
|
207 |
|
208 |
+
**C.** Optional: add the following new CSS rule to your theme stylesheet (or install [Custom CSS](https://wordpress.org/plugins/safecss/) or [Jetpack](https://wordpress.org/plugins/jetpack/) and add it on the new Appearance > Edit CSS admin page) to hide the page browsing links below the gallery thumbnail.
|
209 |
`
|
210 |
.ngg-navigation {
|
211 |
display:none;
|
220 |
|
221 |
Both YouTube and Vimeo movies can be made to play immediately after opening by adding the paramer `autoplay=1` to the URL. For example, a short-url YouTube link that should play in HD mode, have the full screen button and auto-start on open, would look like:
|
222 |
`
|
223 |
+
<a href="https://youtu.be/N_tONWXYviM?hd=1&fs=1&autoplay=1">text or thumbnail</a>
|
224 |
`
|
225 |
|
226 |
|
260 |
|
261 |
You could do this manually by uploading individual thumbnails that you can retrieve by using the unique movie ID in these URLs for three different sizes:
|
262 |
`
|
263 |
+
https://img.youtube.com/vi/UNIQUE-MOVIE-ID/default.jpg
|
264 |
+
https://img.youtube.com/vi/UNIQUE-MOVIE-ID/mqdefault.jpg
|
265 |
+
https://img.youtube.com/vi/UNIQUE-MOVIE-ID/hqdefault.jpg
|
266 |
`
|
267 |
Other locations might be
|
268 |
`
|
269 |
+
https://img.youtube.com/vi/UNIQUE-MOVIE-ID/0.jpg (same as hqdefault.jpg)
|
270 |
+
https://img.youtube.com/vi/UNIQUE-MOVIE-ID/1.jpg
|
271 |
+
https://img.youtube.com/vi/UNIQUE-MOVIE-ID/2.jpg
|
272 |
+
https://img.youtube.com/vi/UNIQUE-MOVIE-ID/3.jpg
|
273 |
+
https://img.youtube.com/vi_webp/UNIQUE-MOVIE-ID/0.webp (same as hqdefault.webp)
|
274 |
etc...
|
275 |
|
276 |
`
|
277 |
|
278 |
But an easier method is this one, shared by Shashank Shekhar (thanks!) :
|
279 |
|
280 |
+
To create Youtube thumbnail galleries, install https://wordpress.org/plugins/youtube-simplegallery/ and set the 'Effect' option to fancybox. Then disable Youtube autodetection on Settings > Media.
|
281 |
|
282 |
|
283 |
= Can I display web pages or HTML files in a FancyBox overlay? =
|
305 |
|
306 |
FancyBox tries to detect the size of the content automatically but if it can not find a size, it will default to the settings for that particular content type as set on the Settings > Media page.
|
307 |
|
308 |
+
The **[Pro extension](https://premium.status301.net/downloads/easy-fancybox-pro/)** provides an extra option to allow you to manually override this by defining the width and height wrapped in curly braces in the class attribute of the link itself. Make sure the option "Include the Metadata jQuery extension script..." under FancyBox | Links on Settings > Media is enabled.
|
309 |
|
310 |
For example, a Flash movie with different size:
|
311 |
|
414 |
`
|
415 |
jQuery(document.body).trigger('post-load');
|
416 |
`
|
417 |
+
|
418 |
Note: It completely depends on the AJAX script where this code snippet should be placed. Optimally, right _after_ the DOM modification where content is added or modified. In most cases at the end of the AJAX Success handler.
|
419 |
|
420 |
|
448 |
- The **Mystique** theme has two options called "Lightbox" and "Optimize website for faster loading" that will break Easy FancyBox. Disable both in Mystique's options > Advanced.
|
449 |
- **Imbalance** and other themes that uses the Photo Galleria jQuery extension: turn of the JSGallery option.
|
450 |
- Themes like **Envisioned**, **Chameleon** and many others have FancyBox baked in. There is no solution other than stripping the theme of all FancyBox related code or better: disable the plugin and use the theme provided version...
|
451 |
+
- Themes based on the **Thesis** framework might see issues in IE 8, for which [a hack has been proposed](https://voidzonemedia.com/solutions/thesis-ie8-remove-ie7-emulation/)
|
452 |
|
453 |
|
454 |
= Other =
|
497 |
|
498 |
== Upgrade Notice ==
|
499 |
|
500 |
+
= 1.8.2 =
|
501 |
+
Bugfix release: video autoplay and https; default enqueue priority; possible max stack reached by image preloader.
|
502 |
|
503 |
|
504 |
== Changelog ==
|
505 |
|
506 |
+
= 1.8.2 =
|
507 |
+
* FIX: main method not returning true in some cases
|
508 |
+
* Force all hosted video to https
|
509 |
+
* FIX: video iframe needs allow="autoplay" on modern browsers
|
510 |
+
* FIX: default enqueue priority not 10
|
511 |
+
* FIX: possible infinite loop in prev/next and image preloader
|
512 |
+
* Move main method (back) to init, position 9
|
513 |
+
* Introducing easy_fancybox_enqueue_scripts action hook
|
514 |
+
|
515 |
= 1.8 =
|
516 |
* NEW: Google Docs Viewer for PDF
|
517 |
* NEW: Youtube privacy-enhanced embed
|