';
}
if (inst.options.showtwitter) {
socialCode +=
'
';
}
if (inst.options.showpinterest) {
socialCode +=
'
';
}
socialCode += "
";
inst.$lightboxBox.append(socialCode);
$(".tsvg-fancy-html5-social-btn", inst.$lightbox).click(
function () {
var shareUrl = window.location.href + (0 > window.location.href.indexOf("?") ? "?" : "&") + "html5lightboxshare=" + encodeURIComponent(inst.currentElem[ELEM_HREF]);
var shareTitle = inst.currentElem[ELEM_TITLE];
var shareMedia = inst.currentElem[ELEM_HREF];
if (inst.currentElem[ELEM_TYPE] == 0) {
shareMedia = inst.absoluteUrl(inst.currentElem[ELEM_HREF]);
} else if (inst.currentElem[ELEM_TYPE] == 3) {
shareMedia = "https://img.youtube.com/vi/" + inst.getYoutubeId(inst.currentElem[ELEM_HREF]) + "/0.jpg";
} else {
var lightboxLink = $('.tsvg-html5lightbox-452410[href="' + inst.currentElem[ELEM_HREF] + '"]');
if (lightboxLink.length > 0)
if (lightboxLink.data("shareimage") && lightboxLink.data("shareimage").length > 0) {
shareMedia = inst.absoluteUrl(lightboxLink.data("shareimage"));
} else if (lightboxLink.data("thumbnail") && lightboxLink.data("thumbnail").length > 0) {
shareMedia = inst.absoluteUrl(lightboxLink.data("thumbnail"));
} else {
var lightboxImg = $("img", lightboxLink);
if (lightboxImg.length > 0) {
shareMedia = inst.absoluteUrl(lightboxImg.attr("src"));
}
}
}
var isVideo =
inst.currentElem[ELEM_TYPE] == 2 ||
inst.currentElem[ELEM_TYPE] == 3 ||
inst.currentElem[ELEM_TYPE] == 4 ||
inst.currentElem[ELEM_TYPE] == 8 ||
inst.currentElem[ELEM_TYPE] == 9 ||
inst.currentElem[ELEM_TYPE] == 11;
if ($(this).hasClass("tsvg-fancy-html5-social-facebook")) {
window.open("https://www.facebook.com/sharer/sharer.php?u=" + encodeURIComponent(shareUrl) + "&t=" + encodeURIComponent(shareTitle), "_blank");
} else if ($(this).hasClass("tsvg-fancy-html5-social-twitter")) {
window.open("https://twitter.com/share?url=" + encodeURIComponent(shareUrl) + "&text=" + encodeURIComponent(shareTitle), "_blank");
} else if ($(this).hasClass("tsvg-fancy-html5-social-pinterest")) {
window.open(
"https://pinterest.com/pin/create/bookmarklet/?media=" +
encodeURIComponent(shareMedia) +
"&url=" +
encodeURIComponent(shareUrl) +
"&description=" +
encodeURIComponent(shareTitle) +
"&is_video=" +
(isVideo ? "true" : "false"),
"_blank"
);
}
return false;
}
);
}
inst.$watermark = $("#tsvg-fancy-html5-watermark", inst.$lightbox);
if (inst.options.stamp) {
inst.$watermark.html("");
} else if (inst.options.watermark) {
var html = "";
if (inst.options.watermarklink) {
html = "" + html + "";
}
inst.$watermark.html(html);
}
if (inst.options.closeonoverlay) {
$("#tsvg-fancy-html5-lightbox-overlay", inst.$lightbox).click(inst.finish);
}
inst.$close.click(inst.finish);
inst.$next.click(
function () {
inst.nextArrowClicked();
}
);
inst.$prev.click(
function () {
inst.prevArrowClicked();
}
);
$(window).resize(
function () {
clearTimeout(inst.options.resizeTimeout);
inst.options.resizeTimeout = setTimeout(
function () {
inst.resizeWindow();
},
500
);
}
);
$(window).scroll(
function () {
inst.scrollBox();
}
);
$(window).bind(
"orientationchange",
function (e) {
if (inst.options.isMobile) {
inst.resizeWindow();
}
}
);
if (inst.options.isIPhone) {
inst.options.windowInnerHeight = window.innerHeight;
setInterval(
function () {
if (inst.options.windowInnerHeight != window.innerHeight) {
inst.options.windowInnerHeight = window.innerHeight;
inst.resizeWindow();
}
},
500
);
}
if (inst.options.enabletouchswipe) {
inst.enableSwipe();
}
};
inst.slideTimer = function (interval, callback, updatecallback) {
let timerInstance = this,
updateinterval = 50,
updateTimerId = null,
runningTime = 0,
paused = false,
started = false,
startedandpaused = false;
timerInstance.timeout = interval;
this.pause = function () {
if (started) {
paused = true;
clearInterval(updateTimerId);
}
};
this.resume = function (forceresume) {
if (startedandpaused && !forceresume) {
return;
}
startedandpaused = false;
if (started && paused) {
paused = false;
updateTimerId = setInterval(
function () {
runningTime += updateinterval;
if (runningTime > timerInstance.timeout) {
clearInterval(updateTimerId);
if (callback) {
callback();
}
}
if (updatecallback) {
updatecallback(runningTime / timerInstance.timeout);
}
},
updateinterval
);
}
};
this.stop = function () {
clearInterval(updateTimerId);
if (updatecallback) {
updatecallback(-1);
}
runningTime = 0;
paused = false;
started = false;
};
this.start = function () {
runningTime = 0;
paused = false;
started = true;
updateTimerId = setInterval(
function () {
runningTime += updateinterval;
if (runningTime > timerInstance.timeout) {
clearInterval(updateTimerId);
if (callback) {
callback();
}
}
if (updatecallback) {
updatecallback(runningTime / timerInstance.timeout);
}
},
updateinterval
);
};
this.startandpause = function () {
runningTime = 0;
paused = true;
started = true;
startedandpaused = true;
};
return this;
};
inst.updateTimer = function (percent) {
var w = Math.round(percent * 100);
if (w > 100) {
w = 100;
}
if (0 > w ) {
w = 0;
}
$("#tsvg-fancy-html5-timer", inst.$lightbox).css({ display: "block", width: w + "%" });
};
inst.initSlide = function () {
inst.autosliding = false;
inst.slideTimeout = inst.slideTimer(
inst.options.slideinterval,
function () {
inst.gotoSlide(-1);
},
inst.options.showtimer
? function (percent) {
inst.updateTimer(percent);
}
: null
);
if (inst.options.autoslide) {
inst.slideTimeout.stop();
inst.autosliding = true;
}
};
inst.nextArrowClicked = function () {
if (inst.options.curElem >= inst.options.nextElem) {
if (inst.options.onlastarrowclicked && window[inst.options.onlastarrowclicked] && typeof window[inst.options.onlastarrowclicked] == "function") {
window[inst.options.onlastarrowclicked]();
}
}
inst.gotoSlide(-1);
};
inst.prevArrowClicked = function () {
if (inst.options.prevElem >= inst.options.curElem) {
if (inst.options.onfirstarrowclicked && window[inst.options.onfirstarrowclicked] && typeof window[inst.options.onfirstarrowclicked] == "function") {
window[inst.options.onfirstarrowclicked]();
}
}
inst.gotoSlide(-2);
};
inst.calcNextPrevElem = function () {
inst.options.nextElem = -1;
inst.options.prevElem = -1;
inst.options.inGroup = false;
inst.options.groupIndex = 0;
inst.options.groupCount = 0;
var group = inst.elemArray[inst.options.curElem][ELEM_GROUP];
for (var i = 0; inst.elemArray.length > i; i++) {
if (inst.matchGroup(group, inst.elemArray[i][ELEM_GROUP])) {
if (i == inst.options.curElem) {
inst.options.groupIndex = inst.options.groupCount;
}
inst.options.groupCount++;
}
}
var j,
curGroup = inst.elemArray[inst.options.curElem][ELEM_GROUP];
if (curGroup != undefined && curGroup != null) {
for (j = inst.options.curElem + 1;inst.elemArray.length > j; j++) {
if (inst.matchGroup(curGroup, inst.elemArray[j][ELEM_GROUP])) {
inst.options.nextElem = j;
break;
}
}
if (0 > inst.options.nextElem) {
for (j = 0; inst.options.curElem > j ; j++) {
if (inst.matchGroup(curGroup, inst.elemArray[j][ELEM_GROUP])) {
inst.options.nextElem = j;
break;
}
}
}
if (inst.options.nextElem >= 0) {
for (j = inst.options.curElem - 1; j >= 0; j--) {
if (inst.matchGroup(curGroup, inst.elemArray[j][ELEM_GROUP])) {
inst.options.prevElem = j;
break;
}
}
if (0 > inst.options.prevElem ) {
for (j = inst.elemArray.length - 1; j > inst.options.curElem; j--) {
if (inst.matchGroup(curGroup, inst.elemArray[j][ELEM_GROUP])) {
inst.options.prevElem = j;
break;
}
}
}
}
}
if (inst.options.nextElem >= 0 || inst.options.prevElem >= 0) {
inst.options.inGroup = true;
}
};
inst.calcBoxPosition = function (initW, initH) {
var boxW = initW + 2 * inst.options.bordersize;
var boxH = initH + 2 * inst.options.bordersize;
var winH = window.innerHeight ? window.innerHeight : $(window).height();
var boxT = Math.round((winH - inst.options.navheight) / 2 - boxH / 2);
if (inst.options.titlestyle == "bottom") {
boxT -= Math.round(inst.options.barheight / 2);
}
var topmargin = inst.options.navarrowsbottomscreenwidth > $(window).width() ? inst.options.bordertopmarginsmall : inst.options.bordertopmargin;
if (topmargin > boxT) {
boxT = topmargin;
}
if (inst.options.insideiframe && window.self != window.top) {
if (parent.window.jQuery && parent.window.jQuery("#" + inst.options.iframeid).length) {
var iframetop = parent.window.jQuery("#" + inst.options.iframeid).offset().top;
var parentscroll = parent.window.document.body.scrollTop;
boxT = topmargin;
boxT += parentscroll > iframetop ? parentscroll - iframetop : 0;
}
}
return [boxW, boxH, boxT];
};
inst.hideNavArrows = function () {
var showPrev = false;
var showNext = false;
if (inst.options.inGroup) {
if (inst.options.arrowloop || (!inst.options.arrowloop && inst.options.curElem > inst.options.prevElem )) {
showPrev = true;
}
if (inst.options.arrowloop || (!inst.options.arrowloop && inst.options.curElem > inst.options.prevElem )) {
showNext = true;
}
}
if (showPrev) {
inst.$prev.removeClass("tsvg-fancy-html5-hide");
if (inst.$prevbottom) {
inst.$prevbottom.removeClass("tsvg-fancy-html5-hide");
}
if (inst.$prevtouch) {
inst.$prevtouch.removeClass("tsvg-fancy-html5-hide");
}
} else {
inst.$prev.addClass("tsvg-fancy-html5-hide");
if (inst.$prevbottom) {
inst.$prevbottom.addClass("tsvg-fancy-html5-hide");
}
if (inst.$prevtouch) {
inst.$prevtouch.addClass("tsvg-fancy-html5-hide");
}
}
if (showNext) {
inst.$next.removeClass("tsvg-fancy-html5-hide");
if (inst.$nextbottom) {
inst.$nextbottom.removeClass("tsvg-fancy-html5-hide");
}
if (inst.$nexttouch) {
inst.$nexttouch.removeClass("tsvg-fancy-html5-hide");
}
} else {
inst.$next.addClass("tsvg-fancy-html5-hide");
if (inst.$nextbottom) {
inst.$nextbottom.addClass("tsvg-fancy-html5-hide");
}
if (inst.$nexttouch) {
inst.$nexttouch.addClass("tsvg-fancy-html5-hide");
}
}
};
inst.clickHandler = function (event) {
var $this = $(this);
var dataoptions = {};
if (jQuery(event.target).prop("tagName") == 'A') {
let link = jQuery(event.target).attr('href');
if (jQuery(event.target).attr('target') == '_blank') {
window.open(link);
} else {
window.location.assign(link)
}
return false;
}
$.each(
$this.data(),
function (key, value) {
dataoptions[key.toLowerCase()] = value;
}
);
inst.options = $.extend(inst.options, inst.defaultoptions, dataoptions);
$(window).trigger("html5lightbox.lightboxshow");
inst.init();
if (0 >= inst.elemArray.length) {
return true;
}
inst.hideObjects();
for (var i = 0; inst.elemArray.length > i ; i++) {
if (inst.elemArray[i][ELEM_ID] == $this.data("tsvgid")) {
break;
}
}
if (i == inst.elemArray.length) {
return true;
}
inst.options.curElem = i;
inst.calcNextPrevElem();
inst.reset();
inst.$lightbox.show();
var boxPos = inst.calcBoxPosition(inst.options.loadingwidth, inst.options.loadingheight);
var boxW = boxPos[0];
var boxH = boxPos[1];
var boxT = boxPos[2];
if (inst.options.iequirksmode) {
inst.$lightboxBox.css({ top: boxT });
} else {
inst.$lightboxBox.css({ "margin-top": boxT });
}
if (!inst.options.positionFixed) {
inst.$lightboxBox.css("margin-top", $(window).scrollTop() + inst.options.bordertopmargin);
}
if (inst.options.titlestyle == "left" || inst.options.titlestyle == "right") {
inst.$lightboxBox.css({ width: boxW, height: boxH });
} else {
inst.$lightboxBox.css({ width: boxW, height: "auto" });
inst.$elemWrap.css({ width: boxW, height: boxH });
}
inst.loadCurElem();
return false;
};
inst.loadThumbnail = function (src, index) {
let inst_img_elem = document.createElement('img');
inst_img_elem.src = src;
inst_img_elem.addEventListener('load', function () {
if (inst.options.thumbwidth / inst.options.thumbheight >= inst_img_elem.naturalWidth / inst_img_elem.naturalHeight ) {
inst_img_elem.setAttribute("style","width:100%;")
} else {
inst_img_elem.setAttribute("style","height:100%;")
}
$(".tsvg-fancy-html5-nav-thumb").eq(index).html(inst_img_elem);
})
inst_img_elem.addEventListener('error', function () {
console.log('error')
})
};
inst.matchGroup = function (curGroup, elemGroup) {
if (!curGroup || !elemGroup) {
return false;
}
var curs = curGroup.split(":");
var elems = elemGroup.split(":");
var result = false;
for (var i in curs) {
if ($.inArray(curs[i], elems) > -1) {
result = true;
break;
}
}
return result;
};
inst.showNavigation = function () {
if (!inst.options.shownavigation) {
return;
}
if (!inst.currentElem || !inst.currentElem[ELEM_GROUP]) {
return;
}
var i;
var showNav = false;
var group = inst.currentElem[ELEM_GROUP];
for (i = 0; inst.elemArray.length > i ; i++) {
if (inst.matchGroup(group, inst.elemArray[i][ELEM_GROUP])) {
if (inst.elemArray[i][ELEM_THUMBNAIL] && inst.elemArray[i][ELEM_THUMBNAIL].length > 0) {
showNav = true;
break;
}
}
}
if (!showNav) {
return;
}
inst.options.navheight = inst.options.thumbheight + inst.options.thumbtopmargin + inst.options.thumbbottommargin;
if ($(".tsvg-fancy-html5-nav").length > 0) {
return;
}
var check_bool = $('.tsvg-fancy-blocks-container').attr('data-tsvg-shn');
if (check_bool === 'false') {
return
}
$("body").append(
"
" +
"
" +
"
" +
"
" +
"" +
"
" +
"
" +
"
" +
"
"
);
if (TS_VG_FG_Show_Nav == "true") {
var index = 0;
}
for (i = 0; inst.elemArray.length > i ; i++) {
if (inst.matchGroup(group, inst.elemArray[i][ELEM_GROUP])) {
if (inst.elemArray[i][ELEM_THUMBNAIL] && inst.elemArray[i][ELEM_THUMBNAIL].length > 0) {
$(".tsvg-fancy-html5-nav-list").append(
"
'
"
);
this.loadThumbnail(inst.elemArray[i][ELEM_THUMBNAIL], index)
index++;
}
}
}
$(".tsvg-fancy-html5-nav-thumb").hover(
function () {
$(this).css({ opacity: 1 });
$(this).css({ border: inst.options.thumbborder + "px solid " + inst.options.thumbhighlightbordercolor });
},
function () {
$(this).css({ opacity: inst.options.thumbopacity });
$(this).css({ border: inst.options.thumbborder + "px solid " + inst.options.thumbbordercolor });
}
);
$(".tsvg-fancy-html5-nav-thumb").click(
function () {
var index = $(this).data("arrayindex");
if (index >= 0) {
inst.gotoSlide(index);
}
}
);
inst.options.totalwidth = index * (inst.options.thumbgap + inst.options.thumbwidth + 2 * inst.options.thumbborder);
$(".tsvg-fancy-html5-nav-list")
.css({ display: "block", position: "relative", "margin-left": 0, width: inst.options.totalwidth + "px" })
.append("");
var $navMask = $(".tsvg-fancy-html5-nav-mask");
var $navPrev = $(".tsvg-fancy-html5-nav-prev");
var $navNext = $(".tsvg-fancy-html5-nav-next");
$navPrev.click(
function () {
var $navList = $(".tsvg-fancy-html5-nav-list");
var $navNext = $(".tsvg-fancy-html5-nav-next");
var winWidth = $(window).width();
var maskWidth = winWidth - 2 * inst.options.navbuttonwidth;
var marginLeft = parseInt($navList.css("margin-left")) + maskWidth;
if (marginLeft >= 0) {
marginLeft = 0;
$(this).css({ "background-position": "center left" });
} else {
$(this).css({ "background-position": "center right" });
}
if (maskWidth - inst.options.totalwidth >= marginLeft ) {
$navNext.css({ "background-position": "center left" });
} else {
$navNext.css({ "background-position": "center right" });
}
$navList.animate({ "margin-left": marginLeft });
}
);
$navNext.click(
function () {
var $navList = $(".tsvg-fancy-html5-nav-list");
var $navPrev = $(".tsvg-fancy-html5-nav-prev");
var winWidth = $(window).width();
var maskWidth = winWidth - 2 * inst.options.navbuttonwidth;
var marginLeft = parseInt($navList.css("margin-left")) - maskWidth;
if (maskWidth - inst.options.totalwidth >= marginLeft) {
marginLeft = maskWidth - inst.options.totalwidth;
$(this).css({ "background-position": "center left" });
} else {
$(this).css({ "background-position": "center right" });
}
if (marginLeft >= 0) {
$navPrev.css({ "background-position": "center left" });
} else {
$navPrev.css({ "background-position": "center right" });
}
$navList.animate({ "margin-left": marginLeft });
}
);
var winWidth = $(window).width();
if (winWidth >= inst.options.totalwidth ) {
$navMask.css({ width: inst.options.totalwidth + "px" });
$navPrev.hide();
$navNext.hide();
} else {
$navMask.css({ width: winWidth - 2 * inst.options.navbuttonwidth + "px" });
$navPrev.show();
$navNext.show();
}
};
inst.loadElem = function (elem) {
inst.currentElem = elem;
inst.showing = true;
inst.showNavigation();
inst.$elem.unbind("mouseenter").unbind("mouseleave").unbind("mousemove");
inst.$loading.show();
if (inst.options.onshowitem && window[inst.options.onshowitem] && typeof window[inst.options.onshowitem] == "function") {
window[inst.options.onshowitem](elem);
}
switch (elem[ELEM_TYPE]) {
case 0:
var imgLoader = new Image();
$(imgLoader).load(
function () {
inst.showImage(elem, imgLoader.width, imgLoader.height);
}
);
$(imgLoader).error(
function () {
inst.showError();
}
);
imgLoader.src = elem[ELEM_HREF];
break;
case 1:
inst.showSWF(elem);
break;
case 2:
case 8:
inst.showVideo(elem);
break;
case 3:
case 4:
case 9:
case 11:
inst.showYoutubeVimeo(elem);
break;
case 5:
inst.showPDF(elem);
break;
case 6:
inst.showMP3(elem);
break;
case 7:
inst.showWeb(elem);
break;
case 10:
inst.showDiv(elem);
break;
}
if (inst.options.googleanalyticsaccount && window._gaq) {
window._gaq.push(["_trackEvent", "Lightbox", "Open", elem[ELEM_HREF]]);
}
};
inst.loadCurElem = function () {
inst.loadElem(inst.elemArray[inst.options.curElem]);
};
inst.showError = function () {
inst.$loading.hide();
inst.resizeLightbox(
inst.options.errorwidth,
inst.options.errorheight,
true,
function () {
inst.$error.show();
inst.$elem.fadeIn(
inst.options.fadespeed,
function () {
inst.showData();
}
);
}
);
};
inst.calcTextWidth = function (objW) {
return objW - 36;
};
(inst.showTitle = function (w, t, description) {
if (inst.options.titlestyle == "inside") {
inst.$elemData.css({ width: w + "px" });
}
var text = "";
if (inst.options.showtitle) {
if (t && t.length > 0) {
text += t;
}
}
if (inst.options.inGroup) {
if (inst.options.showtitleprefix) {
text = inst.options.titleprefix.replace("%NUM", inst.options.groupIndex + 1).replace("%TOTAL", inst.options.groupCount) + " " + text;
}
jQuery("#tsvg-fancy-html5-elem-data-box").css("display", "none");
if (inst.options.showplaybutton && TotalSoft_VG_FG_ShSlPlIc == "true" && TotalSoft_GV_FG_PT != "true") {
jQuery("#tsvg-fancy-html5-elem-data-box")
.css("display", "inline-block")
.html(
"
';
}
if (inst.options.showtwitter) {
socialCode +=
'
';
}
if (inst.options.showpinterest) {
socialCode +=
'
';
}
socialCode += "
";
inst.$lightboxBox.append(socialCode);
$(".tsvg-fancy-html5-social-btn", inst.$lightbox).click(
function () {
var shareUrl = window.location.href + (0 > window.location.href.indexOf("?") ? "?" : "&") + "html5lightboxshare=" + encodeURIComponent(inst.currentElem[ELEM_HREF]);
var shareTitle = inst.currentElem[ELEM_TITLE];
var shareMedia = inst.currentElem[ELEM_HREF];
if (inst.currentElem[ELEM_TYPE] == 0) {
shareMedia = inst.absoluteUrl(inst.currentElem[ELEM_HREF]);
} else if (inst.currentElem[ELEM_TYPE] == 3) {
shareMedia = "https://img.youtube.com/vi/" + inst.getYoutubeId(inst.currentElem[ELEM_HREF]) + "/0.jpg";
} else {
var lightboxLink = $('.tsvg-html5lightbox-931430[href="' + inst.currentElem[ELEM_HREF] + '"]');
if (lightboxLink.length > 0)
if (lightboxLink.data("shareimage") && lightboxLink.data("shareimage").length > 0) {
shareMedia = inst.absoluteUrl(lightboxLink.data("shareimage"));
} else if (lightboxLink.data("thumbnail") && lightboxLink.data("thumbnail").length > 0) {
shareMedia = inst.absoluteUrl(lightboxLink.data("thumbnail"));
} else {
var lightboxImg = $("img", lightboxLink);
if (lightboxImg.length > 0) {
shareMedia = inst.absoluteUrl(lightboxImg.attr("src"));
}
}
}
var isVideo =
inst.currentElem[ELEM_TYPE] == 2 ||
inst.currentElem[ELEM_TYPE] == 3 ||
inst.currentElem[ELEM_TYPE] == 4 ||
inst.currentElem[ELEM_TYPE] == 8 ||
inst.currentElem[ELEM_TYPE] == 9 ||
inst.currentElem[ELEM_TYPE] == 11;
if ($(this).hasClass("tsvg-fancy-html5-social-facebook")) {
window.open("https://www.facebook.com/sharer/sharer.php?u=" + encodeURIComponent(shareUrl) + "&t=" + encodeURIComponent(shareTitle), "_blank");
} else if ($(this).hasClass("tsvg-fancy-html5-social-twitter")) {
window.open("https://twitter.com/share?url=" + encodeURIComponent(shareUrl) + "&text=" + encodeURIComponent(shareTitle), "_blank");
} else if ($(this).hasClass("tsvg-fancy-html5-social-pinterest")) {
window.open(
"https://pinterest.com/pin/create/bookmarklet/?media=" +
encodeURIComponent(shareMedia) +
"&url=" +
encodeURIComponent(shareUrl) +
"&description=" +
encodeURIComponent(shareTitle) +
"&is_video=" +
(isVideo ? "true" : "false"),
"_blank"
);
}
return false;
}
);
}
inst.$watermark = $("#tsvg-fancy-html5-watermark", inst.$lightbox);
if (inst.options.stamp) {
inst.$watermark.html("");
} else if (inst.options.watermark) {
var html = "";
if (inst.options.watermarklink) {
html = "" + html + "";
}
inst.$watermark.html(html);
}
if (inst.options.closeonoverlay) {
$("#tsvg-fancy-html5-lightbox-overlay", inst.$lightbox).click(inst.finish);
}
inst.$close.click(inst.finish);
inst.$next.click(
function () {
inst.nextArrowClicked();
}
);
inst.$prev.click(
function () {
inst.prevArrowClicked();
}
);
$(window).resize(
function () {
clearTimeout(inst.options.resizeTimeout);
inst.options.resizeTimeout = setTimeout(
function () {
inst.resizeWindow();
},
500
);
}
);
$(window).scroll(
function () {
inst.scrollBox();
}
);
$(window).bind(
"orientationchange",
function (e) {
if (inst.options.isMobile) {
inst.resizeWindow();
}
}
);
if (inst.options.isIPhone) {
inst.options.windowInnerHeight = window.innerHeight;
setInterval(
function () {
if (inst.options.windowInnerHeight != window.innerHeight) {
inst.options.windowInnerHeight = window.innerHeight;
inst.resizeWindow();
}
},
500
);
}
if (inst.options.enabletouchswipe) {
inst.enableSwipe();
}
};
inst.slideTimer = function (interval, callback, updatecallback) {
let timerInstance = this,
updateinterval = 50,
updateTimerId = null,
runningTime = 0,
paused = false,
started = false,
startedandpaused = false;
timerInstance.timeout = interval;
this.pause = function () {
if (started) {
paused = true;
clearInterval(updateTimerId);
}
};
this.resume = function (forceresume) {
if (startedandpaused && !forceresume) {
return;
}
startedandpaused = false;
if (started && paused) {
paused = false;
updateTimerId = setInterval(
function () {
runningTime += updateinterval;
if (runningTime > timerInstance.timeout) {
clearInterval(updateTimerId);
if (callback) {
callback();
}
}
if (updatecallback) {
updatecallback(runningTime / timerInstance.timeout);
}
},
updateinterval
);
}
};
this.stop = function () {
clearInterval(updateTimerId);
if (updatecallback) {
updatecallback(-1);
}
runningTime = 0;
paused = false;
started = false;
};
this.start = function () {
runningTime = 0;
paused = false;
started = true;
updateTimerId = setInterval(
function () {
runningTime += updateinterval;
if (runningTime > timerInstance.timeout) {
clearInterval(updateTimerId);
if (callback) {
callback();
}
}
if (updatecallback) {
updatecallback(runningTime / timerInstance.timeout);
}
},
updateinterval
);
};
this.startandpause = function () {
runningTime = 0;
paused = true;
started = true;
startedandpaused = true;
};
return this;
};
inst.updateTimer = function (percent) {
var w = Math.round(percent * 100);
if (w > 100) {
w = 100;
}
if (0 > w ) {
w = 0;
}
$("#tsvg-fancy-html5-timer", inst.$lightbox).css({ display: "block", width: w + "%" });
};
inst.initSlide = function () {
inst.autosliding = false;
inst.slideTimeout = inst.slideTimer(
inst.options.slideinterval,
function () {
inst.gotoSlide(-1);
},
inst.options.showtimer
? function (percent) {
inst.updateTimer(percent);
}
: null
);
if (inst.options.autoslide) {
inst.slideTimeout.stop();
inst.autosliding = true;
}
};
inst.nextArrowClicked = function () {
if (inst.options.curElem >= inst.options.nextElem) {
if (inst.options.onlastarrowclicked && window[inst.options.onlastarrowclicked] && typeof window[inst.options.onlastarrowclicked] == "function") {
window[inst.options.onlastarrowclicked]();
}
}
inst.gotoSlide(-1);
};
inst.prevArrowClicked = function () {
if (inst.options.prevElem >= inst.options.curElem) {
if (inst.options.onfirstarrowclicked && window[inst.options.onfirstarrowclicked] && typeof window[inst.options.onfirstarrowclicked] == "function") {
window[inst.options.onfirstarrowclicked]();
}
}
inst.gotoSlide(-2);
};
inst.calcNextPrevElem = function () {
inst.options.nextElem = -1;
inst.options.prevElem = -1;
inst.options.inGroup = false;
inst.options.groupIndex = 0;
inst.options.groupCount = 0;
var group = inst.elemArray[inst.options.curElem][ELEM_GROUP];
for (var i = 0; inst.elemArray.length > i; i++) {
if (inst.matchGroup(group, inst.elemArray[i][ELEM_GROUP])) {
if (i == inst.options.curElem) {
inst.options.groupIndex = inst.options.groupCount;
}
inst.options.groupCount++;
}
}
var j,
curGroup = inst.elemArray[inst.options.curElem][ELEM_GROUP];
if (curGroup != undefined && curGroup != null) {
for (j = inst.options.curElem + 1;inst.elemArray.length > j; j++) {
if (inst.matchGroup(curGroup, inst.elemArray[j][ELEM_GROUP])) {
inst.options.nextElem = j;
break;
}
}
if (0 > inst.options.nextElem) {
for (j = 0; inst.options.curElem > j ; j++) {
if (inst.matchGroup(curGroup, inst.elemArray[j][ELEM_GROUP])) {
inst.options.nextElem = j;
break;
}
}
}
if (inst.options.nextElem >= 0) {
for (j = inst.options.curElem - 1; j >= 0; j--) {
if (inst.matchGroup(curGroup, inst.elemArray[j][ELEM_GROUP])) {
inst.options.prevElem = j;
break;
}
}
if (0 > inst.options.prevElem ) {
for (j = inst.elemArray.length - 1; j > inst.options.curElem; j--) {
if (inst.matchGroup(curGroup, inst.elemArray[j][ELEM_GROUP])) {
inst.options.prevElem = j;
break;
}
}
}
}
}
if (inst.options.nextElem >= 0 || inst.options.prevElem >= 0) {
inst.options.inGroup = true;
}
};
inst.calcBoxPosition = function (initW, initH) {
var boxW = initW + 2 * inst.options.bordersize;
var boxH = initH + 2 * inst.options.bordersize;
var winH = window.innerHeight ? window.innerHeight : $(window).height();
var boxT = Math.round((winH - inst.options.navheight) / 2 - boxH / 2);
if (inst.options.titlestyle == "bottom") {
boxT -= Math.round(inst.options.barheight / 2);
}
var topmargin = inst.options.navarrowsbottomscreenwidth > $(window).width() ? inst.options.bordertopmarginsmall : inst.options.bordertopmargin;
if (topmargin > boxT) {
boxT = topmargin;
}
if (inst.options.insideiframe && window.self != window.top) {
if (parent.window.jQuery && parent.window.jQuery("#" + inst.options.iframeid).length) {
var iframetop = parent.window.jQuery("#" + inst.options.iframeid).offset().top;
var parentscroll = parent.window.document.body.scrollTop;
boxT = topmargin;
boxT += parentscroll > iframetop ? parentscroll - iframetop : 0;
}
}
return [boxW, boxH, boxT];
};
inst.hideNavArrows = function () {
var showPrev = false;
var showNext = false;
if (inst.options.inGroup) {
if (inst.options.arrowloop || (!inst.options.arrowloop && inst.options.curElem > inst.options.prevElem )) {
showPrev = true;
}
if (inst.options.arrowloop || (!inst.options.arrowloop && inst.options.curElem > inst.options.prevElem )) {
showNext = true;
}
}
if (showPrev) {
inst.$prev.removeClass("tsvg-fancy-html5-hide");
if (inst.$prevbottom) {
inst.$prevbottom.removeClass("tsvg-fancy-html5-hide");
}
if (inst.$prevtouch) {
inst.$prevtouch.removeClass("tsvg-fancy-html5-hide");
}
} else {
inst.$prev.addClass("tsvg-fancy-html5-hide");
if (inst.$prevbottom) {
inst.$prevbottom.addClass("tsvg-fancy-html5-hide");
}
if (inst.$prevtouch) {
inst.$prevtouch.addClass("tsvg-fancy-html5-hide");
}
}
if (showNext) {
inst.$next.removeClass("tsvg-fancy-html5-hide");
if (inst.$nextbottom) {
inst.$nextbottom.removeClass("tsvg-fancy-html5-hide");
}
if (inst.$nexttouch) {
inst.$nexttouch.removeClass("tsvg-fancy-html5-hide");
}
} else {
inst.$next.addClass("tsvg-fancy-html5-hide");
if (inst.$nextbottom) {
inst.$nextbottom.addClass("tsvg-fancy-html5-hide");
}
if (inst.$nexttouch) {
inst.$nexttouch.addClass("tsvg-fancy-html5-hide");
}
}
};
inst.clickHandler = function (event) {
var $this = $(this);
var dataoptions = {};
if (jQuery(event.target).prop("tagName") == 'A') {
let link = jQuery(event.target).attr('href');
if (jQuery(event.target).attr('target') == '_blank') {
window.open(link);
} else {
window.location.assign(link)
}
return false;
}
$.each(
$this.data(),
function (key, value) {
dataoptions[key.toLowerCase()] = value;
}
);
inst.options = $.extend(inst.options, inst.defaultoptions, dataoptions);
$(window).trigger("html5lightbox.lightboxshow");
inst.init();
if (0 >= inst.elemArray.length) {
return true;
}
inst.hideObjects();
for (var i = 0; inst.elemArray.length > i ; i++) {
if (inst.elemArray[i][ELEM_ID] == $this.data("tsvgid")) {
break;
}
}
if (i == inst.elemArray.length) {
return true;
}
inst.options.curElem = i;
inst.calcNextPrevElem();
inst.reset();
inst.$lightbox.show();
var boxPos = inst.calcBoxPosition(inst.options.loadingwidth, inst.options.loadingheight);
var boxW = boxPos[0];
var boxH = boxPos[1];
var boxT = boxPos[2];
if (inst.options.iequirksmode) {
inst.$lightboxBox.css({ top: boxT });
} else {
inst.$lightboxBox.css({ "margin-top": boxT });
}
if (!inst.options.positionFixed) {
inst.$lightboxBox.css("margin-top", $(window).scrollTop() + inst.options.bordertopmargin);
}
if (inst.options.titlestyle == "left" || inst.options.titlestyle == "right") {
inst.$lightboxBox.css({ width: boxW, height: boxH });
} else {
inst.$lightboxBox.css({ width: boxW, height: "auto" });
inst.$elemWrap.css({ width: boxW, height: boxH });
}
inst.loadCurElem();
return false;
};
inst.loadThumbnail = function (src, index) {
let inst_img_elem = document.createElement('img');
inst_img_elem.src = src;
inst_img_elem.addEventListener('load', function () {
if (inst.options.thumbwidth / inst.options.thumbheight >= inst_img_elem.naturalWidth / inst_img_elem.naturalHeight ) {
inst_img_elem.setAttribute("style","width:100%;")
} else {
inst_img_elem.setAttribute("style","height:100%;")
}
$(".tsvg-fancy-html5-nav-thumb").eq(index).html(inst_img_elem);
})
inst_img_elem.addEventListener('error', function () {
console.log('error')
})
};
inst.matchGroup = function (curGroup, elemGroup) {
if (!curGroup || !elemGroup) {
return false;
}
var curs = curGroup.split(":");
var elems = elemGroup.split(":");
var result = false;
for (var i in curs) {
if ($.inArray(curs[i], elems) > -1) {
result = true;
break;
}
}
return result;
};
inst.showNavigation = function () {
if (!inst.options.shownavigation) {
return;
}
if (!inst.currentElem || !inst.currentElem[ELEM_GROUP]) {
return;
}
var i;
var showNav = false;
var group = inst.currentElem[ELEM_GROUP];
for (i = 0; inst.elemArray.length > i ; i++) {
if (inst.matchGroup(group, inst.elemArray[i][ELEM_GROUP])) {
if (inst.elemArray[i][ELEM_THUMBNAIL] && inst.elemArray[i][ELEM_THUMBNAIL].length > 0) {
showNav = true;
break;
}
}
}
if (!showNav) {
return;
}
inst.options.navheight = inst.options.thumbheight + inst.options.thumbtopmargin + inst.options.thumbbottommargin;
if ($(".tsvg-fancy-html5-nav").length > 0) {
return;
}
var check_bool = $('.tsvg-fancy-blocks-container').attr('data-tsvg-shn');
if (check_bool === 'false') {
return
}
$("body").append(
"
" +
"
" +
"
" +
"
" +
"" +
"
" +
"
" +
"
" +
"
"
);
if (TS_VG_FG_Show_Nav == "true") {
var index = 0;
}
for (i = 0; inst.elemArray.length > i ; i++) {
if (inst.matchGroup(group, inst.elemArray[i][ELEM_GROUP])) {
if (inst.elemArray[i][ELEM_THUMBNAIL] && inst.elemArray[i][ELEM_THUMBNAIL].length > 0) {
$(".tsvg-fancy-html5-nav-list").append(
"
'
"
);
this.loadThumbnail(inst.elemArray[i][ELEM_THUMBNAIL], index)
index++;
}
}
}
$(".tsvg-fancy-html5-nav-thumb").hover(
function () {
$(this).css({ opacity: 1 });
$(this).css({ border: inst.options.thumbborder + "px solid " + inst.options.thumbhighlightbordercolor });
},
function () {
$(this).css({ opacity: inst.options.thumbopacity });
$(this).css({ border: inst.options.thumbborder + "px solid " + inst.options.thumbbordercolor });
}
);
$(".tsvg-fancy-html5-nav-thumb").click(
function () {
var index = $(this).data("arrayindex");
if (index >= 0) {
inst.gotoSlide(index);
}
}
);
inst.options.totalwidth = index * (inst.options.thumbgap + inst.options.thumbwidth + 2 * inst.options.thumbborder);
$(".tsvg-fancy-html5-nav-list")
.css({ display: "block", position: "relative", "margin-left": 0, width: inst.options.totalwidth + "px" })
.append("");
var $navMask = $(".tsvg-fancy-html5-nav-mask");
var $navPrev = $(".tsvg-fancy-html5-nav-prev");
var $navNext = $(".tsvg-fancy-html5-nav-next");
$navPrev.click(
function () {
var $navList = $(".tsvg-fancy-html5-nav-list");
var $navNext = $(".tsvg-fancy-html5-nav-next");
var winWidth = $(window).width();
var maskWidth = winWidth - 2 * inst.options.navbuttonwidth;
var marginLeft = parseInt($navList.css("margin-left")) + maskWidth;
if (marginLeft >= 0) {
marginLeft = 0;
$(this).css({ "background-position": "center left" });
} else {
$(this).css({ "background-position": "center right" });
}
if (maskWidth - inst.options.totalwidth >= marginLeft ) {
$navNext.css({ "background-position": "center left" });
} else {
$navNext.css({ "background-position": "center right" });
}
$navList.animate({ "margin-left": marginLeft });
}
);
$navNext.click(
function () {
var $navList = $(".tsvg-fancy-html5-nav-list");
var $navPrev = $(".tsvg-fancy-html5-nav-prev");
var winWidth = $(window).width();
var maskWidth = winWidth - 2 * inst.options.navbuttonwidth;
var marginLeft = parseInt($navList.css("margin-left")) - maskWidth;
if (maskWidth - inst.options.totalwidth >= marginLeft) {
marginLeft = maskWidth - inst.options.totalwidth;
$(this).css({ "background-position": "center left" });
} else {
$(this).css({ "background-position": "center right" });
}
if (marginLeft >= 0) {
$navPrev.css({ "background-position": "center left" });
} else {
$navPrev.css({ "background-position": "center right" });
}
$navList.animate({ "margin-left": marginLeft });
}
);
var winWidth = $(window).width();
if (winWidth >= inst.options.totalwidth ) {
$navMask.css({ width: inst.options.totalwidth + "px" });
$navPrev.hide();
$navNext.hide();
} else {
$navMask.css({ width: winWidth - 2 * inst.options.navbuttonwidth + "px" });
$navPrev.show();
$navNext.show();
}
};
inst.loadElem = function (elem) {
inst.currentElem = elem;
inst.showing = true;
inst.showNavigation();
inst.$elem.unbind("mouseenter").unbind("mouseleave").unbind("mousemove");
inst.$loading.show();
if (inst.options.onshowitem && window[inst.options.onshowitem] && typeof window[inst.options.onshowitem] == "function") {
window[inst.options.onshowitem](elem);
}
switch (elem[ELEM_TYPE]) {
case 0:
var imgLoader = new Image();
$(imgLoader).load(
function () {
inst.showImage(elem, imgLoader.width, imgLoader.height);
}
);
$(imgLoader).error(
function () {
inst.showError();
}
);
imgLoader.src = elem[ELEM_HREF];
break;
case 1:
inst.showSWF(elem);
break;
case 2:
case 8:
inst.showVideo(elem);
break;
case 3:
case 4:
case 9:
case 11:
inst.showYoutubeVimeo(elem);
break;
case 5:
inst.showPDF(elem);
break;
case 6:
inst.showMP3(elem);
break;
case 7:
inst.showWeb(elem);
break;
case 10:
inst.showDiv(elem);
break;
}
if (inst.options.googleanalyticsaccount && window._gaq) {
window._gaq.push(["_trackEvent", "Lightbox", "Open", elem[ELEM_HREF]]);
}
};
inst.loadCurElem = function () {
inst.loadElem(inst.elemArray[inst.options.curElem]);
};
inst.showError = function () {
inst.$loading.hide();
inst.resizeLightbox(
inst.options.errorwidth,
inst.options.errorheight,
true,
function () {
inst.$error.show();
inst.$elem.fadeIn(
inst.options.fadespeed,
function () {
inst.showData();
}
);
}
);
};
inst.calcTextWidth = function (objW) {
return objW - 36;
};
(inst.showTitle = function (w, t, description) {
if (inst.options.titlestyle == "inside") {
inst.$elemData.css({ width: w + "px" });
}
var text = "";
if (inst.options.showtitle) {
if (t && t.length > 0) {
text += t;
}
}
if (inst.options.inGroup) {
if (inst.options.showtitleprefix) {
text = inst.options.titleprefix.replace("%NUM", inst.options.groupIndex + 1).replace("%TOTAL", inst.options.groupCount) + " " + text;
}
jQuery("#tsvg-fancy-html5-elem-data-box").css("display", "none");
if (inst.options.showplaybutton && TotalSoft_VG_FG_ShSlPlIc == "true" && TotalSoft_GV_FG_PT != "true") {
jQuery("#tsvg-fancy-html5-elem-data-box")
.css("display", "inline-block")
.html(
"
';
}
if (inst.options.showtwitter) {
socialCode +=
'
';
}
if (inst.options.showpinterest) {
socialCode +=
'
';
}
socialCode += "
";
inst.$lightboxBox.append(socialCode);
$(".tsvg-fancy-html5-social-btn", inst.$lightbox).click(
function () {
var shareUrl = window.location.href + (0 > window.location.href.indexOf("?") ? "?" : "&") + "html5lightboxshare=" + encodeURIComponent(inst.currentElem[ELEM_HREF]);
var shareTitle = inst.currentElem[ELEM_TITLE];
var shareMedia = inst.currentElem[ELEM_HREF];
if (inst.currentElem[ELEM_TYPE] == 0) {
shareMedia = inst.absoluteUrl(inst.currentElem[ELEM_HREF]);
} else if (inst.currentElem[ELEM_TYPE] == 3) {
shareMedia = "https://img.youtube.com/vi/" + inst.getYoutubeId(inst.currentElem[ELEM_HREF]) + "/0.jpg";
} else {
var lightboxLink = $('.tsvg-html5lightbox-744241[href="' + inst.currentElem[ELEM_HREF] + '"]');
if (lightboxLink.length > 0)
if (lightboxLink.data("shareimage") && lightboxLink.data("shareimage").length > 0) {
shareMedia = inst.absoluteUrl(lightboxLink.data("shareimage"));
} else if (lightboxLink.data("thumbnail") && lightboxLink.data("thumbnail").length > 0) {
shareMedia = inst.absoluteUrl(lightboxLink.data("thumbnail"));
} else {
var lightboxImg = $("img", lightboxLink);
if (lightboxImg.length > 0) {
shareMedia = inst.absoluteUrl(lightboxImg.attr("src"));
}
}
}
var isVideo =
inst.currentElem[ELEM_TYPE] == 2 ||
inst.currentElem[ELEM_TYPE] == 3 ||
inst.currentElem[ELEM_TYPE] == 4 ||
inst.currentElem[ELEM_TYPE] == 8 ||
inst.currentElem[ELEM_TYPE] == 9 ||
inst.currentElem[ELEM_TYPE] == 11;
if ($(this).hasClass("tsvg-fancy-html5-social-facebook")) {
window.open("https://www.facebook.com/sharer/sharer.php?u=" + encodeURIComponent(shareUrl) + "&t=" + encodeURIComponent(shareTitle), "_blank");
} else if ($(this).hasClass("tsvg-fancy-html5-social-twitter")) {
window.open("https://twitter.com/share?url=" + encodeURIComponent(shareUrl) + "&text=" + encodeURIComponent(shareTitle), "_blank");
} else if ($(this).hasClass("tsvg-fancy-html5-social-pinterest")) {
window.open(
"https://pinterest.com/pin/create/bookmarklet/?media=" +
encodeURIComponent(shareMedia) +
"&url=" +
encodeURIComponent(shareUrl) +
"&description=" +
encodeURIComponent(shareTitle) +
"&is_video=" +
(isVideo ? "true" : "false"),
"_blank"
);
}
return false;
}
);
}
inst.$watermark = $("#tsvg-fancy-html5-watermark", inst.$lightbox);
if (inst.options.stamp) {
inst.$watermark.html("");
} else if (inst.options.watermark) {
var html = "";
if (inst.options.watermarklink) {
html = "" + html + "";
}
inst.$watermark.html(html);
}
if (inst.options.closeonoverlay) {
$("#tsvg-fancy-html5-lightbox-overlay", inst.$lightbox).click(inst.finish);
}
inst.$close.click(inst.finish);
inst.$next.click(
function () {
inst.nextArrowClicked();
}
);
inst.$prev.click(
function () {
inst.prevArrowClicked();
}
);
$(window).resize(
function () {
clearTimeout(inst.options.resizeTimeout);
inst.options.resizeTimeout = setTimeout(
function () {
inst.resizeWindow();
},
500
);
}
);
$(window).scroll(
function () {
inst.scrollBox();
}
);
$(window).bind(
"orientationchange",
function (e) {
if (inst.options.isMobile) {
inst.resizeWindow();
}
}
);
if (inst.options.isIPhone) {
inst.options.windowInnerHeight = window.innerHeight;
setInterval(
function () {
if (inst.options.windowInnerHeight != window.innerHeight) {
inst.options.windowInnerHeight = window.innerHeight;
inst.resizeWindow();
}
},
500
);
}
if (inst.options.enabletouchswipe) {
inst.enableSwipe();
}
};
inst.slideTimer = function (interval, callback, updatecallback) {
let timerInstance = this,
updateinterval = 50,
updateTimerId = null,
runningTime = 0,
paused = false,
started = false,
startedandpaused = false;
timerInstance.timeout = interval;
this.pause = function () {
if (started) {
paused = true;
clearInterval(updateTimerId);
}
};
this.resume = function (forceresume) {
if (startedandpaused && !forceresume) {
return;
}
startedandpaused = false;
if (started && paused) {
paused = false;
updateTimerId = setInterval(
function () {
runningTime += updateinterval;
if (runningTime > timerInstance.timeout) {
clearInterval(updateTimerId);
if (callback) {
callback();
}
}
if (updatecallback) {
updatecallback(runningTime / timerInstance.timeout);
}
},
updateinterval
);
}
};
this.stop = function () {
clearInterval(updateTimerId);
if (updatecallback) {
updatecallback(-1);
}
runningTime = 0;
paused = false;
started = false;
};
this.start = function () {
runningTime = 0;
paused = false;
started = true;
updateTimerId = setInterval(
function () {
runningTime += updateinterval;
if (runningTime > timerInstance.timeout) {
clearInterval(updateTimerId);
if (callback) {
callback();
}
}
if (updatecallback) {
updatecallback(runningTime / timerInstance.timeout);
}
},
updateinterval
);
};
this.startandpause = function () {
runningTime = 0;
paused = true;
started = true;
startedandpaused = true;
};
return this;
};
inst.updateTimer = function (percent) {
var w = Math.round(percent * 100);
if (w > 100) {
w = 100;
}
if (0 > w ) {
w = 0;
}
$("#tsvg-fancy-html5-timer", inst.$lightbox).css({ display: "block", width: w + "%" });
};
inst.initSlide = function () {
inst.autosliding = false;
inst.slideTimeout = inst.slideTimer(
inst.options.slideinterval,
function () {
inst.gotoSlide(-1);
},
inst.options.showtimer
? function (percent) {
inst.updateTimer(percent);
}
: null
);
if (inst.options.autoslide) {
inst.slideTimeout.stop();
inst.autosliding = true;
}
};
inst.nextArrowClicked = function () {
if (inst.options.curElem >= inst.options.nextElem) {
if (inst.options.onlastarrowclicked && window[inst.options.onlastarrowclicked] && typeof window[inst.options.onlastarrowclicked] == "function") {
window[inst.options.onlastarrowclicked]();
}
}
inst.gotoSlide(-1);
};
inst.prevArrowClicked = function () {
if (inst.options.prevElem >= inst.options.curElem) {
if (inst.options.onfirstarrowclicked && window[inst.options.onfirstarrowclicked] && typeof window[inst.options.onfirstarrowclicked] == "function") {
window[inst.options.onfirstarrowclicked]();
}
}
inst.gotoSlide(-2);
};
inst.calcNextPrevElem = function () {
inst.options.nextElem = -1;
inst.options.prevElem = -1;
inst.options.inGroup = false;
inst.options.groupIndex = 0;
inst.options.groupCount = 0;
var group = inst.elemArray[inst.options.curElem][ELEM_GROUP];
for (var i = 0; inst.elemArray.length > i; i++) {
if (inst.matchGroup(group, inst.elemArray[i][ELEM_GROUP])) {
if (i == inst.options.curElem) {
inst.options.groupIndex = inst.options.groupCount;
}
inst.options.groupCount++;
}
}
var j,
curGroup = inst.elemArray[inst.options.curElem][ELEM_GROUP];
if (curGroup != undefined && curGroup != null) {
for (j = inst.options.curElem + 1;inst.elemArray.length > j; j++) {
if (inst.matchGroup(curGroup, inst.elemArray[j][ELEM_GROUP])) {
inst.options.nextElem = j;
break;
}
}
if (0 > inst.options.nextElem) {
for (j = 0; inst.options.curElem > j ; j++) {
if (inst.matchGroup(curGroup, inst.elemArray[j][ELEM_GROUP])) {
inst.options.nextElem = j;
break;
}
}
}
if (inst.options.nextElem >= 0) {
for (j = inst.options.curElem - 1; j >= 0; j--) {
if (inst.matchGroup(curGroup, inst.elemArray[j][ELEM_GROUP])) {
inst.options.prevElem = j;
break;
}
}
if (0 > inst.options.prevElem ) {
for (j = inst.elemArray.length - 1; j > inst.options.curElem; j--) {
if (inst.matchGroup(curGroup, inst.elemArray[j][ELEM_GROUP])) {
inst.options.prevElem = j;
break;
}
}
}
}
}
if (inst.options.nextElem >= 0 || inst.options.prevElem >= 0) {
inst.options.inGroup = true;
}
};
inst.calcBoxPosition = function (initW, initH) {
var boxW = initW + 2 * inst.options.bordersize;
var boxH = initH + 2 * inst.options.bordersize;
var winH = window.innerHeight ? window.innerHeight : $(window).height();
var boxT = Math.round((winH - inst.options.navheight) / 2 - boxH / 2);
if (inst.options.titlestyle == "bottom") {
boxT -= Math.round(inst.options.barheight / 2);
}
var topmargin = inst.options.navarrowsbottomscreenwidth > $(window).width() ? inst.options.bordertopmarginsmall : inst.options.bordertopmargin;
if (topmargin > boxT) {
boxT = topmargin;
}
if (inst.options.insideiframe && window.self != window.top) {
if (parent.window.jQuery && parent.window.jQuery("#" + inst.options.iframeid).length) {
var iframetop = parent.window.jQuery("#" + inst.options.iframeid).offset().top;
var parentscroll = parent.window.document.body.scrollTop;
boxT = topmargin;
boxT += parentscroll > iframetop ? parentscroll - iframetop : 0;
}
}
return [boxW, boxH, boxT];
};
inst.hideNavArrows = function () {
var showPrev = false;
var showNext = false;
if (inst.options.inGroup) {
if (inst.options.arrowloop || (!inst.options.arrowloop && inst.options.curElem > inst.options.prevElem )) {
showPrev = true;
}
if (inst.options.arrowloop || (!inst.options.arrowloop && inst.options.curElem > inst.options.prevElem )) {
showNext = true;
}
}
if (showPrev) {
inst.$prev.removeClass("tsvg-fancy-html5-hide");
if (inst.$prevbottom) {
inst.$prevbottom.removeClass("tsvg-fancy-html5-hide");
}
if (inst.$prevtouch) {
inst.$prevtouch.removeClass("tsvg-fancy-html5-hide");
}
} else {
inst.$prev.addClass("tsvg-fancy-html5-hide");
if (inst.$prevbottom) {
inst.$prevbottom.addClass("tsvg-fancy-html5-hide");
}
if (inst.$prevtouch) {
inst.$prevtouch.addClass("tsvg-fancy-html5-hide");
}
}
if (showNext) {
inst.$next.removeClass("tsvg-fancy-html5-hide");
if (inst.$nextbottom) {
inst.$nextbottom.removeClass("tsvg-fancy-html5-hide");
}
if (inst.$nexttouch) {
inst.$nexttouch.removeClass("tsvg-fancy-html5-hide");
}
} else {
inst.$next.addClass("tsvg-fancy-html5-hide");
if (inst.$nextbottom) {
inst.$nextbottom.addClass("tsvg-fancy-html5-hide");
}
if (inst.$nexttouch) {
inst.$nexttouch.addClass("tsvg-fancy-html5-hide");
}
}
};
inst.clickHandler = function (event) {
var $this = $(this);
var dataoptions = {};
if (jQuery(event.target).prop("tagName") == 'A') {
let link = jQuery(event.target).attr('href');
if (jQuery(event.target).attr('target') == '_blank') {
window.open(link);
} else {
window.location.assign(link)
}
return false;
}
$.each(
$this.data(),
function (key, value) {
dataoptions[key.toLowerCase()] = value;
}
);
inst.options = $.extend(inst.options, inst.defaultoptions, dataoptions);
$(window).trigger("html5lightbox.lightboxshow");
inst.init();
if (0 >= inst.elemArray.length) {
return true;
}
inst.hideObjects();
for (var i = 0; inst.elemArray.length > i ; i++) {
if (inst.elemArray[i][ELEM_ID] == $this.data("tsvgid")) {
break;
}
}
if (i == inst.elemArray.length) {
return true;
}
inst.options.curElem = i;
inst.calcNextPrevElem();
inst.reset();
inst.$lightbox.show();
var boxPos = inst.calcBoxPosition(inst.options.loadingwidth, inst.options.loadingheight);
var boxW = boxPos[0];
var boxH = boxPos[1];
var boxT = boxPos[2];
if (inst.options.iequirksmode) {
inst.$lightboxBox.css({ top: boxT });
} else {
inst.$lightboxBox.css({ "margin-top": boxT });
}
if (!inst.options.positionFixed) {
inst.$lightboxBox.css("margin-top", $(window).scrollTop() + inst.options.bordertopmargin);
}
if (inst.options.titlestyle == "left" || inst.options.titlestyle == "right") {
inst.$lightboxBox.css({ width: boxW, height: boxH });
} else {
inst.$lightboxBox.css({ width: boxW, height: "auto" });
inst.$elemWrap.css({ width: boxW, height: boxH });
}
inst.loadCurElem();
return false;
};
inst.loadThumbnail = function (src, index) {
let inst_img_elem = document.createElement('img');
inst_img_elem.src = src;
inst_img_elem.addEventListener('load', function () {
if (inst.options.thumbwidth / inst.options.thumbheight >= inst_img_elem.naturalWidth / inst_img_elem.naturalHeight ) {
inst_img_elem.setAttribute("style","width:100%;")
} else {
inst_img_elem.setAttribute("style","height:100%;")
}
$(".tsvg-fancy-html5-nav-thumb").eq(index).html(inst_img_elem);
})
inst_img_elem.addEventListener('error', function () {
console.log('error')
})
};
inst.matchGroup = function (curGroup, elemGroup) {
if (!curGroup || !elemGroup) {
return false;
}
var curs = curGroup.split(":");
var elems = elemGroup.split(":");
var result = false;
for (var i in curs) {
if ($.inArray(curs[i], elems) > -1) {
result = true;
break;
}
}
return result;
};
inst.showNavigation = function () {
if (!inst.options.shownavigation) {
return;
}
if (!inst.currentElem || !inst.currentElem[ELEM_GROUP]) {
return;
}
var i;
var showNav = false;
var group = inst.currentElem[ELEM_GROUP];
for (i = 0; inst.elemArray.length > i ; i++) {
if (inst.matchGroup(group, inst.elemArray[i][ELEM_GROUP])) {
if (inst.elemArray[i][ELEM_THUMBNAIL] && inst.elemArray[i][ELEM_THUMBNAIL].length > 0) {
showNav = true;
break;
}
}
}
if (!showNav) {
return;
}
inst.options.navheight = inst.options.thumbheight + inst.options.thumbtopmargin + inst.options.thumbbottommargin;
if ($(".tsvg-fancy-html5-nav").length > 0) {
return;
}
var check_bool = $('.tsvg-fancy-blocks-container').attr('data-tsvg-shn');
if (check_bool === 'false') {
return
}
$("body").append(
"
" +
"
" +
"
" +
"
" +
"" +
"
" +
"
" +
"
" +
"
"
);
if (TS_VG_FG_Show_Nav == "true") {
var index = 0;
}
for (i = 0; inst.elemArray.length > i ; i++) {
if (inst.matchGroup(group, inst.elemArray[i][ELEM_GROUP])) {
if (inst.elemArray[i][ELEM_THUMBNAIL] && inst.elemArray[i][ELEM_THUMBNAIL].length > 0) {
$(".tsvg-fancy-html5-nav-list").append(
"
'
"
);
this.loadThumbnail(inst.elemArray[i][ELEM_THUMBNAIL], index)
index++;
}
}
}
$(".tsvg-fancy-html5-nav-thumb").hover(
function () {
$(this).css({ opacity: 1 });
$(this).css({ border: inst.options.thumbborder + "px solid " + inst.options.thumbhighlightbordercolor });
},
function () {
$(this).css({ opacity: inst.options.thumbopacity });
$(this).css({ border: inst.options.thumbborder + "px solid " + inst.options.thumbbordercolor });
}
);
$(".tsvg-fancy-html5-nav-thumb").click(
function () {
var index = $(this).data("arrayindex");
if (index >= 0) {
inst.gotoSlide(index);
}
}
);
inst.options.totalwidth = index * (inst.options.thumbgap + inst.options.thumbwidth + 2 * inst.options.thumbborder);
$(".tsvg-fancy-html5-nav-list")
.css({ display: "block", position: "relative", "margin-left": 0, width: inst.options.totalwidth + "px" })
.append("");
var $navMask = $(".tsvg-fancy-html5-nav-mask");
var $navPrev = $(".tsvg-fancy-html5-nav-prev");
var $navNext = $(".tsvg-fancy-html5-nav-next");
$navPrev.click(
function () {
var $navList = $(".tsvg-fancy-html5-nav-list");
var $navNext = $(".tsvg-fancy-html5-nav-next");
var winWidth = $(window).width();
var maskWidth = winWidth - 2 * inst.options.navbuttonwidth;
var marginLeft = parseInt($navList.css("margin-left")) + maskWidth;
if (marginLeft >= 0) {
marginLeft = 0;
$(this).css({ "background-position": "center left" });
} else {
$(this).css({ "background-position": "center right" });
}
if (maskWidth - inst.options.totalwidth >= marginLeft ) {
$navNext.css({ "background-position": "center left" });
} else {
$navNext.css({ "background-position": "center right" });
}
$navList.animate({ "margin-left": marginLeft });
}
);
$navNext.click(
function () {
var $navList = $(".tsvg-fancy-html5-nav-list");
var $navPrev = $(".tsvg-fancy-html5-nav-prev");
var winWidth = $(window).width();
var maskWidth = winWidth - 2 * inst.options.navbuttonwidth;
var marginLeft = parseInt($navList.css("margin-left")) - maskWidth;
if (maskWidth - inst.options.totalwidth >= marginLeft) {
marginLeft = maskWidth - inst.options.totalwidth;
$(this).css({ "background-position": "center left" });
} else {
$(this).css({ "background-position": "center right" });
}
if (marginLeft >= 0) {
$navPrev.css({ "background-position": "center left" });
} else {
$navPrev.css({ "background-position": "center right" });
}
$navList.animate({ "margin-left": marginLeft });
}
);
var winWidth = $(window).width();
if (winWidth >= inst.options.totalwidth ) {
$navMask.css({ width: inst.options.totalwidth + "px" });
$navPrev.hide();
$navNext.hide();
} else {
$navMask.css({ width: winWidth - 2 * inst.options.navbuttonwidth + "px" });
$navPrev.show();
$navNext.show();
}
};
inst.loadElem = function (elem) {
inst.currentElem = elem;
inst.showing = true;
inst.showNavigation();
inst.$elem.unbind("mouseenter").unbind("mouseleave").unbind("mousemove");
inst.$loading.show();
if (inst.options.onshowitem && window[inst.options.onshowitem] && typeof window[inst.options.onshowitem] == "function") {
window[inst.options.onshowitem](elem);
}
switch (elem[ELEM_TYPE]) {
case 0:
var imgLoader = new Image();
$(imgLoader).load(
function () {
inst.showImage(elem, imgLoader.width, imgLoader.height);
}
);
$(imgLoader).error(
function () {
inst.showError();
}
);
imgLoader.src = elem[ELEM_HREF];
break;
case 1:
inst.showSWF(elem);
break;
case 2:
case 8:
inst.showVideo(elem);
break;
case 3:
case 4:
case 9:
case 11:
inst.showYoutubeVimeo(elem);
break;
case 5:
inst.showPDF(elem);
break;
case 6:
inst.showMP3(elem);
break;
case 7:
inst.showWeb(elem);
break;
case 10:
inst.showDiv(elem);
break;
}
if (inst.options.googleanalyticsaccount && window._gaq) {
window._gaq.push(["_trackEvent", "Lightbox", "Open", elem[ELEM_HREF]]);
}
};
inst.loadCurElem = function () {
inst.loadElem(inst.elemArray[inst.options.curElem]);
};
inst.showError = function () {
inst.$loading.hide();
inst.resizeLightbox(
inst.options.errorwidth,
inst.options.errorheight,
true,
function () {
inst.$error.show();
inst.$elem.fadeIn(
inst.options.fadespeed,
function () {
inst.showData();
}
);
}
);
};
inst.calcTextWidth = function (objW) {
return objW - 36;
};
(inst.showTitle = function (w, t, description) {
if (inst.options.titlestyle == "inside") {
inst.$elemData.css({ width: w + "px" });
}
var text = "";
if (inst.options.showtitle) {
if (t && t.length > 0) {
text += t;
}
}
if (inst.options.inGroup) {
if (inst.options.showtitleprefix) {
text = inst.options.titleprefix.replace("%NUM", inst.options.groupIndex + 1).replace("%TOTAL", inst.options.groupCount) + " " + text;
}
jQuery("#tsvg-fancy-html5-elem-data-box").css("display", "none");
if (inst.options.showplaybutton && TotalSoft_VG_FG_ShSlPlIc == "true" && TotalSoft_GV_FG_PT != "true") {
jQuery("#tsvg-fancy-html5-elem-data-box")
.css("display", "inline-block")
.html(
"
';
}
if (inst.options.showtwitter) {
socialCode +=
'
';
}
if (inst.options.showpinterest) {
socialCode +=
'
';
}
socialCode += "
";
inst.$lightboxBox.append(socialCode);
$(".tsvg-fancy-html5-social-btn", inst.$lightbox).click(
function () {
var shareUrl = window.location.href + (0 > window.location.href.indexOf("?") ? "?" : "&") + "html5lightboxshare=" + encodeURIComponent(inst.currentElem[ELEM_HREF]);
var shareTitle = inst.currentElem[ELEM_TITLE];
var shareMedia = inst.currentElem[ELEM_HREF];
if (inst.currentElem[ELEM_TYPE] == 0) {
shareMedia = inst.absoluteUrl(inst.currentElem[ELEM_HREF]);
} else if (inst.currentElem[ELEM_TYPE] == 3) {
shareMedia = "https://img.youtube.com/vi/" + inst.getYoutubeId(inst.currentElem[ELEM_HREF]) + "/0.jpg";
} else {
var lightboxLink = $('.tsvg-html5lightbox-610795[href="' + inst.currentElem[ELEM_HREF] + '"]');
if (lightboxLink.length > 0)
if (lightboxLink.data("shareimage") && lightboxLink.data("shareimage").length > 0) {
shareMedia = inst.absoluteUrl(lightboxLink.data("shareimage"));
} else if (lightboxLink.data("thumbnail") && lightboxLink.data("thumbnail").length > 0) {
shareMedia = inst.absoluteUrl(lightboxLink.data("thumbnail"));
} else {
var lightboxImg = $("img", lightboxLink);
if (lightboxImg.length > 0) {
shareMedia = inst.absoluteUrl(lightboxImg.attr("src"));
}
}
}
var isVideo =
inst.currentElem[ELEM_TYPE] == 2 ||
inst.currentElem[ELEM_TYPE] == 3 ||
inst.currentElem[ELEM_TYPE] == 4 ||
inst.currentElem[ELEM_TYPE] == 8 ||
inst.currentElem[ELEM_TYPE] == 9 ||
inst.currentElem[ELEM_TYPE] == 11;
if ($(this).hasClass("tsvg-fancy-html5-social-facebook")) {
window.open("https://www.facebook.com/sharer/sharer.php?u=" + encodeURIComponent(shareUrl) + "&t=" + encodeURIComponent(shareTitle), "_blank");
} else if ($(this).hasClass("tsvg-fancy-html5-social-twitter")) {
window.open("https://twitter.com/share?url=" + encodeURIComponent(shareUrl) + "&text=" + encodeURIComponent(shareTitle), "_blank");
} else if ($(this).hasClass("tsvg-fancy-html5-social-pinterest")) {
window.open(
"https://pinterest.com/pin/create/bookmarklet/?media=" +
encodeURIComponent(shareMedia) +
"&url=" +
encodeURIComponent(shareUrl) +
"&description=" +
encodeURIComponent(shareTitle) +
"&is_video=" +
(isVideo ? "true" : "false"),
"_blank"
);
}
return false;
}
);
}
inst.$watermark = $("#tsvg-fancy-html5-watermark", inst.$lightbox);
if (inst.options.stamp) {
inst.$watermark.html("");
} else if (inst.options.watermark) {
var html = "";
if (inst.options.watermarklink) {
html = "" + html + "";
}
inst.$watermark.html(html);
}
if (inst.options.closeonoverlay) {
$("#tsvg-fancy-html5-lightbox-overlay", inst.$lightbox).click(inst.finish);
}
inst.$close.click(inst.finish);
inst.$next.click(
function () {
inst.nextArrowClicked();
}
);
inst.$prev.click(
function () {
inst.prevArrowClicked();
}
);
$(window).resize(
function () {
clearTimeout(inst.options.resizeTimeout);
inst.options.resizeTimeout = setTimeout(
function () {
inst.resizeWindow();
},
500
);
}
);
$(window).scroll(
function () {
inst.scrollBox();
}
);
$(window).bind(
"orientationchange",
function (e) {
if (inst.options.isMobile) {
inst.resizeWindow();
}
}
);
if (inst.options.isIPhone) {
inst.options.windowInnerHeight = window.innerHeight;
setInterval(
function () {
if (inst.options.windowInnerHeight != window.innerHeight) {
inst.options.windowInnerHeight = window.innerHeight;
inst.resizeWindow();
}
},
500
);
}
if (inst.options.enabletouchswipe) {
inst.enableSwipe();
}
};
inst.slideTimer = function (interval, callback, updatecallback) {
let timerInstance = this,
updateinterval = 50,
updateTimerId = null,
runningTime = 0,
paused = false,
started = false,
startedandpaused = false;
timerInstance.timeout = interval;
this.pause = function () {
if (started) {
paused = true;
clearInterval(updateTimerId);
}
};
this.resume = function (forceresume) {
if (startedandpaused && !forceresume) {
return;
}
startedandpaused = false;
if (started && paused) {
paused = false;
updateTimerId = setInterval(
function () {
runningTime += updateinterval;
if (runningTime > timerInstance.timeout) {
clearInterval(updateTimerId);
if (callback) {
callback();
}
}
if (updatecallback) {
updatecallback(runningTime / timerInstance.timeout);
}
},
updateinterval
);
}
};
this.stop = function () {
clearInterval(updateTimerId);
if (updatecallback) {
updatecallback(-1);
}
runningTime = 0;
paused = false;
started = false;
};
this.start = function () {
runningTime = 0;
paused = false;
started = true;
updateTimerId = setInterval(
function () {
runningTime += updateinterval;
if (runningTime > timerInstance.timeout) {
clearInterval(updateTimerId);
if (callback) {
callback();
}
}
if (updatecallback) {
updatecallback(runningTime / timerInstance.timeout);
}
},
updateinterval
);
};
this.startandpause = function () {
runningTime = 0;
paused = true;
started = true;
startedandpaused = true;
};
return this;
};
inst.updateTimer = function (percent) {
var w = Math.round(percent * 100);
if (w > 100) {
w = 100;
}
if (0 > w ) {
w = 0;
}
$("#tsvg-fancy-html5-timer", inst.$lightbox).css({ display: "block", width: w + "%" });
};
inst.initSlide = function () {
inst.autosliding = false;
inst.slideTimeout = inst.slideTimer(
inst.options.slideinterval,
function () {
inst.gotoSlide(-1);
},
inst.options.showtimer
? function (percent) {
inst.updateTimer(percent);
}
: null
);
if (inst.options.autoslide) {
inst.slideTimeout.stop();
inst.autosliding = true;
}
};
inst.nextArrowClicked = function () {
if (inst.options.curElem >= inst.options.nextElem) {
if (inst.options.onlastarrowclicked && window[inst.options.onlastarrowclicked] && typeof window[inst.options.onlastarrowclicked] == "function") {
window[inst.options.onlastarrowclicked]();
}
}
inst.gotoSlide(-1);
};
inst.prevArrowClicked = function () {
if (inst.options.prevElem >= inst.options.curElem) {
if (inst.options.onfirstarrowclicked && window[inst.options.onfirstarrowclicked] && typeof window[inst.options.onfirstarrowclicked] == "function") {
window[inst.options.onfirstarrowclicked]();
}
}
inst.gotoSlide(-2);
};
inst.calcNextPrevElem = function () {
inst.options.nextElem = -1;
inst.options.prevElem = -1;
inst.options.inGroup = false;
inst.options.groupIndex = 0;
inst.options.groupCount = 0;
var group = inst.elemArray[inst.options.curElem][ELEM_GROUP];
for (var i = 0; inst.elemArray.length > i; i++) {
if (inst.matchGroup(group, inst.elemArray[i][ELEM_GROUP])) {
if (i == inst.options.curElem) {
inst.options.groupIndex = inst.options.groupCount;
}
inst.options.groupCount++;
}
}
var j,
curGroup = inst.elemArray[inst.options.curElem][ELEM_GROUP];
if (curGroup != undefined && curGroup != null) {
for (j = inst.options.curElem + 1;inst.elemArray.length > j; j++) {
if (inst.matchGroup(curGroup, inst.elemArray[j][ELEM_GROUP])) {
inst.options.nextElem = j;
break;
}
}
if (0 > inst.options.nextElem) {
for (j = 0; inst.options.curElem > j ; j++) {
if (inst.matchGroup(curGroup, inst.elemArray[j][ELEM_GROUP])) {
inst.options.nextElem = j;
break;
}
}
}
if (inst.options.nextElem >= 0) {
for (j = inst.options.curElem - 1; j >= 0; j--) {
if (inst.matchGroup(curGroup, inst.elemArray[j][ELEM_GROUP])) {
inst.options.prevElem = j;
break;
}
}
if (0 > inst.options.prevElem ) {
for (j = inst.elemArray.length - 1; j > inst.options.curElem; j--) {
if (inst.matchGroup(curGroup, inst.elemArray[j][ELEM_GROUP])) {
inst.options.prevElem = j;
break;
}
}
}
}
}
if (inst.options.nextElem >= 0 || inst.options.prevElem >= 0) {
inst.options.inGroup = true;
}
};
inst.calcBoxPosition = function (initW, initH) {
var boxW = initW + 2 * inst.options.bordersize;
var boxH = initH + 2 * inst.options.bordersize;
var winH = window.innerHeight ? window.innerHeight : $(window).height();
var boxT = Math.round((winH - inst.options.navheight) / 2 - boxH / 2);
if (inst.options.titlestyle == "bottom") {
boxT -= Math.round(inst.options.barheight / 2);
}
var topmargin = inst.options.navarrowsbottomscreenwidth > $(window).width() ? inst.options.bordertopmarginsmall : inst.options.bordertopmargin;
if (topmargin > boxT) {
boxT = topmargin;
}
if (inst.options.insideiframe && window.self != window.top) {
if (parent.window.jQuery && parent.window.jQuery("#" + inst.options.iframeid).length) {
var iframetop = parent.window.jQuery("#" + inst.options.iframeid).offset().top;
var parentscroll = parent.window.document.body.scrollTop;
boxT = topmargin;
boxT += parentscroll > iframetop ? parentscroll - iframetop : 0;
}
}
return [boxW, boxH, boxT];
};
inst.hideNavArrows = function () {
var showPrev = false;
var showNext = false;
if (inst.options.inGroup) {
if (inst.options.arrowloop || (!inst.options.arrowloop && inst.options.curElem > inst.options.prevElem )) {
showPrev = true;
}
if (inst.options.arrowloop || (!inst.options.arrowloop && inst.options.curElem > inst.options.prevElem )) {
showNext = true;
}
}
if (showPrev) {
inst.$prev.removeClass("tsvg-fancy-html5-hide");
if (inst.$prevbottom) {
inst.$prevbottom.removeClass("tsvg-fancy-html5-hide");
}
if (inst.$prevtouch) {
inst.$prevtouch.removeClass("tsvg-fancy-html5-hide");
}
} else {
inst.$prev.addClass("tsvg-fancy-html5-hide");
if (inst.$prevbottom) {
inst.$prevbottom.addClass("tsvg-fancy-html5-hide");
}
if (inst.$prevtouch) {
inst.$prevtouch.addClass("tsvg-fancy-html5-hide");
}
}
if (showNext) {
inst.$next.removeClass("tsvg-fancy-html5-hide");
if (inst.$nextbottom) {
inst.$nextbottom.removeClass("tsvg-fancy-html5-hide");
}
if (inst.$nexttouch) {
inst.$nexttouch.removeClass("tsvg-fancy-html5-hide");
}
} else {
inst.$next.addClass("tsvg-fancy-html5-hide");
if (inst.$nextbottom) {
inst.$nextbottom.addClass("tsvg-fancy-html5-hide");
}
if (inst.$nexttouch) {
inst.$nexttouch.addClass("tsvg-fancy-html5-hide");
}
}
};
inst.clickHandler = function (event) {
var $this = $(this);
var dataoptions = {};
if (jQuery(event.target).prop("tagName") == 'A') {
let link = jQuery(event.target).attr('href');
if (jQuery(event.target).attr('target') == '_blank') {
window.open(link);
} else {
window.location.assign(link)
}
return false;
}
$.each(
$this.data(),
function (key, value) {
dataoptions[key.toLowerCase()] = value;
}
);
inst.options = $.extend(inst.options, inst.defaultoptions, dataoptions);
$(window).trigger("html5lightbox.lightboxshow");
inst.init();
if (0 >= inst.elemArray.length) {
return true;
}
inst.hideObjects();
for (var i = 0; inst.elemArray.length > i ; i++) {
if (inst.elemArray[i][ELEM_ID] == $this.data("tsvgid")) {
break;
}
}
if (i == inst.elemArray.length) {
return true;
}
inst.options.curElem = i;
inst.calcNextPrevElem();
inst.reset();
inst.$lightbox.show();
var boxPos = inst.calcBoxPosition(inst.options.loadingwidth, inst.options.loadingheight);
var boxW = boxPos[0];
var boxH = boxPos[1];
var boxT = boxPos[2];
if (inst.options.iequirksmode) {
inst.$lightboxBox.css({ top: boxT });
} else {
inst.$lightboxBox.css({ "margin-top": boxT });
}
if (!inst.options.positionFixed) {
inst.$lightboxBox.css("margin-top", $(window).scrollTop() + inst.options.bordertopmargin);
}
if (inst.options.titlestyle == "left" || inst.options.titlestyle == "right") {
inst.$lightboxBox.css({ width: boxW, height: boxH });
} else {
inst.$lightboxBox.css({ width: boxW, height: "auto" });
inst.$elemWrap.css({ width: boxW, height: boxH });
}
inst.loadCurElem();
return false;
};
inst.loadThumbnail = function (src, index) {
let inst_img_elem = document.createElement('img');
inst_img_elem.src = src;
inst_img_elem.addEventListener('load', function () {
if (inst.options.thumbwidth / inst.options.thumbheight >= inst_img_elem.naturalWidth / inst_img_elem.naturalHeight ) {
inst_img_elem.setAttribute("style","width:100%;")
} else {
inst_img_elem.setAttribute("style","height:100%;")
}
$(".tsvg-fancy-html5-nav-thumb").eq(index).html(inst_img_elem);
})
inst_img_elem.addEventListener('error', function () {
console.log('error')
})
};
inst.matchGroup = function (curGroup, elemGroup) {
if (!curGroup || !elemGroup) {
return false;
}
var curs = curGroup.split(":");
var elems = elemGroup.split(":");
var result = false;
for (var i in curs) {
if ($.inArray(curs[i], elems) > -1) {
result = true;
break;
}
}
return result;
};
inst.showNavigation = function () {
if (!inst.options.shownavigation) {
return;
}
if (!inst.currentElem || !inst.currentElem[ELEM_GROUP]) {
return;
}
var i;
var showNav = false;
var group = inst.currentElem[ELEM_GROUP];
for (i = 0; inst.elemArray.length > i ; i++) {
if (inst.matchGroup(group, inst.elemArray[i][ELEM_GROUP])) {
if (inst.elemArray[i][ELEM_THUMBNAIL] && inst.elemArray[i][ELEM_THUMBNAIL].length > 0) {
showNav = true;
break;
}
}
}
if (!showNav) {
return;
}
inst.options.navheight = inst.options.thumbheight + inst.options.thumbtopmargin + inst.options.thumbbottommargin;
if ($(".tsvg-fancy-html5-nav").length > 0) {
return;
}
var check_bool = $('.tsvg-fancy-blocks-container').attr('data-tsvg-shn');
if (check_bool === 'false') {
return
}
$("body").append(
"
" +
"
" +
"
" +
"
" +
"" +
"
" +
"
" +
"
" +
"
"
);
if (TS_VG_FG_Show_Nav == "true") {
var index = 0;
}
for (i = 0; inst.elemArray.length > i ; i++) {
if (inst.matchGroup(group, inst.elemArray[i][ELEM_GROUP])) {
if (inst.elemArray[i][ELEM_THUMBNAIL] && inst.elemArray[i][ELEM_THUMBNAIL].length > 0) {
$(".tsvg-fancy-html5-nav-list").append(
"
'
"
);
this.loadThumbnail(inst.elemArray[i][ELEM_THUMBNAIL], index)
index++;
}
}
}
$(".tsvg-fancy-html5-nav-thumb").hover(
function () {
$(this).css({ opacity: 1 });
$(this).css({ border: inst.options.thumbborder + "px solid " + inst.options.thumbhighlightbordercolor });
},
function () {
$(this).css({ opacity: inst.options.thumbopacity });
$(this).css({ border: inst.options.thumbborder + "px solid " + inst.options.thumbbordercolor });
}
);
$(".tsvg-fancy-html5-nav-thumb").click(
function () {
var index = $(this).data("arrayindex");
if (index >= 0) {
inst.gotoSlide(index);
}
}
);
inst.options.totalwidth = index * (inst.options.thumbgap + inst.options.thumbwidth + 2 * inst.options.thumbborder);
$(".tsvg-fancy-html5-nav-list")
.css({ display: "block", position: "relative", "margin-left": 0, width: inst.options.totalwidth + "px" })
.append("");
var $navMask = $(".tsvg-fancy-html5-nav-mask");
var $navPrev = $(".tsvg-fancy-html5-nav-prev");
var $navNext = $(".tsvg-fancy-html5-nav-next");
$navPrev.click(
function () {
var $navList = $(".tsvg-fancy-html5-nav-list");
var $navNext = $(".tsvg-fancy-html5-nav-next");
var winWidth = $(window).width();
var maskWidth = winWidth - 2 * inst.options.navbuttonwidth;
var marginLeft = parseInt($navList.css("margin-left")) + maskWidth;
if (marginLeft >= 0) {
marginLeft = 0;
$(this).css({ "background-position": "center left" });
} else {
$(this).css({ "background-position": "center right" });
}
if (maskWidth - inst.options.totalwidth >= marginLeft ) {
$navNext.css({ "background-position": "center left" });
} else {
$navNext.css({ "background-position": "center right" });
}
$navList.animate({ "margin-left": marginLeft });
}
);
$navNext.click(
function () {
var $navList = $(".tsvg-fancy-html5-nav-list");
var $navPrev = $(".tsvg-fancy-html5-nav-prev");
var winWidth = $(window).width();
var maskWidth = winWidth - 2 * inst.options.navbuttonwidth;
var marginLeft = parseInt($navList.css("margin-left")) - maskWidth;
if (maskWidth - inst.options.totalwidth >= marginLeft) {
marginLeft = maskWidth - inst.options.totalwidth;
$(this).css({ "background-position": "center left" });
} else {
$(this).css({ "background-position": "center right" });
}
if (marginLeft >= 0) {
$navPrev.css({ "background-position": "center left" });
} else {
$navPrev.css({ "background-position": "center right" });
}
$navList.animate({ "margin-left": marginLeft });
}
);
var winWidth = $(window).width();
if (winWidth >= inst.options.totalwidth ) {
$navMask.css({ width: inst.options.totalwidth + "px" });
$navPrev.hide();
$navNext.hide();
} else {
$navMask.css({ width: winWidth - 2 * inst.options.navbuttonwidth + "px" });
$navPrev.show();
$navNext.show();
}
};
inst.loadElem = function (elem) {
inst.currentElem = elem;
inst.showing = true;
inst.showNavigation();
inst.$elem.unbind("mouseenter").unbind("mouseleave").unbind("mousemove");
inst.$loading.show();
if (inst.options.onshowitem && window[inst.options.onshowitem] && typeof window[inst.options.onshowitem] == "function") {
window[inst.options.onshowitem](elem);
}
switch (elem[ELEM_TYPE]) {
case 0:
var imgLoader = new Image();
$(imgLoader).load(
function () {
inst.showImage(elem, imgLoader.width, imgLoader.height);
}
);
$(imgLoader).error(
function () {
inst.showError();
}
);
imgLoader.src = elem[ELEM_HREF];
break;
case 1:
inst.showSWF(elem);
break;
case 2:
case 8:
inst.showVideo(elem);
break;
case 3:
case 4:
case 9:
case 11:
inst.showYoutubeVimeo(elem);
break;
case 5:
inst.showPDF(elem);
break;
case 6:
inst.showMP3(elem);
break;
case 7:
inst.showWeb(elem);
break;
case 10:
inst.showDiv(elem);
break;
}
if (inst.options.googleanalyticsaccount && window._gaq) {
window._gaq.push(["_trackEvent", "Lightbox", "Open", elem[ELEM_HREF]]);
}
};
inst.loadCurElem = function () {
inst.loadElem(inst.elemArray[inst.options.curElem]);
};
inst.showError = function () {
inst.$loading.hide();
inst.resizeLightbox(
inst.options.errorwidth,
inst.options.errorheight,
true,
function () {
inst.$error.show();
inst.$elem.fadeIn(
inst.options.fadespeed,
function () {
inst.showData();
}
);
}
);
};
inst.calcTextWidth = function (objW) {
return objW - 36;
};
(inst.showTitle = function (w, t, description) {
if (inst.options.titlestyle == "inside") {
inst.$elemData.css({ width: w + "px" });
}
var text = "";
if (inst.options.showtitle) {
if (t && t.length > 0) {
text += t;
}
}
if (inst.options.inGroup) {
if (inst.options.showtitleprefix) {
text = inst.options.titleprefix.replace("%NUM", inst.options.groupIndex + 1).replace("%TOTAL", inst.options.groupCount) + " " + text;
}
jQuery("#tsvg-fancy-html5-elem-data-box").css("display", "none");
if (inst.options.showplaybutton && TotalSoft_VG_FG_ShSlPlIc == "true" && TotalSoft_GV_FG_PT != "true") {
jQuery("#tsvg-fancy-html5-elem-data-box")
.css("display", "inline-block")
.html(
"
';
}
if (inst.options.showtwitter) {
socialCode +=
'
';
}
if (inst.options.showpinterest) {
socialCode +=
'
';
}
socialCode += "
";
inst.$lightboxBox.append(socialCode);
$(".tsvg-fancy-html5-social-btn", inst.$lightbox).click(
function () {
var shareUrl = window.location.href + (0 > window.location.href.indexOf("?") ? "?" : "&") + "html5lightboxshare=" + encodeURIComponent(inst.currentElem[ELEM_HREF]);
var shareTitle = inst.currentElem[ELEM_TITLE];
var shareMedia = inst.currentElem[ELEM_HREF];
if (inst.currentElem[ELEM_TYPE] == 0) {
shareMedia = inst.absoluteUrl(inst.currentElem[ELEM_HREF]);
} else if (inst.currentElem[ELEM_TYPE] == 3) {
shareMedia = "https://img.youtube.com/vi/" + inst.getYoutubeId(inst.currentElem[ELEM_HREF]) + "/0.jpg";
} else {
var lightboxLink = $('.tsvg-html5lightbox-997063[href="' + inst.currentElem[ELEM_HREF] + '"]');
if (lightboxLink.length > 0)
if (lightboxLink.data("shareimage") && lightboxLink.data("shareimage").length > 0) {
shareMedia = inst.absoluteUrl(lightboxLink.data("shareimage"));
} else if (lightboxLink.data("thumbnail") && lightboxLink.data("thumbnail").length > 0) {
shareMedia = inst.absoluteUrl(lightboxLink.data("thumbnail"));
} else {
var lightboxImg = $("img", lightboxLink);
if (lightboxImg.length > 0) {
shareMedia = inst.absoluteUrl(lightboxImg.attr("src"));
}
}
}
var isVideo =
inst.currentElem[ELEM_TYPE] == 2 ||
inst.currentElem[ELEM_TYPE] == 3 ||
inst.currentElem[ELEM_TYPE] == 4 ||
inst.currentElem[ELEM_TYPE] == 8 ||
inst.currentElem[ELEM_TYPE] == 9 ||
inst.currentElem[ELEM_TYPE] == 11;
if ($(this).hasClass("tsvg-fancy-html5-social-facebook")) {
window.open("https://www.facebook.com/sharer/sharer.php?u=" + encodeURIComponent(shareUrl) + "&t=" + encodeURIComponent(shareTitle), "_blank");
} else if ($(this).hasClass("tsvg-fancy-html5-social-twitter")) {
window.open("https://twitter.com/share?url=" + encodeURIComponent(shareUrl) + "&text=" + encodeURIComponent(shareTitle), "_blank");
} else if ($(this).hasClass("tsvg-fancy-html5-social-pinterest")) {
window.open(
"https://pinterest.com/pin/create/bookmarklet/?media=" +
encodeURIComponent(shareMedia) +
"&url=" +
encodeURIComponent(shareUrl) +
"&description=" +
encodeURIComponent(shareTitle) +
"&is_video=" +
(isVideo ? "true" : "false"),
"_blank"
);
}
return false;
}
);
}
inst.$watermark = $("#tsvg-fancy-html5-watermark", inst.$lightbox);
if (inst.options.stamp) {
inst.$watermark.html("");
} else if (inst.options.watermark) {
var html = "";
if (inst.options.watermarklink) {
html = "" + html + "";
}
inst.$watermark.html(html);
}
if (inst.options.closeonoverlay) {
$("#tsvg-fancy-html5-lightbox-overlay", inst.$lightbox).click(inst.finish);
}
inst.$close.click(inst.finish);
inst.$next.click(
function () {
inst.nextArrowClicked();
}
);
inst.$prev.click(
function () {
inst.prevArrowClicked();
}
);
$(window).resize(
function () {
clearTimeout(inst.options.resizeTimeout);
inst.options.resizeTimeout = setTimeout(
function () {
inst.resizeWindow();
},
500
);
}
);
$(window).scroll(
function () {
inst.scrollBox();
}
);
$(window).bind(
"orientationchange",
function (e) {
if (inst.options.isMobile) {
inst.resizeWindow();
}
}
);
if (inst.options.isIPhone) {
inst.options.windowInnerHeight = window.innerHeight;
setInterval(
function () {
if (inst.options.windowInnerHeight != window.innerHeight) {
inst.options.windowInnerHeight = window.innerHeight;
inst.resizeWindow();
}
},
500
);
}
if (inst.options.enabletouchswipe) {
inst.enableSwipe();
}
};
inst.slideTimer = function (interval, callback, updatecallback) {
let timerInstance = this,
updateinterval = 50,
updateTimerId = null,
runningTime = 0,
paused = false,
started = false,
startedandpaused = false;
timerInstance.timeout = interval;
this.pause = function () {
if (started) {
paused = true;
clearInterval(updateTimerId);
}
};
this.resume = function (forceresume) {
if (startedandpaused && !forceresume) {
return;
}
startedandpaused = false;
if (started && paused) {
paused = false;
updateTimerId = setInterval(
function () {
runningTime += updateinterval;
if (runningTime > timerInstance.timeout) {
clearInterval(updateTimerId);
if (callback) {
callback();
}
}
if (updatecallback) {
updatecallback(runningTime / timerInstance.timeout);
}
},
updateinterval
);
}
};
this.stop = function () {
clearInterval(updateTimerId);
if (updatecallback) {
updatecallback(-1);
}
runningTime = 0;
paused = false;
started = false;
};
this.start = function () {
runningTime = 0;
paused = false;
started = true;
updateTimerId = setInterval(
function () {
runningTime += updateinterval;
if (runningTime > timerInstance.timeout) {
clearInterval(updateTimerId);
if (callback) {
callback();
}
}
if (updatecallback) {
updatecallback(runningTime / timerInstance.timeout);
}
},
updateinterval
);
};
this.startandpause = function () {
runningTime = 0;
paused = true;
started = true;
startedandpaused = true;
};
return this;
};
inst.updateTimer = function (percent) {
var w = Math.round(percent * 100);
if (w > 100) {
w = 100;
}
if (0 > w ) {
w = 0;
}
$("#tsvg-fancy-html5-timer", inst.$lightbox).css({ display: "block", width: w + "%" });
};
inst.initSlide = function () {
inst.autosliding = false;
inst.slideTimeout = inst.slideTimer(
inst.options.slideinterval,
function () {
inst.gotoSlide(-1);
},
inst.options.showtimer
? function (percent) {
inst.updateTimer(percent);
}
: null
);
if (inst.options.autoslide) {
inst.slideTimeout.stop();
inst.autosliding = true;
}
};
inst.nextArrowClicked = function () {
if (inst.options.curElem >= inst.options.nextElem) {
if (inst.options.onlastarrowclicked && window[inst.options.onlastarrowclicked] && typeof window[inst.options.onlastarrowclicked] == "function") {
window[inst.options.onlastarrowclicked]();
}
}
inst.gotoSlide(-1);
};
inst.prevArrowClicked = function () {
if (inst.options.prevElem >= inst.options.curElem) {
if (inst.options.onfirstarrowclicked && window[inst.options.onfirstarrowclicked] && typeof window[inst.options.onfirstarrowclicked] == "function") {
window[inst.options.onfirstarrowclicked]();
}
}
inst.gotoSlide(-2);
};
inst.calcNextPrevElem = function () {
inst.options.nextElem = -1;
inst.options.prevElem = -1;
inst.options.inGroup = false;
inst.options.groupIndex = 0;
inst.options.groupCount = 0;
var group = inst.elemArray[inst.options.curElem][ELEM_GROUP];
for (var i = 0; inst.elemArray.length > i; i++) {
if (inst.matchGroup(group, inst.elemArray[i][ELEM_GROUP])) {
if (i == inst.options.curElem) {
inst.options.groupIndex = inst.options.groupCount;
}
inst.options.groupCount++;
}
}
var j,
curGroup = inst.elemArray[inst.options.curElem][ELEM_GROUP];
if (curGroup != undefined && curGroup != null) {
for (j = inst.options.curElem + 1;inst.elemArray.length > j; j++) {
if (inst.matchGroup(curGroup, inst.elemArray[j][ELEM_GROUP])) {
inst.options.nextElem = j;
break;
}
}
if (0 > inst.options.nextElem) {
for (j = 0; inst.options.curElem > j ; j++) {
if (inst.matchGroup(curGroup, inst.elemArray[j][ELEM_GROUP])) {
inst.options.nextElem = j;
break;
}
}
}
if (inst.options.nextElem >= 0) {
for (j = inst.options.curElem - 1; j >= 0; j--) {
if (inst.matchGroup(curGroup, inst.elemArray[j][ELEM_GROUP])) {
inst.options.prevElem = j;
break;
}
}
if (0 > inst.options.prevElem ) {
for (j = inst.elemArray.length - 1; j > inst.options.curElem; j--) {
if (inst.matchGroup(curGroup, inst.elemArray[j][ELEM_GROUP])) {
inst.options.prevElem = j;
break;
}
}
}
}
}
if (inst.options.nextElem >= 0 || inst.options.prevElem >= 0) {
inst.options.inGroup = true;
}
};
inst.calcBoxPosition = function (initW, initH) {
var boxW = initW + 2 * inst.options.bordersize;
var boxH = initH + 2 * inst.options.bordersize;
var winH = window.innerHeight ? window.innerHeight : $(window).height();
var boxT = Math.round((winH - inst.options.navheight) / 2 - boxH / 2);
if (inst.options.titlestyle == "bottom") {
boxT -= Math.round(inst.options.barheight / 2);
}
var topmargin = inst.options.navarrowsbottomscreenwidth > $(window).width() ? inst.options.bordertopmarginsmall : inst.options.bordertopmargin;
if (topmargin > boxT) {
boxT = topmargin;
}
if (inst.options.insideiframe && window.self != window.top) {
if (parent.window.jQuery && parent.window.jQuery("#" + inst.options.iframeid).length) {
var iframetop = parent.window.jQuery("#" + inst.options.iframeid).offset().top;
var parentscroll = parent.window.document.body.scrollTop;
boxT = topmargin;
boxT += parentscroll > iframetop ? parentscroll - iframetop : 0;
}
}
return [boxW, boxH, boxT];
};
inst.hideNavArrows = function () {
var showPrev = false;
var showNext = false;
if (inst.options.inGroup) {
if (inst.options.arrowloop || (!inst.options.arrowloop && inst.options.curElem > inst.options.prevElem )) {
showPrev = true;
}
if (inst.options.arrowloop || (!inst.options.arrowloop && inst.options.curElem > inst.options.prevElem )) {
showNext = true;
}
}
if (showPrev) {
inst.$prev.removeClass("tsvg-fancy-html5-hide");
if (inst.$prevbottom) {
inst.$prevbottom.removeClass("tsvg-fancy-html5-hide");
}
if (inst.$prevtouch) {
inst.$prevtouch.removeClass("tsvg-fancy-html5-hide");
}
} else {
inst.$prev.addClass("tsvg-fancy-html5-hide");
if (inst.$prevbottom) {
inst.$prevbottom.addClass("tsvg-fancy-html5-hide");
}
if (inst.$prevtouch) {
inst.$prevtouch.addClass("tsvg-fancy-html5-hide");
}
}
if (showNext) {
inst.$next.removeClass("tsvg-fancy-html5-hide");
if (inst.$nextbottom) {
inst.$nextbottom.removeClass("tsvg-fancy-html5-hide");
}
if (inst.$nexttouch) {
inst.$nexttouch.removeClass("tsvg-fancy-html5-hide");
}
} else {
inst.$next.addClass("tsvg-fancy-html5-hide");
if (inst.$nextbottom) {
inst.$nextbottom.addClass("tsvg-fancy-html5-hide");
}
if (inst.$nexttouch) {
inst.$nexttouch.addClass("tsvg-fancy-html5-hide");
}
}
};
inst.clickHandler = function (event) {
var $this = $(this);
var dataoptions = {};
if (jQuery(event.target).prop("tagName") == 'A') {
let link = jQuery(event.target).attr('href');
if (jQuery(event.target).attr('target') == '_blank') {
window.open(link);
} else {
window.location.assign(link)
}
return false;
}
$.each(
$this.data(),
function (key, value) {
dataoptions[key.toLowerCase()] = value;
}
);
inst.options = $.extend(inst.options, inst.defaultoptions, dataoptions);
$(window).trigger("html5lightbox.lightboxshow");
inst.init();
if (0 >= inst.elemArray.length) {
return true;
}
inst.hideObjects();
for (var i = 0; inst.elemArray.length > i ; i++) {
if (inst.elemArray[i][ELEM_ID] == $this.data("tsvgid")) {
break;
}
}
if (i == inst.elemArray.length) {
return true;
}
inst.options.curElem = i;
inst.calcNextPrevElem();
inst.reset();
inst.$lightbox.show();
var boxPos = inst.calcBoxPosition(inst.options.loadingwidth, inst.options.loadingheight);
var boxW = boxPos[0];
var boxH = boxPos[1];
var boxT = boxPos[2];
if (inst.options.iequirksmode) {
inst.$lightboxBox.css({ top: boxT });
} else {
inst.$lightboxBox.css({ "margin-top": boxT });
}
if (!inst.options.positionFixed) {
inst.$lightboxBox.css("margin-top", $(window).scrollTop() + inst.options.bordertopmargin);
}
if (inst.options.titlestyle == "left" || inst.options.titlestyle == "right") {
inst.$lightboxBox.css({ width: boxW, height: boxH });
} else {
inst.$lightboxBox.css({ width: boxW, height: "auto" });
inst.$elemWrap.css({ width: boxW, height: boxH });
}
inst.loadCurElem();
return false;
};
inst.loadThumbnail = function (src, index) {
let inst_img_elem = document.createElement('img');
inst_img_elem.src = src;
inst_img_elem.addEventListener('load', function () {
if (inst.options.thumbwidth / inst.options.thumbheight >= inst_img_elem.naturalWidth / inst_img_elem.naturalHeight ) {
inst_img_elem.setAttribute("style","width:100%;")
} else {
inst_img_elem.setAttribute("style","height:100%;")
}
$(".tsvg-fancy-html5-nav-thumb").eq(index).html(inst_img_elem);
})
inst_img_elem.addEventListener('error', function () {
console.log('error')
})
};
inst.matchGroup = function (curGroup, elemGroup) {
if (!curGroup || !elemGroup) {
return false;
}
var curs = curGroup.split(":");
var elems = elemGroup.split(":");
var result = false;
for (var i in curs) {
if ($.inArray(curs[i], elems) > -1) {
result = true;
break;
}
}
return result;
};
inst.showNavigation = function () {
if (!inst.options.shownavigation) {
return;
}
if (!inst.currentElem || !inst.currentElem[ELEM_GROUP]) {
return;
}
var i;
var showNav = false;
var group = inst.currentElem[ELEM_GROUP];
for (i = 0; inst.elemArray.length > i ; i++) {
if (inst.matchGroup(group, inst.elemArray[i][ELEM_GROUP])) {
if (inst.elemArray[i][ELEM_THUMBNAIL] && inst.elemArray[i][ELEM_THUMBNAIL].length > 0) {
showNav = true;
break;
}
}
}
if (!showNav) {
return;
}
inst.options.navheight = inst.options.thumbheight + inst.options.thumbtopmargin + inst.options.thumbbottommargin;
if ($(".tsvg-fancy-html5-nav").length > 0) {
return;
}
var check_bool = $('.tsvg-fancy-blocks-container').attr('data-tsvg-shn');
if (check_bool === 'false') {
return
}
$("body").append(
"
" +
"
" +
"
" +
"
" +
"" +
"
" +
"
" +
"
" +
"
"
);
if (TS_VG_FG_Show_Nav == "true") {
var index = 0;
}
for (i = 0; inst.elemArray.length > i ; i++) {
if (inst.matchGroup(group, inst.elemArray[i][ELEM_GROUP])) {
if (inst.elemArray[i][ELEM_THUMBNAIL] && inst.elemArray[i][ELEM_THUMBNAIL].length > 0) {
$(".tsvg-fancy-html5-nav-list").append(
"
'
"
);
this.loadThumbnail(inst.elemArray[i][ELEM_THUMBNAIL], index)
index++;
}
}
}
$(".tsvg-fancy-html5-nav-thumb").hover(
function () {
$(this).css({ opacity: 1 });
$(this).css({ border: inst.options.thumbborder + "px solid " + inst.options.thumbhighlightbordercolor });
},
function () {
$(this).css({ opacity: inst.options.thumbopacity });
$(this).css({ border: inst.options.thumbborder + "px solid " + inst.options.thumbbordercolor });
}
);
$(".tsvg-fancy-html5-nav-thumb").click(
function () {
var index = $(this).data("arrayindex");
if (index >= 0) {
inst.gotoSlide(index);
}
}
);
inst.options.totalwidth = index * (inst.options.thumbgap + inst.options.thumbwidth + 2 * inst.options.thumbborder);
$(".tsvg-fancy-html5-nav-list")
.css({ display: "block", position: "relative", "margin-left": 0, width: inst.options.totalwidth + "px" })
.append("");
var $navMask = $(".tsvg-fancy-html5-nav-mask");
var $navPrev = $(".tsvg-fancy-html5-nav-prev");
var $navNext = $(".tsvg-fancy-html5-nav-next");
$navPrev.click(
function () {
var $navList = $(".tsvg-fancy-html5-nav-list");
var $navNext = $(".tsvg-fancy-html5-nav-next");
var winWidth = $(window).width();
var maskWidth = winWidth - 2 * inst.options.navbuttonwidth;
var marginLeft = parseInt($navList.css("margin-left")) + maskWidth;
if (marginLeft >= 0) {
marginLeft = 0;
$(this).css({ "background-position": "center left" });
} else {
$(this).css({ "background-position": "center right" });
}
if (maskWidth - inst.options.totalwidth >= marginLeft ) {
$navNext.css({ "background-position": "center left" });
} else {
$navNext.css({ "background-position": "center right" });
}
$navList.animate({ "margin-left": marginLeft });
}
);
$navNext.click(
function () {
var $navList = $(".tsvg-fancy-html5-nav-list");
var $navPrev = $(".tsvg-fancy-html5-nav-prev");
var winWidth = $(window).width();
var maskWidth = winWidth - 2 * inst.options.navbuttonwidth;
var marginLeft = parseInt($navList.css("margin-left")) - maskWidth;
if (maskWidth - inst.options.totalwidth >= marginLeft) {
marginLeft = maskWidth - inst.options.totalwidth;
$(this).css({ "background-position": "center left" });
} else {
$(this).css({ "background-position": "center right" });
}
if (marginLeft >= 0) {
$navPrev.css({ "background-position": "center left" });
} else {
$navPrev.css({ "background-position": "center right" });
}
$navList.animate({ "margin-left": marginLeft });
}
);
var winWidth = $(window).width();
if (winWidth >= inst.options.totalwidth ) {
$navMask.css({ width: inst.options.totalwidth + "px" });
$navPrev.hide();
$navNext.hide();
} else {
$navMask.css({ width: winWidth - 2 * inst.options.navbuttonwidth + "px" });
$navPrev.show();
$navNext.show();
}
};
inst.loadElem = function (elem) {
inst.currentElem = elem;
inst.showing = true;
inst.showNavigation();
inst.$elem.unbind("mouseenter").unbind("mouseleave").unbind("mousemove");
inst.$loading.show();
if (inst.options.onshowitem && window[inst.options.onshowitem] && typeof window[inst.options.onshowitem] == "function") {
window[inst.options.onshowitem](elem);
}
switch (elem[ELEM_TYPE]) {
case 0:
var imgLoader = new Image();
$(imgLoader).load(
function () {
inst.showImage(elem, imgLoader.width, imgLoader.height);
}
);
$(imgLoader).error(
function () {
inst.showError();
}
);
imgLoader.src = elem[ELEM_HREF];
break;
case 1:
inst.showSWF(elem);
break;
case 2:
case 8:
inst.showVideo(elem);
break;
case 3:
case 4:
case 9:
case 11:
inst.showYoutubeVimeo(elem);
break;
case 5:
inst.showPDF(elem);
break;
case 6:
inst.showMP3(elem);
break;
case 7:
inst.showWeb(elem);
break;
case 10:
inst.showDiv(elem);
break;
}
if (inst.options.googleanalyticsaccount && window._gaq) {
window._gaq.push(["_trackEvent", "Lightbox", "Open", elem[ELEM_HREF]]);
}
};
inst.loadCurElem = function () {
inst.loadElem(inst.elemArray[inst.options.curElem]);
};
inst.showError = function () {
inst.$loading.hide();
inst.resizeLightbox(
inst.options.errorwidth,
inst.options.errorheight,
true,
function () {
inst.$error.show();
inst.$elem.fadeIn(
inst.options.fadespeed,
function () {
inst.showData();
}
);
}
);
};
inst.calcTextWidth = function (objW) {
return objW - 36;
};
(inst.showTitle = function (w, t, description) {
if (inst.options.titlestyle == "inside") {
inst.$elemData.css({ width: w + "px" });
}
var text = "";
if (inst.options.showtitle) {
if (t && t.length > 0) {
text += t;
}
}
if (inst.options.inGroup) {
if (inst.options.showtitleprefix) {
text = inst.options.titleprefix.replace("%NUM", inst.options.groupIndex + 1).replace("%TOTAL", inst.options.groupCount) + " " + text;
}
jQuery("#tsvg-fancy-html5-elem-data-box").css("display", "none");
if (inst.options.showplaybutton && TotalSoft_VG_FG_ShSlPlIc == "true" && TotalSoft_GV_FG_PT != "true") {
jQuery("#tsvg-fancy-html5-elem-data-box")
.css("display", "inline-block")
.html(
"
';
}
if (inst.options.showtwitter) {
socialCode +=
'
';
}
if (inst.options.showpinterest) {
socialCode +=
'
';
}
socialCode += "
";
inst.$lightboxBox.append(socialCode);
$(".tsvg-fancy-html5-social-btn", inst.$lightbox).click(
function () {
var shareUrl = window.location.href + (0 > window.location.href.indexOf("?") ? "?" : "&") + "html5lightboxshare=" + encodeURIComponent(inst.currentElem[ELEM_HREF]);
var shareTitle = inst.currentElem[ELEM_TITLE];
var shareMedia = inst.currentElem[ELEM_HREF];
if (inst.currentElem[ELEM_TYPE] == 0) {
shareMedia = inst.absoluteUrl(inst.currentElem[ELEM_HREF]);
} else if (inst.currentElem[ELEM_TYPE] == 3) {
shareMedia = "https://img.youtube.com/vi/" + inst.getYoutubeId(inst.currentElem[ELEM_HREF]) + "/0.jpg";
} else {
var lightboxLink = $('.tsvg-html5lightbox-166264[href="' + inst.currentElem[ELEM_HREF] + '"]');
if (lightboxLink.length > 0)
if (lightboxLink.data("shareimage") && lightboxLink.data("shareimage").length > 0) {
shareMedia = inst.absoluteUrl(lightboxLink.data("shareimage"));
} else if (lightboxLink.data("thumbnail") && lightboxLink.data("thumbnail").length > 0) {
shareMedia = inst.absoluteUrl(lightboxLink.data("thumbnail"));
} else {
var lightboxImg = $("img", lightboxLink);
if (lightboxImg.length > 0) {
shareMedia = inst.absoluteUrl(lightboxImg.attr("src"));
}
}
}
var isVideo =
inst.currentElem[ELEM_TYPE] == 2 ||
inst.currentElem[ELEM_TYPE] == 3 ||
inst.currentElem[ELEM_TYPE] == 4 ||
inst.currentElem[ELEM_TYPE] == 8 ||
inst.currentElem[ELEM_TYPE] == 9 ||
inst.currentElem[ELEM_TYPE] == 11;
if ($(this).hasClass("tsvg-fancy-html5-social-facebook")) {
window.open("https://www.facebook.com/sharer/sharer.php?u=" + encodeURIComponent(shareUrl) + "&t=" + encodeURIComponent(shareTitle), "_blank");
} else if ($(this).hasClass("tsvg-fancy-html5-social-twitter")) {
window.open("https://twitter.com/share?url=" + encodeURIComponent(shareUrl) + "&text=" + encodeURIComponent(shareTitle), "_blank");
} else if ($(this).hasClass("tsvg-fancy-html5-social-pinterest")) {
window.open(
"https://pinterest.com/pin/create/bookmarklet/?media=" +
encodeURIComponent(shareMedia) +
"&url=" +
encodeURIComponent(shareUrl) +
"&description=" +
encodeURIComponent(shareTitle) +
"&is_video=" +
(isVideo ? "true" : "false"),
"_blank"
);
}
return false;
}
);
}
inst.$watermark = $("#tsvg-fancy-html5-watermark", inst.$lightbox);
if (inst.options.stamp) {
inst.$watermark.html("");
} else if (inst.options.watermark) {
var html = "";
if (inst.options.watermarklink) {
html = "" + html + "";
}
inst.$watermark.html(html);
}
if (inst.options.closeonoverlay) {
$("#tsvg-fancy-html5-lightbox-overlay", inst.$lightbox).click(inst.finish);
}
inst.$close.click(inst.finish);
inst.$next.click(
function () {
inst.nextArrowClicked();
}
);
inst.$prev.click(
function () {
inst.prevArrowClicked();
}
);
$(window).resize(
function () {
clearTimeout(inst.options.resizeTimeout);
inst.options.resizeTimeout = setTimeout(
function () {
inst.resizeWindow();
},
500
);
}
);
$(window).scroll(
function () {
inst.scrollBox();
}
);
$(window).bind(
"orientationchange",
function (e) {
if (inst.options.isMobile) {
inst.resizeWindow();
}
}
);
if (inst.options.isIPhone) {
inst.options.windowInnerHeight = window.innerHeight;
setInterval(
function () {
if (inst.options.windowInnerHeight != window.innerHeight) {
inst.options.windowInnerHeight = window.innerHeight;
inst.resizeWindow();
}
},
500
);
}
if (inst.options.enabletouchswipe) {
inst.enableSwipe();
}
};
inst.slideTimer = function (interval, callback, updatecallback) {
let timerInstance = this,
updateinterval = 50,
updateTimerId = null,
runningTime = 0,
paused = false,
started = false,
startedandpaused = false;
timerInstance.timeout = interval;
this.pause = function () {
if (started) {
paused = true;
clearInterval(updateTimerId);
}
};
this.resume = function (forceresume) {
if (startedandpaused && !forceresume) {
return;
}
startedandpaused = false;
if (started && paused) {
paused = false;
updateTimerId = setInterval(
function () {
runningTime += updateinterval;
if (runningTime > timerInstance.timeout) {
clearInterval(updateTimerId);
if (callback) {
callback();
}
}
if (updatecallback) {
updatecallback(runningTime / timerInstance.timeout);
}
},
updateinterval
);
}
};
this.stop = function () {
clearInterval(updateTimerId);
if (updatecallback) {
updatecallback(-1);
}
runningTime = 0;
paused = false;
started = false;
};
this.start = function () {
runningTime = 0;
paused = false;
started = true;
updateTimerId = setInterval(
function () {
runningTime += updateinterval;
if (runningTime > timerInstance.timeout) {
clearInterval(updateTimerId);
if (callback) {
callback();
}
}
if (updatecallback) {
updatecallback(runningTime / timerInstance.timeout);
}
},
updateinterval
);
};
this.startandpause = function () {
runningTime = 0;
paused = true;
started = true;
startedandpaused = true;
};
return this;
};
inst.updateTimer = function (percent) {
var w = Math.round(percent * 100);
if (w > 100) {
w = 100;
}
if (0 > w ) {
w = 0;
}
$("#tsvg-fancy-html5-timer", inst.$lightbox).css({ display: "block", width: w + "%" });
};
inst.initSlide = function () {
inst.autosliding = false;
inst.slideTimeout = inst.slideTimer(
inst.options.slideinterval,
function () {
inst.gotoSlide(-1);
},
inst.options.showtimer
? function (percent) {
inst.updateTimer(percent);
}
: null
);
if (inst.options.autoslide) {
inst.slideTimeout.stop();
inst.autosliding = true;
}
};
inst.nextArrowClicked = function () {
if (inst.options.curElem >= inst.options.nextElem) {
if (inst.options.onlastarrowclicked && window[inst.options.onlastarrowclicked] && typeof window[inst.options.onlastarrowclicked] == "function") {
window[inst.options.onlastarrowclicked]();
}
}
inst.gotoSlide(-1);
};
inst.prevArrowClicked = function () {
if (inst.options.prevElem >= inst.options.curElem) {
if (inst.options.onfirstarrowclicked && window[inst.options.onfirstarrowclicked] && typeof window[inst.options.onfirstarrowclicked] == "function") {
window[inst.options.onfirstarrowclicked]();
}
}
inst.gotoSlide(-2);
};
inst.calcNextPrevElem = function () {
inst.options.nextElem = -1;
inst.options.prevElem = -1;
inst.options.inGroup = false;
inst.options.groupIndex = 0;
inst.options.groupCount = 0;
var group = inst.elemArray[inst.options.curElem][ELEM_GROUP];
for (var i = 0; inst.elemArray.length > i; i++) {
if (inst.matchGroup(group, inst.elemArray[i][ELEM_GROUP])) {
if (i == inst.options.curElem) {
inst.options.groupIndex = inst.options.groupCount;
}
inst.options.groupCount++;
}
}
var j,
curGroup = inst.elemArray[inst.options.curElem][ELEM_GROUP];
if (curGroup != undefined && curGroup != null) {
for (j = inst.options.curElem + 1;inst.elemArray.length > j; j++) {
if (inst.matchGroup(curGroup, inst.elemArray[j][ELEM_GROUP])) {
inst.options.nextElem = j;
break;
}
}
if (0 > inst.options.nextElem) {
for (j = 0; inst.options.curElem > j ; j++) {
if (inst.matchGroup(curGroup, inst.elemArray[j][ELEM_GROUP])) {
inst.options.nextElem = j;
break;
}
}
}
if (inst.options.nextElem >= 0) {
for (j = inst.options.curElem - 1; j >= 0; j--) {
if (inst.matchGroup(curGroup, inst.elemArray[j][ELEM_GROUP])) {
inst.options.prevElem = j;
break;
}
}
if (0 > inst.options.prevElem ) {
for (j = inst.elemArray.length - 1; j > inst.options.curElem; j--) {
if (inst.matchGroup(curGroup, inst.elemArray[j][ELEM_GROUP])) {
inst.options.prevElem = j;
break;
}
}
}
}
}
if (inst.options.nextElem >= 0 || inst.options.prevElem >= 0) {
inst.options.inGroup = true;
}
};
inst.calcBoxPosition = function (initW, initH) {
var boxW = initW + 2 * inst.options.bordersize;
var boxH = initH + 2 * inst.options.bordersize;
var winH = window.innerHeight ? window.innerHeight : $(window).height();
var boxT = Math.round((winH - inst.options.navheight) / 2 - boxH / 2);
if (inst.options.titlestyle == "bottom") {
boxT -= Math.round(inst.options.barheight / 2);
}
var topmargin = inst.options.navarrowsbottomscreenwidth > $(window).width() ? inst.options.bordertopmarginsmall : inst.options.bordertopmargin;
if (topmargin > boxT) {
boxT = topmargin;
}
if (inst.options.insideiframe && window.self != window.top) {
if (parent.window.jQuery && parent.window.jQuery("#" + inst.options.iframeid).length) {
var iframetop = parent.window.jQuery("#" + inst.options.iframeid).offset().top;
var parentscroll = parent.window.document.body.scrollTop;
boxT = topmargin;
boxT += parentscroll > iframetop ? parentscroll - iframetop : 0;
}
}
return [boxW, boxH, boxT];
};
inst.hideNavArrows = function () {
var showPrev = false;
var showNext = false;
if (inst.options.inGroup) {
if (inst.options.arrowloop || (!inst.options.arrowloop && inst.options.curElem > inst.options.prevElem )) {
showPrev = true;
}
if (inst.options.arrowloop || (!inst.options.arrowloop && inst.options.curElem > inst.options.prevElem )) {
showNext = true;
}
}
if (showPrev) {
inst.$prev.removeClass("tsvg-fancy-html5-hide");
if (inst.$prevbottom) {
inst.$prevbottom.removeClass("tsvg-fancy-html5-hide");
}
if (inst.$prevtouch) {
inst.$prevtouch.removeClass("tsvg-fancy-html5-hide");
}
} else {
inst.$prev.addClass("tsvg-fancy-html5-hide");
if (inst.$prevbottom) {
inst.$prevbottom.addClass("tsvg-fancy-html5-hide");
}
if (inst.$prevtouch) {
inst.$prevtouch.addClass("tsvg-fancy-html5-hide");
}
}
if (showNext) {
inst.$next.removeClass("tsvg-fancy-html5-hide");
if (inst.$nextbottom) {
inst.$nextbottom.removeClass("tsvg-fancy-html5-hide");
}
if (inst.$nexttouch) {
inst.$nexttouch.removeClass("tsvg-fancy-html5-hide");
}
} else {
inst.$next.addClass("tsvg-fancy-html5-hide");
if (inst.$nextbottom) {
inst.$nextbottom.addClass("tsvg-fancy-html5-hide");
}
if (inst.$nexttouch) {
inst.$nexttouch.addClass("tsvg-fancy-html5-hide");
}
}
};
inst.clickHandler = function (event) {
var $this = $(this);
var dataoptions = {};
if (jQuery(event.target).prop("tagName") == 'A') {
let link = jQuery(event.target).attr('href');
if (jQuery(event.target).attr('target') == '_blank') {
window.open(link);
} else {
window.location.assign(link)
}
return false;
}
$.each(
$this.data(),
function (key, value) {
dataoptions[key.toLowerCase()] = value;
}
);
inst.options = $.extend(inst.options, inst.defaultoptions, dataoptions);
$(window).trigger("html5lightbox.lightboxshow");
inst.init();
if (0 >= inst.elemArray.length) {
return true;
}
inst.hideObjects();
for (var i = 0; inst.elemArray.length > i ; i++) {
if (inst.elemArray[i][ELEM_ID] == $this.data("tsvgid")) {
break;
}
}
if (i == inst.elemArray.length) {
return true;
}
inst.options.curElem = i;
inst.calcNextPrevElem();
inst.reset();
inst.$lightbox.show();
var boxPos = inst.calcBoxPosition(inst.options.loadingwidth, inst.options.loadingheight);
var boxW = boxPos[0];
var boxH = boxPos[1];
var boxT = boxPos[2];
if (inst.options.iequirksmode) {
inst.$lightboxBox.css({ top: boxT });
} else {
inst.$lightboxBox.css({ "margin-top": boxT });
}
if (!inst.options.positionFixed) {
inst.$lightboxBox.css("margin-top", $(window).scrollTop() + inst.options.bordertopmargin);
}
if (inst.options.titlestyle == "left" || inst.options.titlestyle == "right") {
inst.$lightboxBox.css({ width: boxW, height: boxH });
} else {
inst.$lightboxBox.css({ width: boxW, height: "auto" });
inst.$elemWrap.css({ width: boxW, height: boxH });
}
inst.loadCurElem();
return false;
};
inst.loadThumbnail = function (src, index) {
let inst_img_elem = document.createElement('img');
inst_img_elem.src = src;
inst_img_elem.addEventListener('load', function () {
if (inst.options.thumbwidth / inst.options.thumbheight >= inst_img_elem.naturalWidth / inst_img_elem.naturalHeight ) {
inst_img_elem.setAttribute("style","width:100%;")
} else {
inst_img_elem.setAttribute("style","height:100%;")
}
$(".tsvg-fancy-html5-nav-thumb").eq(index).html(inst_img_elem);
})
inst_img_elem.addEventListener('error', function () {
console.log('error')
})
};
inst.matchGroup = function (curGroup, elemGroup) {
if (!curGroup || !elemGroup) {
return false;
}
var curs = curGroup.split(":");
var elems = elemGroup.split(":");
var result = false;
for (var i in curs) {
if ($.inArray(curs[i], elems) > -1) {
result = true;
break;
}
}
return result;
};
inst.showNavigation = function () {
if (!inst.options.shownavigation) {
return;
}
if (!inst.currentElem || !inst.currentElem[ELEM_GROUP]) {
return;
}
var i;
var showNav = false;
var group = inst.currentElem[ELEM_GROUP];
for (i = 0; inst.elemArray.length > i ; i++) {
if (inst.matchGroup(group, inst.elemArray[i][ELEM_GROUP])) {
if (inst.elemArray[i][ELEM_THUMBNAIL] && inst.elemArray[i][ELEM_THUMBNAIL].length > 0) {
showNav = true;
break;
}
}
}
if (!showNav) {
return;
}
inst.options.navheight = inst.options.thumbheight + inst.options.thumbtopmargin + inst.options.thumbbottommargin;
if ($(".tsvg-fancy-html5-nav").length > 0) {
return;
}
var check_bool = $('.tsvg-fancy-blocks-container').attr('data-tsvg-shn');
if (check_bool === 'false') {
return
}
$("body").append(
"
" +
"
" +
"
" +
"
" +
"" +
"
" +
"
" +
"
" +
"
"
);
if (TS_VG_FG_Show_Nav == "true") {
var index = 0;
}
for (i = 0; inst.elemArray.length > i ; i++) {
if (inst.matchGroup(group, inst.elemArray[i][ELEM_GROUP])) {
if (inst.elemArray[i][ELEM_THUMBNAIL] && inst.elemArray[i][ELEM_THUMBNAIL].length > 0) {
$(".tsvg-fancy-html5-nav-list").append(
"
'
"
);
this.loadThumbnail(inst.elemArray[i][ELEM_THUMBNAIL], index)
index++;
}
}
}
$(".tsvg-fancy-html5-nav-thumb").hover(
function () {
$(this).css({ opacity: 1 });
$(this).css({ border: inst.options.thumbborder + "px solid " + inst.options.thumbhighlightbordercolor });
},
function () {
$(this).css({ opacity: inst.options.thumbopacity });
$(this).css({ border: inst.options.thumbborder + "px solid " + inst.options.thumbbordercolor });
}
);
$(".tsvg-fancy-html5-nav-thumb").click(
function () {
var index = $(this).data("arrayindex");
if (index >= 0) {
inst.gotoSlide(index);
}
}
);
inst.options.totalwidth = index * (inst.options.thumbgap + inst.options.thumbwidth + 2 * inst.options.thumbborder);
$(".tsvg-fancy-html5-nav-list")
.css({ display: "block", position: "relative", "margin-left": 0, width: inst.options.totalwidth + "px" })
.append("");
var $navMask = $(".tsvg-fancy-html5-nav-mask");
var $navPrev = $(".tsvg-fancy-html5-nav-prev");
var $navNext = $(".tsvg-fancy-html5-nav-next");
$navPrev.click(
function () {
var $navList = $(".tsvg-fancy-html5-nav-list");
var $navNext = $(".tsvg-fancy-html5-nav-next");
var winWidth = $(window).width();
var maskWidth = winWidth - 2 * inst.options.navbuttonwidth;
var marginLeft = parseInt($navList.css("margin-left")) + maskWidth;
if (marginLeft >= 0) {
marginLeft = 0;
$(this).css({ "background-position": "center left" });
} else {
$(this).css({ "background-position": "center right" });
}
if (maskWidth - inst.options.totalwidth >= marginLeft ) {
$navNext.css({ "background-position": "center left" });
} else {
$navNext.css({ "background-position": "center right" });
}
$navList.animate({ "margin-left": marginLeft });
}
);
$navNext.click(
function () {
var $navList = $(".tsvg-fancy-html5-nav-list");
var $navPrev = $(".tsvg-fancy-html5-nav-prev");
var winWidth = $(window).width();
var maskWidth = winWidth - 2 * inst.options.navbuttonwidth;
var marginLeft = parseInt($navList.css("margin-left")) - maskWidth;
if (maskWidth - inst.options.totalwidth >= marginLeft) {
marginLeft = maskWidth - inst.options.totalwidth;
$(this).css({ "background-position": "center left" });
} else {
$(this).css({ "background-position": "center right" });
}
if (marginLeft >= 0) {
$navPrev.css({ "background-position": "center left" });
} else {
$navPrev.css({ "background-position": "center right" });
}
$navList.animate({ "margin-left": marginLeft });
}
);
var winWidth = $(window).width();
if (winWidth >= inst.options.totalwidth ) {
$navMask.css({ width: inst.options.totalwidth + "px" });
$navPrev.hide();
$navNext.hide();
} else {
$navMask.css({ width: winWidth - 2 * inst.options.navbuttonwidth + "px" });
$navPrev.show();
$navNext.show();
}
};
inst.loadElem = function (elem) {
inst.currentElem = elem;
inst.showing = true;
inst.showNavigation();
inst.$elem.unbind("mouseenter").unbind("mouseleave").unbind("mousemove");
inst.$loading.show();
if (inst.options.onshowitem && window[inst.options.onshowitem] && typeof window[inst.options.onshowitem] == "function") {
window[inst.options.onshowitem](elem);
}
switch (elem[ELEM_TYPE]) {
case 0:
var imgLoader = new Image();
$(imgLoader).load(
function () {
inst.showImage(elem, imgLoader.width, imgLoader.height);
}
);
$(imgLoader).error(
function () {
inst.showError();
}
);
imgLoader.src = elem[ELEM_HREF];
break;
case 1:
inst.showSWF(elem);
break;
case 2:
case 8:
inst.showVideo(elem);
break;
case 3:
case 4:
case 9:
case 11:
inst.showYoutubeVimeo(elem);
break;
case 5:
inst.showPDF(elem);
break;
case 6:
inst.showMP3(elem);
break;
case 7:
inst.showWeb(elem);
break;
case 10:
inst.showDiv(elem);
break;
}
if (inst.options.googleanalyticsaccount && window._gaq) {
window._gaq.push(["_trackEvent", "Lightbox", "Open", elem[ELEM_HREF]]);
}
};
inst.loadCurElem = function () {
inst.loadElem(inst.elemArray[inst.options.curElem]);
};
inst.showError = function () {
inst.$loading.hide();
inst.resizeLightbox(
inst.options.errorwidth,
inst.options.errorheight,
true,
function () {
inst.$error.show();
inst.$elem.fadeIn(
inst.options.fadespeed,
function () {
inst.showData();
}
);
}
);
};
inst.calcTextWidth = function (objW) {
return objW - 36;
};
(inst.showTitle = function (w, t, description) {
if (inst.options.titlestyle == "inside") {
inst.$elemData.css({ width: w + "px" });
}
var text = "";
if (inst.options.showtitle) {
if (t && t.length > 0) {
text += t;
}
}
if (inst.options.inGroup) {
if (inst.options.showtitleprefix) {
text = inst.options.titleprefix.replace("%NUM", inst.options.groupIndex + 1).replace("%TOTAL", inst.options.groupCount) + " " + text;
}
jQuery("#tsvg-fancy-html5-elem-data-box").css("display", "none");
if (inst.options.showplaybutton && TotalSoft_VG_FG_ShSlPlIc == "true" && TotalSoft_GV_FG_PT != "true") {
jQuery("#tsvg-fancy-html5-elem-data-box")
.css("display", "inline-block")
.html(
"
';
}
if (inst.options.showtwitter) {
socialCode +=
'
';
}
if (inst.options.showpinterest) {
socialCode +=
'
';
}
socialCode += "
";
inst.$lightboxBox.append(socialCode);
$(".tsvg-fancy-html5-social-btn", inst.$lightbox).click(
function () {
var shareUrl = window.location.href + (0 > window.location.href.indexOf("?") ? "?" : "&") + "html5lightboxshare=" + encodeURIComponent(inst.currentElem[ELEM_HREF]);
var shareTitle = inst.currentElem[ELEM_TITLE];
var shareMedia = inst.currentElem[ELEM_HREF];
if (inst.currentElem[ELEM_TYPE] == 0) {
shareMedia = inst.absoluteUrl(inst.currentElem[ELEM_HREF]);
} else if (inst.currentElem[ELEM_TYPE] == 3) {
shareMedia = "https://img.youtube.com/vi/" + inst.getYoutubeId(inst.currentElem[ELEM_HREF]) + "/0.jpg";
} else {
var lightboxLink = $('.tsvg-html5lightbox-248095[href="' + inst.currentElem[ELEM_HREF] + '"]');
if (lightboxLink.length > 0)
if (lightboxLink.data("shareimage") && lightboxLink.data("shareimage").length > 0) {
shareMedia = inst.absoluteUrl(lightboxLink.data("shareimage"));
} else if (lightboxLink.data("thumbnail") && lightboxLink.data("thumbnail").length > 0) {
shareMedia = inst.absoluteUrl(lightboxLink.data("thumbnail"));
} else {
var lightboxImg = $("img", lightboxLink);
if (lightboxImg.length > 0) {
shareMedia = inst.absoluteUrl(lightboxImg.attr("src"));
}
}
}
var isVideo =
inst.currentElem[ELEM_TYPE] == 2 ||
inst.currentElem[ELEM_TYPE] == 3 ||
inst.currentElem[ELEM_TYPE] == 4 ||
inst.currentElem[ELEM_TYPE] == 8 ||
inst.currentElem[ELEM_TYPE] == 9 ||
inst.currentElem[ELEM_TYPE] == 11;
if ($(this).hasClass("tsvg-fancy-html5-social-facebook")) {
window.open("https://www.facebook.com/sharer/sharer.php?u=" + encodeURIComponent(shareUrl) + "&t=" + encodeURIComponent(shareTitle), "_blank");
} else if ($(this).hasClass("tsvg-fancy-html5-social-twitter")) {
window.open("https://twitter.com/share?url=" + encodeURIComponent(shareUrl) + "&text=" + encodeURIComponent(shareTitle), "_blank");
} else if ($(this).hasClass("tsvg-fancy-html5-social-pinterest")) {
window.open(
"https://pinterest.com/pin/create/bookmarklet/?media=" +
encodeURIComponent(shareMedia) +
"&url=" +
encodeURIComponent(shareUrl) +
"&description=" +
encodeURIComponent(shareTitle) +
"&is_video=" +
(isVideo ? "true" : "false"),
"_blank"
);
}
return false;
}
);
}
inst.$watermark = $("#tsvg-fancy-html5-watermark", inst.$lightbox);
if (inst.options.stamp) {
inst.$watermark.html("");
} else if (inst.options.watermark) {
var html = "";
if (inst.options.watermarklink) {
html = "" + html + "";
}
inst.$watermark.html(html);
}
if (inst.options.closeonoverlay) {
$("#tsvg-fancy-html5-lightbox-overlay", inst.$lightbox).click(inst.finish);
}
inst.$close.click(inst.finish);
inst.$next.click(
function () {
inst.nextArrowClicked();
}
);
inst.$prev.click(
function () {
inst.prevArrowClicked();
}
);
$(window).resize(
function () {
clearTimeout(inst.options.resizeTimeout);
inst.options.resizeTimeout = setTimeout(
function () {
inst.resizeWindow();
},
500
);
}
);
$(window).scroll(
function () {
inst.scrollBox();
}
);
$(window).bind(
"orientationchange",
function (e) {
if (inst.options.isMobile) {
inst.resizeWindow();
}
}
);
if (inst.options.isIPhone) {
inst.options.windowInnerHeight = window.innerHeight;
setInterval(
function () {
if (inst.options.windowInnerHeight != window.innerHeight) {
inst.options.windowInnerHeight = window.innerHeight;
inst.resizeWindow();
}
},
500
);
}
if (inst.options.enabletouchswipe) {
inst.enableSwipe();
}
};
inst.slideTimer = function (interval, callback, updatecallback) {
let timerInstance = this,
updateinterval = 50,
updateTimerId = null,
runningTime = 0,
paused = false,
started = false,
startedandpaused = false;
timerInstance.timeout = interval;
this.pause = function () {
if (started) {
paused = true;
clearInterval(updateTimerId);
}
};
this.resume = function (forceresume) {
if (startedandpaused && !forceresume) {
return;
}
startedandpaused = false;
if (started && paused) {
paused = false;
updateTimerId = setInterval(
function () {
runningTime += updateinterval;
if (runningTime > timerInstance.timeout) {
clearInterval(updateTimerId);
if (callback) {
callback();
}
}
if (updatecallback) {
updatecallback(runningTime / timerInstance.timeout);
}
},
updateinterval
);
}
};
this.stop = function () {
clearInterval(updateTimerId);
if (updatecallback) {
updatecallback(-1);
}
runningTime = 0;
paused = false;
started = false;
};
this.start = function () {
runningTime = 0;
paused = false;
started = true;
updateTimerId = setInterval(
function () {
runningTime += updateinterval;
if (runningTime > timerInstance.timeout) {
clearInterval(updateTimerId);
if (callback) {
callback();
}
}
if (updatecallback) {
updatecallback(runningTime / timerInstance.timeout);
}
},
updateinterval
);
};
this.startandpause = function () {
runningTime = 0;
paused = true;
started = true;
startedandpaused = true;
};
return this;
};
inst.updateTimer = function (percent) {
var w = Math.round(percent * 100);
if (w > 100) {
w = 100;
}
if (0 > w ) {
w = 0;
}
$("#tsvg-fancy-html5-timer", inst.$lightbox).css({ display: "block", width: w + "%" });
};
inst.initSlide = function () {
inst.autosliding = false;
inst.slideTimeout = inst.slideTimer(
inst.options.slideinterval,
function () {
inst.gotoSlide(-1);
},
inst.options.showtimer
? function (percent) {
inst.updateTimer(percent);
}
: null
);
if (inst.options.autoslide) {
inst.slideTimeout.stop();
inst.autosliding = true;
}
};
inst.nextArrowClicked = function () {
if (inst.options.curElem >= inst.options.nextElem) {
if (inst.options.onlastarrowclicked && window[inst.options.onlastarrowclicked] && typeof window[inst.options.onlastarrowclicked] == "function") {
window[inst.options.onlastarrowclicked]();
}
}
inst.gotoSlide(-1);
};
inst.prevArrowClicked = function () {
if (inst.options.prevElem >= inst.options.curElem) {
if (inst.options.onfirstarrowclicked && window[inst.options.onfirstarrowclicked] && typeof window[inst.options.onfirstarrowclicked] == "function") {
window[inst.options.onfirstarrowclicked]();
}
}
inst.gotoSlide(-2);
};
inst.calcNextPrevElem = function () {
inst.options.nextElem = -1;
inst.options.prevElem = -1;
inst.options.inGroup = false;
inst.options.groupIndex = 0;
inst.options.groupCount = 0;
var group = inst.elemArray[inst.options.curElem][ELEM_GROUP];
for (var i = 0; inst.elemArray.length > i; i++) {
if (inst.matchGroup(group, inst.elemArray[i][ELEM_GROUP])) {
if (i == inst.options.curElem) {
inst.options.groupIndex = inst.options.groupCount;
}
inst.options.groupCount++;
}
}
var j,
curGroup = inst.elemArray[inst.options.curElem][ELEM_GROUP];
if (curGroup != undefined && curGroup != null) {
for (j = inst.options.curElem + 1;inst.elemArray.length > j; j++) {
if (inst.matchGroup(curGroup, inst.elemArray[j][ELEM_GROUP])) {
inst.options.nextElem = j;
break;
}
}
if (0 > inst.options.nextElem) {
for (j = 0; inst.options.curElem > j ; j++) {
if (inst.matchGroup(curGroup, inst.elemArray[j][ELEM_GROUP])) {
inst.options.nextElem = j;
break;
}
}
}
if (inst.options.nextElem >= 0) {
for (j = inst.options.curElem - 1; j >= 0; j--) {
if (inst.matchGroup(curGroup, inst.elemArray[j][ELEM_GROUP])) {
inst.options.prevElem = j;
break;
}
}
if (0 > inst.options.prevElem ) {
for (j = inst.elemArray.length - 1; j > inst.options.curElem; j--) {
if (inst.matchGroup(curGroup, inst.elemArray[j][ELEM_GROUP])) {
inst.options.prevElem = j;
break;
}
}
}
}
}
if (inst.options.nextElem >= 0 || inst.options.prevElem >= 0) {
inst.options.inGroup = true;
}
};
inst.calcBoxPosition = function (initW, initH) {
var boxW = initW + 2 * inst.options.bordersize;
var boxH = initH + 2 * inst.options.bordersize;
var winH = window.innerHeight ? window.innerHeight : $(window).height();
var boxT = Math.round((winH - inst.options.navheight) / 2 - boxH / 2);
if (inst.options.titlestyle == "bottom") {
boxT -= Math.round(inst.options.barheight / 2);
}
var topmargin = inst.options.navarrowsbottomscreenwidth > $(window).width() ? inst.options.bordertopmarginsmall : inst.options.bordertopmargin;
if (topmargin > boxT) {
boxT = topmargin;
}
if (inst.options.insideiframe && window.self != window.top) {
if (parent.window.jQuery && parent.window.jQuery("#" + inst.options.iframeid).length) {
var iframetop = parent.window.jQuery("#" + inst.options.iframeid).offset().top;
var parentscroll = parent.window.document.body.scrollTop;
boxT = topmargin;
boxT += parentscroll > iframetop ? parentscroll - iframetop : 0;
}
}
return [boxW, boxH, boxT];
};
inst.hideNavArrows = function () {
var showPrev = false;
var showNext = false;
if (inst.options.inGroup) {
if (inst.options.arrowloop || (!inst.options.arrowloop && inst.options.curElem > inst.options.prevElem )) {
showPrev = true;
}
if (inst.options.arrowloop || (!inst.options.arrowloop && inst.options.curElem > inst.options.prevElem )) {
showNext = true;
}
}
if (showPrev) {
inst.$prev.removeClass("tsvg-fancy-html5-hide");
if (inst.$prevbottom) {
inst.$prevbottom.removeClass("tsvg-fancy-html5-hide");
}
if (inst.$prevtouch) {
inst.$prevtouch.removeClass("tsvg-fancy-html5-hide");
}
} else {
inst.$prev.addClass("tsvg-fancy-html5-hide");
if (inst.$prevbottom) {
inst.$prevbottom.addClass("tsvg-fancy-html5-hide");
}
if (inst.$prevtouch) {
inst.$prevtouch.addClass("tsvg-fancy-html5-hide");
}
}
if (showNext) {
inst.$next.removeClass("tsvg-fancy-html5-hide");
if (inst.$nextbottom) {
inst.$nextbottom.removeClass("tsvg-fancy-html5-hide");
}
if (inst.$nexttouch) {
inst.$nexttouch.removeClass("tsvg-fancy-html5-hide");
}
} else {
inst.$next.addClass("tsvg-fancy-html5-hide");
if (inst.$nextbottom) {
inst.$nextbottom.addClass("tsvg-fancy-html5-hide");
}
if (inst.$nexttouch) {
inst.$nexttouch.addClass("tsvg-fancy-html5-hide");
}
}
};
inst.clickHandler = function (event) {
var $this = $(this);
var dataoptions = {};
if (jQuery(event.target).prop("tagName") == 'A') {
let link = jQuery(event.target).attr('href');
if (jQuery(event.target).attr('target') == '_blank') {
window.open(link);
} else {
window.location.assign(link)
}
return false;
}
$.each(
$this.data(),
function (key, value) {
dataoptions[key.toLowerCase()] = value;
}
);
inst.options = $.extend(inst.options, inst.defaultoptions, dataoptions);
$(window).trigger("html5lightbox.lightboxshow");
inst.init();
if (0 >= inst.elemArray.length) {
return true;
}
inst.hideObjects();
for (var i = 0; inst.elemArray.length > i ; i++) {
if (inst.elemArray[i][ELEM_ID] == $this.data("tsvgid")) {
break;
}
}
if (i == inst.elemArray.length) {
return true;
}
inst.options.curElem = i;
inst.calcNextPrevElem();
inst.reset();
inst.$lightbox.show();
var boxPos = inst.calcBoxPosition(inst.options.loadingwidth, inst.options.loadingheight);
var boxW = boxPos[0];
var boxH = boxPos[1];
var boxT = boxPos[2];
if (inst.options.iequirksmode) {
inst.$lightboxBox.css({ top: boxT });
} else {
inst.$lightboxBox.css({ "margin-top": boxT });
}
if (!inst.options.positionFixed) {
inst.$lightboxBox.css("margin-top", $(window).scrollTop() + inst.options.bordertopmargin);
}
if (inst.options.titlestyle == "left" || inst.options.titlestyle == "right") {
inst.$lightboxBox.css({ width: boxW, height: boxH });
} else {
inst.$lightboxBox.css({ width: boxW, height: "auto" });
inst.$elemWrap.css({ width: boxW, height: boxH });
}
inst.loadCurElem();
return false;
};
inst.loadThumbnail = function (src, index) {
let inst_img_elem = document.createElement('img');
inst_img_elem.src = src;
inst_img_elem.addEventListener('load', function () {
if (inst.options.thumbwidth / inst.options.thumbheight >= inst_img_elem.naturalWidth / inst_img_elem.naturalHeight ) {
inst_img_elem.setAttribute("style","width:100%;")
} else {
inst_img_elem.setAttribute("style","height:100%;")
}
$(".tsvg-fancy-html5-nav-thumb").eq(index).html(inst_img_elem);
})
inst_img_elem.addEventListener('error', function () {
console.log('error')
})
};
inst.matchGroup = function (curGroup, elemGroup) {
if (!curGroup || !elemGroup) {
return false;
}
var curs = curGroup.split(":");
var elems = elemGroup.split(":");
var result = false;
for (var i in curs) {
if ($.inArray(curs[i], elems) > -1) {
result = true;
break;
}
}
return result;
};
inst.showNavigation = function () {
if (!inst.options.shownavigation) {
return;
}
if (!inst.currentElem || !inst.currentElem[ELEM_GROUP]) {
return;
}
var i;
var showNav = false;
var group = inst.currentElem[ELEM_GROUP];
for (i = 0; inst.elemArray.length > i ; i++) {
if (inst.matchGroup(group, inst.elemArray[i][ELEM_GROUP])) {
if (inst.elemArray[i][ELEM_THUMBNAIL] && inst.elemArray[i][ELEM_THUMBNAIL].length > 0) {
showNav = true;
break;
}
}
}
if (!showNav) {
return;
}
inst.options.navheight = inst.options.thumbheight + inst.options.thumbtopmargin + inst.options.thumbbottommargin;
if ($(".tsvg-fancy-html5-nav").length > 0) {
return;
}
var check_bool = $('.tsvg-fancy-blocks-container').attr('data-tsvg-shn');
if (check_bool === 'false') {
return
}
$("body").append(
"
" +
"
" +
"
" +
"
" +
"" +
"
" +
"
" +
"
" +
"
"
);
if (TS_VG_FG_Show_Nav == "true") {
var index = 0;
}
for (i = 0; inst.elemArray.length > i ; i++) {
if (inst.matchGroup(group, inst.elemArray[i][ELEM_GROUP])) {
if (inst.elemArray[i][ELEM_THUMBNAIL] && inst.elemArray[i][ELEM_THUMBNAIL].length > 0) {
$(".tsvg-fancy-html5-nav-list").append(
"
'
"
);
this.loadThumbnail(inst.elemArray[i][ELEM_THUMBNAIL], index)
index++;
}
}
}
$(".tsvg-fancy-html5-nav-thumb").hover(
function () {
$(this).css({ opacity: 1 });
$(this).css({ border: inst.options.thumbborder + "px solid " + inst.options.thumbhighlightbordercolor });
},
function () {
$(this).css({ opacity: inst.options.thumbopacity });
$(this).css({ border: inst.options.thumbborder + "px solid " + inst.options.thumbbordercolor });
}
);
$(".tsvg-fancy-html5-nav-thumb").click(
function () {
var index = $(this).data("arrayindex");
if (index >= 0) {
inst.gotoSlide(index);
}
}
);
inst.options.totalwidth = index * (inst.options.thumbgap + inst.options.thumbwidth + 2 * inst.options.thumbborder);
$(".tsvg-fancy-html5-nav-list")
.css({ display: "block", position: "relative", "margin-left": 0, width: inst.options.totalwidth + "px" })
.append("");
var $navMask = $(".tsvg-fancy-html5-nav-mask");
var $navPrev = $(".tsvg-fancy-html5-nav-prev");
var $navNext = $(".tsvg-fancy-html5-nav-next");
$navPrev.click(
function () {
var $navList = $(".tsvg-fancy-html5-nav-list");
var $navNext = $(".tsvg-fancy-html5-nav-next");
var winWidth = $(window).width();
var maskWidth = winWidth - 2 * inst.options.navbuttonwidth;
var marginLeft = parseInt($navList.css("margin-left")) + maskWidth;
if (marginLeft >= 0) {
marginLeft = 0;
$(this).css({ "background-position": "center left" });
} else {
$(this).css({ "background-position": "center right" });
}
if (maskWidth - inst.options.totalwidth >= marginLeft ) {
$navNext.css({ "background-position": "center left" });
} else {
$navNext.css({ "background-position": "center right" });
}
$navList.animate({ "margin-left": marginLeft });
}
);
$navNext.click(
function () {
var $navList = $(".tsvg-fancy-html5-nav-list");
var $navPrev = $(".tsvg-fancy-html5-nav-prev");
var winWidth = $(window).width();
var maskWidth = winWidth - 2 * inst.options.navbuttonwidth;
var marginLeft = parseInt($navList.css("margin-left")) - maskWidth;
if (maskWidth - inst.options.totalwidth >= marginLeft) {
marginLeft = maskWidth - inst.options.totalwidth;
$(this).css({ "background-position": "center left" });
} else {
$(this).css({ "background-position": "center right" });
}
if (marginLeft >= 0) {
$navPrev.css({ "background-position": "center left" });
} else {
$navPrev.css({ "background-position": "center right" });
}
$navList.animate({ "margin-left": marginLeft });
}
);
var winWidth = $(window).width();
if (winWidth >= inst.options.totalwidth ) {
$navMask.css({ width: inst.options.totalwidth + "px" });
$navPrev.hide();
$navNext.hide();
} else {
$navMask.css({ width: winWidth - 2 * inst.options.navbuttonwidth + "px" });
$navPrev.show();
$navNext.show();
}
};
inst.loadElem = function (elem) {
inst.currentElem = elem;
inst.showing = true;
inst.showNavigation();
inst.$elem.unbind("mouseenter").unbind("mouseleave").unbind("mousemove");
inst.$loading.show();
if (inst.options.onshowitem && window[inst.options.onshowitem] && typeof window[inst.options.onshowitem] == "function") {
window[inst.options.onshowitem](elem);
}
switch (elem[ELEM_TYPE]) {
case 0:
var imgLoader = new Image();
$(imgLoader).load(
function () {
inst.showImage(elem, imgLoader.width, imgLoader.height);
}
);
$(imgLoader).error(
function () {
inst.showError();
}
);
imgLoader.src = elem[ELEM_HREF];
break;
case 1:
inst.showSWF(elem);
break;
case 2:
case 8:
inst.showVideo(elem);
break;
case 3:
case 4:
case 9:
case 11:
inst.showYoutubeVimeo(elem);
break;
case 5:
inst.showPDF(elem);
break;
case 6:
inst.showMP3(elem);
break;
case 7:
inst.showWeb(elem);
break;
case 10:
inst.showDiv(elem);
break;
}
if (inst.options.googleanalyticsaccount && window._gaq) {
window._gaq.push(["_trackEvent", "Lightbox", "Open", elem[ELEM_HREF]]);
}
};
inst.loadCurElem = function () {
inst.loadElem(inst.elemArray[inst.options.curElem]);
};
inst.showError = function () {
inst.$loading.hide();
inst.resizeLightbox(
inst.options.errorwidth,
inst.options.errorheight,
true,
function () {
inst.$error.show();
inst.$elem.fadeIn(
inst.options.fadespeed,
function () {
inst.showData();
}
);
}
);
};
inst.calcTextWidth = function (objW) {
return objW - 36;
};
(inst.showTitle = function (w, t, description) {
if (inst.options.titlestyle == "inside") {
inst.$elemData.css({ width: w + "px" });
}
var text = "";
if (inst.options.showtitle) {
if (t && t.length > 0) {
text += t;
}
}
if (inst.options.inGroup) {
if (inst.options.showtitleprefix) {
text = inst.options.titleprefix.replace("%NUM", inst.options.groupIndex + 1).replace("%TOTAL", inst.options.groupCount) + " " + text;
}
jQuery("#tsvg-fancy-html5-elem-data-box").css("display", "none");
if (inst.options.showplaybutton && TotalSoft_VG_FG_ShSlPlIc == "true" && TotalSoft_GV_FG_PT != "true") {
jQuery("#tsvg-fancy-html5-elem-data-box")
.css("display", "inline-block")
.html(
"
';
}
if (inst.options.showtwitter) {
socialCode +=
'
';
}
if (inst.options.showpinterest) {
socialCode +=
'
';
}
socialCode += "
";
inst.$lightboxBox.append(socialCode);
$(".tsvg-fancy-html5-social-btn", inst.$lightbox).click(
function () {
var shareUrl = window.location.href + (0 > window.location.href.indexOf("?") ? "?" : "&") + "html5lightboxshare=" + encodeURIComponent(inst.currentElem[ELEM_HREF]);
var shareTitle = inst.currentElem[ELEM_TITLE];
var shareMedia = inst.currentElem[ELEM_HREF];
if (inst.currentElem[ELEM_TYPE] == 0) {
shareMedia = inst.absoluteUrl(inst.currentElem[ELEM_HREF]);
} else if (inst.currentElem[ELEM_TYPE] == 3) {
shareMedia = "https://img.youtube.com/vi/" + inst.getYoutubeId(inst.currentElem[ELEM_HREF]) + "/0.jpg";
} else {
var lightboxLink = $('.tsvg-html5lightbox-491211[href="' + inst.currentElem[ELEM_HREF] + '"]');
if (lightboxLink.length > 0)
if (lightboxLink.data("shareimage") && lightboxLink.data("shareimage").length > 0) {
shareMedia = inst.absoluteUrl(lightboxLink.data("shareimage"));
} else if (lightboxLink.data("thumbnail") && lightboxLink.data("thumbnail").length > 0) {
shareMedia = inst.absoluteUrl(lightboxLink.data("thumbnail"));
} else {
var lightboxImg = $("img", lightboxLink);
if (lightboxImg.length > 0) {
shareMedia = inst.absoluteUrl(lightboxImg.attr("src"));
}
}
}
var isVideo =
inst.currentElem[ELEM_TYPE] == 2 ||
inst.currentElem[ELEM_TYPE] == 3 ||
inst.currentElem[ELEM_TYPE] == 4 ||
inst.currentElem[ELEM_TYPE] == 8 ||
inst.currentElem[ELEM_TYPE] == 9 ||
inst.currentElem[ELEM_TYPE] == 11;
if ($(this).hasClass("tsvg-fancy-html5-social-facebook")) {
window.open("https://www.facebook.com/sharer/sharer.php?u=" + encodeURIComponent(shareUrl) + "&t=" + encodeURIComponent(shareTitle), "_blank");
} else if ($(this).hasClass("tsvg-fancy-html5-social-twitter")) {
window.open("https://twitter.com/share?url=" + encodeURIComponent(shareUrl) + "&text=" + encodeURIComponent(shareTitle), "_blank");
} else if ($(this).hasClass("tsvg-fancy-html5-social-pinterest")) {
window.open(
"https://pinterest.com/pin/create/bookmarklet/?media=" +
encodeURIComponent(shareMedia) +
"&url=" +
encodeURIComponent(shareUrl) +
"&description=" +
encodeURIComponent(shareTitle) +
"&is_video=" +
(isVideo ? "true" : "false"),
"_blank"
);
}
return false;
}
);
}
inst.$watermark = $("#tsvg-fancy-html5-watermark", inst.$lightbox);
if (inst.options.stamp) {
inst.$watermark.html("");
} else if (inst.options.watermark) {
var html = "";
if (inst.options.watermarklink) {
html = "" + html + "";
}
inst.$watermark.html(html);
}
if (inst.options.closeonoverlay) {
$("#tsvg-fancy-html5-lightbox-overlay", inst.$lightbox).click(inst.finish);
}
inst.$close.click(inst.finish);
inst.$next.click(
function () {
inst.nextArrowClicked();
}
);
inst.$prev.click(
function () {
inst.prevArrowClicked();
}
);
$(window).resize(
function () {
clearTimeout(inst.options.resizeTimeout);
inst.options.resizeTimeout = setTimeout(
function () {
inst.resizeWindow();
},
500
);
}
);
$(window).scroll(
function () {
inst.scrollBox();
}
);
$(window).bind(
"orientationchange",
function (e) {
if (inst.options.isMobile) {
inst.resizeWindow();
}
}
);
if (inst.options.isIPhone) {
inst.options.windowInnerHeight = window.innerHeight;
setInterval(
function () {
if (inst.options.windowInnerHeight != window.innerHeight) {
inst.options.windowInnerHeight = window.innerHeight;
inst.resizeWindow();
}
},
500
);
}
if (inst.options.enabletouchswipe) {
inst.enableSwipe();
}
};
inst.slideTimer = function (interval, callback, updatecallback) {
let timerInstance = this,
updateinterval = 50,
updateTimerId = null,
runningTime = 0,
paused = false,
started = false,
startedandpaused = false;
timerInstance.timeout = interval;
this.pause = function () {
if (started) {
paused = true;
clearInterval(updateTimerId);
}
};
this.resume = function (forceresume) {
if (startedandpaused && !forceresume) {
return;
}
startedandpaused = false;
if (started && paused) {
paused = false;
updateTimerId = setInterval(
function () {
runningTime += updateinterval;
if (runningTime > timerInstance.timeout) {
clearInterval(updateTimerId);
if (callback) {
callback();
}
}
if (updatecallback) {
updatecallback(runningTime / timerInstance.timeout);
}
},
updateinterval
);
}
};
this.stop = function () {
clearInterval(updateTimerId);
if (updatecallback) {
updatecallback(-1);
}
runningTime = 0;
paused = false;
started = false;
};
this.start = function () {
runningTime = 0;
paused = false;
started = true;
updateTimerId = setInterval(
function () {
runningTime += updateinterval;
if (runningTime > timerInstance.timeout) {
clearInterval(updateTimerId);
if (callback) {
callback();
}
}
if (updatecallback) {
updatecallback(runningTime / timerInstance.timeout);
}
},
updateinterval
);
};
this.startandpause = function () {
runningTime = 0;
paused = true;
started = true;
startedandpaused = true;
};
return this;
};
inst.updateTimer = function (percent) {
var w = Math.round(percent * 100);
if (w > 100) {
w = 100;
}
if (0 > w ) {
w = 0;
}
$("#tsvg-fancy-html5-timer", inst.$lightbox).css({ display: "block", width: w + "%" });
};
inst.initSlide = function () {
inst.autosliding = false;
inst.slideTimeout = inst.slideTimer(
inst.options.slideinterval,
function () {
inst.gotoSlide(-1);
},
inst.options.showtimer
? function (percent) {
inst.updateTimer(percent);
}
: null
);
if (inst.options.autoslide) {
inst.slideTimeout.stop();
inst.autosliding = true;
}
};
inst.nextArrowClicked = function () {
if (inst.options.curElem >= inst.options.nextElem) {
if (inst.options.onlastarrowclicked && window[inst.options.onlastarrowclicked] && typeof window[inst.options.onlastarrowclicked] == "function") {
window[inst.options.onlastarrowclicked]();
}
}
inst.gotoSlide(-1);
};
inst.prevArrowClicked = function () {
if (inst.options.prevElem >= inst.options.curElem) {
if (inst.options.onfirstarrowclicked && window[inst.options.onfirstarrowclicked] && typeof window[inst.options.onfirstarrowclicked] == "function") {
window[inst.options.onfirstarrowclicked]();
}
}
inst.gotoSlide(-2);
};
inst.calcNextPrevElem = function () {
inst.options.nextElem = -1;
inst.options.prevElem = -1;
inst.options.inGroup = false;
inst.options.groupIndex = 0;
inst.options.groupCount = 0;
var group = inst.elemArray[inst.options.curElem][ELEM_GROUP];
for (var i = 0; inst.elemArray.length > i; i++) {
if (inst.matchGroup(group, inst.elemArray[i][ELEM_GROUP])) {
if (i == inst.options.curElem) {
inst.options.groupIndex = inst.options.groupCount;
}
inst.options.groupCount++;
}
}
var j,
curGroup = inst.elemArray[inst.options.curElem][ELEM_GROUP];
if (curGroup != undefined && curGroup != null) {
for (j = inst.options.curElem + 1;inst.elemArray.length > j; j++) {
if (inst.matchGroup(curGroup, inst.elemArray[j][ELEM_GROUP])) {
inst.options.nextElem = j;
break;
}
}
if (0 > inst.options.nextElem) {
for (j = 0; inst.options.curElem > j ; j++) {
if (inst.matchGroup(curGroup, inst.elemArray[j][ELEM_GROUP])) {
inst.options.nextElem = j;
break;
}
}
}
if (inst.options.nextElem >= 0) {
for (j = inst.options.curElem - 1; j >= 0; j--) {
if (inst.matchGroup(curGroup, inst.elemArray[j][ELEM_GROUP])) {
inst.options.prevElem = j;
break;
}
}
if (0 > inst.options.prevElem ) {
for (j = inst.elemArray.length - 1; j > inst.options.curElem; j--) {
if (inst.matchGroup(curGroup, inst.elemArray[j][ELEM_GROUP])) {
inst.options.prevElem = j;
break;
}
}
}
}
}
if (inst.options.nextElem >= 0 || inst.options.prevElem >= 0) {
inst.options.inGroup = true;
}
};
inst.calcBoxPosition = function (initW, initH) {
var boxW = initW + 2 * inst.options.bordersize;
var boxH = initH + 2 * inst.options.bordersize;
var winH = window.innerHeight ? window.innerHeight : $(window).height();
var boxT = Math.round((winH - inst.options.navheight) / 2 - boxH / 2);
if (inst.options.titlestyle == "bottom") {
boxT -= Math.round(inst.options.barheight / 2);
}
var topmargin = inst.options.navarrowsbottomscreenwidth > $(window).width() ? inst.options.bordertopmarginsmall : inst.options.bordertopmargin;
if (topmargin > boxT) {
boxT = topmargin;
}
if (inst.options.insideiframe && window.self != window.top) {
if (parent.window.jQuery && parent.window.jQuery("#" + inst.options.iframeid).length) {
var iframetop = parent.window.jQuery("#" + inst.options.iframeid).offset().top;
var parentscroll = parent.window.document.body.scrollTop;
boxT = topmargin;
boxT += parentscroll > iframetop ? parentscroll - iframetop : 0;
}
}
return [boxW, boxH, boxT];
};
inst.hideNavArrows = function () {
var showPrev = false;
var showNext = false;
if (inst.options.inGroup) {
if (inst.options.arrowloop || (!inst.options.arrowloop && inst.options.curElem > inst.options.prevElem )) {
showPrev = true;
}
if (inst.options.arrowloop || (!inst.options.arrowloop && inst.options.curElem > inst.options.prevElem )) {
showNext = true;
}
}
if (showPrev) {
inst.$prev.removeClass("tsvg-fancy-html5-hide");
if (inst.$prevbottom) {
inst.$prevbottom.removeClass("tsvg-fancy-html5-hide");
}
if (inst.$prevtouch) {
inst.$prevtouch.removeClass("tsvg-fancy-html5-hide");
}
} else {
inst.$prev.addClass("tsvg-fancy-html5-hide");
if (inst.$prevbottom) {
inst.$prevbottom.addClass("tsvg-fancy-html5-hide");
}
if (inst.$prevtouch) {
inst.$prevtouch.addClass("tsvg-fancy-html5-hide");
}
}
if (showNext) {
inst.$next.removeClass("tsvg-fancy-html5-hide");
if (inst.$nextbottom) {
inst.$nextbottom.removeClass("tsvg-fancy-html5-hide");
}
if (inst.$nexttouch) {
inst.$nexttouch.removeClass("tsvg-fancy-html5-hide");
}
} else {
inst.$next.addClass("tsvg-fancy-html5-hide");
if (inst.$nextbottom) {
inst.$nextbottom.addClass("tsvg-fancy-html5-hide");
}
if (inst.$nexttouch) {
inst.$nexttouch.addClass("tsvg-fancy-html5-hide");
}
}
};
inst.clickHandler = function (event) {
var $this = $(this);
var dataoptions = {};
if (jQuery(event.target).prop("tagName") == 'A') {
let link = jQuery(event.target).attr('href');
if (jQuery(event.target).attr('target') == '_blank') {
window.open(link);
} else {
window.location.assign(link)
}
return false;
}
$.each(
$this.data(),
function (key, value) {
dataoptions[key.toLowerCase()] = value;
}
);
inst.options = $.extend(inst.options, inst.defaultoptions, dataoptions);
$(window).trigger("html5lightbox.lightboxshow");
inst.init();
if (0 >= inst.elemArray.length) {
return true;
}
inst.hideObjects();
for (var i = 0; inst.elemArray.length > i ; i++) {
if (inst.elemArray[i][ELEM_ID] == $this.data("tsvgid")) {
break;
}
}
if (i == inst.elemArray.length) {
return true;
}
inst.options.curElem = i;
inst.calcNextPrevElem();
inst.reset();
inst.$lightbox.show();
var boxPos = inst.calcBoxPosition(inst.options.loadingwidth, inst.options.loadingheight);
var boxW = boxPos[0];
var boxH = boxPos[1];
var boxT = boxPos[2];
if (inst.options.iequirksmode) {
inst.$lightboxBox.css({ top: boxT });
} else {
inst.$lightboxBox.css({ "margin-top": boxT });
}
if (!inst.options.positionFixed) {
inst.$lightboxBox.css("margin-top", $(window).scrollTop() + inst.options.bordertopmargin);
}
if (inst.options.titlestyle == "left" || inst.options.titlestyle == "right") {
inst.$lightboxBox.css({ width: boxW, height: boxH });
} else {
inst.$lightboxBox.css({ width: boxW, height: "auto" });
inst.$elemWrap.css({ width: boxW, height: boxH });
}
inst.loadCurElem();
return false;
};
inst.loadThumbnail = function (src, index) {
let inst_img_elem = document.createElement('img');
inst_img_elem.src = src;
inst_img_elem.addEventListener('load', function () {
if (inst.options.thumbwidth / inst.options.thumbheight >= inst_img_elem.naturalWidth / inst_img_elem.naturalHeight ) {
inst_img_elem.setAttribute("style","width:100%;")
} else {
inst_img_elem.setAttribute("style","height:100%;")
}
$(".tsvg-fancy-html5-nav-thumb").eq(index).html(inst_img_elem);
})
inst_img_elem.addEventListener('error', function () {
console.log('error')
})
};
inst.matchGroup = function (curGroup, elemGroup) {
if (!curGroup || !elemGroup) {
return false;
}
var curs = curGroup.split(":");
var elems = elemGroup.split(":");
var result = false;
for (var i in curs) {
if ($.inArray(curs[i], elems) > -1) {
result = true;
break;
}
}
return result;
};
inst.showNavigation = function () {
if (!inst.options.shownavigation) {
return;
}
if (!inst.currentElem || !inst.currentElem[ELEM_GROUP]) {
return;
}
var i;
var showNav = false;
var group = inst.currentElem[ELEM_GROUP];
for (i = 0; inst.elemArray.length > i ; i++) {
if (inst.matchGroup(group, inst.elemArray[i][ELEM_GROUP])) {
if (inst.elemArray[i][ELEM_THUMBNAIL] && inst.elemArray[i][ELEM_THUMBNAIL].length > 0) {
showNav = true;
break;
}
}
}
if (!showNav) {
return;
}
inst.options.navheight = inst.options.thumbheight + inst.options.thumbtopmargin + inst.options.thumbbottommargin;
if ($(".tsvg-fancy-html5-nav").length > 0) {
return;
}
var check_bool = $('.tsvg-fancy-blocks-container').attr('data-tsvg-shn');
if (check_bool === 'false') {
return
}
$("body").append(
"
" +
"
" +
"
" +
"
" +
"" +
"
" +
"
" +
"
" +
"
"
);
if (TS_VG_FG_Show_Nav == "true") {
var index = 0;
}
for (i = 0; inst.elemArray.length > i ; i++) {
if (inst.matchGroup(group, inst.elemArray[i][ELEM_GROUP])) {
if (inst.elemArray[i][ELEM_THUMBNAIL] && inst.elemArray[i][ELEM_THUMBNAIL].length > 0) {
$(".tsvg-fancy-html5-nav-list").append(
"
'
"
);
this.loadThumbnail(inst.elemArray[i][ELEM_THUMBNAIL], index)
index++;
}
}
}
$(".tsvg-fancy-html5-nav-thumb").hover(
function () {
$(this).css({ opacity: 1 });
$(this).css({ border: inst.options.thumbborder + "px solid " + inst.options.thumbhighlightbordercolor });
},
function () {
$(this).css({ opacity: inst.options.thumbopacity });
$(this).css({ border: inst.options.thumbborder + "px solid " + inst.options.thumbbordercolor });
}
);
$(".tsvg-fancy-html5-nav-thumb").click(
function () {
var index = $(this).data("arrayindex");
if (index >= 0) {
inst.gotoSlide(index);
}
}
);
inst.options.totalwidth = index * (inst.options.thumbgap + inst.options.thumbwidth + 2 * inst.options.thumbborder);
$(".tsvg-fancy-html5-nav-list")
.css({ display: "block", position: "relative", "margin-left": 0, width: inst.options.totalwidth + "px" })
.append("");
var $navMask = $(".tsvg-fancy-html5-nav-mask");
var $navPrev = $(".tsvg-fancy-html5-nav-prev");
var $navNext = $(".tsvg-fancy-html5-nav-next");
$navPrev.click(
function () {
var $navList = $(".tsvg-fancy-html5-nav-list");
var $navNext = $(".tsvg-fancy-html5-nav-next");
var winWidth = $(window).width();
var maskWidth = winWidth - 2 * inst.options.navbuttonwidth;
var marginLeft = parseInt($navList.css("margin-left")) + maskWidth;
if (marginLeft >= 0) {
marginLeft = 0;
$(this).css({ "background-position": "center left" });
} else {
$(this).css({ "background-position": "center right" });
}
if (maskWidth - inst.options.totalwidth >= marginLeft ) {
$navNext.css({ "background-position": "center left" });
} else {
$navNext.css({ "background-position": "center right" });
}
$navList.animate({ "margin-left": marginLeft });
}
);
$navNext.click(
function () {
var $navList = $(".tsvg-fancy-html5-nav-list");
var $navPrev = $(".tsvg-fancy-html5-nav-prev");
var winWidth = $(window).width();
var maskWidth = winWidth - 2 * inst.options.navbuttonwidth;
var marginLeft = parseInt($navList.css("margin-left")) - maskWidth;
if (maskWidth - inst.options.totalwidth >= marginLeft) {
marginLeft = maskWidth - inst.options.totalwidth;
$(this).css({ "background-position": "center left" });
} else {
$(this).css({ "background-position": "center right" });
}
if (marginLeft >= 0) {
$navPrev.css({ "background-position": "center left" });
} else {
$navPrev.css({ "background-position": "center right" });
}
$navList.animate({ "margin-left": marginLeft });
}
);
var winWidth = $(window).width();
if (winWidth >= inst.options.totalwidth ) {
$navMask.css({ width: inst.options.totalwidth + "px" });
$navPrev.hide();
$navNext.hide();
} else {
$navMask.css({ width: winWidth - 2 * inst.options.navbuttonwidth + "px" });
$navPrev.show();
$navNext.show();
}
};
inst.loadElem = function (elem) {
inst.currentElem = elem;
inst.showing = true;
inst.showNavigation();
inst.$elem.unbind("mouseenter").unbind("mouseleave").unbind("mousemove");
inst.$loading.show();
if (inst.options.onshowitem && window[inst.options.onshowitem] && typeof window[inst.options.onshowitem] == "function") {
window[inst.options.onshowitem](elem);
}
switch (elem[ELEM_TYPE]) {
case 0:
var imgLoader = new Image();
$(imgLoader).load(
function () {
inst.showImage(elem, imgLoader.width, imgLoader.height);
}
);
$(imgLoader).error(
function () {
inst.showError();
}
);
imgLoader.src = elem[ELEM_HREF];
break;
case 1:
inst.showSWF(elem);
break;
case 2:
case 8:
inst.showVideo(elem);
break;
case 3:
case 4:
case 9:
case 11:
inst.showYoutubeVimeo(elem);
break;
case 5:
inst.showPDF(elem);
break;
case 6:
inst.showMP3(elem);
break;
case 7:
inst.showWeb(elem);
break;
case 10:
inst.showDiv(elem);
break;
}
if (inst.options.googleanalyticsaccount && window._gaq) {
window._gaq.push(["_trackEvent", "Lightbox", "Open", elem[ELEM_HREF]]);
}
};
inst.loadCurElem = function () {
inst.loadElem(inst.elemArray[inst.options.curElem]);
};
inst.showError = function () {
inst.$loading.hide();
inst.resizeLightbox(
inst.options.errorwidth,
inst.options.errorheight,
true,
function () {
inst.$error.show();
inst.$elem.fadeIn(
inst.options.fadespeed,
function () {
inst.showData();
}
);
}
);
};
inst.calcTextWidth = function (objW) {
return objW - 36;
};
(inst.showTitle = function (w, t, description) {
if (inst.options.titlestyle == "inside") {
inst.$elemData.css({ width: w + "px" });
}
var text = "";
if (inst.options.showtitle) {
if (t && t.length > 0) {
text += t;
}
}
if (inst.options.inGroup) {
if (inst.options.showtitleprefix) {
text = inst.options.titleprefix.replace("%NUM", inst.options.groupIndex + 1).replace("%TOTAL", inst.options.groupCount) + " " + text;
}
jQuery("#tsvg-fancy-html5-elem-data-box").css("display", "none");
if (inst.options.showplaybutton && TotalSoft_VG_FG_ShSlPlIc == "true" && TotalSoft_GV_FG_PT != "true") {
jQuery("#tsvg-fancy-html5-elem-data-box")
.css("display", "inline-block")
.html(
"
');
}else{
jQuery('.tsvg-section-491211 .tsvg-pagination-pages-wrapper').find('.btn-lg').html('');
}
}, 2000 );
}
})
tsvgPaginationCreate491211(jQuery('.tsvg-section-491211 .tsvg-main-content-491211 figure ul li').not('.tsvg-layout-item-show'),0, numberItemsPerPage)
}
}
function tsvgNewPagination491211(){
var interval_pag_fn_491211 = setInterval(setPagina_491211, 100);
function setPagina_491211() {
if( typeof(jQuery) != "undefined" && jQuery != null){
if( jQuery('.tsvg-main-content-491211').attr("data-pagination")=='pagination'){
tsvgPaginationGenerate491211();
}
if( jQuery('.tsvg-main-content-491211').attr("data-pagination")=='load-more'){
tsvgPaginationGenerate491211();
}
clearInterval(interval_pag_fn_491211);
}
}
}
tsvgNewPagination491211();
function tsvgPaginationGenerate(){
tsvgPaginationGenerate491211();
}
function getPoint(point, i, a, smoothing) {
let cp = (current, previous, next, reverse) => {
let p = previous || current,
n = next || current,
o = {
length: Math.sqrt(Math.pow(n[0] - p[0], 2) + Math.pow(n[1] - p[1], 2)),
angle: Math.atan2(n[1] - p[1], n[0] - p[0])
},
angle = o.angle + (reverse ? Math.PI : 0),
length = o.length * smoothing;
return [current[0] + Math.cos(angle) * length, current[1] + Math.sin(angle) * length];
},
cps = cp(a[i - 1], a[i - 2], point, false),
cpe = cp(point, a[i - 1], a[i + 1], true);
return `C ${cps[0]},${cps[1]} ${cpe[0]},${cpe[1]} ${point[0]},${point[1]}`;
}
function getPath(update, smoothing, pointsNew) {
let points = pointsNew ? pointsNew : [
[4, 12],
[12, update],
[20, 12]
],
d = points.reduce((acc, point, i, a) => i === 0 ? `M ${point[0]},${point[1]}` : `${acc} ${getPoint(point, i, a, smoothing)}`, '');
return ``;
}
To subscribe to Vin Mistrys Youtube Channel, please see here.
To see more of Vins work with Vaani, please see the full Vaani channel here.
Manage Cookie Consent
To provide the best experiences, we use technologies like cookies to store and/or access device information. Consenting to these technologies will allow us to process data such as browsing behavior or unique IDs on this site. Not consenting or withdrawing consent, may adversely affect certain features and functions.
Functional
Always active
The technical storage or access is strictly necessary for the legitimate purpose of enabling the use of a specific service explicitly requested by the subscriber or user, or for the sole purpose of carrying out the transmission of a communication over an electronic communications network.
Preferences
The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
Statistics
The technical storage or access that is used exclusively for statistical purposes.The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
Marketing
The technical storage or access is required to create user profiles to send advertising, or to track the user on a website or across several websites for similar marketing purposes.