Version Description
= 3.0.5 = Fixes the Revert options button and wrong version number on settings page. Also updates links in settings page and readme file.
Download this release
Release Info
| Developer | giucu91 |
| Plugin | |
| Version | 3.3.2 |
| Comparing to | |
| See all releases | |
Code changes from version 3.3.1 to 3.3.2
- assets/js/jquery.fancybox.js +417 -399
- fancybox.php +5 -3
- readme.txt +7 -3
assets/js/jquery.fancybox.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
| 1 |
// ==================================================
|
| 2 |
-
// fancyBox v3.5.
|
| 3 |
//
|
| 4 |
// Licensed GPLv3 for open source use
|
| 5 |
// or fancyBox Commercial License for commercial use
|
| 6 |
//
|
| 7 |
// http://fancyapps.com/fancybox/
|
| 8 |
-
// Copyright
|
| 9 |
//
|
| 10 |
// ==================================================
|
| 11 |
-
(function(window, document, $, undefined) {
|
| 12 |
"use strict";
|
| 13 |
|
| 14 |
window.console = window.console || {
|
| 15 |
-
info: function(stuff) {}
|
| 16 |
};
|
| 17 |
|
| 18 |
// If there's no jQuery, fancyBox can't work
|
|
@@ -110,8 +110,7 @@
|
|
| 110 |
|
| 111 |
iframe: {
|
| 112 |
// Iframe template
|
| 113 |
-
tpl:
|
| 114 |
-
'<iframe id="fancybox-frame{rnd}" name="fancybox-frame{rnd}" class="fancybox-iframe" allowfullscreen allow="autoplay; fullscreen" src=""></iframe>',
|
| 115 |
|
| 116 |
// Preload iframe before displaying it
|
| 117 |
// This allows to calculate iframe content width and height
|
|
@@ -130,8 +129,7 @@
|
|
| 130 |
|
| 131 |
// For HTML5 video only
|
| 132 |
video: {
|
| 133 |
-
tpl:
|
| 134 |
-
'<video class="fancybox-video" controls controlsList="nodownload" poster="{{poster}}">' +
|
| 135 |
'<source src="{{src}}" type="{{format}}" />' +
|
| 136 |
'Sorry, your browser doesn\'t support embedded videos, <a href="{{src}}">download</a> and watch with your favorite video player!' +
|
| 137 |
"</video>",
|
|
@@ -181,15 +179,14 @@
|
|
| 181 |
baseClass: "",
|
| 182 |
|
| 183 |
// Base template for layout
|
| 184 |
-
baseTpl:
|
| 185 |
-
'<div class="fancybox-container" role="dialog" tabindex="-1">' +
|
| 186 |
'<div class="fancybox-bg"></div>' +
|
| 187 |
'<div class="fancybox-inner">' +
|
| 188 |
'<div class="fancybox-infobar"><span data-fancybox-index></span> / <span data-fancybox-count></span></div>' +
|
| 189 |
'<div class="fancybox-toolbar">{{buttons}}</div>' +
|
| 190 |
'<div class="fancybox-navigation">{{arrows}}</div>' +
|
| 191 |
'<div class="fancybox-stage"></div>' +
|
| 192 |
-
'<div class="fancybox-caption"></div>' +
|
| 193 |
"</div>" +
|
| 194 |
"</div>",
|
| 195 |
|
|
@@ -200,36 +197,30 @@
|
|
| 200 |
errorTpl: '<div class="fancybox-error"><p>{{ERROR}}</p></div>',
|
| 201 |
|
| 202 |
btnTpl: {
|
| 203 |
-
download:
|
| 204 |
-
'<a download data-fancybox-download class="fancybox-button fancybox-button--download" title="{{DOWNLOAD}}" href="javascript:;">' +
|
| 205 |
'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M18.62 17.09V19H5.38v-1.91zm-2.97-6.96L17 11.45l-5 4.87-5-4.87 1.36-1.32 2.68 2.64V5h1.92v7.77z"/></svg>' +
|
| 206 |
"</a>",
|
| 207 |
|
| 208 |
-
zoom:
|
| 209 |
-
'<button data-fancybox-zoom class="fancybox-button fancybox-button--zoom" title="{{ZOOM}}">' +
|
| 210 |
'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M18.7 17.3l-3-3a5.9 5.9 0 0 0-.6-7.6 5.9 5.9 0 0 0-8.4 0 5.9 5.9 0 0 0 0 8.4 5.9 5.9 0 0 0 7.7.7l3 3a1 1 0 0 0 1.3 0c.4-.5.4-1 0-1.5zM8.1 13.8a4 4 0 0 1 0-5.7 4 4 0 0 1 5.7 0 4 4 0 0 1 0 5.7 4 4 0 0 1-5.7 0z"/></svg>' +
|
| 211 |
"</button>",
|
| 212 |
|
| 213 |
-
close:
|
| 214 |
-
'<button data-fancybox-close class="fancybox-button fancybox-button--close" title="{{CLOSE}}">' +
|
| 215 |
'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 10.6L6.6 5.2 5.2 6.6l5.4 5.4-5.4 5.4 1.4 1.4 5.4-5.4 5.4 5.4 1.4-1.4-5.4-5.4 5.4-5.4-1.4-1.4-5.4 5.4z"/></svg>' +
|
| 216 |
"</button>",
|
| 217 |
|
| 218 |
// Arrows
|
| 219 |
-
arrowLeft:
|
| 220 |
-
'<button data-fancybox-prev class="fancybox-button fancybox-button--arrow_left" title="{{PREV}}">' +
|
| 221 |
'<div><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M11.28 15.7l-1.34 1.37L5 12l4.94-5.07 1.34 1.38-2.68 2.72H19v1.94H8.6z"/></svg></div>' +
|
| 222 |
"</button>",
|
| 223 |
|
| 224 |
-
arrowRight:
|
| 225 |
-
'<button data-fancybox-next class="fancybox-button fancybox-button--arrow_right" title="{{NEXT}}">' +
|
| 226 |
'<div><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M15.4 12.97l-2.68 2.72 1.34 1.38L19 12l-4.94-5.07-1.34 1.38 2.68 2.72H5v1.94z"/></svg></div>' +
|
| 227 |
"</button>",
|
| 228 |
|
| 229 |
// This small close button will be appended to your html/inline/ajax content by default,
|
| 230 |
// if "smallBtn" option is not set to false
|
| 231 |
-
smallBtn:
|
| 232 |
-
'<button type="button" data-fancybox-close class="fancybox-button fancybox-close-small" title="{{CLOSE}}">' +
|
| 233 |
'<svg xmlns="http://www.w3.org/2000/svg" version="1" viewBox="0 0 24 24"><path d="M13 12l5-5-1-1-5 5-5-5-1 1 5 5-5 5 1 1 5-5 5 5 1-1z"/></svg>' +
|
| 234 |
"</button>"
|
| 235 |
},
|
|
@@ -339,7 +330,7 @@
|
|
| 339 |
// false - do nothing
|
| 340 |
|
| 341 |
// Clicked on the content
|
| 342 |
-
clickContent: function(current, event) {
|
| 343 |
return current.type === "image" ? "zoom" : false;
|
| 344 |
},
|
| 345 |
|
|
@@ -361,16 +352,16 @@
|
|
| 361 |
mobile: {
|
| 362 |
preventCaptionOverlap: false,
|
| 363 |
idleTime: false,
|
| 364 |
-
clickContent: function(current, event) {
|
| 365 |
return current.type === "image" ? "toggleControls" : false;
|
| 366 |
},
|
| 367 |
-
clickSlide: function(current, event) {
|
| 368 |
return current.type === "image" ? "toggleControls" : "close";
|
| 369 |
},
|
| 370 |
-
dblclickContent: function(current, event) {
|
| 371 |
return current.type === "image" ? "zoom" : false;
|
| 372 |
},
|
| 373 |
-
dblclickSlide: function(current, event) {
|
| 374 |
return current.type === "image" ? "zoom" : false;
|
| 375 |
}
|
| 376 |
},
|
|
@@ -394,17 +385,17 @@
|
|
| 394 |
ZOOM: "Zoom"
|
| 395 |
},
|
| 396 |
de: {
|
| 397 |
-
CLOSE: "
|
| 398 |
NEXT: "Weiter",
|
| 399 |
-
PREV: "
|
| 400 |
-
ERROR: "Die angeforderten Daten konnten nicht geladen werden. <br/> Bitte versuchen Sie es
|
| 401 |
PLAY_START: "Diaschau starten",
|
| 402 |
PLAY_STOP: "Diaschau beenden",
|
| 403 |
FULL_SCREEN: "Vollbild",
|
| 404 |
THUMBS: "Vorschaubilder",
|
| 405 |
DOWNLOAD: "Herunterladen",
|
| 406 |
SHARE: "Teilen",
|
| 407 |
-
ZOOM: "
|
| 408 |
}
|
| 409 |
}
|
| 410 |
};
|
|
@@ -419,32 +410,32 @@
|
|
| 419 |
|
| 420 |
// Check if an object is a jQuery object and not a native JavaScript object
|
| 421 |
// ========================================================================
|
| 422 |
-
var isQuery = function(obj) {
|
| 423 |
return obj && obj.hasOwnProperty && obj instanceof $;
|
| 424 |
};
|
| 425 |
|
| 426 |
// Handle multiple browsers for "requestAnimationFrame" and "cancelAnimationFrame"
|
| 427 |
// ===============================================================================
|
| 428 |
-
var requestAFrame = (function() {
|
| 429 |
return (
|
| 430 |
window.requestAnimationFrame ||
|
| 431 |
window.webkitRequestAnimationFrame ||
|
| 432 |
window.mozRequestAnimationFrame ||
|
| 433 |
window.oRequestAnimationFrame ||
|
| 434 |
// if all else fails, use setTimeout
|
| 435 |
-
function(callback) {
|
| 436 |
return window.setTimeout(callback, 1000 / 60);
|
| 437 |
}
|
| 438 |
);
|
| 439 |
})();
|
| 440 |
|
| 441 |
-
var cancelAFrame = (function() {
|
| 442 |
return (
|
| 443 |
window.cancelAnimationFrame ||
|
| 444 |
window.webkitCancelAnimationFrame ||
|
| 445 |
window.mozCancelAnimationFrame ||
|
| 446 |
window.oCancelAnimationFrame ||
|
| 447 |
-
function(id) {
|
| 448 |
window.clearTimeout(id);
|
| 449 |
}
|
| 450 |
);
|
|
@@ -452,7 +443,7 @@
|
|
| 452 |
|
| 453 |
// Detect the supported transition-end event property name
|
| 454 |
// =======================================================
|
| 455 |
-
var transitionEnd = (function() {
|
| 456 |
var el = document.createElement("fakeelement"),
|
| 457 |
t;
|
| 458 |
|
|
@@ -475,17 +466,17 @@
|
|
| 475 |
// Force redraw on an element.
|
| 476 |
// This helps in cases where the browser doesn't redraw an updated element properly
|
| 477 |
// ================================================================================
|
| 478 |
-
var forceRedraw = function($el) {
|
| 479 |
return $el && $el.length && $el[0].offsetHeight;
|
| 480 |
};
|
| 481 |
|
| 482 |
// Exclude array (`buttons`) options from deep merging
|
| 483 |
// ===================================================
|
| 484 |
-
var mergeOpts = function(opts1, opts2) {
|
| 485 |
var rez = $.extend(true, {}, opts1, opts2);
|
| 486 |
|
| 487 |
-
$.each(opts2, function(key, value) {
|
| 488 |
-
if (
|
| 489 |
rez[key] = value;
|
| 490 |
}
|
| 491 |
});
|
|
@@ -496,7 +487,7 @@
|
|
| 496 |
// How much of an element is visible in viewport
|
| 497 |
// =============================================
|
| 498 |
|
| 499 |
-
var inViewport = function(elem) {
|
| 500 |
var elemCenter, rez;
|
| 501 |
|
| 502 |
if (!elem || elem.ownerDocument !== document) {
|
|
@@ -520,10 +511,12 @@
|
|
| 520 |
// Class definition
|
| 521 |
// ================
|
| 522 |
|
| 523 |
-
var FancyBox = function(content, opts, index) {
|
| 524 |
var self = this;
|
| 525 |
|
| 526 |
-
self.opts = mergeOpts({
|
|
|
|
|
|
|
| 527 |
|
| 528 |
if ($.isPlainObject(opts)) {
|
| 529 |
self.opts = mergeOpts(self.opts, opts);
|
|
@@ -563,7 +556,7 @@
|
|
| 563 |
// Create DOM structure
|
| 564 |
// ====================
|
| 565 |
|
| 566 |
-
init: function() {
|
| 567 |
var self = this,
|
| 568 |
firstItem = self.group[self.currIndex],
|
| 569 |
firstItemOpts = firstItem.opts,
|
|
@@ -587,8 +580,8 @@
|
|
| 587 |
) {
|
| 588 |
$("head").append(
|
| 589 |
'<style id="fancybox-style-noscroll" type="text/css">.compensate-for-scrollbar{margin-right:' +
|
| 590 |
-
|
| 591 |
-
|
| 592 |
);
|
| 593 |
|
| 594 |
$("body").addClass("compensate-for-scrollbar");
|
|
@@ -600,20 +593,20 @@
|
|
| 600 |
// Build html code for buttons and insert into main template
|
| 601 |
buttonStr = "";
|
| 602 |
|
| 603 |
-
$.each(firstItemOpts.buttons, function(index, value) {
|
| 604 |
buttonStr += firstItemOpts.btnTpl[value] || "";
|
| 605 |
});
|
| 606 |
|
| 607 |
// Create markup from base template, it will be initially hidden to
|
| 608 |
// avoid unnecessary work like painting while initializing is not complete
|
| 609 |
$container = $(
|
| 610 |
-
|
| 611 |
-
|
| 612 |
-
|
| 613 |
.replace("{{buttons}}", buttonStr)
|
| 614 |
.replace("{{arrows}}", firstItemOpts.btnTpl.arrowLeft + firstItemOpts.btnTpl.arrowRight)
|
|
|
|
| 615 |
)
|
| 616 |
-
)
|
| 617 |
.attr("id", "fancybox-container-" + self.id)
|
| 618 |
.addClass(firstItemOpts.baseClass)
|
| 619 |
.data("FancyBox", self)
|
|
@@ -624,7 +617,7 @@
|
|
| 624 |
container: $container
|
| 625 |
};
|
| 626 |
|
| 627 |
-
["bg", "inner", "infobar", "toolbar", "stage", "caption", "navigation"].forEach(function(item) {
|
| 628 |
self.$refs[item] = $container.find(".fancybox-" + item);
|
| 629 |
});
|
| 630 |
|
|
@@ -641,17 +634,11 @@
|
|
| 641 |
// with corresponding values
|
| 642 |
// ============================================================
|
| 643 |
|
| 644 |
-
translate: function(obj, str) {
|
| 645 |
-
var arr = obj.opts.i18n[obj.opts.lang];
|
| 646 |
|
| 647 |
-
return str.replace(/\{\{(\w+)\}\}/g, function(match, n) {
|
| 648 |
-
|
| 649 |
-
|
| 650 |
-
if (value === undefined) {
|
| 651 |
-
return match;
|
| 652 |
-
}
|
| 653 |
-
|
| 654 |
-
return value;
|
| 655 |
});
|
| 656 |
},
|
| 657 |
|
|
@@ -659,12 +646,12 @@
|
|
| 659 |
// Check if each object has valid type and content
|
| 660 |
// ===============================================
|
| 661 |
|
| 662 |
-
addContent: function(content) {
|
| 663 |
var self = this,
|
| 664 |
items = $.makeArray(content),
|
| 665 |
thumbs;
|
| 666 |
|
| 667 |
-
$.each(items, function(i, item) {
|
| 668 |
var obj = {},
|
| 669 |
opts = {},
|
| 670 |
$item,
|
|
@@ -714,7 +701,7 @@
|
|
| 714 |
obj.opts = $.extend(true, {}, self.opts, opts);
|
| 715 |
|
| 716 |
// Do not merge buttons array
|
| 717 |
-
if (
|
| 718 |
obj.opts.buttons = opts.buttons;
|
| 719 |
}
|
| 720 |
|
|
@@ -739,6 +726,14 @@
|
|
| 739 |
type = "image";
|
| 740 |
} else if (src.match(/\.(pdf)((\?|#).*)?$/i)) {
|
| 741 |
type = "iframe";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 742 |
} else if (src.charAt(0) === "#") {
|
| 743 |
type = "inline";
|
| 744 |
}
|
|
@@ -859,7 +854,7 @@
|
|
| 859 |
if (thumbs && thumbs.isActive) {
|
| 860 |
thumbs.create();
|
| 861 |
|
| 862 |
-
thumbs.
|
| 863 |
}
|
| 864 |
}
|
| 865 |
},
|
|
@@ -872,7 +867,7 @@
|
|
| 872 |
// - detecting inactivity
|
| 873 |
// ======================================
|
| 874 |
|
| 875 |
-
addEvents: function() {
|
| 876 |
var self = this;
|
| 877 |
|
| 878 |
self.removeEvents();
|
|
@@ -881,25 +876,25 @@
|
|
| 881 |
// ==================================
|
| 882 |
|
| 883 |
self.$refs.container
|
| 884 |
-
.on("click.fb-close", "[data-fancybox-close]", function(e) {
|
| 885 |
e.stopPropagation();
|
| 886 |
e.preventDefault();
|
| 887 |
|
| 888 |
self.close(e);
|
| 889 |
})
|
| 890 |
-
.on("touchstart.fb-prev click.fb-prev", "[data-fancybox-prev]", function(e) {
|
| 891 |
e.stopPropagation();
|
| 892 |
e.preventDefault();
|
| 893 |
|
| 894 |
self.previous();
|
| 895 |
})
|
| 896 |
-
.on("touchstart.fb-next click.fb-next", "[data-fancybox-next]", function(e) {
|
| 897 |
e.stopPropagation();
|
| 898 |
e.preventDefault();
|
| 899 |
|
| 900 |
self.next();
|
| 901 |
})
|
| 902 |
-
.on("click.fb", "[data-fancybox-zoom]", function(e) {
|
| 903 |
// Click handler for zoom button
|
| 904 |
self[self.isScaledDown() ? "scaleToActual" : "scaleToFit"]();
|
| 905 |
});
|
|
@@ -907,13 +902,13 @@
|
|
| 907 |
// Handle page scrolling and browser resizing
|
| 908 |
// ==========================================
|
| 909 |
|
| 910 |
-
$W.on("orientationchange.fb resize.fb", function(e) {
|
| 911 |
if (e && e.originalEvent && e.originalEvent.type === "resize") {
|
| 912 |
if (self.requestId) {
|
| 913 |
cancelAFrame(self.requestId);
|
| 914 |
}
|
| 915 |
|
| 916 |
-
self.requestId = requestAFrame(function() {
|
| 917 |
self.update(e);
|
| 918 |
});
|
| 919 |
} else {
|
|
@@ -921,15 +916,18 @@
|
|
| 921 |
self.$refs.stage.hide();
|
| 922 |
}
|
| 923 |
|
| 924 |
-
setTimeout(
|
| 925 |
-
|
|
|
|
| 926 |
|
| 927 |
-
|
| 928 |
-
|
|
|
|
|
|
|
| 929 |
}
|
| 930 |
});
|
| 931 |
|
| 932 |
-
$D.on("keydown.fb", function(e) {
|
| 933 |
var instance = $.fancyboxforwp ? $.fancyboxforwp.getInstance() : null,
|
| 934 |
current = instance.current,
|
| 935 |
keycode = e.keyCode || e.which;
|
|
@@ -948,7 +946,7 @@
|
|
| 948 |
// Enable keyboard navigation
|
| 949 |
// ==========================
|
| 950 |
|
| 951 |
-
if (!current.opts.keyboard || e.ctrlKey || e.altKey || e.shiftKey || $(e.target).is("input
|
| 952 |
return;
|
| 953 |
}
|
| 954 |
|
|
@@ -988,7 +986,7 @@
|
|
| 988 |
|
| 989 |
$D.on(
|
| 990 |
"mousemove.fb-idle mouseleave.fb-idle mousedown.fb-idle touchstart.fb-idle touchmove.fb-idle scroll.fb-idle keydown.fb-idle",
|
| 991 |
-
function(e) {
|
| 992 |
self.idleSecondsCounter = 0;
|
| 993 |
|
| 994 |
if (self.isIdle) {
|
|
@@ -999,7 +997,7 @@
|
|
| 999 |
}
|
| 1000 |
);
|
| 1001 |
|
| 1002 |
-
self.idleInterval = window.setInterval(function() {
|
| 1003 |
self.idleSecondsCounter++;
|
| 1004 |
|
| 1005 |
if (self.idleSecondsCounter >= self.group[self.currIndex].opts.idleTime && !self.isDragging) {
|
|
@@ -1015,7 +1013,7 @@
|
|
| 1015 |
// Remove events added by the core
|
| 1016 |
// ===============================
|
| 1017 |
|
| 1018 |
-
removeEvents: function() {
|
| 1019 |
var self = this;
|
| 1020 |
|
| 1021 |
$W.off("orientationchange.fb resize.fb");
|
|
@@ -1033,21 +1031,21 @@
|
|
| 1033 |
// Change to previous gallery item
|
| 1034 |
// ===============================
|
| 1035 |
|
| 1036 |
-
previous: function(duration) {
|
| 1037 |
return this.jumpTo(this.currPos - 1, duration);
|
| 1038 |
},
|
| 1039 |
|
| 1040 |
// Change to next gallery item
|
| 1041 |
// ===========================
|
| 1042 |
|
| 1043 |
-
next: function(duration) {
|
| 1044 |
return this.jumpTo(this.currPos + 1, duration);
|
| 1045 |
},
|
| 1046 |
|
| 1047 |
// Switch to selected gallery item
|
| 1048 |
// ===============================
|
| 1049 |
|
| 1050 |
-
jumpTo: function(pos, duration) {
|
| 1051 |
var self = this,
|
| 1052 |
groupLen = self.group.length,
|
| 1053 |
firstRun,
|
|
@@ -1140,7 +1138,7 @@
|
|
| 1140 |
stagePos = $.fancyboxforwp.getTranslate(self.$refs.stage);
|
| 1141 |
|
| 1142 |
// Clean up all slides
|
| 1143 |
-
$.each(self.slides, function(index, slide) {
|
| 1144 |
$.fancyboxforwp.stop(slide.$slide, true);
|
| 1145 |
});
|
| 1146 |
|
|
@@ -1155,8 +1153,8 @@
|
|
| 1155 |
// Calculate horizontal swipe distance
|
| 1156 |
diff = slidePos.left - (previous.pos * slidePos.width + previous.pos * previous.opts.gutter);
|
| 1157 |
|
| 1158 |
-
$.each(self.slides, function(index, slide) {
|
| 1159 |
-
slide.$slide.removeClass("fancybox-animated").removeClass(function(index, className) {
|
| 1160 |
return (className.match(/(^|\s)fancybox-fx-\S+/g) || []).join(" ");
|
| 1161 |
});
|
| 1162 |
|
|
@@ -1164,7 +1162,10 @@
|
|
| 1164 |
// This is mostly needed for freshly added slides, because they are not yet positioned
|
| 1165 |
var leftPos = slide.pos * slidePos.width + slide.pos * slide.opts.gutter;
|
| 1166 |
|
| 1167 |
-
$.fancyboxforwp.setTranslate(slide.$slide, {
|
|
|
|
|
|
|
|
|
|
| 1168 |
|
| 1169 |
if (slide.pos !== current.pos) {
|
| 1170 |
slide.$slide.addClass("fancybox-slide--" + (slide.pos > current.pos ? "next" : "previous"));
|
|
@@ -1175,13 +1176,12 @@
|
|
| 1175 |
|
| 1176 |
// Animate the slide
|
| 1177 |
$.fancyboxforwp.animate(
|
| 1178 |
-
slide.$slide,
|
| 1179 |
-
{
|
| 1180 |
top: 0,
|
| 1181 |
left: (slide.pos - current.pos) * slidePos.width + (slide.pos - current.pos) * slide.opts.gutter
|
| 1182 |
},
|
| 1183 |
duration,
|
| 1184 |
-
function() {
|
| 1185 |
slide.$slide
|
| 1186 |
.css({
|
| 1187 |
transform: "",
|
|
@@ -1205,7 +1205,7 @@
|
|
| 1205 |
previous.$slide,
|
| 1206 |
prop,
|
| 1207 |
duration,
|
| 1208 |
-
function() {
|
| 1209 |
previous.$slide.removeClass(prop).removeClass("fancybox-slide--next fancybox-slide--previous");
|
| 1210 |
},
|
| 1211 |
false
|
|
@@ -1225,7 +1225,7 @@
|
|
| 1225 |
// These are gallery items that are actually added to DOM
|
| 1226 |
// =======================================================
|
| 1227 |
|
| 1228 |
-
createSlide: function(pos) {
|
| 1229 |
var self = this,
|
| 1230 |
$slide,
|
| 1231 |
index;
|
|
@@ -1252,7 +1252,7 @@
|
|
| 1252 |
// x and y values should be relative to the slide
|
| 1253 |
// ==============================================
|
| 1254 |
|
| 1255 |
-
scaleToActual: function(x, y, duration) {
|
| 1256 |
var self = this,
|
| 1257 |
current = self.current,
|
| 1258 |
$content = current.$content,
|
|
@@ -1317,15 +1317,14 @@
|
|
| 1317 |
self.updateCursor(newImgWidth, newImgHeight);
|
| 1318 |
|
| 1319 |
$.fancyboxforwp.animate(
|
| 1320 |
-
$content,
|
| 1321 |
-
{
|
| 1322 |
top: posY,
|
| 1323 |
left: posX,
|
| 1324 |
scaleX: scaleX,
|
| 1325 |
scaleY: scaleY
|
| 1326 |
},
|
| 1327 |
-
duration ||
|
| 1328 |
-
function() {
|
| 1329 |
self.isAnimating = false;
|
| 1330 |
}
|
| 1331 |
);
|
|
@@ -1339,7 +1338,7 @@
|
|
| 1339 |
// Scale image to fit inside parent element
|
| 1340 |
// ========================================
|
| 1341 |
|
| 1342 |
-
scaleToFit: function(duration) {
|
| 1343 |
var self = this,
|
| 1344 |
current = self.current,
|
| 1345 |
$content = current.$content,
|
|
@@ -1358,15 +1357,14 @@
|
|
| 1358 |
self.updateCursor(end.width, end.height);
|
| 1359 |
|
| 1360 |
$.fancyboxforwp.animate(
|
| 1361 |
-
$content,
|
| 1362 |
-
{
|
| 1363 |
top: end.top,
|
| 1364 |
left: end.left,
|
| 1365 |
scaleX: end.width / $content.width(),
|
| 1366 |
scaleY: end.height / $content.height()
|
| 1367 |
},
|
| 1368 |
-
duration ||
|
| 1369 |
-
function() {
|
| 1370 |
self.isAnimating = false;
|
| 1371 |
}
|
| 1372 |
);
|
|
@@ -1375,7 +1373,7 @@
|
|
| 1375 |
// Calculate image size to fit inside viewport
|
| 1376 |
// ===========================================
|
| 1377 |
|
| 1378 |
-
getFitPos: function(slide) {
|
| 1379 |
var self = this,
|
| 1380 |
$content = slide.$content,
|
| 1381 |
$slide = slide.$slide,
|
|
@@ -1449,10 +1447,10 @@
|
|
| 1449 |
// Update content size and position for all slides
|
| 1450 |
// ==============================================
|
| 1451 |
|
| 1452 |
-
update: function(e) {
|
| 1453 |
var self = this;
|
| 1454 |
|
| 1455 |
-
$.each(self.slides, function(key, slide) {
|
| 1456 |
self.updateSlide(slide, e);
|
| 1457 |
});
|
| 1458 |
},
|
|
@@ -1460,7 +1458,7 @@
|
|
| 1460 |
// Update slide content position and size
|
| 1461 |
// ======================================
|
| 1462 |
|
| 1463 |
-
updateSlide: function(slide, e) {
|
| 1464 |
var self = this,
|
| 1465 |
$content = slide && slide.$content,
|
| 1466 |
width = slide.width || slide.opts.width,
|
|
@@ -1502,7 +1500,7 @@
|
|
| 1502 |
// Horizontally center slide
|
| 1503 |
// =========================
|
| 1504 |
|
| 1505 |
-
centerSlide: function(duration) {
|
| 1506 |
var self = this,
|
| 1507 |
current = self.current,
|
| 1508 |
$slide = current.$slide;
|
|
@@ -1522,14 +1520,13 @@
|
|
| 1522 |
.removeClass("fancybox-slide--previous fancybox-slide--next");
|
| 1523 |
|
| 1524 |
$.fancyboxforwp.animate(
|
| 1525 |
-
$slide,
|
| 1526 |
-
{
|
| 1527 |
top: 0,
|
| 1528 |
left: 0,
|
| 1529 |
opacity: 1
|
| 1530 |
},
|
| 1531 |
duration === undefined ? 0 : duration,
|
| 1532 |
-
function() {
|
| 1533 |
// Clean up
|
| 1534 |
$slide.css({
|
| 1535 |
transform: "",
|
|
@@ -1547,7 +1544,7 @@
|
|
| 1547 |
// Check if current slide is moved (swiped)
|
| 1548 |
// ========================================
|
| 1549 |
|
| 1550 |
-
isMoved: function(slide) {
|
| 1551 |
var current = slide || this.current,
|
| 1552 |
slidePos,
|
| 1553 |
stagePos;
|
|
@@ -1568,7 +1565,7 @@
|
|
| 1568 |
// Update cursor style depending if content can be zoomed
|
| 1569 |
// ======================================================
|
| 1570 |
|
| 1571 |
-
updateCursor: function(nextWidth, nextHeight) {
|
| 1572 |
var self = this,
|
| 1573 |
current = self.current,
|
| 1574 |
$container = self.$refs.container,
|
|
@@ -1604,7 +1601,7 @@
|
|
| 1604 |
// Check if current slide is zoomable
|
| 1605 |
// ==================================
|
| 1606 |
|
| 1607 |
-
isZoomable: function() {
|
| 1608 |
var self = this,
|
| 1609 |
current = self.current,
|
| 1610 |
fitPos;
|
|
@@ -1630,7 +1627,7 @@
|
|
| 1630 |
// Check if current image dimensions are smaller than actual
|
| 1631 |
// =========================================================
|
| 1632 |
|
| 1633 |
-
isScaledDown: function(nextWidth, nextHeight) {
|
| 1634 |
var self = this,
|
| 1635 |
rez = false,
|
| 1636 |
current = self.current,
|
|
@@ -1649,7 +1646,7 @@
|
|
| 1649 |
// Check if image dimensions exceed parent element
|
| 1650 |
// ===============================================
|
| 1651 |
|
| 1652 |
-
canPan: function(nextWidth, nextHeight) {
|
| 1653 |
var self = this,
|
| 1654 |
current = self.current,
|
| 1655 |
pos = null,
|
|
@@ -1659,7 +1656,10 @@
|
|
| 1659 |
rez = self.getFitPos(current);
|
| 1660 |
|
| 1661 |
if (nextWidth !== undefined && nextHeight !== undefined) {
|
| 1662 |
-
pos = {
|
|
|
|
|
|
|
|
|
|
| 1663 |
} else if (current.isComplete) {
|
| 1664 |
pos = $.fancyboxforwp.getTranslate(current.$content);
|
| 1665 |
}
|
|
@@ -1675,7 +1675,7 @@
|
|
| 1675 |
// Load content into the slide
|
| 1676 |
// ===========================
|
| 1677 |
|
| 1678 |
-
loadSlide: function(slide) {
|
| 1679 |
var self = this,
|
| 1680 |
type,
|
| 1681 |
$slide,
|
|
@@ -1722,9 +1722,9 @@
|
|
| 1722 |
self.setContent(
|
| 1723 |
slide,
|
| 1724 |
slide.opts.video.tpl
|
| 1725 |
-
|
| 1726 |
-
|
| 1727 |
-
|
| 1728 |
);
|
| 1729 |
|
| 1730 |
break;
|
|
@@ -1744,12 +1744,12 @@
|
|
| 1744 |
ajaxLoad = $.ajax(
|
| 1745 |
$.extend({}, slide.opts.ajax.settings, {
|
| 1746 |
url: slide.src,
|
| 1747 |
-
success: function(data, textStatus) {
|
| 1748 |
if (textStatus === "success") {
|
| 1749 |
self.setContent(slide, data);
|
| 1750 |
}
|
| 1751 |
},
|
| 1752 |
-
error: function(jqXHR, textStatus) {
|
| 1753 |
if (jqXHR && textStatus !== "abort") {
|
| 1754 |
self.setError(slide);
|
| 1755 |
}
|
|
@@ -1757,7 +1757,7 @@
|
|
| 1757 |
})
|
| 1758 |
);
|
| 1759 |
|
| 1760 |
-
$slide.one("onReset", function() {
|
| 1761 |
ajaxLoad.abort();
|
| 1762 |
});
|
| 1763 |
|
|
@@ -1775,20 +1775,18 @@
|
|
| 1775 |
// Use thumbnail image, if possible
|
| 1776 |
// ================================
|
| 1777 |
|
| 1778 |
-
setImage: function(slide) {
|
| 1779 |
var self = this,
|
| 1780 |
ghost;
|
| 1781 |
|
| 1782 |
// Check if need to show loading icon
|
| 1783 |
-
|
| 1784 |
-
|
| 1785 |
-
var $img = slide.$image;
|
| 1786 |
|
| 1787 |
-
|
| 1788 |
-
|
| 1789 |
-
|
| 1790 |
-
|
| 1791 |
-
});
|
| 1792 |
|
| 1793 |
//Check if image has srcset
|
| 1794 |
self.checkSrcset(slide);
|
|
@@ -1806,13 +1804,13 @@
|
|
| 1806 |
|
| 1807 |
ghost = document.createElement("img");
|
| 1808 |
|
| 1809 |
-
ghost.onerror = function() {
|
| 1810 |
$(this).remove();
|
| 1811 |
|
| 1812 |
slide.$ghost = null;
|
| 1813 |
};
|
| 1814 |
|
| 1815 |
-
ghost.onload = function() {
|
| 1816 |
self.afterLoad(slide);
|
| 1817 |
};
|
| 1818 |
|
|
@@ -1828,7 +1826,7 @@
|
|
| 1828 |
|
| 1829 |
// Check if image has srcset and get the source
|
| 1830 |
// ============================================
|
| 1831 |
-
checkSrcset: function(slide) {
|
| 1832 |
var srcset = slide.opts.srcset || slide.opts.image.srcset,
|
| 1833 |
found,
|
| 1834 |
temp,
|
|
@@ -1842,12 +1840,12 @@
|
|
| 1842 |
pxRatio = window.devicePixelRatio || 1;
|
| 1843 |
windowWidth = window.innerWidth * pxRatio;
|
| 1844 |
|
| 1845 |
-
temp = srcset.split(",").map(function(el) {
|
| 1846 |
var ret = {};
|
| 1847 |
|
| 1848 |
el.trim()
|
| 1849 |
.split(/\s+/)
|
| 1850 |
-
.forEach(function(el, i) {
|
| 1851 |
var value = parseInt(el.substring(0, el.length - 1), 10);
|
| 1852 |
|
| 1853 |
if (i === 0) {
|
|
@@ -1864,7 +1862,7 @@
|
|
| 1864 |
});
|
| 1865 |
|
| 1866 |
// Sort by value
|
| 1867 |
-
temp.sort(function(a, b) {
|
| 1868 |
return a.value - b.value;
|
| 1869 |
});
|
| 1870 |
|
|
@@ -1900,16 +1898,16 @@
|
|
| 1900 |
// Create full-size image
|
| 1901 |
// ======================
|
| 1902 |
|
| 1903 |
-
setBigImage: function(slide) {
|
| 1904 |
var self = this,
|
| 1905 |
img = document.createElement("img"),
|
| 1906 |
$img = $(img);
|
| 1907 |
|
| 1908 |
slide.$image = $img
|
| 1909 |
-
.one("error", function() {
|
| 1910 |
self.setError(slide);
|
| 1911 |
})
|
| 1912 |
-
.one("load", function() {
|
| 1913 |
var sizes;
|
| 1914 |
|
| 1915 |
if (!slide.$ghost) {
|
|
@@ -1936,7 +1934,7 @@
|
|
| 1936 |
|
| 1937 |
// Hide temporary image after some delay
|
| 1938 |
if (slide.$ghost) {
|
| 1939 |
-
setTimeout(function() {
|
| 1940 |
if (slide.$ghost && !self.isClosing) {
|
| 1941 |
slide.$ghost.hide();
|
| 1942 |
}
|
|
@@ -1959,7 +1957,7 @@
|
|
| 1959 |
// Computes the slide size from image size and maxWidth/maxHeight
|
| 1960 |
// ==============================================================
|
| 1961 |
|
| 1962 |
-
resolveImageSlideSize: function(slide, imgWidth, imgHeight) {
|
| 1963 |
var maxWidth = parseInt(slide.opts.width, 10),
|
| 1964 |
maxHeight = parseInt(slide.opts.height, 10);
|
| 1965 |
|
|
@@ -1981,17 +1979,12 @@
|
|
| 1981 |
// Create iframe wrapper, iframe and bindings
|
| 1982 |
// ==========================================
|
| 1983 |
|
| 1984 |
-
setIframe: function(slide) {
|
| 1985 |
var self = this,
|
| 1986 |
opts = slide.opts.iframe,
|
| 1987 |
$slide = slide.$slide,
|
| 1988 |
$iframe;
|
| 1989 |
|
| 1990 |
-
// Fix responsive iframes on iOS (along with `position:absolute;` for iframe element)
|
| 1991 |
-
if ($.fancyboxforwp.isMobile) {
|
| 1992 |
-
opts.css.overflow = "scroll";
|
| 1993 |
-
}
|
| 1994 |
-
|
| 1995 |
slide.$content = $('<div class="fancybox-content' + (opts.preload ? " fancybox-is-hidden" : "") + '"></div>')
|
| 1996 |
.css(opts.css)
|
| 1997 |
.appendTo($slide);
|
|
@@ -2008,7 +2001,7 @@
|
|
| 2008 |
// Unfortunately, it is not always possible to determine if iframe is successfully loaded
|
| 2009 |
// (due to browser security policy)
|
| 2010 |
|
| 2011 |
-
$iframe.on("load.fb error.fb", function(e) {
|
| 2012 |
this.isReady = 1;
|
| 2013 |
|
| 2014 |
slide.$slide.trigger("refresh");
|
|
@@ -2019,7 +2012,7 @@
|
|
| 2019 |
// Recalculate iframe content size
|
| 2020 |
// ===============================
|
| 2021 |
|
| 2022 |
-
$slide.on("refresh.fb", function() {
|
| 2023 |
var $content = slide.$content,
|
| 2024 |
frameWidth = opts.css.width,
|
| 2025 |
frameHeight = opts.css.height,
|
|
@@ -2035,7 +2028,7 @@
|
|
| 2035 |
$body = $contents.find("body");
|
| 2036 |
} catch (ignore) {}
|
| 2037 |
|
| 2038 |
-
// Calculate
|
| 2039 |
if ($body && $body.length && $body.children().length) {
|
| 2040 |
// Avoid scrolling to top (if multiple instances)
|
| 2041 |
$slide.css("overflow", "visible");
|
|
@@ -2070,7 +2063,7 @@
|
|
| 2070 |
$iframe.attr("src", slide.src);
|
| 2071 |
|
| 2072 |
// Remove iframe if closing or changing gallery item
|
| 2073 |
-
$slide.one("onReset", function() {
|
| 2074 |
// This helps IE not to throw errors when closing
|
| 2075 |
try {
|
| 2076 |
$(this)
|
|
@@ -2092,7 +2085,7 @@
|
|
| 2092 |
// Wrap and append content to the slide
|
| 2093 |
// ======================================
|
| 2094 |
|
| 2095 |
-
setContent: function(slide, content) {
|
| 2096 |
var self = this;
|
| 2097 |
|
| 2098 |
if (self.isClosing) {
|
|
@@ -2111,8 +2104,8 @@
|
|
| 2111 |
// The placeholder is created so we will know where to put it back.
|
| 2112 |
if (isQuery(content) && content.parent().length) {
|
| 2113 |
// Make sure content is not already moved to fancyBox
|
| 2114 |
-
if (content.hasClass("fancybox-content")) {
|
| 2115 |
-
content.
|
| 2116 |
}
|
| 2117 |
|
| 2118 |
// Create temporary element marking original place of the content
|
|
@@ -2138,7 +2131,7 @@
|
|
| 2138 |
}
|
| 2139 |
}
|
| 2140 |
|
| 2141 |
-
slide.$slide.one("onReset", function() {
|
| 2142 |
// Pause all html5 video/audio
|
| 2143 |
$(this)
|
| 2144 |
.find("video,audio")
|
|
@@ -2206,7 +2199,7 @@
|
|
| 2206 |
// Display error message
|
| 2207 |
// =====================
|
| 2208 |
|
| 2209 |
-
setError: function(slide) {
|
| 2210 |
slide.hasError = true;
|
| 2211 |
|
| 2212 |
slide.$slide
|
|
@@ -2226,7 +2219,7 @@
|
|
| 2226 |
// Show loading icon inside the slide
|
| 2227 |
// ==================================
|
| 2228 |
|
| 2229 |
-
showLoading: function(slide) {
|
| 2230 |
var self = this;
|
| 2231 |
|
| 2232 |
slide = slide || self.current;
|
|
@@ -2242,7 +2235,7 @@
|
|
| 2242 |
// Remove loading icon from the slide
|
| 2243 |
// ==================================
|
| 2244 |
|
| 2245 |
-
hideLoading: function(slide) {
|
| 2246 |
var self = this;
|
| 2247 |
|
| 2248 |
slide = slide || self.current;
|
|
@@ -2257,7 +2250,7 @@
|
|
| 2257 |
// Adjustments after slide content has been loaded
|
| 2258 |
// ===============================================
|
| 2259 |
|
| 2260 |
-
afterLoad: function(slide) {
|
| 2261 |
var self = this;
|
| 2262 |
|
| 2263 |
if (self.isClosing) {
|
|
@@ -2278,7 +2271,7 @@
|
|
| 2278 |
|
| 2279 |
// Disable right click
|
| 2280 |
if (slide.opts.protect && slide.$content && !slide.hasError) {
|
| 2281 |
-
slide.$content.on("contextmenu.fb", function(e) {
|
| 2282 |
if (e.button == 2) {
|
| 2283 |
e.preventDefault();
|
| 2284 |
}
|
|
@@ -2308,25 +2301,30 @@
|
|
| 2308 |
// fix css inconsistency across browsers
|
| 2309 |
// =====================================
|
| 2310 |
|
| 2311 |
-
adjustCaption: function(slide) {
|
| 2312 |
var self = this,
|
| 2313 |
current = slide || self.current,
|
| 2314 |
caption = current.opts.caption,
|
|
|
|
| 2315 |
$caption = self.$refs.caption,
|
|
|
|
| 2316 |
captionH = false;
|
| 2317 |
|
| 2318 |
-
|
|
|
|
|
|
|
| 2319 |
if (current.pos !== self.currPos) {
|
| 2320 |
-
$
|
| 2321 |
-
.clone()
|
| 2322 |
-
.empty()
|
| 2323 |
-
.appendTo($caption.parent());
|
| 2324 |
|
| 2325 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2326 |
|
| 2327 |
-
captionH = $
|
| 2328 |
|
| 2329 |
-
$
|
| 2330 |
} else if (self.$caption) {
|
| 2331 |
captionH = self.$caption.outerHeight(true);
|
| 2332 |
}
|
|
@@ -2339,7 +2337,7 @@
|
|
| 2339 |
// https://bugzilla.mozilla.org/show_bug.cgi?id=748518
|
| 2340 |
// ====================================================================================
|
| 2341 |
|
| 2342 |
-
adjustLayout: function(slide) {
|
| 2343 |
var self = this,
|
| 2344 |
current = slide || self.current,
|
| 2345 |
scrollHeight,
|
|
@@ -2378,7 +2376,7 @@
|
|
| 2378 |
// user navigates gallery and transition should start
|
| 2379 |
// ============================================================
|
| 2380 |
|
| 2381 |
-
revealContent: function(slide) {
|
| 2382 |
var self = this,
|
| 2383 |
$slide = slide.$slide,
|
| 2384 |
end = false,
|
|
@@ -2436,7 +2434,7 @@
|
|
| 2436 |
forceRedraw(slide.$content);
|
| 2437 |
|
| 2438 |
// Start animation
|
| 2439 |
-
$.fancyboxforwp.animate(slide.$content, end, duration, function() {
|
| 2440 |
self.isAnimating = false;
|
| 2441 |
|
| 2442 |
self.complete();
|
|
@@ -2485,7 +2483,7 @@
|
|
| 2485 |
$slide,
|
| 2486 |
"fancybox-slide--current",
|
| 2487 |
duration,
|
| 2488 |
-
function() {
|
| 2489 |
$slide.removeClass(effectClassName).css({
|
| 2490 |
transform: "",
|
| 2491 |
opacity: ""
|
|
@@ -2502,7 +2500,7 @@
|
|
| 2502 |
// Check if we can and have to zoom from thumbnail
|
| 2503 |
//================================================
|
| 2504 |
|
| 2505 |
-
getThumbPos: function(slide) {
|
| 2506 |
var rez = false,
|
| 2507 |
$thumb = slide.$thumb,
|
| 2508 |
thumbPos,
|
|
@@ -2538,7 +2536,7 @@
|
|
| 2538 |
// and it`s content is loaded
|
| 2539 |
// ==================================================================
|
| 2540 |
|
| 2541 |
-
complete: function() {
|
| 2542 |
var self = this,
|
| 2543 |
current = self.current,
|
| 2544 |
slides = {},
|
|
@@ -2561,7 +2559,7 @@
|
|
| 2561 |
current.$slide.addClass("fancybox-slide--complete");
|
| 2562 |
|
| 2563 |
// Remove unnecessary slides
|
| 2564 |
-
$.each(self.slides, function(key, slide) {
|
| 2565 |
if (slide.pos >= self.currPos - 1 && slide.pos <= self.currPos + 1) {
|
| 2566 |
slides[slide.pos] = slide;
|
| 2567 |
} else if (slide) {
|
|
@@ -2586,7 +2584,15 @@
|
|
| 2586 |
.find("video,audio")
|
| 2587 |
.filter(":visible:first")
|
| 2588 |
.trigger("play")
|
| 2589 |
-
.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2590 |
}
|
| 2591 |
|
| 2592 |
// Try to focus on the first focusable element
|
|
@@ -2608,10 +2614,17 @@
|
|
| 2608 |
// Preload next and previous slides
|
| 2609 |
// ================================
|
| 2610 |
|
| 2611 |
-
preload: function(type) {
|
| 2612 |
var self = this,
|
| 2613 |
-
|
| 2614 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2615 |
|
| 2616 |
if (prev && prev.type === type) {
|
| 2617 |
self.loadSlide(prev);
|
|
@@ -2625,7 +2638,7 @@
|
|
| 2625 |
// Try to find and focus on the first focusable element
|
| 2626 |
// ====================================================
|
| 2627 |
|
| 2628 |
-
focus: function(e, firstRun) {
|
| 2629 |
var self = this,
|
| 2630 |
focusableStr = [
|
| 2631 |
"a[href]",
|
|
@@ -2637,6 +2650,8 @@
|
|
| 2637 |
"iframe",
|
| 2638 |
"object",
|
| 2639 |
"embed",
|
|
|
|
|
|
|
| 2640 |
"[contenteditable]",
|
| 2641 |
'[tabindex]:not([tabindex^="-"])'
|
| 2642 |
].join(","),
|
|
@@ -2655,7 +2670,7 @@
|
|
| 2655 |
focusableItems = self.current.$slide.find("*:visible" + (firstRun ? ":not(.fancybox-close-small)" : ""));
|
| 2656 |
}
|
| 2657 |
|
| 2658 |
-
focusableItems = focusableItems.filter(focusableStr).filter(function() {
|
| 2659 |
return $(this).css("visibility") !== "hidden" && !$(this).hasClass("disabled");
|
| 2660 |
});
|
| 2661 |
|
|
@@ -2688,11 +2703,11 @@
|
|
| 2688 |
// notifies other instances about deactivating
|
| 2689 |
// =================================================================================
|
| 2690 |
|
| 2691 |
-
activate: function() {
|
| 2692 |
var self = this;
|
| 2693 |
|
| 2694 |
// Deactivate all instances
|
| 2695 |
-
$(".fancybox-container").each(function() {
|
| 2696 |
var instance = $(this).data("FancyBox");
|
| 2697 |
|
| 2698 |
// Skip self and closing instances
|
|
@@ -2722,7 +2737,7 @@
|
|
| 2722 |
// This will start "zoom-out" animation if needed and clean everything up afterwards
|
| 2723 |
// =================================================================================
|
| 2724 |
|
| 2725 |
-
close: function(e, d) {
|
| 2726 |
var self = this,
|
| 2727 |
current = self.current,
|
| 2728 |
effect,
|
|
@@ -2733,7 +2748,7 @@
|
|
| 2733 |
start,
|
| 2734 |
end;
|
| 2735 |
|
| 2736 |
-
var done = function() {
|
| 2737 |
self.cleanUp(e);
|
| 2738 |
};
|
| 2739 |
|
|
@@ -2747,7 +2762,7 @@
|
|
| 2747 |
if (self.trigger("beforeClose", e) === false) {
|
| 2748 |
self.isClosing = false;
|
| 2749 |
|
| 2750 |
-
requestAFrame(function() {
|
| 2751 |
self.update();
|
| 2752 |
});
|
| 2753 |
|
|
@@ -2855,7 +2870,7 @@
|
|
| 2855 |
// Final adjustments after removing the instance
|
| 2856 |
// =============================================
|
| 2857 |
|
| 2858 |
-
cleanUp: function(e) {
|
| 2859 |
var self = this,
|
| 2860 |
instance,
|
| 2861 |
$focus = self.current.opts.$orig,
|
|
@@ -2903,7 +2918,7 @@
|
|
| 2903 |
// Call callback and trigger an event
|
| 2904 |
// ==================================
|
| 2905 |
|
| 2906 |
-
trigger: function(name, slide) {
|
| 2907 |
var args = Array.prototype.slice.call(arguments, 1),
|
| 2908 |
self = this,
|
| 2909 |
obj = slide && slide.opts ? slide : self.current,
|
|
@@ -2935,7 +2950,7 @@
|
|
| 2935 |
// Update infobar values, navigation button states and reveal caption
|
| 2936 |
// ==================================================================
|
| 2937 |
|
| 2938 |
-
updateControls: function() {
|
| 2939 |
var self = this,
|
| 2940 |
current = self.current,
|
| 2941 |
index = current.index,
|
|
@@ -2946,7 +2961,17 @@
|
|
| 2946 |
// Recalculate content dimensions
|
| 2947 |
current.$slide.trigger("refresh");
|
| 2948 |
|
| 2949 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2950 |
|
| 2951 |
if (!self.hasHiddenControls && !self.isIdle) {
|
| 2952 |
self.showControls();
|
|
@@ -2981,7 +3006,7 @@
|
|
| 2981 |
// Hide toolbar and caption
|
| 2982 |
// ========================
|
| 2983 |
|
| 2984 |
-
hideControls: function(andCaption) {
|
| 2985 |
var self = this,
|
| 2986 |
arr = ["infobar", "toolbar", "nav"];
|
| 2987 |
|
|
@@ -2991,16 +3016,16 @@
|
|
| 2991 |
|
| 2992 |
this.$refs.container.removeClass(
|
| 2993 |
arr
|
| 2994 |
-
|
| 2995 |
-
|
| 2996 |
-
|
| 2997 |
-
|
| 2998 |
);
|
| 2999 |
|
| 3000 |
this.hasHiddenControls = true;
|
| 3001 |
},
|
| 3002 |
|
| 3003 |
-
showControls: function() {
|
| 3004 |
var self = this,
|
| 3005 |
opts = self.current ? self.current.opts : self.opts,
|
| 3006 |
$container = self.$refs.container;
|
|
@@ -3019,7 +3044,7 @@
|
|
| 3019 |
// Toggle toolbar and caption
|
| 3020 |
// ==========================
|
| 3021 |
|
| 3022 |
-
toggleControls: function() {
|
| 3023 |
if (this.hasHiddenControls) {
|
| 3024 |
this.showControls();
|
| 3025 |
} else {
|
|
@@ -3029,7 +3054,7 @@
|
|
| 3029 |
});
|
| 3030 |
|
| 3031 |
$.fancyboxforwp = {
|
| 3032 |
-
version: "3.5.
|
| 3033 |
defaults: defaults,
|
| 3034 |
|
| 3035 |
// Get current instance and execute a command.
|
|
@@ -3044,7 +3069,7 @@
|
|
| 3044 |
// });
|
| 3045 |
// ======================================================
|
| 3046 |
|
| 3047 |
-
getInstance: function(command) {
|
| 3048 |
var instance = $('.fancybox-container:not(".fancybox-is-closing"):last').data("FancyBox"),
|
| 3049 |
args = Array.prototype.slice.call(arguments, 1);
|
| 3050 |
|
|
@@ -3064,14 +3089,14 @@
|
|
| 3064 |
// Create new instance
|
| 3065 |
// ===================
|
| 3066 |
|
| 3067 |
-
open: function(items, opts, index) {
|
| 3068 |
return new FancyBox(items, opts, index);
|
| 3069 |
},
|
| 3070 |
|
| 3071 |
// Close current or all instances
|
| 3072 |
// ==============================
|
| 3073 |
|
| 3074 |
-
close: function(all) {
|
| 3075 |
var instance = this.getInstance();
|
| 3076 |
|
| 3077 |
if (instance) {
|
|
@@ -3087,7 +3112,7 @@
|
|
| 3087 |
// Close all instances and unbind all events
|
| 3088 |
// =========================================
|
| 3089 |
|
| 3090 |
-
destroy: function() {
|
| 3091 |
this.close(true);
|
| 3092 |
|
| 3093 |
$D.add("body").off("click.fb-start", "**");
|
|
@@ -3101,7 +3126,7 @@
|
|
| 3101 |
// Detect if 'translate3d' support is available
|
| 3102 |
// ============================================
|
| 3103 |
|
| 3104 |
-
use3d: (function() {
|
| 3105 |
var div = document.createElement("div");
|
| 3106 |
|
| 3107 |
return (
|
|
@@ -3116,7 +3141,7 @@
|
|
| 3116 |
// returns array[ top, left, horizontal-scale, vertical-scale, opacity ]
|
| 3117 |
// =====================================================================
|
| 3118 |
|
| 3119 |
-
getTranslate: function($el) {
|
| 3120 |
var domRect;
|
| 3121 |
|
| 3122 |
if (!$el || !$el.length) {
|
|
@@ -3138,7 +3163,7 @@
|
|
| 3138 |
// Can set be used to set opacity, too
|
| 3139 |
// ========================================================
|
| 3140 |
|
| 3141 |
-
setTranslate: function($el, props) {
|
| 3142 |
var str = "",
|
| 3143 |
css = {};
|
| 3144 |
|
|
@@ -3177,7 +3202,7 @@
|
|
| 3177 |
if (props.width !== undefined) {
|
| 3178 |
css.width = props.width;
|
| 3179 |
}
|
| 3180 |
-
|
| 3181 |
var custom_caption_outerHeight = 0;
|
| 3182 |
|
| 3183 |
if($('.fancybox-custom-caption.inside-caption').length ){
|
|
@@ -3205,14 +3230,13 @@
|
|
| 3205 |
css.height = props.height + custom_caption_outerHeight;
|
| 3206 |
}
|
| 3207 |
|
| 3208 |
-
|
| 3209 |
return $el.css(css);
|
| 3210 |
},
|
| 3211 |
|
| 3212 |
// Simple CSS transition handler
|
| 3213 |
// =============================
|
| 3214 |
|
| 3215 |
-
animate: function($el, to, duration, callback, leaveAnimationName) {
|
| 3216 |
var self = this,
|
| 3217 |
from;
|
| 3218 |
|
|
@@ -3225,7 +3249,7 @@
|
|
| 3225 |
|
| 3226 |
from = self.getTranslate($el);
|
| 3227 |
|
| 3228 |
-
$el.on(transitionEnd, function(e) {
|
| 3229 |
// Skip events from child elements and z-index change
|
| 3230 |
if (e && e.originalEvent && (!$el.is(e.originalEvent.target) || e.originalEvent.propertyName == "z-index")) {
|
| 3231 |
return;
|
|
@@ -3280,13 +3304,13 @@
|
|
| 3280 |
// Make sure that `transitionend` callback gets fired
|
| 3281 |
$el.data(
|
| 3282 |
"timer",
|
| 3283 |
-
setTimeout(function() {
|
| 3284 |
$el.trigger(transitionEnd);
|
| 3285 |
}, duration + 33)
|
| 3286 |
);
|
| 3287 |
},
|
| 3288 |
|
| 3289 |
-
stop: function($el, callCallback) {
|
| 3290 |
if ($el && $el.length) {
|
| 3291 |
clearTimeout($el.data("timer"));
|
| 3292 |
|
|
@@ -3361,7 +3385,7 @@
|
|
| 3361 |
// Create a jQuery plugin
|
| 3362 |
// ======================
|
| 3363 |
|
| 3364 |
-
$.fn.fancyboxforwp = function(options) {
|
| 3365 |
var selector;
|
| 3366 |
|
| 3367 |
options = options || {};
|
|
@@ -3371,11 +3395,12 @@
|
|
| 3371 |
// Use body element instead of document so it executes first
|
| 3372 |
$("body")
|
| 3373 |
.off("click.fb-start", selector)
|
| 3374 |
-
.on("click.fb-start", selector, {
|
|
|
|
|
|
|
| 3375 |
} else {
|
| 3376 |
this.off("click.fb-start").on(
|
| 3377 |
-
"click.fb-start",
|
| 3378 |
-
{
|
| 3379 |
items: this,
|
| 3380 |
options: options
|
| 3381 |
},
|
|
@@ -3394,7 +3419,7 @@
|
|
| 3394 |
// Enable "trigger elements"
|
| 3395 |
// =========================
|
| 3396 |
|
| 3397 |
-
$D.on("click.fb-start", "[data-fancybox-trigger]", function(e) {
|
| 3398 |
$('[data-fancybox="' + $(this).attr("data-fancybox-trigger") + '"]')
|
| 3399 |
.eq($(this).attr("data-fancybox-index") || 0)
|
| 3400 |
.trigger("click.fb-start", {
|
|
@@ -3404,12 +3429,12 @@
|
|
| 3404 |
|
| 3405 |
// Track focus event for better accessibility styling
|
| 3406 |
// ==================================================
|
| 3407 |
-
(function() {
|
| 3408 |
var buttonStr = ".fancybox-button",
|
| 3409 |
focusStr = "fancybox-focus",
|
| 3410 |
$pressed = null;
|
| 3411 |
|
| 3412 |
-
$D.on("mousedown mouseup focus blur", buttonStr, function(e) {
|
| 3413 |
switch (e.type) {
|
| 3414 |
case "mousedown":
|
| 3415 |
$pressed = $(this);
|
|
@@ -3431,14 +3456,13 @@
|
|
| 3431 |
});
|
| 3432 |
})();
|
| 3433 |
})(window, document, jQuery);
|
| 3434 |
-
|
| 3435 |
// ==========================================================================
|
| 3436 |
//
|
| 3437 |
// Media
|
| 3438 |
// Adds additional media type support
|
| 3439 |
//
|
| 3440 |
// ==========================================================================
|
| 3441 |
-
(function($) {
|
| 3442 |
"use strict";
|
| 3443 |
|
| 3444 |
// Object containing properties for each media type
|
|
@@ -3457,8 +3481,8 @@
|
|
| 3457 |
},
|
| 3458 |
paramPlace: 8,
|
| 3459 |
type: "iframe",
|
| 3460 |
-
url: "
|
| 3461 |
-
thumb: "
|
| 3462 |
},
|
| 3463 |
|
| 3464 |
vimeo: {
|
|
@@ -3490,7 +3514,7 @@
|
|
| 3490 |
gmap_place: {
|
| 3491 |
matcher: /(maps\.)?google\.([a-z]{2,3}(\.[a-z]{2})?)\/(((maps\/(place\/(.*)\/)?\@(.*),(\d+.?\d+?)z))|(\?ll=))(.*)?/i,
|
| 3492 |
type: "iframe",
|
| 3493 |
-
url: function(rez) {
|
| 3494 |
return (
|
| 3495 |
"//maps.google." +
|
| 3496 |
rez[2] +
|
|
@@ -3509,14 +3533,14 @@
|
|
| 3509 |
gmap_search: {
|
| 3510 |
matcher: /(maps\.)?google\.([a-z]{2,3}(\.[a-z]{2})?)\/(maps\/search\/)(.*)/i,
|
| 3511 |
type: "iframe",
|
| 3512 |
-
url: function(rez) {
|
| 3513 |
return "//maps.google." + rez[2] + "/maps?q=" + rez[5].replace("query=", "q=").replace("api=1", "") + "&output=embed";
|
| 3514 |
}
|
| 3515 |
}
|
| 3516 |
};
|
| 3517 |
|
| 3518 |
// Formats matching url to final form
|
| 3519 |
-
var format = function(url, rez, params) {
|
| 3520 |
if (!url) {
|
| 3521 |
return;
|
| 3522 |
}
|
|
@@ -3527,7 +3551,7 @@
|
|
| 3527 |
params = $.param(params, true);
|
| 3528 |
}
|
| 3529 |
|
| 3530 |
-
$.each(rez, function(key, value) {
|
| 3531 |
url = url.replace("$" + key, value || "");
|
| 3532 |
});
|
| 3533 |
|
|
@@ -3538,7 +3562,7 @@
|
|
| 3538 |
return url;
|
| 3539 |
};
|
| 3540 |
|
| 3541 |
-
$(document).on("objectNeedsType.fb", function(e, instance, item) {
|
| 3542 |
var url = item.src || "",
|
| 3543 |
type = false,
|
| 3544 |
media,
|
|
@@ -3552,7 +3576,7 @@
|
|
| 3552 |
media = $.extend(true, {}, defaults, item.opts.media);
|
| 3553 |
|
| 3554 |
// Look for any matching media type
|
| 3555 |
-
$.each(media, function(providerName, providerOpts) {
|
| 3556 |
rez = url.match(providerOpts.matcher);
|
| 3557 |
|
| 3558 |
if (!rez) {
|
|
@@ -3590,7 +3614,7 @@
|
|
| 3590 |
$.type(providerOpts.thumb) === "function" ? providerOpts.thumb.call(this, rez, params, item) : format(providerOpts.thumb, rez);
|
| 3591 |
|
| 3592 |
if (providerName === "youtube") {
|
| 3593 |
-
url = url.replace(/&t=((\d+)m)?(\d+)s/, function(match, p1, m, s) {
|
| 3594 |
return "&start=" + ((m ? parseInt(m, 10) * 60 : 0) + parseInt(s, 10));
|
| 3595 |
});
|
| 3596 |
} else if (providerName === "vimeo") {
|
|
@@ -3646,12 +3670,12 @@
|
|
| 3646 |
loaded: false
|
| 3647 |
},
|
| 3648 |
|
| 3649 |
-
load: function(vendor) {
|
| 3650 |
var _this = this,
|
| 3651 |
script;
|
| 3652 |
|
| 3653 |
if (this[vendor].loaded) {
|
| 3654 |
-
setTimeout(function() {
|
| 3655 |
_this.done(vendor);
|
| 3656 |
});
|
| 3657 |
return;
|
|
@@ -3668,12 +3692,12 @@
|
|
| 3668 |
script.src = this[vendor].src;
|
| 3669 |
|
| 3670 |
if (vendor === "youtube") {
|
| 3671 |
-
window.onYouTubeIframeAPIReady = function() {
|
| 3672 |
_this[vendor].loaded = true;
|
| 3673 |
_this.done(vendor);
|
| 3674 |
};
|
| 3675 |
} else {
|
| 3676 |
-
script.onload = function() {
|
| 3677 |
_this[vendor].loaded = true;
|
| 3678 |
_this.done(vendor);
|
| 3679 |
};
|
|
@@ -3681,7 +3705,7 @@
|
|
| 3681 |
|
| 3682 |
document.body.appendChild(script);
|
| 3683 |
},
|
| 3684 |
-
done: function(vendor) {
|
| 3685 |
var instance, $el, player;
|
| 3686 |
|
| 3687 |
if (vendor === "youtube") {
|
|
@@ -3696,7 +3720,7 @@
|
|
| 3696 |
if (vendor === "youtube" && YT !== undefined && YT) {
|
| 3697 |
player = new YT.Player($el.attr("id"), {
|
| 3698 |
events: {
|
| 3699 |
-
onStateChange: function(e) {
|
| 3700 |
if (e.data == 0) {
|
| 3701 |
instance.next();
|
| 3702 |
}
|
|
@@ -3706,7 +3730,7 @@
|
|
| 3706 |
} else if (vendor === "vimeo" && Vimeo !== undefined && Vimeo) {
|
| 3707 |
player = new Vimeo.Player($el);
|
| 3708 |
|
| 3709 |
-
player.on("ended", function() {
|
| 3710 |
instance.next();
|
| 3711 |
});
|
| 3712 |
}
|
|
@@ -3715,49 +3739,48 @@
|
|
| 3715 |
};
|
| 3716 |
|
| 3717 |
$(document).on({
|
| 3718 |
-
"afterShow.fb": function(e, instance, current) {
|
| 3719 |
if (instance.group.length > 1 && (current.contentSource === "youtube" || current.contentSource === "vimeo")) {
|
| 3720 |
VideoAPILoader.load(current.contentSource);
|
| 3721 |
}
|
| 3722 |
}
|
| 3723 |
});
|
| 3724 |
})(jQuery);
|
| 3725 |
-
|
| 3726 |
// ==========================================================================
|
| 3727 |
//
|
| 3728 |
// Guestures
|
| 3729 |
// Adds touch guestures, handles click and tap events
|
| 3730 |
//
|
| 3731 |
// ==========================================================================
|
| 3732 |
-
(function(window, document, $) {
|
| 3733 |
"use strict";
|
| 3734 |
|
| 3735 |
-
var requestAFrame = (function() {
|
| 3736 |
return (
|
| 3737 |
window.requestAnimationFrame ||
|
| 3738 |
window.webkitRequestAnimationFrame ||
|
| 3739 |
window.mozRequestAnimationFrame ||
|
| 3740 |
window.oRequestAnimationFrame ||
|
| 3741 |
// if all else fails, use setTimeout
|
| 3742 |
-
function(callback) {
|
| 3743 |
return window.setTimeout(callback, 1000 / 60);
|
| 3744 |
}
|
| 3745 |
);
|
| 3746 |
})();
|
| 3747 |
|
| 3748 |
-
var cancelAFrame = (function() {
|
| 3749 |
return (
|
| 3750 |
window.cancelAnimationFrame ||
|
| 3751 |
window.webkitCancelAnimationFrame ||
|
| 3752 |
window.mozCancelAnimationFrame ||
|
| 3753 |
window.oCancelAnimationFrame ||
|
| 3754 |
-
function(id) {
|
| 3755 |
window.clearTimeout(id);
|
| 3756 |
}
|
| 3757 |
);
|
| 3758 |
})();
|
| 3759 |
|
| 3760 |
-
var getPointerXY = function(e) {
|
| 3761 |
var result = [];
|
| 3762 |
|
| 3763 |
e = e.originalEvent || e || window.e;
|
|
@@ -3780,7 +3803,7 @@
|
|
| 3780 |
return result;
|
| 3781 |
};
|
| 3782 |
|
| 3783 |
-
var distance = function(point2, point1, what) {
|
| 3784 |
if (!point1 || !point2) {
|
| 3785 |
return 0;
|
| 3786 |
}
|
|
@@ -3794,7 +3817,7 @@
|
|
| 3794 |
return Math.sqrt(Math.pow(point2.x - point1.x, 2) + Math.pow(point2.y - point1.y, 2));
|
| 3795 |
};
|
| 3796 |
|
| 3797 |
-
var isClickable = function($el) {
|
| 3798 |
if (
|
| 3799 |
$el.is('a,area,button,[role="button"],input,label,select,summary,textarea,video,audio,iframe') ||
|
| 3800 |
$.isFunction($el.get(0).onclick) ||
|
|
@@ -3813,7 +3836,7 @@
|
|
| 3813 |
return false;
|
| 3814 |
};
|
| 3815 |
|
| 3816 |
-
var hasScrollbars = function(el) {
|
| 3817 |
var overflowY = window.getComputedStyle(el)["overflow-y"],
|
| 3818 |
overflowX = window.getComputedStyle(el)["overflow-x"],
|
| 3819 |
vertical = (overflowY === "scroll" || overflowY === "auto") && el.scrollHeight > el.clientHeight,
|
|
@@ -3822,7 +3845,7 @@
|
|
| 3822 |
return vertical || horizontal;
|
| 3823 |
};
|
| 3824 |
|
| 3825 |
-
var isScrollable = function($el) {
|
| 3826 |
var rez = false;
|
| 3827 |
|
| 3828 |
while (true) {
|
|
@@ -3842,7 +3865,7 @@
|
|
| 3842 |
return rez;
|
| 3843 |
};
|
| 3844 |
|
| 3845 |
-
var Guestures = function(instance) {
|
| 3846 |
var self = this;
|
| 3847 |
|
| 3848 |
self.instance = instance;
|
|
@@ -3856,7 +3879,7 @@
|
|
| 3856 |
self.$container.on("touchstart.fb.touch mousedown.fb.touch", $.proxy(self, "ontouchstart"));
|
| 3857 |
};
|
| 3858 |
|
| 3859 |
-
Guestures.prototype.destroy = function() {
|
| 3860 |
var self = this;
|
| 3861 |
|
| 3862 |
self.$container.off(".fb.touch");
|
|
@@ -3874,7 +3897,7 @@
|
|
| 3874 |
}
|
| 3875 |
};
|
| 3876 |
|
| 3877 |
-
Guestures.prototype.ontouchstart = function(e) {
|
| 3878 |
var self = this,
|
| 3879 |
$target = $(e.target),
|
| 3880 |
instance = self.instance,
|
|
@@ -3941,7 +3964,10 @@
|
|
| 3941 |
self.canvasHeight = Math.round($slide[0].clientHeight);
|
| 3942 |
|
| 3943 |
self.contentLastPos = null;
|
| 3944 |
-
self.contentStartPos = $.fancyboxforwp.getTranslate(self.$content) || {
|
|
|
|
|
|
|
|
|
|
| 3945 |
self.sliderStartPos = $.fancyboxforwp.getTranslate($slide);
|
| 3946 |
|
| 3947 |
// Since position will be absolute, but we need to make it relative to the stage
|
|
@@ -3968,7 +3994,7 @@
|
|
| 3968 |
e.preventDefault();
|
| 3969 |
}
|
| 3970 |
|
| 3971 |
-
if (!($.fancyboxforwp.isMobile && $target.
|
| 3972 |
return;
|
| 3973 |
}
|
| 3974 |
}
|
|
@@ -4013,7 +4039,7 @@
|
|
| 4013 |
}
|
| 4014 |
};
|
| 4015 |
|
| 4016 |
-
Guestures.prototype.onscroll = function(e) {
|
| 4017 |
var self = this;
|
| 4018 |
|
| 4019 |
self.isScrolling = true;
|
|
@@ -4021,7 +4047,7 @@
|
|
| 4021 |
document.removeEventListener("scroll", self.onscroll, true);
|
| 4022 |
};
|
| 4023 |
|
| 4024 |
-
Guestures.prototype.ontouchmove = function(e) {
|
| 4025 |
var self = this;
|
| 4026 |
|
| 4027 |
// Make sure user has not released over iframe or disabled element
|
|
@@ -4062,7 +4088,7 @@
|
|
| 4062 |
}
|
| 4063 |
};
|
| 4064 |
|
| 4065 |
-
Guestures.prototype.onSwipe = function(e) {
|
| 4066 |
var self = this,
|
| 4067 |
instance = self.instance,
|
| 4068 |
swiping = self.isSwiping,
|
|
@@ -4096,7 +4122,7 @@
|
|
| 4096 |
// Reset points to avoid jumping, because we dropped first swipes to calculate the angle
|
| 4097 |
self.startPoints = self.newPoints;
|
| 4098 |
|
| 4099 |
-
$.each(instance.slides, function(index, slide) {
|
| 4100 |
var slidePos, stagePos;
|
| 4101 |
|
| 4102 |
$.fancyboxforwp.stop(slide.$slide);
|
|
@@ -4111,7 +4137,7 @@
|
|
| 4111 |
"transition-duration": ""
|
| 4112 |
})
|
| 4113 |
.removeClass("fancybox-animated")
|
| 4114 |
-
.removeClass(function(index, className) {
|
| 4115 |
return (className.match(/(^|\s)fancybox-fx-\S+/g) || []).join(" ");
|
| 4116 |
});
|
| 4117 |
|
|
@@ -4164,9 +4190,9 @@
|
|
| 4164 |
self.requestId = null;
|
| 4165 |
}
|
| 4166 |
|
| 4167 |
-
self.requestId = requestAFrame(function() {
|
| 4168 |
if (self.sliderLastPos) {
|
| 4169 |
-
$.each(self.instance.slides, function(index, slide) {
|
| 4170 |
var pos = slide.pos - self.instance.currPos;
|
| 4171 |
|
| 4172 |
$.fancyboxforwp.setTranslate(slide.$slide, {
|
|
@@ -4180,7 +4206,7 @@
|
|
| 4180 |
});
|
| 4181 |
};
|
| 4182 |
|
| 4183 |
-
Guestures.prototype.onPan = function() {
|
| 4184 |
var self = this;
|
| 4185 |
|
| 4186 |
// Prevent accidental movement (sometimes, when tapping casually, finger can move a bit)
|
|
@@ -4197,13 +4223,13 @@
|
|
| 4197 |
cancelAFrame(self.requestId);
|
| 4198 |
}
|
| 4199 |
|
| 4200 |
-
self.requestId = requestAFrame(function() {
|
| 4201 |
$.fancyboxforwp.setTranslate(self.$content, self.contentLastPos);
|
| 4202 |
});
|
| 4203 |
};
|
| 4204 |
|
| 4205 |
// Make panning sticky to the edges
|
| 4206 |
-
Guestures.prototype.limitMovement = function() {
|
| 4207 |
var self = this;
|
| 4208 |
|
| 4209 |
var canvasWidth = self.canvasWidth;
|
|
@@ -4263,7 +4289,7 @@
|
|
| 4263 |
};
|
| 4264 |
};
|
| 4265 |
|
| 4266 |
-
Guestures.prototype.limitPosition = function(newOffsetX, newOffsetY, newWidth, newHeight) {
|
| 4267 |
var self = this;
|
| 4268 |
|
| 4269 |
var canvasWidth = self.canvasWidth;
|
|
@@ -4291,7 +4317,7 @@
|
|
| 4291 |
};
|
| 4292 |
};
|
| 4293 |
|
| 4294 |
-
Guestures.prototype.onZoom = function() {
|
| 4295 |
var self = this;
|
| 4296 |
|
| 4297 |
// Calculate current distance between points to get pinch ratio and new width and height
|
|
@@ -4345,12 +4371,12 @@
|
|
| 4345 |
cancelAFrame(self.requestId);
|
| 4346 |
}
|
| 4347 |
|
| 4348 |
-
self.requestId = requestAFrame(function() {
|
| 4349 |
$.fancyboxforwp.setTranslate(self.$content, self.contentLastPos);
|
| 4350 |
});
|
| 4351 |
};
|
| 4352 |
|
| 4353 |
-
Guestures.prototype.ontouchend = function(e) {
|
| 4354 |
var self = this;
|
| 4355 |
|
| 4356 |
var swiping = self.isSwiping;
|
|
@@ -4401,7 +4427,7 @@
|
|
| 4401 |
return;
|
| 4402 |
};
|
| 4403 |
|
| 4404 |
-
Guestures.prototype.endSwiping = function(swiping, scrolling) {
|
| 4405 |
var self = this,
|
| 4406 |
ret = false,
|
| 4407 |
len = self.instance.group.length,
|
|
@@ -4415,8 +4441,7 @@
|
|
| 4415 |
if (swiping == "y" && !scrolling && Math.abs(self.distanceY) > 50) {
|
| 4416 |
// Continue vertical movement
|
| 4417 |
$.fancyboxforwp.animate(
|
| 4418 |
-
self.instance.current.$slide,
|
| 4419 |
-
{
|
| 4420 |
top: self.sliderStartPos.top + self.distanceY + self.velocityY * 150,
|
| 4421 |
opacity: 0
|
| 4422 |
},
|
|
@@ -4438,7 +4463,7 @@
|
|
| 4438 |
|
| 4439 |
// Limit panning from edges
|
| 4440 |
// ========================
|
| 4441 |
-
Guestures.prototype.endPanning = function() {
|
| 4442 |
var self = this,
|
| 4443 |
newOffsetX,
|
| 4444 |
newOffsetY,
|
|
@@ -4462,10 +4487,10 @@
|
|
| 4462 |
newPos.width = self.contentStartPos.width;
|
| 4463 |
newPos.height = self.contentStartPos.height;
|
| 4464 |
|
| 4465 |
-
$.fancyboxforwp.animate(self.$content, newPos,
|
| 4466 |
};
|
| 4467 |
|
| 4468 |
-
Guestures.prototype.endZooming = function() {
|
| 4469 |
var self = this;
|
| 4470 |
|
| 4471 |
var current = self.instance.current;
|
|
@@ -4505,7 +4530,7 @@
|
|
| 4505 |
}
|
| 4506 |
};
|
| 4507 |
|
| 4508 |
-
Guestures.prototype.onTap = function(e) {
|
| 4509 |
var self = this;
|
| 4510 |
var $target = $(e.target);
|
| 4511 |
|
|
@@ -4519,7 +4544,7 @@
|
|
| 4519 |
|
| 4520 |
var where;
|
| 4521 |
|
| 4522 |
-
var process = function(prefix) {
|
| 4523 |
var action = current.opts[prefix];
|
| 4524 |
|
| 4525 |
if ($.isFunction(action)) {
|
|
@@ -4588,9 +4613,9 @@
|
|
| 4588 |
} else if (
|
| 4589 |
instance.current.$content &&
|
| 4590 |
instance.current.$content
|
| 4591 |
-
|
| 4592 |
-
|
| 4593 |
-
|
| 4594 |
) {
|
| 4595 |
where = "Content";
|
| 4596 |
} else {
|
|
@@ -4617,7 +4642,7 @@
|
|
| 4617 |
self.tapY = tapY;
|
| 4618 |
|
| 4619 |
if (current.opts["dblclick" + where] && current.opts["dblclick" + where] !== current.opts["click" + where]) {
|
| 4620 |
-
self.tapped = setTimeout(function() {
|
| 4621 |
self.tapped = null;
|
| 4622 |
|
| 4623 |
if (!instance.isAnimating) {
|
|
@@ -4633,18 +4658,17 @@
|
|
| 4633 |
};
|
| 4634 |
|
| 4635 |
$(document)
|
| 4636 |
-
.on("onActivate.fb", function(e, instance) {
|
| 4637 |
if (instance && !instance.Guestures) {
|
| 4638 |
instance.Guestures = new Guestures(instance);
|
| 4639 |
}
|
| 4640 |
})
|
| 4641 |
-
.on("beforeClose.fb", function(e, instance) {
|
| 4642 |
if (instance && instance.Guestures) {
|
| 4643 |
instance.Guestures.destroy();
|
| 4644 |
}
|
| 4645 |
});
|
| 4646 |
})(window, document, jQuery);
|
| 4647 |
-
|
| 4648 |
// ==========================================================================
|
| 4649 |
//
|
| 4650 |
// SlideShow
|
|
@@ -4654,13 +4678,12 @@
|
|
| 4654 |
// $.fancyboxforwp.getInstance().SlideShow.start()
|
| 4655 |
//
|
| 4656 |
// ==========================================================================
|
| 4657 |
-
(function(document, $) {
|
| 4658 |
"use strict";
|
| 4659 |
|
| 4660 |
$.extend(true, $.fancyboxforwp.defaults, {
|
| 4661 |
btnTpl: {
|
| 4662 |
-
slideShow:
|
| 4663 |
-
'<button data-fancybox-play class="fancybox-button fancybox-button--play" title="{{PLAY_START}}">' +
|
| 4664 |
'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M6.5 5.4v13.2l11-6.6z"/></svg>' +
|
| 4665 |
'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M8.33 5.75h2.2v12.5h-2.2V5.75zm5.15 0h2.2v12.5h-2.2V5.75z"/></svg>' +
|
| 4666 |
"</button>"
|
|
@@ -4672,7 +4695,7 @@
|
|
| 4672 |
}
|
| 4673 |
});
|
| 4674 |
|
| 4675 |
-
var SlideShow = function(instance) {
|
| 4676 |
this.instance = instance;
|
| 4677 |
this.init();
|
| 4678 |
};
|
|
@@ -4682,12 +4705,12 @@
|
|
| 4682 |
isActive: false,
|
| 4683 |
$button: null,
|
| 4684 |
|
| 4685 |
-
init: function() {
|
| 4686 |
var self = this,
|
| 4687 |
instance = self.instance,
|
| 4688 |
opts = instance.group[instance.currIndex].opts.slideShow;
|
| 4689 |
|
| 4690 |
-
self.$button = instance.$refs.toolbar.find("[data-fancybox-play]").on("click", function() {
|
| 4691 |
self.toggle();
|
| 4692 |
});
|
| 4693 |
|
|
@@ -4698,7 +4721,7 @@
|
|
| 4698 |
}
|
| 4699 |
},
|
| 4700 |
|
| 4701 |
-
set: function(force) {
|
| 4702 |
var self = this,
|
| 4703 |
instance = self.instance,
|
| 4704 |
current = instance.current;
|
|
@@ -4707,11 +4730,17 @@
|
|
| 4707 |
if (current && (force === true || current.opts.loop || instance.currIndex < instance.group.length - 1)) {
|
| 4708 |
if (self.isActive && current.contentType !== "video") {
|
| 4709 |
if (self.$progress) {
|
| 4710 |
-
$.fancyboxforwp.animate(self.$progress.show(), {
|
|
|
|
|
|
|
| 4711 |
}
|
| 4712 |
|
| 4713 |
-
self.timer = setTimeout(function() {
|
| 4714 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4715 |
}, current.opts.slideShow.speed);
|
| 4716 |
}
|
| 4717 |
} else {
|
|
@@ -4721,7 +4750,7 @@
|
|
| 4721 |
}
|
| 4722 |
},
|
| 4723 |
|
| 4724 |
-
clear: function() {
|
| 4725 |
var self = this;
|
| 4726 |
|
| 4727 |
clearTimeout(self.timer);
|
|
@@ -4733,13 +4762,13 @@
|
|
| 4733 |
}
|
| 4734 |
},
|
| 4735 |
|
| 4736 |
-
start: function() {
|
| 4737 |
var self = this,
|
| 4738 |
current = self.instance.current;
|
| 4739 |
|
| 4740 |
if (current) {
|
| 4741 |
self.$button
|
| 4742 |
-
.attr("title", current.opts.i18n[current.opts.lang].PLAY_STOP)
|
| 4743 |
.removeClass("fancybox-button--play")
|
| 4744 |
.addClass("fancybox-button--pause");
|
| 4745 |
|
|
@@ -4753,14 +4782,14 @@
|
|
| 4753 |
}
|
| 4754 |
},
|
| 4755 |
|
| 4756 |
-
stop: function() {
|
| 4757 |
var self = this,
|
| 4758 |
current = self.instance.current;
|
| 4759 |
|
| 4760 |
self.clear();
|
| 4761 |
|
| 4762 |
self.$button
|
| 4763 |
-
.attr("title", current.opts.i18n[current.opts.lang].PLAY_START)
|
| 4764 |
.removeClass("fancybox-button--pause")
|
| 4765 |
.addClass("fancybox-button--play");
|
| 4766 |
|
|
@@ -4773,7 +4802,7 @@
|
|
| 4773 |
}
|
| 4774 |
},
|
| 4775 |
|
| 4776 |
-
toggle: function() {
|
| 4777 |
var self = this;
|
| 4778 |
|
| 4779 |
if (self.isActive) {
|
|
@@ -4785,13 +4814,13 @@
|
|
| 4785 |
});
|
| 4786 |
|
| 4787 |
$(document).on({
|
| 4788 |
-
"onInit.fb": function(e, instance) {
|
| 4789 |
if (instance && !instance.SlideShow) {
|
| 4790 |
instance.SlideShow = new SlideShow(instance);
|
| 4791 |
}
|
| 4792 |
},
|
| 4793 |
|
| 4794 |
-
"beforeShow.fb": function(e, instance, current, firstRun) {
|
| 4795 |
var SlideShow = instance && instance.SlideShow;
|
| 4796 |
|
| 4797 |
if (firstRun) {
|
|
@@ -4803,7 +4832,7 @@
|
|
| 4803 |
}
|
| 4804 |
},
|
| 4805 |
|
| 4806 |
-
"afterShow.fb": function(e, instance, current) {
|
| 4807 |
var SlideShow = instance && instance.SlideShow;
|
| 4808 |
|
| 4809 |
if (SlideShow && SlideShow.isActive) {
|
|
@@ -4811,7 +4840,7 @@
|
|
| 4811 |
}
|
| 4812 |
},
|
| 4813 |
|
| 4814 |
-
"afterKeydown.fb": function(e, instance, current, keypress, keycode) {
|
| 4815 |
var SlideShow = instance && instance.SlideShow;
|
| 4816 |
|
| 4817 |
// "P" or Spacebar
|
|
@@ -4822,7 +4851,7 @@
|
|
| 4822 |
}
|
| 4823 |
},
|
| 4824 |
|
| 4825 |
-
"beforeClose.fb onDeactivate.fb": function(e, instance) {
|
| 4826 |
var SlideShow = instance && instance.SlideShow;
|
| 4827 |
|
| 4828 |
if (SlideShow) {
|
|
@@ -4832,7 +4861,7 @@
|
|
| 4832 |
});
|
| 4833 |
|
| 4834 |
// Page Visibility API to pause slideshow when window is not active
|
| 4835 |
-
$(document).on("visibilitychange", function() {
|
| 4836 |
var instance = $.fancyboxforwp.getInstance(),
|
| 4837 |
SlideShow = instance && instance.SlideShow;
|
| 4838 |
|
|
@@ -4845,18 +4874,17 @@
|
|
| 4845 |
}
|
| 4846 |
});
|
| 4847 |
})(document, jQuery);
|
| 4848 |
-
|
| 4849 |
// ==========================================================================
|
| 4850 |
//
|
| 4851 |
// FullScreen
|
| 4852 |
// Adds fullscreen functionality
|
| 4853 |
//
|
| 4854 |
// ==========================================================================
|
| 4855 |
-
(function(document, $) {
|
| 4856 |
"use strict";
|
| 4857 |
|
| 4858 |
// Collection of methods supported by user browser
|
| 4859 |
-
var fn = (function() {
|
| 4860 |
var fnMap = [
|
| 4861 |
["requestFullscreen", "exitFullscreen", "fullscreenElement", "fullscreenEnabled", "fullscreenchange", "fullscreenerror"],
|
| 4862 |
// new WebKit
|
|
@@ -4907,15 +4935,15 @@
|
|
| 4907 |
|
| 4908 |
if (fn) {
|
| 4909 |
var FullScreen = {
|
| 4910 |
-
request: function(elem) {
|
| 4911 |
elem = elem || document.documentElement;
|
| 4912 |
|
| 4913 |
elem[fn.requestFullscreen](elem.ALLOW_KEYBOARD_INPUT);
|
| 4914 |
},
|
| 4915 |
-
exit: function() {
|
| 4916 |
document[fn.exitFullscreen]();
|
| 4917 |
},
|
| 4918 |
-
toggle: function(elem) {
|
| 4919 |
elem = elem || document.documentElement;
|
| 4920 |
|
| 4921 |
if (this.isFullscreen()) {
|
|
@@ -4924,18 +4952,17 @@
|
|
| 4924 |
this.request(elem);
|
| 4925 |
}
|
| 4926 |
},
|
| 4927 |
-
isFullscreen: function() {
|
| 4928 |
return Boolean(document[fn.fullscreenElement]);
|
| 4929 |
},
|
| 4930 |
-
enabled: function() {
|
| 4931 |
return Boolean(document[fn.fullscreenEnabled]);
|
| 4932 |
}
|
| 4933 |
};
|
| 4934 |
|
| 4935 |
$.extend(true, $.fancyboxforwp.defaults, {
|
| 4936 |
btnTpl: {
|
| 4937 |
-
fullScreen:
|
| 4938 |
-
'<button data-fancybox-fullscreen class="fancybox-button fancybox-button--fsenter" title="{{FULL_SCREEN}}">' +
|
| 4939 |
'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z"/></svg>' +
|
| 4940 |
'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M5 16h3v3h2v-5H5zm3-8H5v2h5V5H8zm6 11h2v-3h3v-2h-5zm2-11V5h-2v5h5V8z"/></svg>' +
|
| 4941 |
"</button>"
|
|
@@ -4945,18 +4972,20 @@
|
|
| 4945 |
}
|
| 4946 |
});
|
| 4947 |
|
| 4948 |
-
$(document).on(fn.fullscreenchange, function() {
|
| 4949 |
var isFullscreen = FullScreen.isFullscreen(),
|
| 4950 |
instance = $.fancyboxforwp.getInstance();
|
| 4951 |
|
| 4952 |
if (instance) {
|
| 4953 |
// If image is zooming, then force to stop and reposition properly
|
| 4954 |
if (instance.current && instance.current.type === "image" && instance.isAnimating) {
|
| 4955 |
-
instance.current.$content.css("transition", "none");
|
| 4956 |
-
|
| 4957 |
instance.isAnimating = false;
|
| 4958 |
|
| 4959 |
instance.update(true, true, 0);
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4960 |
}
|
| 4961 |
|
| 4962 |
instance.trigger("onFullscreenChange", isFullscreen);
|
|
@@ -4972,7 +5001,7 @@
|
|
| 4972 |
}
|
| 4973 |
|
| 4974 |
$(document).on({
|
| 4975 |
-
"onInit.fb": function(e, instance) {
|
| 4976 |
var $container;
|
| 4977 |
|
| 4978 |
if (!fn) {
|
|
@@ -4984,7 +5013,7 @@
|
|
| 4984 |
if (instance && instance.group[instance.currIndex].opts.fullScreen) {
|
| 4985 |
$container = instance.$refs.container;
|
| 4986 |
|
| 4987 |
-
$container.on("click.fb-fullscreen", "[data-fancybox-fullscreen]", function(e) {
|
| 4988 |
e.stopPropagation();
|
| 4989 |
e.preventDefault();
|
| 4990 |
|
|
@@ -5002,7 +5031,7 @@
|
|
| 5002 |
}
|
| 5003 |
},
|
| 5004 |
|
| 5005 |
-
"afterKeydown.fb": function(e, instance, current, keypress, keycode) {
|
| 5006 |
// "F"
|
| 5007 |
if (instance && instance.FullScreen && keycode === 70) {
|
| 5008 |
keypress.preventDefault();
|
|
@@ -5011,21 +5040,20 @@
|
|
| 5011 |
}
|
| 5012 |
},
|
| 5013 |
|
| 5014 |
-
"beforeClose.fb": function(e, instance) {
|
| 5015 |
if (instance && instance.FullScreen && instance.$refs.container.hasClass("fancybox-is-fullscreen")) {
|
| 5016 |
FullScreen.exit();
|
| 5017 |
}
|
| 5018 |
}
|
| 5019 |
});
|
| 5020 |
})(document, jQuery);
|
| 5021 |
-
|
| 5022 |
// ==========================================================================
|
| 5023 |
//
|
| 5024 |
// Thumbs
|
| 5025 |
// Displays thumbnails in a grid
|
| 5026 |
//
|
| 5027 |
// ==========================================================================
|
| 5028 |
-
(function(document, $) {
|
| 5029 |
"use strict";
|
| 5030 |
|
| 5031 |
var CLASS = "fancybox-thumbs",
|
|
@@ -5033,11 +5061,9 @@
|
|
| 5033 |
|
| 5034 |
// Make sure there are default values
|
| 5035 |
$.fancyboxforwp.defaults = $.extend(
|
| 5036 |
-
true,
|
| 5037 |
-
{
|
| 5038 |
btnTpl: {
|
| 5039 |
-
thumbs:
|
| 5040 |
-
'<button data-fancybox-thumbs class="fancybox-button fancybox-button--thumbs" title="{{THUMBS}}">' +
|
| 5041 |
'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M14.59 14.59h3.76v3.76h-3.76v-3.76zm-4.47 0h3.76v3.76h-3.76v-3.76zm-4.47 0h3.76v3.76H5.65v-3.76zm8.94-4.47h3.76v3.76h-3.76v-3.76zm-4.47 0h3.76v3.76h-3.76v-3.76zm-4.47 0h3.76v3.76H5.65v-3.76zm8.94-4.47h3.76v3.76h-3.76V5.65zm-4.47 0h3.76v3.76h-3.76V5.65zm-4.47 0h3.76v3.76H5.65V5.65z"/></svg>' +
|
| 5042 |
"</button>"
|
| 5043 |
},
|
|
@@ -5051,7 +5077,7 @@
|
|
| 5051 |
$.fancyboxforwp.defaults
|
| 5052 |
);
|
| 5053 |
|
| 5054 |
-
var FancyThumbs = function(instance) {
|
| 5055 |
this.init(instance);
|
| 5056 |
};
|
| 5057 |
|
|
@@ -5062,7 +5088,7 @@
|
|
| 5062 |
isVisible: false,
|
| 5063 |
isActive: false,
|
| 5064 |
|
| 5065 |
-
init: function(instance) {
|
| 5066 |
var self = this,
|
| 5067 |
group = instance.group,
|
| 5068 |
enabled = 0;
|
|
@@ -5086,7 +5112,7 @@
|
|
| 5086 |
}
|
| 5087 |
|
| 5088 |
if (enabled > 1 && !!self.opts) {
|
| 5089 |
-
self.$button.removeAttr("style").on("click", function() {
|
| 5090 |
self.toggle();
|
| 5091 |
});
|
| 5092 |
|
|
@@ -5096,7 +5122,7 @@
|
|
| 5096 |
}
|
| 5097 |
},
|
| 5098 |
|
| 5099 |
-
create: function() {
|
| 5100 |
var self = this,
|
| 5101 |
instance = self.instance,
|
| 5102 |
parentEl = self.opts.parentEl,
|
|
@@ -5107,13 +5133,13 @@
|
|
| 5107 |
// Create main element
|
| 5108 |
self.$grid = $('<div class="' + CLASS + " " + CLASS + "-" + self.opts.axis + '"></div>').appendTo(
|
| 5109 |
instance.$refs.container
|
| 5110 |
-
|
| 5111 |
-
|
| 5112 |
-
|
| 5113 |
);
|
| 5114 |
|
| 5115 |
// Add "click" event that performs gallery navigation
|
| 5116 |
-
self.$grid.on("click", "a", function() {
|
| 5117 |
instance.jumpTo($(this).attr("data-index"));
|
| 5118 |
});
|
| 5119 |
}
|
|
@@ -5123,7 +5149,7 @@
|
|
| 5123 |
self.$list = $('<div class="' + CLASS + '__list">').appendTo(self.$grid);
|
| 5124 |
}
|
| 5125 |
|
| 5126 |
-
$.each(instance.group, function(i, item) {
|
| 5127 |
src = item.thumb;
|
| 5128 |
|
| 5129 |
if (!src && item.type === "image") {
|
|
@@ -5132,10 +5158,10 @@
|
|
| 5132 |
|
| 5133 |
list.push(
|
| 5134 |
'<a href="javascript:;" tabindex="0" data-index="' +
|
| 5135 |
-
|
| 5136 |
-
|
| 5137 |
-
|
| 5138 |
-
|
| 5139 |
);
|
| 5140 |
});
|
| 5141 |
|
|
@@ -5145,16 +5171,16 @@
|
|
| 5145 |
// Set fixed width for list element to enable horizontal scrolling
|
| 5146 |
self.$list.width(
|
| 5147 |
parseInt(self.$grid.css("padding-right"), 10) +
|
| 5148 |
-
|
| 5149 |
-
|
| 5150 |
-
|
| 5151 |
-
|
| 5152 |
-
|
| 5153 |
);
|
| 5154 |
}
|
| 5155 |
},
|
| 5156 |
|
| 5157 |
-
focus: function(duration) {
|
| 5158 |
var self = this,
|
| 5159 |
$list = self.$list,
|
| 5160 |
$grid = self.$grid,
|
|
@@ -5175,8 +5201,7 @@
|
|
| 5175 |
|
| 5176 |
// Check if need to scroll to make current thumb visible
|
| 5177 |
if (self.opts.axis === "y" && (thumbPos.top < 0 || thumbPos.top > $list.height() - thumb.outerHeight())) {
|
| 5178 |
-
$list.stop().animate(
|
| 5179 |
-
{
|
| 5180 |
scrollTop: $list.scrollTop() + thumbPos.top
|
| 5181 |
},
|
| 5182 |
duration
|
|
@@ -5188,8 +5213,7 @@
|
|
| 5188 |
$list
|
| 5189 |
.parent()
|
| 5190 |
.stop()
|
| 5191 |
-
.animate(
|
| 5192 |
-
{
|
| 5193 |
scrollLeft: thumbPos.left
|
| 5194 |
},
|
| 5195 |
duration
|
|
@@ -5197,7 +5221,7 @@
|
|
| 5197 |
}
|
| 5198 |
},
|
| 5199 |
|
| 5200 |
-
update: function() {
|
| 5201 |
var that = this;
|
| 5202 |
that.instance.$refs.container.toggleClass("fancybox-show-thumbs", this.isVisible);
|
| 5203 |
|
|
@@ -5217,24 +5241,24 @@
|
|
| 5217 |
that.instance.update();
|
| 5218 |
},
|
| 5219 |
|
| 5220 |
-
hide: function() {
|
| 5221 |
this.isVisible = false;
|
| 5222 |
this.update();
|
| 5223 |
},
|
| 5224 |
|
| 5225 |
-
show: function() {
|
| 5226 |
this.isVisible = true;
|
| 5227 |
this.update();
|
| 5228 |
},
|
| 5229 |
|
| 5230 |
-
toggle: function() {
|
| 5231 |
this.isVisible = !this.isVisible;
|
| 5232 |
this.update();
|
| 5233 |
}
|
| 5234 |
});
|
| 5235 |
|
| 5236 |
$(document).on({
|
| 5237 |
-
"onInit.fb": function(e, instance) {
|
| 5238 |
var Thumbs;
|
| 5239 |
|
| 5240 |
if (instance && !instance.Thumbs) {
|
|
@@ -5246,7 +5270,7 @@
|
|
| 5246 |
}
|
| 5247 |
},
|
| 5248 |
|
| 5249 |
-
"beforeShow.fb": function(e, instance, item, firstRun) {
|
| 5250 |
var Thumbs = instance && instance.Thumbs;
|
| 5251 |
|
| 5252 |
if (Thumbs && Thumbs.isVisible) {
|
|
@@ -5254,7 +5278,7 @@
|
|
| 5254 |
}
|
| 5255 |
},
|
| 5256 |
|
| 5257 |
-
"afterKeydown.fb": function(e, instance, current, keypress, keycode) {
|
| 5258 |
var Thumbs = instance && instance.Thumbs;
|
| 5259 |
|
| 5260 |
// "G"
|
|
@@ -5265,7 +5289,7 @@
|
|
| 5265 |
}
|
| 5266 |
},
|
| 5267 |
|
| 5268 |
-
"beforeClose.fb": function(e, instance) {
|
| 5269 |
var Thumbs = instance && instance.Thumbs;
|
| 5270 |
|
| 5271 |
if (Thumbs && Thumbs.isVisible && Thumbs.opts.hideOnClose !== false) {
|
|
@@ -5274,31 +5298,28 @@
|
|
| 5274 |
}
|
| 5275 |
});
|
| 5276 |
})(document, jQuery);
|
| 5277 |
-
|
| 5278 |
//// ==========================================================================
|
| 5279 |
//
|
| 5280 |
// Share
|
| 5281 |
// Displays simple form for sharing current url
|
| 5282 |
//
|
| 5283 |
// ==========================================================================
|
| 5284 |
-
(function(document, $) {
|
| 5285 |
"use strict";
|
| 5286 |
|
| 5287 |
$.extend(true, $.fancyboxforwp.defaults, {
|
| 5288 |
btnTpl: {
|
| 5289 |
-
share:
|
| 5290 |
-
'<button data-fancybox-share class="fancybox-button fancybox-button--share" title="{{SHARE}}">' +
|
| 5291 |
'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M2.55 19c1.4-8.4 9.1-9.8 11.9-9.8V5l7 7-7 6.3v-3.5c-2.8 0-10.5 2.1-11.9 4.2z"/></svg>' +
|
| 5292 |
"</button>"
|
| 5293 |
},
|
| 5294 |
share: {
|
| 5295 |
-
url: function(instance, item) {
|
| 5296 |
return (
|
| 5297 |
(!instance.currentHash && !(item.type === "inline" || item.type === "html") ? item.origSrc || item.src : false) || window.location
|
| 5298 |
);
|
| 5299 |
},
|
| 5300 |
-
tpl:
|
| 5301 |
-
'<div class="fancybox-share">' +
|
| 5302 |
"<h1>{{SHARE}}</h1>" +
|
| 5303 |
"<p>" +
|
| 5304 |
'<a class="fancybox-share__button fancybox-share__button--fb" href="https://www.facebook.com/sharer/sharer.php?u={{url}}">' +
|
|
@@ -5331,12 +5352,12 @@
|
|
| 5331 |
"=": "="
|
| 5332 |
};
|
| 5333 |
|
| 5334 |
-
return String(string).replace(/[&<>"'`=\/]/g, function(s) {
|
| 5335 |
return entityMap[s];
|
| 5336 |
});
|
| 5337 |
}
|
| 5338 |
|
| 5339 |
-
$(document).on("click", "[data-fancybox-share]", function() {
|
| 5340 |
var instance = $.fancyboxforwp.getInstance(),
|
| 5341 |
current = instance.current || null,
|
| 5342 |
url,
|
|
@@ -5362,14 +5383,14 @@
|
|
| 5362 |
opts: {
|
| 5363 |
touch: false,
|
| 5364 |
animationEffect: false,
|
| 5365 |
-
afterLoad: function(shareInstance, shareCurrent) {
|
| 5366 |
// Close self if parent instance is closing
|
| 5367 |
-
instance.$refs.container.one("beforeClose.fb", function() {
|
| 5368 |
shareInstance.close(null, 0);
|
| 5369 |
});
|
| 5370 |
|
| 5371 |
// Opening links in a popup window
|
| 5372 |
-
shareCurrent.$content.find(".fancybox-share__button").
|
| 5373 |
window.open(this.href, "Share", "width=550, height=450");
|
| 5374 |
return false;
|
| 5375 |
});
|
|
@@ -5381,21 +5402,20 @@
|
|
| 5381 |
});
|
| 5382 |
});
|
| 5383 |
})(document, jQuery);
|
| 5384 |
-
|
| 5385 |
// ==========================================================================
|
| 5386 |
//
|
| 5387 |
// Hash
|
| 5388 |
// Enables linking to each modal
|
| 5389 |
//
|
| 5390 |
// ==========================================================================
|
| 5391 |
-
(function(window, document, $) {
|
| 5392 |
"use strict";
|
| 5393 |
|
| 5394 |
// Simple $.escapeSelector polyfill (for jQuery prior v3)
|
| 5395 |
if (!$.escapeSelector) {
|
| 5396 |
-
$.escapeSelector = function(sel) {
|
| 5397 |
var rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g;
|
| 5398 |
-
var fcssescape = function(ch, asCodePoint) {
|
| 5399 |
if (asCodePoint) {
|
| 5400 |
// U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
|
| 5401 |
if (ch === "\0") {
|
|
@@ -5456,7 +5476,7 @@
|
|
| 5456 |
}
|
| 5457 |
|
| 5458 |
// Start when DOM becomes ready
|
| 5459 |
-
$(function() {
|
| 5460 |
// Check if user has disabled this module
|
| 5461 |
if ($.fancyboxforwp.defaults.hash === false) {
|
| 5462 |
return;
|
|
@@ -5464,7 +5484,7 @@
|
|
| 5464 |
|
| 5465 |
// Update hash when opening/closing fancyBox
|
| 5466 |
$(document).on({
|
| 5467 |
-
"onInit.fb": function(e, instance) {
|
| 5468 |
var url, gallery;
|
| 5469 |
|
| 5470 |
if (instance.group[instance.currIndex].opts.hash === false) {
|
|
@@ -5480,7 +5500,7 @@
|
|
| 5480 |
}
|
| 5481 |
},
|
| 5482 |
|
| 5483 |
-
"beforeShow.fb": function(e, instance, current, firstRun) {
|
| 5484 |
var gallery;
|
| 5485 |
|
| 5486 |
if (!current || current.opts.hash === false) {
|
|
@@ -5512,10 +5532,9 @@
|
|
| 5512 |
}
|
| 5513 |
|
| 5514 |
// Update hash
|
| 5515 |
-
instance.hashTimer = setTimeout(function() {
|
| 5516 |
if ("replaceState" in window.history) {
|
| 5517 |
-
window.history[firstRun ? "pushState" : "replaceState"](
|
| 5518 |
-
{},
|
| 5519 |
document.title,
|
| 5520 |
window.location.pathname + window.location.search + "#" + instance.currentHash
|
| 5521 |
);
|
|
@@ -5531,8 +5550,8 @@
|
|
| 5531 |
}, 300);
|
| 5532 |
},
|
| 5533 |
|
| 5534 |
-
"beforeClose.fb": function(e, instance, current) {
|
| 5535 |
-
if (current.opts.hash === false) {
|
| 5536 |
return;
|
| 5537 |
}
|
| 5538 |
|
|
@@ -5554,16 +5573,16 @@
|
|
| 5554 |
});
|
| 5555 |
|
| 5556 |
// Check if need to start/close after url has changed
|
| 5557 |
-
$(window).on("hashchange.fb", function() {
|
| 5558 |
var url = parseUrl(),
|
| 5559 |
fb = null;
|
| 5560 |
|
| 5561 |
// Find last fancyBox instance that has "hash"
|
| 5562 |
$.each(
|
| 5563 |
$(".fancybox-container")
|
| 5564 |
-
|
| 5565 |
-
|
| 5566 |
-
function(index, value) {
|
| 5567 |
var tmp = $(value).data("FancyBox");
|
| 5568 |
|
| 5569 |
if (tmp && tmp.currentHash) {
|
|
@@ -5586,28 +5605,27 @@
|
|
| 5586 |
});
|
| 5587 |
|
| 5588 |
// Check current hash and trigger click event on matching element to start fancyBox, if needed
|
| 5589 |
-
setTimeout(function() {
|
| 5590 |
if (!$.fancyboxforwp.getInstance()) {
|
| 5591 |
triggerFromUrl(parseUrl());
|
| 5592 |
}
|
| 5593 |
}, 50);
|
| 5594 |
});
|
| 5595 |
})(window, document, jQuery);
|
| 5596 |
-
|
| 5597 |
// ==========================================================================
|
| 5598 |
//
|
| 5599 |
// Wheel
|
| 5600 |
// Basic mouse weheel support for gallery navigation
|
| 5601 |
//
|
| 5602 |
// ==========================================================================
|
| 5603 |
-
(function(document, $) {
|
| 5604 |
"use strict";
|
| 5605 |
|
| 5606 |
var prevTime = new Date().getTime();
|
| 5607 |
|
| 5608 |
$(document).on({
|
| 5609 |
-
"onInit.fb": function(e, instance, current) {
|
| 5610 |
-
instance.$refs.stage.on("mousewheel DOMMouseScroll wheel MozMousePixelScroll", function(e) {
|
| 5611 |
var current = instance.current,
|
| 5612 |
currTime = new Date().getTime();
|
| 5613 |
|
|
@@ -5634,4 +5652,4 @@
|
|
| 5634 |
});
|
| 5635 |
}
|
| 5636 |
});
|
| 5637 |
-
})(document, jQuery);
|
| 1 |
// ==================================================
|
| 2 |
+
// fancyBox v3.5.7
|
| 3 |
//
|
| 4 |
// Licensed GPLv3 for open source use
|
| 5 |
// or fancyBox Commercial License for commercial use
|
| 6 |
//
|
| 7 |
// http://fancyapps.com/fancybox/
|
| 8 |
+
// Copyright 2019 fancyApps
|
| 9 |
//
|
| 10 |
// ==================================================
|
| 11 |
+
(function (window, document, $, undefined) {
|
| 12 |
"use strict";
|
| 13 |
|
| 14 |
window.console = window.console || {
|
| 15 |
+
info: function (stuff) {}
|
| 16 |
};
|
| 17 |
|
| 18 |
// If there's no jQuery, fancyBox can't work
|
| 110 |
|
| 111 |
iframe: {
|
| 112 |
// Iframe template
|
| 113 |
+
tpl: '<iframe id="fancybox-frame{rnd}" name="fancybox-frame{rnd}" class="fancybox-iframe" allowfullscreen="allowfullscreen" allow="autoplay; fullscreen" src=""></iframe>',
|
|
|
|
| 114 |
|
| 115 |
// Preload iframe before displaying it
|
| 116 |
// This allows to calculate iframe content width and height
|
| 129 |
|
| 130 |
// For HTML5 video only
|
| 131 |
video: {
|
| 132 |
+
tpl: '<video class="fancybox-video" controls controlsList="nodownload" poster="{{poster}}">' +
|
|
|
|
| 133 |
'<source src="{{src}}" type="{{format}}" />' +
|
| 134 |
'Sorry, your browser doesn\'t support embedded videos, <a href="{{src}}">download</a> and watch with your favorite video player!' +
|
| 135 |
"</video>",
|
| 179 |
baseClass: "",
|
| 180 |
|
| 181 |
// Base template for layout
|
| 182 |
+
baseTpl: '<div class="fancybox-container" role="dialog" tabindex="-1">' +
|
|
|
|
| 183 |
'<div class="fancybox-bg"></div>' +
|
| 184 |
'<div class="fancybox-inner">' +
|
| 185 |
'<div class="fancybox-infobar"><span data-fancybox-index></span> / <span data-fancybox-count></span></div>' +
|
| 186 |
'<div class="fancybox-toolbar">{{buttons}}</div>' +
|
| 187 |
'<div class="fancybox-navigation">{{arrows}}</div>' +
|
| 188 |
'<div class="fancybox-stage"></div>' +
|
| 189 |
+
'<div class="fancybox-caption"><div class="fancybox-caption__body"></div></div>' +
|
| 190 |
"</div>" +
|
| 191 |
"</div>",
|
| 192 |
|
| 197 |
errorTpl: '<div class="fancybox-error"><p>{{ERROR}}</p></div>',
|
| 198 |
|
| 199 |
btnTpl: {
|
| 200 |
+
download: '<a download data-fancybox-download class="fancybox-button fancybox-button--download" title="{{DOWNLOAD}}" href="javascript:;">' +
|
|
|
|
| 201 |
'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M18.62 17.09V19H5.38v-1.91zm-2.97-6.96L17 11.45l-5 4.87-5-4.87 1.36-1.32 2.68 2.64V5h1.92v7.77z"/></svg>' +
|
| 202 |
"</a>",
|
| 203 |
|
| 204 |
+
zoom: '<button data-fancybox-zoom class="fancybox-button fancybox-button--zoom" title="{{ZOOM}}">' +
|
|
|
|
| 205 |
'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M18.7 17.3l-3-3a5.9 5.9 0 0 0-.6-7.6 5.9 5.9 0 0 0-8.4 0 5.9 5.9 0 0 0 0 8.4 5.9 5.9 0 0 0 7.7.7l3 3a1 1 0 0 0 1.3 0c.4-.5.4-1 0-1.5zM8.1 13.8a4 4 0 0 1 0-5.7 4 4 0 0 1 5.7 0 4 4 0 0 1 0 5.7 4 4 0 0 1-5.7 0z"/></svg>' +
|
| 206 |
"</button>",
|
| 207 |
|
| 208 |
+
close: '<button data-fancybox-close class="fancybox-button fancybox-button--close" title="{{CLOSE}}">' +
|
|
|
|
| 209 |
'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 10.6L6.6 5.2 5.2 6.6l5.4 5.4-5.4 5.4 1.4 1.4 5.4-5.4 5.4 5.4 1.4-1.4-5.4-5.4 5.4-5.4-1.4-1.4-5.4 5.4z"/></svg>' +
|
| 210 |
"</button>",
|
| 211 |
|
| 212 |
// Arrows
|
| 213 |
+
arrowLeft: '<button data-fancybox-prev class="fancybox-button fancybox-button--arrow_left" title="{{PREV}}">' +
|
|
|
|
| 214 |
'<div><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M11.28 15.7l-1.34 1.37L5 12l4.94-5.07 1.34 1.38-2.68 2.72H19v1.94H8.6z"/></svg></div>' +
|
| 215 |
"</button>",
|
| 216 |
|
| 217 |
+
arrowRight: '<button data-fancybox-next class="fancybox-button fancybox-button--arrow_right" title="{{NEXT}}">' +
|
|
|
|
| 218 |
'<div><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M15.4 12.97l-2.68 2.72 1.34 1.38L19 12l-4.94-5.07-1.34 1.38 2.68 2.72H5v1.94z"/></svg></div>' +
|
| 219 |
"</button>",
|
| 220 |
|
| 221 |
// This small close button will be appended to your html/inline/ajax content by default,
|
| 222 |
// if "smallBtn" option is not set to false
|
| 223 |
+
smallBtn: '<button type="button" data-fancybox-close class="fancybox-button fancybox-close-small" title="{{CLOSE}}">' +
|
|
|
|
| 224 |
'<svg xmlns="http://www.w3.org/2000/svg" version="1" viewBox="0 0 24 24"><path d="M13 12l5-5-1-1-5 5-5-5-1 1 5 5-5 5 1 1 5-5 5 5 1-1z"/></svg>' +
|
| 225 |
"</button>"
|
| 226 |
},
|
| 330 |
// false - do nothing
|
| 331 |
|
| 332 |
// Clicked on the content
|
| 333 |
+
clickContent: function (current, event) {
|
| 334 |
return current.type === "image" ? "zoom" : false;
|
| 335 |
},
|
| 336 |
|
| 352 |
mobile: {
|
| 353 |
preventCaptionOverlap: false,
|
| 354 |
idleTime: false,
|
| 355 |
+
clickContent: function (current, event) {
|
| 356 |
return current.type === "image" ? "toggleControls" : false;
|
| 357 |
},
|
| 358 |
+
clickSlide: function (current, event) {
|
| 359 |
return current.type === "image" ? "toggleControls" : "close";
|
| 360 |
},
|
| 361 |
+
dblclickContent: function (current, event) {
|
| 362 |
return current.type === "image" ? "zoom" : false;
|
| 363 |
},
|
| 364 |
+
dblclickSlide: function (current, event) {
|
| 365 |
return current.type === "image" ? "zoom" : false;
|
| 366 |
}
|
| 367 |
},
|
| 385 |
ZOOM: "Zoom"
|
| 386 |
},
|
| 387 |
de: {
|
| 388 |
+
CLOSE: "Schließen",
|
| 389 |
NEXT: "Weiter",
|
| 390 |
+
PREV: "Zurück",
|
| 391 |
+
ERROR: "Die angeforderten Daten konnten nicht geladen werden. <br/> Bitte versuchen Sie es später nochmal.",
|
| 392 |
PLAY_START: "Diaschau starten",
|
| 393 |
PLAY_STOP: "Diaschau beenden",
|
| 394 |
FULL_SCREEN: "Vollbild",
|
| 395 |
THUMBS: "Vorschaubilder",
|
| 396 |
DOWNLOAD: "Herunterladen",
|
| 397 |
SHARE: "Teilen",
|
| 398 |
+
ZOOM: "Vergrößern"
|
| 399 |
}
|
| 400 |
}
|
| 401 |
};
|
| 410 |
|
| 411 |
// Check if an object is a jQuery object and not a native JavaScript object
|
| 412 |
// ========================================================================
|
| 413 |
+
var isQuery = function (obj) {
|
| 414 |
return obj && obj.hasOwnProperty && obj instanceof $;
|
| 415 |
};
|
| 416 |
|
| 417 |
// Handle multiple browsers for "requestAnimationFrame" and "cancelAnimationFrame"
|
| 418 |
// ===============================================================================
|
| 419 |
+
var requestAFrame = (function () {
|
| 420 |
return (
|
| 421 |
window.requestAnimationFrame ||
|
| 422 |
window.webkitRequestAnimationFrame ||
|
| 423 |
window.mozRequestAnimationFrame ||
|
| 424 |
window.oRequestAnimationFrame ||
|
| 425 |
// if all else fails, use setTimeout
|
| 426 |
+
function (callback) {
|
| 427 |
return window.setTimeout(callback, 1000 / 60);
|
| 428 |
}
|
| 429 |
);
|
| 430 |
})();
|
| 431 |
|
| 432 |
+
var cancelAFrame = (function () {
|
| 433 |
return (
|
| 434 |
window.cancelAnimationFrame ||
|
| 435 |
window.webkitCancelAnimationFrame ||
|
| 436 |
window.mozCancelAnimationFrame ||
|
| 437 |
window.oCancelAnimationFrame ||
|
| 438 |
+
function (id) {
|
| 439 |
window.clearTimeout(id);
|
| 440 |
}
|
| 441 |
);
|
| 443 |
|
| 444 |
// Detect the supported transition-end event property name
|
| 445 |
// =======================================================
|
| 446 |
+
var transitionEnd = (function () {
|
| 447 |
var el = document.createElement("fakeelement"),
|
| 448 |
t;
|
| 449 |
|
| 466 |
// Force redraw on an element.
|
| 467 |
// This helps in cases where the browser doesn't redraw an updated element properly
|
| 468 |
// ================================================================================
|
| 469 |
+
var forceRedraw = function ($el) {
|
| 470 |
return $el && $el.length && $el[0].offsetHeight;
|
| 471 |
};
|
| 472 |
|
| 473 |
// Exclude array (`buttons`) options from deep merging
|
| 474 |
// ===================================================
|
| 475 |
+
var mergeOpts = function (opts1, opts2) {
|
| 476 |
var rez = $.extend(true, {}, opts1, opts2);
|
| 477 |
|
| 478 |
+
$.each(opts2, function (key, value) {
|
| 479 |
+
if ($.isArray(value)) {
|
| 480 |
rez[key] = value;
|
| 481 |
}
|
| 482 |
});
|
| 487 |
// How much of an element is visible in viewport
|
| 488 |
// =============================================
|
| 489 |
|
| 490 |
+
var inViewport = function (elem) {
|
| 491 |
var elemCenter, rez;
|
| 492 |
|
| 493 |
if (!elem || elem.ownerDocument !== document) {
|
| 511 |
// Class definition
|
| 512 |
// ================
|
| 513 |
|
| 514 |
+
var FancyBox = function (content, opts, index) {
|
| 515 |
var self = this;
|
| 516 |
|
| 517 |
+
self.opts = mergeOpts({
|
| 518 |
+
index: index
|
| 519 |
+
}, $.fancyboxforwp.defaults);
|
| 520 |
|
| 521 |
if ($.isPlainObject(opts)) {
|
| 522 |
self.opts = mergeOpts(self.opts, opts);
|
| 556 |
// Create DOM structure
|
| 557 |
// ====================
|
| 558 |
|
| 559 |
+
init: function () {
|
| 560 |
var self = this,
|
| 561 |
firstItem = self.group[self.currIndex],
|
| 562 |
firstItemOpts = firstItem.opts,
|
| 580 |
) {
|
| 581 |
$("head").append(
|
| 582 |
'<style id="fancybox-style-noscroll" type="text/css">.compensate-for-scrollbar{margin-right:' +
|
| 583 |
+
(window.innerWidth - document.documentElement.clientWidth) +
|
| 584 |
+
"px;}</style>"
|
| 585 |
);
|
| 586 |
|
| 587 |
$("body").addClass("compensate-for-scrollbar");
|
| 593 |
// Build html code for buttons and insert into main template
|
| 594 |
buttonStr = "";
|
| 595 |
|
| 596 |
+
$.each(firstItemOpts.buttons, function (index, value) {
|
| 597 |
buttonStr += firstItemOpts.btnTpl[value] || "";
|
| 598 |
});
|
| 599 |
|
| 600 |
// Create markup from base template, it will be initially hidden to
|
| 601 |
// avoid unnecessary work like painting while initializing is not complete
|
| 602 |
$container = $(
|
| 603 |
+
self.translate(
|
| 604 |
+
self,
|
| 605 |
+
firstItemOpts.baseTpl
|
| 606 |
.replace("{{buttons}}", buttonStr)
|
| 607 |
.replace("{{arrows}}", firstItemOpts.btnTpl.arrowLeft + firstItemOpts.btnTpl.arrowRight)
|
| 608 |
+
)
|
| 609 |
)
|
|
|
|
| 610 |
.attr("id", "fancybox-container-" + self.id)
|
| 611 |
.addClass(firstItemOpts.baseClass)
|
| 612 |
.data("FancyBox", self)
|
| 617 |
container: $container
|
| 618 |
};
|
| 619 |
|
| 620 |
+
["bg", "inner", "infobar", "toolbar", "stage", "caption", "navigation"].forEach(function (item) {
|
| 621 |
self.$refs[item] = $container.find(".fancybox-" + item);
|
| 622 |
});
|
| 623 |
|
| 634 |
// with corresponding values
|
| 635 |
// ============================================================
|
| 636 |
|
| 637 |
+
translate: function (obj, str) {
|
| 638 |
+
var arr = obj.opts.i18n[obj.opts.lang] || obj.opts.i18n.en;
|
| 639 |
|
| 640 |
+
return str.replace(/\{\{(\w+)\}\}/g, function (match, n) {
|
| 641 |
+
return arr[n] === undefined ? match : arr[n];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 642 |
});
|
| 643 |
},
|
| 644 |
|
| 646 |
// Check if each object has valid type and content
|
| 647 |
// ===============================================
|
| 648 |
|
| 649 |
+
addContent: function (content) {
|
| 650 |
var self = this,
|
| 651 |
items = $.makeArray(content),
|
| 652 |
thumbs;
|
| 653 |
|
| 654 |
+
$.each(items, function (i, item) {
|
| 655 |
var obj = {},
|
| 656 |
opts = {},
|
| 657 |
$item,
|
| 701 |
obj.opts = $.extend(true, {}, self.opts, opts);
|
| 702 |
|
| 703 |
// Do not merge buttons array
|
| 704 |
+
if ($.isArray(opts.buttons)) {
|
| 705 |
obj.opts.buttons = opts.buttons;
|
| 706 |
}
|
| 707 |
|
| 726 |
type = "image";
|
| 727 |
} else if (src.match(/\.(pdf)((\?|#).*)?$/i)) {
|
| 728 |
type = "iframe";
|
| 729 |
+
obj = $.extend(true, obj, {
|
| 730 |
+
contentType: "pdf",
|
| 731 |
+
opts: {
|
| 732 |
+
iframe: {
|
| 733 |
+
preload: false
|
| 734 |
+
}
|
| 735 |
+
}
|
| 736 |
+
});
|
| 737 |
} else if (src.charAt(0) === "#") {
|
| 738 |
type = "inline";
|
| 739 |
}
|
| 854 |
if (thumbs && thumbs.isActive) {
|
| 855 |
thumbs.create();
|
| 856 |
|
| 857 |
+
thumbs.focus();
|
| 858 |
}
|
| 859 |
}
|
| 860 |
},
|
| 867 |
// - detecting inactivity
|
| 868 |
// ======================================
|
| 869 |
|
| 870 |
+
addEvents: function () {
|
| 871 |
var self = this;
|
| 872 |
|
| 873 |
self.removeEvents();
|
| 876 |
// ==================================
|
| 877 |
|
| 878 |
self.$refs.container
|
| 879 |
+
.on("click.fb-close", "[data-fancybox-close]", function (e) {
|
| 880 |
e.stopPropagation();
|
| 881 |
e.preventDefault();
|
| 882 |
|
| 883 |
self.close(e);
|
| 884 |
})
|
| 885 |
+
.on("touchstart.fb-prev click.fb-prev", "[data-fancybox-prev]", function (e) {
|
| 886 |
e.stopPropagation();
|
| 887 |
e.preventDefault();
|
| 888 |
|
| 889 |
self.previous();
|
| 890 |
})
|
| 891 |
+
.on("touchstart.fb-next click.fb-next", "[data-fancybox-next]", function (e) {
|
| 892 |
e.stopPropagation();
|
| 893 |
e.preventDefault();
|
| 894 |
|
| 895 |
self.next();
|
| 896 |
})
|
| 897 |
+
.on("click.fb", "[data-fancybox-zoom]", function (e) {
|
| 898 |
// Click handler for zoom button
|
| 899 |
self[self.isScaledDown() ? "scaleToActual" : "scaleToFit"]();
|
| 900 |
});
|
| 902 |
// Handle page scrolling and browser resizing
|
| 903 |
// ==========================================
|
| 904 |
|
| 905 |
+
$W.on("orientationchange.fb resize.fb", function (e) {
|
| 906 |
if (e && e.originalEvent && e.originalEvent.type === "resize") {
|
| 907 |
if (self.requestId) {
|
| 908 |
cancelAFrame(self.requestId);
|
| 909 |
}
|
| 910 |
|
| 911 |
+
self.requestId = requestAFrame(function () {
|
| 912 |
self.update(e);
|
| 913 |
});
|
| 914 |
} else {
|
| 916 |
self.$refs.stage.hide();
|
| 917 |
}
|
| 918 |
|
| 919 |
+
setTimeout(
|
| 920 |
+
function () {
|
| 921 |
+
self.$refs.stage.show();
|
| 922 |
|
| 923 |
+
self.update(e);
|
| 924 |
+
},
|
| 925 |
+
$.fancyboxforwp.isMobile ? 600 : 250
|
| 926 |
+
);
|
| 927 |
}
|
| 928 |
});
|
| 929 |
|
| 930 |
+
$D.on("keydown.fb", function (e) {
|
| 931 |
var instance = $.fancyboxforwp ? $.fancyboxforwp.getInstance() : null,
|
| 932 |
current = instance.current,
|
| 933 |
keycode = e.keyCode || e.which;
|
| 946 |
// Enable keyboard navigation
|
| 947 |
// ==========================
|
| 948 |
|
| 949 |
+
if (!current.opts.keyboard || e.ctrlKey || e.altKey || e.shiftKey || $(e.target).is("input,textarea,video,audio,select")) {
|
| 950 |
return;
|
| 951 |
}
|
| 952 |
|
| 986 |
|
| 987 |
$D.on(
|
| 988 |
"mousemove.fb-idle mouseleave.fb-idle mousedown.fb-idle touchstart.fb-idle touchmove.fb-idle scroll.fb-idle keydown.fb-idle",
|
| 989 |
+
function (e) {
|
| 990 |
self.idleSecondsCounter = 0;
|
| 991 |
|
| 992 |
if (self.isIdle) {
|
| 997 |
}
|
| 998 |
);
|
| 999 |
|
| 1000 |
+
self.idleInterval = window.setInterval(function () {
|
| 1001 |
self.idleSecondsCounter++;
|
| 1002 |
|
| 1003 |
if (self.idleSecondsCounter >= self.group[self.currIndex].opts.idleTime && !self.isDragging) {
|
| 1013 |
// Remove events added by the core
|
| 1014 |
// ===============================
|
| 1015 |
|
| 1016 |
+
removeEvents: function () {
|
| 1017 |
var self = this;
|
| 1018 |
|
| 1019 |
$W.off("orientationchange.fb resize.fb");
|
| 1031 |
// Change to previous gallery item
|
| 1032 |
// ===============================
|
| 1033 |
|
| 1034 |
+
previous: function (duration) {
|
| 1035 |
return this.jumpTo(this.currPos - 1, duration);
|
| 1036 |
},
|
| 1037 |
|
| 1038 |
// Change to next gallery item
|
| 1039 |
// ===========================
|
| 1040 |
|
| 1041 |
+
next: function (duration) {
|
| 1042 |
return this.jumpTo(this.currPos + 1, duration);
|
| 1043 |
},
|
| 1044 |
|
| 1045 |
// Switch to selected gallery item
|
| 1046 |
// ===============================
|
| 1047 |
|
| 1048 |
+
jumpTo: function (pos, duration) {
|
| 1049 |
var self = this,
|
| 1050 |
groupLen = self.group.length,
|
| 1051 |
firstRun,
|
| 1138 |
stagePos = $.fancyboxforwp.getTranslate(self.$refs.stage);
|
| 1139 |
|
| 1140 |
// Clean up all slides
|
| 1141 |
+
$.each(self.slides, function (index, slide) {
|
| 1142 |
$.fancyboxforwp.stop(slide.$slide, true);
|
| 1143 |
});
|
| 1144 |
|
| 1153 |
// Calculate horizontal swipe distance
|
| 1154 |
diff = slidePos.left - (previous.pos * slidePos.width + previous.pos * previous.opts.gutter);
|
| 1155 |
|
| 1156 |
+
$.each(self.slides, function (index, slide) {
|
| 1157 |
+
slide.$slide.removeClass("fancybox-animated").removeClass(function (index, className) {
|
| 1158 |
return (className.match(/(^|\s)fancybox-fx-\S+/g) || []).join(" ");
|
| 1159 |
});
|
| 1160 |
|
| 1162 |
// This is mostly needed for freshly added slides, because they are not yet positioned
|
| 1163 |
var leftPos = slide.pos * slidePos.width + slide.pos * slide.opts.gutter;
|
| 1164 |
|
| 1165 |
+
$.fancyboxforwp.setTranslate(slide.$slide, {
|
| 1166 |
+
top: 0,
|
| 1167 |
+
left: leftPos - stagePos.left + diff
|
| 1168 |
+
});
|
| 1169 |
|
| 1170 |
if (slide.pos !== current.pos) {
|
| 1171 |
slide.$slide.addClass("fancybox-slide--" + (slide.pos > current.pos ? "next" : "previous"));
|
| 1176 |
|
| 1177 |
// Animate the slide
|
| 1178 |
$.fancyboxforwp.animate(
|
| 1179 |
+
slide.$slide, {
|
|
|
|
| 1180 |
top: 0,
|
| 1181 |
left: (slide.pos - current.pos) * slidePos.width + (slide.pos - current.pos) * slide.opts.gutter
|
| 1182 |
},
|
| 1183 |
duration,
|
| 1184 |
+
function () {
|
| 1185 |
slide.$slide
|
| 1186 |
.css({
|
| 1187 |
transform: "",
|
| 1205 |
previous.$slide,
|
| 1206 |
prop,
|
| 1207 |
duration,
|
| 1208 |
+
function () {
|
| 1209 |
previous.$slide.removeClass(prop).removeClass("fancybox-slide--next fancybox-slide--previous");
|
| 1210 |
},
|
| 1211 |
false
|
| 1225 |
// These are gallery items that are actually added to DOM
|
| 1226 |
// =======================================================
|
| 1227 |
|
| 1228 |
+
createSlide: function (pos) {
|
| 1229 |
var self = this,
|
| 1230 |
$slide,
|
| 1231 |
index;
|
| 1252 |
// x and y values should be relative to the slide
|
| 1253 |
// ==============================================
|
| 1254 |
|
| 1255 |
+
scaleToActual: function (x, y, duration) {
|
| 1256 |
var self = this,
|
| 1257 |
current = self.current,
|
| 1258 |
$content = current.$content,
|
| 1317 |
self.updateCursor(newImgWidth, newImgHeight);
|
| 1318 |
|
| 1319 |
$.fancyboxforwp.animate(
|
| 1320 |
+
$content, {
|
|
|
|
| 1321 |
top: posY,
|
| 1322 |
left: posX,
|
| 1323 |
scaleX: scaleX,
|
| 1324 |
scaleY: scaleY
|
| 1325 |
},
|
| 1326 |
+
duration || 366,
|
| 1327 |
+
function () {
|
| 1328 |
self.isAnimating = false;
|
| 1329 |
}
|
| 1330 |
);
|
| 1338 |
// Scale image to fit inside parent element
|
| 1339 |
// ========================================
|
| 1340 |
|
| 1341 |
+
scaleToFit: function (duration) {
|
| 1342 |
var self = this,
|
| 1343 |
current = self.current,
|
| 1344 |
$content = current.$content,
|
| 1357 |
self.updateCursor(end.width, end.height);
|
| 1358 |
|
| 1359 |
$.fancyboxforwp.animate(
|
| 1360 |
+
$content, {
|
|
|
|
| 1361 |
top: end.top,
|
| 1362 |
left: end.left,
|
| 1363 |
scaleX: end.width / $content.width(),
|
| 1364 |
scaleY: end.height / $content.height()
|
| 1365 |
},
|
| 1366 |
+
duration || 366,
|
| 1367 |
+
function () {
|
| 1368 |
self.isAnimating = false;
|
| 1369 |
}
|
| 1370 |
);
|
| 1373 |
// Calculate image size to fit inside viewport
|
| 1374 |
// ===========================================
|
| 1375 |
|
| 1376 |
+
getFitPos: function (slide) {
|
| 1377 |
var self = this,
|
| 1378 |
$content = slide.$content,
|
| 1379 |
$slide = slide.$slide,
|
| 1447 |
// Update content size and position for all slides
|
| 1448 |
// ==============================================
|
| 1449 |
|
| 1450 |
+
update: function (e) {
|
| 1451 |
var self = this;
|
| 1452 |
|
| 1453 |
+
$.each(self.slides, function (key, slide) {
|
| 1454 |
self.updateSlide(slide, e);
|
| 1455 |
});
|
| 1456 |
},
|
| 1458 |
// Update slide content position and size
|
| 1459 |
// ======================================
|
| 1460 |
|
| 1461 |
+
updateSlide: function (slide, e) {
|
| 1462 |
var self = this,
|
| 1463 |
$content = slide && slide.$content,
|
| 1464 |
width = slide.width || slide.opts.width,
|
| 1500 |
// Horizontally center slide
|
| 1501 |
// =========================
|
| 1502 |
|
| 1503 |
+
centerSlide: function (duration) {
|
| 1504 |
var self = this,
|
| 1505 |
current = self.current,
|
| 1506 |
$slide = current.$slide;
|
| 1520 |
.removeClass("fancybox-slide--previous fancybox-slide--next");
|
| 1521 |
|
| 1522 |
$.fancyboxforwp.animate(
|
| 1523 |
+
$slide, {
|
|
|
|
| 1524 |
top: 0,
|
| 1525 |
left: 0,
|
| 1526 |
opacity: 1
|
| 1527 |
},
|
| 1528 |
duration === undefined ? 0 : duration,
|
| 1529 |
+
function () {
|
| 1530 |
// Clean up
|
| 1531 |
$slide.css({
|
| 1532 |
transform: "",
|
| 1544 |
// Check if current slide is moved (swiped)
|
| 1545 |
// ========================================
|
| 1546 |
|
| 1547 |
+
isMoved: function (slide) {
|
| 1548 |
var current = slide || this.current,
|
| 1549 |
slidePos,
|
| 1550 |
stagePos;
|
| 1565 |
// Update cursor style depending if content can be zoomed
|
| 1566 |
// ======================================================
|
| 1567 |
|
| 1568 |
+
updateCursor: function (nextWidth, nextHeight) {
|
| 1569 |
var self = this,
|
| 1570 |
current = self.current,
|
| 1571 |
$container = self.$refs.container,
|
| 1601 |
// Check if current slide is zoomable
|
| 1602 |
// ==================================
|
| 1603 |
|
| 1604 |
+
isZoomable: function () {
|
| 1605 |
var self = this,
|
| 1606 |
current = self.current,
|
| 1607 |
fitPos;
|
| 1627 |
// Check if current image dimensions are smaller than actual
|
| 1628 |
// =========================================================
|
| 1629 |
|
| 1630 |
+
isScaledDown: function (nextWidth, nextHeight) {
|
| 1631 |
var self = this,
|
| 1632 |
rez = false,
|
| 1633 |
current = self.current,
|
| 1646 |
// Check if image dimensions exceed parent element
|
| 1647 |
// ===============================================
|
| 1648 |
|
| 1649 |
+
canPan: function (nextWidth, nextHeight) {
|
| 1650 |
var self = this,
|
| 1651 |
current = self.current,
|
| 1652 |
pos = null,
|
| 1656 |
rez = self.getFitPos(current);
|
| 1657 |
|
| 1658 |
if (nextWidth !== undefined && nextHeight !== undefined) {
|
| 1659 |
+
pos = {
|
| 1660 |
+
width: nextWidth,
|
| 1661 |
+
height: nextHeight
|
| 1662 |
+
};
|
| 1663 |
} else if (current.isComplete) {
|
| 1664 |
pos = $.fancyboxforwp.getTranslate(current.$content);
|
| 1665 |
}
|
| 1675 |
// Load content into the slide
|
| 1676 |
// ===========================
|
| 1677 |
|
| 1678 |
+
loadSlide: function (slide) {
|
| 1679 |
var self = this,
|
| 1680 |
type,
|
| 1681 |
$slide,
|
| 1722 |
self.setContent(
|
| 1723 |
slide,
|
| 1724 |
slide.opts.video.tpl
|
| 1725 |
+
.replace(/\{\{src\}\}/gi, slide.src)
|
| 1726 |
+
.replace("{{format}}", slide.opts.videoFormat || slide.opts.video.format || "")
|
| 1727 |
+
.replace("{{poster}}", slide.thumb || "")
|
| 1728 |
);
|
| 1729 |
|
| 1730 |
break;
|
| 1744 |
ajaxLoad = $.ajax(
|
| 1745 |
$.extend({}, slide.opts.ajax.settings, {
|
| 1746 |
url: slide.src,
|
| 1747 |
+
success: function (data, textStatus) {
|
| 1748 |
if (textStatus === "success") {
|
| 1749 |
self.setContent(slide, data);
|
| 1750 |
}
|
| 1751 |
},
|
| 1752 |
+
error: function (jqXHR, textStatus) {
|
| 1753 |
if (jqXHR && textStatus !== "abort") {
|
| 1754 |
self.setError(slide);
|
| 1755 |
}
|
| 1757 |
})
|
| 1758 |
);
|
| 1759 |
|
| 1760 |
+
$slide.one("onReset", function () {
|
| 1761 |
ajaxLoad.abort();
|
| 1762 |
});
|
| 1763 |
|
| 1775 |
// Use thumbnail image, if possible
|
| 1776 |
// ================================
|
| 1777 |
|
| 1778 |
+
setImage: function (slide) {
|
| 1779 |
var self = this,
|
| 1780 |
ghost;
|
| 1781 |
|
| 1782 |
// Check if need to show loading icon
|
| 1783 |
+
setTimeout(function () {
|
| 1784 |
+
var $img = slide.$image;
|
|
|
|
| 1785 |
|
| 1786 |
+
if (!self.isClosing && slide.isLoading && (!$img || !$img.length || !$img[0].complete) && !slide.hasError) {
|
| 1787 |
+
self.showLoading(slide);
|
| 1788 |
+
}
|
| 1789 |
+
}, 50);
|
|
|
|
| 1790 |
|
| 1791 |
//Check if image has srcset
|
| 1792 |
self.checkSrcset(slide);
|
| 1804 |
|
| 1805 |
ghost = document.createElement("img");
|
| 1806 |
|
| 1807 |
+
ghost.onerror = function () {
|
| 1808 |
$(this).remove();
|
| 1809 |
|
| 1810 |
slide.$ghost = null;
|
| 1811 |
};
|
| 1812 |
|
| 1813 |
+
ghost.onload = function () {
|
| 1814 |
self.afterLoad(slide);
|
| 1815 |
};
|
| 1816 |
|
| 1826 |
|
| 1827 |
// Check if image has srcset and get the source
|
| 1828 |
// ============================================
|
| 1829 |
+
checkSrcset: function (slide) {
|
| 1830 |
var srcset = slide.opts.srcset || slide.opts.image.srcset,
|
| 1831 |
found,
|
| 1832 |
temp,
|
| 1840 |
pxRatio = window.devicePixelRatio || 1;
|
| 1841 |
windowWidth = window.innerWidth * pxRatio;
|
| 1842 |
|
| 1843 |
+
temp = srcset.split(",").map(function (el) {
|
| 1844 |
var ret = {};
|
| 1845 |
|
| 1846 |
el.trim()
|
| 1847 |
.split(/\s+/)
|
| 1848 |
+
.forEach(function (el, i) {
|
| 1849 |
var value = parseInt(el.substring(0, el.length - 1), 10);
|
| 1850 |
|
| 1851 |
if (i === 0) {
|
| 1862 |
});
|
| 1863 |
|
| 1864 |
// Sort by value
|
| 1865 |
+
temp.sort(function (a, b) {
|
| 1866 |
return a.value - b.value;
|
| 1867 |
});
|
| 1868 |
|
| 1898 |
// Create full-size image
|
| 1899 |
// ======================
|
| 1900 |
|
| 1901 |
+
setBigImage: function (slide) {
|
| 1902 |
var self = this,
|
| 1903 |
img = document.createElement("img"),
|
| 1904 |
$img = $(img);
|
| 1905 |
|
| 1906 |
slide.$image = $img
|
| 1907 |
+
.one("error", function () {
|
| 1908 |
self.setError(slide);
|
| 1909 |
})
|
| 1910 |
+
.one("load", function () {
|
| 1911 |
var sizes;
|
| 1912 |
|
| 1913 |
if (!slide.$ghost) {
|
| 1934 |
|
| 1935 |
// Hide temporary image after some delay
|
| 1936 |
if (slide.$ghost) {
|
| 1937 |
+
setTimeout(function () {
|
| 1938 |
if (slide.$ghost && !self.isClosing) {
|
| 1939 |
slide.$ghost.hide();
|
| 1940 |
}
|
| 1957 |
// Computes the slide size from image size and maxWidth/maxHeight
|
| 1958 |
// ==============================================================
|
| 1959 |
|
| 1960 |
+
resolveImageSlideSize: function (slide, imgWidth, imgHeight) {
|
| 1961 |
var maxWidth = parseInt(slide.opts.width, 10),
|
| 1962 |
maxHeight = parseInt(slide.opts.height, 10);
|
| 1963 |
|
| 1979 |
// Create iframe wrapper, iframe and bindings
|
| 1980 |
// ==========================================
|
| 1981 |
|
| 1982 |
+
setIframe: function (slide) {
|
| 1983 |
var self = this,
|
| 1984 |
opts = slide.opts.iframe,
|
| 1985 |
$slide = slide.$slide,
|
| 1986 |
$iframe;
|
| 1987 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1988 |
slide.$content = $('<div class="fancybox-content' + (opts.preload ? " fancybox-is-hidden" : "") + '"></div>')
|
| 1989 |
.css(opts.css)
|
| 1990 |
.appendTo($slide);
|
| 2001 |
// Unfortunately, it is not always possible to determine if iframe is successfully loaded
|
| 2002 |
// (due to browser security policy)
|
| 2003 |
|
| 2004 |
+
$iframe.on("load.fb error.fb", function (e) {
|
| 2005 |
this.isReady = 1;
|
| 2006 |
|
| 2007 |
slide.$slide.trigger("refresh");
|
| 2012 |
// Recalculate iframe content size
|
| 2013 |
// ===============================
|
| 2014 |
|
| 2015 |
+
$slide.on("refresh.fb", function () {
|
| 2016 |
var $content = slide.$content,
|
| 2017 |
frameWidth = opts.css.width,
|
| 2018 |
frameHeight = opts.css.height,
|
| 2028 |
$body = $contents.find("body");
|
| 2029 |
} catch (ignore) {}
|
| 2030 |
|
| 2031 |
+
// Calculate content dimensions, if it is accessible
|
| 2032 |
if ($body && $body.length && $body.children().length) {
|
| 2033 |
// Avoid scrolling to top (if multiple instances)
|
| 2034 |
$slide.css("overflow", "visible");
|
| 2063 |
$iframe.attr("src", slide.src);
|
| 2064 |
|
| 2065 |
// Remove iframe if closing or changing gallery item
|
| 2066 |
+
$slide.one("onReset", function () {
|
| 2067 |
// This helps IE not to throw errors when closing
|
| 2068 |
try {
|
| 2069 |
$(this)
|
| 2085 |
// Wrap and append content to the slide
|
| 2086 |
// ======================================
|
| 2087 |
|
| 2088 |
+
setContent: function (slide, content) {
|
| 2089 |
var self = this;
|
| 2090 |
|
| 2091 |
if (self.isClosing) {
|
| 2104 |
// The placeholder is created so we will know where to put it back.
|
| 2105 |
if (isQuery(content) && content.parent().length) {
|
| 2106 |
// Make sure content is not already moved to fancyBox
|
| 2107 |
+
if (content.hasClass("fancybox-content") || content.parent().hasClass("fancybox-content")) {
|
| 2108 |
+
content.parents(".fancybox-slide").trigger("onReset");
|
| 2109 |
}
|
| 2110 |
|
| 2111 |
// Create temporary element marking original place of the content
|
| 2131 |
}
|
| 2132 |
}
|
| 2133 |
|
| 2134 |
+
slide.$slide.one("onReset", function () {
|
| 2135 |
// Pause all html5 video/audio
|
| 2136 |
$(this)
|
| 2137 |
.find("video,audio")
|
| 2199 |
// Display error message
|
| 2200 |
// =====================
|
| 2201 |
|
| 2202 |
+
setError: function (slide) {
|
| 2203 |
slide.hasError = true;
|
| 2204 |
|
| 2205 |
slide.$slide
|
| 2219 |
// Show loading icon inside the slide
|
| 2220 |
// ==================================
|
| 2221 |
|
| 2222 |
+
showLoading: function (slide) {
|
| 2223 |
var self = this;
|
| 2224 |
|
| 2225 |
slide = slide || self.current;
|
| 2235 |
// Remove loading icon from the slide
|
| 2236 |
// ==================================
|
| 2237 |
|
| 2238 |
+
hideLoading: function (slide) {
|
| 2239 |
var self = this;
|
| 2240 |
|
| 2241 |
slide = slide || self.current;
|
| 2250 |
// Adjustments after slide content has been loaded
|
| 2251 |
// ===============================================
|
| 2252 |
|
| 2253 |
+
afterLoad: function (slide) {
|
| 2254 |
var self = this;
|
| 2255 |
|
| 2256 |
if (self.isClosing) {
|
| 2271 |
|
| 2272 |
// Disable right click
|
| 2273 |
if (slide.opts.protect && slide.$content && !slide.hasError) {
|
| 2274 |
+
slide.$content.on("contextmenu.fb", function (e) {
|
| 2275 |
if (e.button == 2) {
|
| 2276 |
e.preventDefault();
|
| 2277 |
}
|
| 2301 |
// fix css inconsistency across browsers
|
| 2302 |
// =====================================
|
| 2303 |
|
| 2304 |
+
adjustCaption: function (slide) {
|
| 2305 |
var self = this,
|
| 2306 |
current = slide || self.current,
|
| 2307 |
caption = current.opts.caption,
|
| 2308 |
+
preventOverlap = current.opts.preventCaptionOverlap,
|
| 2309 |
$caption = self.$refs.caption,
|
| 2310 |
+
$clone,
|
| 2311 |
captionH = false;
|
| 2312 |
|
| 2313 |
+
$caption.toggleClass("fancybox-caption--separate", preventOverlap);
|
| 2314 |
+
|
| 2315 |
+
if (preventOverlap && caption && caption.length) {
|
| 2316 |
if (current.pos !== self.currPos) {
|
| 2317 |
+
$clone = $caption.clone().appendTo($caption.parent());
|
|
|
|
|
|
|
|
|
|
| 2318 |
|
| 2319 |
+
$clone
|
| 2320 |
+
.children()
|
| 2321 |
+
.eq(0)
|
| 2322 |
+
.empty()
|
| 2323 |
+
.html(caption);
|
| 2324 |
|
| 2325 |
+
captionH = $clone.outerHeight(true);
|
| 2326 |
|
| 2327 |
+
$clone.empty().remove();
|
| 2328 |
} else if (self.$caption) {
|
| 2329 |
captionH = self.$caption.outerHeight(true);
|
| 2330 |
}
|
| 2337 |
// https://bugzilla.mozilla.org/show_bug.cgi?id=748518
|
| 2338 |
// ====================================================================================
|
| 2339 |
|
| 2340 |
+
adjustLayout: function (slide) {
|
| 2341 |
var self = this,
|
| 2342 |
current = slide || self.current,
|
| 2343 |
scrollHeight,
|
| 2376 |
// user navigates gallery and transition should start
|
| 2377 |
// ============================================================
|
| 2378 |
|
| 2379 |
+
revealContent: function (slide) {
|
| 2380 |
var self = this,
|
| 2381 |
$slide = slide.$slide,
|
| 2382 |
end = false,
|
| 2434 |
forceRedraw(slide.$content);
|
| 2435 |
|
| 2436 |
// Start animation
|
| 2437 |
+
$.fancyboxforwp.animate(slide.$content, end, duration, function () {
|
| 2438 |
self.isAnimating = false;
|
| 2439 |
|
| 2440 |
self.complete();
|
| 2483 |
$slide,
|
| 2484 |
"fancybox-slide--current",
|
| 2485 |
duration,
|
| 2486 |
+
function () {
|
| 2487 |
$slide.removeClass(effectClassName).css({
|
| 2488 |
transform: "",
|
| 2489 |
opacity: ""
|
| 2500 |
// Check if we can and have to zoom from thumbnail
|
| 2501 |
//================================================
|
| 2502 |
|
| 2503 |
+
getThumbPos: function (slide) {
|
| 2504 |
var rez = false,
|
| 2505 |
$thumb = slide.$thumb,
|
| 2506 |
thumbPos,
|
| 2536 |
// and it`s content is loaded
|
| 2537 |
// ==================================================================
|
| 2538 |
|
| 2539 |
+
complete: function () {
|
| 2540 |
var self = this,
|
| 2541 |
current = self.current,
|
| 2542 |
slides = {},
|
| 2559 |
current.$slide.addClass("fancybox-slide--complete");
|
| 2560 |
|
| 2561 |
// Remove unnecessary slides
|
| 2562 |
+
$.each(self.slides, function (key, slide) {
|
| 2563 |
if (slide.pos >= self.currPos - 1 && slide.pos <= self.currPos + 1) {
|
| 2564 |
slides[slide.pos] = slide;
|
| 2565 |
} else if (slide) {
|
| 2584 |
.find("video,audio")
|
| 2585 |
.filter(":visible:first")
|
| 2586 |
.trigger("play")
|
| 2587 |
+
.one("ended", function () {
|
| 2588 |
+
if (Document.exitFullscreen) {
|
| 2589 |
+
Document.exitFullscreen();
|
| 2590 |
+
} else if (this.webkitExitFullscreen) {
|
| 2591 |
+
this.webkitExitFullscreen();
|
| 2592 |
+
}
|
| 2593 |
+
|
| 2594 |
+
self.next();
|
| 2595 |
+
});
|
| 2596 |
}
|
| 2597 |
|
| 2598 |
// Try to focus on the first focusable element
|
| 2614 |
// Preload next and previous slides
|
| 2615 |
// ================================
|
| 2616 |
|
| 2617 |
+
preload: function (type) {
|
| 2618 |
var self = this,
|
| 2619 |
+
prev,
|
| 2620 |
+
next;
|
| 2621 |
+
|
| 2622 |
+
if (self.group.length < 2) {
|
| 2623 |
+
return;
|
| 2624 |
+
}
|
| 2625 |
+
|
| 2626 |
+
next = self.slides[self.currPos + 1];
|
| 2627 |
+
prev = self.slides[self.currPos - 1];
|
| 2628 |
|
| 2629 |
if (prev && prev.type === type) {
|
| 2630 |
self.loadSlide(prev);
|
| 2638 |
// Try to find and focus on the first focusable element
|
| 2639 |
// ====================================================
|
| 2640 |
|
| 2641 |
+
focus: function (e, firstRun) {
|
| 2642 |
var self = this,
|
| 2643 |
focusableStr = [
|
| 2644 |
"a[href]",
|
| 2650 |
"iframe",
|
| 2651 |
"object",
|
| 2652 |
"embed",
|
| 2653 |
+
"video",
|
| 2654 |
+
"audio",
|
| 2655 |
"[contenteditable]",
|
| 2656 |
'[tabindex]:not([tabindex^="-"])'
|
| 2657 |
].join(","),
|
| 2670 |
focusableItems = self.current.$slide.find("*:visible" + (firstRun ? ":not(.fancybox-close-small)" : ""));
|
| 2671 |
}
|
| 2672 |
|
| 2673 |
+
focusableItems = focusableItems.filter(focusableStr).filter(function () {
|
| 2674 |
return $(this).css("visibility") !== "hidden" && !$(this).hasClass("disabled");
|
| 2675 |
});
|
| 2676 |
|
| 2703 |
// notifies other instances about deactivating
|
| 2704 |
// =================================================================================
|
| 2705 |
|
| 2706 |
+
activate: function () {
|
| 2707 |
var self = this;
|
| 2708 |
|
| 2709 |
// Deactivate all instances
|
| 2710 |
+
$(".fancybox-container").each(function () {
|
| 2711 |
var instance = $(this).data("FancyBox");
|
| 2712 |
|
| 2713 |
// Skip self and closing instances
|
| 2737 |
// This will start "zoom-out" animation if needed and clean everything up afterwards
|
| 2738 |
// =================================================================================
|
| 2739 |
|
| 2740 |
+
close: function (e, d) {
|
| 2741 |
var self = this,
|
| 2742 |
current = self.current,
|
| 2743 |
effect,
|
| 2748 |
start,
|
| 2749 |
end;
|
| 2750 |
|
| 2751 |
+
var done = function () {
|
| 2752 |
self.cleanUp(e);
|
| 2753 |
};
|
| 2754 |
|
| 2762 |
if (self.trigger("beforeClose", e) === false) {
|
| 2763 |
self.isClosing = false;
|
| 2764 |
|
| 2765 |
+
requestAFrame(function () {
|
| 2766 |
self.update();
|
| 2767 |
});
|
| 2768 |
|
| 2870 |
// Final adjustments after removing the instance
|
| 2871 |
// =============================================
|
| 2872 |
|
| 2873 |
+
cleanUp: function (e) {
|
| 2874 |
var self = this,
|
| 2875 |
instance,
|
| 2876 |
$focus = self.current.opts.$orig,
|
| 2918 |
// Call callback and trigger an event
|
| 2919 |
// ==================================
|
| 2920 |
|
| 2921 |
+
trigger: function (name, slide) {
|
| 2922 |
var args = Array.prototype.slice.call(arguments, 1),
|
| 2923 |
self = this,
|
| 2924 |
obj = slide && slide.opts ? slide : self.current,
|
| 2950 |
// Update infobar values, navigation button states and reveal caption
|
| 2951 |
// ==================================================================
|
| 2952 |
|
| 2953 |
+
updateControls: function () {
|
| 2954 |
var self = this,
|
| 2955 |
current = self.current,
|
| 2956 |
index = current.index,
|
| 2961 |
// Recalculate content dimensions
|
| 2962 |
current.$slide.trigger("refresh");
|
| 2963 |
|
| 2964 |
+
// Set caption
|
| 2965 |
+
if (caption && caption.length) {
|
| 2966 |
+
self.$caption = $caption;
|
| 2967 |
+
|
| 2968 |
+
$caption
|
| 2969 |
+
.children()
|
| 2970 |
+
.eq(0)
|
| 2971 |
+
.html(caption);
|
| 2972 |
+
} else {
|
| 2973 |
+
self.$caption = null;
|
| 2974 |
+
}
|
| 2975 |
|
| 2976 |
if (!self.hasHiddenControls && !self.isIdle) {
|
| 2977 |
self.showControls();
|
| 3006 |
// Hide toolbar and caption
|
| 3007 |
// ========================
|
| 3008 |
|
| 3009 |
+
hideControls: function (andCaption) {
|
| 3010 |
var self = this,
|
| 3011 |
arr = ["infobar", "toolbar", "nav"];
|
| 3012 |
|
| 3016 |
|
| 3017 |
this.$refs.container.removeClass(
|
| 3018 |
arr
|
| 3019 |
+
.map(function (i) {
|
| 3020 |
+
return "fancybox-show-" + i;
|
| 3021 |
+
})
|
| 3022 |
+
.join(" ")
|
| 3023 |
);
|
| 3024 |
|
| 3025 |
this.hasHiddenControls = true;
|
| 3026 |
},
|
| 3027 |
|
| 3028 |
+
showControls: function () {
|
| 3029 |
var self = this,
|
| 3030 |
opts = self.current ? self.current.opts : self.opts,
|
| 3031 |
$container = self.$refs.container;
|
| 3044 |
// Toggle toolbar and caption
|
| 3045 |
// ==========================
|
| 3046 |
|
| 3047 |
+
toggleControls: function () {
|
| 3048 |
if (this.hasHiddenControls) {
|
| 3049 |
this.showControls();
|
| 3050 |
} else {
|
| 3054 |
});
|
| 3055 |
|
| 3056 |
$.fancyboxforwp = {
|
| 3057 |
+
version: "3.5.7",
|
| 3058 |
defaults: defaults,
|
| 3059 |
|
| 3060 |
// Get current instance and execute a command.
|
| 3069 |
// });
|
| 3070 |
// ======================================================
|
| 3071 |
|
| 3072 |
+
getInstance: function (command) {
|
| 3073 |
var instance = $('.fancybox-container:not(".fancybox-is-closing"):last').data("FancyBox"),
|
| 3074 |
args = Array.prototype.slice.call(arguments, 1);
|
| 3075 |
|
| 3089 |
// Create new instance
|
| 3090 |
// ===================
|
| 3091 |
|
| 3092 |
+
open: function (items, opts, index) {
|
| 3093 |
return new FancyBox(items, opts, index);
|
| 3094 |
},
|
| 3095 |
|
| 3096 |
// Close current or all instances
|
| 3097 |
// ==============================
|
| 3098 |
|
| 3099 |
+
close: function (all) {
|
| 3100 |
var instance = this.getInstance();
|
| 3101 |
|
| 3102 |
if (instance) {
|
| 3112 |
// Close all instances and unbind all events
|
| 3113 |
// =========================================
|
| 3114 |
|
| 3115 |
+
destroy: function () {
|
| 3116 |
this.close(true);
|
| 3117 |
|
| 3118 |
$D.add("body").off("click.fb-start", "**");
|
| 3126 |
// Detect if 'translate3d' support is available
|
| 3127 |
// ============================================
|
| 3128 |
|
| 3129 |
+
use3d: (function () {
|
| 3130 |
var div = document.createElement("div");
|
| 3131 |
|
| 3132 |
return (
|
| 3141 |
// returns array[ top, left, horizontal-scale, vertical-scale, opacity ]
|
| 3142 |
// =====================================================================
|
| 3143 |
|
| 3144 |
+
getTranslate: function ($el) {
|
| 3145 |
var domRect;
|
| 3146 |
|
| 3147 |
if (!$el || !$el.length) {
|
| 3163 |
// Can set be used to set opacity, too
|
| 3164 |
// ========================================================
|
| 3165 |
|
| 3166 |
+
setTranslate: function ($el, props) {
|
| 3167 |
var str = "",
|
| 3168 |
css = {};
|
| 3169 |
|
| 3202 |
if (props.width !== undefined) {
|
| 3203 |
css.width = props.width;
|
| 3204 |
}
|
| 3205 |
+
|
| 3206 |
var custom_caption_outerHeight = 0;
|
| 3207 |
|
| 3208 |
if($('.fancybox-custom-caption.inside-caption').length ){
|
| 3230 |
css.height = props.height + custom_caption_outerHeight;
|
| 3231 |
}
|
| 3232 |
|
|
|
|
| 3233 |
return $el.css(css);
|
| 3234 |
},
|
| 3235 |
|
| 3236 |
// Simple CSS transition handler
|
| 3237 |
// =============================
|
| 3238 |
|
| 3239 |
+
animate: function ($el, to, duration, callback, leaveAnimationName) {
|
| 3240 |
var self = this,
|
| 3241 |
from;
|
| 3242 |
|
| 3249 |
|
| 3250 |
from = self.getTranslate($el);
|
| 3251 |
|
| 3252 |
+
$el.on(transitionEnd, function (e) {
|
| 3253 |
// Skip events from child elements and z-index change
|
| 3254 |
if (e && e.originalEvent && (!$el.is(e.originalEvent.target) || e.originalEvent.propertyName == "z-index")) {
|
| 3255 |
return;
|
| 3304 |
// Make sure that `transitionend` callback gets fired
|
| 3305 |
$el.data(
|
| 3306 |
"timer",
|
| 3307 |
+
setTimeout(function () {
|
| 3308 |
$el.trigger(transitionEnd);
|
| 3309 |
}, duration + 33)
|
| 3310 |
);
|
| 3311 |
},
|
| 3312 |
|
| 3313 |
+
stop: function ($el, callCallback) {
|
| 3314 |
if ($el && $el.length) {
|
| 3315 |
clearTimeout($el.data("timer"));
|
| 3316 |
|
| 3385 |
// Create a jQuery plugin
|
| 3386 |
// ======================
|
| 3387 |
|
| 3388 |
+
$.fn.fancyboxforwp = function (options) {
|
| 3389 |
var selector;
|
| 3390 |
|
| 3391 |
options = options || {};
|
| 3395 |
// Use body element instead of document so it executes first
|
| 3396 |
$("body")
|
| 3397 |
.off("click.fb-start", selector)
|
| 3398 |
+
.on("click.fb-start", selector, {
|
| 3399 |
+
options: options
|
| 3400 |
+
}, _run);
|
| 3401 |
} else {
|
| 3402 |
this.off("click.fb-start").on(
|
| 3403 |
+
"click.fb-start", {
|
|
|
|
| 3404 |
items: this,
|
| 3405 |
options: options
|
| 3406 |
},
|
| 3419 |
// Enable "trigger elements"
|
| 3420 |
// =========================
|
| 3421 |
|
| 3422 |
+
$D.on("click.fb-start", "[data-fancybox-trigger]", function (e) {
|
| 3423 |
$('[data-fancybox="' + $(this).attr("data-fancybox-trigger") + '"]')
|
| 3424 |
.eq($(this).attr("data-fancybox-index") || 0)
|
| 3425 |
.trigger("click.fb-start", {
|
| 3429 |
|
| 3430 |
// Track focus event for better accessibility styling
|
| 3431 |
// ==================================================
|
| 3432 |
+
(function () {
|
| 3433 |
var buttonStr = ".fancybox-button",
|
| 3434 |
focusStr = "fancybox-focus",
|
| 3435 |
$pressed = null;
|
| 3436 |
|
| 3437 |
+
$D.on("mousedown mouseup focus blur", buttonStr, function (e) {
|
| 3438 |
switch (e.type) {
|
| 3439 |
case "mousedown":
|
| 3440 |
$pressed = $(this);
|
| 3456 |
});
|
| 3457 |
})();
|
| 3458 |
})(window, document, jQuery);
|
|
|
|
| 3459 |
// ==========================================================================
|
| 3460 |
//
|
| 3461 |
// Media
|
| 3462 |
// Adds additional media type support
|
| 3463 |
//
|
| 3464 |
// ==========================================================================
|
| 3465 |
+
(function ($) {
|
| 3466 |
"use strict";
|
| 3467 |
|
| 3468 |
// Object containing properties for each media type
|
| 3481 |
},
|
| 3482 |
paramPlace: 8,
|
| 3483 |
type: "iframe",
|
| 3484 |
+
url: "https://www.youtube-nocookie.com/embed/$4",
|
| 3485 |
+
thumb: "https://img.youtube.com/vi/$4/hqdefault.jpg"
|
| 3486 |
},
|
| 3487 |
|
| 3488 |
vimeo: {
|
| 3514 |
gmap_place: {
|
| 3515 |
matcher: /(maps\.)?google\.([a-z]{2,3}(\.[a-z]{2})?)\/(((maps\/(place\/(.*)\/)?\@(.*),(\d+.?\d+?)z))|(\?ll=))(.*)?/i,
|
| 3516 |
type: "iframe",
|
| 3517 |
+
url: function (rez) {
|
| 3518 |
return (
|
| 3519 |
"//maps.google." +
|
| 3520 |
rez[2] +
|
| 3533 |
gmap_search: {
|
| 3534 |
matcher: /(maps\.)?google\.([a-z]{2,3}(\.[a-z]{2})?)\/(maps\/search\/)(.*)/i,
|
| 3535 |
type: "iframe",
|
| 3536 |
+
url: function (rez) {
|
| 3537 |
return "//maps.google." + rez[2] + "/maps?q=" + rez[5].replace("query=", "q=").replace("api=1", "") + "&output=embed";
|
| 3538 |
}
|
| 3539 |
}
|
| 3540 |
};
|
| 3541 |
|
| 3542 |
// Formats matching url to final form
|
| 3543 |
+
var format = function (url, rez, params) {
|
| 3544 |
if (!url) {
|
| 3545 |
return;
|
| 3546 |
}
|
| 3551 |
params = $.param(params, true);
|
| 3552 |
}
|
| 3553 |
|
| 3554 |
+
$.each(rez, function (key, value) {
|
| 3555 |
url = url.replace("$" + key, value || "");
|
| 3556 |
});
|
| 3557 |
|
| 3562 |
return url;
|
| 3563 |
};
|
| 3564 |
|
| 3565 |
+
$(document).on("objectNeedsType.fb", function (e, instance, item) {
|
| 3566 |
var url = item.src || "",
|
| 3567 |
type = false,
|
| 3568 |
media,
|
| 3576 |
media = $.extend(true, {}, defaults, item.opts.media);
|
| 3577 |
|
| 3578 |
// Look for any matching media type
|
| 3579 |
+
$.each(media, function (providerName, providerOpts) {
|
| 3580 |
rez = url.match(providerOpts.matcher);
|
| 3581 |
|
| 3582 |
if (!rez) {
|
| 3614 |
$.type(providerOpts.thumb) === "function" ? providerOpts.thumb.call(this, rez, params, item) : format(providerOpts.thumb, rez);
|
| 3615 |
|
| 3616 |
if (providerName === "youtube") {
|
| 3617 |
+
url = url.replace(/&t=((\d+)m)?(\d+)s/, function (match, p1, m, s) {
|
| 3618 |
return "&start=" + ((m ? parseInt(m, 10) * 60 : 0) + parseInt(s, 10));
|
| 3619 |
});
|
| 3620 |
} else if (providerName === "vimeo") {
|
| 3670 |
loaded: false
|
| 3671 |
},
|
| 3672 |
|
| 3673 |
+
load: function (vendor) {
|
| 3674 |
var _this = this,
|
| 3675 |
script;
|
| 3676 |
|
| 3677 |
if (this[vendor].loaded) {
|
| 3678 |
+
setTimeout(function () {
|
| 3679 |
_this.done(vendor);
|
| 3680 |
});
|
| 3681 |
return;
|
| 3692 |
script.src = this[vendor].src;
|
| 3693 |
|
| 3694 |
if (vendor === "youtube") {
|
| 3695 |
+
window.onYouTubeIframeAPIReady = function () {
|
| 3696 |
_this[vendor].loaded = true;
|
| 3697 |
_this.done(vendor);
|
| 3698 |
};
|
| 3699 |
} else {
|
| 3700 |
+
script.onload = function () {
|
| 3701 |
_this[vendor].loaded = true;
|
| 3702 |
_this.done(vendor);
|
| 3703 |
};
|
| 3705 |
|
| 3706 |
document.body.appendChild(script);
|
| 3707 |
},
|
| 3708 |
+
done: function (vendor) {
|
| 3709 |
var instance, $el, player;
|
| 3710 |
|
| 3711 |
if (vendor === "youtube") {
|
| 3720 |
if (vendor === "youtube" && YT !== undefined && YT) {
|
| 3721 |
player = new YT.Player($el.attr("id"), {
|
| 3722 |
events: {
|
| 3723 |
+
onStateChange: function (e) {
|
| 3724 |
if (e.data == 0) {
|
| 3725 |
instance.next();
|
| 3726 |
}
|
| 3730 |
} else if (vendor === "vimeo" && Vimeo !== undefined && Vimeo) {
|
| 3731 |
player = new Vimeo.Player($el);
|
| 3732 |
|
| 3733 |
+
player.on("ended", function () {
|
| 3734 |
instance.next();
|
| 3735 |
});
|
| 3736 |
}
|
| 3739 |
};
|
| 3740 |
|
| 3741 |
$(document).on({
|
| 3742 |
+
"afterShow.fb": function (e, instance, current) {
|
| 3743 |
if (instance.group.length > 1 && (current.contentSource === "youtube" || current.contentSource === "vimeo")) {
|
| 3744 |
VideoAPILoader.load(current.contentSource);
|
| 3745 |
}
|
| 3746 |
}
|
| 3747 |
});
|
| 3748 |
})(jQuery);
|
|
|
|
| 3749 |
// ==========================================================================
|
| 3750 |
//
|
| 3751 |
// Guestures
|
| 3752 |
// Adds touch guestures, handles click and tap events
|
| 3753 |
//
|
| 3754 |
// ==========================================================================
|
| 3755 |
+
(function (window, document, $) {
|
| 3756 |
"use strict";
|
| 3757 |
|
| 3758 |
+
var requestAFrame = (function () {
|
| 3759 |
return (
|
| 3760 |
window.requestAnimationFrame ||
|
| 3761 |
window.webkitRequestAnimationFrame ||
|
| 3762 |
window.mozRequestAnimationFrame ||
|
| 3763 |
window.oRequestAnimationFrame ||
|
| 3764 |
// if all else fails, use setTimeout
|
| 3765 |
+
function (callback) {
|
| 3766 |
return window.setTimeout(callback, 1000 / 60);
|
| 3767 |
}
|
| 3768 |
);
|
| 3769 |
})();
|
| 3770 |
|
| 3771 |
+
var cancelAFrame = (function () {
|
| 3772 |
return (
|
| 3773 |
window.cancelAnimationFrame ||
|
| 3774 |
window.webkitCancelAnimationFrame ||
|
| 3775 |
window.mozCancelAnimationFrame ||
|
| 3776 |
window.oCancelAnimationFrame ||
|
| 3777 |
+
function (id) {
|
| 3778 |
window.clearTimeout(id);
|
| 3779 |
}
|
| 3780 |
);
|
| 3781 |
})();
|
| 3782 |
|
| 3783 |
+
var getPointerXY = function (e) {
|
| 3784 |
var result = [];
|
| 3785 |
|
| 3786 |
e = e.originalEvent || e || window.e;
|
| 3803 |
return result;
|
| 3804 |
};
|
| 3805 |
|
| 3806 |
+
var distance = function (point2, point1, what) {
|
| 3807 |
if (!point1 || !point2) {
|
| 3808 |
return 0;
|
| 3809 |
}
|
| 3817 |
return Math.sqrt(Math.pow(point2.x - point1.x, 2) + Math.pow(point2.y - point1.y, 2));
|
| 3818 |
};
|
| 3819 |
|
| 3820 |
+
var isClickable = function ($el) {
|
| 3821 |
if (
|
| 3822 |
$el.is('a,area,button,[role="button"],input,label,select,summary,textarea,video,audio,iframe') ||
|
| 3823 |
$.isFunction($el.get(0).onclick) ||
|
| 3836 |
return false;
|
| 3837 |
};
|
| 3838 |
|
| 3839 |
+
var hasScrollbars = function (el) {
|
| 3840 |
var overflowY = window.getComputedStyle(el)["overflow-y"],
|
| 3841 |
overflowX = window.getComputedStyle(el)["overflow-x"],
|
| 3842 |
vertical = (overflowY === "scroll" || overflowY === "auto") && el.scrollHeight > el.clientHeight,
|
| 3845 |
return vertical || horizontal;
|
| 3846 |
};
|
| 3847 |
|
| 3848 |
+
var isScrollable = function ($el) {
|
| 3849 |
var rez = false;
|
| 3850 |
|
| 3851 |
while (true) {
|
| 3865 |
return rez;
|
| 3866 |
};
|
| 3867 |
|
| 3868 |
+
var Guestures = function (instance) {
|
| 3869 |
var self = this;
|
| 3870 |
|
| 3871 |
self.instance = instance;
|
| 3879 |
self.$container.on("touchstart.fb.touch mousedown.fb.touch", $.proxy(self, "ontouchstart"));
|
| 3880 |
};
|
| 3881 |
|
| 3882 |
+
Guestures.prototype.destroy = function () {
|
| 3883 |
var self = this;
|
| 3884 |
|
| 3885 |
self.$container.off(".fb.touch");
|
| 3897 |
}
|
| 3898 |
};
|
| 3899 |
|
| 3900 |
+
Guestures.prototype.ontouchstart = function (e) {
|
| 3901 |
var self = this,
|
| 3902 |
$target = $(e.target),
|
| 3903 |
instance = self.instance,
|
| 3964 |
self.canvasHeight = Math.round($slide[0].clientHeight);
|
| 3965 |
|
| 3966 |
self.contentLastPos = null;
|
| 3967 |
+
self.contentStartPos = $.fancyboxforwp.getTranslate(self.$content) || {
|
| 3968 |
+
top: 0,
|
| 3969 |
+
left: 0
|
| 3970 |
+
};
|
| 3971 |
self.sliderStartPos = $.fancyboxforwp.getTranslate($slide);
|
| 3972 |
|
| 3973 |
// Since position will be absolute, but we need to make it relative to the stage
|
| 3994 |
e.preventDefault();
|
| 3995 |
}
|
| 3996 |
|
| 3997 |
+
if (!($.fancyboxforwp.isMobile && $target.parents(".fancybox-caption").length)) {
|
| 3998 |
return;
|
| 3999 |
}
|
| 4000 |
}
|
| 4039 |
}
|
| 4040 |
};
|
| 4041 |
|
| 4042 |
+
Guestures.prototype.onscroll = function (e) {
|
| 4043 |
var self = this;
|
| 4044 |
|
| 4045 |
self.isScrolling = true;
|
| 4047 |
document.removeEventListener("scroll", self.onscroll, true);
|
| 4048 |
};
|
| 4049 |
|
| 4050 |
+
Guestures.prototype.ontouchmove = function (e) {
|
| 4051 |
var self = this;
|
| 4052 |
|
| 4053 |
// Make sure user has not released over iframe or disabled element
|
| 4088 |
}
|
| 4089 |
};
|
| 4090 |
|
| 4091 |
+
Guestures.prototype.onSwipe = function (e) {
|
| 4092 |
var self = this,
|
| 4093 |
instance = self.instance,
|
| 4094 |
swiping = self.isSwiping,
|
| 4122 |
// Reset points to avoid jumping, because we dropped first swipes to calculate the angle
|
| 4123 |
self.startPoints = self.newPoints;
|
| 4124 |
|
| 4125 |
+
$.each(instance.slides, function (index, slide) {
|
| 4126 |
var slidePos, stagePos;
|
| 4127 |
|
| 4128 |
$.fancyboxforwp.stop(slide.$slide);
|
| 4137 |
"transition-duration": ""
|
| 4138 |
})
|
| 4139 |
.removeClass("fancybox-animated")
|
| 4140 |
+
.removeClass(function (index, className) {
|
| 4141 |
return (className.match(/(^|\s)fancybox-fx-\S+/g) || []).join(" ");
|
| 4142 |
});
|
| 4143 |
|
| 4190 |
self.requestId = null;
|
| 4191 |
}
|
| 4192 |
|
| 4193 |
+
self.requestId = requestAFrame(function () {
|
| 4194 |
if (self.sliderLastPos) {
|
| 4195 |
+
$.each(self.instance.slides, function (index, slide) {
|
| 4196 |
var pos = slide.pos - self.instance.currPos;
|
| 4197 |
|
| 4198 |
$.fancyboxforwp.setTranslate(slide.$slide, {
|
| 4206 |
});
|
| 4207 |
};
|
| 4208 |
|
| 4209 |
+
Guestures.prototype.onPan = function () {
|
| 4210 |
var self = this;
|
| 4211 |
|
| 4212 |
// Prevent accidental movement (sometimes, when tapping casually, finger can move a bit)
|
| 4223 |
cancelAFrame(self.requestId);
|
| 4224 |
}
|
| 4225 |
|
| 4226 |
+
self.requestId = requestAFrame(function () {
|
| 4227 |
$.fancyboxforwp.setTranslate(self.$content, self.contentLastPos);
|
| 4228 |
});
|
| 4229 |
};
|
| 4230 |
|
| 4231 |
// Make panning sticky to the edges
|
| 4232 |
+
Guestures.prototype.limitMovement = function () {
|
| 4233 |
var self = this;
|
| 4234 |
|
| 4235 |
var canvasWidth = self.canvasWidth;
|
| 4289 |
};
|
| 4290 |
};
|
| 4291 |
|
| 4292 |
+
Guestures.prototype.limitPosition = function (newOffsetX, newOffsetY, newWidth, newHeight) {
|
| 4293 |
var self = this;
|
| 4294 |
|
| 4295 |
var canvasWidth = self.canvasWidth;
|
| 4317 |
};
|
| 4318 |
};
|
| 4319 |
|
| 4320 |
+
Guestures.prototype.onZoom = function () {
|
| 4321 |
var self = this;
|
| 4322 |
|
| 4323 |
// Calculate current distance between points to get pinch ratio and new width and height
|
| 4371 |
cancelAFrame(self.requestId);
|
| 4372 |
}
|
| 4373 |
|
| 4374 |
+
self.requestId = requestAFrame(function () {
|
| 4375 |
$.fancyboxforwp.setTranslate(self.$content, self.contentLastPos);
|
| 4376 |
});
|
| 4377 |
};
|
| 4378 |
|
| 4379 |
+
Guestures.prototype.ontouchend = function (e) {
|
| 4380 |
var self = this;
|
| 4381 |
|
| 4382 |
var swiping = self.isSwiping;
|
| 4427 |
return;
|
| 4428 |
};
|
| 4429 |
|
| 4430 |
+
Guestures.prototype.endSwiping = function (swiping, scrolling) {
|
| 4431 |
var self = this,
|
| 4432 |
ret = false,
|
| 4433 |
len = self.instance.group.length,
|
| 4441 |
if (swiping == "y" && !scrolling && Math.abs(self.distanceY) > 50) {
|
| 4442 |
// Continue vertical movement
|
| 4443 |
$.fancyboxforwp.animate(
|
| 4444 |
+
self.instance.current.$slide, {
|
|
|
|
| 4445 |
top: self.sliderStartPos.top + self.distanceY + self.velocityY * 150,
|
| 4446 |
opacity: 0
|
| 4447 |
},
|
| 4463 |
|
| 4464 |
// Limit panning from edges
|
| 4465 |
// ========================
|
| 4466 |
+
Guestures.prototype.endPanning = function () {
|
| 4467 |
var self = this,
|
| 4468 |
newOffsetX,
|
| 4469 |
newOffsetY,
|
| 4487 |
newPos.width = self.contentStartPos.width;
|
| 4488 |
newPos.height = self.contentStartPos.height;
|
| 4489 |
|
| 4490 |
+
$.fancyboxforwp.animate(self.$content, newPos, 366);
|
| 4491 |
};
|
| 4492 |
|
| 4493 |
+
Guestures.prototype.endZooming = function () {
|
| 4494 |
var self = this;
|
| 4495 |
|
| 4496 |
var current = self.instance.current;
|
| 4530 |
}
|
| 4531 |
};
|
| 4532 |
|
| 4533 |
+
Guestures.prototype.onTap = function (e) {
|
| 4534 |
var self = this;
|
| 4535 |
var $target = $(e.target);
|
| 4536 |
|
| 4544 |
|
| 4545 |
var where;
|
| 4546 |
|
| 4547 |
+
var process = function (prefix) {
|
| 4548 |
var action = current.opts[prefix];
|
| 4549 |
|
| 4550 |
if ($.isFunction(action)) {
|
| 4613 |
} else if (
|
| 4614 |
instance.current.$content &&
|
| 4615 |
instance.current.$content
|
| 4616 |
+
.find($target)
|
| 4617 |
+
.addBack()
|
| 4618 |
+
.filter($target).length
|
| 4619 |
) {
|
| 4620 |
where = "Content";
|
| 4621 |
} else {
|
| 4642 |
self.tapY = tapY;
|
| 4643 |
|
| 4644 |
if (current.opts["dblclick" + where] && current.opts["dblclick" + where] !== current.opts["click" + where]) {
|
| 4645 |
+
self.tapped = setTimeout(function () {
|
| 4646 |
self.tapped = null;
|
| 4647 |
|
| 4648 |
if (!instance.isAnimating) {
|
| 4658 |
};
|
| 4659 |
|
| 4660 |
$(document)
|
| 4661 |
+
.on("onActivate.fb", function (e, instance) {
|
| 4662 |
if (instance && !instance.Guestures) {
|
| 4663 |
instance.Guestures = new Guestures(instance);
|
| 4664 |
}
|
| 4665 |
})
|
| 4666 |
+
.on("beforeClose.fb", function (e, instance) {
|
| 4667 |
if (instance && instance.Guestures) {
|
| 4668 |
instance.Guestures.destroy();
|
| 4669 |
}
|
| 4670 |
});
|
| 4671 |
})(window, document, jQuery);
|
|
|
|
| 4672 |
// ==========================================================================
|
| 4673 |
//
|
| 4674 |
// SlideShow
|
| 4678 |
// $.fancyboxforwp.getInstance().SlideShow.start()
|
| 4679 |
//
|
| 4680 |
// ==========================================================================
|
| 4681 |
+
(function (document, $) {
|
| 4682 |
"use strict";
|
| 4683 |
|
| 4684 |
$.extend(true, $.fancyboxforwp.defaults, {
|
| 4685 |
btnTpl: {
|
| 4686 |
+
slideShow: '<button data-fancybox-play class="fancybox-button fancybox-button--play" title="{{PLAY_START}}">' +
|
|
|
|
| 4687 |
'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M6.5 5.4v13.2l11-6.6z"/></svg>' +
|
| 4688 |
'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M8.33 5.75h2.2v12.5h-2.2V5.75zm5.15 0h2.2v12.5h-2.2V5.75z"/></svg>' +
|
| 4689 |
"</button>"
|
| 4695 |
}
|
| 4696 |
});
|
| 4697 |
|
| 4698 |
+
var SlideShow = function (instance) {
|
| 4699 |
this.instance = instance;
|
| 4700 |
this.init();
|
| 4701 |
};
|
| 4705 |
isActive: false,
|
| 4706 |
$button: null,
|
| 4707 |
|
| 4708 |
+
init: function () {
|
| 4709 |
var self = this,
|
| 4710 |
instance = self.instance,
|
| 4711 |
opts = instance.group[instance.currIndex].opts.slideShow;
|
| 4712 |
|
| 4713 |
+
self.$button = instance.$refs.toolbar.find("[data-fancybox-play]").on("click", function () {
|
| 4714 |
self.toggle();
|
| 4715 |
});
|
| 4716 |
|
| 4721 |
}
|
| 4722 |
},
|
| 4723 |
|
| 4724 |
+
set: function (force) {
|
| 4725 |
var self = this,
|
| 4726 |
instance = self.instance,
|
| 4727 |
current = instance.current;
|
| 4730 |
if (current && (force === true || current.opts.loop || instance.currIndex < instance.group.length - 1)) {
|
| 4731 |
if (self.isActive && current.contentType !== "video") {
|
| 4732 |
if (self.$progress) {
|
| 4733 |
+
$.fancyboxforwp.animate(self.$progress.show(), {
|
| 4734 |
+
scaleX: 1
|
| 4735 |
+
}, current.opts.slideShow.speed);
|
| 4736 |
}
|
| 4737 |
|
| 4738 |
+
self.timer = setTimeout(function () {
|
| 4739 |
+
if (!instance.current.opts.loop && instance.current.index == instance.group.length - 1) {
|
| 4740 |
+
instance.jumpTo(0);
|
| 4741 |
+
} else {
|
| 4742 |
+
instance.next();
|
| 4743 |
+
}
|
| 4744 |
}, current.opts.slideShow.speed);
|
| 4745 |
}
|
| 4746 |
} else {
|
| 4750 |
}
|
| 4751 |
},
|
| 4752 |
|
| 4753 |
+
clear: function () {
|
| 4754 |
var self = this;
|
| 4755 |
|
| 4756 |
clearTimeout(self.timer);
|
| 4762 |
}
|
| 4763 |
},
|
| 4764 |
|
| 4765 |
+
start: function () {
|
| 4766 |
var self = this,
|
| 4767 |
current = self.instance.current;
|
| 4768 |
|
| 4769 |
if (current) {
|
| 4770 |
self.$button
|
| 4771 |
+
.attr("title", (current.opts.i18n[current.opts.lang] || current.opts.i18n.en).PLAY_STOP)
|
| 4772 |
.removeClass("fancybox-button--play")
|
| 4773 |
.addClass("fancybox-button--pause");
|
| 4774 |
|
| 4782 |
}
|
| 4783 |
},
|
| 4784 |
|
| 4785 |
+
stop: function () {
|
| 4786 |
var self = this,
|
| 4787 |
current = self.instance.current;
|
| 4788 |
|
| 4789 |
self.clear();
|
| 4790 |
|
| 4791 |
self.$button
|
| 4792 |
+
.attr("title", (current.opts.i18n[current.opts.lang] || current.opts.i18n.en).PLAY_START)
|
| 4793 |
.removeClass("fancybox-button--pause")
|
| 4794 |
.addClass("fancybox-button--play");
|
| 4795 |
|
| 4802 |
}
|
| 4803 |
},
|
| 4804 |
|
| 4805 |
+
toggle: function () {
|
| 4806 |
var self = this;
|
| 4807 |
|
| 4808 |
if (self.isActive) {
|
| 4814 |
});
|
| 4815 |
|
| 4816 |
$(document).on({
|
| 4817 |
+
"onInit.fb": function (e, instance) {
|
| 4818 |
if (instance && !instance.SlideShow) {
|
| 4819 |
instance.SlideShow = new SlideShow(instance);
|
| 4820 |
}
|
| 4821 |
},
|
| 4822 |
|
| 4823 |
+
"beforeShow.fb": function (e, instance, current, firstRun) {
|
| 4824 |
var SlideShow = instance && instance.SlideShow;
|
| 4825 |
|
| 4826 |
if (firstRun) {
|
| 4832 |
}
|
| 4833 |
},
|
| 4834 |
|
| 4835 |
+
"afterShow.fb": function (e, instance, current) {
|
| 4836 |
var SlideShow = instance && instance.SlideShow;
|
| 4837 |
|
| 4838 |
if (SlideShow && SlideShow.isActive) {
|
| 4840 |
}
|
| 4841 |
},
|
| 4842 |
|
| 4843 |
+
"afterKeydown.fb": function (e, instance, current, keypress, keycode) {
|
| 4844 |
var SlideShow = instance && instance.SlideShow;
|
| 4845 |
|
| 4846 |
// "P" or Spacebar
|
| 4851 |
}
|
| 4852 |
},
|
| 4853 |
|
| 4854 |
+
"beforeClose.fb onDeactivate.fb": function (e, instance) {
|
| 4855 |
var SlideShow = instance && instance.SlideShow;
|
| 4856 |
|
| 4857 |
if (SlideShow) {
|
| 4861 |
});
|
| 4862 |
|
| 4863 |
// Page Visibility API to pause slideshow when window is not active
|
| 4864 |
+
$(document).on("visibilitychange", function () {
|
| 4865 |
var instance = $.fancyboxforwp.getInstance(),
|
| 4866 |
SlideShow = instance && instance.SlideShow;
|
| 4867 |
|
| 4874 |
}
|
| 4875 |
});
|
| 4876 |
})(document, jQuery);
|
|
|
|
| 4877 |
// ==========================================================================
|
| 4878 |
//
|
| 4879 |
// FullScreen
|
| 4880 |
// Adds fullscreen functionality
|
| 4881 |
//
|
| 4882 |
// ==========================================================================
|
| 4883 |
+
(function (document, $) {
|
| 4884 |
"use strict";
|
| 4885 |
|
| 4886 |
// Collection of methods supported by user browser
|
| 4887 |
+
var fn = (function () {
|
| 4888 |
var fnMap = [
|
| 4889 |
["requestFullscreen", "exitFullscreen", "fullscreenElement", "fullscreenEnabled", "fullscreenchange", "fullscreenerror"],
|
| 4890 |
// new WebKit
|
| 4935 |
|
| 4936 |
if (fn) {
|
| 4937 |
var FullScreen = {
|
| 4938 |
+
request: function (elem) {
|
| 4939 |
elem = elem || document.documentElement;
|
| 4940 |
|
| 4941 |
elem[fn.requestFullscreen](elem.ALLOW_KEYBOARD_INPUT);
|
| 4942 |
},
|
| 4943 |
+
exit: function () {
|
| 4944 |
document[fn.exitFullscreen]();
|
| 4945 |
},
|
| 4946 |
+
toggle: function (elem) {
|
| 4947 |
elem = elem || document.documentElement;
|
| 4948 |
|
| 4949 |
if (this.isFullscreen()) {
|
| 4952 |
this.request(elem);
|
| 4953 |
}
|
| 4954 |
},
|
| 4955 |
+
isFullscreen: function () {
|
| 4956 |
return Boolean(document[fn.fullscreenElement]);
|
| 4957 |
},
|
| 4958 |
+
enabled: function () {
|
| 4959 |
return Boolean(document[fn.fullscreenEnabled]);
|
| 4960 |
}
|
| 4961 |
};
|
| 4962 |
|
| 4963 |
$.extend(true, $.fancyboxforwp.defaults, {
|
| 4964 |
btnTpl: {
|
| 4965 |
+
fullScreen: '<button data-fancybox-fullscreen class="fancybox-button fancybox-button--fsenter" title="{{FULL_SCREEN}}">' +
|
|
|
|
| 4966 |
'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z"/></svg>' +
|
| 4967 |
'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M5 16h3v3h2v-5H5zm3-8H5v2h5V5H8zm6 11h2v-3h3v-2h-5zm2-11V5h-2v5h5V8z"/></svg>' +
|
| 4968 |
"</button>"
|
| 4972 |
}
|
| 4973 |
});
|
| 4974 |
|
| 4975 |
+
$(document).on(fn.fullscreenchange, function () {
|
| 4976 |
var isFullscreen = FullScreen.isFullscreen(),
|
| 4977 |
instance = $.fancyboxforwp.getInstance();
|
| 4978 |
|
| 4979 |
if (instance) {
|
| 4980 |
// If image is zooming, then force to stop and reposition properly
|
| 4981 |
if (instance.current && instance.current.type === "image" && instance.isAnimating) {
|
|
|
|
|
|
|
| 4982 |
instance.isAnimating = false;
|
| 4983 |
|
| 4984 |
instance.update(true, true, 0);
|
| 4985 |
+
|
| 4986 |
+
if (!instance.isComplete) {
|
| 4987 |
+
instance.complete();
|
| 4988 |
+
}
|
| 4989 |
}
|
| 4990 |
|
| 4991 |
instance.trigger("onFullscreenChange", isFullscreen);
|
| 5001 |
}
|
| 5002 |
|
| 5003 |
$(document).on({
|
| 5004 |
+
"onInit.fb": function (e, instance) {
|
| 5005 |
var $container;
|
| 5006 |
|
| 5007 |
if (!fn) {
|
| 5013 |
if (instance && instance.group[instance.currIndex].opts.fullScreen) {
|
| 5014 |
$container = instance.$refs.container;
|
| 5015 |
|
| 5016 |
+
$container.on("click.fb-fullscreen", "[data-fancybox-fullscreen]", function (e) {
|
| 5017 |
e.stopPropagation();
|
| 5018 |
e.preventDefault();
|
| 5019 |
|
| 5031 |
}
|
| 5032 |
},
|
| 5033 |
|
| 5034 |
+
"afterKeydown.fb": function (e, instance, current, keypress, keycode) {
|
| 5035 |
// "F"
|
| 5036 |
if (instance && instance.FullScreen && keycode === 70) {
|
| 5037 |
keypress.preventDefault();
|
| 5040 |
}
|
| 5041 |
},
|
| 5042 |
|
| 5043 |
+
"beforeClose.fb": function (e, instance) {
|
| 5044 |
if (instance && instance.FullScreen && instance.$refs.container.hasClass("fancybox-is-fullscreen")) {
|
| 5045 |
FullScreen.exit();
|
| 5046 |
}
|
| 5047 |
}
|
| 5048 |
});
|
| 5049 |
})(document, jQuery);
|
|
|
|
| 5050 |
// ==========================================================================
|
| 5051 |
//
|
| 5052 |
// Thumbs
|
| 5053 |
// Displays thumbnails in a grid
|
| 5054 |
//
|
| 5055 |
// ==========================================================================
|
| 5056 |
+
(function (document, $) {
|
| 5057 |
"use strict";
|
| 5058 |
|
| 5059 |
var CLASS = "fancybox-thumbs",
|
| 5061 |
|
| 5062 |
// Make sure there are default values
|
| 5063 |
$.fancyboxforwp.defaults = $.extend(
|
| 5064 |
+
true, {
|
|
|
|
| 5065 |
btnTpl: {
|
| 5066 |
+
thumbs: '<button data-fancybox-thumbs class="fancybox-button fancybox-button--thumbs" title="{{THUMBS}}">' +
|
|
|
|
| 5067 |
'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M14.59 14.59h3.76v3.76h-3.76v-3.76zm-4.47 0h3.76v3.76h-3.76v-3.76zm-4.47 0h3.76v3.76H5.65v-3.76zm8.94-4.47h3.76v3.76h-3.76v-3.76zm-4.47 0h3.76v3.76h-3.76v-3.76zm-4.47 0h3.76v3.76H5.65v-3.76zm8.94-4.47h3.76v3.76h-3.76V5.65zm-4.47 0h3.76v3.76h-3.76V5.65zm-4.47 0h3.76v3.76H5.65V5.65z"/></svg>' +
|
| 5068 |
"</button>"
|
| 5069 |
},
|
| 5077 |
$.fancyboxforwp.defaults
|
| 5078 |
);
|
| 5079 |
|
| 5080 |
+
var FancyThumbs = function (instance) {
|
| 5081 |
this.init(instance);
|
| 5082 |
};
|
| 5083 |
|
| 5088 |
isVisible: false,
|
| 5089 |
isActive: false,
|
| 5090 |
|
| 5091 |
+
init: function (instance) {
|
| 5092 |
var self = this,
|
| 5093 |
group = instance.group,
|
| 5094 |
enabled = 0;
|
| 5112 |
}
|
| 5113 |
|
| 5114 |
if (enabled > 1 && !!self.opts) {
|
| 5115 |
+
self.$button.removeAttr("style").on("click", function () {
|
| 5116 |
self.toggle();
|
| 5117 |
});
|
| 5118 |
|
| 5122 |
}
|
| 5123 |
},
|
| 5124 |
|
| 5125 |
+
create: function () {
|
| 5126 |
var self = this,
|
| 5127 |
instance = self.instance,
|
| 5128 |
parentEl = self.opts.parentEl,
|
| 5133 |
// Create main element
|
| 5134 |
self.$grid = $('<div class="' + CLASS + " " + CLASS + "-" + self.opts.axis + '"></div>').appendTo(
|
| 5135 |
instance.$refs.container
|
| 5136 |
+
.find(parentEl)
|
| 5137 |
+
.addBack()
|
| 5138 |
+
.filter(parentEl)
|
| 5139 |
);
|
| 5140 |
|
| 5141 |
// Add "click" event that performs gallery navigation
|
| 5142 |
+
self.$grid.on("click", "a", function () {
|
| 5143 |
instance.jumpTo($(this).attr("data-index"));
|
| 5144 |
});
|
| 5145 |
}
|
| 5149 |
self.$list = $('<div class="' + CLASS + '__list">').appendTo(self.$grid);
|
| 5150 |
}
|
| 5151 |
|
| 5152 |
+
$.each(instance.group, function (i, item) {
|
| 5153 |
src = item.thumb;
|
| 5154 |
|
| 5155 |
if (!src && item.type === "image") {
|
| 5158 |
|
| 5159 |
list.push(
|
| 5160 |
'<a href="javascript:;" tabindex="0" data-index="' +
|
| 5161 |
+
i +
|
| 5162 |
+
'"' +
|
| 5163 |
+
(src && src.length ? ' style="background-image:url(' + src + ')"' : 'class="fancybox-thumbs-missing"') +
|
| 5164 |
+
"></a>"
|
| 5165 |
);
|
| 5166 |
});
|
| 5167 |
|
| 5171 |
// Set fixed width for list element to enable horizontal scrolling
|
| 5172 |
self.$list.width(
|
| 5173 |
parseInt(self.$grid.css("padding-right"), 10) +
|
| 5174 |
+
instance.group.length *
|
| 5175 |
+
self.$list
|
| 5176 |
+
.children()
|
| 5177 |
+
.eq(0)
|
| 5178 |
+
.outerWidth(true)
|
| 5179 |
);
|
| 5180 |
}
|
| 5181 |
},
|
| 5182 |
|
| 5183 |
+
focus: function (duration) {
|
| 5184 |
var self = this,
|
| 5185 |
$list = self.$list,
|
| 5186 |
$grid = self.$grid,
|
| 5201 |
|
| 5202 |
// Check if need to scroll to make current thumb visible
|
| 5203 |
if (self.opts.axis === "y" && (thumbPos.top < 0 || thumbPos.top > $list.height() - thumb.outerHeight())) {
|
| 5204 |
+
$list.stop().animate({
|
|
|
|
| 5205 |
scrollTop: $list.scrollTop() + thumbPos.top
|
| 5206 |
},
|
| 5207 |
duration
|
| 5213 |
$list
|
| 5214 |
.parent()
|
| 5215 |
.stop()
|
| 5216 |
+
.animate({
|
|
|
|
| 5217 |
scrollLeft: thumbPos.left
|
| 5218 |
},
|
| 5219 |
duration
|
| 5221 |
}
|
| 5222 |
},
|
| 5223 |
|
| 5224 |
+
update: function () {
|
| 5225 |
var that = this;
|
| 5226 |
that.instance.$refs.container.toggleClass("fancybox-show-thumbs", this.isVisible);
|
| 5227 |
|
| 5241 |
that.instance.update();
|
| 5242 |
},
|
| 5243 |
|
| 5244 |
+
hide: function () {
|
| 5245 |
this.isVisible = false;
|
| 5246 |
this.update();
|
| 5247 |
},
|
| 5248 |
|
| 5249 |
+
show: function () {
|
| 5250 |
this.isVisible = true;
|
| 5251 |
this.update();
|
| 5252 |
},
|
| 5253 |
|
| 5254 |
+
toggle: function () {
|
| 5255 |
this.isVisible = !this.isVisible;
|
| 5256 |
this.update();
|
| 5257 |
}
|
| 5258 |
});
|
| 5259 |
|
| 5260 |
$(document).on({
|
| 5261 |
+
"onInit.fb": function (e, instance) {
|
| 5262 |
var Thumbs;
|
| 5263 |
|
| 5264 |
if (instance && !instance.Thumbs) {
|
| 5270 |
}
|
| 5271 |
},
|
| 5272 |
|
| 5273 |
+
"beforeShow.fb": function (e, instance, item, firstRun) {
|
| 5274 |
var Thumbs = instance && instance.Thumbs;
|
| 5275 |
|
| 5276 |
if (Thumbs && Thumbs.isVisible) {
|
| 5278 |
}
|
| 5279 |
},
|
| 5280 |
|
| 5281 |
+
"afterKeydown.fb": function (e, instance, current, keypress, keycode) {
|
| 5282 |
var Thumbs = instance && instance.Thumbs;
|
| 5283 |
|
| 5284 |
// "G"
|
| 5289 |
}
|
| 5290 |
},
|
| 5291 |
|
| 5292 |
+
"beforeClose.fb": function (e, instance) {
|
| 5293 |
var Thumbs = instance && instance.Thumbs;
|
| 5294 |
|
| 5295 |
if (Thumbs && Thumbs.isVisible && Thumbs.opts.hideOnClose !== false) {
|
| 5298 |
}
|
| 5299 |
});
|
| 5300 |
})(document, jQuery);
|
|
|
|
| 5301 |
//// ==========================================================================
|
| 5302 |
//
|
| 5303 |
// Share
|
| 5304 |
// Displays simple form for sharing current url
|
| 5305 |
//
|
| 5306 |
// ==========================================================================
|
| 5307 |
+
(function (document, $) {
|
| 5308 |
"use strict";
|
| 5309 |
|
| 5310 |
$.extend(true, $.fancyboxforwp.defaults, {
|
| 5311 |
btnTpl: {
|
| 5312 |
+
share: '<button data-fancybox-share class="fancybox-button fancybox-button--share" title="{{SHARE}}">' +
|
|
|
|
| 5313 |
'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M2.55 19c1.4-8.4 9.1-9.8 11.9-9.8V5l7 7-7 6.3v-3.5c-2.8 0-10.5 2.1-11.9 4.2z"/></svg>' +
|
| 5314 |
"</button>"
|
| 5315 |
},
|
| 5316 |
share: {
|
| 5317 |
+
url: function (instance, item) {
|
| 5318 |
return (
|
| 5319 |
(!instance.currentHash && !(item.type === "inline" || item.type === "html") ? item.origSrc || item.src : false) || window.location
|
| 5320 |
);
|
| 5321 |
},
|
| 5322 |
+
tpl: '<div class="fancybox-share">' +
|
|
|
|
| 5323 |
"<h1>{{SHARE}}</h1>" +
|
| 5324 |
"<p>" +
|
| 5325 |
'<a class="fancybox-share__button fancybox-share__button--fb" href="https://www.facebook.com/sharer/sharer.php?u={{url}}">' +
|
| 5352 |
"=": "="
|
| 5353 |
};
|
| 5354 |
|
| 5355 |
+
return String(string).replace(/[&<>"'`=\/]/g, function (s) {
|
| 5356 |
return entityMap[s];
|
| 5357 |
});
|
| 5358 |
}
|
| 5359 |
|
| 5360 |
+
$(document).on("click", "[data-fancybox-share]", function () {
|
| 5361 |
var instance = $.fancyboxforwp.getInstance(),
|
| 5362 |
current = instance.current || null,
|
| 5363 |
url,
|
| 5383 |
opts: {
|
| 5384 |
touch: false,
|
| 5385 |
animationEffect: false,
|
| 5386 |
+
afterLoad: function (shareInstance, shareCurrent) {
|
| 5387 |
// Close self if parent instance is closing
|
| 5388 |
+
instance.$refs.container.one("beforeClose.fb", function () {
|
| 5389 |
shareInstance.close(null, 0);
|
| 5390 |
});
|
| 5391 |
|
| 5392 |
// Opening links in a popup window
|
| 5393 |
+
shareCurrent.$content.find(".fancybox-share__button").click(function () {
|
| 5394 |
window.open(this.href, "Share", "width=550, height=450");
|
| 5395 |
return false;
|
| 5396 |
});
|
| 5402 |
});
|
| 5403 |
});
|
| 5404 |
})(document, jQuery);
|
|
|
|
| 5405 |
// ==========================================================================
|
| 5406 |
//
|
| 5407 |
// Hash
|
| 5408 |
// Enables linking to each modal
|
| 5409 |
//
|
| 5410 |
// ==========================================================================
|
| 5411 |
+
(function (window, document, $) {
|
| 5412 |
"use strict";
|
| 5413 |
|
| 5414 |
// Simple $.escapeSelector polyfill (for jQuery prior v3)
|
| 5415 |
if (!$.escapeSelector) {
|
| 5416 |
+
$.escapeSelector = function (sel) {
|
| 5417 |
var rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g;
|
| 5418 |
+
var fcssescape = function (ch, asCodePoint) {
|
| 5419 |
if (asCodePoint) {
|
| 5420 |
// U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
|
| 5421 |
if (ch === "\0") {
|
| 5476 |
}
|
| 5477 |
|
| 5478 |
// Start when DOM becomes ready
|
| 5479 |
+
$(function () {
|
| 5480 |
// Check if user has disabled this module
|
| 5481 |
if ($.fancyboxforwp.defaults.hash === false) {
|
| 5482 |
return;
|
| 5484 |
|
| 5485 |
// Update hash when opening/closing fancyBox
|
| 5486 |
$(document).on({
|
| 5487 |
+
"onInit.fb": function (e, instance) {
|
| 5488 |
var url, gallery;
|
| 5489 |
|
| 5490 |
if (instance.group[instance.currIndex].opts.hash === false) {
|
| 5500 |
}
|
| 5501 |
},
|
| 5502 |
|
| 5503 |
+
"beforeShow.fb": function (e, instance, current, firstRun) {
|
| 5504 |
var gallery;
|
| 5505 |
|
| 5506 |
if (!current || current.opts.hash === false) {
|
| 5532 |
}
|
| 5533 |
|
| 5534 |
// Update hash
|
| 5535 |
+
instance.hashTimer = setTimeout(function () {
|
| 5536 |
if ("replaceState" in window.history) {
|
| 5537 |
+
window.history[firstRun ? "pushState" : "replaceState"]({},
|
|
|
|
| 5538 |
document.title,
|
| 5539 |
window.location.pathname + window.location.search + "#" + instance.currentHash
|
| 5540 |
);
|
| 5550 |
}, 300);
|
| 5551 |
},
|
| 5552 |
|
| 5553 |
+
"beforeClose.fb": function (e, instance, current) {
|
| 5554 |
+
if (!current || current.opts.hash === false) {
|
| 5555 |
return;
|
| 5556 |
}
|
| 5557 |
|
| 5573 |
});
|
| 5574 |
|
| 5575 |
// Check if need to start/close after url has changed
|
| 5576 |
+
$(window).on("hashchange.fb", function () {
|
| 5577 |
var url = parseUrl(),
|
| 5578 |
fb = null;
|
| 5579 |
|
| 5580 |
// Find last fancyBox instance that has "hash"
|
| 5581 |
$.each(
|
| 5582 |
$(".fancybox-container")
|
| 5583 |
+
.get()
|
| 5584 |
+
.reverse(),
|
| 5585 |
+
function (index, value) {
|
| 5586 |
var tmp = $(value).data("FancyBox");
|
| 5587 |
|
| 5588 |
if (tmp && tmp.currentHash) {
|
| 5605 |
});
|
| 5606 |
|
| 5607 |
// Check current hash and trigger click event on matching element to start fancyBox, if needed
|
| 5608 |
+
setTimeout(function () {
|
| 5609 |
if (!$.fancyboxforwp.getInstance()) {
|
| 5610 |
triggerFromUrl(parseUrl());
|
| 5611 |
}
|
| 5612 |
}, 50);
|
| 5613 |
});
|
| 5614 |
})(window, document, jQuery);
|
|
|
|
| 5615 |
// ==========================================================================
|
| 5616 |
//
|
| 5617 |
// Wheel
|
| 5618 |
// Basic mouse weheel support for gallery navigation
|
| 5619 |
//
|
| 5620 |
// ==========================================================================
|
| 5621 |
+
(function (document, $) {
|
| 5622 |
"use strict";
|
| 5623 |
|
| 5624 |
var prevTime = new Date().getTime();
|
| 5625 |
|
| 5626 |
$(document).on({
|
| 5627 |
+
"onInit.fb": function (e, instance, current) {
|
| 5628 |
+
instance.$refs.stage.on("mousewheel DOMMouseScroll wheel MozMousePixelScroll", function (e) {
|
| 5629 |
var current = instance.current,
|
| 5630 |
currTime = new Date().getTime();
|
| 5631 |
|
| 5652 |
});
|
| 5653 |
}
|
| 5654 |
});
|
| 5655 |
+
})(document, jQuery);
|
fancybox.php
CHANGED
|
@@ -3,7 +3,7 @@
|
|
| 3 |
* Plugin Name: FancyBox for WordPress
|
| 4 |
* Plugin URI: https://wordpress.org/plugins/fancybox-for-wordpress/
|
| 5 |
* Description: Integrates <a href="http://fancyapps.com/fancybox/3/">FancyBox 3</a> into WordPress.
|
| 6 |
-
* Version: 3.3.
|
| 7 |
* Author: Colorlib
|
| 8 |
* Author URI: https://colorlib.com/wp/
|
| 9 |
* Tested up to: 5.6
|
|
@@ -36,7 +36,7 @@
|
|
| 36 |
* Plugin Init
|
| 37 |
*/
|
| 38 |
// Constants
|
| 39 |
-
define( 'FBFW_VERSION', '3.3.
|
| 40 |
define( 'FBFW_PATH', plugin_dir_path( __FILE__ ) );
|
| 41 |
define( 'FBFW_URL', plugin_dir_url( __FILE__ ) );
|
| 42 |
define( 'FBFW_PLUGIN_BASE', plugin_basename( __FILE__ ) );
|
|
@@ -269,6 +269,8 @@ function mfbfw_init() {
|
|
| 269 |
|
| 270 |
$mfbfw['customExpression'] = str_replace( '"rel"', '"data-fancybox"', $mfbfw['customExpression'] );
|
| 271 |
|
|
|
|
|
|
|
| 272 |
//title position settings
|
| 273 |
if ( isset( $mfbfw['titlePosition'] ) ) {
|
| 274 |
if ( $mfbfw['titlePosition'] == 'inside' ) {
|
|
@@ -301,7 +303,7 @@ function mfbfw_init() {
|
|
| 301 |
' . ( isset( $mfbfw['titleShow'] ) ? 'div.fancybox-caption p.caption-title{display:inline-block}' : 'div.fancybox-custom-caption p.caption-title{display:none}div.fancybox-caption{display:none;}' ) . '
|
| 302 |
' . ( isset( $mfbfw['titleSize'] ) ? 'div.fancybox-caption p.caption-title{font-size:' . $mfbfw['titleSize'] . 'px}' : 'div.fancybox-caption p.caption-title{font-size:14px}' ) . '
|
| 303 |
' . ( isset( $mfbfw['titleColor'] ) && $mfbfw['titlePosition'] == 'inside' ? 'div.fancybox-caption p.caption-title{color:' . $mfbfw['titleColor'] . '}' : 'div.fancybox-caption p.caption-title{color:#fff}' ) . '
|
| 304 |
-
' . ( isset( $mfbfw['titlePosition'] ) ? 'div.fancybox-caption {color:' . $mfbfw['titleColor'] . '}' : 'div.fancybox-caption p.caption-title{color:#333333}' ) . $captionPosition
|
| 305 |
</style>';
|
| 306 |
?>
|
| 307 |
<script type="text/javascript">
|
| 3 |
* Plugin Name: FancyBox for WordPress
|
| 4 |
* Plugin URI: https://wordpress.org/plugins/fancybox-for-wordpress/
|
| 5 |
* Description: Integrates <a href="http://fancyapps.com/fancybox/3/">FancyBox 3</a> into WordPress.
|
| 6 |
+
* Version: 3.3.2
|
| 7 |
* Author: Colorlib
|
| 8 |
* Author URI: https://colorlib.com/wp/
|
| 9 |
* Tested up to: 5.6
|
| 36 |
* Plugin Init
|
| 37 |
*/
|
| 38 |
// Constants
|
| 39 |
+
define( 'FBFW_VERSION', '3.3.2' );
|
| 40 |
define( 'FBFW_PATH', plugin_dir_path( __FILE__ ) );
|
| 41 |
define( 'FBFW_URL', plugin_dir_url( __FILE__ ) );
|
| 42 |
define( 'FBFW_PLUGIN_BASE', plugin_basename( __FILE__ ) );
|
| 269 |
|
| 270 |
$mfbfw['customExpression'] = str_replace( '"rel"', '"data-fancybox"', $mfbfw['customExpression'] );
|
| 271 |
|
| 272 |
+
$close_button = (isset($mfbfw['showCloseButton']) && 'on' == $mfbfw['showCloseButton'] ) ? 'body.fancybox-active .fancybox-container .fancybox-stage .fancybox-content .fancybox-close-small{display:block;}' : '';
|
| 273 |
+
|
| 274 |
//title position settings
|
| 275 |
if ( isset( $mfbfw['titlePosition'] ) ) {
|
| 276 |
if ( $mfbfw['titlePosition'] == 'inside' ) {
|
| 303 |
' . ( isset( $mfbfw['titleShow'] ) ? 'div.fancybox-caption p.caption-title{display:inline-block}' : 'div.fancybox-custom-caption p.caption-title{display:none}div.fancybox-caption{display:none;}' ) . '
|
| 304 |
' . ( isset( $mfbfw['titleSize'] ) ? 'div.fancybox-caption p.caption-title{font-size:' . $mfbfw['titleSize'] . 'px}' : 'div.fancybox-caption p.caption-title{font-size:14px}' ) . '
|
| 305 |
' . ( isset( $mfbfw['titleColor'] ) && $mfbfw['titlePosition'] == 'inside' ? 'div.fancybox-caption p.caption-title{color:' . $mfbfw['titleColor'] . '}' : 'div.fancybox-caption p.caption-title{color:#fff}' ) . '
|
| 306 |
+
' . ( isset( $mfbfw['titlePosition'] ) ? 'div.fancybox-caption {color:' . $mfbfw['titleColor'] . '}' : 'div.fancybox-caption p.caption-title{color:#333333}' ) . $captionPosition .$close_button.'
|
| 307 |
</style>';
|
| 308 |
?>
|
| 309 |
<script type="text/javascript">
|
readme.txt
CHANGED
|
@@ -2,8 +2,8 @@
|
|
| 2 |
Contributors: silkalns
|
| 3 |
Tags: fancybox, lightbox, jquery, gallery, image, images, photo, photos, picture, pictures, zoom
|
| 4 |
Requires at least: 4.6
|
| 5 |
-
Tested up to: 5.
|
| 6 |
-
Stable tag: 3.3.
|
| 7 |
License: GPLv3 or later
|
| 8 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
| 9 |
|
|
@@ -30,7 +30,11 @@ If you are new to WordPress and want to lear more we have got you covered. Color
|
|
| 30 |
If you enjoy using FancyBox lightbox for WordPress please leave a [positive feedback](https://wordpress.org/support/plugin/fancybox-for-wordpress/reviews/?filter=5). We are committed to make it the best lightbox plugin for WordPress.
|
| 31 |
|
| 32 |
== Changelog ==
|
| 33 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
Compatibility with jQuery 3.0
|
| 35 |
|
| 36 |
= 3.3.0 =
|
| 2 |
Contributors: silkalns
|
| 3 |
Tags: fancybox, lightbox, jquery, gallery, image, images, photo, photos, picture, pictures, zoom
|
| 4 |
Requires at least: 4.6
|
| 5 |
+
Tested up to: 5.7
|
| 6 |
+
Stable tag: 3.3.2
|
| 7 |
License: GPLv3 or later
|
| 8 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
| 9 |
|
| 30 |
If you enjoy using FancyBox lightbox for WordPress please leave a [positive feedback](https://wordpress.org/support/plugin/fancybox-for-wordpress/reviews/?filter=5). We are committed to make it the best lightbox plugin for WordPress.
|
| 31 |
|
| 32 |
== Changelog ==
|
| 33 |
+
- 3.3.2 - 05.03.2021 =
|
| 34 |
+
Changed: Upgrade Fancybox to latest version ( https://github.com/ColorlibHQ/fancybox-for-wordpress/issues/95 )
|
| 35 |
+
Fixed: Close button not showing up although option is enabled
|
| 36 |
+
|
| 37 |
+
= 3.3.1 =
|
| 38 |
Compatibility with jQuery 3.0
|
| 39 |
|
| 40 |
= 3.3.0 =
|
