PageSourceSearch

https://www.max-joseph-schule.de/templates/maxjosephschule/js/html5lightbox/html5lightbox.js?f992c2

js max-joseph-schule.de collected 2026-10-06 19:10:39 UTC 153,742 bytes, 2,853 lines download raw bytes

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

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.