Comparing version 1.7.2 to 1.8.0
{ | ||
"name": "venobox", | ||
"version": "1.7.2", | ||
"name": "VenoBox", | ||
"version": "1.8.0", | ||
"authors": [ | ||
@@ -5,0 +5,0 @@ "Nicola Franchini" |
{ | ||
"name": "nicolafranchini/venobox", | ||
"description": "Responsive jQuery modal window plugin", | ||
"version": "1.7.2", | ||
"version": "1.8.0", | ||
"keywords": [ | ||
@@ -11,3 +11,2 @@ "lightbox", | ||
"jquery-plugin", | ||
"ecosystem:jquery", | ||
"jQuery" | ||
@@ -14,0 +13,0 @@ ], |
{ | ||
"name": "venobox", | ||
"version": "1.7.2", | ||
"version": "1.8.0", | ||
"description": "Responsive jQuery modal window plugin", | ||
@@ -5,0 +5,0 @@ "main": "venobox/venobox.min.js", |
@@ -16,5 +16,5 @@ # VenoBox | ||
This package can be installed with: | ||
- [npm](https://www.npmjs.com/package/venobox): `npm install venobox` | ||
- [bower](https://bower.io/search/?q=venobox): `bower install venobox` | ||
- [composer](https://packagist.org/packages/nicolafranchini/venobox): `composer require nicolafranchini/venobox` | ||
@@ -30,20 +30,12 @@ Or download the [latest release](https://github.com/nicolafranchini/VenoBox/releases). | ||
```html | ||
<link rel="stylesheet" href="/node_modules/venobox/venobox/venobox.css" /> | ||
<link rel="stylesheet" href="/venobox/venobox.css" /> | ||
``` | ||
```html | ||
<link rel="stylesheet" href="/bower_components/venobox/venobox/venobox.css" /> | ||
``` | ||
Put the script at the [bottom](https://developer.yahoo.com/performance/rules.html#js_bottom) of your markup right after jQuery: | ||
```html | ||
<script src="/node_modules/jquery/dist/jquery.js"></script> | ||
<script src="/node_modules/venobox/venobox/venobox.min.js"></script> | ||
<script src="/jquery/dist/jquery.js"></script> | ||
<script src="/venobox/venobox.min.js"></script> | ||
``` | ||
```html | ||
<script src="/bower_components/jquery/dist/jquery.js"></script> | ||
<script src="/bower_components/venobox/venobox/venobox.min.js"></script> | ||
``` | ||
### Usage | ||
@@ -50,0 +42,0 @@ |
/* | ||
* VenoBox - jQuery Plugin | ||
* version: 1.7.2 | ||
* version: 1.8.0 | ||
* @requires jQuery >= 1.7.0 | ||
@@ -17,6 +17,5 @@ * | ||
infinigall, items, keyNavigationDisabled, margine, numeratio, overlayColor, overlay, | ||
prima, title, thisgall, thenext, theprev, type, finH, sonH, nextok, prevok, preloader, | ||
prima, title, thisgall, thenext, theprev, type, nextok, prevok, preloader, | ||
navigation, spinner, titlePosition, titleColor, titleBackground, closeColor, closeBackground, | ||
numerationPosition, numerationColor, numerationBackground, | ||
pre_open_callback, post_open_callback, pre_close_callback, post_close_callback, post_resize_callback; | ||
numerationPosition, numerationColor, numerationBackground, obj, gallIndex; | ||
@@ -26,4 +25,4 @@ $.fn.extend({ | ||
venobox: function(options) { | ||
// default option | ||
var plugin = this; | ||
// default options | ||
var defaults = { | ||
@@ -39,2 +38,5 @@ arrowsColor : '#B6B6B6', | ||
infinigall: false, | ||
htmlClose : '×', | ||
htmlNext : '<span>Next</span>', | ||
htmlPrev : '<span>Prev</span>', | ||
numeratio: false, | ||
@@ -52,7 +54,9 @@ numerationBackground : '#161617', | ||
titlePosition : 'top', // 'top' || 'bottom' | ||
pre_open_callback: function(){ return true; }, // Callbacks - thanx @garyee | ||
post_open_callback: function(){}, | ||
pre_close_callback: function(){ return true; }, | ||
post_close_callback: function(){}, | ||
post_resize_callback: function(){} | ||
cb_pre_open: function(){ return true; }, // Callbacks - thanx @garyee | ||
cb_post_open: function(){}, | ||
cb_pre_close: function(){ return true; }, | ||
cb_post_close: function(){}, | ||
cb_post_resize: function(){}, | ||
cb_after_nav: function(){}, | ||
cb_init: function(){} | ||
}; | ||
@@ -62,10 +66,17 @@ | ||
// callback plugin initialization | ||
option.cb_init(plugin); | ||
return this.each(function() { | ||
var obj = $(this); | ||
obj = $(this); | ||
// Prevent double initialization - thanx @matthistuff | ||
if(obj.data('venobox')) { | ||
if (obj.data('venobox')) { | ||
return true; | ||
} | ||
// method to be used outside the plugin | ||
plugin.VBclose = function() { | ||
closeVbox(); | ||
} | ||
obj.addClass('vbox-item'); | ||
@@ -81,18 +92,24 @@ obj.data('framewidth', option.framewidth); | ||
post_open_callback = option.post_open_callback; | ||
post_resize_callback = option.post_resize_callback; | ||
obj.data('venobox', true); | ||
obj.on('click', function(e){ | ||
// e.stopPropagation(); | ||
e.preventDefault(); | ||
obj = $(this); | ||
var rtn = option.pre_open_callback(obj); | ||
if (rtn != undefined && !rtn) { | ||
return; | ||
// callback plugin initialization | ||
var cb_pre_open = option.cb_pre_open(obj); | ||
if (cb_pre_open === false) { | ||
return false; | ||
} | ||
// methods to be used outside the plugin | ||
plugin.VBnext = function() { | ||
navigateGall(thenext); | ||
} | ||
plugin.VBprev = function() { | ||
navigateGall(theprev); | ||
} | ||
overlayColor = obj.data('overlay') || obj.data('overlaycolor'); | ||
@@ -110,3 +127,3 @@ | ||
// set a different url to be loaded via ajax using data-href="" - thanx @pixeline | ||
// set a different url to be loaded using data-href="" - thanx @pixeline | ||
dest = obj.data('href') || obj.attr('href'); | ||
@@ -116,4 +133,2 @@ extraCss = obj.data( 'css' ) || ''; | ||
$('body').addClass('vbox-open'); | ||
preloader = '<div class="vbox-preloader">'; | ||
@@ -123,58 +138,58 @@ | ||
case 'rotating-plane': | ||
preloader += '<div class="sk-rotating-plane"></div>'; | ||
break; | ||
case 'double-bounce': | ||
preloader += '<div class="sk-double-bounce">' | ||
+ '<div class="sk-child sk-double-bounce1"></div>' | ||
+ '<div class="sk-child sk-double-bounce2"></div>' | ||
+ '</div>'; | ||
break; | ||
case 'wave': | ||
preloader += '<div class="sk-wave">' | ||
+ '<div class="sk-rect sk-rect1"></div>' | ||
+ '<div class="sk-rect sk-rect2"></div>' | ||
+ '<div class="sk-rect sk-rect3"></div>' | ||
+ '<div class="sk-rect sk-rect4"></div>' | ||
+ '<div class="sk-rect sk-rect5"></div>' | ||
+ '</div>'; | ||
break; | ||
case 'wandering-cubes': | ||
preloader += '<div class="sk-wandering-cubes">' | ||
+ '<div class="sk-cube sk-cube1"></div>' | ||
+ '<div class="sk-cube sk-cube2"></div>' | ||
+ '</div>'; | ||
break; | ||
case 'spinner-pulse': | ||
preloader += '<div class="sk-spinner sk-spinner-pulse"></div>'; | ||
break; | ||
case 'three-bounce': | ||
preloader += '<div class="sk-three-bounce">' | ||
+ '<div class="sk-child sk-bounce1"></div>' | ||
+ '<div class="sk-child sk-bounce2"></div>' | ||
+ '<div class="sk-child sk-bounce3"></div>' | ||
+ '</div>'; | ||
break; | ||
case 'cube-grid': | ||
preloader += '<div class="sk-cube-grid">' | ||
+ '<div class="sk-cube sk-cube1"></div>' | ||
+ '<div class="sk-cube sk-cube2"></div>' | ||
+ '<div class="sk-cube sk-cube3"></div>' | ||
+ '<div class="sk-cube sk-cube4"></div>' | ||
+ '<div class="sk-cube sk-cube5"></div>' | ||
+ '<div class="sk-cube sk-cube6"></div>' | ||
+ '<div class="sk-cube sk-cube7"></div>' | ||
+ '<div class="sk-cube sk-cube8"></div>' | ||
+ '<div class="sk-cube sk-cube9"></div>' | ||
+ '</div>'; | ||
break; | ||
case 'rotating-plane': | ||
preloader += '<div class="sk-rotating-plane"></div>'; | ||
break; | ||
case 'double-bounce': | ||
preloader += '<div class="sk-double-bounce">' | ||
+ '<div class="sk-child sk-double-bounce1"></div>' | ||
+ '<div class="sk-child sk-double-bounce2"></div>' | ||
+ '</div>'; | ||
break; | ||
case 'wave': | ||
preloader += '<div class="sk-wave">' | ||
+ '<div class="sk-rect sk-rect1"></div>' | ||
+ '<div class="sk-rect sk-rect2"></div>' | ||
+ '<div class="sk-rect sk-rect3"></div>' | ||
+ '<div class="sk-rect sk-rect4"></div>' | ||
+ '<div class="sk-rect sk-rect5"></div>' | ||
+ '</div>'; | ||
break; | ||
case 'wandering-cubes': | ||
preloader += '<div class="sk-wandering-cubes">' | ||
+ '<div class="sk-cube sk-cube1"></div>' | ||
+ '<div class="sk-cube sk-cube2"></div>' | ||
+ '</div>'; | ||
break; | ||
case 'spinner-pulse': | ||
preloader += '<div class="sk-spinner sk-spinner-pulse"></div>'; | ||
break; | ||
case 'three-bounce': | ||
preloader += '<div class="sk-three-bounce">' | ||
+ '<div class="sk-child sk-bounce1"></div>' | ||
+ '<div class="sk-child sk-bounce2"></div>' | ||
+ '<div class="sk-child sk-bounce3"></div>' | ||
+ '</div>'; | ||
break; | ||
case 'cube-grid': | ||
preloader += '<div class="sk-cube-grid">' | ||
+ '<div class="sk-cube sk-cube1"></div>' | ||
+ '<div class="sk-cube sk-cube2"></div>' | ||
+ '<div class="sk-cube sk-cube3"></div>' | ||
+ '<div class="sk-cube sk-cube4"></div>' | ||
+ '<div class="sk-cube sk-cube5"></div>' | ||
+ '<div class="sk-cube sk-cube6"></div>' | ||
+ '<div class="sk-cube sk-cube7"></div>' | ||
+ '<div class="sk-cube sk-cube8"></div>' | ||
+ '<div class="sk-cube sk-cube9"></div>' | ||
+ '</div>'; | ||
break; | ||
} | ||
preloader += '</div>'; | ||
navigation = '<a class="vbox-next"><span>next</span></a><a class="vbox-prev"><span>prev</span></a>'; | ||
vbheader = '<div class="vbox-title"></div><div class="vbox-num">0/0</div><div class="vbox-close">×</div>'; | ||
navigation = '<a class="vbox-next">' + option.htmlNext + '</a><a class="vbox-prev">' + option.htmlPrev + '</a>'; | ||
vbheader = '<div class="vbox-title"></div><div class="vbox-num">0/0</div><div class="vbox-close">' + option.htmlClose + '</div>'; | ||
core = '<div class="vbox-overlay ' + extraCss + '" style="background:'+ overlayColor +'">' | ||
+ preloader + '<div class="vbox-container"><div class="vbox-content"></div></div>' + vbheader + navigation + '</div>'; | ||
$('body').append(core); | ||
$('body').append('<div class="ghostoverlay"></div>').append(core).addClass('vbox-open'); | ||
@@ -211,3 +226,2 @@ $('.vbox-preloader .sk-child, .vbox-preloader .sk-rotating-plane, .vbox-preloader .sk-rect, .vbox-preloader .sk-cube, .vbox-preloader .sk-spinner-pulse').css('background-color', option.spinColor); | ||
content.html(''); | ||
@@ -221,12 +235,10 @@ content.css('opacity', '0'); | ||
if(obj.data('vbtype') == 'iframe'){ | ||
if (obj.data('vbtype') == 'iframe') { | ||
loadIframe(); | ||
}else if (obj.data('vbtype') == 'inline'){ | ||
} else if (obj.data('vbtype') == 'inline') { | ||
loadInline(); | ||
}else if (obj.data('vbtype') == 'ajax'){ | ||
} else if (obj.data('vbtype') == 'ajax') { | ||
loadAjax(); | ||
}else if (obj.data('vbtype') == 'vimeo'){ | ||
loadVid(autoplay, 'vimeo'); | ||
}else if (obj.data('vbtype') == 'youtube'){ | ||
loadVid(autoplay, 'youtube'); | ||
} else if (obj.data('vbtype') == 'video' || obj.data('vbtype') == 'vimeo' || obj.data('vbtype') == 'youtube') { | ||
loadVid(autoplay); | ||
} else { | ||
@@ -236,336 +248,471 @@ content.html('<img src="'+dest+'">'); | ||
} | ||
option.cb_post_open(obj, gallIndex, thenext, theprev) | ||
}); | ||
/* -------- CHECK NEXT / PREV -------- */ | ||
function checknav(){ | ||
thisgall = obj.data('vbgall'); | ||
numeratio = obj.data('numeratio'); | ||
infinigall = obj.data('infinigall'); | ||
/* -------- KEYBOARD ACTIONS -------- */ | ||
$('body').keydown(keyboardHandler); | ||
items = $('.vbox-item[data-vbgall="' + thisgall + '"]'); | ||
/* -------- PREVGALL -------- */ | ||
$('.vbox-prev').on('click', function(){ | ||
navigateGall(theprev); | ||
if (items.length > 1 && numeratio === true) { | ||
blocknum.html(items.index(obj)+1 + ' / ' + items.length); | ||
blocknum.show(); | ||
} else { | ||
blocknum.hide(); | ||
} | ||
}); | ||
/* -------- NEXTGALL -------- */ | ||
$('.vbox-next').on('click', function(){ | ||
navigateGall(thenext); | ||
}); | ||
return false; | ||
thenext = items.eq( items.index(obj) + 1 ); | ||
theprev = items.eq( items.index(obj) - 1 ); | ||
}); // click | ||
if (title !== '') { | ||
blocktitle.show(); | ||
} else { | ||
blocktitle.hide(); | ||
} | ||
/* -------- CHECK NEXT / PREV -------- */ | ||
function checknav(){ | ||
if (items.length > 1 && infinigall === true) { | ||
thisgall = obj.data('gall'); | ||
numeratio = obj.data('numeratio'); | ||
infinigall = obj.data('infinigall'); | ||
nextok = true; | ||
prevok = true; | ||
items = $('.vbox-item[data-gall="' + thisgall + '"]'); | ||
if(thenext.length < 1 ){ | ||
thenext = items.eq(0); | ||
} | ||
if(items.index(obj) < 1 ){ | ||
theprev = items.eq( items.index(items.length) ); | ||
} | ||
thenext = items.eq( items.index(obj) + 1 ); | ||
theprev = items.eq( items.index(obj) - 1 ); | ||
} else { | ||
// update gall numeration | ||
if (items.length > 1) { | ||
gallIndex = items.index(obj)+1; | ||
blocknum.html(gallIndex + ' / ' + items.length); | ||
} else { | ||
gallIndex = 1; | ||
} | ||
if (numeratio === true) { | ||
blocknum.show(); | ||
} else { | ||
blocknum.hide(); | ||
} | ||
if(thenext.length > 0 ){ | ||
$('.vbox-next').css('display', 'block'); | ||
nextok = true; | ||
}else{ | ||
$('.vbox-next').css('display', 'none'); | ||
nextok = false; | ||
} | ||
if(items.index(obj) > 0 ){ | ||
$('.vbox-prev').css('display', 'block'); | ||
prevok = true; | ||
}else{ | ||
$('.vbox-prev').css('display', 'none'); | ||
prevok = false; | ||
} | ||
} | ||
// update title | ||
if (title !== '') { | ||
blocktitle.show(); | ||
} else { | ||
blocktitle.hide(); | ||
} | ||
/* -------- NAVIGATION CODE -------- */ | ||
var gallnav = { | ||
prev: function() { | ||
if (keyNavigationDisabled) { | ||
return; | ||
} else { | ||
keyNavigationDisabled = true; | ||
} | ||
// update navigation arrows | ||
if (!thenext.length && infinigall !== true) { | ||
$('.vbox-next').css('display', 'none'); | ||
nextok = false; | ||
} else { | ||
$('.vbox-next').css('display', 'block'); | ||
nextok = true; | ||
} | ||
overlayColor = theprev.data('overlay') || theprev.data('overlaycolor'); | ||
if (items.index(obj) > 0 || infinigall === true) { | ||
$('.vbox-prev').css('display', 'block'); | ||
prevok = true; | ||
} else { | ||
$('.vbox-prev').css('display', 'none'); | ||
prevok = false; | ||
} | ||
// activate swipe | ||
if (prevok === true || nextok === true) { | ||
content.on(TouchMouseEvent.DOWN, onDownEvent); | ||
content.on(TouchMouseEvent.MOVE, onMoveEvent); | ||
content.on(TouchMouseEvent.UP, onUpEvent); | ||
} | ||
framewidth = theprev.data('framewidth'); | ||
frameheight = theprev.data('frameheight'); | ||
border = theprev.data('border'); | ||
bgcolor = theprev.data('bgcolor'); | ||
dest = theprev.data('href') || theprev.attr('href'); | ||
} | ||
autoplay = theprev.data('autoplay'); | ||
/* -------- gallery navigation -------- */ | ||
function navigateGall(destination) { | ||
title = theprev.attr(theprev.data('titleattr')) || ''; | ||
if (destination.length < 1) { | ||
return false; | ||
} | ||
if (keyNavigationDisabled) { | ||
return false; | ||
} else { | ||
keyNavigationDisabled = true; | ||
} | ||
content.animate({ opacity:0}, 500, function(){ | ||
overlay.css('background',overlayColor); | ||
overlayColor = destination.data('overlay') || destination.data('overlaycolor'); | ||
if (theprev.data('vbtype') == 'iframe') { | ||
loadIframe(); | ||
} else if (theprev.data('vbtype') == 'inline'){ | ||
loadInline(); | ||
} else if (theprev.data('vbtype') == 'ajax'){ | ||
loadAjax(); | ||
} else if (theprev.data('vbtype') == 'youtube'){ | ||
loadVid(autoplay, 'youtube'); | ||
} else if (theprev.data('vbtype') == 'vimeo'){ | ||
loadVid(autoplay, 'vimeo'); | ||
}else{ | ||
content.html('<img src="'+dest+'">'); | ||
preloadFirst(); | ||
} | ||
obj = theprev; | ||
checknav(); | ||
keyNavigationDisabled = false; | ||
}); | ||
framewidth = destination.data('framewidth'); | ||
frameheight = destination.data('frameheight'); | ||
border = destination.data('border'); | ||
bgcolor = destination.data('bgcolor'); | ||
dest = destination.data('href') || destination.attr('href'); | ||
}, | ||
autoplay = destination.data('autoplay'); | ||
next: function() { | ||
title = destination.attr(destination.data('titleattr')) || ''; | ||
// swipe out item | ||
if (destination === theprev) { | ||
content.addClass('animated').addClass('swipe-right') | ||
} | ||
if (destination === thenext) { | ||
content.addClass('animated').addClass('swipe-left') | ||
} | ||
content.animate({ | ||
opacity : 0, | ||
}, 500, function(){ | ||
if (keyNavigationDisabled) { | ||
return; | ||
overlay.css('background',overlayColor); | ||
content | ||
.removeClass('animated') | ||
.removeClass('swipe-left') | ||
.removeClass('swipe-right') | ||
.css({'margin-left': 0,'margin-right': 0}); | ||
if (destination.data('vbtype') == 'iframe') { | ||
loadIframe(); | ||
} else if (destination.data('vbtype') == 'inline') { | ||
loadInline(); | ||
} else if (destination.data('vbtype') == 'ajax') { | ||
loadAjax(); | ||
} else if (destination.data('vbtype') == 'video' | ||
|| destination.data('vbtype') == 'vimeo' | ||
|| destination.data('vbtype') == 'youtube' | ||
) { | ||
loadVid(autoplay); | ||
} else { | ||
keyNavigationDisabled = true; | ||
content.html('<img src="'+dest+'">'); | ||
preloadFirst(); | ||
} | ||
obj = destination; | ||
checknav(); | ||
keyNavigationDisabled = false; | ||
option.cb_after_nav(obj, gallIndex, thenext, theprev); | ||
}); | ||
} | ||
overlayColor = thenext.data('overlay') || thenext.data('overlaycolor'); | ||
/* -------- KEYBOARD HANDLER -------- */ | ||
function keyboardHandler(e) { | ||
if (e.keyCode === 27) { // esc | ||
closeVbox(); | ||
} | ||
framewidth = thenext.data('framewidth'); | ||
frameheight = thenext.data('frameheight'); | ||
border = thenext.data('border'); | ||
bgcolor = thenext.data('bgcolor'); | ||
dest = thenext.data('href') || thenext.attr('href'); | ||
autoplay = thenext.data('autoplay'); | ||
if (e.keyCode == 37 && prevok === true) { // left | ||
navigateGall(theprev); | ||
} | ||
title = thenext.attr(thenext.data('titleattr')) || ''; | ||
if (e.keyCode == 39 && nextok === true) { // right | ||
navigateGall(thenext); | ||
} | ||
} | ||
content.animate({ opacity:0}, 500, function(){ | ||
overlay.css('background', overlayColor); | ||
/* -------- CLOSE VBOX -------- */ | ||
function closeVbox(){ | ||
var cb_pre_close = option.cb_pre_close(obj, gallIndex, thenext, theprev); | ||
if (thenext.data('vbtype') == 'iframe') { | ||
loadIframe(); | ||
} else if (thenext.data('vbtype') == 'inline'){ | ||
loadInline(); | ||
} else if (thenext.data('vbtype') == 'ajax'){ | ||
loadAjax(); | ||
} else if (thenext.data('vbtype') == 'youtube'){ | ||
loadVid(autoplay, 'youtube'); | ||
} else if (thenext.data('vbtype') == 'vimeo'){ | ||
loadVid(autoplay, 'vimeo'); | ||
}else{ | ||
content.html('<img src="'+dest+'">'); | ||
preloadFirst(); | ||
} | ||
obj = thenext; | ||
checknav(); | ||
keyNavigationDisabled = false; | ||
}); | ||
} | ||
}; | ||
if (cb_pre_close === false) { | ||
return false; | ||
} | ||
/* -------- NAVIGATE WITH ARROW KEYS -------- */ | ||
$('body').keydown(function(e) { | ||
if(e.keyCode == 37 && prevok == true) { // left | ||
gallnav.prev(); | ||
} | ||
if(e.keyCode == 39 && nextok == true) { // right | ||
gallnav.next(); | ||
} | ||
$('body').off('keydown', keyboardHandler).removeClass('vbox-open');; | ||
obj.focus(); | ||
overlay.animate({opacity:0}, 500, function(){ | ||
overlay.remove(); | ||
keyNavigationDisabled = false; | ||
option.cb_post_close(); | ||
}); | ||
} | ||
/* -------- PREVGALL -------- */ | ||
$('.vbox-prev').click(function(){ | ||
gallnav.prev(); | ||
}); | ||
/* -------- NEXTGALL -------- */ | ||
$('.vbox-next').click(function(){ | ||
gallnav.next(); | ||
}); | ||
/* -------- ESCAPE HANDLER -------- */ | ||
function escapeHandler(e) { | ||
if(e.keyCode === 27) { | ||
closeVbox(); | ||
} | ||
/* -------- CLOSE CLICK -------- */ | ||
var closeclickclass = '.vbox-overlay'; | ||
if(!option.overlayClose){ | ||
closeclickclass = '.vbox-close'; // close only on X | ||
} | ||
$(document).on('click', closeclickclass, function(e){ | ||
if ($(e.target).is('.vbox-overlay') | ||
|| $(e.target).is('.vbox-content') | ||
|| $(e.target).is('.vbox-close') | ||
|| $(e.target).is('.vbox-preloader') | ||
) { | ||
closeVbox(); | ||
} | ||
}); | ||
/* -------- CLOSE VBOX -------- */ | ||
function closeVbox(){ | ||
var startX = null; | ||
var endX = null; | ||
var rtn = option.pre_close_callback(obj, content, blocknum, blocktitle); | ||
if(rtn!=undefined && !rtn) { | ||
return; | ||
} | ||
var diff = 0; | ||
var threshold = 50; | ||
startouch = false; | ||
$('body').removeClass('vbox-open'); | ||
$('body').off('keydown', escapeHandler); | ||
overlay.animate({opacity:0}, 500, function(){ | ||
overlay.remove(); | ||
keyNavigationDisabled = false; | ||
obj.focus(); | ||
function onDownEvent(e){ | ||
content.addClass('animated'); | ||
startY = e.pageY; | ||
startX = e.pageX; | ||
startouch = true; | ||
} | ||
option.post_close_callback(obj,content,blocknum,blocktitle); | ||
}); | ||
} | ||
function onMoveEvent(e){ | ||
if (startouch === true) { | ||
endX = e.pageX; | ||
endY = e.pageY; | ||
/* -------- CLOSE CLICK -------- */ | ||
var closeclickclass = '.vbox-overlay'; | ||
if(!option.overlayClose){ | ||
closeclickclass = '.vbox-close'; // close only on X | ||
} | ||
diffX = endX - startX; | ||
diffY = endY - startY; | ||
var absdiffX = Math.abs(diffX); | ||
var absdiffY = Math.abs(diffY); | ||
$(closeclickclass).click(function(e){ | ||
if ($(e.target).is('.vbox-overlay') || $(e.target).is('.vbox-content') || $(e.target).is('.vbox-close') || $(e.target).is('.vbox-preloader')) { | ||
closeVbox(); | ||
} | ||
}) | ||
$('body').keydown(escapeHandler); | ||
return false; | ||
if ((absdiffX > absdiffY) && (absdiffX <= 100)) { | ||
e.preventDefault(); | ||
content.css('margin-left', diffX); | ||
} | ||
} | ||
} | ||
function onUpEvent(e){ | ||
if (startouch === true) { | ||
startouch = false; | ||
var dir = 'none'; | ||
var subject = obj; | ||
var change = false; | ||
diff = endX - startX; | ||
if (diff < 0 && nextok === true) { | ||
subject = thenext; | ||
change = true; | ||
} | ||
if (diff > 0 && prevok === true) { | ||
subject = theprev; | ||
change = true; | ||
} | ||
if (Math.abs(diff) >= threshold && change === true) { | ||
navigateGall(subject); | ||
} else { | ||
content.css({'margin-left': 0,'margin-right': 0}); | ||
} | ||
} | ||
} | ||
/* == GLOBAL DECLERATIONS == */ | ||
TouchMouseEvent = { | ||
DOWN: "touchmousedown", | ||
UP: "touchmouseup", | ||
MOVE: "touchmousemove" | ||
} | ||
/* == EVENT LISTENERS == */ | ||
var onMouseEvent = function(event) { | ||
var type; | ||
switch (event.type) { | ||
case "mousedown": type = TouchMouseEvent.DOWN; break; | ||
case "mouseup": type = TouchMouseEvent.UP; break; | ||
case "mouseout": type = TouchMouseEvent.UP; break; | ||
case "mousemove": type = TouchMouseEvent.MOVE; break; | ||
default: | ||
return; | ||
} | ||
var touchMouseEvent = normalizeEvent(type, event, event.pageX, event.pageY); | ||
$(event.target).trigger(touchMouseEvent); | ||
} | ||
var onTouchEvent = function(event) { | ||
var type; | ||
switch (event.type) { | ||
case "touchstart": type = TouchMouseEvent.DOWN; break; | ||
case "touchend": type = TouchMouseEvent.UP; break; | ||
case "touchmove": type = TouchMouseEvent.MOVE; break; | ||
default: | ||
return; | ||
} | ||
var touch = event.originalEvent.touches[0]; | ||
var touchMouseEvent; | ||
if (type == TouchMouseEvent.UP) { | ||
touchMouseEvent = normalizeEvent(type, event, null, null); | ||
} else { | ||
touchMouseEvent = normalizeEvent(type, event, touch.pageX, touch.pageY); | ||
} | ||
$(event.target).trigger(touchMouseEvent); | ||
} | ||
/* == NORMALIZE == */ | ||
var normalizeEvent = function(type, original, x, y) { | ||
return $.Event(type, { | ||
pageX: x, | ||
pageY: y, | ||
originalEvent: original | ||
}); | ||
}); | ||
} | ||
}); | ||
} | ||
/* == LISTEN TO ORIGINAL EVENT == */ | ||
if ("ontouchstart" in window) { | ||
$(document).on("touchstart", onTouchEvent); | ||
$(document).on("touchmove", onTouchEvent); | ||
$(document).on("touchend", onTouchEvent); | ||
} else { | ||
$(document).on("mousedown", onMouseEvent); | ||
$(document).on("mouseup", onMouseEvent); | ||
$(document).on("mouseout", onMouseEvent); | ||
$(document).on("mousemove", onMouseEvent); | ||
} | ||
/* -------- LOAD AJAX -------- */ | ||
function loadAjax(){ | ||
$.ajax({ | ||
url: dest, | ||
cache: false | ||
}).done(function( msg ) { | ||
content.html('<div class="vbox-inline">'+ msg +'</div>'); | ||
preloadFirst(); | ||
/* -------- LOAD AJAX -------- */ | ||
function loadAjax(){ | ||
$.ajax({ | ||
url: dest, | ||
cache: false | ||
}).done(function( msg ) { | ||
content.html('<div class="vbox-inline">'+ msg +'</div>'); | ||
preloadFirst(); | ||
}).fail(function() { | ||
content.html('<div class="vbox-inline"><p>Error retrieving contents, please retry</div>'); | ||
updateoverlay(); | ||
}) | ||
} | ||
}).fail(function() { | ||
content.html('<div class="vbox-inline"><p>Error retrieving contents, please retry</div>'); | ||
updateoverlay(); | ||
}) | ||
} | ||
/* -------- LOAD IFRAME -------- */ | ||
function loadIframe(){ | ||
content.html('<iframe class="venoframe" src="'+dest+'"></iframe>'); | ||
// $('.venoframe').load(function(){ // valid only for iFrames in same domain | ||
updateoverlay(); | ||
// }); | ||
} | ||
/* -------- LOAD IFRAME -------- */ | ||
function loadIframe(){ | ||
content.html('<iframe class="venoframe" src="'+dest+'"></iframe>'); | ||
// $('.venoframe').load(function(){ // valid only for iFrames in same domain | ||
updateoverlay(); | ||
// }); | ||
} | ||
/* -------- LOAD VIDEO -------- */ | ||
function loadVid(autoplay, host){ | ||
/* -------- LOAD VIDEOs -------- */ | ||
function loadVid(autoplay){ | ||
var player, videoid; | ||
var player, videoid; | ||
var videoObj = parseVideo(dest); | ||
// set rel=0 to hide related videos at the end of YT + optional autoplay | ||
var stringAutoplay = autoplay ? "?rel=0&autoplay=1" : "?rel=0"; | ||
// set rel=0 to hide related videos at the end of YT + optional autoplay | ||
var stringAutoplay = autoplay ? "?rel=0&autoplay=1" : "?rel=0"; | ||
var queryvars = stringAutoplay + getUrlParameter(dest); | ||
if (videoObj.type == 'vimeo') { | ||
player = 'https://player.vimeo.com/video/'; | ||
} else if (videoObj.type == 'youtube') { | ||
player = 'https://www.youtube.com/embed/'; | ||
} | ||
content.html('<iframe class="venoframe vbvid" webkitallowfullscreen mozallowfullscreen allowfullscreen frameborder="0" src="'+player+videoObj.id+queryvars+'"></iframe>'); | ||
updateoverlay(); | ||
} | ||
if (host == 'vimeo') { | ||
player = 'https://player.vimeo.com/video/'; | ||
var pezzi = dest.split('/'); | ||
videoid = pezzi[pezzi.length-1]; | ||
} else { | ||
player = 'https://www.youtube.com/embed/'; | ||
videoid = YouTubeGetID(dest); | ||
} | ||
content.html('<iframe class="venoframe vbvid" webkitallowfullscreen mozallowfullscreen allowfullscreen frameborder="0" src="'+player+videoid+stringAutoplay+'"></iframe>'); | ||
updateoverlay(); | ||
} | ||
/** | ||
* parse Youtube or Vimeo videos and get host & ID | ||
*/ | ||
function parseVideo (url) { | ||
url.match(/(http:|https:|)\/\/(player.|www.)?(vimeo\.com|youtu(be\.com|\.be|be\.googleapis\.com))\/(video\/|embed\/|watch\?v=|v\/)?([A-Za-z0-9._%-]*)(\&\S+)?/); | ||
/** | ||
* Get YouTube ID from various YouTube URL | ||
* @author: takien | ||
* @url: https://gist.github.com/takien/4077195 | ||
*/ | ||
function YouTubeGetID(url){ | ||
var ID = ''; | ||
url = url.replace(/(>|<)/gi,'').split(/(vi\/|v=|\/v\/|youtu\.be\/|\/embed\/)/); | ||
if(url[2] !== undefined) { | ||
ID = url[2].split(/[^0-9a-z_\-]/i); | ||
ID = ID[0]; | ||
} | ||
else { | ||
ID = url; | ||
} | ||
return ID; | ||
} | ||
if (RegExp.$3.indexOf('youtu') > -1) { | ||
var type = 'youtube'; | ||
} else if (RegExp.$3.indexOf('vimeo') > -1) { | ||
var type = 'vimeo'; | ||
} | ||
return { | ||
type: type, | ||
id: RegExp.$6 | ||
}; | ||
} | ||
/* -------- LOAD INLINE -------- */ | ||
function loadInline(){ | ||
content.html('<div class="vbox-inline">'+$(dest).html()+'</div>'); | ||
updateoverlay(); | ||
} | ||
/** | ||
* get additional video url parameters | ||
*/ | ||
function getUrlParameter(name) { | ||
var result = ''; | ||
var sPageURL = decodeURIComponent(name); | ||
var firstsplit = sPageURL.split('?'); | ||
/* -------- PRELOAD IMAGE -------- */ | ||
function preloadFirst(){ | ||
images = $('.vbox-content').find('img'); | ||
if (firstsplit[1] !== undefined) { | ||
var sURLVariables = firstsplit[1].split('&'); | ||
var sParameterName; | ||
var i; | ||
for (i = 0; i < sURLVariables.length; i++) { | ||
sParameterName = sURLVariables[i].split('='); | ||
result = result + '&'+ sParameterName[0]+'='+ sParameterName[1]; | ||
} | ||
} | ||
return encodeURI(result); | ||
}; | ||
if (images.length) { | ||
images.each(function(){ | ||
$(this).one('load', function() { | ||
updateoverlay(); | ||
}); | ||
}); | ||
} else { | ||
updateoverlay(); | ||
} | ||
} | ||
/* -------- LOAD INLINE -------- */ | ||
function loadInline(){ | ||
content.html('<div class="vbox-inline">'+$(dest).html()+'</div>'); | ||
updateoverlay(); | ||
} | ||
/* -------- CENTER ON LOAD -------- */ | ||
function updateoverlay(){ | ||
/* -------- PRELOAD IMAGE -------- */ | ||
function preloadFirst(){ | ||
images = content.find('img'); | ||
blocktitle.html(title); | ||
content.find(">:first-child").addClass('figlio'); | ||
$('.figlio').css('width', framewidth).css('height', frameheight).css('padding', border).css('background', bgcolor); | ||
if (images.length) { | ||
images.each(function(){ | ||
$(this).one('load', function() { | ||
updateoverlay(); | ||
}); | ||
}); | ||
} else { | ||
updateoverlay(); | ||
} | ||
} | ||
updateol(sonH, finH); | ||
/* -------- FADE-IN THE NEW CONTENT -------- */ | ||
function updateoverlay(){ | ||
content.animate({ | ||
'opacity': '1' | ||
},'slow', post_open_callback(content,blocknum,blocktitle) | ||
) | ||
} | ||
blocktitle.html(title); | ||
content.find(">:first-child").addClass('figlio') | ||
.css({ | ||
'width': framewidth, | ||
'height': frameheight, | ||
'padding': border, | ||
'background': bgcolor | ||
}); | ||
/* -------- CENTER FRAME -------- */ | ||
function updateol(){ | ||
$('img.figlio').on('dragstart', function(event) { | ||
event.preventDefault(); | ||
}); | ||
sonH = content.outerHeight(); | ||
finH = $(window).height(); | ||
updateOL(); | ||
if(sonH+30 < finH){ | ||
margine = (finH - sonH)/2; | ||
content.css('margin-top', margine); | ||
content.css('margin-bottom', margine); | ||
}else{ | ||
content.css('margin-top', '30px'); | ||
content.css('margin-bottom', '30px'); | ||
} | ||
post_resize_callback(content,blocknum,blocktitle); | ||
} | ||
content.animate({ | ||
'opacity': '1' | ||
},'slow', function(){ | ||
$(window).resize(function(){ | ||
if($('.vbox-content').length){ | ||
setTimeout(updateol(), 800); | ||
} | ||
}); | ||
}) | ||
} | ||
})(jQuery); | ||
/* -------- CENTER FRAME -------- */ | ||
function updateOL(){ | ||
var sonH = content.outerHeight(); | ||
var finH = $(window).height(); | ||
if (sonH + 60 < finH) { | ||
margine = (finH - sonH)/2; | ||
content.css('margin-top', margine); | ||
content.css('margin-bottom', margine); | ||
} else { | ||
margine = '30px'; | ||
content.css('margin-top', margine); | ||
content.css('margin-bottom', margine); | ||
} | ||
option.cb_post_resize(); | ||
} | ||
$(window).resize(function(){ | ||
if($('.vbox-content').length){ | ||
setTimeout(updateOL(), 800); | ||
} | ||
}); | ||
}); // each | ||
} // venobox | ||
}); // extend | ||
})(jQuery); |
/* | ||
* VenoBox - jQuery Plugin | ||
* version: 1.7.2 | ||
* version: 1.8.0 | ||
* @requires jQuery >= 1.7.0 | ||
@@ -12,2 +12,2 @@ * | ||
*/ | ||
!function(e){function a(){e.ajax({url:m,cache:!1}).done(function(e){f.html('<div class="vbox-inline">'+e+"</div>"),c()}).fail(function(){f.html('<div class="vbox-inline"><p>Error retrieving contents, please retry</div>'),r()})}function o(){f.html('<iframe class="venoframe" src="'+m+'"></iframe>'),r()}function t(e,a){var o,t,s=e?"?rel=0&autoplay=1":"?rel=0";if("vimeo"==a){o="https://player.vimeo.com/video/";var c=m.split("/");t=c[c.length-1]}else o="https://www.youtube.com/embed/",t=i(m);f.html('<iframe class="venoframe vbvid" webkitallowfullscreen mozallowfullscreen allowfullscreen frameborder="0" src="'+o+t+s+'"></iframe>'),r()}function i(e){var a="";return e=e.replace(/(>|<)/gi,"").split(/(vi\/|v=|\/v\/|youtu\.be\/|\/embed\/)/),void 0!==e[2]?(a=e[2].split(/[^0-9a-z_\-]/i),a=a[0]):a=e,a}function s(){f.html('<div class="vbox-inline">'+e(m).html()+"</div>"),r()}function c(){images=e(".vbox-content").find("img"),images.length?images.each(function(){e(this).one("load",function(){r()})}):r()}function r(){b.html(q),f.find(">:first-child").addClass("figlio"),e(".figlio").css("width",g).css("height",x).css("padding",u).css("background",d),n(Q,H),f.animate({opacity:"1"},"slow",I(f,v,b))}function n(){Q=f.outerHeight(),H=e(window).height(),H>Q+30?(_=(H-Q)/2,f.css("margin-top",_),f.css("margin-bottom",_)):(f.css("margin-top","30px"),f.css("margin-bottom","30px")),J(f,v,b)}var l,d,v,b,u,p,k,f,m,h,g,x,y,w,C,_,B,j,z,q,P,D,E,H,Q,T,A,F,G,I,J;e.fn.extend({venobox:function(i){var r={arrowsColor:"#B6B6B6",autoplay:!1,bgcolor:"#fff",border:"0",closeBackground:"#161617",closeColor:"#d2d2d2",framewidth:"",frameheight:"",infinigall:!1,numeratio:!1,numerationBackground:"#161617",numerationColor:"#d2d2d2",numerationPosition:"top",overlayClose:!0,overlayColor:"rgba(23,23,23,0.85)",spinner:"double-bounce",spinColor:"#d2d2d2",titleattr:"title",titleBackground:"#161617",titleColor:"#d2d2d2",titlePosition:"top",pre_open_callback:function(){return!0},post_open_callback:function(){},pre_close_callback:function(){return!0},post_close_callback:function(){},post_resize_callback:function(){}},n=e.extend(r,i);return this.each(function(){var i=e(this);return i.data("venobox")?!0:(i.addClass("vbox-item"),i.data("framewidth",n.framewidth),i.data("frameheight",n.frameheight),i.data("border",n.border),i.data("bgcolor",n.bgcolor),i.data("numeratio",n.numeratio),i.data("infinigall",n.infinigall),i.data("overlaycolor",n.overlayColor),i.data("titleattr",n.titleattr),I=n.post_open_callback,J=n.post_resize_callback,i.data("venobox",!0),void i.on("click",function(r){function _(){P=i.data("vbgall"),B=i.data("numeratio"),y=i.data("infinigall"),w=e('.vbox-item[data-vbgall="'+P+'"]'),w.length>1&&B===!0?(v.html(w.index(i)+1+" / "+w.length),v.show()):v.hide(),D=w.eq(w.index(i)+1),E=w.eq(w.index(i)-1),""!==q?b.show():b.hide(),w.length>1&&y===!0?(T=!0,A=!0,D.length<1&&(D=w.eq(0)),w.index(i)<1&&(E=w.eq(w.index(w.length)))):(D.length>0?(e(".vbox-next").css("display","block"),T=!0):(e(".vbox-next").css("display","none"),T=!1),w.index(i)>0?(e(".vbox-prev").css("display","block"),A=!0):(e(".vbox-prev").css("display","none"),A=!1))}function H(e){27===e.keyCode&&Q()}function Q(){var a=n.pre_close_callback(i,f,v,b);(void 0==a||a)&&(e("body").removeClass("vbox-open"),e("body").off("keydown",H),z.animate({opacity:0},500,function(){z.remove(),C=!1,i.focus(),n.post_close_callback(i,f,v,b)}))}r.preventDefault(),i=e(this);var I=n.pre_open_callback(i);if(void 0==I||I){switch(j=i.data("overlay")||i.data("overlaycolor"),g=i.data("framewidth"),x=i.data("frameheight"),l=i.data("autoplay")||n.autoplay,u=i.data("border"),d=i.data("bgcolor"),T=!1,A=!1,C=!1,m=i.data("href")||i.attr("href"),h=i.data("css")||"",q=i.attr(i.data("titleattr"))||"",e("body").addClass("vbox-open"),F='<div class="vbox-preloader">',n.spinner){case"rotating-plane":F+='<div class="sk-rotating-plane"></div>';break;case"double-bounce":F+='<div class="sk-double-bounce"><div class="sk-child sk-double-bounce1"></div><div class="sk-child sk-double-bounce2"></div></div>';break;case"wave":F+='<div class="sk-wave"><div class="sk-rect sk-rect1"></div><div class="sk-rect sk-rect2"></div><div class="sk-rect sk-rect3"></div><div class="sk-rect sk-rect4"></div><div class="sk-rect sk-rect5"></div></div>';break;case"wandering-cubes":F+='<div class="sk-wandering-cubes"><div class="sk-cube sk-cube1"></div><div class="sk-cube sk-cube2"></div></div>';break;case"spinner-pulse":F+='<div class="sk-spinner sk-spinner-pulse"></div>';break;case"three-bounce":F+='<div class="sk-three-bounce"><div class="sk-child sk-bounce1"></div><div class="sk-child sk-bounce2"></div><div class="sk-child sk-bounce3"></div></div>';break;case"cube-grid":F+='<div class="sk-cube-grid"><div class="sk-cube sk-cube1"></div><div class="sk-cube sk-cube2"></div><div class="sk-cube sk-cube3"></div><div class="sk-cube sk-cube4"></div><div class="sk-cube sk-cube5"></div><div class="sk-cube sk-cube6"></div><div class="sk-cube sk-cube7"></div><div class="sk-cube sk-cube8"></div><div class="sk-cube sk-cube9"></div></div>'}F+="</div>",G='<a class="vbox-next"><span>next</span></a><a class="vbox-prev"><span>prev</span></a>',vbheader='<div class="vbox-title"></div><div class="vbox-num">0/0</div><div class="vbox-close">×</div>',p='<div class="vbox-overlay '+h+'" style="background:'+j+'">'+F+'<div class="vbox-container"><div class="vbox-content"></div></div>'+vbheader+G+"</div>",e("body").append(p),e(".vbox-preloader .sk-child, .vbox-preloader .sk-rotating-plane, .vbox-preloader .sk-rect, .vbox-preloader .sk-cube, .vbox-preloader .sk-spinner-pulse").css("background-color",n.spinColor),z=e(".vbox-overlay"),k=e(".vbox-container"),f=e(".vbox-content"),v=e(".vbox-num"),b=e(".vbox-title"),b.css(n.titlePosition,"-1px"),b.css({color:n.titleColor,"background-color":n.titleBackground}),e(".vbox-close").css({color:n.closeColor,"background-color":n.closeBackground}),e(".vbox-num").css(n.numerationPosition,"-1px"),e(".vbox-num").css({color:n.numerationColor,"background-color":n.numerationBackground}),e(".vbox-next span, .vbox-prev span").css({"border-top-color":n.arrowsColor,"border-right-color":n.arrowsColor}),f.html(""),f.css("opacity","0"),_(),z.animate({opacity:1},250,function(){"iframe"==i.data("vbtype")?o():"inline"==i.data("vbtype")?s():"ajax"==i.data("vbtype")?a():"vimeo"==i.data("vbtype")?t(l,"vimeo"):"youtube"==i.data("vbtype")?t(l,"youtube"):(f.html('<img src="'+m+'">'),c())});var J={prev:function(){C||(C=!0,j=E.data("overlay")||E.data("overlaycolor"),g=E.data("framewidth"),x=E.data("frameheight"),u=E.data("border"),d=E.data("bgcolor"),m=E.data("href")||E.attr("href"),l=E.data("autoplay"),q=E.attr(E.data("titleattr"))||"",f.animate({opacity:0},500,function(){z.css("background",j),"iframe"==E.data("vbtype")?o():"inline"==E.data("vbtype")?s():"ajax"==E.data("vbtype")?a():"youtube"==E.data("vbtype")?t(l,"youtube"):"vimeo"==E.data("vbtype")?t(l,"vimeo"):(f.html('<img src="'+m+'">'),c()),i=E,_(),C=!1}))},next:function(){C||(C=!0,j=D.data("overlay")||D.data("overlaycolor"),g=D.data("framewidth"),x=D.data("frameheight"),u=D.data("border"),d=D.data("bgcolor"),m=D.data("href")||D.attr("href"),l=D.data("autoplay"),q=D.attr(D.data("titleattr"))||"",f.animate({opacity:0},500,function(){z.css("background",j),"iframe"==D.data("vbtype")?o():"inline"==D.data("vbtype")?s():"ajax"==D.data("vbtype")?a():"youtube"==D.data("vbtype")?t(l,"youtube"):"vimeo"==D.data("vbtype")?t(l,"vimeo"):(f.html('<img src="'+m+'">'),c()),i=D,_(),C=!1}))}};e("body").keydown(function(e){37==e.keyCode&&1==A&&J.prev(),39==e.keyCode&&1==T&&J.next()}),e(".vbox-prev").click(function(){J.prev()}),e(".vbox-next").click(function(){J.next()});var K=".vbox-overlay";return n.overlayClose||(K=".vbox-close"),e(K).click(function(a){(e(a.target).is(".vbox-overlay")||e(a.target).is(".vbox-content")||e(a.target).is(".vbox-close")||e(a.target).is(".vbox-preloader"))&&Q()}),e("body").keydown(H),!1}}))})}}),e(window).resize(function(){e(".vbox-content").length&&setTimeout(n(),800)})}(jQuery); | ||
!function(e){var o,t,a,s,i,n,c,r,d,l,v,u,b,p,m,f,h,g,k,x,y,w,C,_,E,M,P,T,B;e.fn.extend({venobox:function(Y){var O=this,U={arrowsColor:"#B6B6B6",autoplay:!1,bgcolor:"#fff",border:"0",closeBackground:"#161617",closeColor:"#d2d2d2",framewidth:"",frameheight:"",infinigall:!1,htmlClose:"×",htmlNext:"<span>Next</span>",htmlPrev:"<span>Prev</span>",numeratio:!1,numerationBackground:"#161617",numerationColor:"#d2d2d2",numerationPosition:"top",overlayClose:!0,overlayColor:"rgba(23,23,23,0.85)",spinner:"double-bounce",spinColor:"#d2d2d2",titleattr:"title",titleBackground:"#161617",titleColor:"#d2d2d2",titlePosition:"top",cb_pre_open:function(){return!0},cb_post_open:function(){},cb_pre_close:function(){return!0},cb_post_close:function(){},cb_post_resize:function(){},cb_after_nav:function(){},cb_init:function(){}},X=e.extend(U,Y);return X.cb_init(O),this.each(function(){function Y(){y=T.data("gall"),h=T.data("numeratio"),b=T.data("infinigall"),p=e('.vbox-item[data-gall="'+y+'"]'),w=p.eq(p.index(T)+1),C=p.eq(p.index(T)-1),p.length>1?(B=p.index(T)+1,a.html(B+" / "+p.length)):B=1,h===!0?a.show():a.hide(),""!==x?s.show():s.hide(),w.length||b===!0?(e(".vbox-next").css("display","block"),_=!0):(e(".vbox-next").css("display","none"),_=!1),p.index(T)>0||b===!0?(e(".vbox-prev").css("display","block"),E=!0):(e(".vbox-prev").css("display","none"),E=!1),(E===!0||_===!0)&&(r.on(TouchMouseEvent.DOWN,V),r.on(TouchMouseEvent.MOVE,z),r.on(TouchMouseEvent.UP,R))}function U(e){return e.length<1?!1:m?!1:(m=!0,g=e.data("overlay")||e.data("overlaycolor"),v=e.data("framewidth"),u=e.data("frameheight"),i=e.data("border"),t=e.data("bgcolor"),d=e.data("href")||e.attr("href"),o=e.data("autoplay"),x=e.attr(e.data("titleattr"))||"",e===C&&r.addClass("animated").addClass("swipe-right"),e===w&&r.addClass("animated").addClass("swipe-left"),void r.animate({opacity:0},500,function(){k.css("background",g),r.removeClass("animated").removeClass("swipe-left").removeClass("swipe-right").css({"margin-left":0,"margin-right":0}),"iframe"==e.data("vbtype")?W():"inline"==e.data("vbtype")?A():"ajax"==e.data("vbtype")?j():"video"==e.data("vbtype")||"vimeo"==e.data("vbtype")||"youtube"==e.data("vbtype")?$(o):(r.html('<img src="'+d+'">'),H()),T=e,Y(),m=!1,X.cb_after_nav(T,B,w,C)}))}function D(e){27===e.keyCode&&N(),37==e.keyCode&&E===!0&&U(C),39==e.keyCode&&_===!0&&U(w)}function N(){var o=X.cb_pre_close(T,B,w,C);return o===!1?!1:(e("body").off("keydown",D).removeClass("vbox-open"),T.focus(),void k.animate({opacity:0},500,function(){k.remove(),m=!1,X.cb_post_close()}))}function V(e){r.addClass("animated"),startY=e.pageY,F=e.pageX,startouch=!0}function z(e){if(startouch===!0){G=e.pageX,endY=e.pageY,diffX=G-F,diffY=endY-startY;var o=Math.abs(diffX),t=Math.abs(diffY);o>t&&100>=o&&(e.preventDefault(),r.css("margin-left",diffX))}}function R(e){if(startouch===!0){startouch=!1;var o=T,t=!1;J=G-F,0>J&&_===!0&&(o=w,t=!0),J>0&&E===!0&&(o=C,t=!0),Math.abs(J)>=K&&t===!0?U(o):r.css({"margin-left":0,"margin-right":0})}}function j(){e.ajax({url:d,cache:!1}).done(function(e){r.html('<div class="vbox-inline">'+e+"</div>"),H()}).fail(function(){r.html('<div class="vbox-inline"><p>Error retrieving contents, please retry</div>'),Q()})}function W(){r.html('<iframe class="venoframe" src="'+d+'"></iframe>'),Q()}function $(e){var o,t=q(d),a=e?"?rel=0&autoplay=1":"?rel=0",s=a+I(d);"vimeo"==t.type?o="https://player.vimeo.com/video/":"youtube"==t.type&&(o="https://www.youtube.com/embed/"),r.html('<iframe class="venoframe vbvid" webkitallowfullscreen mozallowfullscreen allowfullscreen frameborder="0" src="'+o+t.id+s+'"></iframe>'),Q()}function q(e){if(e.match(/(http:|https:|)\/\/(player.|www.)?(vimeo\.com|youtu(be\.com|\.be|be\.googleapis\.com))\/(video\/|embed\/|watch\?v=|v\/)?([A-Za-z0-9._%-]*)(\&\S+)?/),RegExp.$3.indexOf("youtu")>-1)var o="youtube";else if(RegExp.$3.indexOf("vimeo")>-1)var o="vimeo";return{type:o,id:RegExp.$6}}function I(e){var o="",t=decodeURIComponent(e),a=t.split("?");if(void 0!==a[1]){var s,i,n=a[1].split("&");for(i=0;i<n.length;i++)s=n[i].split("="),o=o+"&"+s[0]+"="+s[1]}return encodeURI(o)}function A(){r.html('<div class="vbox-inline">'+e(d).html()+"</div>"),Q()}function H(){images=r.find("img"),images.length?images.each(function(){e(this).one("load",function(){Q()})}):Q()}function Q(){s.html(x),r.find(">:first-child").addClass("figlio").css({width:v,height:u,padding:i,background:t}),e("img.figlio").on("dragstart",function(e){e.preventDefault()}),S(),r.animate({opacity:"1"},"slow",function(){})}function S(){var o=r.outerHeight(),t=e(window).height();t>o+60?(f=(t-o)/2,r.css("margin-top",f),r.css("margin-bottom",f)):(f="30px",r.css("margin-top",f),r.css("margin-bottom",f)),X.cb_post_resize()}if(T=e(this),T.data("venobox"))return!0;O.VBclose=function(){N()},T.addClass("vbox-item"),T.data("framewidth",X.framewidth),T.data("frameheight",X.frameheight),T.data("border",X.border),T.data("bgcolor",X.bgcolor),T.data("numeratio",X.numeratio),T.data("infinigall",X.infinigall),T.data("overlaycolor",X.overlayColor),T.data("titleattr",X.titleattr),T.data("venobox",!0),T.on("click",function(b){b.preventDefault(),T=e(this);var p=X.cb_pre_open(T);if(p===!1)return!1;switch(O.VBnext=function(){U(w)},O.VBprev=function(){U(C)},g=T.data("overlay")||T.data("overlaycolor"),v=T.data("framewidth"),u=T.data("frameheight"),o=T.data("autoplay")||X.autoplay,i=T.data("border"),t=T.data("bgcolor"),_=!1,E=!1,m=!1,d=T.data("href")||T.attr("href"),l=T.data("css")||"",x=T.attr(T.data("titleattr"))||"",M='<div class="vbox-preloader">',X.spinner){case"rotating-plane":M+='<div class="sk-rotating-plane"></div>';break;case"double-bounce":M+='<div class="sk-double-bounce"><div class="sk-child sk-double-bounce1"></div><div class="sk-child sk-double-bounce2"></div></div>';break;case"wave":M+='<div class="sk-wave"><div class="sk-rect sk-rect1"></div><div class="sk-rect sk-rect2"></div><div class="sk-rect sk-rect3"></div><div class="sk-rect sk-rect4"></div><div class="sk-rect sk-rect5"></div></div>';break;case"wandering-cubes":M+='<div class="sk-wandering-cubes"><div class="sk-cube sk-cube1"></div><div class="sk-cube sk-cube2"></div></div>';break;case"spinner-pulse":M+='<div class="sk-spinner sk-spinner-pulse"></div>';break;case"three-bounce":M+='<div class="sk-three-bounce"><div class="sk-child sk-bounce1"></div><div class="sk-child sk-bounce2"></div><div class="sk-child sk-bounce3"></div></div>';break;case"cube-grid":M+='<div class="sk-cube-grid"><div class="sk-cube sk-cube1"></div><div class="sk-cube sk-cube2"></div><div class="sk-cube sk-cube3"></div><div class="sk-cube sk-cube4"></div><div class="sk-cube sk-cube5"></div><div class="sk-cube sk-cube6"></div><div class="sk-cube sk-cube7"></div><div class="sk-cube sk-cube8"></div><div class="sk-cube sk-cube9"></div></div>'}return M+="</div>",P='<a class="vbox-next">'+X.htmlNext+'</a><a class="vbox-prev">'+X.htmlPrev+"</a>",vbheader='<div class="vbox-title"></div><div class="vbox-num">0/0</div><div class="vbox-close">'+X.htmlClose+"</div>",n='<div class="vbox-overlay '+l+'" style="background:'+g+'">'+M+'<div class="vbox-container"><div class="vbox-content"></div></div>'+vbheader+P+"</div>",e("body").append('<div class="ghostoverlay"></div>').append(n).addClass("vbox-open"),e(".vbox-preloader .sk-child, .vbox-preloader .sk-rotating-plane, .vbox-preloader .sk-rect, .vbox-preloader .sk-cube, .vbox-preloader .sk-spinner-pulse").css("background-color",X.spinColor),k=e(".vbox-overlay"),c=e(".vbox-container"),r=e(".vbox-content"),a=e(".vbox-num"),s=e(".vbox-title"),s.css(X.titlePosition,"-1px"),s.css({color:X.titleColor,"background-color":X.titleBackground}),e(".vbox-close").css({color:X.closeColor,"background-color":X.closeBackground}),e(".vbox-num").css(X.numerationPosition,"-1px"),e(".vbox-num").css({color:X.numerationColor,"background-color":X.numerationBackground}),e(".vbox-next span, .vbox-prev span").css({"border-top-color":X.arrowsColor,"border-right-color":X.arrowsColor}),r.html(""),r.css("opacity","0"),Y(),k.animate({opacity:1},250,function(){"iframe"==T.data("vbtype")?W():"inline"==T.data("vbtype")?A():"ajax"==T.data("vbtype")?j():"video"==T.data("vbtype")||"vimeo"==T.data("vbtype")||"youtube"==T.data("vbtype")?$(o):(r.html('<img src="'+d+'">'),H()),X.cb_post_open(T,B,w,C)}),e("body").keydown(D),e(".vbox-prev").on("click",function(){U(C)}),e(".vbox-next").on("click",function(){U(w)}),!1});var Z=".vbox-overlay";X.overlayClose||(Z=".vbox-close"),e(document).on("click",Z,function(o){(e(o.target).is(".vbox-overlay")||e(o.target).is(".vbox-content")||e(o.target).is(".vbox-close")||e(o.target).is(".vbox-preloader"))&&N()});var F=null,G=null,J=0,K=50;startouch=!1,TouchMouseEvent={DOWN:"touchmousedown",UP:"touchmouseup",MOVE:"touchmousemove"};var L=function(o){var t;switch(o.type){case"mousedown":t=TouchMouseEvent.DOWN;break;case"mouseup":t=TouchMouseEvent.UP;break;case"mouseout":t=TouchMouseEvent.UP;break;case"mousemove":t=TouchMouseEvent.MOVE;break;default:return}var a=oe(t,o,o.pageX,o.pageY);e(o.target).trigger(a)},ee=function(o){var t;switch(o.type){case"touchstart":t=TouchMouseEvent.DOWN;break;case"touchend":t=TouchMouseEvent.UP;break;case"touchmove":t=TouchMouseEvent.MOVE;break;default:return}var a,s=o.originalEvent.touches[0];a=t==TouchMouseEvent.UP?oe(t,o,null,null):oe(t,o,s.pageX,s.pageY),e(o.target).trigger(a)},oe=function(o,t,a,s){return e.Event(o,{pageX:a,pageY:s,originalEvent:t})};"ontouchstart"in window?(e(document).on("touchstart",ee),e(document).on("touchmove",ee),e(document).on("touchend",ee)):(e(document).on("mousedown",L),e(document).on("mouseup",L),e(document).on("mouseout",L),e(document).on("mousemove",L)),e(window).resize(function(){e(".vbox-content").length&&setTimeout(S(),800)})})}})}(jQuery); |
Sorry, the diff of this file is not supported yet
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
55115
913
8
60