PageSourceSearch

https://nabilak.com/wp-content/plugins/wonderplugin-lightbox/engine/wonderpluginlightbox.js

js nabilak.com collected 2026-09-30 10:01:48 UTC 166,868 bytes, 3,063 lines download raw bytes

1/** Wonderplugin Lightbox Plugin Free Version
2 * Copyright 2015 Magic Hills Pty Ltd All Rights Reserved
3 * Website: http://www.wonderplugin.com
4 * Version 6.1 
5 */
6(function() {
7var scripts = document.getElementsByTagName("script");
8        var jsFolder = "";
9        for (var i = 0; i < scripts.length; i++)
10        if (scripts[i].src && scripts[i].src.match(/html5lightbox\.js/i))
11        jsFolder = scripts[i].src.substr(0, scripts[i].src.lastIndexOf("/") + 1);
12        var loadjQuery = false;
13        if (typeof jQuery == "undefined")
14        loadjQuery = true;
15        else {
16var jVersion = jQuery.fn.jquery.split(".");
17        if (jVersion[0] < 1 || jVersion[0] == 1 && jVersion[1] < 6)
18        loadjQuery = true
19}
20if (loadjQuery) {
21var head = document.getElementsByTagName("head")[0];
22        var script = document.createElement("script");
23        script.setAttribute("type", "text/javascript");
24        if (script.readyState)
25        script.onreadystatechange = function() {
26if (script.readyState == "loaded" || script.readyState == "complete") {
27script.onreadystatechange = null;
28        loadHtml5LightBox(jsFolder)
29}
30};
31        else
32        script.onload = function() {
33loadHtml5LightBox(jsFolder)
34};
35        script.setAttribute("src", jsFolder + "jquery.js");
36        head.appendChild(script)
37} else
38        loadHtml5LightBox(jsFolder)
39        })();
40        function loadHtml5LightBox(jsFolder) {
41        (function($) {
42        $.fn.wonderpluginlightbox = function(options) {
43        var inst = this;
44                inst.options = $.extend({
45        freelink: "http://www.wonderplugin.com/wordpress-lightbox/",
46                defaultvideovolume: 1,
47                autoclose: false,
48                autoclosedelay: 0,
49                resizedelay: 100,
50                insideiframe: false,
51                autoresizecontent: true,
52                defaultwidth: 960,
53                defaultheight: 540,
54                usedefaultsizeforcontent: false,
55                autoplay: true,
56                loopvideo: false,
57                html5player: true,
58                responsive: true,
59                nativehtml5controls: false,
60                videohidecontrols: false,
61                nativecontrolsonfirefox: true,
62                nativecontrolsonie: true,
63                nativecontrolsonandroid: true,
64                imagekeepratio: true,
65                maxheight: false,
66                elemautoheight: false,
67                useflashonie9: true,
68                useflashonie10: true,
69                useflashonie11: false,
70                useflashformp4onfirefox: false,
71                transition: "none",
72                transitionduration: 400,
73                enablepdfjs: true,
74                pdfjsengine: "",
75                openpdfinnewtaboniphone: false,
76                openpdfinnewtabonipad: false,
77                googleanalyticsaccount: "",
78                arrowloop: true,
79                showall: false,
80                userelforgroup: true,
81                shownavigation: true,
82                thumbwidth: 96,
83                thumbheight: 72,
84                thumbgap: 4,
85                thumbtopmargin: 12,
86                thumbbottommargin: 12,
87                thumbborder: 1,
88                thumbbordercolor: "transparent",
89                thumbhighlightbordercolor: "#fff",
90                thumbopacity: 1,
91                navbuttonwidth: 32,
92                navbgcolor: "rgba(0,0,0,0.2)",
93                shownavcontrol: true,
94                navcontrolimage: "lightbox-navcontrol.png",
95                hidenavdefault: false,
96                overlaybgcolor: "#000",
97                overlayopacity: 0.9,
98                bgcolor: "#fff",
99                bordersize: 8,
100                borderradius: 0,
101                bordermargin: 16,
102                bordertopmargin: 48,
103                bordertopmarginsmall: 48,
104                barautoheight: true,
105                barheight: 64,
106                responsivebarheight: false,
107                smallscreenheight: 415,
108                barheightonsmallheight: 64,
109                notkeepratioonsmallheight: false,
110                loadingwidth: 64,
111                loadingheight: 64,
112                resizespeed: 400,
113                fadespeed: 400,
114                jsfolder: jsFolder,
115                skinsfoldername: "skins/default/",
116                loadingimage: "lightbox-loading.gif",
117                nextimage: "lightbox-next.png",
118                previmage: "lightbox-prev.png",
119                closeimage: "remove-product.svg",
120                playvideoimage: "lightbox-playvideo.png",
121                titlebgimage: "lightbox-titlebg.png",
122                navarrowsprevimage: "lightbox-navprev.png",
123                navarrowsnextimage: "lightbox-navnext.png",
124                navarrowsalwaysshowontouch: true,
125                navarrowsbottomscreenwidth: 479,
126                closeonoverlay: true,
127                alwaysshownavarrows: false,
128                showplaybutton: true,
129                playimage: "lightbox-play.png",
130                pauseimage: "lightbox-pause.png",
131                fullscreenmode: false,
132                fullscreencloseimage: "lightbox-close-fullscreen.png",
133                fullscreennextimage: "lightbox-next-fullscreen.png",
134                fullscreenprevimage: "lightbox-prev-fullscreen.png",
135                fullscreennomargin: false,
136                fullscreenmodeonsmallscreen: false,
137                fullscreennomarginonsmallscreen: false,
138                fullscreensmallscreenwidth: 736,
139                fullscreenbgcolor: "rgba(0, 0, 0, 0.9)",
140                fullscreennomargintextinside: false,
141                videobgcolor: "#000",
142                html5videoposter: "",
143                showtitle: true,
144                titlestyle: "bottom",
145                titleinsidecss: "color:#fff; font-size:16px; font-family:Arial,Helvetica,sans-serif; overflow:hidden; text-align:left; margin:4px 8px;",
146                titlebottomcss: "color:#333; font-size:16px; font-family:Arial,Helvetica,sans-serif; overflow:hidden; text-align:left;",
147                showdescription: true,
148                descriptioninsidecss: "color:#fff; font-size:12px; font-family:Arial,Helvetica,sans-serif; overflow:hidden; text-align:left; margin:4px 0px 0px; padding: 0px;",
149                descriptionbottomcss: "color:#333; font-size:12px; font-family:Arial,Helvetica,sans-serif; overflow:hidden; text-align:left; margin:4px 0px 0px; padding: 0px;",
150                fullscreentitlebottomcss: "color:#fff; font-size:16px; font-family:Arial,Helvetica,sans-serif; overflow:hidden; text-align:left; margin:4px 8px 8px;",
151                fullscreendescriptionbottomcss: "color:#fff; font-size:12px; font-family:Arial,Helvetica,sans-serif; overflow:hidden; text-align:left; margin:4px 0px 0px; padding: 0px;",
152                showsocialmedia: true,
153                socialmediaposition: "position:absolute;top:8px;right:8px;",
154                showtitleprefix: true,
155                titleprefix: "%NUM / %TOTAL",
156                autoslide: false,
157                slideinterval: 5E3,
158                showtimer: true,
159                timerposition: "bottom",
160                timerheight: 2,
161                timercolor: "#dc572e",
162                timeropacity: 1,
163                initvimeo: true,
164                inityoutube: true,
165                swipepreventdefaultonandroid: false,
166                initsocial: true,
167                showsocial: false,
168                socialposition: "position:absolute;top:100%;right:0;",
169                socialpositionsmallscreen: "position:absolute;top:100%;right:0;left:0;",
170                socialdirection: "horizontal",
171                socialbuttonsize: 32,
172                socialbuttonfontsize: 18,
173                socialrotateeffect: true,
174                showfacebook: true,
175                showtwitter: true,
176                showpinterest: true,
177                showemail: false,
178                imagepercentage: 75,
179                sidetobottomscreenwidth: 479,
180                errorwidth: 280,
181                errorheight: 48,
182                errorcss: "text-align:center; color:#ff0000; font-size:14px; font-family:Arial, sans-serif;",
183                enabletouchswipe: true,
184                mobileresizeevent: false,
185                swipedistance: 0,
186                bodynoscroll: false,
187                useabsolutepos: false,
188                useabsoluteposonmobile: false,
189                supportesckey: true,
190                supportarrowkeys: true,
191                version: "3.3",
192                stamp: true,
193                freemark: "87,111,114,100,80,114,101,115,115,32,76,105,103,104,116,98,111,120,32,70,114,101,101,32,86,101,114,115,105,111,110",
194                watermark: "",
195                watermarklink: ""
196        }, options);
197                if (typeof wonderpluginlightbox_options != "undefined" && wonderpluginlightbox_options)
198                $.extend(inst.options, wonderpluginlightbox_options);
199                if ($("div.wonderpluginlightbox_options").length)
200                $.each($("div.wonderpluginlightbox_options").data(), function(key,
201                value) {
202        inst.options[key.toLowerCase()] = value
203        });
204                if ($("div#wonderpluginlightbox_options").length)
205                $.each($("div#wonderpluginlightbox_options").data(), function(key, value) {
206        inst.options[key.toLowerCase()] = value
207        });
208                if ($("div#html5lightbox_general_options").length)
209                $.each($("div#html5lightbox_general_options").data(), function(key, value) {
210        inst.options[key.toLowerCase()] = value
211        });
212                var ELEM_TYPE = 0,
213                ELEM_HREF = 1,
214                ELEM_TITLE = 2,
215                ELEM_GROUP = 3,
216                ELEM_WIDTH = 4,
217                ELEM_HEIGHT = 5,
218                ELEM_HREF_WEBM = 6,
219                ELEM_HREF_OGG = 7,
220                ELEM_THUMBNAIL = 8,
221                ELEM_DESCRIPTION =
222                9,
223                ELEM_DIV = 10,
224                ELEM_ORIGINALWIDTH = 11,
225                ELEM_ORIGINALHEIGHT = 12,
226                ELEM_SOCIALMEDIA = 13;
227                inst.options.types = ["IMAGE", "FLASH", "VIDEO", "YOUTUBE", "VIMEO", "PDF", "MP3", "WEB", "FLV", "DAILYMOTION", "DIV", "WISTIA", "IFRAMEVIDEO"];
228                inst.options.htmlfolder = window.location.href.substr(0, window.location.href.lastIndexOf("/") + 1);
229                inst.options.skinsfolder = inst.options.skinsfoldername;
230                if (inst.options.skinsfolder.length > 0 && inst.options.skinsfolder[inst.options.skinsfolder.length - 1] != "/")
231                inst.options.skinsfolder += "/";
232                if (inst.options.skinsfolder.charAt(0) !=
233                "/" && inst.options.skinsfolder.substring(0, 5) != "http:" && inst.options.skinsfolder.substring(0, 6) != "https:")
234                inst.options.skinsfolder = inst.options.jsfolder + inst.options.skinsfolder;
235                var image_list = ["loadingimage", "nextimage", "previmage", "closeimage", "playvideoimage", "titlebgimage", "navarrowsprevimage", "navarrowsnextimage", "navcontrolimage", "playimage", "pauseimage", "fullscreencloseimage", "fullscreennextimage", "fullscreenprevimage"];
236                for (var i = 0; i < image_list.length; i++)
237                if (inst.options[image_list[i]])
238                if (inst.options[image_list[i]].substring(0,
239                7).toLowerCase() != "http://" && inst.options[image_list[i]].substring(0, 8).toLowerCase() != "https://")
240                inst.options[image_list[i]] = inst.options.skinsfolder + inst.options[image_list[i]];
241                var i;
242                var l;
243                var mark = "";
244                var bytes = inst.options.freemark.split(",");
245                for (i = 0; i < bytes.length; i++)
246                mark += String.fromCharCode(bytes[i]);
247                inst.options.freemark = mark;
248                var d0 = "wmoangdiecrpluginh.iclolms";
249                for (i = 1; i <= 5; i++)
250                d0 = d0.slice(0, i) + d0.slice(i + 1);
251                l = d0.length;
252                for (i = 0; i < 5; i++)
253                d0 = d0.slice(0, l - 9 + i) + d0.slice(l - 8 + i);
254                if (inst.options.htmlfolder.indexOf(d0) !=
255                - 1)
256                inst.options.stamp = false;
257                inst.options.flashInstalled = false;
258                try {
259        if (new ActiveXObject("ShockwaveFlash.ShockwaveFlash"))
260                inst.options.flashInstalled = true
261        } catch (e) {
262        if (navigator.mimeTypes["application/x-shockwave-flash"])
263                inst.options.flashInstalled = true
264        }
265        inst.options.html5VideoSupported = !!document.createElement("video").canPlayType;
266                inst.options.isChrome = navigator.userAgent.match(/Chrome/i) != null;
267                inst.options.isFirefox = navigator.userAgent.match(/Firefox/i) != null;
268                inst.options.isOpera = navigator.userAgent.match(/Opera/i) !=
269                null || navigator.userAgent.match(/OPR\//i) != null;
270                inst.options.isSafari = navigator.userAgent.match(/Safari/i) != null;
271                inst.options.isIE11 = navigator.userAgent.match(/Trident\/7/) != null && navigator.userAgent.match(/rv:11/) != null;
272                inst.options.isIE = navigator.userAgent.match(/MSIE/i) != null && !inst.options.isOpera;
273                inst.options.isIE10 = navigator.userAgent.match(/MSIE 10/i) != null && !this.options.isOpera;
274                inst.options.isIE9 = navigator.userAgent.match(/MSIE 9/i) != null && !inst.options.isOpera;
275                inst.options.isIE8 = navigator.userAgent.match(/MSIE 8/i) !=
276                null && !inst.options.isOpera;
277                inst.options.isIE7 = navigator.userAgent.match(/MSIE 7/i) != null && !inst.options.isOpera;
278                inst.options.isIE6 = navigator.userAgent.match(/MSIE 6/i) != null && !inst.options.isOpera;
279                inst.options.isIE678 = inst.options.isIE6 || inst.options.isIE7 || inst.options.isIE8;
280                inst.options.isIE6789 = inst.options.isIE6 || inst.options.isIE7 || inst.options.isIE8 || inst.options.isIE9;
281                inst.options.isAndroid = navigator.userAgent.match(/Android/i) != null;
282                inst.options.isIPad = navigator.userAgent.match(/iPad/i) !=
283                null;
284                inst.options.isIPhone = navigator.userAgent.match(/iPod/i) != null || navigator.userAgent.match(/iPhone/i) != null;
285                inst.options.isIOS = inst.options.isIPad || inst.options.isIPhone;
286                inst.options.isMobile = inst.options.isAndroid || inst.options.isIPad || inst.options.isIPhone;
287                inst.options.isIOSLess5 = inst.options.isIPad && inst.options.isIPhone && (navigator.userAgent.match(/OS 4/i) != null || navigator.userAgent.match(/OS 3/i) != null);
288                inst.options.supportCSSPositionFixed = !inst.options.isIE6 && !inst.options.isIOSLess5;
289                inst.options.iequirksmode =
290                inst.options.isIE6789 && document.compatMode != "CSS1Compat";
291                inst.options.isTouch = "ontouchstart" in window;
292                if (inst.options.isAndroid) {
293        var match = navigator.userAgent.match(/Android\s([0-9\.]*)/i);
294                inst.options.androidVersion = match && match.length >= 2 ? parseInt(match[1], 10) : - 1
295        }
296        var v = document.createElement("video");
297                inst.options.canplaymp4 = v && v.canPlayType && v.canPlayType("video/mp4").replace(/no/, "");
298                if (inst.options.isMobile)
299                inst.options.autoplay = false;
300                if (inst.options.isFirefox && inst.options.nativecontrolsonfirefox ||
301                inst.options.isAndroid && inst.options.nativecontrolsonandroid)
302                inst.options.nativehtml5controls = true;
303                if ((inst.options.isIE6789 || inst.options.isIE10 || inst.options.isIE11) && inst.options.nativecontrolsonie)
304                inst.options.nativehtml5controls = true;
305                inst.options.navheight = 0;
306                inst.options.thumbgap += 2 * inst.options.thumbborder;
307                inst.options.resizeTimeout = - 1;
308                inst.slideTimeout = null;
309                inst.autosliding = false;
310                inst.existingElem = - 1;
311                inst.direction = - 3;
312                inst.elemArray = new Array;
313                inst.options.curElem = - 1;
314                inst.defaultoptions = $.extend({},
315                inst.options);
316                if (inst.options.googleanalyticsaccount && !window._gaq) {
317        window._gaq = window._gaq || [];
318                window._gaq.push(["_setAccount", inst.options.googleanalyticsaccount]);
319                window._gaq.push(["_trackPageview"]);
320                $.getScript("https://ssl.google-analytics.com/ga.js")
321        }
322        if (inst.options.initvimeo) {
323        var tag = document.createElement("script");
324                tag.src = inst.options.jsfolder + "froogaloop2.min.js";
325                var firstScriptTag = document.getElementsByTagName("script")[0];
326                firstScriptTag.parentNode.insertBefore(tag, firstScriptTag)
327        }
328        if (inst.options.inityoutube) {
329        var tag =
330                document.createElement("script");
331                tag.src = "https://www.youtube.com/iframe_api";
332                var firstScriptTag = document.getElementsByTagName("script")[0];
333                firstScriptTag.parentNode.insertBefore(tag, firstScriptTag)
334        }
335        if (inst.options.initsocial)
336                $("head").append('<link rel="stylesheet" href="' + inst.options.jsfolder + 'icons/css/fontello.css" type="text/css" />');
337                inst.showing = false;
338                inst.navvisible = false;
339                inst.disableEscKey = function(isFullscreen) {
340        if (isFullscreen)
341                inst.disableesckeyinfullscreen = true;
342                else
343                setTimeout(function() {
344        inst.disableesckeyinfullscreen =
345                false
346        }, 1E3)
347        };
348                inst.supportKeyboard = function() {
349        inst.disableesckeyinfullscreen = false;
350                $(document).keyup(function(e) {
351        if (!inst.showing)
352                return;
353                if (!inst.disableesckeyinfullscreen && inst.options.supportesckey && e.keyCode == 27)
354                inst.finish();
355                else if (inst.options.supportarrowkeys)
356                if (e.keyCode == 39)
357                inst.gotoSlide( - 1);
358                else if (e.keyCode == 37)
359                inst.gotoSlide(-2)
360                });
361                if (inst.options.supportesckey) {
362                    document.addEventListener("MSFullscreenChange", function() {
363                        inst.disableEscKey(document.msFullscreenElement != null)
364                    }, false);
365                    document.addEventListener("webkitfullscreenchange",
366                            function() {
367                                inst.disableEscKey(document.webkitIsFullScreen)
368                            }, false)
369                }
370            };
371            inst.supportKeyboard();
372            inst.init = function() {
373                inst.showing = false;
374                inst.readData();
375                inst.createMarkup();
376                inst.initSlide()
377            };
378            inst.readData = function() {
379                inst.each(function() {
380                    if (this.nodeName.toLowerCase() != "a" && this.nodeName.toLowerCase() != "area")
381                        return;
382                    var $this = $(this);
383
384                    var fileType = "mediatype" in $this.data() ? $this.data("mediatype") : inst.checkType($this.attr("href"));
385                    if (fileType < 0)
386                        return;
387                    var title = $this.data("title") ? $this.data("title") : $this.attr("title");
388                    var group = $this.data("group") ? $this.data("group") : inst.options.userelforgroup ? $this.attr("rel") : null;
389                    for (var i = 0; i < inst.elemArray.length; i++)
390                        if ($this.attr("href") == inst.elemArray[i][ELEM_HREF]) {
391                            inst.elemArray[i][ELEM_TITLE] = title;
392                            inst.elemArray[i][ELEM_GROUP] = group;
393                            return
394                        }
395                    inst.elemArray.push(new Array(fileType, $this.attr("href"), title, group, $this.data("width"), $this.data("height"), $this.data("webm"), $this.data("ogg"), $this.data("thumbnail"), $this.data("description"), null, null, null, $this.data("socialmedia")));
396
397                })
398            };
399            inst.createMarkup = function() {
400                if ($(window).width() <= inst.options.fullscreensmallscreenwidth) {
401                    if (inst.options.fullscreenmodeonsmallscreen) {
402                        inst.options.fullscreenmode = true;
403                        if (inst.options.fullscreennomarginonsmallscreen)
404                            inst.options.fullscreennomargin = true
405                    }
406                    if (inst.options.fullscreenmode && inst.options.fullscreennomarginonsmallscreen)
407                        inst.options.fullscreennomargin = true
408                }
409                if (inst.options.fullscreenmode && inst.options.fullscreennomargin) {
410                    inst.options.bgcolor = inst.options.fullscreenbgcolor;
411                    inst.options.bordersize =
412                            0;
413                    inst.options.bordermargin = 0;
414                    inst.options.bordertopmargin = 0;
415                    inst.options.bordertopmarginsmall = 0;
416                    if (inst.options.fullscreennomargintextinside)
417                        inst.options.titlestyle = "inside";
418                    else {
419                        inst.options.titlebottomcss = inst.options.fullscreentitlebottomcss;
420                        inst.options.descriptionbottomcss = inst.options.fullscreendescriptionbottomcss
421                    }
422                }
423                inst.options.barheightoriginal = inst.options.barheight;
424                if (inst.options.responsivebarheight) {
425                    var winH = $(window).height();
426                    if (winH <= inst.options.smallscreenheight)
427                        inst.options.barheight =
428                                inst.options.barheightonsmallheight
429                }
430                if (!inst.options.titlecss)
431                    inst.options.titlecss = inst.options.titlestyle == "inside" ? inst.options.titleinsidecss : inst.options.titlebottomcss;
432                if (!inst.options.descriptioncss)
433                    inst.options.descriptioncss = inst.options.titlestyle == "inside" ? inst.options.descriptioninsidecss : inst.options.descriptionbottomcss;
434                inst.options.titlecss = $.trim(inst.options.titlecss);
435                if (inst.options.titlecss.length > 1) {
436                    if (inst.options.titlecss.charAt(0) == "{")
437                        inst.options.titlecss = inst.options.titlecss.substring(1);
438                    if (inst.options.titlecss.charAt(inst.options.titlecss.length - 1) == "}")
439                        inst.options.titlecss = inst.options.titlecss.substring(0, inst.options.titlecss.length - 1)
440                }
441                inst.options.descriptioncss = $.trim(inst.options.descriptioncss);
442                if (inst.options.descriptioncss.length > 1) {
443                    if (inst.options.descriptioncss.charAt(0) == "{")
444                        inst.options.descriptioncss = inst.options.descriptioncss.substring(1);
445                    if (inst.options.descriptioncss.charAt(inst.options.descriptioncss.length - 1) == "}")
446                        inst.options.descriptioncss = inst.options.descriptioncss.substring(0,
447                                inst.options.descriptioncss.length - 1)
448                }
449                inst.options.errorcss = $.trim(inst.options.errorcss);
450                if (inst.options.errorcss.length > 1) {
451                    if (inst.options.errorcss.charAt(0) == "{")
452                        inst.options.errorcss = inst.options.errorcss.substring(1);
453                    if (inst.options.errorcss.charAt(inst.options.errorcss.length - 1) == "}")
454                        inst.options.errorcss = inst.options.errorcss.substring(0, inst.options.errorcss.length - 1)
455                }
456                var styleCss = ".bodynoscroll {height:100%;overflow:hidden;}";
457                styleCss += ".html5-hide {display:none !important;} #html5box-html5-lightbox .html5-text {" +
458                        inst.options.titlecss + "}";
459                styleCss += "#html5box-html5-lightbox .html5-description {" + inst.options.descriptioncss + "}";
460                styleCss += "#html5box-html5-lightbox .html5-error {" + inst.options.errorcss + "}";
461                if (inst.options.navarrowsalwaysshowontouch || inst.options.alwaysshownavarrows) {
462                    styleCss += "#html5box-html5-lightbox .html5-prev-touch {left
462:0px;top:50%;margin-top:-16px;margin-left:-32px;} #html5box-html5-lightbox .html5-next-touch {right:0px;top:50%;margin-top:-16px;margin-right:-32px;}";
463                    styleCss += "@media (max-width: " +
464                            inst.options.navarrowsbottomscreenwidth + "px) { #html5box-html5-lightbox .html5-prev-touch {top:100%;left:0;margin:0;} #html5box-html5-lightbox .html5-next-touch {top:100%;right:0;margin:0;} }"
465                }
466                styleCss += "#html5box-html5-lightbox .html5-prev-fullscreen {display:block;} #html5box-html5-lightbox .html5-next-fullscreen {display:block;} #html5box-html5-lightbox .html5-prev-bottom-fullscreen {display:none;} #html5box-html5-lightbox .html5-next-bottom-fullscreen {display:none;}";
467                styleCss += "@media (max-width: " +
468                        inst.options.navarrowsbottomscreenwidth + "px) {#html5box-html5-lightbox .html5-prev-fullscreen {display:none;} #html5box-html5-lightbox .html5-next-fullscreen {display:none;} #html5box-html5-lightbox .html5-prev-bottom-fullscreen {display:block;} #html5box-html5-lightbox .html5-next-bottom-fullscreen {display:block;} }";
469                if (inst.options.titlestyle == "right") {
470                    styleCss += "#html5box-html5-lightbox .html5-elem-wrap {width:" + inst.options.imagepercentage + "%;height:100%;} #html5box-html5-lightbox .html5-elem-data-box {min-height:100%;}";
471                    styleCss += "@media (max-width: " + inst.options.sidetobottomscreenwidth + "px) {#html5box-html5-lightbox .html5-elem-wrap {width:100%;height:auto;} #html5box-html5-lightbox .html5-elem-data-box {width:100%;height:auto;min-height:0;}}"
472                } else if (inst.options.titlestyle == "left") {
473                    styleCss += "#html5box-html5-lightbox .html5-elem-wrap {height:100%;} #html5box-html5-lightbox .html5-elem-data-box {width:" + String(100 - inst.options.imagepercentage) + "%;min-height:100%;}";
474                    styleCss += "@media (max-width: " + inst.options.sidetobottomscreenwidth +
475                            "px) {#html5box-html5-lightbox .html5-elem-wrap {width:100%;height:auto;} #html5box-html5-lightbox .html5-elem-data-box {width:100%;height:auto;min-height:0;}}"
476                }
477                styleCss += ".html5-rotate { border-radius:50%; -webkit-transition:-webkit-transform .4s ease-in; transition: transform .4s ease-in; } .html5-rotate:hover { -webkit-transform: rotate(360deg); transform: rotate(360deg); }";
478                styleCss += "@media (max-width: " + inst.options.navarrowsbottomscreenwidth + "px) {#html5-social {" + inst.options.socialpositionsmallscreen +
479                        "}}";
480                $("head").append("<style type='text/css' data-creator='html5box-html5-lightbox'>" + styleCss + "</style>");
481                var elemheight = inst.options.elemautoheight ? "auto" : "100%";
482                inst.$lightbox = $("<div id='html5box-html5-lightbox' style='display:none;top:0px;left:0px;width:100%;height:100%;z-index:9999998;text-align:center;'>" + "<div id='html5-lightbox-overlay' style='display:block;position:absolute;top:0px;left:0px;width:100%;min-height:100%;background-color:" + inst.options.overlaybgcolor + ";opacity:" + inst.options.overlayopacity +
483                        ";filter:alpha(opacity=" + Math.round(inst.options.overlayopacity * 100) + ");'></div>" + "<div id='html5-lightbox-box' style='display:block;position:relative;margin:0px auto;'>" + "<div class='html5-elem-box' style='display:block;position:relative;width:100%;overflow-x:hidden;overflow-y:auto;height:" + elemheight + ";margin:0px auto;text-align:center;box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;'>" + "<div class='html5-elem-wrap' style='display:block;position:relative;margin:0px auto;text-align:center;box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;background-color:" +
484                        inst.options.bgcolor + ";'>" + "<div class='html5-loading' style='display:none;position:absolute;top:0px;left:0px;text-align:center;width:100%;height:100%;background:url(\"" + inst.options.loadingimage + "\") no-repeat center center;'></div>" + "<div class='html5-error-box html5-error' style='display:none;position:absolute;padding:" + inst.options.bordersize + "px;text-align:center;
484width:" + inst.options.errorwidth + "px;height:" + inst.options.errorheight + "px;'>" + "The requested content cannot be loaded.<br />Please try again later." +
485                        "</div>" + "<div class='html5-image' style='display:none;position:relative;top:0px;left:0px;width:100%;height:100%;" + (inst.options.iequirksmode ? "margin" : "padding") + ":" + inst.options.bordersize + "px;text-align:center;box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;'></div>" + "</div>" + "</div>" + "<div id='html5-watermark' style='display:none;position:absolute;left:" + String(inst.options.bordersize + 2) + "px;top:" + String(inst.options.bordersize + 2) + "px;'></div>" + "</div>" + "</div>");
486                inst.options.positionFixed = inst.options.supportCSSPositionFixed && inst.options.responsive && !inst.options.iequirksmode;
487                if (inst.options.useabsolutepos || inst.options.useabsoluteposonmobile && inst.options.isMobile)
488                    inst.options.positionFixed = false;
489                if (!inst.options.positionFixed)
490                    inst.options.bodynoscroll = true;
491                inst.$lightbox.css({
492                    position: inst.options.positionFixed ? "fixed" : "absolute"
493                });
494                inst.$lightbox.appendTo("body");
495                inst.$lightboxBox = $("#html5-lightbox-box", inst.$lightbox);
496                inst.$elem = $(".html5-elem-box",
497                        inst.$lightbox);
498                inst.$elemWrap = $(".html5-elem-wrap", inst.$lightbox);
499                inst.$loading = $(".html5-loading", inst.$lightbox);
500                inst.$error = $(".html5-error-box", inst.$lightbox);
501                inst.$image = $(".html5-image", inst.$lightbox);
502                 if (inst.options.fullscreenmode && inst.options.fullscreennomargin)
503                    inst.$elem.css({
504                        overflow: "hidden"
505                    });
506                var elemText = "<div class='html5-elem-data-box' style='display:none;box-sizing:border-box;'><div class='html5-text' style='display:block;overflow:hidden;'></div></div>";
507                if (inst.options.titlestyle ==
508                        "left")
509                    inst.$elem.prepend(elemText);
510                else
511                    inst.$elem.append(elemText);
512                inst.$elemData = $(".html5-elem-data-box", inst.$lightbox);
513                inst.$text = $(".html5-text", inst.$lightbox);
514                if (inst.options.borderradius > 0) {
515                    inst.$elem.css({
516                        "border-radius": inst.options.borderradius + "px",
517                        "-moz-border-radius": inst.options.borderradius + "px",
518                        "-webkit-border-radius": inst.options.borderradius + "px"
519                    });
520                    if (inst.options.titlestyle == "inside")
521                        inst.$elemWrap.css({
522                            "border-radius": inst.options.borderradius + "px",
523                            "-moz-border-radius": inst.options.borderradius +
524                                    "px",
525                            "-webkit-border-radius": inst.options.borderradius + "px"
526                        });
527                    else if (inst.options.titlestyle == "bottom") {
528                        inst.$elemWrap.css({
529                            "border-top-left-radius": inst.options.borderradius + "px",
530                            "-moz-top-left-border-radius": inst.options.borderradius + "px",
531                            "-webkit-top-left-border-radius": inst.options.borderradius + "px",
532                            "border-top-right-radius": inst.options.borderradius + "px",
533                            "-moz-top-right-border-radius": inst.options.borderradius + "px",
534                            "-webkit-top-right-border-radius": inst.options.borderradius + "px"
535                        });
536                        inst.$elemData.css({
537                            "border-bottom-left-radius": inst.options.borderradius +
538                                    "px",
539                            "-moz-top-bottom-border-radius": inst.options.borderradiu
539s + "px",
540                            "-webkit-bottom-left-border-radius": inst.options.borderradius + "px",
541                            "border-bottom-right-radius": inst.options.borderradius + "px",
542                            "-moz-bottom-right-border-radius": inst.options.borderradius + "px",
543                            "-webkit-bottom-right-border-radius": inst.options.borderradius + "px"
544                        })
545                    }
546                }
547                if (inst.options.titlestyle == "right" || inst.options.titlestyle == "left") {
548                    inst.$lightboxBox.css({
549                        "background-color": inst.options.bgcolor
550                    });
551                    if (inst.options.titlestyle == "right") {
552                        inst.$elemWrap.css({
553                            position: "relative",
554                            "float": "left"
555                        });
556                        inst.$elemData.css({
557                            position: "relative",
558                            overflow: "hidden",
559                            padding: inst.options.bordersize + "px"
560                        })
561                    } else {
562                        inst.$elemWrap.css({
563                            position: "relative",
564                            overflow: "hidden"
565                        });
566                        inst.$elemData.css({
567                            position: "relative",
568                            "float": "left",
569                            padding: inst.options.bordersize + "px"
570                        })
571                    }
572                } else if (inst.options.titlestyle == "inside") {
573                    inst.$elemData.css({
574                        position: "absolute",
575                        margin: inst.options.bordersize + "px",
576                        bottom: 0,
577                        left: 0,
578                        "background-color": "#333",
579                        "background-color": "rgba(51, 51, 51, 0.6)"
580                    });
581                    inst.$text.css({
582                        padding: inst.options.bordersize +
583                                "px " + 2 * inst.options.bordersize + "px"
584                    })
585                } else {
586                    inst.$elemData.css({
587                        position: "relative",
588                        width: "100%",
589                        height: inst.options.barautoheight ? "auto" : inst.options.barheight + "px",
590                        "padding": "0 0 " + inst.options.bordersize + "px" + " 0",
591                        "background-color": inst.options.bgcolor,
592                        "text-align": "left"
593                    });
594                    if (!inst.options.fullscreenmode || !inst.options.fullscreennomargin)
595                        inst.$text.css({
596                            "margin": "0 " + inst.options.bordersize + "px"
597                        })
598                }
599                if (inst.options.showsocial) {
600                    var socialCode = '<div id="html5-social" style="display:none;' + inst.options.socialposition +
601                            '">';
602                    var socialBtnCSS = (inst.options.socialdirection == "horizontal" ? "display:inline-block;" : "display:block;") + "margin:4px;";
603                    var socialCSS = "display:table-cell;width:" + inst.options.socialbuttonsize + "px;height:" + inst.options.socialbuttonsize + "px;font-size:" + inst.options.socialbuttonfontsize + "px;border-radius:50%;color:#fff;vertical-align:middle;text-align:center;cursor:pointer;padding:0;";
604                    if (inst.options.showemail)
605                        socialCode += '<div class="html5-social-btn' + (inst.options.socialrotateeffect ? " html5-rotate" :
606                                "") + ' html5-social-email" style="' + socialBtnCSS + '"><div class="mh-icon-mail" style="' + socialCSS + 'background-color:#4d83ff;"></div></div>';
607                    if (inst.options.showfacebook)
608                        socialCode += '<div class="html5-social-btn' + (inst.options.socialrotateeffect ? " html5-rotate" : "") + ' html5-social-facebook" style="' + socialBtnCSS + '"><div class="mh-icon-facebook" style="' + socialCSS + 'background-color:#3b5998;"></div></div>';
609                    if (inst.options.showtwitter)
610                        socialCode += '<div class="html5-social-btn' + (inst.options.socialrotateeffect ?
611                                " html5-rotate" : "") + ' html5-social-twitter" style="' + socialBtnCSS + '"><div class="mh-icon-twitter" style="' + socialCSS + 'background-color:#03b3ee;"></div></div>';
612                    if (inst.options.showpinterest)
613                        socialCode += '<div class="html5-social-btn' + (inst.options.socialrotateeffect ? " html5-rotate" : "") + ' html5-social-pinterest" style="' + socialBtnCSS + '"><div class="mh-icon-pinterest" style="' + socialCSS + 'background-color:#c92228;"></div></div>';
614                    socialCode += '<div style="clear:both;"></div></div>';
615                    inst.$lightboxBox.append(socialCode);
616                    $(".html5-social-btn", inst.$lightbox).click(function() {
617                        var shareUrl = window.location.href + (window.location.href.indexOf("?") < 0 ? "?" : "&") + "wplightboxshare=" + encodeURIComponent(inst.currentElem[ELEM_HREF]);
618                        var shareTitle = inst.currentElem[ELEM_TITLE];
619                        var shareMedia = inst.currentElem[ELEM_HREF];
620                        if (inst.currentElem[ELEM_TYPE] == 0)
621                            shareMedia = inst.absoluteUrl(inst.currentElem[ELEM_HREF]);
622                        else if (inst.currentElem[ELEM_TYPE] == 3)
623                            shareMedia = "https://img.youtube.com/vi/" + inst.getYoutubeId(inst.currentElem[ELEM_HREF]) +
624                                    "/0.jpg";
625                        else {
626                            var lightboxLink = $('.wplightbox[href="' + inst.currentElem[ELEM_HREF] + '"]');
627                            if (lightboxLink.length > 0)
628                                if (lightboxLink.data("shareimage") && lightboxLink.data("shareimage").length > 0)
629                                    shareMedia = inst.absoluteUrl(lightboxLink.data("shareimage"));
630                                else if (lightboxLink.data("thumbnail") && lightboxLink.data("thumbnail").length > 0)
631                                    shareMedia = inst.absoluteUrl(lightboxLink.data("thumbnail"));
632                                else {
633                                    var lightboxImg = $("img", lightboxLink);
634                                    if (lightboxImg.length > 0)
635                                        shareMedia = inst.absoluteUrl(lightboxImg.attr("src"))
636                                }
637                        }
638                        var isVideo =
639                                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 || inst.currentElem[ELEM_TYPE] == 12;
640                        if (!shareTitle)
641                            shareTitle = "";
642                        else
643                            shareTitle = inst.html2Text(shareTitle);
644                        if ($(this).hasClass("html5-social-facebook"))
645                            window.open("https://www.facebook.com/sharer/sharer.php?u=" + encodeURIComponent(shareUrl) + "&t=" + encodeURIComponent(shareTitle), "_blank");
646                        else if ($(this).hasClass("html5-social-twitter"))
647                            window.open("https://twitter.com/share?url=" +
648                                    encodeURIComponent(shareUrl) + "&text=" + encodeURIComponent(shareTitle), "_blank");
649                        else if ($(this).hasClass("html5-social-pinterest"))
650                            window.open("https://pinterest.com/pin/create/bookmarklet/?media=" + encodeURIComponent(shareMedia) + "&url=" + encodeURIComponent(shareUrl) + "&description=" + encodeURIComponent(shareTitle) + "&is_video=" + (isVideo ? "true" : "false"), "_blank");
651                        else if ($(this).hasClass("html5-social-email"))
652                            window.open("mailto:?subject=" + encodeURIComponent(shareTitle) + "&body=Check out this: " + encodeURIComponent(shareUrl));
653                        return false
654                    })
655                }
656                if (inst.options.fullscreenmode) {
657                    inst.$lightbox.append("<div class='html5-next-fullscreen' style='cursor:pointer;position:absolute;right:" + inst.options.bordersize + "px;top:50%;margin-top:-16px;'><img alt='' src='" + inst.options.fullscreennextimage + "'></div>" + "<div class='html5-prev-fullscreen' style='cursor:pointer;position:absolute;
657left:" + inst.options.bordersize + "px;top:50%;margin-top:-16px;'><img alt='' src='" + inst.options.fullscreenprevimage + "'></div>");
658                    inst.$next = $(".html5-next-fullscreen",
659                            inst.$lightbox);
660                    inst.$prev = $(".html5-prev-fullscreen", inst.$lightbox);
661                    inst.$lightboxBox.append("<div class='html5-next-bottom-fullscreen' style='cursor:pointer;position:absolute;top:100%;right:0;margin-top:8px;'><img alt='' src='" + inst.options.fullscreennextimage + "'></div>" + "<div class='html5-prev-bottom-fullscreen' style='cursor:pointer;position:absolute;top:100%;left:0;margin-top:8px;'><img alt='' src='" + inst.options.fullscreenprevimage + "'></div>");
662                    inst.$nextbottom = $(".html5-next-bottom-fullscreen",
663                            inst.$lightbox);
664                    inst.$prevbottom = $(".html5-prev-bottom-fullscreen", inst.$lightbox);
665                    inst.$nextbottom.click(function() {
666                        inst.nextArrowClicked()
667                    });
668                    inst.$prevbottom.click(function() {
669                        inst.prevArrowClicked()
670                    });
671                    inst.$lightbox.append("<div id='html5-close-fullscreen' style='display:block;cursor:pointer;position:absolute;top:0;right:0;margin-top:0;margin-right:0;'><img alt='' src='" + inst.options.fullscreencloseimage + "'></div>");
672                    inst.$close = $("#html5-close-fullscreen", inst.$lightbox)
673                } else {
674                    inst.$lightboxBox.append("<div class='html5-next' style='display:none;cursor:pointer;position:absolute;right:" +
675                            inst.options.bordersize + "px;top:50%;margin-top:-32px;'><img alt='' src='" + inst.options.nextimage + "'></div>" + "<div class='html5-prev' style='display:none;cursor:pointer;position:absolute;left:" + inst.options.bordersize + "px;top:50%;margin-top:-32px;'><img alt='' src='" + inst.options.previmage + "'></div>");
676                    inst.$next = $(".html5-next", inst.$lightbox);
677                    inst.$prev = $(".html5-prev", inst.$lightbox);
678                    if (inst.options.isTouch && inst.options.navarrowsalwaysshowontouch || inst.options.alwaysshownavarrows) {
679                        inst.$lightboxBox.append("<div class='html5-next-touch' style='display:block;cursor:pointer;position:absolute;'><img alt='' src='" +
680                                inst.options.nextimage + "'></div>" + "<div class='html5-prev-touch' style='display:block;cursor:pointer;position:absolute;'><img alt='' src='" + inst.options.previmage + "'></div>");
681                        inst.$nexttouch = $(".html5-next-touch", inst.$lightbox);
682                        inst.$prevtouch = $(".html5-prev-touch", inst.$lightbox);
683                        inst.$nexttouch.click(function() {
684                            inst.nextArrowClicked()
685                        });
686                        inst.$prevtouch.click(function() {
687                            inst.prevArrowClicked()
688                        })
689                    }
690                    inst.$lightboxBox.append("<div id='html5-close' style='display:none;cursor:pointer;position:absolute;top:0;right:0;margin-top:-16px;margin-right:-16px;'><img class='svg' alt='' src='" +
691                            inst.options.closeimage + "'></div>");
692                    inst.$close = $("#html5-close", inst.$lightbox);
693                    
694                    
695                    jQuery('img.svg').each(function(){
696            var $img = jQuery(this);
697            var imgID = $img.attr('id');
698            var imgClass = $img.attr('class');
699            var imgURL = $img.attr('src');
700
701            jQuery.get(imgURL, function(data) {
702                // Get the SVG tag, ignore the rest
703                var $svg = jQuery(data).find('svg');
704
705                // Add replaced image's ID to the new SVG
706                if(typeof imgID !== 'undefined') {
707                    $svg = $svg.attr('id', imgID);
708                }
709                // Add replaced image's classes to the new SVG
710                if(typeof imgClass !== 'undefined') {
711                    $svg = $svg.attr('class', imgClass+' replaced-svg');
712                }
713
714                // Remove any invalid XML tags as per http://validator.w3.org
715                $svg = $svg.removeAttr('xmlns:a');
716
717                // Replace image with new SVG
718                $img.replaceWith($svg);
719
720            }, 'xml');
721
722        });
723        
724       
725        
726        
727                }
728                inst.$watermark = $("#html5-watermark", inst.$lightbox);
729                if (inst.options.stamp)
730                    inst.$watermark.html("<a href='" + inst.options.freelink + "' style='text-decoration:none;' title='WordPress Lightbox'><div style='display:block;width:200px;height:20px;text-align:center;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;background-color:#fff;color:#333;font:12px Arial,sans-serif;'><div style='line-height:20px;'>" + inst.options.freemark +
731                            "</div></div></a>");
732                else if (inst.options.watermark) {
733                    var html = "<img alt='' src='" + inst.options.watermark + "' style='border:none;' />";
734                    if (inst.options.watermarklink)
735                        html = "<a href='" + inst.options.watermarklink + "' target='_blank'>" + html + "</a>";
736                    inst.$watermark.html(html)
737                }
738                if (inst.options.closeonoverlay)
739                    $("#html5-lightbox-overlay", inst.$lightbox).click(inst.finish);
740                inst.$close.click(inst.finish);
741                inst.$next.click(function() {
742                    inst.nextArrowClicked()
743                });
744                inst.$prev.click(function() {
745                    inst.prevArrowClicked()
746                });
747                $(window).resize(function() {
748                    if (inst.options.isIOS &&
749                            !inst.options.mobileresizeevent)
750                        return;
751                    clearTimeout(inst.options.resizeTimeout);
752                    inst.options.resizeTimeout = setTimeout(function() {
753                        inst.resizeWindow()
754                    }, inst.options.resizedelay)
755                });
756                $(window).scroll(function() {
757                    if (inst.options.isIOS && !inst.options.mobileresizeevent)
758                        return;
759                    inst.scrollBox()
760                });
761                $(window).on("orientationchange", function(e) {
762                    if (inst.options.isMobile)
763                        inst.resizeWindow()
764                });
765                if (inst.options.enabletouchswipe)
766                    inst.enableSwipe()
767            };
768            inst.html2Text = function(html) {
769                var tag = document.createElement("div");
770                tag.innerHTML =
771                        html;
772                return tag.innerText
773            };
774            inst.slideTimer = function(interval, callback, updatecallback) {
775                var timerInstance = this;
776                timerInstance.timeout = interval;
777                var updateinterval = 50;
778                var updateTimerId = null;
779                var runningTime = 0;
780                var paused = false;
781                var started = false;
782                var startedandpaused = false;
783                this.pause = function() {
784                    if (started) {
785                        paused = true;
786                        clearInterval(updateTimerId)
787                    }
788                };
789                this.resume = function(forceresume) {
790                    if (startedandpaused && !forceresume)
791                        return;
792                    startedandpaused = false;
793                    if (started && paused) {
794                        paused = false;
795                        updateTimerId = setInterval(function() {
796                            runningTime +=
797                                    updateinterval;
798                            if (runningTime > timerInstance.timeout) {
799                                clearInterval(updateTimerId);
800                                if (callback)
801                                    callback()
802                            }
803                            if (updatecallback)
804                                updatecallback(runningTime / timerInstance.timeout)
805                        }, updateinterval)
806                    }
807                };
808                this.stop = function() {
809                    clearInterval(updateTimerId);
810                    if (updatecallback)
811                        updatecallback(-1);
812                    runningTime = 0;
813                    paused = false;
814                    started = false
815                };
816                this.start = function() {
817                    runningTime = 0;
818                    paused = false;
819                    started = true;
820                    updateTimerId = setInterval(function() {
821                        runningTime += updateinterval;
822                        if (runningTime > timerInstance.timeout) {
823                            clearInterval(updateTimerId);
824                            if (callback)
825                                callback()
826                        }
827                        if (updatecallback)
828                            updatecallback(runningTime / timerInstance.timeout)
829                    }, updateinterval)
830                };
831                this.startandpause = function() {
832                    runningTime = 0;
833                    paused = true;
834                    started = true;
835                    startedandpaused = true
836                };
837                return this
838            };
839            inst.updateTimer = function(percent) {
840                var w = Math.round(percent * 100);
841                if (w > 100)
842                    w = 100;
843                if (w < 0)
844                    w = 0;
845                $(".html5-timer", inst.$lightbox).css({
846                    display: "block",
847                    width: w + "%"
848                })
849            };
850            inst.initSlide = function() {
851                inst.autosliding = false;
852                inst.slideTimeout = inst.slideTimer(inst.options.slideinterval, function() {
853                    inst.gotoSlide(-1)
854                },
855                        inst.options.showtimer ? function(percent) {
856                    inst.updateTimer(percent)
857                } : null);
858                if (inst.options.autoslide) {
859                    inst.slideTimeout.stop();
860                    inst.autosliding = true
861                }
862            };
863            inst.nextArrowClicked = function() {
864                if (inst.options.nextElem <= inst.options.curElem)
865                    if (inst.options.onlastarrowclicked && window[inst.options.onlastarrowclicked] && typeof window[inst.options.onlastarrowclicked] == "function")
866                        window[inst.options.onlastarrowclicked]();
867                inst.gotoSlide(-1)
868            };
869            inst.prevArrowClicked = function() {
870                if (inst.options.prevElem >= inst.options.curElem)
871                    if (inst.options.onfirstarrowclicked &&
872                            window[inst.options.onfirstarrowclicked] && typeof window[inst.options.onfirstarrowclicked] == "function")
873                        window[inst.options.onfirstarrowclicked]();
874                inst.gotoSlide(-2)
875            };
876            inst.calcNextPrevElem = function() {
877                inst.options.nextElem = -1;
878                inst.options.prevElem = -1;
879                inst.options.inGroup = false;
880                inst.options.groupIndex = 0;
881                inst.options.groupCount = 0;
882                var group = inst.elemArray[inst.options.curElem][ELEM_GROUP];
883                for (var i = 0; i < inst.elemArray.length; i++)
884                    if (inst.matchGroup(group, inst.elemArray[i][ELEM_GROUP])) {
885                        if (i == inst.options.curElem)
886                            inst.options.groupIndex =
887                                    inst.options.groupCount;
888                        inst.options.groupCount++
889                    }
890                var j, curGroup = inst.elemArray[inst.options.curElem][ELEM_GROUP];
891                if (curGroup != undefined && curGroup != null) {
892                    for (j = inst.options.curElem + 1; j < inst.elemArray.length; j++)
893                        if (inst.matchGroup(curGroup, inst.elemArray[j][ELEM_GROUP])) {
894                            inst.options.nextElem = j;
895                            break
896                        }
897                    if (inst.options.nextElem < 0)
898                        for (j = 0; j < inst.options.curElem; j++)
899                            if (inst.matchGroup(curGroup, inst.elemArray[j][ELEM_GROUP])) {
900                                inst.options.nextElem = j;
901                                break
902                            }
903                    if (inst.options.nextElem >= 0) {
904                        for (j = inst.options.curElem -
905                                1; j >= 0; j--)
906                            if (inst.matchGroup(curGroup, inst.elemArray[j][ELEM_GROUP])) {
907                                inst.options.prevElem = j;
908                                break
909                            }
910                        if (inst.options.prevElem < 0)
911                            for (j = inst.elemArray.length - 1; j > inst.options.curElem; j--)
912                                if (inst.matchGroup(curGroup, inst.elemArray[j][ELEM_GROUP])) {
913                                    inst.options.prevElem = j;
914                                    break
915                                }
916                    }
917                }
918                if (inst.options.nextElem >= 0 || inst.options.prevElem >= 0)
919                    inst.options.inGroup = true
920            };
921            inst.calcBoxPosition = function(initW, initH) {
922                var boxW = initW + 2 * inst.options.bordersize;
923                var boxH = initH + 2 * inst.options.bordersize;
924                var navH = inst.options.shownavigation &&
925                        inst.navvisible ? inst.options.navheight : 0;
926                var winH = $(window).height();
927                var boxT = Math.round((winH - navH) / 2 - boxH / 2);
928                if (inst.options.titlestyle == "bottom")
929                    boxT -= Math.round(inst.options.barheight / 2);
930                var topmargin = $(window).width() < inst.options.navarrowsbottomscreenwidth ? inst.options.bordertopmarginsmall : inst.options.bordertopmargin;
931                if (boxT < topmargin)
932                    boxT = topmargin;
933                if (inst.options.insideiframe && window.self != window.top)
934                    if (parent.window.jQuery && parent.window.jQuery("#" + inst.options.iframeid).length) {
935                        var iframetop =
936                                parent.window.jQuery("#" + inst.options.iframeid).offset().top;
937                        var parentscroll = parent.window.document.body.scrollTop;
938                        boxT = topmargin;
939                        boxT += parentscroll > iframetop ? parentscroll - iframetop : 0
940                    }
941                return [boxW, boxH, boxT]
942            };
943            inst.hideNavArrows = function() {
944                var showPrev = false;
945                var showNext = false;
946                if (inst.options.inGroup) {
947                    if (inst.options.arrowloop || !inst.options.arrowloop && inst.options.prevElem < inst.options.curElem)
948                        showPrev = true;
949                    if (inst.options.arrowloop || !inst.options.arrowloop && inst.options.nextElem > inst.options.curElem)
950                        showNext =
951                                true
952                }
953                if (showPrev) {
954                    inst.$prev.removeClass("html5-hide");
955                    if (inst.$prevbottom)
956                        inst.$prevbottom.removeClass("html5-hide");
957                    if (inst.$prevtouch)
958                        inst.$prevtouch.removeClass("html5-hide")
959                } else {
960                    inst.$prev.addClass("html5-hide");
961                    if (inst.$prevbottom)
962                        inst.$prevbottom.addClass("html5-hide");
963                    if (inst.$prevtouch)
964                        inst.$prevtouch.addClass("html5-hide")
965                }
966                if (showNext) {
967                    inst.$next.removeClass("html5-hide");
968                    if (inst.$nextbottom)
969                        inst.$nextbottom.removeClass("html5-hide");
970                    if (inst.$nexttouch)
971                        inst.$nexttouch.removeClass("html5-hide")
972                } else {
973                    inst.$next.addClass("html5-hide");
974                    if (inst.$nextbottom)
975                        inst.$nextbottom.addClass("html5-hide");
976                    if (inst.$nexttouch)
977                        inst.$nexttouch.addClass("html5-hide")
978                }
979            };
980            inst.clickHandler = function() {
981                jQuery('body').addClass('ovrflw-hdn');
982                var $this = $(this);
983                var dataoptions = {};
984                $.each($this.data(), function(key, value) {
985                    dataoptions[key.toLowerCase()] = value
986                });
987                inst.options = $.extend(inst.options, inst.defaultoptions, dataoptions);
988                $(window).trigger("html5lightbox.lightboxshow");
989                inst.init();
990
991                if (inst.elemArray.length <= 0)
992                    return true;
993                inst.hideObjects();
994                for (var i = 0; i < inst.elemArray.length; i++)
995                    if (inst.elemArray[i][ELEM_HREF] == $this.attr("href"))
996                        break;
997                if (i == inst.elemArray.length)
998                    return true;
999                inst.options.curElem = i;
1000                inst.calcNextPrevElem();
1001                inst.reset();
1002                inst.$lightbox.show();
1003                var boxPos = inst.calcBoxPosition(inst.options.loadingwidth, inst.options.loadingheight);
1004                var boxW = boxPos[0];
1005                var boxH = boxPos[1];
1006                var boxT = boxPos[2];
1007                if (inst.options.iequirksmode)
1008                    inst.$lightboxBox.css({
1009                        "top": boxT
1010                    });
1011                else
1012                    inst.$lightboxBox.css({
1013                        "margin-top": boxT
1014                    });
1015                if (inst.options.titlestyle == "left" || inst.options.titlestyle == "right")
1016                    inst.$lightboxBox.css({
1017                        "width": boxW,
1018                        "height": boxH
1019                    });
1020                else {
1021                    inst.$lightboxBox.css({
1022                        "width": boxW,
1023                        "height": "auto"
1024                    });
1025                    inst.$elemWrap.css({
1026                        "width": boxW,
1027                        "height": boxH
1028                    })
1029                }
1030                inst.loadCurElem();
1031                return false
1032            };
1033            inst.loadThumbnail = function(src, index, title) {
1034                var imgLoader = new Image;
1035                $(imgLoader).on("load", function() {
1036                    var style;
1037                    if (this.width / this.height <= inst.options.thumbwidth / inst.options.thumbheight)
1038                        style = "width:100%;";
1039                    else
1040                        style = "height:100%;";
1041                    $(".html5-nav-thumb").eq(index).html("<img alt='" + inst.html2Text(title) + "' style='" + style + "' src='" + src + "' />")
1042                });
1043                imgLoader.src = src
1044            };
1045            inst.matchGroup = function(curGroup, elemGroup) {
1046                if (inst.options.showall)
1047                    return true;
1048                if (!curGroup || !elemGroup)
1049                    return false;
1050                var curs = curGroup.split(":");
1051                var elems = elemGroup.split(":");
1052                var result = false;
1053                for (var i in curs)
1054                    if ($.inArray(curs[i], elems) > -1) {
1055                        result = true;
1056                        break
1057                    }
1058                return result
1059            };
1060            inst.showNavigation = function() {
1061                if (!inst.options.shownavigation)
1062                    return;
1063                if (!inst.currentElem || !inst.currentElem[ELEM_GROUP])
1064                    return;
1065                var i;
1066                var showNav = false;
1067                var group = inst.currentElem[ELEM_GROUP];
1068                for (i = 0; i < inst.elemArray.length; i++)
1069                    if (inst.matchGroup(group,
1070                            inst.elemArray[i][ELEM_GROUP]))
1071                        if (inst.elemArray[i][ELEM_THUMBNAIL] && inst.elemArray[i][ELEM_THUMBNAIL].length > 0) {
1072                            showNav = true;
1073                            break
1074                        }
1075                if (!showNav)
1076                    return;
1077                inst.options.navheight = inst.options.thumbheight + inst.options.thumbtopmargin + inst.options.thumbbottommargin;
1078                if ($(".html5-nav").length > 0)
1079                    return;
1080                var posCss = inst.options.hidenavdefault ? "top:100%;bottom:auto;left:0;right:0;" : "top:auto;bottom:0;left:0;right:0;";
1081                var posType = inst.options.positionFixed ? "fixed" : "absolute";
1082                $("body").append("<div class='html5-nav' style='display:block;position:" +
1083                        posType + ";" + posCss + "width:100%;height:" + inst.options.navheight + "px;z-index:9999999;" + (inst.options.navbgcolor ? "background-color:" + inst.options.navbgcolor + ";" : "") + "'>" + "<div class='html5-nav-container' style='position:relative;margin:" + inst.options.thumbtopmargin + "px auto " + inst.options.thumbbottommargin + "px;'>" + "<div class='html5-nav-prev' style='display:block;position:absolute;cursor:pointer;width:" + inst.options.navbuttonwidth + 'px;height:100%;left:0;top:0;background:url("' + inst.options.navarrowsprevimage +
1084                        "\") no-repeat left center;'></div>" + "<div class='html5-nav-mask' style='display:block;position:relative;margin:0 auto;overflow:hidden;'>" + "<div class='html5-nav-list'></div>" + "</div>" + "<div class='html5-nav-next' style='display:block;position:absolute;cursor:pointer;width:" + inst.options.navbuttonwidth + 'px;height:100%;right:0;top:0;background:url("' + inst.options.navarrowsnextimage + "\") no-repeat right center;'></div>" + "</div>" + "</div>");
1085                inst.navvisible = inst.options.hidenavdefault ? false : true;
1086                if (inst.options.shownavcontrol) {
1087                    $(".html5-nav").append('<div class="html5-nav-showcontrol" style="position:absolute;display:block;cursor:pointer;bottom:100%;right:12px;margin:0;padding:0;"><img alt="" src="' +
1088                            inst.options.navcontrolimage + '"></div>');
1089                    $(".html5-nav-showcontrol").click(function() {
1090                        var winH = $(window).height();
1091                        var navH = $(".html5-nav").height();
1092                        if (inst.navvisible) {
1093                            inst.navvisible = false;
1094                            $(".html5-nav").css({
1095                                top: winH - navH + "px",
1096                                bottom: "auto"
1097                            }).animate({
1098                                top: winH + "px"
1099                            }, function() {
1100                                $(this).css({
1101                                    top: "100%",
1102                                    bottom: "auto"
1103                                })
1104                            })
1105                        } else {
1106                            inst.navvisible = true;
1107                            var navH = $(".html5-nav").height();
1108                            $(".html5-nav").css({
1109                                top: winH + "px",
1110                                bottom: "auto"
1111                            }).animate({
1112                                top: winH - navH + "px"
1113                            }, function() {
1114                                $(this).css({
1115                                    top: "auto",
1116                                    bottom: 0
1117                                })
1118                            })
1119                        }
1120                        inst.resizeWindow()
1121                    })
1122                }
1123                var index =
1124                        0;
1125                for (i = 0; i < inst.elemArray.length; i++)
1126                    if (inst.matchGroup(group, inst.elemArray[i][ELEM_GROUP]))
1127                        if (inst.elemArray[i][ELEM_THUMBNAIL] && inst.elemArray[i][ELEM_THUMBNAIL].length > 0) {
1128                            $(".html5-nav-list").append("<div class='html5-nav-thumb' data-arrayindex='" + i + "' style='float:left;overflow:hidden;cursor:pointer;opacity:" + inst.options.thumbopacity + ";margin: 0 " + inst.options.thumbgap / 2 + "px;
1128width:" + inst.options.thumbwidth + "px;height:" + inst.options.thumbheight + "px;border:" + inst.options.thumbborder + "px solid " +
1129                                    inst.options.thumbbordercolor + ";'></div>");
1130                            this.loadThumbnail(inst.elemArray[i][ELEM_THUMBNAIL], index, inst.elemArray[i][ELEM_TITLE]);
1131                            index++
1132                        }
1133                $(".html5-nav-thumb").hover(function() {
1134                    $(this).css({
1135                        opacity: 1
1136                    });
1137                    $(this).css({
1138                        border: inst.options.thumbborder + "px solid " + inst.options.thumbhighlightbordercolor
1139                    })
1140                }, function() {
1141                    $(this).css({
1142                        opacity: inst.options.thumbopacity
1143                    });
1144                    $(this).css({
1145                        border: inst.options.thumbborder + "px solid " + inst.options.thumbbordercolor
1146                    })
1147                });
1148                $(".html5-nav-thumb").click(function() {
1149                    var index =
1150                            $(this).data("arrayindex");
1151                    if (index >= 0)
1152                        inst.gotoSlide(index)
1153                });
1154                inst.options.totalwidth = index * (inst.options.thumbgap + inst.options.thumbwidth + 2 * inst.options.thumbborder);
1155                $(".html5-nav-list").css({
1156                    display: "block",
1157                    position: "relative",
1158                    "margin-left": 0,
1159                    width: inst.options.totalwidth + "px"
1160                }).append("<div style='clear:both;'></div>");
1161                var $navMask = $(".html5-nav-mask");
1162                var $navPrev = $(".html5-nav-prev");
1163                var $navNext = $(".html5-nav-next");
1164                $navPrev.click(function() {
1165                    var $navList = $(".html5-nav-list");
1166                    var $navNext = $(".html5-nav-next");
1167                    var winWidth = $(window).width();
1168                    var maskWidth = winWidth - 2 * inst.options.navbuttonwidth;
1169                    var marginLeft = parseInt($navList.css("margin-left")) + maskWidth;
1170                    if (marginLeft >= 0) {
1171                        marginLeft = 0;
1172                        $(this).css({
1173                            "background-position": "center left"
1174                        })
1175                    } else
1176                        $(this).css({
1177                            "background-position": "center right"
1178                        });
1179                    if (marginLeft <= maskWidth - inst.options.totalwidth)
1180                        $navNext.css({
1181                            "background-position": "center left"
1182                        });
1183                    else
1184                        $navNext.css({
1185                            "background-position": "center right"
1186                        });
1187                    $navList.animate({
1188                        "margin-left": marginLeft
1189                    })
1190                });
1191                $navNext.click(function() {
1192                    var $navList =
1193                            $(".html5-nav-list");
1194                    var $navPrev = $(".html5-nav-prev");
1195                    var winWidth = $(window).width();
1196                    var maskWidth = winWidth - 2 * inst.options.navbuttonwidth;
1197                    var marginLeft = parseInt($navList.css("margin-left")) - maskWidth;
1198                    if (marginLeft <= maskWidth - inst.options.totalwidth) {
1199                        marginLeft = maskWidth - inst.options.totalwidth;
1200                        $(this).css({
1201                            "background-position": "center left"
1202                        })
1203                    } else
1204                        $(this).css({
1205                            "background-position": "center right"
1206                        });
1207                    if (marginLeft >= 0)
1208                        $navPrev.css({
1209                            "background-position": "center left"
1210                        });
1211                    else
1212                        $navPrev.css({
1213                            "background-position": "center right"
1214                        });
1215                    $navList.animate({
1216                        "margin-left": marginLeft
1217                    })
1218                });
1219                var winWidth = $(window).width();
1220                if (inst.options.totalwidth <= winWidth) {
1221                    $navMask.css({
1222                        width: inst.options.totalwidth + "px"
1223                    });
1224                    $navPrev.hide();
1225                    $navNext.hide()
1226                } else {
1227                    $navMask.css({
1228                        width: winWidth - 2 * inst.options.navbuttonwidth + "px"
1229                    });
1230                    $navPrev.show();
1231                    $navNext.show()
1232                }
1233            };
1234            inst.loadElem = function(elem) {
1235                //console.log('inst.loadElem ' + elem);
1236                inst.currentElem = elem;
1237                inst.showing = true;
1238                if (inst.options.bodynoscroll)
1239                    $("html,body").addClass("bodynoscroll");
1240                if (!(inst.options.showtitle && inst.currentElem[ELEM_TITLE] &&
1241                        inst.currentElem[ELEM_TITLE].length > 0 || inst.options.showdescription && inst.currentElem[ELEM_DESCRIPTION] && inst.currentElem[ELEM_DESCRIPTION].length > 0 || inst.options.inGroup && (inst.options.showplaybutton || inst.options.showtitleprefix)))
1242                    inst.options.barheight = 0;
1243                inst.showNavigation();
1244                inst.$elem.off("mouseenter").off("mouseleave").off("mousemove");
1245                inst.$loading.show();
1246                if (inst.options.onshowitem && window[inst.options.onshowitem] && typeof window[inst.options.onshowitem] == "function")
1247                    window[inst.options.onshowitem](elem);
1248                if (inst.options.transition != "none" && inst.existingElem >= 0) {
1249                    $(".html5-elem-box-previous").remove();
1250                    var newitem = inst.$elem.clone();
1251                    newitem.insertAfter(inst.$elem);
1252                    inst.$prevelem = inst.$elem;
1253                    inst.$elem = newitem;
1254                    inst.$prevelem.addClass("html5-elem-box-previous");
1255                    inst.$elem.addClass("html5-elem-box-current");
1256                    inst.$elemWrap = $(".html5-elem-wrap", inst.$elem);
1257                    inst.$loading = $(".html5-loading", inst.$elem);
1258                    inst.$error = $(".html5-error-box", inst.$elem);
1259                    inst.$image = $(".html5-image", inst.$elem);
1260                    inst.$elemData = $(".html5-elem-data-box",
1261                            inst.$elem);
1262                    inst.$text = $(".html5-text", inst.$elem);
1263                    if (inst.options.transition == "slide") {
1264                        inst.$elem.css({
1265                            position: "absolute",
1266                            top: 0,
1267                            left: inst.direction == -1 ? "100%" : "-100%",
1268                            opacity: 0,
1269                            height: "auto"
1270                        });
1271                        inst.$prevelem.css({
1272                            width: inst.$prevelem.width() + "px",
1273                            height: inst.$prevelem.height() + "px"
1274                        })
1275                    }
1276                }
1277                switch (elem[ELEM_TYPE]) {
1278                    case 0:
1279                        var imgLoader = new Image;
1280                        $(imgLoader).on("load", function() {
1281                            elem[ELEM_ORIGINALWIDTH] = imgLoader.width;
1282                            elem[ELEM_ORIGINALHEIGHT] = imgLoader.height;
1283                            inst.showImage(elem, imgLoader.width, imgLoader.height)
1284                        });
1285                        $(imgLoader).on("error", function() {
1286                            inst.showError()
1287                        });
1288                        imgLoader.src = elem[ELEM_HREF];
1289                        break;
1290                    case 1:
1291                        inst.showSWF(elem);
1292                        break;
1293                    case 2:
1294                    case 8:
1295                        inst.showVideo(elem);
1296                        break;
1297                    case 3:
1298                    case 4:
1299                    case 9:
1300                    case 11:
1301                    case 12:
1302                        inst.showYoutubeVimeo(elem);
1303                        break;
1304                    case 5:
1305                        inst.showPDF(elem);
1306                        break;
1307                    case 6:
1308                        inst.showMP3(elem);
1309                        break;
1310                    case 7:
1311                        inst.showWeb(elem);
1312                        break;
1313                    case 10:
1314                        inst.showDiv(elem);
1315                        break
1316                }
1317                if (inst.options.googleanalyticsaccount && window._gaq)
1318                    window._gaq.push(["_trackEvent", "Lightbox", "Open", elem[ELEM_HREF]])
1319            };
1320            inst.loadCurElem =
1321                    function() {
1322                        inst.loadElem(inst.elemArray[inst.options.curElem]);
1323                    };
1324            inst.showError = function() {
1325                inst.$loading.hide();
1326                inst.resizeLightbox(inst.options.errorwidth, inst.options.errorheight, true, function() {
1327                    inst.$loading.hide();
1328                    inst.$error.show();
1329                    inst.$elem.fadeIn(inst.options.fadespeed, function() {
1330                        inst.showData()
1331                    })
1332                })
1333            };
1334            inst.calcTextWidth = function(objW) {
1335                return objW - 36
1336            };
1337            inst.showTitle = function(w, t, description) {
1338                if (inst.options.titlestyle == "inside")
1339                    inst.$elemData.css({
1340                        width: w + "px"
1341                    });
1342                var text = "";
1343                if (inst.options.showtitle)
1344                    if (t &&
1345                            t.length > 0)
1346                        text += t;
1347                if (inst.options.inGroup) {
1348                    if (inst.options.showtitleprefix)
1349                        text = "<span class='html5-title-prefix'>" + inst.options.titleprefix.replace("%NUM", inst.options.groupIndex + 1).replace("%TOTAL", inst.options.groupCount) + "</span> <span class='html5-title-caption'>
1349" + text + "</span>";
1350                    if (inst.options.showplaybutton)
1351                        text = "<div class='html5-playpause' style='display:inline-block;cursor:pointer;vertical-align:middle;'><div class='html5-play' style='display:block;'><img alt='' src='" + inst.options.playimage +
1352                                "'></div><div class='html5-pause' style='display:none;'><img alt='' src='" + inst.options.pauseimage + "'></div></div> " + text
1353                }
1354                if (text.length > 0)
1355                    text = '<div class="html5-title">' + text + "</div>";
1356
1357                if (inst.options.showdescription && description && description.length > 0)
1358                    text += '<div class="html5-description">' + description + "</div>";
1359                inst.$text.html(text);
1360                if (inst.options.inGroup && inst.options.showplaybutton) {
1361                    if (inst.autosliding) {
1362                        $(".html5-play", inst.$lightbox).hide();
1363                        $(".html5-pause", inst.$lightbox).show()
1364                    } else {
1365                        $(".html5-play",
1366                                inst.$lightbox).show();
1367                        $(".html5-pause", inst.$lightbox).hide()
1368                    }
1369                    $(".html5-play", inst.$lightbox).click(function() {
1370                        $(".html5-play", inst.$lightbox).hide();
1371                        $(".html5-pause", inst.$lightbox).show();
1372                        if (inst.slideTimeout) {
1373                            inst.slideTimeout.stop();
1374                            inst.slideTimeout.start();
1375                            inst.autosliding = true
1376                        }
1377                    });
1378                    $(".html5-pause", inst.$lightbox).click(function() {
1379                        $(".html5-play", inst.$lightbox).show();
1380                        $(".html5-pause", inst.$lightbox).hide();
1381                        if (inst.slideTimeout) {
1382                            inst.slideTimeout.stop();
1383                            inst.autosliding = false
1384                        }
1385                    })
1386                }
1387                $("#html5-social",
1388                        inst.$lightbox).show();
1389                if (inst.options.showsocialmedia)
1390                    if (inst.currentElem[ELEM_SOCIALMEDIA])
1391                        if ($("#html5-socialmedia", inst.$lightboxBox).length > 0)
1392                            $("#html5-socialmedia", inst.$lightboxBox).html(inst.currentElem[ELEM_SOCIALMEDIA]);
1393                        else
1394                            inst.$lightboxBox.append('<div id="html5-socialmedia" style="' + inst.options.socialmediaposition + '">' + inst.currentElem[ELEM_SOCIALMEDIA] + "</div>");
1395                    else if ($("#html5-socialmedia", inst.$lightboxBox).length > 0)
1396                        $("#html5-socialmedia", inst.$lightboxBox).remove()
1397            }, inst.showImage =
1398                    function(elem, imgW, imgH) {
1399                        // console.log('Show showImage');
1400                        var elemW, elemH;
1401                        if (elem[ELEM_WIDTH])
1402                            elemW = elem[ELEM_WIDTH];
1403                        else {
1404                            elemW = imgW;
1405                            elem[ELEM_WIDTH] = imgW
1406                        }
1407                        if (elem[ELEM_HEIGHT])
1408                            elemH = elem[ELEM_HEIGHT];
1409                        else {
1410                            elemH = imgH;
1411                            elem[ELEM_HEIGHT] = imgH
1412                        }
1413                        var sizeObj = inst.calcElemSize({
1414                            w: elemW,
1415                            h: elemH
1416                        }, inst.options.imagekeepratio);
1417                        inst.resizeLightbox(sizeObj.w, sizeObj.h, true, function() {
1418                            inst.$loading.hide();
1419                            inst.showTitle(sizeObj.w, elem[ELEM_TITLE], elem[ELEM_DESCRIPTION]);
1420                            var timercode = !inst.options.showtimer || !inst.options.inGroup ? "" : "<div class='html5-timer' style='display:none;position:absolute;" +
1421                                    inst.options.timerposition + ":0;left:0;width:0;height:" + inst.options.timerheight + "px;background-color:" + inst.options.timercolor + ";opacity:" + inst.options.timeropacity + ";'></div>";
1422                            inst.$image.show();
1423                            inst.$image.html("<div class='html5-image-container' style='display:block;position:relative;width:100%;height:100%;" + (inst.options.imagekeepratio ? "overflow:hidden;" : "overflow:auto;") + "'><img alt='" + inst.html2Text(elem[ELEM_TITLE]) + "' src='" + elem[ELEM_HREF] + "' width='100%' height='" + (inst.options.imagekeepratio ?
1424                                    "100%" : "auto") + "' />" + timercode + "</div>");
1425                            inst.$elem.fadeIn(inst.options.fadespeed, function() {
1426                                inst.showData()
1427                            });
1428                            if (inst.autosliding) {
1429                                inst.slideTimeout.stop();
1430                                inst.slideTimeout.start()
1431                            }
1432                        })
1433                    };
1434            inst.showSWF = function(elem) {
1435                // console.log('Show showSWF');
1436                var dataW = elem[ELEM_WIDTH] ? elem[ELEM_WIDTH] : inst.options.defaultwidth;
1437                var dataH = elem[ELEM_HEIGHT] ? elem[ELEM_HEIGHT] : inst.options.defaultheight;
1438                var sizeObj = inst.calcElemSize({
1439                    w: dataW,
1440                    h: dataH
1441                }, true);
1442                dataW = sizeObj.w;
1443                dataH = sizeObj.h;
1444                inst.resizeLightbox(dataW, dataH, true, function() {
1445                    inst.$loading.hide();
1446                    inst.showTitle(sizeObj.w, elem[ELEM_TITLE], elem[ELEM_DESCRIPTION]);
1447                    inst.$image.html("<div class='html5lightbox-swf' style='display:block;width:100%;height:100%;'></div>").show();
1448                    inst.embedFlash($(".html5lightbox-swf", inst.$image), elem[ELEM_HREF], "window", {
1449                        width: dataW,
1450                        height: dataH
1451                    });
1452                    inst.$elem.show();
1453                    inst.showData();
1454                    if (inst.autosliding) {
1455                        inst.slideTimeout.stop();
1456                        inst.slideTimeout.start()
1457                    }
1458                })
1459            };
1460            inst.showVideo = function(elem) {
1461                // console.log('Show showVideo');
1462                inst.slideTimeout.stop();
1463                var dataW = elem[ELEM_WIDTH] ? elem[ELEM_WIDTH] : inst.options.defaultwidth;
1464                var dataH = elem[ELEM_HEIGHT] ? elem[ELEM_HEIGHT] : inst.options.defaultheight;
1465                var sizeObj = inst.calcElemSize({
1466                    w: dataW,
1467                    h: dataH
1468                }, true);
1469                dataW = sizeObj.w;
1470                dataH = sizeObj.h;
1471                inst.resizeLightbox(dataW, dataH, true, function() {
1472                    inst.$loading.hide();
1473                    inst.showTitle(sizeObj.w, elem[ELEM_TITLE], elem[ELEM_DESCRIPTION]);
1474                    inst.$image.html("<div class='html5lightbox-video' style='display:block;width:100%;height:100%;overflow:hidden;background-color:" + inst.options.videobgcolor + ";'></div>").show();
1475                    var isHTML5 = false;
1476                    if (inst.options.isIE678 ||
1477                            elem[ELEM_TYPE] == 8 || inst.options.isIE9 && inst.options.useflashonie9 || inst.options.isIE10 && inst.options.useflashonie10 || inst.options.isIE11 && inst.options.useflashonie11)
1478                        isHTML5 = false;
1479                    else if (inst.options.isMobile)
1480                        isHTML5 = true;
1481                    else if ((inst.options.html5player || !inst.options.flashInstalled) && inst.options.html5VideoSupported) {
1482                        isHTML5 = true;
1483                        if (inst.options.isFirefox || inst.options.isOpera)
1484                            if (!elem[ELEM_HREF_WEBM] && !elem[ELEM_HREF_OGG] && (!inst.options.canplaymp4 || inst.options.useflashformp4onfirefox))
1485                                isHTML5 =
1486                                        false
1487                    }
1488                    if (isHTML5) {
1489                        var videoSrc = elem[ELEM_HREF];
1490                        if (inst.options.isFirefox || inst.options.isOpera)
1491                            if (elem[ELEM_HREF_WEBM])
1492                                videoSrc = elem[ELEM_HREF_WEBM];
1493                            else if (elem[ELEM_HREF_OGG])
1494                                videoSrc = elem[ELEM_HREF_OGG];
1495                        inst.embedHTML5Video($(".html5lightbox-video", inst.$image), videoSrc, inst.options.autoplay, inst.options.loopvideo)
1496                    } else {
1497                        var videoFile = elem[ELEM_HREF];
1498                        if (videoFile.charAt(0) != "/" && videoFile.substring(0, 5) != "http:" && videoFile.substring(0, 6) != "https:")
1499                            videoFile = inst.options.htmlfolder + videoFile;
1500                        inst.embedFlash($(".html5lightbox-video",
1501                                inst.$image), inst.options.jsfolder + "html5boxplayer.swf", "transparent", {
1502                            width: dataW,
1503                            height: dataH,
1504                            jsobjectname: "wonderpluginLightbox",
1505                            hidecontrols: inst.options.videohidecontrols ? "1" : "0",
1506                            hideplaybutton: "0",
1507                            videofile: videoFile,
1508                            hdfile: "",
1509                            ishd: "0",
1510                            defaultvolume: inst.options.defaultvideovolume,
1511                            autoplay: inst.options.autoplay ? "1" : "0",
1512                            loop: inst.options.loopvideo ? "1" : "0",
1513                            errorcss: ".html5box-error" + inst.options.errorcss,
1514                            id: 0
1515                        })
1516                    }
1517                    inst.$elem.show();
1518                    inst.showData()
1519                })
1520            };
1521            inst.loadNext = function() {
1522                $(window).trigger("html5lightbox.videofinished");
1523                if (inst.autosliding)
1524                    inst.gotoSlide(-1);
1525                else if (inst.options.autoclose)
1526                    setTimeout(function() {
1527                        inst.finish()
1528                    }, inst.options.autoclosedelay)
1529            };
1530            inst.getYoutubeParams = function(href) {
1531                var result = {};
1532                if (href.indexOf("?") < 0)
1533                    return result;
1534                var params = href.substring(href.indexOf("?") + 1).split("&");
1535                for (var i = 0; i < params.length; i++) {
1536                    var value = params[i].split("=");
1537                    if (value && value.length == 2 && value[0].toLowerCase() != "v")
1538                        result[value[0].toLowerCase()] = value[1]
1539                }
1540                return result
1541            };
1542            inst.getYoutubeId = function(href) {
1543                var youtubeId =
1544                        "";
1545                var regExp = /^.*((youtu.be\/)|(v\/)|(\/u\/\w\/)|(embed\/)|(watch\??v?=?))([^#\&\?]*).*/;
1546                var match = href.match(regExp);
1547                if (match && match[7] && match[7].length == 11)
1548                    youtubeId = match[7];
1549                return youtubeId
1550            };
1551            inst.prepareYoutubeHref = function(href) {
1552                var youtubeId = inst.getYoutubeId(href);
1553                var protocol = "https:";
1554                var result = protocol + "//www.youtube.com/embed/" + youtubeId;
1555                var params = this.getYoutubeParams(href);
1556                var first = true;
1557                for (var key in params) {
1558                    if (first) {
1559                        result += "?";
1560                        first = false
1561                    } else
1562                        result += "&";
1563                    result += key + "=" + params[key]
1564                }
1565                return result
1566            };
1567            inst.prepareDailymotionHref = function(href) {
1568                if (href.match(/\:\/\/.*(dai\.ly)/i)) {
1569                    var protocol = "https:";
1570                    var id = href.match(/(dai\.ly\/)([a-zA-Z0-9\-\_]+)/)[2];
1571                    href = protocol + "//www.dailymotion.com/embed/video/" + id
1572                }
1573                return href
1574            };
1575            inst.showYoutubeVimeo = function(elem) {
1576                //console.log('Show showYoutubeVimeo');
1577                inst.slideTimeout.stop();
1578                var dataW = elem[ELEM_WIDTH] ? elem[ELEM_WIDTH] : inst.options.defaultwidth;
1579                var dataH = elem[ELEM_HEIGHT] ? elem[ELEM_HEIGHT] : inst.options.defaultheight;
1580                var sizeObj = inst.calcElemSize({
1581                    w: dataW,
1582                    h: dataH
1583                }, true);
1584                dataW = sizeObj.w;
1585                dataH =
1586                        sizeObj.h;
1587                inst.resizeLightbox(dataW, dataH, true, function() {
1588                    inst.$loading.hide();
1589                    inst.showTitle(sizeObj.w, elem[ELEM_TITLE], elem[ELEM_DESCRIPTION]);
1590                    inst.$image.html("<div class='html5lightbox-video' style='display:block;width:100%;height:100%;overflow:hidden;'></div>").show();
1591                    var href = elem[ELEM_HREF];
1592                    var youtubeid = "";
1593                    if (elem[ELEM_TYPE] == 3) {
1594                        youtubeid = inst.getYoutubeId(href);
1595                        href = inst.prepareYoutubeHref(href)
1596                    }
1597                    if (elem[ELEM_TYPE] == 9)
1598                        href = inst.prepareDailymotionHref(href);
1599                    if (inst.options.autoplay) {
1600                        href +=
1601                                href.indexOf("?") < 0 ? "?" : "&";
1602                        if (elem[ELEM_TYPE] == 11)
1603                            href += "autoPlay=true";
1604                        else
1605                            href += "autoplay=1"
1606                    }
1607                    if (inst.options.loopvideo) {
1608                        href += href.indexOf("?") < 0 ? "?" : "&";
1609                        switch (elem[ELEM_TYPE]) {
1610                            case 3:
1611                                href += "loop=1&playlist=" + youtubeid;
1612                                break;
1613                            case 4:
1614                            case 9:
1615                                href += "loop=1";
1616                                break;
1617                            case 11:
1618                                href += "endVideoBehavior=loop";
1619                                break
1620                        }
1621                    }
1622                    if (elem[ELEM_TYPE] == 3) {
1623                        if (href.indexOf("?") < 0)
1624                            href += "?wmode=transparent&rel=0";
1625                        else
1626                            href += "&wmode=transparent&rel=0";
1627                        if (inst.options.videohidecontrols)
1628                            href += "&controls=0&showinfo=0";
1629                        href += "&enablejsapi=1&origin=" +
1630                                document.location.protocol + "//" + document.location.hostname
1631                    } else if (elem[ELEM_TYPE] == 4) {
1632                        href += href.indexOf("?") < 0 ? "?" : "&";
1633                        href += "api=1&player_id=html5boxiframevideo" + inst.options.curElem
1634                    }
1635                    $(".html5lightbox-video", inst.$image).html("<iframe style='margin:0;padding:0;border:0;' class='html5boxiframevideo' id='html5boxiframevideo" + inst.options.curElem + "' width='100%' height='100%' src='" + href + "' frameborder='0' webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>");
1636                    inst.$elem.show();
1637                    inst.showData();
1638                    if (elem[ELEM_TYPE] == 3 && typeof YT === "object" && typeof YT.Player === "function")
1639                        inst.ytplayer = new YT.Player("html5boxiframevideo" + inst.options.curElem, {
1640                            events: {
1641                                "onStateChange": function(event) {
1642                                    if (event.data == YT.PlayerState.ENDED) {
1643                                        $(window).trigger("html5lightbox.videofinished");
1644                                        if (inst.autosliding)
1645                                            inst.gotoSlide(-1);
1646                                        else if (inst.options.autoclose)
1647                                            setTimeout(function() {
1648                                                inst.finish()
1649                                            }, inst.options.autoclosedelay)
1650                                    }
1651                                }
1652                            }
1653                        });
1654                    else if (elem[ELEM_TYPE] == 4 && typeof $f === "function") {
1655                        var vimeoIframe = $("#html5boxiframevideo" +
1656                                inst.options.curElem)[0];
1657                        inst.vimeoPlayer = $f(vimeoIframe);
1658                        inst.vimeoPlayer.addEvent("ready", function() {
1659                            inst.vimeoPlayer.addEvent("finish", function(id) {
1660                                $(window).trigger("html5lightbox.videofinished");
1661                                if (inst.autosliding)
1662                                    inst.gotoSlide(-1);
1663                                else if (inst.options.autoclose)
1664                                    setTimeout(function() {
1665                                        inst.finish()
1666                                    }, inst.options.autoclosedelay)
1667                            })
1668                        })
1669                    }
1670                })
1671            };
1672            inst.showPDF = function(elem) {
1673                if (inst.options.enablepdfjs) {
1674                    if (inst.options.isIPhone && inst.options.openpdfinnewtaboniphone || inst.options.isIPad && inst.options.openpdfinnewtabonipad) {
1675                        var win =
1676                                window.open(elem[ELEM_HREF], "_blank");
1677                        win.focus();
1678                        inst.finish();
1679                        return
1680                    }
1681                    if (!inst.options.pdfjsengine)
1682                        inst.options.pdfjsengine = inst.options.jsfolder + "pdfjs/web/viewer.html";
1683                    var href = elem[ELEM_HREF];
1684                    if (href.substring(0, 5) != "http:" && href.substring(0, 6) != "https:")
1685                        href = inst.absoluteUrl(href);
1686                    var pdfelem = jQuery.extend(true, {}, elem);
1687                    pdfelem[ELEM_HREF] = inst.options.pdfjsengine + "?file=" + encodeURIComponent(href);
1688                    inst.showWeb(pdfelem)
1689                } else if (inst.options.isIPhone || inst.options.isIPad || inst.options.isAndroid ||
1690                        inst.options.isIE || inst.options.isIE11) {
1691                    var win = window.open(elem[ELEM_HREF], "_blank");
1692                    win.focus();
1693                    inst.finish();
1694                    return
1695                } else
1696                    inst.showWeb(elem)
1697            };
1698            inst.showMP3 = function(elem) {
1699            };
1700            inst.showDiv = function(elem) {
1701                //  console.log('Show Div');
1702                var winWidth = $(window).width();
1703                var winH = $(window).height();
1704                var navH = inst.options.shownavigation && inst.navvisible ? inst.options.navheight : 0;
1705                var dataW = elem[ELEM_WIDTH] ? elem[ELEM_WIDTH] : inst.options.usedefaultsizeforcontent ? inst.options.defaultwidth : winWidth;
1706                var dataH = elem[ELEM_HEIGHT] ? elem[ELEM_HEIGHT] :
1707                        inst.options.usedefaultsizeforcontent ? inst.options.defaultheight : winH - navH;
1708                var sizeObj = inst.calcElemSize({
1709                    w: dataW,
1710                    h: dataH
1711                }, false);
1712                dataW = sizeObj.w;
1713                dataH = sizeObj.h;
1714                inst.resizeLightbox(dataW, dataH, true, function() {
1715                    inst.$loading.hide();
1716                    inst.showTitle(sizeObj.w, elem[ELEM_TITLE], elem[ELEM_DESCRIPTION]);
1717                    inst.$image.html("<div class='html5lightbox-div' id='html5lightbox-div" + inst.options.curElem + "' style='display:block;width:100%;height:" + (inst.options.autoresizecontent ? "auto" : "100%") + ";" + (inst.options.isIOS ?
1718                            "-webkit-overflow-scrolling:touch;overflow-y:scroll;" : "overflow:auto;") + "'></div>").show();
1719                    var divID = elem[ELEM_HREF];
1720                    if ($(divID).length > 0)
1721                        $(divID).children().appendTo($("#html5lightbox-div" + inst.options.curElem, inst.$image));
1722                    else
1723                        $("#html5lightbox-div" + inst.options.curElem, inst.$image).html("<div class='html5-error'>The specified div ID does not exist.</div>");
1724                    inst.$elem.show();
1725                    inst.showData();
1726                    if (inst.options.autoresizecontent)
1727                        inst.resizeWindow();
1728                    if (inst.autosliding) {
1729                        inst.slideTimeout.stop();
1730                        inst.slideTimeout.start()
1731                    }
1732                })
1733            };
1734            inst.isSameDomain = function(href) {
1735                if (href.substring(0, 5) != "http:" && href.substring(0, 6) != "https:")
1736                    return true;
1737                var link = document.createElement("a");
1738                link.setAttribute("href", href);
1739                var result = link.protocol == document.location.protocol && link.host == document.location.host && link.port == document.location.port;
1740                link = null;
1741                return result
1742            };
1743            inst.showWeb = function(elem) {
1744                var winWidth = $(window).width();
1745                var winH = $(window).height();
1746                var navH = inst.options.shownavigation && inst.navvisible ? inst.options.navheight : 0;
1747                var dataW = elem[ELEM_WIDTH] ?
1748                        elem[ELEM_WIDTH] : inst.options.usedefaultsizeforcontent ? inst.options.defaultwidth : winWidth;
1749                var dataH = elem[ELEM_HEIGHT] ? elem[ELEM_HEIGHT] : inst.options.usedefaultsizeforcontent ? inst.options.defaultheight : winH - navH;
1750                var sizeObj = inst.calcElemSize({
1751                    w: dataW,
1752                    h: dataH
1753                }, false);
1754                dataW = sizeObj.w;
1755                dataH = sizeObj.h;
1756                inst.resizeLightbox(dataW, dataH, true, function() {
1757                    inst.$loading.hide();
1758                    inst.showTitle(sizeObj.w, elem[ELEM_TITLE], elem[ELEM_DESCRIPTION]);
1759                    inst.$image.html("<div class='html5lightbox-web' style='display:block;width:100%;height:100%;" +
1760                            (inst.options.isIOS ? "-webkit-overflow-scrolling:touch;overflow-y:scroll;" : "") + "'></div>").show();
1761                    $(".html5lightbox-web", inst.$image).html("<iframe style='margin:0;padding:0;border:0;' class='html5lightbox-web-iframe' width='100%' height='100%' src='" + elem[ELEM_HREF] + "' frameborder='0' webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>");
1762                    inst.$elem.show();
1763                    inst.showData();
1764                    if (inst.options.autoresizecontent && inst.isSameDomain(elem[ELEM_HREF])) {
1765                        $(".html5lightbox-web-iframe", inst.$image).data("sameorigin",
1766                                true);
1767                        $(".html5lightbox-web-iframe", inst.$image).on("load", function() {
1768                            $(this).data("sameoriginloaded", true);
1769                            inst.resizeWindow()
1770                        })
1771                    }
1772                    if (inst.autosliding) {
1773                        inst.slideTimeout.stop();
1774                        inst.slideTimeout.start()
1775                    }
1776                })
1777            };
1778            inst.scrollBox = function() {
1779            };
1780            inst.resizeWindow = function() {
1781                if (!inst.currentElem)
1782                    return;
1783                if (!inst.options.responsive)
1784                    return;
1785                var winWidth = $(window).width();
1786                var winH = $(window).height();
1787                if (inst.options.responsivebarheight) {
1788                    if (winH <= inst.options.smallscreenheight)
1789                        inst.options.barheight = inst.options.barheightonsmallheight;
1790                    else
1791                        inst.options.barheight = inst.options.barheightoriginal;
1792                    if (inst.options.titlestyle == "bottom" && inst.options.barautoheight != "auto")
1793                        inst.$elemData.css({
1794                            height: inst.options.barheight + "px",
1795                            "max-height": inst.options.barheight + "px"
1796                        })
1797                }
1798                if (!(inst.options.showtitle && inst.currentElem[ELEM_TITLE] && inst.currentElem[ELEM_TITLE].length > 0 || inst.options.showdescription && inst.currentElem[ELEM_DESCRIPTION] && inst.currentElem[ELEM_DESCRIPTION].length > 0 || inst.options.inGroup && (inst.options.showplaybutton || inst.options.showtitleprefix)))
1799                    inst.options.barheight =
1800                            0;
1801                var elemW, elemH, keepratio;
1802                if (inst.currentElem[ELEM_TYPE] == 5 || inst.currentElem[ELEM_TYPE] == 7 || inst.currentElem[ELEM_TYPE] == 10) {
1803                    var navH = inst.options.shownavigation && inst.navvisible ? inst.options.navheight : 0;
1804                    elemW = inst.currentElem[ELEM_WIDTH] ? inst.currentElem[ELEM_WIDTH] : inst.options.usedefaultsizeforcontent ? inst.options.defaultwidth : winWidth;
1805                    elemH = inst.currentElem[ELEM_HEIGHT] ? inst.currentElem[ELEM_HEIGHT] : inst.options.usedefaultsizeforcontent ? inst.options.defaultheight : winH - navH;
1806                    keepratio = false
1807                } else {
1808                    elemW =
1809                            inst.currentElem[ELEM_WIDTH] ? inst.currentElem[ELEM_WIDTH] : inst.options.defaultwidth;
1810                    elemH = inst.currentElem[ELEM_HEIGHT] ? inst.currentElem[ELEM_HEIGHT] : inst.options.defaultheight;
1811                    if (inst.currentElem[ELEM_TYPE] == 0)
1812                        keepratio = inst.options.imagekeepratio;
1813                    else
1814                        keepratio = true
1815                }
1816                var sizeObj = inst.calcElemSize({
1817                    w: elemW,
1818                    h: elemH
1819                }, keepratio);
1820                var boxPos = inst.calcBoxPosition(sizeObj.w, sizeObj.h);
1821                var boxW = boxPos[0];
1822                var boxH = boxPos[1];
1823                var boxT = boxPos[2];
1824                inst.$lightboxBox.css({
1825                    "margin-top": boxT
1826                });
1827                if (inst.options.titlestyle ==
1828                        "left" || inst.options.titlestyle == "right")
1829                    inst.$lightboxBox.css({
1830                        "width": boxW,
1831                        "height": boxH
1832                    });
1833                else {
1834                    inst.$lightboxBox.css({
1835                        "width": boxW,
1836                        "height": "auto"
1837                    });
1838                    inst.$elemWrap.css({
1839                        "width": boxW,
1840                        "height": boxH
1841                    })
1842                }
1843                if (inst.options.titlestyle == "inside")
1844                    inst.$elemData.css({
1845                        width: sizeObj.w + "px"
1846                    });
1847                if (inst.options.autoresizecontent && (inst.currentElem[ELEM_TYPE] == 5 || inst.currentElem[ELEM_TYPE] == 7 || inst.currentElem[ELEM_TYPE] == 10)) {
1848                    var resizeHeight = false;
1849                    if (inst.currentElem[ELEM_TYPE] == 7 && $(".html5lightbox-web-iframe",
1850                            inst.$lightbox).length > 0 && $(".html5lightbox-web-iframe", inst.$lightbox).data("sameoriginloaded")) {
1851                        var iframe = $(".html5lightbox-web-iframe", inst.$lightbox)[0];
1852                        if (iframe && iframe.contentWindow && iframe.contentWindow.document && iframe.contentWindow.document.documentElement.offsetHeight)
1853                            if (elemH > iframe.contentWindow.document.documentElement.offsetHeight) {
1854                                elemH = iframe.contentWindow.document.documentElement.offsetHeight;
1855                                resizeHeight = true
1856                            }
1857                    } else if (inst.currentElem[ELEM_TYPE] == 10 && $(".html5lightbox-div", inst.$lightbox).length >
1858                            0) {
1859                        var divH = $(".html5lightbox-div", inst.$lightbox).height();
1860                        if (elemH > divH) {
1861                            elemH = divH;
1862                            resizeHeight = true
1863                        }
1864                    }
1865                    if (resizeHeight) {
1866                        sizeObj = inst.calcElemSize({
1867                            w: elemW,
1868                            h: elemH
1869                        }, keepratio);
1870                        boxPos = inst.calcBoxPosition(sizeObj.w, sizeObj.h);
1871                        boxW = boxPos[0];
1872                        boxH = boxPos[1];
1873                        boxT = boxPos[2];
1874                        inst.$lightboxBox.css({
1875                            "margin-top": boxT
1876                        });
1877                        if (inst.options.titlestyle == "left" || inst.options.titlestyle == "right")
1878                            inst.$lightboxBox.css({
1879                                "height": boxH
1880                            });
1881                        else {
1882                            inst.$lightboxBox.css({
1883                                "height": "auto"
1884                            });
1885                            inst.$elemWrap.css({
1886                                "height": boxH
1887                            })
1888                        }
1889                    }
1890                }
1891                if ($(".html5-nav").length <=
1892                        0)
1893                    return;
1894                $(".html5-nav-list").css({
1895                    "margin-left": 0
1896                });
1897                var $navMask = $(".html5-nav-mask");
1898                var $navPrev = $(".html5-nav-prev");
1899                var $navNext = $(".html5-nav-next");
1900                var winWidth = $(window).width();
1901                if (inst.options.totalwidth <= winWidth) {
1902                    $navMask.css({
1903                        width: inst.options.totalwidth + "px"
1904                    });
1905                    $navPrev.hide();
1906                    $navNext.hide()
1907                } else {
1908                    $navMask.css({
1909                        width: winWidth - 2 * inst.options.navbuttonwidth + "px"
1910                    });
1911                    $navPrev.show();
1912                    $navNext.show()
1913                }
1914            };
1915            inst.calcElemSize = function(sizeObj, keepratio) {
1916                if (!inst.options.responsive)
1917                    return sizeObj;
1918                var winWidth = $(window).width();
1919                winWidth = winWidth ? winWidth : $(document).width();
1920                var winH = $(window).height();
1921                winH = winH ? winH : $(document).height();
1922                if ((inst.options.titlestyle == "left" || inst.options.titlestyle == "right") && winWidth > inst.options.sidetobottomscreenwidth)
1923                    sizeObj.w = sizeObj.w * 100 / inst.options.imagepercentage;
1924                var navH = inst.options.shownavigation && inst.navvisible ? inst.options.navheight : 0;
1925                var topmargin = $(window).width() < inst.options.navarrowsbottomscreenwidth ? inst.options.bordertopmarginsmall : inst.options.bordertopmargin;
1926                var h0 = winH - navH - 2 * inst.options.bordersize - 2 * topmargin;
1927                if (inst.options.titlestyle == "bottom")
1928                    h0 -= inst.options.barheight;
1929                var w0 = winWidth - 2 * inst.options.bordersize - 2 * inst.options.bordermargin;
1930                if (inst.options.fullscreenmode && winWidth > inst.options.navarrowsbottomscreenwidth || (inst.options.isTouch && inst.options.navarrowsalwaysshowontouch || inst.options.alwaysshownavarrows) && winWidth > inst.options.navarrowsbottomscreenwidth)
1931                    w0 -= 64;
1932                if ((inst.options.titlestyle == "left" || inst.options.titlestyle == "right") && winWidth <=
1933                        inst.options.sidetobottomscreenwidth || inst.options.notkeepratioonsmallheight && winH <= inst.options.smallscreenheight)
1934                    keepratio = false;
1935                if (inst.currentElem[ELEM_TYPE] == 0 && keepratio) {
1936                    var ratio = inst.currentElem[ELEM_ORIGINALWIDTH] / inst.currentElem[ELEM_ORIGINALHEIGHT];
1937                    sizeObj.h = Math.round(sizeObj.w / ratio);
1938                    if (sizeObj.h > h0) {
1939                        sizeObj.w = Math.round(ratio * h0);
1940                        sizeObj.h = h0
1941                    }
1942                    if (sizeObj.w > w0) {
1943                        sizeObj.h = Math.round(w0 / ratio);
1944                        sizeObj.w = w0
1945                    }
1946                } else {
1947                    if (sizeObj.h > h0) {
1948                        if (keepratio)
1949                            sizeObj.w = Math.round(sizeObj.w * h0 / sizeObj.h);
1950                        sizeObj.h = h0
1951                    } else if (inst.options.maxheight)
1952                        sizeObj.h = h0;
1953                    if (sizeObj.w > w0) {
1954                        if (keepratio)
1955                            sizeObj.h = Math.round(sizeObj.h * w0 / sizeObj.w);
1956                        sizeObj.w = w0
1957                    }
1958                }
1959                return sizeObj
1960            };
1961            inst.showData = function() {
1962                if (inst.$text.text().length > 0)
1963                    inst.$elemData.show();
1964                if (inst.options.titlestyle == "bottom" || inst.options.titlestyle == "inside")
1965                    inst.$lightboxBox.css({
1966                        height: "auto"
1967                    });
1968                if (inst.$text.text().length > 0 && inst.options.titlestyle == "bottom")
1969                    inst.$elemData.css({
1970                        "max-height": inst.options.barheight + "px"
1971                    });
1972                if (inst.options.positionFixed)
1973                    $("#html5-lightbox-overlay",
1974                            inst.$lightbox).css({
1975                        height: Math.max($(window).height(), $(document).height())
1976                    });
1977                else
1978                    $("#html5-lightbox-overlay", inst.$lightbox).css({
1979                        height: "100%"
1980                    });
1981                $(window).trigger("html5lightbox.lightboxopened")
1982            };
1983            inst.resizeLightbox = function(elemW, elemH, bAnimate, onFinish) {
1984                inst.hideNavArrows();
1985                var boxPos = inst.calcBoxPosition(elemW, elemH);
1986                var boxW = boxPos[0];
1987                var boxH = boxPos[1];
1988                var boxT = boxPos[2];
1989                inst.$loading.hide();
1990                inst.$watermark.hide();
1991                if (inst.options.nextElem <= inst.options.curElem)
1992                    if (inst.options.onlastitem &&
1993                            window[inst.options.onlastitem] && typeof window[inst.options.onlastitem] == "function")
1994                        window[inst.options.onlastitem](inst.currentElem);
1995                if (inst.options.prevElem >= inst.options.curElem)
1996                    if (inst.options.onfirstitem && window[inst.options.onfirstitem] && typeof window[inst.options.onfirstitem] == "function")
1997                        window[inst.options.onfirstitem](inst.currentElem);
1998                if (!inst.options.fullscreenmode && (!inst.options.isTouch || !inst.options.navarrowsalwaysshowontouch) && !inst.options.alwaysshownavarrows) {
1999                    inst.$lightboxBox.on("mouseenter mousemove",
2000                            function() {
2001                                if (inst.options.arrowloop && inst.options.prevElem >= 0 || !inst.options.arrowloop && inst.options.prevElem >= 0 && inst.options.prevElem < inst.options.curElem)
2002                                    inst.$prev.fadeIn();
2003                                if (inst.options.arrowloop && inst.options.nextElem >= 0 || !inst.options.arrowloop && inst.options.nextElem >= 0 && inst.options.nextElem > inst.options.curElem)
2004                                    inst.$next.fadeIn()
2005                            });
2006                    inst.$lightboxBox.on("mouseleave", function() {
2007                        inst.$next.fadeOut();
2008                        inst.$prev.fadeOut()
2009                    })
2010                }
2011                var existingBoxT = parseInt(inst.$lightboxBox.css("margin-top"));
2012                inst.$lightboxBox.css({
2013                    "margin-top": boxT
2014                });
2015                var speed = bAnimate ? inst.options.resizespeed : 0;
2016                if (inst.options.transition == "slide" && inst.existingElem >= 0)
2017                    speed = 0;
2018                if (inst.options.titlestyle == "left" || inst.options.titlestyle == "right") {
2019                    if (boxW == inst.$lightboxBox.width() && boxH == inst.$lightboxBox.height())
2020                        speed = 0;
2021                    inst.$lightboxBox.animate({
2022                        width: boxW
2023                    }, speed).animate({
2024                        height: boxH
2025                    }, speed, function() {
2026                        inst.onAnimateFinish(onFinish)
2027                    })
2028                } else {
2029                    if (boxW == inst.$elemWrap.width() && boxH == inst.$elemWrap.height())
2030                        speed = 0;
2031                    inst.$lightboxBox.css({
2032                        "width": boxW,
2033                        "height": "auto"
2034                    });
2035                    if (inst.options.transition == "slide" && inst.existingElem >= 0)
2036                        if ($(".html5-elem-box-previous", inst.$lightbox).length > 0)
2037                            $(".html5-elem-box-previous", inst.$lightbox).css({
2038                                "margin-left": String(boxW / 2 - $(".html5-elem-box-previous", inst.$lightbox).width() / 2) + "px",
2039                                top: String(existingBoxT - boxT) + "px"
2040                            });
2041                    inst.$elemWrap.animate({
2042                        width: boxW
2043                    }, speed).animate({
2044                        height: boxH
2045                    }, speed, function() {
2046                        inst.onAnimateFinish(onFinish)
2047                    })
2048                }
2049            };
2050            inst.onAnimateFinish = function(onFinish) {
2051                inst.$loading.show();
2052                inst.$watermark.show();
2053                inst.$close.show();
2054                inst.$elem.css({
2055                    "background-color": inst.options.bgcolor
2056                });
2057                onFinish();
2058                inst.finishCallback()
2059            };
2060            inst.finishCallback = function() {
2061                if (inst.options.transition == "slide" && inst.existingElem >= 0) {
2062                    inst.$prevelem.animate({
2063                        left: inst.direction == -1 ? "-100%" : "100%",
2064                        opacity: 0
2065                    }, {
2066                        duration: inst.options.transitionduration
2067                    });
2068                    inst.$elem.animate({
2069                        left: 0,
2070                        opacity: 1
2071                    }, {
2072                        duration: inst.options.transitionduration,
2073                        always: function() {
2074                            inst.$prevelem.remove();
2075                            inst.$elem.removeClass("html5-elem-box-current").css({
2076                                position: "relative",
2077                                height: "100%"
2078                            })
2079                        }
2080                    })
2081                }
2082            },
2083                    inst.resetDiv = function(elemID) {
2084                if (inst.elemArray.length > 0 && elemID >= 0)
2085                    if (inst.elemArray[elemID][ELEM_TYPE] == 10) {
2086                        var divID = inst.elemArray[elemID][ELEM_HREF];
2087                        if ($(divID).length > 0)
2088                            $("#html5lightbox-div" + elemID).children().appendTo($(divID))
2089                    }
2090            };
2091            inst.reset = function() {
2092                if (inst.options.stamp)
2093                    inst.$watermark.hide();
2094                inst.showing = false;
2095                inst.$image.empty();
2096                inst.$text.empty();
2097                inst.$error.hide();
2098                inst.$loading.hide();
2099                inst.$image.hide();
2100                if (inst.options.titlestyle == "bottom" || inst.options.titlestyle == "inside")
2101                    inst.$elemData.hide();
2102                if (!inst.options.fullscreenmode)
2103                    inst.$close.hide();
2104                inst.$elem.css({
2105                    "background-color": ""
2106                })
2107            };
2108            inst.resetNavigation = function() {
2109                inst.options.navheight = 0;
2110                $(".html5-nav").remove();
2111                inst.navvisible = false
2112            };
2113            inst.finish = function() {
2114                //console.log("234234234234234");
2115                jQuery('body').removeClass('ovrflw-hdn');
2116                inst.existingElem = -1;
2117                inst.resetDiv(inst.options.curElem);
2118                if ($(".html5-lightbox-video", inst.$lightbox).length)
2119                    $(".html5-lightbox-video", inst.$lightbox).attr("src", "");
2120                $("head").find("style").each(function() {
2121                    if ($(this).data("creator") == "html5box-html5-lightbox")
2122                        $(this).remove()
2123                });
2124                if (inst.options.bodynoscroll)
2125                    $("html,body").removeClass("bodynoscroll");
2126                inst.slideTimeout.stop();
2127                inst.reset();
2128                inst.resetNavigation();
2129                inst.$lightbox.remove();
2130                $("#html5box-html5-lightbox").remove();
2131                inst.showObjects();
2132                if (inst.options.oncloselightbox && window[inst.options.oncloselightbox] && typeof window[inst.options.oncloselightbox] == "function")
2133                    window[inst.options.oncloselightbox](inst.currentElem);
2134                if (inst.onLightboxClosed && typeof inst.onLightboxClosed == "function")
2135                    inst.onLightboxClosed(inst.currentElem);
2136                $(window).trigger("html5lightbox.lightboxclosed")
2137            };
2138            inst.pauseSlide = function() {
2139            };
2140            inst.playSlide = function() {
2141            };
2142            inst.gotoSlide = function(slide) {
2143                inst.existingElem = inst.options.curElem;
2144                inst.direction = slide;
2145                inst.resetDiv(inst.options.curElem);
2146                if (slide == -1) {
2147                    if (inst.options.nextElem < 0)
2148                        return;
2149                    inst.options.curElem = inst.options.nextElem
2150                } else if (slide == -2) {
2151                    if (inst.options.prevElem < 0)
2152                        return;
2153                    inst.options.curElem = inst.options.prevElem
2154                } else if (slide >= 0) {
2155                    inst.direction = slide > inst.options.curElem ? -1 : -2;
2156                    inst.options.curElem = slide
2157                }
2158                if (inst.autosliding)
2159                    inst.slideTimeout.stop();
2160                inst.calcNextPrevElem();
2161                if (inst.options.transition == "none")
2162                    inst.reset();
2163                inst.loadCurElem()
2164            };
2165            inst.enableSwipe = function() {
2166                var preventDefault = inst.options.isAndroid && (inst.options.swipepreventdefaultonandroid || inst.options.androidVersion >= 0 && inst.options.androidVersion <= 5) ? true : false;
2167                inst.$lightboxBox.html5lightboxTouchSwipe({
2168                    preventWebBrowser: preventDefault,
2169                    swipeDistance: inst.options.swipedistance,
2170                    swipeLeft: function() {
2171                        inst.gotoSlide(-1)
2172                    },
2173                    swipeRight: function() {
2174                        inst.gotoSlide(-2)
2175                    }
2176                })
2177            };
2178            inst.hideObjects = function() {
2179                $("select, embed, object").css({
2180                    "visibility": "hidden"
2181                })
2182            };
2183            inst.showObjects = function() {
2184                $("select, embed, object").css({
2185                    "visibility": "visible"
2186                })
2187            };
2188            inst.embedHTML5Video = function($container, src, autoplay, loopvideo) {
2189                $container.html("<div style='display:block;width:100%;height:100%;position:relative;'><video class='html5-lightbox-video' width='100%' height='100%'" + (inst.options.html5videoposter && inst.options.html5videoposter.length > 0 ? "poster='" + inst.options.html5videoposter + "'" : "") + (autoplay ? " autoplay" : "") + (loopvideo ? " loop" : "") + (inst.options.nativehtml5controls &&
2190                        !inst.options.videohidecontrols ? " controls='controls'" : "") + " src='" + src + "'></div>");
2191                if (!inst.options.nativehtml5controls) {
2192                    $("video", $container).data("src", src);
2193                    $("video", $container).lightboxHTML5VideoControls(inst.options.skinsfolder, inst, inst.options.videohidecontrols, false, inst.options.defaultvideovolume)
2194                }
2195                $("video", $container).off("ended").on("ended", function() {
2196                    $(window).trigger("html5lightbox.videofinished");
2197                    if (inst.autosliding)
2198                        inst.gotoSlide(-1);
2199                    else if (inst.options.autoclose)
2200                        setTimeout(function() {
2201                            inst.finish()
2202                        },
2203                                inst.options.autoclosedelay)
2204                })
2205            };
2206            inst.embedFlash = function($container, src, wmode, flashVars) {
2207                if (inst.options.flashInstalled) {
2208                    var htmlOptions = {
2209                        pluginspage: "http://www.adobe.com/go/getflashplayer",
2210                        quality: "high",
2211                        allowFullScreen: "true",
2212                        allowScriptAccess: "always",
2213                        type: "application/x-shockwave-flash"
2214                    };
2215                    htmlOptions.width = "100%";
2216                    htmlOptions.height = "100%";
2217                    htmlOptions.src = src;
2218                    htmlOptions.flashVars = $.param(flashVars);
2219                    htmlOptions.wmode = wmode;
2220                    var htmlString = "";
2221                    for (var key in htmlOptions)
2222                        htmlString += key + "=" + htmlOptions[key] +
2223                                " ";
2224                    $container.html("<embed " + htmlString + "/>")
2225                } else
2226                    $container.html("<div class='html5lightbox-flash-error' style='display:block; position:relative;text-align:center; width:100%; left:0px; top:40%;'><div class='html5-error'><div>The required Adobe Flash Player plugin is not installed</div><br /><div style='display:block;position:relative;text-align:center;width:112px;height:33px;margin:0px auto;'><a href='http://www.adobe.com/go/getflashplayer'><img src='http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif' alt='Get Adobe Flash player' width='112' height='33'></img></a></div></div>")
2227            };
2228            inst.checkType = function(href) {
2229                if (!href)
2230                    return -1;
2231                if (href.match(/\.(jpg|gif|png|bmp|jpeg)(.*)?$/i))
2232                    return 0;
2233                if (href.match(/[^\.]\.(swf)\s*$/i))
2234                    return 1;
2235                if (href.match(/\.(mp4|m4v|ogv|ogg|webm)(.*)?$/i))
2236                    return 2;
2237                if (href.match(/\:\/\/.*(youtube\.com)/i) || href.match(/\:\/\/.*(youtu\.be)/i))
2238                    return 3;
2239                if (href.match(/\:\/\/.*(vimeo\.com)/i))
2240                    return 4;
2241                if (href.match(/\:\/\/.*(dailymotion\.com)/i) || href.match(/\:\/\/.*(dai\.ly)/i))
2242                    return 9;
2243                if (href.match(/[^\.]\.(pdf)\s*$/i))
2244                    return 5;
2245                if (href.match(/[^\.]\.(mp3)\s*$/i))
2246                    return 6;
2247                if (href.match(/[^\.]\.(flv)\s*$/i))
2248                    return 8;
2249                if (href.match(/\#\w+/i))
2250                    return 10;
2251                if (href.match(/\:\/\/.*(wistia)/i))
2252                    return 11;
2253                return 7
2254            };
2255            inst.getURLParams = function() {
2256                var result = {};
2257                var params = window.location.search.substring(1).split("&");
2258                for (var i = 0; i < params.length; i++) {
2259                    var value = params[i].split("=");
2260                    if (value && value.length == 2)
2261                        result[value[0].toLowerCase()] = unescape(value[1])
2262                }
2263                return result
2264            };
2265            inst.absoluteUrl = function(href) {
2266                var link = document.createElement("a");
2267                link.href = href;
2268                return link.protocol + "//" + link.host +
2269                        link.pathname + link.search + link.hash
2270            };
2271            inst.showLightbox = function(type, href, title, width, height, webm, ogg, thumbnail, description) {
2272                inst.options = $.extend(inst.options, inst.defaultoptions);
2273                $(window).trigger("html5lightbox.lightboxshow");
2274                inst.init();
2275                inst.reset();
2276                inst.$lightbox.show();
2277                var boxPos = inst.calcBoxPosition(inst.options.loadingwidth, inst.options.loadingheight);
2278                var boxW = boxPos[0];
2279                var boxH = boxPos[1];
2280                var boxT = boxPos[2];
2281                inst.$lightboxBox.css({
2282                    "margin-top": boxT
2283                });
2284                if (inst.options.titlestyle == "left" || inst.options.titlestyle ==
2285                        "right")
2286                    inst.$lightboxBox.css({
2287                        "width": boxW,
2288                        "height": boxH
2289                    });
2290                else {
2291                    inst.$lightboxBox.css({
2292                        "width": boxW,
2293                        "height": "auto"
2294                    });
2295                    inst.$elemWrap.css({
2296                        "width": boxW,
2297                        "height": boxH
2298                    })
2299                }
2300
2301                inst.loadElem(new Array(type, href, title, null, width, height, webm, ogg, thumbnail, description))
2302            };
2303            inst.addItem = function(href, title, group, width, height, webm, ogg, thumbnail, description, mediatype) {
2304                type = mediatype && mediatype >= 0 ? mediatype : inst.checkType(href);
2305                inst.elemArray.push(new Array(type, href, title, group, width, height, webm, ogg, thumbnail, description))
2306            };
2307            inst.showItem = function(href) {
2308                inst.options = $.extend(inst.options, inst.defaultoptions);
2309                $(window).trigger("html5lightbox.lightboxshow");
2310                inst.init();
2311                if (inst.elemArray.length <= 0)
2312                    return true;
2313                inst.hideObjects();
2314                for (var i = 0; i < inst.elemArray.length; i++)
2315                    if (inst.elemArray[i][ELEM_HREF] == href)
2316                        break;
2317                if (i == inst.elemArray.length)
2318                    return true;
2319                inst.options.curElem = i;
2320                inst.calcNextPrevElem();
2321                inst.reset();
2322                inst.$lightbox.show();
2323                var boxPos = inst.calcBoxPosition(inst.options.loadingwidth, inst.options.loadingheight);
2324                var boxW =
2325                        boxPos[0];
2326                var boxH = boxPos[1];
2327                var boxT = boxPos[2];
2328                inst.$lightboxBox.css({
2329                    "margin-top": boxT
2330                });
2331                if (inst.options.titlestyle == "left" || inst.options.titlestyle == "right")
2332                    inst.$lightboxBox.css({
2333                        "width": boxW,
2334                        "height": boxH
2335                    });
2336                else {
2337                    inst.$lightboxBox.css({
2338                        "width": boxW,
2339                        "height": "auto"
2340                    });
2341                    inst.$elemWrap.css({
2342                        "width": boxW,
2343                        "height": boxH
2344                    })
2345                }
2346                inst.loadCurElem();
2347                return false
2348            };
2349            inst.off("click").click(inst.clickHandler);
2350            inst.each(function() {
2351                var self = $(this);
2352                var autoopen = false;
2353                var autoopendelay = 0;
2354                if (typeof wonderpluginlightbox_options !=
2355                        "undefined" && wonderpluginlightbox_options) {
2356                    if ("autoopen" in wonderpluginlightbox_options)
2357                        autoopen = wonderpluginlightbox_options.autoopen;
2358                    if ("autoopendelay" in wonderpluginlightbox_options)
2359                        autoopendelay = wonderpluginlightbox_options.autoopendelay
2360                }
2361                autoopen = self.data("autoopen") ? self.data("autoopen") : autoopen;
2362                autoopendelay = self.data("autoopendelay") ? self.data("autoopendelay") : autoopendelay;
2363                if (autoopen) {
2364                    setTimeout(function() {
2365                        self.click()
2366                    }, autoopendelay);
2367                    return false
2368                }
2369            });
2370            var urlParams = inst.getURLParams();
2371            if ("wplightboxshare" in urlParams) {
2372                var shareUrl =
2373                        decodeURIComponent(urlParams["wplightboxshare"]);
2374                var shareLink = $('.wplightbox[href="' + shareUrl + '"]');
2375                if (shareLink.length > 0)
2376                    shareLink.click()
2377            }
2378            return inst
2379        }
2380    })(jQuery);
2381    (function($) {
2382        $.fn.html5lightboxTouchSwipe = function(options) {
2383            var defaults = {
2384                preventWebBrowser: false,
2385                swipeDistance: 0,
2386                swipeLeft: null,
2387                swipeRight: null,
2388                swipeTop: null,
2389                swipeBottom: null
2390            };
2391            if (options)
2392                $.extend(defaults, options);
2393            return this.each(function() {
2394                var startX = -1,
2395                        startY = -1;
2396                var curX = -1,
2397                        curY = -1;
2398
2399                function touchStart(event) {
2400                    var e = event.originalEvent;
2401                    if (e.targetTouches.length >= 1) {
2402                        startX = e.targetTouches[0].pageX;
2403                        startY = e.targetTouches[0].pageY
2404                    } else
2405                        touchCancel(event)
2406                }
2407
2408                function touchMove(event) {
2409                    if (defaults.preventWebBrowser)
2410                        event.preventDefault();
2411                    var e = event.originalEvent;
2412                    if (e.targetTouches.length >= 1) {
2413                        curX = e.targetTouches[0].pageX;
2414                        curY = e.targetTouches[0].pageY
2415                    } else
2416                        touchCancel(event)
2417                }
2418
2419                function touchEnd(event) {
2420                    if (curX > 0 || curY > 0) {
2421                        triggerHandler();
2422                        touchCancel(event)
2423                    } else
2424                        touchCancel(event)
2425                }
2426
2427                function touchCancel(event) {
2428                    startX = -1;
2429                    startY = -1;
2430                    curX = -1;
2431                    curY = -1
2432                }
2433
2434                function triggerHandler() {
2435                    if (Math.abs(curX - startX) > Math.abs(curY - startY)) {
2436                        if (Math.abs(curX - startX) > defaults.swipeDistance)
2437                            if (curX > startX) {
2438                                if (defaults.swipeRight)
2439                                    defaults.swipeRight.call()
2440                            } else if (defaults.swipeLeft)
2441                                defaults.swipeLeft.call()
2442                    } else if (Math.abs(curY - startY) > defaults.swipeDistance)
2443                        if (curY > startY) {
2444                            if (defaults.swipeBottom)
2445                                defaults.swipeBottom.call()
2446                        } else if (defaults.swipeTop)
2447                            defaults.swipeTop.call()
2448                }
2449                try {
2450                    $(this).on("touchstart", touchStart);
2451                    $(this).on("touchmove", touchMove);
2452                    $(this).on("touchend",
2453                            touchEnd);
2454                    $(this).on("touchcancel", touchCancel)
2455                } catch (e) {
2456                }
2457            })
2458        }
2459    })(jQuery);
2460    (function($) {
2461        $.fn.lightboxHTML5VideoControls = function(skinFolder, parentInst, hidecontrols, hideplaybutton, defaultvolume) {
2462            var isTouch = "ontouchstart" in window;
2463            var eStart = isTouch ? "touchstart" : "mousedown";
2464            var eMove = isTouch ? "touchmove" : "mousemove";
2465            var eCancel = isTouch ? "touchcancel" : "mouseup";
2466            var eClick = "click";
2467            var BUTTON_SIZE = 32;
2468            var BAR_HEIGHT = isTouch ? 48 : 36;
2469            var hideControlsTimerId = null;
2470            var hideVolumeBarTimeoutId = null;
2471            var sliderDragging =
2472                    false;
2473            var isFullscreen = false;
2474            var userActive = true;
2475            var isIPhone = navigator.userAgent.match(/iPod/i) != null || navigator.userAgent.match(/iPhone/i) != null;
2476            var isHd = $(this).data("ishd");
2477            var hd = $(this).data("hd");
2478            var src = $(this).data("src");
2479            var $videoObj = $(this);
2480            $videoObj.get(0).removeAttribute("controls");
2481            if (isIPhone) {
2482                var h = $videoObj.height() - BAR_HEIGHT;
2483                $videoObj.css({
2484                    height: h
2485                })
2486            }
2487            var $videoPlay = $("<div class='html5boxVideoPlay'></div>");
2488            if (!isIPhone) {
2489                $videoObj.after($videoPlay);
2490                $videoPlay.css({
2491                    position: "absolute",
2492                    top: "50%",
2493                    left: "50%",
2494                    display: "block",
2495                    cursor: "pointer",
2496                    width: 64,
2497                    height: 64,
2498                    "margin-left": -32,
2499                    "margin-top": -32,
2500                    "background-image": "url('" + skinFolder + "html5boxplayer_playvideo.png" + "')",
2501                    "background-position": "center center",
2502                    "background-repeat": "no-repeat"
2503                }).on(eClick, function() {
2504                    $videoObj.get(0).play()
2505                })
2506            }
2507            var $videoFullscreenBg = $("<div class='html5boxVideoFullscreenBg'></div>");
2508            var $videoControls = $("<div class='html5boxVideoControls'>" + "<div class='html5boxVideoControlsBg'></div>" + "<div class='html5boxPlayPause'>" +
2509                    "<div class='html5boxPlay'></div>" + "<div class='html5boxPause'></div>" + "</div>" + "<div class='html5boxTimeCurrent'>--:--</div>" + "<div class='html5boxFullscreen'></div>" + "<div class='html5boxHD'></div>" + "<div class='html5boxVolume'>" + "<div class='html5boxVolumeButton'></div>" + "<div class='html5boxVolumeBar'>" + "<div class='html5boxVolumeBarBg'>" + "<div class='html5boxVolumeBarActive'></div>" + "</div>" + "</div>" + "</div>" + "<div class='html5boxTimeTotal'>--:--</div>" + "<div class='html5boxSeeker'>" + "<div class='html5boxSeekerBuffer'></div>" +
2510                    "<div class='html5boxSeekerPlay'></div>" + "<div class='html5boxSeekerHandler'></div>" + "</div>" + "<div style='clear:both;'></div>" + "</div>");
2511            $videoObj.after($videoControls);
2512            $videoObj.after($videoFullscreenBg);
2513            $videoFullscreenBg.css({
2514                display: "none",
2515                position: "fixed",
2516                left: 0,
2517                top: 0,
2518                bottom: 0,
2519                right: 0,
2520                "z-index": 2147483647
2521            });
2522            $videoControls.css({
2523                display: "block",
2524                position: "absolute",
2525                width: "100%",
2526                height: BAR_HEIGHT,
2527                left: 0,
2528                bottom: 0,
2529                right: 0,
2530                "max-width": "640px",
2531                margin: "0 auto"
2532            });
2533            var userActivate = function() {
2534                userActive =
2535                        true
2536            };
2537            $videoObj.on(eClick, function() {
2538                userActive = true
2539            }).hover(function() {
2540                userActive = true
2541            }, function() {
2542                userActive = false
2543            });
2544            if (!hidecontrols)
2545                setInterval(function() {
2546                    if (userActive) {
2547                        $videoControls.show();
2548                        userActive = false;
2549                        clearTimeout(hideControlsTimerId);
2550                        hideControlsTimerId = setTimeout(function() {
2551                            if (!$videoObj.get(0).paused)
2552                                $videoControls.fadeOut()
2553                        }, 5E3)
2554                    }
2555                }, 250);
2556            $(".html5boxVideoControlsBg", $videoControls).css({
2557                display: "block",
2558                position: "absolute",
2559                width: "100%",
2560                height: "100%",
2561                left: 0,
2562                top: 0,
2563                "background-color": "#000000",
2564                opacity: 0.7,
2565                filter: "alpha(opacity=70)"
2566            });
2567            $(".html5boxPlayPause", $videoControls).css({
2568                display: "block",
2569                position: "relative",
2570                width: BUTTON_SIZE + "px",
2571                height: BUTTON_SIZE + "px",
2572                margin: Math.floor((BAR_HEIGHT - BUTTON_SIZE) / 2),
2573                "float": "left"
2574            });
2575            var $videoBtnPlay = $(".html5boxPlay", $videoControls);
2576            var $videoBtnPause = $(".html5boxPause", $videoControls);
2577            $videoBtnPlay.css({
2578                display: "block",
2579                position: "absolute",
2580                top: 0,
2581                left: 0,
2582                width: BUTTON_SIZE + "px",
2583                height: BUTTON_SIZE + "px",
2584                cursor: "pointer",
2585                "background-image": "url('" + skinFolder +
2586                        "html5boxplayer_playpause.png" + "')",
2587                "background-position": "top left"
2588            }).hover(function() {
2589                $(this).css({
2590                    "background-position": "bottom left"
2591                })
2592            }, function() {
2593                $(this).css({
2594                    "background-position": "top left"
2595                })
2596            }).on(eClick, function() {
2597                $videoObj.get(0).play()
2598            });
2599            $videoBtnPause.css({
2600                display: "none",
2601                position: "absolute",
2602                top: 0,
2603                left: 0,
2604                width: BUTTON_SIZE + "px",
2605                height: BUTTON_SIZE + "px",
2606                cursor: "pointer",
2607                "background-image": "url('" + skinFolder + "html5boxplayer_playpause.png" + "')",
2608                "background-position": "top right"
2609            }).hover(function() {
2610                $(this).css({
2611                    "background-position": "bottom right"
2612                })
2613            },
2614                    function() {
2615                        $(this).css({
2616                            "background-position": "top right"
2617                        })
2618                    }).on(eClick, function() {
2619                $videoObj.get(0).pause()
2620            });
2621            var $videoTimeCurrent = $(".html5boxTimeCurrent", $videoControls);
2622            var $videoTimeTotal = $(".html5boxTimeTotal", $videoControls);
2623            var $videoSeeker = $(".html5boxSeeker", $videoControls);
2624            var $videoSeekerPlay = $(".html5boxSeekerPlay", $videoControls);
2625            var $videoSeekerBuffer = $(".html5boxSeekerBuffer", $videoControls);
2626            var $videoSeekerHandler = $(".html5boxSeekerHandler", $videoControls);
2627            $videoTimeCurrent.css({
2628                display: "block",
2629                position: "relative",
2630                "float": "left",
2631                "line-height": BAR_HEIGHT + "px",
2632                "font-weight": "normal",
2633                "font-size": "12px",
2634                margin: "0 8px",
2635                "font-family": "Arial, Helvetica, sans-serif",
2636                color: "#fff"
2637            });
2638            $videoTimeTotal.css({
2639                display: "block",
2640                position: "relative",
2641                "float": "right",
2642                "line-height": BAR_HEIGHT + "px",
2643                "font-weight": "normal",
2644                "font-size": "12px",
2645                margin: "0 8px",
2646                "font-family": "Arial, Helvetica, sans-serif",
2647                color: "#fff"
2648            });
2649            $videoSeeker.css({
2650                display: "block",
2651                cursor: "pointer",
2652                overflow: "hidden",
2653                position: "relative",
2654                height: "10px",
2655                "background-color": "#222",
2656                margin: Math.floor((BAR_HEIGHT - 10) / 2) + "px 4px"
2657            }).on(eStart, function(e) {
2658                var e0 = isTouch ? e.originalEvent.touches[0] : e;
2659                var pos = e0.pageX - $videoSeeker.offset().left;
2660                $videoSeekerPlay.css({
2661                    width: pos
2662                });
2663                $videoObj.get(0).currentTime = pos * $videoObj.get(0).duration / $videoSeeker.width();
2664                $videoSeeker.on(eMove, function(e) {
2665                    var e0 = isTouch ? e.originalEvent.touches[0] : e;
2666                    var pos = e0.pageX - $videoSeeker.offset().left;
2667                    $videoSeekerPlay.css({
2668                        width: pos
2669                    });
2670                    $videoObj.get(0).currentTime = pos * $videoObj.get(0).duration /
2671                            $videoSeeker.width()
2672                })
2673            }).on(eCancel, function() {
2674                $videoSeeker.off(eMove)
2675            });
2676            $videoSeekerBuffer.css({
2677                display: "block",
2678                position: "absolute",
2679                left: 0,
2680                top: 0,
2681                height: "100%",
2682                "background-color": "#444"
2683            });
2684            $videoSeekerPlay.css({
2685                display: "block",
2686                position: "absolute",
2687                left: 0,
2688                top: 0,
2689                height: "100%",
2690                "background-color": "#fcc500"
2691            });
2692            if (!isIPhone && ($videoObj.get(0).requestFullscreen || $videoObj.get(0).webkitRequestFullScreen || $videoObj.get(0).mozRequestFullScreen || $videoObj.get(0).webkitEnterFullScreen || $videoObj.get(0).msRequestFullscreen)) {
2693                var switchScreen =
2694                        function(fullscreen) {
2695                            if (fullscreen) {
2696                                var isIE11 = navigator.userAgent.match(/Trident\/7/) != null && navigator.userAgent.match(/rv:11/) != null;
2697                                var isIE = navigator.userAgent.match(/MSIE/i) != null && !this.options.isOpera;
2698                                if (isIE11 || isIE)
2699                                    $videoObj.get(0).setAttribute("controls", "controls");
2700                                if ($videoObj.get(0).requestFullscreen)
2701                                    $videoObj.get(0).requestFullscreen();
2702                                else if ($videoObj.get(0).webkitRequestFullScreen)
2703                                    $videoObj.get(0).webkitRequestFullScreen();
2704                                else if ($videoObj.get(0).mozRequestFullScreen)
2705                                    $videoObj.get(0).mozRequestFullScreen();
2706                                else if ($videoObj.get(0).webkitEnterFullScreen)
2707                                    $videoObj.get(0).webkitEnterFullScreen();
2708                                if ($videoObj.get(0).msRequestFullscreen)
2709                                    $videoObj.get(0).msRequestFullscreen()
2710                            } else if (document.cancelFullScreen)
2711                                document.cancelFullScreen();
2712                            else if (document.mozCancelFullScreen)
2713                                document.mozCancelFullScreen();
2714                            else if (document.webkitCancelFullScreen)
2715                                document.webkitCancelFullScreen();
2716                            else if (document.webkitExitFullscreen)
2717                                document.webkitExitFullscreen();
2718                            else if (document.msExitFullscreen)
2719                                document.msExitFullscreen()
2720                        };
2721                var switchScreenCSS = function(fullscreen) {
2722                    $videoControls.css({
2723                        position: fullscreen ? "fixed" : "absolute"
2724                    });
2725                    var backgroundPosY = $videoFullscreen.css("background-position") ? $videoFullscreen.css("background-position").split(" ")[1] : $videoFullscreen.css("background-position-y");
2726                    $videoFullscreen.css({
2727                        "background-position": (fullscreen ? "right" : "left") + " " + backgroundPosY
2728                    });
2729                    $videoFullscreenBg.css({
2730                        display: fullscreen ? "block" : "none"
2731                    });
2732                    if (fullscreen) {
2733                        $(document).on("mousemove", userActivate);
2734                        $videoControls.css({
2735                            "z-index": 2147483647
2736                        })
2737                    } else {
2738                        $(document).off("mousemove",
2739                                userActivate);
2740                        $videoControls.css({
2741                            "z-index": ""
2742                        })
2743                    }
2744                };
2745                document.addEventListener("MSFullscreenChange", function() {
2746                    isFullscreen = document.msFullscreenElement != null;
2747                    var isIE11 = navigator.userAgent.match(/Trident\/7/) != null && navigator.userAgent.match(/rv:11/) != null;
2748                    var isIE = navigator.userAgent.match(/MSIE/i) != null && !this.options.isOpera;
2749                    if (isIE11 || isIE)
2750                        if (!isFullscreen)
2751                            $videoObj.get(0).removeAttribute("controls");
2752                    switchScreenCSS(isFullscreen)
2753                }, false);
2754                document.addEventListener("fullscreenchange", function() {
2755                    isFullscreen =
2756                            document.fullscreen;
2757                    switchScreenCSS(document.fullscreen)
2758                }, false);
2759                document.addEventListener("mozfullscreenchange", function() {
2760                    isFullscreen = document.mozFullScreen;
2761                    if (navigator.userAgent.match(/Firefox/i) != null)
2762                        if (isFullscreen)
2763                            $videoObj.get(0).setAttribute("controls", "controls");
2764                        else
2765                            $videoObj.get(0).removeAttribute("controls");
2766                    switchScreenCSS(document.mozFullScreen)
2767                }, false);
2768                document.addEventListener("webkitfullscreenchange", function() {
2769                    isFullscreen = document.webkitIsFullScreen;
2770                    if (navigator.userAgent.match(/Android/i) !=
2771                            null)
2772                        if (isFullscreen)
2773                            $videoObj.get(0).setAttribute("controls", "controls");
2774                        else {
2775                            $videoObj.get(0).removeAttribute("controls");
2776                            switchScreenCSS(document.webkitIsFullScreen)
2777                        }
2778                    else
2779                        switchScreenCSS(document.webkitIsFullScreen)
2780                }, false);
2781                $videoObj.get(0).addEventListener("webkitbeginfullscreen", function() {
2782                    isFullscreen = true
2783                }, false);
2784                $videoObj.get(0).addEventListener("webkitendfullscreen", function() {
2785                    isFullscreen = false
2786                }, false);
2787                if (navigator.userAgent.match(/Android/i) == null)
2788                    $("head").append("<style type='text/css'>video::-webkit-media-controls { display:none !important; }</style>");
2789                var $videoFullscreen = $(".html5boxFullscreen", $videoControls);
2790                $videoFullscreen.css({
2791                    display: "block",
2792                    position: "relative",
2793                    "float": "right",
2794                    width: BUTTON_SIZE + "px",
2795                    height: BUTTON_SIZE + "px",
2796                    margin: Math.floor((BAR_HEIGHT - BUTTON_SIZE) / 2),
2797                    cursor: "pointer",
2798                    "background-image": "url('" + skinFolder + "html5boxplayer_fullscreen.png" + "')",
2799                    "background-position": "left top"
2800                }).hover(function() {
2801                    var backgroundPosX = $(this).css("background-position") ? $(this).css("background-position").split(" ")[0] : $(this).css("background-position-x");
2802                    $(this).css({
2803                        "background-position": backgroundPosX + " bottom"
2804                    })
2805                }, function() {
2806                    var backgroundPosX = $(this).css("background-position") ? $(this).css("background-position").split(" ")[0] : $(this).css("background-position-x");
2807                    $(this).css({
2808                        "background-position": backgroundPosX + " top"
2809                    })
2810                }).on(eClick, function() {
2811                    isFullscreen = !isFullscreen;
2812                    switchScreen(isFullscreen)
2813                })
2814            }
2815            if (hd) {
2816                var $videoHD = $(".html5boxHD", $videoControls);
2817                $videoHD.css({
2818                    display: "block",
2819                    position: "relative",
2820                    "float": "right",
2821                    width: BUTTON_SIZE + "px",
2822                    height: BUTTON_SIZE +
2823                            "px",
2824                    margin: Math.floor((BAR_HEIGHT - BUTTON_SIZE) / 2),
2825                    cursor: "pointer",
2826                    "background-image": "url('" + skinFolder + "html5boxplayer_hd.png" + "')",
2827                    "background-position": (isHd ? "right" : "left") + " center"
2828                }).on(eClick, function() {
2829                    isHd = !isHd;
2830                    $(this).css({
2831                        "background-position": (isHd ? "right" : "left") + " center"
2832                    });
2833                    parentInst.isHd = isHd;
2834                    var isPaused = $videoObj.get(0).isPaused;
2835                    $videoObj.get(0).setAttribute("src", (isHd ? hd : src) + "#t=" + $videoObj.get(0).currentTime);
2836                    if (!isPaused)
2837                        $videoObj.get(0).play();
2838                    else if (!isIPhone)
2839                        $videoObj.get(0).pause()
2840                })
2841            }
2842            $videoObj.get(0).volume =
2843                    defaultvolume;
2844            var volumeSaved = defaultvolume == 0 ? 1 : defaultvolume;
2845            var volume = $videoObj.get(0).volume;
2846            $videoObj.get(0).volume = volume / 2 + 0.1;
2847            if ($videoObj.get(0).volume === volume / 2 + 0.1) {
2848                $videoObj.get(0).volume = volume;
2849                var $videoVolume = $(".html5boxVolume", $videoControls);
2850                var $videoVolumeButton = $(".html5boxVolumeButton", $videoControls);
2851                var $videoVolumeBar = $(".html5boxVolumeBar", $videoControls);
2852                var $videoVolumeBarBg = $(".html5boxVolumeBarBg", $videoControls);
2853                var $videoVolumeBarActive = $(".html5boxVolumeBarActive",
2854                        $videoControls);
2855                $videoVolume.css({
2856                    display: "block",
2857                    position: "relative",
2858                    "float": "right",
2859                    width: BUTTON_SIZE + "px",
2860                    height: BUTTON_SIZE + "px",
2861                    margin: Math.floor((BAR_HEIGHT - BUTTON_SIZE) / 2)
2862                }).hover(function() {
2863                    clearTimeout(hideVolumeBarTimeoutId);
2864                    var volume = $videoObj.get(0).volume;
2865                    $videoVolumeBarActive.css({
2866                        height: Math.round(volume * 100) + "%"
2867                    });
2868                    $videoVolumeBar.show()
2869                }, function() {
2870                    clearTimeout(hideVolumeBarTimeoutId);
2871                    hideVolumeBarTimeoutId = setTimeout(function() {
2872                        $videoVolumeBar.hide()
2873                    }, 1E3)
2874                });
2875                $videoVolumeButton.css({
2876                    display: "block",
2877                    position: "absolute",
2878                    top: 0,
2879                    left: 0,
2880                    width: BUTTON_SIZE + "px",
2881                    height: BUTTON_SIZE + "px",
2882                    cursor: "pointer",
2883                    "background-image": "url('" + skinFolder + "html5boxplayer_volume.png" + "')",
2884                    "background-position": "top " + (volume > 0 ? "left" : "right")
2885                }).hover(function() {
2886                    var backgroundPosX = $(this).css("background-position") ? $(this).css("background-position").split(" ")[0] : $(this).css("background-position-x");
2887                    $(this).css({
2888                        "background-position": backgroundPosX + " bottom"
2889                    })
2890                }, function() {
2891                    var backgroundPosX = $(this).css("background-position") ?
2892                            $(this).css("background-position").split(" ")[0] : $(this).css("background-position-x");
2893                    $(this).css({
2894                        "background-position": backgroundPosX + " top"
2895                    })
2896                }).on(eClick, function() {
2897                    var volume = $videoObj.get(0).volume;
2898                    if (volume > 0) {
2899                        volumeSaved = volume;
2900                        volume = 0
2901                    } else
2902                        volume = volumeSaved;
2903                    var backgroundPosY = $(this).css("background-position") ? $(this).css("background-position").split(" ")[1] : $(this).css("background-position-y");
2904                    $videoVolumeButton.css({
2905                        "background-position": (volume > 0 ? "left" : "right") + " " + backgroundPosY
2906                    });
2907                    $videoObj.get(0).volume = volume;
2908                    $videoVolumeBarActive.css({
2909                        height: Math.round(volume * 100) + "%"
2910                    })
2911                });
2912                $videoVolumeBar.css({
2913                    display: "none",
2914                    position: "absolute",
2915                    left: 4,
2916                    bottom: "100%",
2917                    width: 24,
2918                    height: 80,
2919                    "margin-bottom": Math.floor((BAR_HEIGHT - BUTTON_SIZE) / 2),
2920                    "background-color": "#000000",
2921                    opacity: 0.7,
2922                    filter: "alpha(opacity=70)"
2923                });
2924                $videoVolumeBarBg.css({
2925                    display: "block",
2926                    position: "relative",
2927                    width: 10,
2928                    height: 68,
2929                    margin: 7,
2930                    cursor: "pointer",
2931                    "background-color": "#222"
2932                });
2933                $videoVolumeBarActive.css({
2934                    display: "block",
2935                    position: "absolute",
2936                    bottom: 0,
2937                    left: 0,
2938                    width: "100%",
2939                    height: "100%",
2940                    "background-color": "#fcc500"
2941                });
2942                $videoVolumeBarBg.on(eStart, function(e) {
2943                    var e0 = isTouch ? e.originalEvent.touches[0] : e;
2944                    var vol = 1 - (e0.pageY - $videoVolumeBarBg.offset().top) / $videoVolumeBarBg.height();
2945                    vol = vol > 1 ? 1 : vol < 0 ? 0 : vol;
2946                    $videoVolumeBarActive.css({
2947                        height: Math.round(vol * 100) + "%"
2948                    });
2949                    $videoVolumeButton.css({
2950                        "background-position": "left " + (vol > 0 ? "top" : "bottom")
2951                    });
2952                    $videoObj.get(0).volume = vol;
2953                    $videoVolumeBarBg.on(eMove, function(e) {
2954                        var e0 = isTouch ? e.originalEvent.touches[0] :
2955                                e;
2956                        var vol = 1 - (e0.pageY - $videoVolumeBarBg.offset().top) / $videoVolumeBarBg.height();
2957                        vol = vol > 1 ? 1 : vol < 0 ? 0 : vol;
2958                        $videoVolumeBarActive.css({
2959                            height: Math.round(vol * 100) + "%"
2960                        });
2961                        $videoVolumeButton.css({
2962                            "background-position": "left " + (vol > 0 ? "top" : "bottom")
2963                        });
2964                        $videoObj.get(0).volume = vol
2965                    })
2966                }).on(eCancel, function() {
2967                    $videoVolumeBarBg.off(eMove)
2968                })
2969            }
2970            var calcTimeFormat = function(seconds) {
2971                var h0 = Math.floor(seconds / 3600);
2972                var h = h0 < 10 ? "0" + h0 : h0;
2973                var m0 = Math.floor((seconds - h0 * 3600) / 60);
2974                var m = m0 < 10 ? "0" + m0 : m0;
2975                var s0 = Math.floor(seconds -
2976                        (h0 * 3600 + m0 * 60));
2977                var s = s0 < 10 ? "0" + s0 : s0;
2978                var r = m + ":" + s;
2979                if (h0 > 0)
2980                    r = h + ":" + r;
2981                return r
2982            };
2983            if (hideplaybutton)
2984                $videoPlay.hide();
2985            if (hidecontrols)
2986                $videoControls.hide();
2987            var onVideoPlay = function() {
2988                if (!hideplaybutton)
2989                    $videoPlay.hide();
2990                if (!hidecontrols) {
2991                    $videoBtnPlay.hide();
2992                    $videoBtnPause.show()
2993                }
2994            };
2995            var onVideoPause = function() {
2996                if (!hideplaybutton)
2997                    $videoPlay.show();
2998                if (!hidecontrols) {
2999                    $videoControls.show();
3000                    clearTimeout(hideControlsTimerId);
3001                    $videoBtnPlay.show();
3002                    $videoBtnPause.hide()
3003                }
3004            };
3005            var onVideoEnded = function() {
3006                $(window).trigger("html5lightbox.videoended");
3007                if (!hideplaybutton)
3008                    $videoPlay.show();
3009                if (!hidecontrols) {
3010                    $videoControls.show();
3011                    clearTimeout(hideControlsTimerId);
3012                    $videoBtnPlay.show();
3013                    $videoBtnPause.hide()
3014                }
3015            };
3016            var onVideoUpdate = function() {
3017                var curTime = $videoObj.get(0).currentTime;
3018                if (curTime) {
3019                    $videoTimeCurrent.text(calcTimeFormat(curTime));
3020                    var duration = $videoObj.get(0).duration;
3021                    if (duration) {
3022                        $videoTimeTotal.text(calcTimeFormat(duration));
3023                        if (!sliderDragging) {
3024                            var sliderW = $videoSeeker.width();
3025                            var pos = Math.round(sliderW * curTime / duration);
3026                            $videoSeekerPlay.css({
3027                                width: pos
3028                            });
3029                            $videoSeekerHandler.css({
3030                                left: pos
3031                            })
3032                        }
3033                    }
3034                }
3035            };
3036            var onVideoProgress = function() {
3037                if ($videoObj.get(0).buffered && $videoObj.get(0).buffered.length > 0 && !isNaN($videoObj.get(0).buffered.end(0)) && !isNaN($videoObj.get(0).duration)) {
3038                    var sliderW = $videoSeeker.width();
3039                    $videoSeekerBuffer.css({
3040                        width: Math.round(sliderW * $videoObj.get(0).buffered.end(0) / $videoObj.get(0).duration)
3041                    })
3042                }
3043            };
3044            try {
3045                $videoObj.on("play", onVideoPlay);
3046                $videoObj.on("pause", onVideoPause);
3047                $videoObj.on("ended", onVideoEnded);
3048                $videoObj.on("timeupdate", onVideoUpdate);
3049                $videoObj.on("progress", onVideoProgress)
3050            } catch (e) {
3051            }
3052        }
3053    })(jQuery);
3054    jQuery(document).ready(function() {
3055        if (typeof wonderpluginLightbox === "undefined") {
3056            jQuery(".wonderplugin-engine").css({
3057                display: "none"
3058            });
3059            wonderpluginLightbox = jQuery(".wplightbox").wonderpluginlightbox()
3060        }
3061    })
3062}
3063;

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.