@fancyapps/fancybox
Advanced tools
Comparing version 3.4.0 to 3.4.1
{ | ||
"name": "@fancyapps/fancybox", | ||
"description": "Touch enabled, responsive and fully customizable jQuery lightbox script", | ||
"version": "3.4.0", | ||
"version": "3.4.1", | ||
"homepage": "https://fancyapps.com/fancybox/3/", | ||
"main": "./dist/jquery.fancybox.js", | ||
"main": "dist/jquery.fancybox.js", | ||
"style": "dist/jquery.fancybox.css", | ||
"author": "fancyApps", | ||
@@ -8,0 +9,0 @@ "license": "GPL-3.0", |
@@ -44,3 +44,3 @@ # fancyBox | ||
[Read more about fancyBox license](http://fancyapps.com/fancybox/#license). | ||
[Read more about fancyBox license](http://fancyapps.com/fancybox/3/#license). | ||
@@ -47,0 +47,0 @@ ## Bugs and feature requests |
@@ -60,50 +60,68 @@ // ========================================================================== | ||
// If browser does not have Full Screen API, then simply unset default button template and stop | ||
if (!fn) { | ||
if ($ && $.fancybox) { | ||
$.fancybox.defaults.btnTpl.fullScreen = false; | ||
} | ||
if (fn) { | ||
var FullScreen = { | ||
request: function(elem) { | ||
elem = elem || document.documentElement; | ||
return; | ||
} | ||
elem[fn.requestFullscreen](elem.ALLOW_KEYBOARD_INPUT); | ||
}, | ||
exit: function() { | ||
document[fn.exitFullscreen](); | ||
}, | ||
toggle: function(elem) { | ||
elem = elem || document.documentElement; | ||
var FullScreen = { | ||
request: function(elem) { | ||
elem = elem || document.documentElement; | ||
if (this.isFullscreen()) { | ||
this.exit(); | ||
} else { | ||
this.request(elem); | ||
} | ||
}, | ||
isFullscreen: function() { | ||
return Boolean(document[fn.fullscreenElement]); | ||
}, | ||
enabled: function() { | ||
return Boolean(document[fn.fullscreenEnabled]); | ||
} | ||
}; | ||
elem[fn.requestFullscreen](elem.ALLOW_KEYBOARD_INPUT); | ||
}, | ||
exit: function() { | ||
document[fn.exitFullscreen](); | ||
}, | ||
toggle: function(elem) { | ||
elem = elem || document.documentElement; | ||
$.extend(true, $.fancybox.defaults, { | ||
btnTpl: { | ||
fullScreen: | ||
'<button data-fancybox-fullscreen class="fancybox-button fancybox-button--fsenter" title="{{FULL_SCREEN}}">' + | ||
'<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>' + | ||
'<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>' + | ||
"</button>" | ||
}, | ||
fullScreen: { | ||
autoStart: false | ||
} | ||
}); | ||
if (this.isFullscreen()) { | ||
this.exit(); | ||
} else { | ||
this.request(elem); | ||
$(document).on(fn.fullscreenchange, function() { | ||
var isFullscreen = FullScreen.isFullscreen(), | ||
instance = $.fancybox.getInstance(); | ||
if (instance) { | ||
// If image is zooming, then force to stop and reposition properly | ||
if (instance.current && instance.current.type === "image" && instance.isAnimating) { | ||
instance.current.$content.css("transition", "none"); | ||
instance.isAnimating = false; | ||
instance.update(true, true, 0); | ||
} | ||
instance.trigger("onFullscreenChange", isFullscreen); | ||
instance.$refs.container.toggleClass("fancybox-is-fullscreen", isFullscreen); | ||
instance.$refs.toolbar | ||
.find("[data-fancybox-fullscreen]") | ||
.toggleClass("fancybox-button--fsenter", !isFullscreen) | ||
.toggleClass("fancybox-button--fsexit", isFullscreen); | ||
} | ||
}, | ||
isFullscreen: function() { | ||
return Boolean(document[fn.fullscreenElement]); | ||
}, | ||
enabled: function() { | ||
return Boolean(document[fn.fullscreenEnabled]); | ||
} | ||
}; | ||
}); | ||
} | ||
$.extend(true, $.fancybox.defaults, { | ||
btnTpl: { | ||
fullScreen: | ||
'<button data-fancybox-fullscreen class="fancybox-button fancybox-button--fsenter" title="{{FULL_SCREEN}}">' + | ||
'<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>' + | ||
'<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>' + | ||
"</button>" | ||
}, | ||
fullScreen: { | ||
autoStart: false | ||
} | ||
}); | ||
$(document).on({ | ||
@@ -113,2 +131,8 @@ "onInit.fb": function(e, instance) { | ||
if (!fn) { | ||
instance.$refs.toolbar.find("[data-fancybox-fullscreen]").remove(); | ||
return; | ||
} | ||
if (instance && instance.group[instance.currIndex].opts.fullScreen) { | ||
@@ -150,27 +174,2 @@ $container = instance.$refs.container; | ||
}); | ||
$(document).on(fn.fullscreenchange, function() { | ||
var isFullscreen = FullScreen.isFullscreen(), | ||
instance = $.fancybox.getInstance(); | ||
if (instance) { | ||
// If image is zooming, then force to stop and reposition properly | ||
if (instance.current && instance.current.type === "image" && instance.isAnimating) { | ||
instance.current.$content.css("transition", "none"); | ||
instance.isAnimating = false; | ||
instance.update(true, true, 0); | ||
} | ||
instance.trigger("onFullscreenChange", isFullscreen); | ||
instance.$refs.container.toggleClass("fancybox-is-fullscreen", isFullscreen); | ||
instance.$refs.toolbar | ||
.find("[data-fancybox-fullscreen]") | ||
.toggleClass("fancybox-button--fsenter", !isFullscreen) | ||
.toggleClass("fancybox-button--fsexit", isFullscreen); | ||
} | ||
}); | ||
})(document, window.jQuery || jQuery); | ||
})(document, jQuery); |
@@ -894,2 +894,2 @@ // ========================================================================== | ||
}); | ||
})(window, document, window.jQuery || jQuery); | ||
})(window, document, jQuery); |
@@ -7,3 +7,3 @@ // ========================================================================== | ||
// ========================================================================== | ||
(function(document, window, $) { | ||
(function(window, document, $) { | ||
"use strict"; | ||
@@ -52,6 +52,7 @@ | ||
if (url.gallery !== "") { | ||
// If we can find element matching 'data-fancybox' atribute, then trigger click event for that. | ||
// It should start fancyBox | ||
// If we can find element matching 'data-fancybox' atribute, | ||
// then triggering click event should start fancyBox | ||
$("[data-fancybox='" + $.escapeSelector(url.gallery) + "']") | ||
.eq(url.index - 1) | ||
.focus() | ||
.trigger("click.fb-start"); | ||
@@ -123,3 +124,3 @@ } | ||
if (!instance.origHash) { | ||
if (firstRun && !instance.origHash) { | ||
instance.origHash = window.location.hash; | ||
@@ -213,2 +214,2 @@ } | ||
}); | ||
})(document, window, window.jQuery || jQuery); | ||
})(window, document, jQuery); |
@@ -201,2 +201,2 @@ // ========================================================================== | ||
}); | ||
})(window.jQuery || jQuery); | ||
})(jQuery); |
@@ -106,2 +106,2 @@ //// ========================================================================== | ||
}); | ||
})(document, window.jQuery || jQuery); | ||
})(document, jQuery); |
@@ -50,19 +50,30 @@ // ========================================================================== | ||
set: function(force) { | ||
var self = this; | ||
var self = this, | ||
instance = self.instance, | ||
current = instance.current, | ||
advance = function() { | ||
if (self.isActive) { | ||
instance.jumpTo((instance.currIndex + 1) % instance.group.length); | ||
} | ||
}; | ||
// Check if reached last element | ||
if ( | ||
self.instance && | ||
self.instance.current && | ||
(force === true || self.instance.current.opts.loop || self.instance.currIndex < self.instance.group.length - 1) | ||
) { | ||
if (current && (force === true || current.opts.loop || instance.currIndex < instance.group.length - 1)) { | ||
self.timer = setTimeout(function() { | ||
var $video; | ||
if (self.isActive) { | ||
self.instance.jumpTo((self.instance.currIndex + 1) % self.instance.group.length); | ||
$video = current.$slide.find("video,audio").filter(":visible:first"); | ||
if ($video.length) { | ||
$video.one("ended", advance); | ||
} else { | ||
advance(); | ||
} | ||
} | ||
}, self.instance.current.opts.slideShow.speed); | ||
}, current.opts.slideShow.speed); | ||
} else { | ||
self.stop(); | ||
self.instance.idleSecondsCounter = 0; | ||
self.instance.showControls(); | ||
instance.idleSecondsCounter = 0; | ||
instance.showControls(); | ||
} | ||
@@ -186,2 +197,2 @@ }, | ||
}); | ||
})(document, window.jQuery || jQuery); | ||
})(document, jQuery); |
@@ -254,2 +254,2 @@ // ========================================================================== | ||
}); | ||
})(document, window.jQuery || jQuery); | ||
})(document, jQuery); |
@@ -41,2 +41,2 @@ // ========================================================================== | ||
}); | ||
})(document, window.jQuery || jQuery); | ||
})(document, jQuery); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
502474
10088