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