PageSourceSearch

https://www.fussball-em-2024.de/wp-content/plugins/lightbox/js/frontend/lightbox.js?ver=1.0

js fussball-em-2024.de collected 2026-10-02 22:03:30 UTC 108,084 bytes, 2,471 lines download raw bytes

1(function ($) {
2
3    'use strict';
4
5    jQuery.each(hugeit_gen_resp_lightbox_obj, function (index, value) {
6        if (value.indexOf('true') > -1 || value.indexOf('false') > -1)
7            hugeit_gen_resp_lightbox_obj[index] = value == "true";
8    });
9
10    function Lightbox(element, options) {
11
12        this.el = element;
13        this.$element = $(element);
14        this.$body = $('body');
15        this.objects = {};
16        this.lightboxModul = {};
17        this.$item = '';
18        this.$cont = '';
19        this.$items = this.$body.find('a.responsove_lightbox');
20
21        this.settings = $.extend({}, this.constructor.defaults, options);
22
23        this.init();
24
25        return this;
26    }
27
28    Lightbox.defaults = {
29        idPrefix: 'rwd-',
30        classPrefix: 'rwd-',
31        attrPrefix: 'data-',
32        slideAnimationType: hugeit_gen_resp_lightbox_obj.hugeit_lightbox_slideAnimationType, /*  effect_1   effect_2    effect_3
33         effect_4   effect_5    effect_6
34         effect_7   effect_8    effect_9   */
35        lightboxView: hugeit_resp_lightbox_obj.hugeit_lightbox_lightboxView,              //  view1, view2, view3, view4, view5, view6
36        speed: hugeit_resp_lightbox_obj.hugeit_lightbox_speed_new,
37        width: hugeit_resp_lightbox_obj.hugeit_lightbox_width_new + '%',
38        height: hugeit_resp_lightbox_obj.hugeit_lightbox_height_new + '%',
39        videoMaxWidth: hugeit_resp_lightbox_obj.hugeit_lightbox_videoMaxWidth,
40        sizeFix: true, //not for option
41        overlayDuration: +hugeit_gen_resp_lightbox_obj.hugeit_lightbox_overlayDuration,
42        slideAnimation: true, //not for option
43        overlayClose: hugeit_resp_lightbox_obj.hugeit_lightbox_overlayClose_new,
44        loop: hugeit_resp_lightbox_obj.hugeit_lightbox_loop_new,
45        escKey: hugeit_gen_resp_lightbox_obj.hugeit_lightbox_escKey_new,
46        keyPress: hugeit_gen_resp_lightbox_obj.hugeit_lightbox_keyPress_new,
47        arrows: hugeit_gen_resp_lightbox_obj.hugeit_lightbox_arrows,
48        mouseWheel: hugeit_gen_resp_lightbox_obj.hugeit_lightbox_mouseWheel,
49        download: hugeit_gen_resp_lightbox_obj.hugeit_lightbox_download,
50        showTitle: hugeit_resp_lightbox_obj.hugeit_lightbox_showTitle === 'true',
51        showDesc: hugeit_resp_lightbox_obj.hugeit_lightbox_showDesc === 'true',
52        showBorder: hugeit_resp_lightbox_obj.hugeit_lightbox_showBorder === 'true',
53        showCounter: hugeit_gen_resp_lightbox_obj.hugeit_lightbox_showCounter,
54        defaultTitle: '',  //some text
55        preload: 10,  //not for option
56        showAfterLoad: true,  //not for option
57        nextHtml: '',  //not for option
58        prevHtml: '',  //not for option
59        sequence_info: hugeit_gen_resp_lightbox_obj.hugeit_lightbox_sequence_info,
60        sequenceInfo: hugeit_gen_resp_lightbox_obj.hugeit_lightbox_sequenceInfo,
61        slideshow: hugeit_gen_resp_lightbox_obj.hugeit_lightbox_slideshow_new,
62        slideshowAuto: hugeit_gen_resp_lightbox_obj.hugeit_lightbox_slideshow_auto_new,
63        slideshowSpeed: hugeit_gen_resp_lightbox_obj.hugeit_lightbox_slideshow_speed_new,
64        slideshowStart: '',  //not for option
65        slideshowStop: '',   //not for option
66        hideControlOnEnd: false,  //not for option
67        watermark: hugeit_gen_resp_lightbox_obj.hugeit_lightbox_watermark,
68        socialSharing: hugeit_gen_resp_lightbox_obj.hugeit_lightbox_socialSharing,
69        titlePos: hugeit_resp_lightbox_obj.hugeit_lightbox_title_pos,
70        fullwidth: hugeit_resp_lightbox_obj.hugeit_lightbox_fullwidth_effect === 'true',
71        zoomLogo: hugeit_resp_lightbox_obj.hugeit_lightbox_zoomlogo,
72        wURL: hugeit_resp_lightbox_obj.hugeit_lightbox_watermark_link,
73        watermarkURL: hugeit_resp_lightbox_obj.hugeit_lightbox_watermark_url,
74        wURLnewTab: hugeit_resp_lightbox_obj.hugeit_lightbox_watermark_url_new_tab,
75        share: {
76            facebookButton: hugeit_gen_resp_lightbox_obj.hugeit_lightbox_facebookButton,
77            twitterButton: hugeit_gen_resp_lightbox_obj.hugeit_lightbox_twitterButton,
78            googleplusButton: hugeit_gen_resp_lightbox_obj.hugeit_lightbox_googleplusButton,
79            pinterestButton: hugeit_gen_resp_lightbox_obj.hugeit_lightbox_pinterestButton,
80            linkedinButton: hugeit_gen_resp_lightbox_obj.hugeit_lightbox_linkedinButton,
81            tumblrButton: hugeit_gen_resp_lightbox_obj.hugeit_lightbox_tumblrButton,
82            redditButton: hugeit_gen_resp_lightbox_obj.hugeit_lightbox_redditButton,
83            bufferButton: hugeit_gen_resp_lightbox_obj.hugeit_lightbox_bufferButton,
84            diggButton: hugeit_gen_resp_lightbox_obj.hugeit_lightbox_diggButton,
85            vkButton: hugeit_gen_resp_lightbox_obj.hugeit_lightbox_vkButton,
86            yummlyButton: hugeit_gen_resp_lightbox_obj.hugeit_lightbox_yummlyButton
87        }
88    };
89
90    Lightbox.prototype.init = function () {
91
92        var $object = this,
93            $hash;
94
95        $hash = window.location.hash;
96
97        ($object.settings.watermark && $('.watermark').watermark());
98
99        if ($hash.indexOf('lightbox&') > 0) {
100            $object.index = parseInt($hash.split('&slide=')[1], 10) - 1;
101
102            $object.$body.addClass('rwd-share');
103            if (!$object.$body.hasClass('rwd-on')) {
104                setTimeout(function () {
105                    $object.build($object.index);
106                }, 900);
107                $object.$body.addClass('rwd-on');
108            }
109        }
110
111        (($object.settings.preload > $object.$items.length) && ($object.settings.preload = $object.$items.length));
112
113        $object.$items.on('click.rwdcustom', function (event) {
114
115            event = event || window.event;
116            event.preventDefault ? event.preventDefault() : (event.returnValue = false);
117
118            $object.index = $object.$items.index(this);
119
120            if (!$object.$body.hasClass($object.settings.classPrefix + 'on')) {
121                $object.build($object.index);
122                $object.$body.addClass($object.settings.classPrefix + 'on');
123            }
124
125        });
126
127        $object.$body.on('click', function () {
128            $object.$_y_ = window.pageYOffset;
129        });
130
131        switch (this.settings.zoomLogo) {
132            case '1':
133                $object.$body.addClass('rwd-zoomGlass');
134                break;
135            case '2':
136                $object.$body.addClass('rwd-zoomHand');
137                break;
138        }
139
140    };
141
142    Lightbox.prototype.build = function (index) {
143
144        var $object = this;
145
146        $object.structure();
147
148        $object.lightboxModul['modul'] = new $.fn.lightbox.lightboxModul['modul']($object.el);
149
150        $object.slide(index, false, false);
151
152        ($object.settings.keyPress && $object.addKeyEvents());
153
154        if ($object.$items.length > 1) {
155
156            $object.arrow();
157
158            ($object.settings.mouseWheel && $object.mousewheel());
159
160            ($object.settings.slideshow && $object.slideShow());
161
162        }
163
164        $object.counter();
165
166        $object.closeGallery();
167
168        $object.$cont.on('click.rwd-container', function () {
169
170            $object.$cont.removeClass($object.settings.classPrefix + 'hide-items');
171
172        });
173
174        $('.shareLook').on('click.rwd-container', function () {
175            $(this).css({'display': 'none'});
176            $('.rwd-share-buttons').css({'display': 'block'});
177            setTimeout(function(){
178                $('.shareLook').css({'display' : 'block'});
179                $('.rwd-share-buttons').css({'display' : 'none'});
180            }, 9000);
181        });
182
183        $object.calculateDimensions();
184    };
185
186    Lightbox.prototype.structure = function () {
187
188        var $object = this, list = '', controls = '', i,
189            subHtmlCont1 = '', subHtmlCont2 = '', subHtmlCont3 = '',
190            close1 = '', close2 = '', socialIcons = '',
191            template, $arrows, $next, $prev,
192            $_next, $_prev, $close_bg, $download_bg, $download_bg_, $contInner, $view;
193
194        $view = (this.settings.lightboxView === 'view6') ? 'rwd-view6' : '';
195
196        this.$body.append(
197            this.objects.overlay = $('<div class="' + this.settings.classPrefix + 'overlay ' + $view + '"></div>')
198        );
199        this.objects.overlay.css('transition-duration', this.settings.overlayDuration + 'ms');
200
201        var $wURL = '',
202            $target = '';
203
204        if($object.settings.watermark && $object.settings.wURL && hugeit_resp_lightbox_obj.hugeit_lightbox_watermark_text){
205            if($object.settings.wURLnewTab){
206                $target = 'target="_blank"';
207            }
208            $wURL = '<a href="' + $object.settings.watermarkURL + '" class="w_url" ' + $target + '></a>';
209        }
210
211        for (i = 0; i < this.$items.length; i++) {
212            list += '<div class="' + this.settings.classPrefix + 'item">' + $wURL + '</div>';
213        }
214
215        $close_bg = '<svg class="close_bg" width="16px" height="16px" fill="#999" viewBox="-341 343.4 15.6 15.6">' +
216            '<path d="M-332.1,351.2l6.5-6.5c0.3-0.3,0.3-0.8,0-1.1s-0.8-0.3-1.1,0l-6.5,6.5l-6.5-6.5c-0.3-0.3-0.8-0.3-1.1,0s-0.3,0.8,0,1.1l6.5,6.5l-6.5,6.5c-0.3,0.3-0.3,0.8,0,1.1c0.1,0.1,0.3,0.2,0.5,0.2s0.4-0.1,0.5-0.2l6.5-6.5l6.5,6.5c0.1,0.1,0.3,0.2,0.5,0.2s0.4-0.1,0.5-0.2c0.3-0.3,0.3-0.8,0-1.1L-332.1,351.2z"/>' +
217            '</svg>';
218
219        switch (this.settings.lightboxView) {
220            case 'view1':
221            default:
222                $_next = '<svg class="next_bg" width="22px" height="22px" fill="#999" viewBox="-333 335.5 31.5 31.5" >' +
223                    '<path d="M-311.8,340.5c-0.4-0.4-1.1-0.4-1.6,0c-0.4,0.4-0.4,1.1,0,1.6l8,8h-26.6c-0.6,0-1.1,0.5-1.1,1.1s0.5,1.1,1.1,1.1h26.6l-8,8c-0.4,0.4-0.4,1.2,0,1.6c0.4,0.4,1.2,0.4,1.6,0l10-10c0.4-0.4,0.4-1.1,0-1.6L-311.8,340.5z"/>' +
224                    '</svg>';
225                $_prev = '<svg class="prev_bg" width="22px" height="22px" fill="#999" viewBox="-333 335.5 31.5 31.5" >' +
226                    '<path d="M-322.7,340.5c0.4-0.4,1.1-0.4,1.6,0c0.4,0.4,0.4,1.1,0,1.6l-8,8h26.6c0.6,0,1.1,0.5,1.1,1.1c0,0.6-0.5,1.1-1.1,1.1h-26.6l8,8c0.4,0.4,0.4,1.2,0,1.6c-0.4,0.4-1.1,0.4-1.6,0l-10-10c-0.4-0.4-0.4-1.1,0-1.6L-322.7,340.5z"/>' +
227                    '</svg>';
228                if(this.settings.showTitle){
229                    subHtmlCont1 = '<div class="' + this.settings.classPrefix + 'title"></div>';
230                }
231                close1 = '<span class="' + this.settings.classPrefix + 'close ' + $object.settings.classPrefix + 'icon">' + $close_bg + '</span>';
232                break;
233            case 'view2':
234                $_next = '<svg class="next_bg" width="22px" height="22px" fill="#999" viewBox="-123 125.2 451.8 451.8" >' +
235                    '<g><path d="M222.4,373.4L28.2,567.7c-12.4,12.4-32.4,12.4-44.8,0c-12.4-12.4-12.4-32.4,0-44.7l171.9-171.9L-16.6,179.2c-12.4-12.4-12.4-32.4,0-44.7c12.4-12.4,32.4-12.4,44.8,0l194.3,194.3c6.2,6.2,9.3,14.3,9.3,22.4C231.7,359.2,228.6,367.3,222.4,373.4z"/></g>' +
236                    '</svg>';
237                $_prev = '<svg class="prev_bg" width="22px" height="22px" fill="#999" viewBox="-123 125.2 451.8 451.8" >' +
238                    '<g><path d="M-25.9,351.1c0-8.1,3.1-16.2,9.3-22.4l194.3-194.3c12.4-12.4,32.4-12.4,44.8,0c12.4,12.4,12.4,32.4,0,44.7L50.5,351.1L222.4,523c12.4,12.4,12.4,32.4,0,44.7c-12.4,12.4-32.4,12.4-44.7,0L-16.6,373.4C-22.8,367.3-25.9,359.2-25.9,351.1z"/></g>' +
239                    '</svg>';
240                if(this.settings.showTitle){
241                    subHtmlCont2 = '<div class="' + this.settings.classPrefix + 'title"></div>';
242                }
243                close2 = '<div class="barCont"></div><span class="' + this.settings.classPrefix + 'close ' + $object.settings.classPrefix + 'icon">' + $close_bg + '</span>';
244                break;
245            case 'view3':
246                $_next = '<svg class="next_bg" width="22px" height="22px" fill="#999" viewBox="-104 105.6 490.4 490.4" >' +
247                    '<g><g><path d="M141.2,596c135.2,0,245.2-110,245.2-245.2s-110-245.2-245.2-245.2S-104,215.6-104,350.8S6,596,141.2,596z M141.2,130.1c121.7,0,220.7,99,220.7,220.7s-99,220.7-220.7,220.7s-220.7-99-220.7-220.7S19.5,130.1,141.2,130.1z"/>' +
248                    '<path d="M34.7,363.1h183.4l-48,48c-4.8,4.8-4.8,12.5,0,17.3c2.4,2.4,5.5,3.6,8.7,3.6s6.3-1.2,8.7-3.6l68.9-68.9c4.8-4.8,4.8-12.5,0-17.3l-68.9-68.9c-4.8-4.8-12.5-4.8-17.3,0s-4.8,12.5,0,17.3l48,48H34.7c-6.8,0-12.3,5.5-12.3,12.3C22.4,357.7,27.9,363.1,34.7,363.1z"/></g></g>' +
249                    '</svg>';
250                $_prev = '<svg class="prev_bg" width="22px" height="22px" fill="#999" viewBox="-104 105.6 490.4 490.4" >' +
251                    '<g><g><path d="M141.2,596c135.2,0,245.2-110,245.2-245.2s-110-245.2-245.2-245.2S-104,215.6-104,350.8S6,596,141.2,596z M141.2,130.1c121.7,0,220.7,99,220.7,220.7s-99,220.7-220.7,220.7s-220.7-99-220.7-220.7S19.5,130.1,141.2,130.1z"/>' +
252                    '<path d="M94.9,428.4c2.4,2.4,5.5,3.6,8.7,3.6s6.3-1.2,8.7-3.6c4.8-4.8,4.8-12.5,0-17.3l-48-48h183.4c6.8,0,12.3-5.5,12.3-12.3c0-6.8-5.5-12.3-12.3-12.3H64.3l48-48c4.8-4.8,4.8-12.5,0-17.3c-4.8-4.8-12.5-4.8-17.3,0l-68.9,68.9c-4.8,4.8-4.8,12.5,0,17.3L94.9,428.4z"/></g></g>' +
253                    '</svg>';
254                if(this.settings.showTitle){
255                    subHtmlCont1 = '<div class="' + this.settings.classPrefix + 'title"></div>';
256                }
257                close1 = '<span class="' + this.settings.classPrefix + 'close ' + $object.settings.classPrefix + 'icon">' + $close_bg + '</span>';
258                break;
259            case 'view4':
260                $_next = '<svg class="next_bg" width="22px" height="22px" fill="#999" viewBox="-123 125.2 451.8 451.8" >' +
261                    '<g><path d="M222.4,373.4L28.2,567.7c-12.4,12.4-32.4,12.4-44.8,0c-12.4-12.4-12.4-32.4,0-44.7l171.9-171.9L-16.6,179.2c-12.4-12.4-12.4-32.4,0-44.7c12.4-12.4,32.4
261-12.4,44.8,0l194.3,194.3c6.2,6.2,9.3,14.3,9.3,22.4C231.7,359.2,228.6,367.3,222.4,373.4z"/></g>' +
262                    '</svg>';
263                $_prev = '<svg class="prev_bg" width="22px" height="22px" fill="#999" viewBox="-123 125.2 451.8 451.8" >' +
264                    '<g><path d="M-25.9,351.1c0-8.1,3.1-16.2,9.3-22.4l194.3-194.3c12.4-12.4,32.4-12.4,44.8,0c12.4,12.4,12.4,32.4,0,44.7L50.5,351.1L222.4,523c12.4,12.4,12.4,32.4,0,44.7c-12.4,12.4-32.4,12.4-44.7,0L-16.6,373.4C-22.8,367.3-25.9,359.2-25.9,351.1z"/></g>' +
265                    '</svg>';
266                $close_bg = '<svg class="close_bg" width="16px" height="16px" fill="#999" viewBox="-341 343.4 15.6 15.6">' +
267                    '<path d="M-332.1,351.2l6.5-6.5c0.3-0.3,0.3-0.8,0-1.1s-0.8-0.3-1.1,0l-6.5,6.5l-6.5-6.5c-0.3-0.3-0.8-0.3-1.1,0s-0.3,0.8,0,1.1l6.5,6.5l-6.5,6.5c-0.3,0.3-0.3,0.8,0,1.1c0.1,0.1,0.3,0.2,0.5,0.2s0.4-0.1,0.5-0.2l6.5-6.5l6.5,6.5c0.1,0.1,0.3,0.2,0.5,0.2s0.4-0.1,0.5-0.2c0.3-0.3,0.3-0.8,0-1.1L-332.1,351.2z"/>' +
268                    '</svg>';
269                if(this.settings.showTitle){
270                    subHtmlCont2 = '<div class="' + this.settings.classPrefix + 'title"></div>';
271                }
272                close1 = '<span class="' + this.settings.classPrefix + 'close ' + $object.settings.classPrefix + 'icon">' + $close_bg + '</span>';
273                break;
274            case 'view5':
275            case 'view6':
276                $_next = '<svg class="next_bg" width="22px" height="44px" fill="#999" x="0px" y="0px"' +
277                    'viewBox="0 0 40 70" style="enable-background:new 0 0 40 70;" xml:space="preserve">' +
278                    '<path id="XMLID_2_" class="st0" d="M3.3,1.5L1.8,2.9l31.8,31.8c0.5,0.5,0.5,0.9,0,1.4L1.8,67.9l1.5,1.4c0.3,0.5,0.9,0.5,1.4,0' +
279                    'l33.2-33.2c0.3-0.5,0.3-0.9,0-1.4L4.7,1.5C4.3,1,3.6,1,3.3,1.5L3.3,1.5z"/>' +
280                    '</svg>';
281                $_prev = '<svg class="prev_bg" width="22px" height="44px" fill="#999" x="0px" y="0px"' +
282                    'viewBox="0 0 40 70" style="enable-background:new 0 0 40 70;" xml:space="preserve">' +
283                    '<path id="XMLID_2_" class="st0" d="M37.1,68.9l1.5-1.4L6.8,35.7c-0.3-0.5-0.3-0.9,0-1.4L38.6,2.5l-1.5-1.4c-0.3-0.5-0.9-0.5-1.2,0' +
284                    'L2.5,34.3c-0.3,0.5-0.3,0.9,0,1.4l33.4,33.2C36.2,69.4,36.8,69.4,37.1,68.9L37.1,68.9z"/>' +
285                    '</svg>';
286                $close_bg = '<svg class="close_bg" width="16px" height="16px" fill="#999" viewBox="-341 343.4 15.6 15.6">' +
287                    '<path d="M-332.1,351.2l6.5-6.5c0.3-0.3,0.3-0.8,0-1.1s-0.8-0.3-1.1,0l-6.5,6.5l-6.5-6.5c-0.3-0.3-0.8-0.3-1.1,0s-0.3,0.8,0,1.1l6.5,6.5l-6.5,6.5c-0.3,0.3-0.3,0.8,0,1.1c0.1,0.1,0.3,0.2,0.5,0.2s0.4-0.1,0.5-0.2l6.5-6.5l6.5,6.5c0.1,0.1,0.3,0.2,0.5,0.2s0.4-0.1,0.5-0.2c0.3-0.3,0.3-0.8,0-1.1L-332.1,351.2z"/>' +
288                    '</svg>';
289                if(this.settings.showTitle){
290                    subHtmlCont3 += '<div class="' + this.settings.classPrefix + 'title"></div>';
291                }
292                if(this.settings.showDesc){
293                    subHtmlCont3 += '<div class="' + this.settings.classPrefix + 'description"></div>';
294                }
295                close1 = '<span class="' + this.settings.classPrefix + 'close ' + $object.settings.classPrefix + 'icon">' + $close_bg + '</span>';
296                break;
297        }
298
299        if (this.settings.arrows && this.$items.length > 1) {
300            controls = '<div class="' + this.settings.classPrefix + 'arrows">' +
301                '<div class="' + this.settings.classPrefix + 'prev ' + $object.settings.classPrefix + 'icon">' + $_prev + this.settings.prevHtml + '</div>' +
302                '<div class="' + this.settings.classPrefix + 'next ' + $object.settings.classPrefix + 'icon">' + $_next + this.settings.nextHtml + '</div>' +
303                '</div>';
304        }
305
306        if (this.settings.socialSharing && (this.settings.lightboxView !== 'view5' || this.settings.lightboxView !== 'view6')) {
307            socialIcons = '<div class="' + this.settings.classPrefix + 'socialIcons"><button class="shareLook">share</button></div>';
308        }
309
310        $contInner = (this.settings.lightboxView === 'view5' || this.settings.lightboxView === 'view6') ? '<div class="contInner">' + subHtmlCont3 + '</div>' : '';
311        
312        template = '<div class="' + this.settings.classPrefix + 'cont ">' +
313            '<div class="rwd-container rwd-' + this.settings.lightboxView + '">' +
314            '<div class="cont-inner">
314' + list + '</div>' +
315            $contInner +
316            '<div class="' + this.settings.classPrefix + 'toolbar group">' +
317            close1 + subHtmlCont2 +
318            '</div>' +
319            controls +
320            '<div class="' + this.settings.classPrefix + 'bar">' +
321            close2 + subHtmlCont1 + socialIcons + '</div>' +
322            '</div>' +
323            '</div>';
324
325        if ($object.settings.socialSharing) {
326            setTimeout(function () {
327                $object.socialShare();
328            }, 50);
329        }
330
331        this.$body.append(template);
332        this.$cont = $('.' + $object.settings.classPrefix + 'cont');
333        this.$item = this.$cont.find('.' + $object.settings.classPrefix + 'item');
334
335        if (!this.settings.slideAnimation) {
336            this.$cont.addClass(this.settings.classPrefix + 'animation');
337            this.settings.slideAnimationType = this.settings.classPrefix + 'slide';
338        } else {
339            this.$cont.addClass(this.settings.classPrefix + 'use');
340        }
341
342        $object.calculateDimensions();
343
344        $(window).on('resize.rwd-container', function () {
345            setTimeout(function () {
346                $object.calculateDimensions();
347            }, 100);
348        });
349
350        this.$item.eq(this.index).addClass(this.settings.classPrefix + 'current');
351
352        if (this.effectsSupport()) {
353            this.$cont.addClass(this.settings.classPrefix + 'support');
354        } else {
355            this.$cont.addClass(this.settings.classPrefix + 'noSupport');
356            this.settings.speed = 0;
357        }
358
359        this.$cont.addClass(this.settings.slideAnimationType);
360
361        ((this.settings.showAfterLoad) && (this.$cont.addClass(this.settings.classPrefix + 'show-after-load')));
362
363        if (this.effectsSupport()) {
364            var $inner = this.$cont.find('.cont-inner');
365            $inner.css('transition-timing-function', 'ease');
366            $inner.css('transition-duration', this.settings.speed + 'ms');
367        }
368
369        switch($object.settings.lightboxView){
370            case 'view1':
371            case 'view2':
372            case 'view3':
373                $inner.css({
374                    height: 'calc(100% - 92px)',
375                    top: '47px'
376                });
377                break;
378            case 'view4':
379                $inner.css({
380                    height: 'calc(100% - 92px)',
381                    top: '45px'
382                });
383                break;
384            case 'view5':
385                jQuery('.cont-inner').css({
386                    width: '60%'
387                });
388                break;
389            case 'view6':
390                jQuery('.cont-inner').css({
391                    width: '80%'
392                });
393                break;
394        }
395
396        $object.objects.overlay.addClass('in');
397
398        setTimeout(function () {
399            $object.$cont.addClass($object.settings.classPrefix + 'visible');
400        }, this.settings.overlayDuration);
401
402        if (this.settings.download) {
403            $download_bg = '<svg class="download_bg" width="20px" height="20px" stroke="#999" fill="#999"  viewBox="-328 330.3 41.7 41.7" >' +
404                '<path class="st0" d="M-296.4,352.1c0.4-0.4,0.4-1.1,0-1.6c-0.4-0.4-1.1-0.4-1.6,0l-8,8V332c0-0.6-0.5-1.1-1.1-1.1c-0.6,0-1.1,0.5-1.1,1.1v26.5l-8-8c-0.4-0.4-1.2-0.4-1.6,0c-0.4,0.4-0.4,1.1,0,1.6l10,10c0.4,0.4,1.1,0.4,1.6,0L-296.4,352.1zM-288.5,359.4c0-0.6,0.5-1.1,1.1-1.1c0.6,0,1.1,0.5,1.1,1.1v10.9c0,0.6-0.5,1.1-1.1,1.1h-39.5c-0.6,0-1.1-0.5-1.1-1.1v-10.9c0-0.6,0.5-1.1,1.1-1.1c0.6,0,1.1,0.5,1.1,1.1v9.8h37.2V359.4z"/>' +
405                '</svg>';
406            $download_bg_ = '<svg class="download_bg" width="36px" height="34px" stroke="#999" fill="#999" x="0px" y="0px"' +
407                'viewBox="0 0 90 90" style="enable-background:new 0 0 90 90;" xml:space="preserve">' +
408                '<path id="XMLID_2_" class="st0" d="M61.3,31.8L45.5,47.7c-0.2,0.2-0.5,0.2-0.7,0l-16-15.9c-0.2-0.2-0.2-0.5,0-0.7l2.1-2.1l12.6,12.6' +
409                'V7.4c0-0.9,0.7-1.7,1.7-1.7s1.8,0.8,1.8,1.7v34l12.2-12.3l2.1,2.1C61.5,31.3,61.5,31.6,61.3,31.8L61.3,31.8z"/>' +
410                '<path id="XMLID_3_" class="st0" d="M25.6,50.7L25.6,50.7h38.7c1.6,0,2.8,1.2,2.8,2.7v1.5c0,1.6-1.2,2.9-2.8,2.9H25.6' +
411                'c-1.5,0-2.8-1.3-2.8-2.9v-1.5C22.9,51.9,24.1,50.7,25.6,50.7L25.6,50.7z"/>' +
412                '</svg>';
413            switch (this.settings.lightboxView) {
414                case 'view1':
415                default:
416                    this.$cont.find('.' + $object.settings.classPrefix + 'toolbar').append('<a id="' + $object.settings.classPrefix + 'download" target="_blank" download class="' + this.settings.classPrefix + 'download ' + $object.settings.classPrefix + 'icon">' + $download_bg + '</a>');
417                    break;
418                case 'view2':
419                    this.$cont.find('.' + $object.settings.classPrefix + 'bar').append('<a id="' + $object.settings.classPrefix + 'download" target="_blank" download class="' + this.settings.classPrefix + 'download ' + $object.settings.classPrefix + 'icon">' + $download_bg + '</a>');
420                    break;
421                case 'view4':
422                    $('<a id="' + $object.settings.classPrefix + 'download" target="_blank" download class="' + this.settings.classPrefix + 'download ' + $object.settings.classPrefix + 'icon">' + $download_bg + '</a>').insertBefore($('.rwd-title'));
423                    break;
424                case 'view5':
425                case 'view6':
426                    $('.rwd-toolbar').append('<a id="' + $object.settings.classPrefix + 'download" target="_blank" download class="' + this.settings.classPrefix + 'download ' + $object.settings.classPrefix + 'icon">' + $download_bg_ + '</a>');
427                    break;
428            }
429        }
430
431        $arrows = $('.rwd-arrows .rwd-next, .rwd-arrows .rwd-prev');
432        $next = $('.rwd-arrows .rwd-next');
433        $prev = $('.rwd-arrows .rwd-prev');
434
435        var title_text = $('.rwd-title');
436
437        switch (this.settings.titlePos) {
438            case 'left':
439                title_text.css({'text-align': 'left'});
440                break;
441            case 'center':
442                title_text.css({'text-align': 'center'});
443                break;
444            case 'right':
445                title_text.css({'text-align': 'right'});
446                break;
447        }
448
449        switch (this.settings.lightboxView) {
450            case 'view1':
451            default:
452                $arrows.css({'top': '50%'});
453                $next.css({'right': '20px'});
454                $prev.css({'left': '20px'});
455                break;
456            case 'view2':
457                $arrows.css({'bottom': '0'});
458                $next.css({'right': '40%'});
459                $prev.css({'left': '40%'});
460                break;
461            case 'view3':
462                $arrows.css({'top': '14px', 'z-index': '1090'});
463                $next.css({'right': '20px'});
464                $prev.css({'right': '55px'});
465                title_text.css({'text-align': 'left', 'border-top': '1px solid #999'});
466                $('.rwd-close').css({'margin-right': '45%'});
467                $('.rwd-overlay, .rwd-toolbar, .rwd-title, .rwd-next, .rwd-prev').css({'background': 'rgba(255, 255, 255, 1)'});
468                $('.rwd-title, .shareLook').css({'color': '#999'});
469                $('.rwd-toolbar').css({'border-bottom': '1px solid #999'});
470                $('.rwd-toolbar .rwd-icon, .rwd-arrows .rwd-icon').addClass('rwd-icon0');
471                break;
472        }
473
474        this.prevScrollTop = $(window).scrollTop();
475
476        $object.objects.content = $('.rwd-container');
477
478        $object.objects.content.css({
479            'width': $object.settings.width,
480            'height': $object.settings.height
481        });
482
483        var $color, $zoomTop = (document.documentElement.clientHeight - $object.objects.content.height()) / 2;
484        switch (this.settings.lightboxView){
485            case 'view3':
486                $color = 'rgba(255,255,255,.9)';
487                break;
488            default:
489                $color = 'rgba(0,0,0,.9)';
490                break;
491        }
492
493        if(hugeit_resp_lightbox_obj.hugeit_lightbox_rightclick_protection === 'true'){
494            setTimeout(function () {
495                $('.rwd-container').bind('contextmenu', function () {
496                    return false;
497                });
498            }, 50);
499        }
500
501        if(this.settings.showBorder){
502            $('.rwd-container').css({
503                border: '2px solid #999'
504            });
505        }
506    };
507
508    Lightbox.prototype.calculateDimensions = function () {
509        var $object = this, $width;
510
511        $width = $('.' + $object.settings.classPrefix + 'current').height() * 16 / 9;
512
513        if ($width > $object.settings.videoMaxWidth) {
514            $width = $object.settings.videoMaxWidth;
515        }
516
517        $('.' + $object.settings.classPrefix + 'video-cont ').css({
518            'max-width': $width + 'px'
519        });
520    };
521
522    Lightbox.prototype.effectsSupport = function () {
523        var transition, root, support;
524        support = function () {
525            transition = ['transition', 'MozTransition', 'WebkitTransition', 'OTransition', 'msTransition', 'KhtmlTransition'];
526            root = document.documentElement;
527            for (var i = 0; i < transition.length; i++) {
528                if (transition[i] in root.style) {
529                    return transition[i] in root.style;
530                }
531            }
532        };
533
534        return support();
535    };
536
537    Lightbox.prototype.isVideo = function (src, index) {
538        var youtube, vimeo, dailymotion;
539
540        youtube = src.match(/\/\/(?:www\.)?youtu(?:\.be|be\.com)\/(?:watch\?v=|embed\/)?([a-z0-9\-\_\%]+)/i);
541        vimeo = src.match(/\/\/(?:www\.)?vimeo.com\/([0-9a-z\-_]+)/i);
542        dailymotion = src.match(/^.+dailymotion.com\/(video|hub)\/([^_]+)[^#]*(#video=([^_&]+))?/);
543
544        if (youtube) {
545            return {
546                youtube: youtube
547            };
548        } else if (vimeo) {
549            return {
550                vimeo: vimeo
551            };
552        } else if (dailymotion) {
553            return {
554                dailymotion: dailymotion
555            };
556        }
557    };
558
559    Lightbox.prototype.counter = function () {
560        if (this.settings.showCounter) {
561            switch (this.settings.lightboxView) {
562                case 'view1':
563                default:
564                    $('.' + this.settings.classPrefix + 'toolbar').append(this.objects.counter = $('<div id="' + this.settings.idPrefix + 'counter"></div>'));
565                    $('#rwd-counter').css({'padding-left': '23px'});
566                    break;
567                case 'view2':
568                case 'view4':
569                    $('.' + this.settings.classPrefix + 'bar').append('<div class="barCont"></div>
569').append(this.objects.counter = $('<div id="' + this.settings.idPrefix + 'counter"></div>'));
570                    break;
571                case 'view5':
572                case 'view6':
573                    $('.contInner').append(this.objects.counter = $('<div id="' + this.settings.idPrefix + 'counter"></div>'));
574                    break;
575            }
576
577            this.objects.counter.append(
578                this.objects.current = $('<div>' + this.settings.sequence_info + ' <span id="' + this.settings.idPrefix + 'counter-current">' + (parseInt(this.index, 10) + 1) + '</span> ' +
579                    this.settings.sequenceInfo + ' <span id="' + this.settings.idPrefix + 'counter-all">' + this.$items.length + '</span></div>')
580            );
581        }
582    };
583
584    Lightbox.prototype.setTitle = function (index) {
585        var $object = this, $title, $currentElement;
586
587        $currentElement = this.$items.eq(index);
588        $title = $currentElement.find('img').attr('alt') ||
589            $currentElement.find('img').attr('title') ||
590            this.settings.defaultTitle || '';
591
592        this.$cont.find('.' + this.settings.classPrefix + 'title').html('<div class="rwd-title-text">' + $title + '</div>');
593
594        (($object.settings.lightboxView === 'view2') && $('.rwd-title-text').css({'width': '100%'}));
595
596        if ($object.settings.lightboxView !== 'view1' && $object.settings.lightboxView !== 'view3' && $object.settings.lightboxView !== 'view4') {
597            ($title === '' && $object.settings.socialSharing) ?
598                this.$cont.find('.' + this.settings.classPrefix + 'title').hide() :
599                this.$cont.find('.' + this.settings.classPrefix + 'title').show();
600        }
601    };
602
603    Lightbox.prototype.setDescription = function (index) {
604        var $object = this, $description, $currentElement;
605
606        $currentElement = this.$items.eq(index);
607        $description = $currentElement.find('img').attr('data-description') || '';
608
609        this.$cont.find('.' + this.settings.classPrefix + 'description').html('<div class="rwd-description-text" title="' + $description + '">' + $description + '</div>');
610    };
611
612    Lightbox.prototype.preload = function (index) {
613        for (var i = 1; i <= this.settings.preload; i++) {
614            if (i >= this.$items.length - index) {
615                break;
616            }
617
618            this.loadContent(index + i, false, 0);
619        }
620
621        for (var j = 1; j <= this.settings.preload; j++) {
622            if (index - j < 0) {
623                break;
624            }
625
626            this.loadContent(index - j, false, 0);
627        }
628    };
629
630    Lightbox.prototype.socialShare = function () {
631        var $object = this;
632
633        var shareButtons = '<ul class="rwd-share-buttons">';
634        shareButtons += $object.settings.share.facebookButton ? '<li><a title="Facebook" id="rwd-share-facebook" target="_blank"></a></li>' : '';
635        shareButtons += $object.settings.share.twitterButton ? '<li><a title="Twitter" id="rwd-share-twitter" target="_blank"></a></li>' : '';
636        shareButtons += $object.settings.share.googleplusButton ? '<li><a title="Google Plus" id="rwd-share-googleplus" target="_blank"></a></li>' : '';
637        shareButtons += $object.settings.share.pinterestButton ? '<li><a title="Pinterest" id="rwd-share-pinterest" target="_blank"></a></li>' : '';
638        shareButtons += $object.settings.share.linkedinButton ? '<li><a title="Linkedin" id="rwd-share-linkedin" target="_blank"></a></li>' : '';
639        shareButtons += $object.settings.share.tumblrButton ? '<li><a title="Tumblr" id="rwd-share-tumblr" target="_blank"></a></li>' : '';
640        shareButtons += $object.settings.share.redditButton ? '<li><a title="Reddit" id="rwd-share-reddit" target="_blank"></a></li>' : '';
641        shareButtons += $object.settings.share.bufferButton ? '<li><a title="Buffer" id="rwd-share-buffer" target="_blank"></a></li>' : '';
642        shareButtons += $object.settings.share.diggButton ? '<li><a title="Digg" id="rwd-share-digg" target="_blank"></a></li>' : '';
643        shareButtons += $object.settings.share.vkButton ? '<li>
643<a title="VK" id="rwd-share-vk" target="_blank"></a></li>' : '';
644        shareButtons += $object.settings.share.yummlyButton ? '<li><a title="Yummly" id="rwd-share-yummly" target="_blank"></a></li>' : '';
645        shareButtons += '</ul>';
646
647        if (this.settings.lightboxView === 'view5' || this.settings.lightboxView === 'view6') {
648            $('.contInner').append(shareButtons);
649        } else {
650            $('.' + this.settings.classPrefix + 'socialIcons').append(shareButtons);
651        }
652
653        setTimeout(function () {
654            $('#rwd-share-facebook').attr('href', 'https://www.facebook.com/sharer/sharer.php?u=' + (encodeURIComponent(window.location.href)));
655            $('#rwd-share-twitter').attr('href', 'https://twitter.com/intent/tweet?text=&url=' + (encodeURIComponent(window.location.href)));
656            $('#rwd-share-googleplus').attr('href', 'https://plus.google.com/share?url=' + (encodeURIComponent(window.location.href)));
657            $('#rwd-share-pinterest').attr('href', 'http://www.pinterest.com/pin/create/button/?url=' + (encodeURIComponent(window.location.href)));
658            $('#rwd-share-linkedin').attr('href', 'http://www.linkedin.com/shareArticle?mini=true&amp;url=' + (encodeURIComponent(window.location.href)));
659            $('#rwd-share-tumblr').attr('href', 'http://www.tumblr.com/share/link?url=' + (encodeURIComponent(window.location.href)));
660            $('#rwd-share-reddit').attr('href', 'http://reddit.com/submit?url=' + (encodeURIComponent(window.location.href)));
661            $('#rwd-share-buffer').attr('href', 'https://bufferapp.com/add?url=' + (encodeURIComponent(window.location.href)));
662            $('#rwd-share-digg').attr('href', 'http://www.digg.com/submit?url=' + (encodeURIComponent(window.location.href)));
663            $('#rwd-share-vk').attr('href', 'http://vkontakte.ru/share.php?url=' + (encodeURIComponent(window.location.href)));
664            $('#rwd-share-yummly').attr('href', 'http://www.yummly.com/urb/verify?url=' + (encodeURIComponent(window.location.href)));
665        }, 200);
666    };
667
668    Lightbox.prototype.changeHash = function (index) {
669        var $object = this;
670
671        (($object.settings.socialSharing) && (window.location.hash = '/lightbox&slide=' + (index + 1)));
672    };
673
674    Lightbox.prototype.loadContent = function (index, rec, delay) {
675
676        var $object, src, isVideo;
677
678        $object = this;
679
680        function isImg() {
681            src = $object.$items.eq(index).attr('href');
682            return src.match(/\.(jpg|png|gif)\b/);
683        }
684
685        if ($object.settings.watermark) {
686            if (isImg()) {
687                src = $object.$items.eq(index).find('img').attr('data-src');
688            }
689        } else {
690            src = $object.$items.eq(index).attr('href');
691        }
692
693        isVideo = $object.isVideo(src, index);
694        if (!$object.$item.eq(index).hasClass($object.settings.classPrefix + 'loaded')) {
695            if (isVideo) {
696                $object.$item.eq(index).prepend('<div class="' + this.settings.classPrefix + 'video-cont "><div class="' + this.settings.classPrefix + 'video"></div></div>');
697                $object.$element.trigger('hasVideo.rwd-container', [index, src]);
698            } else {
699                $object.$item.eq(index).prepend('<div class="' + this.settings.classPrefix + 'img-wrap"><img class="' + this.settings.classPrefix + 'object ' + $object.settings.classPrefix + 'image watermark" src="' + src + '" /></div>');
700            }
701
702            $object.$element.trigger('onAferAppendSlide.rwd-container', [index]);
703
704            $object.$item.eq(index).addClass($object.settings.classPrefix + 'loaded');
705        }
706
707        $object.$item.eq(index).find('.' + $object.settings.classPrefix + 'object').on('load.rwd-container error.rwd-container', function () {
708
709            var speed = 0;
710            if (delay) {
711                speed = delay;
712            }
713
714            setTimeout(function () {
715                $object.$item.eq(index).addClass($object.settings.classPrefix + 'complete');
716            }, speed);
717
718        });
719
720        if (rec === true) {
721
722            if (!$object.$item.eq(index).hasClass($object.settings.classPrefix + 'complete')) {
723                $object.$item.eq(index).find('.' + $object.settings.classPrefix + 'object').on('load.rwd-container error.rwd-container', function () {
724                    $object.preload(index);
725                });
726            } else {
727                $object.preload(index);
728            }
729        }
730
731        if(hugeit_resp_lightbox_obj.hugeit_lightbox_imageframe !== 'frame_0'){
732            $('.rwd-image').css({
733                borderColor: '#f4be52',
734                borderStyle: 'inset',
735                borderWidth: '60px'
736            });
737            if(hugeit_resp_lightbox_obj.hugeit_lightbox_imageframe !== 'frame_8'){
738                $('.rwd-image').css({
739                    borderImage: 'url("' + hugeit_resp_lightbox_plugins_url + hugeit_resp_lightbox_obj.hugeit_lightbox_imageframe + '.png") 90 95 95 90 stretch stretch'
740                });
741            } else {
742                $('.rwd-image').css({
743                    borderImage: 'url("' + hugeit_resp_lightbox_plugins_url + hugeit_resp_lightbox_obj.hugeit_lightbox_imageframe + '.png") 90 123 85 129 stretch stretch'
744                });
745            }
746        }
747
748    };
749
750    Lightbox.prototype.slide = function (index, fromSlide, fromThumb) {
751
752        var $object, prevIndex;
753        $object = this;
754        prevIndex = this.$cont.find('.' + $object.settings.classPrefix + 'current').index();
755
756        var length = this.$item.length,
757            time = 0,
758            next = false,
759            prev = false;
760
761        if (this.settings.download) {
762            var src;
763            if (!this.settings.watermark) {
764                src = $object.$items.eq(index).attr('data-download-url') !== 'false' && ($object.$items.eq(index).attr('data-download-url') || $object.$items.eq(index).attr('href'));
765            }
766            else {
767                src = $object.$items.eq(index).find('img').attr('data-src');
768            }
769            if (src) {
770                $('#' + $object.settings.classPrefix + 'download').attr('href', src);
771                $object.$cont.removeClass($object.settings.classPrefix + 'hide-download');
772                $object.$cont.removeClass($object.settings.classPrefix + 'hide-actual-size');
773                $object.$cont.removeClass($object.settings.classPrefix + 'hide-fullwidth');
774                $object.$cont.removeClass($object.settings.classPrefix + 'hide-zoom-in');
775                $object.$cont.removeClass($object.settings.classPrefix + 'hide-zoom-out');
776            } else {
777                $object.$cont.addClass($object.settings.classPrefix + 'hide-download');
778                $object.$cont.addClass($object.settings.classPrefix + 'hide-actual-size');
779                $object.$cont.addClass($object.settings.classPrefix + 'hide-fullwidth');
780                $object.$cont.addClass($object.settings.classPrefix + 'hide-zoom-in');
781                $object.$cont.addClass($object.settings.classPrefix + 'hide-zoom-out');
782            }
783        }
784
785        this.$element.trigger('onBeforeSlide.rwd-container', [prevIndex, index, fromSlide, fromThumb]);
786
787        setTimeout(function () {
788            $object.setTitle(index);
789        }, time);
790
791        if ($object.settings.lightboxView === 'view5' || $object.settings.lightboxView === 'view6') {
792            setTimeout(function () {
793                $object.setDescription(index);
794            }, time);
795        }
796
797        this.arrowDisable(index);
798
799
800        $object.$cont.addClass($object.settings.classPrefix + 'no-trans');
801
802        this.$item.removeClass($object.settings.classPrefix + 'prev-slide ' + $object.settings.classPrefix + 'next-slide');
803        if (!fromSlide) {
804
805            if (index < prevIndex) {
806                prev = true;
807                if ((index === 0) && (prevIndex === length - 1) && !fromThumb) {
808                    prev = false;
809                    next = true;
810                }
811            } else if (index > prevIndex) {
812                next = true;
813                if ((index === length - 1) && (prevIndex === 0) && !fromThumb) {
814                    prev = true;
815                    next = false;
816                }
817            }
818
819            if (prev) {
820
821                this.$item.eq(index).addClass($object.settings.classPrefix + 'prev-slide');
822                this.$item.eq(prevIndex).addClass($object.settings.classPrefix + 'next-slide');
823            } else if (next) {
824
825                this.$item.eq(index).addClass($object.settings.classPrefix + 'next-slide');
826                this.$item.eq(prevIndex).addClass($object.settings.classPrefix + 'prev-slide');
827            }
828
829            setTimeout(function () {
830                $object.$item.removeClass($object.settings.classPrefix + 'current');
831
832                $object.$item.eq(index).addClass($object.settings.classPrefix + 'current');
833
834                $object.$cont.removeClass($object.settings.classPrefix + 'no-trans');
835            }, 50);
836        } else {
837
838            var slidePrev = index - 1;
839            var slideNext = index + 1;
840
841            if ((index === 0) && (prevIndex === length - 1)) {
842
843                slideNext = 0;
844                slidePrev = length - 1;
845            } else if ((index === length - 1) && (prevIndex === 0)) {
846
847                slideNext = 0;
848                slidePrev = length - 1;
849            }
850
851            this.$item.removeClass($object.settings.classPrefix + 'prev-slide ' + $object.settings.classPrefix + 'current ' + $object.settings.classPrefix + 'next-slide');
852            $object.$item.eq(slidePrev).addClass($object.settings.classPrefix + 'prev-slide');
853            $object.$item.eq(slideNext).addClass($object.settings.classPrefix + 'next-slide');
854            $object.$item.eq(index).addClass($object.settings.classPrefix + 'current');
855        }
856
857        $object.loadContent(index, true, $object.settings.overlayDuration);
858
859        $object.$element.trigger('onAfterSlide.rwd-container', [prevIndex, index, fromSlide, fromThumb]);
860
861        if (this.settings.showCounter) {
862            $('#' + $object.settings.classPrefix + 'counter-current').text(index + 1);
863        }
864
865        if (this.settings.socialSharing) {
866            $object.changeHash(index);
867        }
868
869        var $top, $left, $wWidth, $wHeight, $imgWidth, $imgHeight, $wmWidth, $wmHeight, $pos, $item;
870        $item = $('.rwd-item.rwd-current');
871        $pos = +hugeit_resp_lightbox_obj.hugeit_lightbox_watermark_margin;
872        $wWidth = +hugeit_resp_lightbox_obj.hugeit_lightbox_watermark_containerWidth;
873        $wHeight = +hugeit_resp_lightbox_obj.hugeit_lightbox_watermark_textFontSize;
874        $imgWidth = $object.$item.eq(index).find('img').width();
875        $imgHeight = $object.$item.eq(index).find('img').height();
876        $wmWidth = $item.width();
877        $wmHeight = $item.height();
878
879        switch ('pos' + hugeit_resp_lightbox_obj.hugeit_lightbox_watermark_position_new) {
880            case 'pos1':
881                $top = ($wmHeight - $imgHeight) / 2 + $pos;
882                $left = ($wmWidth - $imgWidth) / 2 + $pos;
883                break;
884            case 'pos2':
885                $top = ($wmHeight - $imgHeight) / 2 + $pos;
886                $left = ($wmWidth - $wWidth) / 2;
887                break;
888            case 'pos3':
889                $top = ($wmHeight - $imgHeight) / 2 + $pos;
890                $left = ($wmWidth + $imgWidth) / 2 - $wWidth - $pos;
891                break;
892            case 'pos4':
893                $top = ($wmHeight - $wHeight) / 2;
894                $left = ($wmWidth - $imgWidth) / 2 + $pos;
895                break;
896            case 'pos5':
897                $top = ($wmHeight - $wHeight) / 2;
898                $left = ($wmWidth - $wWidth) / 2;
899                break;
900            case 'pos6':
901                $top = ($wmHeight - $wHeight) / 2;
902                $left = ($wmWidth + $imgWidth) / 2 - $wWidth - $pos;
903                break;
904            case 'pos7':
905                $top = ($wmHeight + $imgHeight) / 2 - $wHeight - $pos;
906                $left = ($wmWidth - $imgWidth) / 2 + $pos;
907                break;
908            case 'pos8':
909                $top = ($wmHeight + $imgHeight) / 2 - $wHeight - $pos;
910                $left = ($wmWidth - $wWidth) / 2;
911                break;
912            case 'pos9':
913                $top = ($wmHeight + $imgHeight) / 2 - $wHeight - $pos;
914                $left = ($wmWidth + $imgWidth) / 2 - $wWidth - $pos;
915                break;
916            default:
917                $top = ($wmHeight - $wHeight) / 2;
918                $left = ($wmWidth - $wWidth) / 2;
919        }
920
921        $('.w_url').css({
922            position: 'absolute',
923            width: $wWidth + 'px',
924            height: $wHeight + 'px',
925            top: $top + 'px',
926            left: $left + 'px'
927        });
928
929        $object.calculateDimensions();
930
931        $('.rwd-container .rwd-thumb-item img').css({
932            opacity: 1 - 10 / 100
933        });
934
935        $('.rwd-container .rwd-thumb-item.active img').css({
936            opacity: 1
937        });
938    };
939
940    Lightbox.prototype.goToNextSlide = function (fromSlide) {
941        var $object = this,
942            $cont = $('.rwd-cont'),
943            $imageObject, k;
944        if (($object.index + 1) < $object.$item.length) {
945            $object.index++;
946            $object.slide($object.index, fromSlide, false);
947        } else {
948            if ($object.settings.loop === 'true') {
949                $object.index = 0;
950                $object.slide($object.index, fromSlide, false);
951            }
952        }
953
954        if ($object.settings.fullwidth && $cont.hasClass('rwd-fullwidth-on')) {
955            $imageObject = $cont.find('.rwd-image').eq($object.index);
956
957            k = $imageObject.width() / $imageObject.height();
958            if ($imageObject.width() > $imageObject.height() && k > 2) {
959                $imageObject.css({
960                    'min-width': '100%'
961                });
962            } else {
963                $imageObject.css({
964                    'min-height': '100%'
965                });
966            }
967        }
968    };
969
970    Lightbox.prototype.goToPrevSlide = function (fromSlide) {
971        var $object = this,
972            $cont = $('.rwd-cont'),
973            $imageObject, k;
974
975        if ($object.index > 0) {
976            $object.index--;
977            $object.slide($object.index, fromSlide, false);
978        } else {
979            if ($object.settings.loop === 'true') {
980                $object.index = $object.$items.length - 1;
981                $object.slide($object.index, fromSlide, false);
982            }
983        }
984
985        if ($object.settings.fullwidth && $cont.hasClass('rwd-fullwidth-on')) {
986            $imageObject = $cont.find('.rwd-image').eq($object.index);
987
988            k = $imageObject.width() / $imageObject.height();
989            if ($imageObject.width() > $imageObject.height() && k > 2) {
990                $imageObject.css({
991                    'min-width': '100%'
992                });
993            } else {
994                $imageObject.css({
995                    'min-height': '100%'
996                });
997            }
998        }
999    };
1000
1001    Lightbox.prototype.slideShow = function () {
1002        var $object = this, $toolbar, $play_bg, $pause_bg;
1003
1004        $play_bg = '<svg class="play_bg" width="20px" height="20px" fill="#999" viewBox="-192 193.9 314.1 314.1">' +
1005            '<g><g id="_x33_56._Play"><g><path d="M101,272.5C57.6,197.4-38.4,171.6-113.5,215c-75.1,43.4-100.8,139.4-57.5,214.5c43.4,75.1,139.4,100.8,214.5,57.5C118.6,443.6,144.4,347.6,101,272.5z M27.8,459.7c-60.1,34.7-136.9,14.1-171.6-46c-34.7-60.1-14.1-136.9,46-171.6c60.1-34.7,136.9-14.1,171.6,46C108.5,348.2,87.9,425,27.8,459.7z M21.6,344.6l-82.2-47.9c-7.5-4.4-13.5-0.9-13.5,7.8l0.4,95.2c0,8.7,6.2,12.2,13.7,7.9l81.6-47.1C29,356,29,349,21.6,344.6z"/></g></g></g>' +
1006            '</svg>';
1007        $pause_bg = '<svg class="pause_bg" width="20px" height="20px" fill="#999" viewBox="-94 96 510 510" >' +
1008            '<g><g id="pause-circle-outline"><path d="M84.5,453h51V249h-51V453z M161,96C20.8,96-94,210.8-94,351S20.8,606,161,606s255-114.8,255-255S301.3,96,161,96zM161,555C48.8,555-43,463.2-43,351s91.8-204,204-204s204,91.8,204,204S273.2,555,161,555z M186.5,453h51V249h-51V453z"/></g></g>' +
1009            '</svg>';
1010
1011        $toolbar = $('.' + $object.settings.classPrefix + 'toolbar');
1012        switch (this.settings.lightboxView) {
1013            case 'view1':
1014            default:
1015                $toolbar.append('<span class="' + $object.settings.classPrefix + 'auto
1015play-button ' + $object.settings.classPrefix + 'icon">' + $play_bg + $pause_bg + '</span>');
1016                break;
1017            case 'view2':
1018                $('.' + $object.settings.classPrefix + 'bar').append('<span class="' + $object.settings.classPrefix + 'autoplay-button ' + $object.settings.classPrefix + 'icon">' + $play_bg + $pause_bg + '</span>');
1019                break;
1020            case 'view3':
1021                $toolbar.append('<span class="' + $object.settings.classPrefix + 'autoplay-button ' + $object.settings.classPrefix + 'icon">' + $play_bg + $pause_bg + '</span>');
1022                $('.rwd-toolbar .rwd-icon').addClass('rwd-icon0');
1023                break;
1024            case 'view4':
1025                $('<span class="' + $object.settings.classPrefix + 'autoplay-button ' + $object.settings.classPrefix + 'icon">' + $play_bg + $pause_bg + '</span>').insertBefore($('.rwd-title'));
1026                $('.rwd-toolbar .rwd-icon').addClass('rwd-icon0');
1027                break;
1028        }
1029        if ($object.settings.slideshowAuto) {
1030            $object.slideshowAuto();
1031        }
1032
1033        $object.$cont.find('.' + $object.settings.classPrefix + 'autoplay-button').on('click.rwd-container', function () {
1034            !$($object.$cont).hasClass($object.settings.classPrefix + 'show-autoplay') ? $object.startSlide() : $object.stopSlide();
1035        });
1036
1037    };
1038
1039    Lightbox.prototype.slideshowAuto = function () {
1040        var $object = this;
1041
1042        $object.$cont.addClass('' + $object.settings.classPrefix + 'show-autoplay');
1043        $object.startSlide();
1044    };
1045
1046    Lightbox.prototype.startSlide = function () {
1047        var $object = this;
1048        $object.$cont.addClass('' + $object.settings.classPrefix + 'show-autoplay');
1049        $('.rwd-autoplay-button > .pause_bg').css({'display': 'inline-block'});
1050        $('.rwd-autoplay-button > .play_bg').css({'display': 'none'});
1051        $object.interval = setInterval(function () {
1052            $object.goToNextSlide();
1053        }, $object.settings.slideshowSpeed);
1054    };
1055
1056    Lightbox.prototype.stopSlide = function () {
1057        clearInterval(this.interval);
1058        this.$cont.removeClass(this.settings.classPrefix + 'show-autoplay');
1059        $('.rwd-thumb').removeClass('thumb_move');
1060        $('.rwd-autoplay-button > .pause_bg').css({'display': 'none'});
1061        $('.rwd-autoplay-button > .play_bg').css({'display': 'inline-block'});
1062    };
1063
1064    Lightbox.prototype.addKeyEvents = function () {
1065        var $object = this;
1066        if (this.$items.length > 1) {
1067            $(window).on('keyup.rwd-container', function (e) {
1068                if ($object.$items.length > 1) {
1069                    if (e.keyCode === 37) {
1070                        e.preventDefault();
1071                        $object.goToPrevSlide();
1072                    }
1073
1074                    if (e.keyCode === 39) {
1075                        e.preventDefault();
1076                        $object.goToNextSlide();
1077                    }
1078                }
1079            });
1080        }
1081
1082        $(window).on('keydown.rwd-container', function (e) {
1083            if ($object.settings.escKey === true && e.keyCode === 27) {
1084                e.preventDefault();
1085                if (!$object.$cont.hasClass($object.settings.classPrefix + 'thumb-open')) {
1086                    $object.destroy();
1087                } else {
1088                    $object.$cont.removeClass($object.settings.classPrefix + 'thumb-open');
1089                }
1090            }
1091        });
1092    };
1093
1094    Lightbox.prototype.arrow = function () {
1095        var $object = this;
1096        this.$cont.find('.' + $object.settings.classPrefix + 'prev').on('click.rwd-container', function () {
1097            $object.goToPrevSlide();
1098        });
1099
1100        this.$cont.find('.' + $object.settings.classPrefix + 'next').on('click.rwd-container', function () {
1101            $object.goToNextSlide();
1102        });
1103    };
1104
1105    Lightbox.prototype.arrowDisable = function (index) {
1106
1107        if (!this.settings.loop === 'true' && this.settings.hideControlOnEnd) {
1108            if ((index + 1) < this.$item.length) {
1109                this.$cont.find('.' + this.settings.classPrefix + 'next').removeAttr('disabled').removeClass('disabled');
1110            } else {
1111                this.$cont.find('.' + this.settings.classPrefix + 'next').attr('disabled', 'disabled').addClass('disabled');
1112            }
1113
1114            if (index > 0) {
1115                this.$cont.find('.' + this.settings.classPrefix + 'prev').removeAttr('disabled').removeClass('disabled');
1116            } else {
1117                this.$cont.find('.' + this.settings.classPrefix + 'prev').attr('disabled', 'disabled').addClass('disabled');
1118            }
1119        }
1120    };
1121
1122    Lightbox.prototype.mousewheel = function () {
1123        var $object = this, delta;
1124
1125        $object.$cont.on('mousewheel', function (e) {
1126            e = e || window.event;
1127            delta = e.deltaY || e.detail || e.wheelDelta;
1128
1129            (delta > 0) ? $object.goToNextSlide() : $object.goToPrevSlide();
1130            e.preventDefault ? e.preventDefault() : (e.returnValue = false);
1131        });
1132
1133    };
1134
1135    Lightbox.prototype.closeGallery = function () {
1136
1137        var $object = this, mousedown = false;
1138
1139        this.$cont.find('.' + $object.settings.classPrefix + 'close').on('click.rwd-container', function () {
1140            $object.destroy();
1141        });
1142
1143        if ($object.settings.overlayClose === 'true') {
1144
1145            $object.$cont.on('mousedown.rwd-container', function (e) {
1146
1147                mousedown = ($(e.target).is('.' + $object.settings.classPrefix + 'cont') || $(e.target).is('.' + $object.settings.classPrefix + 'item ') || $(e.target).is('.' + $object.settings.classPrefix + 'img-wrap'));
1148
1149            });
1150
1151            $object.$cont.on('mouseup.rwd-container', function (e) {
1152
1153                if ($(e.target).is('.contInner') || $(e.target).is('.' + $object.settings.classPrefix + 'cont') || $(e.target).is('.' + $object.settings.classPrefix + 'item ') || $(e.target).is('.' + $object.settings.classPrefix + 'img-wrap') && mousedown) {
1154                    if (!$object.$cont.hasClass($object.settings.classPrefix + 'dragEvent')) {
1155                        $object.destroy();
1156                    }
1157                }
1158
1159            });
1160
1161        }
1162    };
1163
1164    Lightbox.prototype.destroy = function (d) {
1165
1166        var $object = this;
1167
1168        clearInterval($object.interval);
1169
1170        $object.$body.removeClass($object.settings.classPrefix + 'on');
1171
1172        $(window).scrollTop($object.prevScrollTop);
1173
1174        if (d) {
1175            $.removeData($object.el, 'lightbox');
1176        }
1177
1178        ($object.settings.socialSharing && (window.location.hash = ''));
1179
1180        this.$element.off('.rwd-container');
1181
1182        $(window).off('.rwd-container');
1183
1184        if ($object.$cont) {
1185            $object.$cont.removeClass($object.settings.classPrefix + 'visible');
1186        }
1187
1188        $object.objects.overlay.removeClass('in');
1189
1190        setTimeout(function () {
1191            if ($object.$cont) {
1192                $object.$cont.remove();
1193            }
1194
1195            $object.objects.overlay.remove();
1196
1197        }, $object.settings.overlayDuration + 50);
1198
1199        window.scrollTo(0, $object.$_y_);
1200
1201        $.fn.lightbox.lightboxModul['modul'].prototype.destroy();
1202    };
1203
1204    $.fn.lightbox = function (options) {
1205        return this.each(function () {
1206            if (!$.data(this, 'lightbox')) {
1207                $.data(this, 'lightbox', new Lightbox(this, options));
1208            }
1209        });
1210    };
1211
1212    $.fn.lightbox.lightboxModul = {};
1213
1214    var Modul = function (element) {
1215
1216        this.dataL = $(element).data('lightbox');
1217        this.$element = $(element);
1218        this.dataL.modulSettings = $.extend({}, this.constructor.defaultsModul);
1219
1220        this.init();
1221
1222        if (this.dataL.modulSettings.zoom && this.dataL.effectsSupport()) {
1223            this.initZoom();
1224
1225            this.zoomabletimeout = false;
1226
1227            this.pageX = $(window).width() / 2;
1228            this.pageY = ($(window).height() / 2) + $(window).scrollTop();
1229        }
1230
1231        if (this.dataL.modulSettings.fullwidth && this.dataL.effectsSupport()) {
1232            this.initFullWidth();
1233        }
1234
1235        this.$el = $(element);
1236        this.$thumbCont = null;
1237        this.thumbContWidth = 0;
1238        this.thumbTotalWidth = (this.dataL.$items.length * (this.dataL.modulSettings.thumbsWidth + this.dataL.modulSettings.thumbMargin));
1239        this.thumbIndex = this.dataL.index;
1240        this.left = 0;
1241        if(hugeit_resp_lightbox_obj.hugeit_lightbox_thumbs === 'true'){
1242            this.initThumbs();
1243        }
1244
1245        if(this.dataL.modulSettings.fullscreen){
1246            this.initFullscreen();
1247        }
1248
1249        return this;
1250    };
1251
1252    Modul.defaultsModul = {
1253        idPrefix: 'rwd-',
1254        classPrefix: 'rwd-',
1255        attrPrefix: 'data-',
1256        videoMaxWidth: hugeit_gen_resp_lightbox_obj.hugeit_lightbox_videoMaxWidth,
1257        fullwidth: hugeit_resp_lightbox_obj.hugeit_lightbox_fullwidth_effect === 'true',
1258        zoom: hugeit_resp_lightbox_obj.hugeit_lightbox_zoom,
1259        scale: +hugeit_resp_lightbox_obj.hugeit_lightbox_zoomsize / 10,
1260        thumbnail: hugeit_resp_lightbox_obj.hugeit_lightbox_thumbs,
1261        thumbsWidth: 100,
1262        thumbsHeight: 100,
1263        thumbMargin: 5,
1264        showByDefault: true,
1265        toogleThumb: false,
1266        thumbPosition: '0',
1267        thumbsOverlayColor: 'black',
1268        thumbsOverlayOpacity: 10,
1269        fullscreen: hugeit_resp_lightbox_obj.hugeit_lightbox_fullscreen_effect === 'true'
1270    };
1271
1272    Modul.prototype.init = function () {
1273        var $object = this;
1274
1275        $object.dataL.$element.on('hasVideo.rwd-container', function (event, index, src) {
1276            $object.dataL.$item.eq(index).find('.' + $object.dataL.modulSettings.classPrefix + 'video').append($object.loadVideo(src, '' + $object.dataL.modulSettings.classPrefix + 'object', index));
1277        });
1278
1279        $object.dataL.$element.on('onAferAppendSlide.rwd-container', function (event, index) {
1280            $object.dataL.$item.eq(index).find('.' + $object.dataL.settings.classPrefix + 'video-cont').css({
1281                'max-width': $object.dataL.modulSettings.videoMaxWidth + 'px'
1282            });
1283        });
1284
1285        $object.dataL.$element.on('onBeforeSlide.rwd-container', function (event, prevIndex, index) {
1286
1287            var $videoSlide = $object.dataL.$item.eq(prevIndex),
1288                youtubePlayer = $videoSlide.find('.rwd-youtube').get(0),
1289                vimeoPlayer = $videoSlide.find('.rwd-vimeo').get(0),
1290                dailymotionPlayer = $videoSlide.find('.rwd-dailymotion').get(0);
1291
1292            if (youtubePlayer) {
1293                youtubePlayer.contentWindow.postMessage('{"event":"command","func":"pauseVideo","args":""}', '*');
1294            } else if (vimeoPlayer) {
1295                try {
1296                    $f(vimeoPlayer).api('pause');
1297                } catch (e) {
1298                    console.error('Make sure you have included froogaloop2 js');
1299                }
1300            } else if (dailymotionPlayer) {
1301                dailymotionPlayer.contentWindow.postMessage('pause', '*');
1302            }
1303
1304            var src;
1305            src = $object.dataL.$items.eq(index).attr('href');
1306
1307            var isVideo = $object.dataL.isVideo(src, index) || {};
1308            if (isVideo.youtube || isVideo.vimeo || isVideo.dailymotion) {
1309                $object.dataL.$cont.addClass($object.dataL.modulSettings.classPrefix + 'hide-download');
1310                $object.dataL.$cont.addClass($object.dataL.modulSettings.classPrefix + 'hide-actual-size');
1311                $object.dataL.$cont.addClass($object.dataL.modulSettings.classPrefix + 'hide-fullwidth');
1312                $object.dataL.$cont.addClass($object.dataL.modulSettings.classPrefix + 'hide-zoom-in');
1313                $object.dataL.$cont.addClass($object.dataL.modulSettings.classPrefix + 'hide-zoom-out');
1314            }
1315
1316        });
1317
1318        $object.dataL.$element.on('onAfterSlide.rwd-container', function (event, prevIndex) {
1319            $object.dataL.$item.eq(prevIndex).removeClass($object.dataL.modulSettings.classPrefix + 'video-playing');
1320        });
1321    };
1322
1323    Modul.prototype.loadVideo = function (src, addClass, index) {
1324        var video = '',
1325            autoplay = 0,
1326            a = '',
1327            isVideo = this.dataL.isVideo(src, index) || {};
1328
1329        if (isVideo.youtube) {
1330
1331            a = '?wmode=opaque&autoplay=' + autoplay + '&enablejsapi=1';
1332
1333            video = '<iframe class="' + this.dataL.modulSettings.classPrefix + 'video-object ' + this.dataL.modulSettings.classPrefix + 'youtube ' + addClass + '" width="560" height="315" src="//www.youtube.com/embed/' + isVideo.youtube[1] + a + '" frameborder="0" allowfullscreen></iframe>';
1334
1335        } else if (isVideo.vimeo) {
1336
1337            a = '?autoplay=' + autoplay + '&api=1';
1338
1339            video = '<iframe class="' + this.dataL.modulSettings.classPrefix + 'video-object ' + this.dataL.modulSettings.classPrefix + 'vimeo ' + addClass + '" width="560" height="315"  src="//player.vimeo.com/video/' + isVideo.vimeo[1] + a + '" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>';
1340
1341        } else if (isVideo.dailymotion) {
1342
1343            a = '?wmode=opaque&autoplay=' + autoplay + '&api=postMessage';
1344
1345            video = '<iframe class="rwd-video-object rwd-dailymotion ' + addClass + '" width="560" height="315" src="//www.dailymotion.com/embed/video/' + isVideo.dailymotion[2] + a + '" frameborder="0" allowfullscreen></iframe>';
1346      
1347        }
1348
1349        return video;
1350    };
1351
1352    Modul.prototype.initFullscreen = function() {
1353        var fullScreen = '';
1354        if (this.dataL.modulSettings.fullscreen) {
1355            if (!document.fullscreenEnabled && !document.webkitFullscreenEnabled && !document.mozFullScreenEnabled && !document.msFullscreenEnabled) {
1356                return;
1357            } else {
1358                fullScreen = '<span class="rwd-fullscreen rwd-icon">' +
1359                    '<svg id="rwd-fullscreen-on" width="20px" height="20px" stroke="#999" fill="#999" x="0px" y="0px" viewBox="134 -133 357 357" style="enable-background:new 134 -133 357 357;">' +
1360                    '<g><g id="fullscreen"><path d="M165,96.5h-31V224h127.5v-31H165V96.5z M134-5.5h31V-82h96.5v-31H134V-5.5z M440,193h-76.5v31H491V96.5h-31V192z M363.5-103v21H460v76.5h31V-113H363.5z"></path>' +
1361                    '</g></g></svg>
1361' +
1362                    '<svg id="rwd-fullscreen-off" width="20px" height="20px" stroke="#999" fill="#999" x="0px" y="0px" viewBox="134 -133 357 357" style="enable-background:new 134 -133 357 357;">' +
1363                    '<g><g id="fullscreen-exit"><path d="M134, 127.5h 96.5V 224h 31V 96.5H 114V 147.5z M210.5 -36.5H 134v 31h 127.5V -133h -31V -36.5z M363.5, 224h 31v -96.5H 491v -31H 363.5V 224z M394.5 -56.5V -133h -31V -5.5H 491v -31H 395.5z"></path>' +
1364                    '</g></g></svg>' +
1365                    '</span>';
1366                switch (hugeit_resp_lightbox_obj.hugeit_lightbox_lightboxView) {
1367                    case 'view1':
1368                    default:
1369                        $('.rwd-cont').find('.rwd-toolbar').append(fullScreen);
1370                        break;
1371                    case 'view2':
1372                        $('.rwd-cont').find('.rwd-bar').append(fullScreen);
1373                        break;
1374                    case 'view4':
1375                        $(fullScreen).insertBefore('.rwd-title');
1376                        break;
1377                }
1378                this.fullScreen();
1379            }
1380        }
1381    };
1382
1383    Modul.prototype.requestFullscreen = function() {
1384        var el = document.documentElement;
1385
1386        if (el.requestFullscreen) {
1387            el.requestFullscreen();
1388        } else if (el.msRequestFullscreen) {
1389            el.msRequestFullscreen();
1390        } else if (el.mozRequestFullScreen) {
1391            el.mozRequestFullScreen();
1392        } else if (el.webkitRequestFullscreen) {
1393            el.webkitRequestFullscreen();
1394        }
1395    };
1396
1397    Modul.prototype.exitFullscreen = function() {
1398        if (document.exitFullscreen) {
1399            document.exitFullscreen();
1400        } else if (document.msExitFullscreen) {
1401            document.msExitFullscreen();
1402        } else if (document.mozCancelFullScreen) {
1403            document.mozCancelFullScreen();
1404        } else if (document.webkitExitFullscreen) {
1405            document.webkitExitFullscreen();
1406        }
1407    };
1408
1409    Modul.prototype.fullScreen = function() {
1410        var $object = this;
1411
1412        $(document).on('fullscreenchange.rwd-container webkitfullscreenchange.rwd-container mozfullscreenchange.rwd-container MSFullscreenChange.rwd-container', function() {
1413            $('.rwd-cont').toggleClass('rwd-fullscreen-on');
1414        });
1415
1416        $('.rwd-cont').find('.rwd-fullscreen').on('click.rwd-container', function() {
1417            if (!document.fullscreenElement && !document.mozFullScreenElement && !document.webkitFullscreenElement && !document.msFullscreenElement) {
1418                $object.requestFullscreen();
1419            } else {
1420                $object.exitFullscreen();
1421            }
1422        });
1423
1424        $(window).on('keydown', function(e){
1425           if(e.keyCode === 27){
1426               console.log(1);
1427           }
1428        });
1429
1430    };
1431
1432    Modul.prototype.initFullWidth = function () {
1433        var $object = this,
1434            $fullWidth, $fullWidthOn;
1435
1436        $fullWidth = '<svg id="rwd-fullwidth" width="50px" height="25px" stroke="#999" fill="#999" x="0px" y="0px" viewBox="0 0 960 500" style="enable-background:new 0 0 960 560;">' +
1437            '<g><path d="M769.4,280L651.7,397.6l0.1-90.5L543.1,307l0-54.3l108.6,0.1l0.1-90.5L769.4,280z M416.4,306.9l-108.6-0.1l-0.1,90.5' +
1438            'L190.2,279.6L307.9,162l-0.1,90.5l108.6,0.1L416.4,306.9z M416.4,306.9"/></g></svg>';
1439
1440        $fullWidthOn = '<svg  id="rwd-fullwidth_on" width="50px" height="25px" stroke="#999" fill="#999" x="0px" y="0px" viewBox="0 0 960 500" style="enable-background:new 0 0 960 560;">' +
1441            '<path d="M516,280.3l117.3-118l0.3,90.5l108.6-0.3l0.2,54.3l-108.6,0.3l0.3,90.5L516,280.3z M217.3,252.8l108.6-0.3l-0.2-90.5' +
1442            'l117.9,117.4l-117.4,118l-0.2-90.5l-108.6,0.3L217.3,252.8z M416.4,306.9"/></svg>';
1443
1444        if (this.dataL.modulSettings.fullwidth) {
1445            var fullwidth = '<span class="rwd-fullwidth rwd-icon">' + $fullWidth + $fullWidthOn + '</span>';
1446            switch (hugeit_resp_lightbox_obj.hugeit_lightbox_lightboxView) {
1447                case 'view1':
1448                default:
1449                    this.dataL.$cont.find('.rwd-toolbar').append(fullwidth);
1450                    break;
1451                case 'view2':
1452                    this.dataL.$cont.find('.rwd-bar').append(fullwidth);
1453                    break;
1454                case 'view4':
1455                    $(fullwidth).insertBefore('.rwd-title');
1456                    break;
1457            }
1458
1459        }
1460
1461        if (this.dataL.modulSettings.fullwidth) {
1462            $('.rwd-fullwidth').on('click.rwd-container', function () {
1463                !$('.rwd-cont').hasClass('rwd-fullwidth-on') ? $object.onFullWidth() : $object.offFullWidth();
1464            });
1465        }
1466    };
1467
1468    Modul.prototype.onFullWidth = function () {
1469
1470        var $imageObject = this.dataL.$cont.find('.rwd-current .rwd-image');
1471
1472        $('#rwd-fullwidth').css({'display': 'none'});
1473        $('#rwd-fullwidth_on').css({'display': 'inline-block'});
1474
1475        $('.rwd-cont').addClass('rwd-fullwidth-on');
1476
1477        $('.rwd-container').css({
1478            width: '100%',
1479            height: '100%'
1480        });
1481
1482        var k = $imageObject.width() / $imageObject.height();
1483        if ($imageObject.width() > $imageObject.height() && k > 2) {
1484            $imageObject.css({
1485                'min-width': '100%'
1486            });
1487        } else {
1488            $imageObject.css({
1489                'min-height': '100%'
1490            });
1491        }
1492    };
1493
1494    Modul.prototype.offFullWidth = function () {
1495        var $imageObject = this.dataL.$cont.find('.rwd-current .rwd-image');
1496
1497        $('#rwd-fullwidth').css({'display': 'inline-block'});
1498        $('#rwd-fullwidth_on').css({'display': 'none'});
1499
1500        $('.rwd-cont').removeClass('rwd-fullwidth-on');
1501        $('.rwd-container').css({
1502            width: hugeit_resp_lightbox_obj.hugeit_lightbox_width_new + '%',
1503            height: hugeit_resp_lightbox_obj.hugeit_lightbox_height_new + '%'
1504        });
1505        $imageObject.css({
1506            'min-width': '',
1507            'min-height': ''
1508        });
1509    };
1510
1511    Modul.prototype.initZoom = function () {
1512
1513        var $object = this, zoomIcons,
1514            $zoomIn, $zoomOut, scale;
1515
1516        $zoomIn = '<svg id="zoom_in" width="20px" height="20px" stroke="#999" fill="#999" x="0px" y="0px" viewBox="-18 19 53 53" style="enable-background:new -18 19 53 53;">' +
1517            '<g><path d="M11,39H5v-6c0-0.6-0.4-1-1-1s-1,0.4-1,1v6h-6c-0.6,0-1,0.4-1,1s0.4,1,1,1h6v6c0,0.6,0.4,1,1,1s1-0.4,1-1v-6h6' +
1518            'c0.6,0,1-0.4,1-1S11.5,39,11,39z"/>' +
1519            '<path d="M33.7,70.3L18.8,54.9c3.8-3.8,6.1-9,6.1-14.8c0-11.6-9.4-21-21-21s-21,9.4-21,21s9.4,21,21,21c5.1,0,9.7-1.8,13.4-4.8' +
1520            'l14.9,15.5c0.2,0.2,0.5,0.3,0.7,0.3c0.3,0,0.5-0.1,0.7-0.3C34.1,71.3,34.1,70.7,33.7,70.3z M-15,40c0-10.5,8.5-19,19-19' +
1521            's19,8.5,19,19S14.5,59,4,59S-15,50.5-15,40z"/></g>' +
1522            '</svg>';
1523
1524        $zoomOut = '<svg id="zoom_out" width="20px" height="20px" stroke="#999" fill="#999" x="0px" y="0px" x="0px" y="0px" viewBox="-18 19 53 53" style="enable-background:new -18 19 53 53;">' +
1525            '<g><path d="M11,39H-3c-0.6,0-1,0.4-1,1s0.4,1,1,1h14c0.6,0,1-0.4,1-1S11.5,39,11,39z"/>' +
1526            '<path d="M33.7,70.3L18.8,54.9c3.8-3.8,6.1-9,6.1-14.8c0-11.6-9.4-21-21-21s-21,9.4-21,21s9.4,21,21,21c5.1,0,9.7-1.8,13.4-4.8' +
1527            'l14.9,15.5c0.2,0.2,0.5,0.3,0.7,0.3c0.3,0,0.5-0.1,0.7-0.3C34.1,71.3,34.1,70.7,33.7,70.3z M-15,40c0-10.5,8.5-19,19-19' +
1528            's19,8.5,19,19S14.5,59,4,59S-15,50.5-15,40z"/></g>' +
1529            '</svg>';
1530
1531        zoomIcons = '<span id="rwd-zoom-out" class="rwd-icon">' + $zoomOut + '</span><span id="rwd-zoom-in" class="rwd-icon">' + $zoomIn + '</span>';
1532
1533        switch (hugeit_resp_lightbox_obj.hugeit_lightbox_lightboxView) {
1534            case 'view1':
1535            default:
1536                this.dataL.$cont.find('.rwd-toolbar').append(zoomIcons);
1537                break;
1538            case 'view2':
1539                this.dataL.$cont.find('.rwd-bar').append(zoomIcons);
1540                break;
1541            case 'view4':
1542                $(zoomIcons).insertBefore('.rwd-title');
1543                break;
1544        }
1545
1546        scale = 1;
1547        function zoom(scaleVal) {
1548            var $imageObject, _x, _y, offsetX, offsetY, x, y;
1549
1550            $imageObject = $object.dataL.$cont.find('.rwd-current .rwd-image');
1551
1552            offsetX = ($(window).width() - $imageObject.width()) / 2;
1553            offsetY = (($(window).height() - $imageObject.height()) / 2) + $(window).scrollTop();
1554
1555            _x = $object.pageX - offsetX;
1556            _y = $object.pageY - offsetY;
1557
1558            x = _x;
1559            y = _y;
1560
1561            $imageObject.css('transform', 'scale3d(' + scaleVal + ', ' + scaleVal + ', 1)').attr('data-scale', scaleVal);
1562
1563            $imageObject.parent().css({
1564                transform: 'translate3d(0, ' + -y + 'px, 0)'
1565            }).attr('data-y', -y);
1566        }
1567
1568        function callScale() {
1569            if (scale > 1) {
1570                $object.dataL.$cont.addClass('rwd-zoomed');
1571            } else {
1572                $object.dataL.$cont.removeClass('rwd-zoomed');
1573            }
1574
1575            if (scale < 1) {
1576                scale = 1;
1577            }
1578
1579            zoom(scale);
1580        }
1581
1582        $(window).on('resize.rwd-container.zoom scroll.rwd-container.zoom orientationchange.rwd-container.zoom', function () {
1583            $object.pageX = $(window).width() / 2;
1584            $object.pageY = ($(window).height() / 2) + $(window).scrollTop();
1585            zoom(scale);
1586        });
1587
1588        $('#rwd-zoom-out').on('click.rwd-container', function () {
1589            if ($object.dataL.$cont.find('.rwd-current .rwd-image').length) {
1590                scale -= $object.dataL.modulSettings.scale;
1591                callScale();
1592            }
1593        });
1594
1595        $('#rwd-zoom-in').on('click.rwd-container', function () {
1596            if ($object.dataL.$cont.find('.rwd-current .rwd-image').length) {
1597                scale += $object.dataL.modulSettings.scale;
1598                callScale();
1599            }
1600        });
1601
1602        if (hugeit_resp_lightbox_obj.hugeit_lightbox_zoomlogo !== '0') {
1603            $object.dataL.$cont.dblclick(function () {
1604                if (!$object.dataL.$cont.hasClass('dbl-zoomed')) {
1605                    $object.dataL.$cont.addClass('dbl-zoomed');
1606                    if ($object.dataL.$cont.find('.rwd-current .rwd-image').length) {
1607                        scale += $object.dataL.modulSettings.scale;
1608                        callScale();
1609                    }
1610                } else {
1611                    $object.dataL.$cont.removeClass('dbl-zoomed');
1612                    if ($object.dataL.$cont.find('.rwd-current .rwd-image').length) {
1613                        scale -= $object.dataL.modulSettings.scale;
1614                        callScale();
1615                    }
1616                }
1617            });
1618        }
1619
1620        if (!('ontouchstart' in document.documentElement)) {
1621            $object.zoomDrag();
1622        }
1623
1624        if (('ontouchstart' in document.documentElement)) {
1625            $object.zoomSwipe();
1626        }
1627
1628    };
1629
1630    Modul.prototype.touchendZoom = function (startCoords, endCoords, abscissa, ordinate) {
1631
1632        var $object = this, _$el, $imageObject, distanceX, distanceY, maxX, maxY;
1633
1634        _$el = $object.dataL.$item.eq($object.dataL.index).find('.rwd-img-wrap');
1635        $imageObject = $object.dataL.$item.eq($object.dataL.index).find('.rwd-object');
1636        maxX = Math.abs($imageObject.outerWidth() * Math.abs($imageObject.attr('data-scale')) - $object.dataL.$cont.find('.rwd-container').width()) / 2;
1637        maxY = Math.abs($imageObject.outerHeight() * Math.abs($imageObject.attr('data-scale')) - $object.dataL.$cont.find('.rwd-container').height()) / 2 + $(window).scrollTop();
1638
1639        if (_$el.attr('data-x')) {
1640            distanceX = +_$el.attr('data-x') + (endCoords.x - startCoords.x);
1641        } else {
1642            distanceX = endCoords.x - startCoords.x;
1643        }
1644
1645        distanceY = +_$el.attr('data-y') + (endCoords.y - startCoords.y);
1646
1647        if ((Math.abs(endCoords.x - startCoords.x) > 15) || (Math.abs(endCoords.y - startCoords.y) > 15)) {
1648
1649            if (abscissa) {
1650                if (endCoords.x - startCoords.x < 0) {
1651                    if(distanceX <= -maxX){
1652                        distanceX = -maxX;
1653                    }
1654                } else {
1655                    if(distanceX >= maxX) {
1656                        distanceX = maxX;
1657                    }
1658                }
1659
1660                _$el.attr('data-x', distanceX);
1661            }
1662
1663            if (ordinate) {
1664                if (endCoords.y - startCoords.y < 0) {
1665                    if(distanceY <= -(maxY + ($object.pageY - ($(window).height() - $imageObject.height()) / 2)) + 2 * $(window).scrollTop()) {
1666                        distanceY = -(maxY + ($object.pageY - ($(window).height() - $imageObject.height()) / 2)) + 2 * $(window).scrollTop();
1667                    }
1668                } else {
1669                    if(distanceY >= maxY - ($object.pageY - ($(window).height() - $imageObject.height()) / 2)) {
1670                        distanceY = maxY - ($object.pageY - ($(window).height() - $imageObject.height()) / 2);
1671                    }
1672                }
1673
1674                _$el.attr('data-y', distanceY);
1675            }
1676
1677            _$el.css({
1678                transform: 'translate3d(' + distanceX + 'px, ' + distanceY + 'px, 0)'
1679            });
1680
1681        }
1682    };
1683
1684    Modul.prototype.zoomDrag = function () {
1685
1686        var $object = this,
1687            startCoords = {},
1688            endCoords = {},
1689            isDraging = false,
1690            isMoved = false,
1691            abscissa = false,
1692            ordinate = false;
1693
1694        $object.dataL.$item.on('mousedown.rwd-container.zoom', function (e) {
1695
1696            var $imageObject = $object.dataL.$item.eq($object.dataL.index).find('.rwd-object');
1697
1698            ordinate = $imageObject.outerHeight() * $imageObject.attr('data-scale') > $object.dataL.$cont.find('.rwd-container').height();
1699            abscissa = $imageObject.outerWidth() * $imageObject.attr('data-scale') > $object.dataL.$cont.find('.rwd-container').width();
1700
1701            if ($object.dataL.$cont.hasClass('rwd-zoomed')) {
1702                if ($(e.target).hasClass('rwd-object') && (abscissa || ordinate)) {
1703                    e.preventDefault();
1704                    startCoords = {
1705                        x: e.pageX,
1706                        y: e.pageY
1707                    };
1708
1709                    isDraging = true;
1710
1711                    $object.dataL.$cont.scrollLeft += 1;
1712                    $object.dataL.$cont.scrollLeft -= 1;
1713
1714                }
1715            }
1716        });
1717
1718        $(window).on('mousemove.rwd-container.zoom', function (e) {
1719            if (isDraging) {
1720                var _$el = $object.dataL.$item.eq($object.dataL.index).find('.rwd-img-wrap');
1721                var distanceX;
1722                var distanceY;
1723
1724                isMoved = true;
1725                endCoords = {
1726                    x: e.pageX,
1727                    y: e.pageY
1728                };
1729
1730                if (_$el.attr('data-x')) {
1731                    distanceX = +_$el.attr('data-x') + (endCoords.x - startCoords.x);
1732                } else {
1733                    distanceX = endCoords.x - startCoords.x;
1734                }
1735
1736                if (ordinate) {
1737                    distanceY = +_$el.attr('data-y') + (endCoords.y - startCoords.y);
1738                }
1739
1740                _$el.css({
1741                    transform: 'translate3d(' + distanceX + 'px, ' + distanceY + 'px, 0)'
1742                });
1743            }
1744        });
1745
1746        $(window).on('mouseup.rwd-container.zoom', function (e) {
1747
1748            if (isDraging) {
1749                isDraging = false;
1750
1751                if (isMoved && ((startCoords.x !== endCoords.x) || (startCoords.y !== endCoords.y))) {
1752                    endCoords = {
1753                        x: e.pageX,
1754                        y: e.pageY
1755                    };
1756                    $object.touchendZoom(startCoords, endCoords, abscissa, ordinate);
1757
1758                }
1759
1760                isMoved = false;
1761            }
1762
1763        });
1764    };
1765
1766    Modul.prototype.zoomSwipe = function () {
1767        var $object = this,
1768            startCoords = {},
1769            endCoords = {},
1770            isMoved = false,
1771            abscissa = false,                   ordinate = false;
1772
1773        $object.dataL.$item.on('touchstart.rwd-container', function (e) {
1774
1775            if ($object.dataL.$cont.hasClass('rwd-zoomed')) {
1776                var $imageObject = $object.dataL.$item.eq($object.dataL.index).find('.rwd-object');
1777
1778                ordinate = $imageObject.outerHeight() * $imageObject.attr('data-scale') > $object.dataL.$cont.find('.rwd-container').height();
1779                abscissa = $imageObject.outerWidth() * $imageObject.attr('data-scale') > $object.dataL.$cont.find('.rwd-container').width();
1780                if ((abscissa || ordinate)) {
1781                    e.preventDefault();
1782                    startCoords = {
1783                        x: e.originalEvent.targetTouches[0].pageX,
1784                        y: e.originalEvent.targetTouches[0].pageY
1785                    };
1786                }
1787            }
1788
1789        });
1790
1791        $object.dataL.$item.on('touchmove.rwd-container', function (e) {
1792
1793            if ($object.dataL.$cont.hasClass('rwd-zoomed')) {
1794
1795                var _$el = $object.dataL.$item.eq($object.dataL.index).find('.rwd-img-wrap');
1796                var distanceX;
1797                var distanceY;
1798
1799                e.preventDefault();
1800                isMoved = true;
1801
1802                endCoords = {
1803                    x: e.originalEvent.targetTouches[0].pageX,
1804                    y: e.originalEvent.targetTouches[0].pageY
1805                };
1806
1807                if (_$el.attr('data-x')) {
1808                    distanceX = +_$el.attr('data-x') + (endCoords.x - startCoords.x);
1809                } else {
1810                    distanceX = endCoords.x - startCoords.x;
1811                }
1812
1813                if (ordinate) {
1814                    distanceY = +_$el.attr('data-y') + (endCoords.y - startCoords.y);
1815                }
1816
1817                if ((Math.abs(endCoords.x - startCoords.x) > 15) || (Math.abs(endCoords.y - startCoords.y) > 15)) {
1818                    _$el.css({
1819                        transform: 'translate3d(' + distanceX + 'px, ' + distanceY + 'px, 0)'
1820                    });
1821                }
1822
1823            }
1824
1825        });
1826
1827        $object.dataL.$item.on('touchend.rwd-container', function () {
1828            if ($object.dataL.$cont.hasClass('rwd-zoomed')) {
1829                if (isMoved) {
1830                    isMoved = false;
1831                    $object.touchendZoom(startCoords, endCoords, abscissa, ordinate);
1832
1833                }
1834            }
1835        });
1836
1837    };
1838
1839    Modul.prototype.initThumbs = function() {
1840        var $object = this;
1841
1842        if (this.dataL.modulSettings.thumbnail === 'true' && this.dataL.$items.length > 1) {
1843
1844            if (this.dataL.modulSettings.showByDefault) {
1845                setTimeout(function(){
1846                    $object.dataL.$cont.addClass('rwd-thumb-open');
1847                }, 100);
1848            }
1849
1850            this.buildThumbs();
1851
1852            this.dataL.effectsSupport() && this.enableThumbDrag();
1853
1854            this.activatedThumbs = false;
1855
1856            if ($object.dataL.modulSettings.toogleThumb) {
1857                $object.$thumbCont.append('<span class="rwd-toggle-thumb rwd-icon"></span>');
1858                $object.dataL.$cont.find('.rwd-toggle-thumb').on('click.rwd-container', function() {
1859                    $object.dataL.$cont.toggleClass('rwd-thumb-open');
1860                });
1861            }
1862        }
1863
1864        $('.rwd-container .rwd-thumb-item').css({
1865            background: '#' + this.dataL.modulSettings.thumbsOverlayColor
1866        });
1867        $('.rwd-container .rwd-thumb-item img').css({
1868            opacity: 1 - +this.dataL.modulSettings.thumbsOverlayOpacity / 100
1869        });
1870
1871        $('.rwd-thumb-cont').css({
1872            bottom: -$object.dataL.modulSettings.thumbsHeight + 'px'
1873        });
1874
1875        if (this.dataL.modulSettings.showByDefault) {
1876            var $cont_ = $('.cont-inner'),
1877                $thumb_ = $('.rwd-thumb-cont'),
1878                $toolbar_ = $('.rwd-toolbar');
1879            setTimeout(function(){
1880                switch($object.dataL.settings.lightboxView){
1881                    case 'view1':
1882                        switch($object.dataL.modulSettings.thumbPosition){
1883                            case '0':
1884                                $cont_.css({
1885                                    height: 'calc(100% - ' + ($object.dataL.modulSettings.thumbsHeight + 92) + 'px)',
1886                                    top: '47px'
1887                                });
1888                                $thumb_.css({
1889                                    bottom: '0',
1890                                    backgroundColor: 'rgba(0,0,0,.9)'
1891                                });
1892                                $('.rwd-bar > *').css({
1893                                    bottom: $object.dataL.modulSettings.thumbsHeight + 'px'
1894                                });
1895                                break;
1896                            case '1':
1897                                $cont_.css({
1898                                    height: 'calc(100% - ' + ($object.dataL.modulSettings.thumbsHeight + 92) + 'px)',
1899                                    top: $object.dataL.modulSettings.thumbsHeight + 47 + 'px'
1900                                });
1901                                $thumb_.css({
1902                                    top: '47px',
1903                                    backgroundColor: 'rgba(0,0,0,.9)'
1904                                });
1905                                break;
1906                        }
1907                        break;
1908                    case 'view2':
1909                        switch($object.dataL.modulSettings.thumbPosition) {
1910                            case '0':
1911                                $cont_.css({
1912                                    height: 'calc(100% - ' + ($object.dataL.modulSettings.thumbsHeight + 92) + 'px)',
1913                                    top: '45px'
1914                                });
1915                                $thumb_.css({
1916                                    bottom: '45px',
1917                                    backgroundColor: 'rgba(0,0,0,.9)'
1918                                });
1919                                break;
1920                            case '1':
1921                                $cont_.css({
1922                                    height: 'calc(100% - ' + ($object.dataL.modulSettings.thumbsHeight + 92) + 'px)',
1923                                    top: $object.dataL.modulSettings.thumbsHeight + 45 + 'px'
1924                                });
1925                                $thumb_.css({
1926                                    top: '0',
1927                                    backgroundColor: 'rgba(0,0,0,.9)'
1928                                });
1929                                $toolbar_.css({
1930                                    top: $object.dataL.modulSettings.thumbsHeight + 'px'
1931                                });
1932                                break;
1933                        }
1934                        break;
1935                    case 'view3':
1936                        switch($object.dataL.modulSettings.thumbPosition) {
1937                            case '0':
1938                                $cont_.css({
1939                                    height: 'calc(100% - ' + ($object.dataL.modulSettings.thumbsHeight + 92) + 'px)',
1940                                    top: '47px'
1941                                });
1942                                $thumb_.css({
1943                                    bottom: '0',
1944                                    backgroundColor: 'white'
1945                                });
1946                                $('.rwd-title').css({
1947                                    bottom: $object.dataL.modulSettings.thumbsHeight + 'px'
1948                                });
1949                                break;
1950                            case '1':
1951                                $cont_.css({
1952                                    height: 'calc(100% - ' + ($object.dataL.modulSettings.thumbsHeight + 93) + 'px)',
1953                                    top: ($object.dataL.modulSettings.thumbsHeight + 48) + 'px'
1954                                });
1955                                $thumb_.css({
1956                                    top: '48px',
1957                                    backgroundColor: 'white'
1958                                });
1959                                break;
1960                        }
1961                        break;
1962                    case 'view4':
1963                        switch($object.dataL.modulSettings.thumbPosition) {
1964                            case '0':
1965                                $cont_.css({
1966                                    height: 'calc(100% - ' + ($object.dataL.modulSettings.thumbsHeight + 92) + 'px)'
1967                                });
1968                                $thumb_.css({
1969                                    bottom: '0',
1970                                    backgroundColor: 'none'
1971                                });
1972                                $('.rwd-socialIcons').css({
1973                                    bottom: ($object.dataL.modulSettings.thumbsHeight - 10) + 'px'
1974                                });
1975                                $('.barCont').css({
1976                                    bottom: $object.dataL.modulSettings.thumbsHeight + 'px'
1977                                });
1978                                $('#rwd-counter').css({
1979                                    bottom: ($object.dataL.modulSettings.thumbsHeight + 5) + 'px'
1980                                });
1981                                $('.rwd-item').css({
1982                                    top: '47px'
1983                                });
1984                                break;
1985                            case '1':
1986                                $cont_.css({
1987                                    height: 'calc(100% - ' + ($object.dataL.modulSettings.thumbsHeight + 90) + 'px)',
1988                                    top: $object.dataL.modulSettings.thumbsHeight + 45 + 'px'
1989                                });
1990                                $thumb_.css({
1991                                    top: '45px',
1992                                    backgroundColor: 'none'
1993                                });
1994                                break;
1995                        }
1996                        break;
1997                    case 'view5':
1998                    case 'view6':
1999                        switch($object.dataL.modulSettings.thumbPosition) {
2000                            case '0':
2001                                $cont_.css({
2002                                    height: 'calc(100% - ' + $object.dataL.modulSettings.thumbsHeight + 'px)'
2003                                });
2004                                $thumb_.css({
2005                                    bottom: '0'
2006                                });
2007                                break;
2008                            case '1':
2009                                $cont_.css({
2010                                    height: 'calc(100% - ' + $object.dataL.modulSettings.thumbsHeight + 'px)',
2011                                    top: $object.dataL.modulSettings.thumbsHeight + 'px'
2012                                });
2013                                $thumb_.css({
2014                                    top: '0'
2015                                });
2016                                break;
2017                        }
2018                        break;
2019                }
2020            }, 100);
2021        }
2022    };
2023
2024    Modul.prototype.buildThumbs = function() {
2025        var $object = this;
2026        var thumbList = '';
2027        var vimeoErrorThumbSize = '';
2028        var $thumb;
2029        var html = '<div class="rwd-thumb-cont">' +
2030            '<div class="rwd-thumb group">' +
2031            '</div>' +
2032            '</div>';
2033
2034        vimeoErrorThumbSize = '100x75';
2035
2036        $object.dataL.$cont.addClass('rwd-has-thumb');
2037
2038        $object.dataL.$cont.find('.rwd-container').append(html);
2039
2040        $object.$thumbCont = $object.dataL.$cont.find('.rwd-thumb-cont');
2041        $object.thumbContWidth = $object.$thumbCont.width();
2042
2043        $object.dataL.$cont.find('.rwd-thumb').css({
2044            width: $object.thumbTotalWidth + 'px',
2045            position: 'relative'
2046        });
2047
2048        $object.$thumbCont.css('height', $object.dataL.modulSettings.thumbsHeight + 'px');
2049
2050        function getThumb(src, thumb, index) {
2051            var isVideo = $object.dataL.isVideo(src, index) || {};
2052            var thumbImg;
2053            var vimeoId = '';
2054
2055            if (isVideo.youtube || isVideo.vimeo || isVideo.dailymotion) {
2056                if (isVideo.youtube) {
2057                    thumbImg = '//img.youtube.com/vi/' + isVideo.youtube[1] + '/1.jpg';
2058                } else if (isVideo.vimeo) {
2059                    thumbImg = '//i.vimeocdn.com/video/error_' + vimeoErrorThumbSize + '.jpg';
2060                    vimeoId = isVideo.vimeo[1];
2061                } else if (isVideo.dailymotion) {
2062                    thumbImg = '//www.dailymotion.com/thumbnail/video/' + isVideo.dailymotion[2];
2063                }
2064            } else {
2065                thumbImg = thumb;
2066            }
2067
2068            thumbList += '<div data-vimeo-id="' + vimeoId + '" class="rwd-thumb-item" style="width:' + $object.dataL.modulSettings.thumbsWidth + 'px; margin-right: ' + $object.dataL.modulSettings.thumbMargin + 'px"><img src="' + thumbImg + '" /></div>';
2069            vimeoId = '';
2070        }
2071
2072        $object.dataL.$items.each(function(i) {
2073
2074            getThumb($(this).attr('href') || $(this).attr('data-src'), $(this).find('img').attr('src'), i);
2075
2076        });
2077
2078        $object.dataL.$cont.find('.rwd-thumb').html(thumbList);
2079
2080        $thumb = $object.dataL.$cont.find('.rwd-thumb-item');
2081
2082        $thumb.each(function() {
2083            var $this = $(this);
2084            var vimeoVideoId = $this.attr('data-vimeo-id');
2085
2086            if (vimeoVideoId) {
2087                $.getJSON('//www.vimeo.com/api/v2/video/' + vimeoVideoId + '.json?callback=?', {
2088                    format: 'json'
2089                }, function(data) {
2090                    $this.find('img').attr('src', data[0]['thumbnail_small']);
2091                });
2092            }
2093        });
2094
2095        $thumb.eq($object.dataL.index).addClass('active');
2096        $object.dataL.$element.on('onBeforeSlide.rwd-container', function() {
2097            $thumb.removeClass('active');
2098            $thumb.eq($object.dataL.index).addClass('active');
2099        });
2100
2101        $thumb.on('click.rwd-container touchend.rwd-container', function() {
2102            var _$this = $(this);
2103            setTimeout(function() {
2104                if ($object.activatedThumbs || !$object.dataL.effectsSupport()) {
2105                    $object.dataL.index = _$this.index();
2106                    $object.dataL.slide($object.dataL.index, false, true);
2107                    $('.rwd-thumb').removeClass('thumb_move');
2108                }
2109            }, 50);
2110        });
2111
2112        $object.dataL.$element.on('onBeforeSlide.rwd-container', function() {
2113            $object.animateThumb($object.dataL.index);
2114        });
2115
2116        $(window).on('resize.rwd-container.thumb orientationchange.rwd-container.thumb', function() {
2117            setTimeout(function() {
2118                $object.animateThumb($object.dataL.index);
2119                $object.thumbContWidth = $object.$thumbCont.width();
2120            }, 200);
2121        });
2122
2123    };
2124
2125    Modul.prototype.animateThumb = function(index) {
2126        var $thumb = this.dataL.$cont.find('.rwd-thumb'),
2127            position = (this.thumbContWidth / 2) - (this.dataL.modulSettings.thumbsWidth / 2);
2128
2129        this.left = ((this.dataL.modulSettings.thumbsWidth + this.dataL.modulSettings.thumbMargin) * index - 1) - position;
2130        if (this.left > (this.thumbTotalWidth - this.thumbContWidth)) {
2131            this.left = this.thumbTotalWidth - this.thumbContWidth;
2132        }
2133
2134        if (this.left < 0) {
2135            this.left = 0;
2136        }
2137        
2138        if (!$thumb.hasClass('on')) {
2139            this.dataL.$cont.find('.rwd-thumb').css('transition-duration', this.dataL.modulSettings.speed + 'ms');
2140        }
2141
2142        if (!this.dataL.effectsSupport()) {
2143            $thumb.animate({
2144                left: -this.left + 'px'
2145            }, this.dataL.modulSettings.speed);
2146        }
2147            
2148        if(!$('.rwd-thumb').hasClass('thumb_move')){
2149            this.dataL.$cont.find('.rwd-thumb').css({
2150                transform: 'translate3d(-' + (this.left) + 'px, 0px, 0px)'
2151            });
2152        }
2153    };
2154
2155    Modul.prototype.enableThumbDrag = function() {
2156
2157        var $object = this,
2158            startCoords = 0,
2159            endCoords = 0,
2160            isDraging = false,
2161            isMoved = false,
2162            tempLeft = 0,
2163            $left_ = ((this.dataL.modulSettings.thumbsWidth + this.dataL.modulSettings.thumbMargin) * $object.dataL.index - 1) - (this.thumbContWidth / 2) - (this.dataL.modulSettings.thumbsWidth / 2);
2164
2165        $('.rwd-thumb').attr('data-left', $left_);
2166
2167        $object.dataL.$cont.find('.rwd-thumb').on('mousedown.rwd-container.thumb', function(e) {
2168            if ($object.thumbTotalWidth > $object.thumbContWidth) {
2169                e.preventDefault();
2170                startCoords = e.pageX;
2171                isDraging = true;
2172
2173                $object.dataL.$cont.scrollLeft += 1;
2174                $object.dataL.$cont.scrollLeft -= 1;
2175
2176                $object.activatedThumbs = false;
2177            }
2178        });
2179
2180        $(window).on('mousemove.rwd-container.thumb', function(e) {
2181            if (isDraging) {
2182                tempLeft = +$('.rwd-thumb').attr('data-left');                isMoved = true;
2183                endCoords = e.pageX;
2184
2185                if(Math.abs(endCoords - startCoords) > 0 && $('.rwd-cont').hasClass('rwd-show-autoplay')){
2186                    $('.rwd-thumb').addClass('thumb_move');
2187                }
2188
2189                tempLeft = tempLeft - (endCoords - startCoords);
2190
2191                if (tempLeft > ($object.thumbTotalWidth - $object.thumbContWidth)) {
2192                    tempLeft = $object.thumbTotalWidth - $object.thumbContWidth;
2193                }
2194
2195                if (tempLeft < 0) {
2196                    tempLeft = 0;
2197                }
2198
2199                $object.dataL.$cont.find('.rwd-thumb').css({
2200                    transform: 'translate3d(-' + (tempLeft) + 'px, 0px, 0px)'
2201                });
2202            }
2203        });
2204
2205        $(window).on('mouseup.rwd-container.thumb', function() {
2206            if (isMoved) {
2207                isMoved = false;
2208
2209                $('.rwd-thumb').attr('data-left', tempLeft);
2210
2211            } else {
2212                $object.activatedThumbs = true;
2213            }
2214
2215            if (isDraging) {
2216                isDraging = false;
2217            }
2218        });
2219
2220    };
2221
2222    Modul.prototype.destroy = function () {
2223        var $object = this;
2224
2225        $(window).off('.rwd-container.zoom');
2226        $('.rwd-cont').removeClass('rwd-zoomed');
2227        clearTimeout($object.zoomabletimeout);
2228        $object.zoomabletimeout = false;
2229
2230        if (hugeit_resp_lightbox_obj.hugeit_lightbox_thumbs === 'true') {
2231            $(window).off('resize.rwd-container.thumb orientationchange.rwd-container.thumb keydown.rwd-container.thumb');
2232            $('.rwd-cont').removeClass('rwd-has-thumb');
2233            $('.cont-inner').css({
2234                height: '100%'
2235            });
2236        }
2237
2238        $object.exitFullscreen();
2239        $(document).off('fullscreenchange.rwd-container webkitfullscreenchange.rwd-container mozfullscreenchange.rwd-container MSFullscreenChange.rwd-container');
2240    };
2241
2242    $.fn.lightbox.lightboxModul.modul = Modul;
2243
2244    var WaterMark = function (element) {
2245        this.element = element;
2246        this.settings = $.extend({}, this.constructor.defaults);
2247        this.init();
2248    };
2249
2250    WaterMark.defaults = {
2251        imgSrc: hugeit_gen_resp_lightbox_obj.hugeit_lightbox_watermark_img_src_new,
2252        text: hugeit_gen_resp_lightbox_obj.hugeit_lightbox_watermark_text,
2253        textColor: '#' + hugeit_gen_resp_lightbox_obj.hugeit_lightbox_watermark_textColor,
2254        textFontSize: +hugeit_gen_resp_lightbox_obj.hugeit_lightbox_watermark_textFontSize,
2255        containerBackground: hugeit_gen_resp_lightbox_obj.hugeit_lightbox_watermark_container_bg_color,
2256        containerWidth: +hugeit_gen_resp_lightbox_obj.hugeit_lightbox_watermark_containerWidth,
2257        position: 'pos' + hugeit_gen_resp_lightbox_obj.hugeit_lightbox_watermark_position_new,
2258        opacity: +hugeit_gen_resp_lightbox_obj.hugeit_lightbox_watermark_opacity / 100,
2259        margin: +hugeit_gen_resp_lightbox_obj.hugeit_lightbox_watermark_margin,
2260        done: function (imgURL) {
2261            this.dataset.src = imgURL;
2262        }
2263    };
2264
2265    WaterMark.prototype.init = function () {
2266        var $object = this,
2267            $elem = $object.element,
2268            $settings = $object.settings,
2269            wmData = {},
2270            imageData = {};
2271
2272        var WatermarkImage = jQuery('<img />');
2273        WatermarkImage.attr('src', $object.settings.imgSrc);
2274        WatermarkImage.css('display', 'none').attr('id', 'huge_it_watermark_img_sample');
2275        if (!jQuery('body').find('#huge_it_watermark_img_sample').length) {
2276            jQuery('body').append(WatermarkImage);
2277        }
2278
2279        wmData = {
2280            imgurl: $settings.imgSrc,
2281            type: 'jpeg'
2282        };
2283
2284        imageData = {
2285            imgurl: $elem.dataset.imgsrc
2286        };
2287
2288        var defer = $.Deferred();
2289
2290        $.when(defer).done(function (imgObj) {
2291            imageData.$wmObject = imgObj;
2292
2293            $object.imgurltodata(imageData, function (dataURL) {
2294                $settings.done.call($elem, dataURL);
2295            });
2296        });
2297
2298        if ($settings.text !== '') {
2299            wmData.imgurl = $object.textwatermark();
2300        }
2301
2302        $object.imgurltodata(wmData, function (imgObj) {
2303            defer.resolve(imgObj);
2304        });
2305    };
2306
2307    WaterMark.prototype.textwatermark = function () {
2308        var $object = this,
2309            $settings,
2310            canvas,
2311            context,
2312            $width,
2313            $height;
2314
2315        $settings = $object.settings;
2316        canvas = document.createElement('canvas');
2317        context = canvas.getContext('2d');
2318
2319        $width = $settings.containerWidth;
2320        $height = $settings.textFontSize;
2321
2322        canvas.width = $width;
2323        canvas.height = $height;
2324
2325        context.fillStyle = $settings.containerBackground;
2326        context.fillRect(0, 0, $width, $height);
2327
2328        context.fillStyle = $settings.textColor;
2329        context.textAlign = 'center';
2330        context.font = '500 ' + $settings.textFontSize + 'px Sans-serif';
2331
2332        context.fillText($settings.text, ($width / 2), ($height - 5));
2333
2334        return canvas.toDataURL();
2335    };
2336
2337    WaterMark.prototype.imgurltodata = function (data, callback) {
2338        var $object = this,
2339            $settings = $object.settings,
2340            img;
2341
2342        img = new Image();
2343        img.setAttribute('crossOrigin', 'anonymous');
2344        img.onload = function () {
2345
2346            var canvas = document.createElement('canvas'),
2347                context = canvas.getContext('2d'),
2348
2349                $imgWidth = this.width,
2350                $imgHeight = this.height;
2351
2352            if (data.$wmObject) {
2353
2354                if (data.width !== 'auto' && data.height === 'auto' && data.width < $imgWidth) {
2355                    $imgHeight = $imgHeight / $imgWidth * data.width;
2356                    $imgWidth = data.width;
2357                } else if (data.width === 'auto' && data.height !== 'auto' && data.height < $imgHeight) {
2358                    $imgWidth = $imgWidth / $imgHeight * data.height;
2359                    $imgHeight = data.height;
2360                } else if (data.width !== 'auto' && data.height !== 'auto' && data.width < $imgWidth && data.height < $imgHeight) {
2361                    $imgWidth = data.width;
2362                    $imgHeight = data.height;
2363                }
2364
2365            }
2366
2367
2368            canvas.width = $imgWidth;
2369            canvas.height = $imgHeight;
2370
2371            /*if (data.type === 'jpeg') {
2372             context.fillStyle = '#ffffff';
2373             context.fillRect(0, 0, $imgWidth, $imgHeight);
2374             }*/
2375
2376            context.drawImage(this, 0, 0, $imgWidth, $imgHeight);
2377
2378            if (data.$wmObject) {
2379
2380                var $opacity = +hugeit_gen_resp_lightbox_obj.hugeit_lightbox_watermark_containerOpacity / 100;
2381                if ($opacity >= 0 && $opacity <= 1) {
2382                    //context.globalAlpha = $settings.opacity;
2383                    context.globalAlpha = $opacity;
2384                }
2385
2386                var $wmWidth,
2387                    $wmHeight,
2388                    pos = $settings.margin,
2389                    $x, $y;
2390                if ($settings.text !== '') {
2391                    $wmWidth = data.$wmObject.width;
2392                    $wmHeight = data.$wmObject.height;
2393                }
2394                else {
2395                    $wmWidth = $settings.containerWidth;
2396                    $wmHeight = (jQuery('img#huge_it_watermark_img_sample').prop('naturalHeight') * $wmWidth) / jQuery('img#huge_it_watermark_img_sample').prop('naturalWidth');
2397                }
2398
2399                switch ($settings.position) {
2400                    case 'pos1':
2401                        $x = pos;
2402                        $y = pos;
2403                        break;
2404                    case 'pos2':
2405                        $x = $imgWidth / 2 - $wmWidth / 2;
2406                        $y = pos;
2407                        break;
2408                    case 'pos3':
2409                        $x = $imgWidth - $wmWidth - pos;
2410                        $y = pos;
2411                        break;
2412                    case 'pos4':
2413                        $x = pos;
2414                        $y = $imgHeight / 2 - $wmHeight / 2;
2415                        break;
2416                    case 'pos5':
2417                        $x = $imgWidth / 2 - $wmWidth / 2;
2418                        $y = $imgHeight / 2 - $wmHeight / 2;
2419                        break;
2420                    case 'pos6':
2421                        $x = $imgWidth - $wmWidth - pos;
2422                        $y = $imgHeight / 2 - $wmHeight / 2;
2423                        break;
2424                    case 'pos7':
2425                        $x = pos;
2426                        $y = $imgHeight - $wmHeight - pos;
2427                        break;
2428                    case 'pos8':
2429                        $x = $imgWidth / 2 - $wmWidth / 2;
2430                        $y = $imgHeight - $wmHeight - pos;
2431                        break;
2432                    case 'pos9':
2433                        $x = $imgWidth - $wmWidth - pos;
2434                        $y = $imgHeight - $wmHeight - pos;
2435                        break;
2436                    default:
2437                        $x = $imgWidth - $wmWidth - pos;
2438                        $y = $imgHeight - $wmHeight - pos;
2439                }
2440                context.drawImage(data.$wmObject, $x, $y, $wmWidth, $wmHeight);
2441            }
2442
2443            var dataURL = canvas.toDataURL('image/' + data.type);
2444
2445            if (typeof callback === 'function') {
2446
2447                if (data.$wmObject) {
2448                    callback(dataURL);
2449
2450                } else {
2451                    var $wmNew = new Image();
2452                    $wmNew.src = dataURL;
2453                    callback($wmNew);
2454                }
2455            }
2456
2457            canvas = null;
2458        };
2459
2460        img.src = data.imgurl;
2461    };
2462
2463    $.fn['watermark'] = function () {
2464        return this.each(function () {
2465            if (!$.data(this, 'watermark')) {
2466                $.data(this, 'watermark', new WaterMark(this));
2467            }
2468        });
2469    };
2470
2471})(jQuery);

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.