1'use strict';(function($){var Galleries=function($element,data){return{currentItem:0,gallery:$element,galleryTitle:$element.find('.photo-gallery-title .content'),galleryCounter:$element.find('.photo-gallery-counter'),thumbSlider:$element.find('.thumbnails'),thumbs:$element.find('.thumbnails .item'),thumbsTemplate:undefined,galleryArea:$element.find('.gallery-area'),gallerySelector:$element.find('.gallery-selector'),gallerySelectorWrapper:$element.find('.gallery-selector .gallery-selector-wrapper'),gallerySelectorTpl:$element.find('.gallery-selector [data-template]'),isVertical:$element.is('[data-gallery-position="vertical"]'),slides:undefined,templates:$element.find('[data-template]','.slide-container'),slideContainer:$element.find('.slide-container'),controllers:$element.find('.gallery-area [data-controller]'),timeout:$element.data('gallery-timeout'),timer:undefined,maxHeightEl:undefined,data:data,enableTimeout:!0,defaultThumb:$element.data('default-thumbnail')||'http://placehold.it/135x75',fixedHeight:!1,hasThumbnails:function(){var doIHave=!!this.thumbSlider.length;if(doIHave){doIHave=doIHave&&!!this.data[this.currentGallery||0].media.length;if(!doIHave){this.thumbSlider.empty()}} 2return doIHave},hasSlides:function(){return!!this.slideContainer.length},hasGallerySelector:function(){return!!this.gallerySelector.length&&this.data.length>1},resizeAfterLoad:function(){var me=this,media=this.activeSlide.find('img, iframe, object, .jwplayer');if(media.length){try{var iframe=media[0].contentDocument||(media[0].contentWindow&&media[0].contentWindow.document);
2if(media[0].complete||(iframe&&iframe.readyState==='complete')||media.is('object')||media.hasClass('jwplayer')){me.updateMaxHeight()}else{media.on('load',function(){me.updateMaxHeight()})}}catch(e){me.updateMaxHeight()}}},setMaxHeight:function(){if(!this.hasSlides()){return} 3var height=0,gallery=this;if(this.fixedHeight){this.slides.each(function(){var slideHeight=$(this).outerHeight();if(slideHeight>height){height=slideHeight;gallery.maxHeightEl=$(this)}});this.updateMaxHeight()}else{if(this.activeSlide.length){this.maxHeightEl=this.activeSlide;this.resizeAfterLoad()}}},updateMaxHeight:function(){if(!this.maxHeightEl){return} 4var me=this;this.maxHeightEl.css({height:'auto','min-height':0});var height=this.maxHeightEl.outerHeight();this.slideContainer.css({height:height});this.slides.each(function(){$(this).css({height:height})});if(this.hasGallerySelector()){setTimeout(function(){me.setSelectorSliderWidth();me.slideToCurrentGallery();me.setMaxHeight()},250)}else{setTimeout(function(){me.setMaxHeight()},250)}},setTimeout:function(){if(!this.timeout){return} 5var me=this;this.clearTimeout();this.timer=setInterval(function(){me.next()},this.timeout)},setSliderWidth:function(collection,container,vertical){if(!vertical){var width=0;collection.each(function(){width+=$(this).outerWidth()});container.css({width:width+100})}else{var height=0;collection.each(function(){height+=$(this).outerHeight(!0)});container.css({height:height})}},clearTimeout:function(){clearInterval(this.timer)},attachGalleryEvents:function(){var me=this;this.gallery.on('gallery:next',function(){me.haveToClear=!1;me.next()}).on('gallery:next-gallery',function(){me.nextGallery()}).on('gallery:prev-gallery',function(){me.prevGallery()}).on('gallery:prev',function(){me.haveToClear=!1;me.prev()}).on('gallery:rebuild',function(){me.buildGallery()}).on('mouseenter',function(){me.resetViewport();if(me.timeout&&me.enableTimeout){me.clearTimeout()}}).on('mouseleave',function(){me.cleanViewport();if(me.timeout&&me.enableTimeout){me.setTimeout()}}).on('click','.thumbnails .item',function(ev){ev.preventDefault();ev.stopPropagation();me.moveTo($(this).index())}).on('click','[data-controller]',function(ev){ev.preventDefault();ev.stopPropagation();var action=$(this).data('controller');if(action){me.gallery.trigger('gallery:'+action)}}).on('click','.gallery-selector-item',function(ev){ev.preventDefault();ev.stopPropagation();me.loadGallery($(this).data('gallery-index'))}).on('jwplayer:playing','.jwplayer',function(){me.clearTimeout();me.enableTimeout=!1;me.haveToClear=!0;return!0}).on('jwplayer:stoped','.jwplayer',function(){me.enableTimeout=!0;me.haveToClear=!1;me.setTimeout();me.resetViewport();return!0});if(window.Hammer){var touchEvents=new Hammer(this.gallery[0]);touchEvents.on('swipeleft',function(){me.prev()}).on('swiperight',function(){me.next()})}},cleanViewport:function(){if(this.haveToClear){this.gallery.addClass('clear-viewport');this.gallery.addClass('clear-viewport-full')}else{this.resetViewport()}},resetViewport:function(){this.gallery.removeClass('clear-viewport');if(!this.haveToClear){this.gallery.removeClass('clear-viewport-full')}},showInMain:function(index){this.mainView.empty().append(this.thumbs[index].clone())},slideTo:function(index,collection,wrapper,vertical){var thumb=collection.filter(':eq('+index+')'),offset;if(!vertical){var wrapperWidth=wrapper.parent().width();offset=(wrapperWidth)-(thumb.position().left+thumb.outerWidth());if(offset<0){wrapper.css({left:offset})}else{wrapper.css({left:0})}}else{var wrapperHeight=wrapper.parent().outerHeight();offset=(wrapperHeight)-(thumb.position().top+thumb.outerHeight(!0));if(offset<0){wrapper.css({top:offset})}else{wrapper.css({top:0})}}},makeActive:function(index){if(this.hasThumbnails()){this.thumbs.removeClass('active').filter(':eq('+index+')').addClass('active')} 6if(this.hasSlides()){var oldHeight=0;if(this.activeSlide){oldHeight=this.activeSlide.outerHeight()} 7this.activeSlide=this.slides.removeClass('active').filter(':eq('+index+')').addClass('active');if(!this.fixedHeight){this.activeSlide.css({'min-height':oldHeight});this.setMaxHeight()}} 8if(this.hasThumbnails()){this.slideTo(index,this.thumbs,this.thumbSlider)}},next:function(){this.currentItem+=1;if(this.currentItem>=this.slides.length){this.currentItem=0} 9this.makeActive(this.currentItem)},prev:function(){this.currentItem-=1;if(this.currentItem<0){this.currentItem=this.slides.length-1} 10this.makeActive(this.currentItem)},nextGallery:function(){this.currentGallery+=1;if(this.currentGallery>=this.data.length){this.currentGallery=0} 11this.loadGallery(this.currentGallery,!0)},prevGallery:function(){this.currentGallery-=1;if(this.currentGallery<0){this.currentGallery=this.data.length-1} 12this.loadGallery(this.currentGallery,!0)},moveTo:function(pos){this.currentItem=pos;this.makeActive(this.currentItem)},parseTemplate:function(tpl,data){var result=tpl.replace(/x-src/g,'src').replace('data-template=""','').replace(/x-srcset/g,'srcset');$.each(data,function(key,val){result=result.replace(new RegExp('\\{\\[\\s*'+key+'\\s*\\]\\}','g'),val)});return result},loadSlides:function(gallery,data){if(!this.hasSlides()){return} 13var me=this;
13this.slideContainer.find('[data-slide]').remove();$.each(data.media,function(){var template=me.parseTemplate(gallery.templates[this.type],this);var $template=$(template);gallery.slideContainer.append($template);if(this.type=='Video'){var idVideo=me.gallery[0].id+'_v'+this.idAdjunto;var vidElem=document.getElementById(idVideo);var enableVideoMetrix=!1;var c2='';if(vidElem.dataset.c2){enableVideoMetrix=!0;c2=vidElem.dataset.c2} 14var $src=this.url;var type="";if($src.search(/youtu(\.)?be/)==-1){if($src.search(/\.m3u8$/)==-1){type='video/mp4'}else{type='application/x-mpegURL'}}else{type='video/youtube'} 15if(window['player_'+idVideo]!==undefined){videojs(idVideo).dispose()} 16window['player_'+idVideo]=undefined;console.log('player_'+idVideo);console.log(window['player_'+idVideo]);if(window['player_'+idVideo]===undefined){window['player_'+idVideo]=videojs(idVideo,{techOrder:["html5","youtube"],autoplay:!1,poster:this.thumbnail,youtube:{"ytControls":2},sources:[{type:type,src:$src}]});var preroll='vastPreRoll_'+me.gallery[0].id;if(window[preroll]){var options={id:idVideo,debug:!0,adTagUrl:window[preroll],vpaidMode:google.ima.ImaSdkSettings.VpaidMode.INSECURE};console.log(options);console.log('player_'+idVideo);window['player_'+idVideo].ima(options)} 17if(enableVideoMetrix){var comscorePlugin=window['player_'+idVideo].ComScore({'publisherId':c2})}}}});gallery.slides=this.slideContainer.children('[data-slide]')},loadThumbs:function(gallery,data){if(!this.hasThumbnails()){return} 18var me=this,container=gallery.thumbSlider;container.empty();$.each(data.media,function(){var template=me.parseTemplate(gallery.thumbsTemplate,this);container.append(template)});gallery.thumbs=container.children();if(data.media.length>1){container.show()}else{container.hide()}},loadGalleryTitle:function(data){if(this.galleryTitle.length){this.galleryTitle.text(data.title);this.galleryTitle.parent().attr({'href':data.link,'target':data.linkTarget})} 19if(this.galleryCounter.length){this.galleryCounter.text(data.media.length)}},slideToCurrentGallery:function(){this.slideTo(this.currentGallery,this.gallerySelectorWrapper.children(),this.gallerySelectorWrapper,this.isVertical)},loadGallery:function(index,force){if(index===this.currentGallery&&!force){return} 20var data=this.data[index];this.currentGallery=index;this.currentItem=0;this.loadGalleryTitle(data);if(data.media.length<2){this.controllers.hide()}else{this.controllers.show()} 21this.loadSlides(this,data);this.loadThumbs(this,data);if(this.hasThumbnails()){this.setSliderWidth(this.thumbs,this.thumbSlider)} 22this.makeActive(this.currentItem);this.currentItem=0},loadTemplate:function(tpl){var tempContainer=$('<div></div>'),templateData;tempContainer.append(tpl);templateData=tempContainer.html();tempContainer.empty();return templateData},loadGallerySelectorTemplate:function(){if(!this.hasGallerySelector()||this.gallerySelectorTplLoaded){if(!this.gallery.is('.hide-gallery-selector')){this.gallery.addClass('hide-gallery-selector')} 23return} 24this.gallery.addClass('has-gallery-selector');this.gallerySelectorTpl=this.loadTemplate(this.gallerySelectorTpl);this.gallerySelectorTplLoaded=!0},loadGallerySelectorItems:function(){if(!this.hasGallerySelector()){return} 25var me=this;this.gallerySelectorWrapper.children().not('.keep').remove();$.each(this.data,function(i){var template=me.parseTemplate(me.gallerySelectorTpl,this);var $template=$(me.parseTemplate(template,this.media[0]));$template.data('gallery-index',i);me.gallerySelectorWrapper.append($template)})},loadSlideTemplates:function(){if(!this.hasSlides()||this.templatesLoaded){return} 26var templates={},me=this;this.templates.each(function(){var key=$(this).data('type');templates[key]=me.loadTemplate(this)});this.templates=templates;this.templatesLoaded=!0},loadThumbsTemplate:function(){if(!this.hasThumbnails()||this.thumbTemplateLoaded){return} 27this.thumbsTemplate=this.loadTemplate(this.thumbs.filter('[data-template]'));this.thumbTemplateLoaded=!0},setSelectorSliderWidth:function(){this.setSliderWidth(this.gallerySelectorWrapper.children(),this.gallerySelectorWrapper,this.isVertical)},buildGallery:function(){this.loadGallerySelectorTemplate();this.loadGallerySelectorItems();if(this.hasGallerySelector()){this.setSelectorSliderWidth()} 28this.loadSlideTemplates();this.loadThumbsTemplate();this.loadGallery(0)},init:function(){var gallery=this;if(!this.data.length){this.gallery.hide();return!1} 29this.buildGallery();$(window).on('resize',function(){gallery.updateMaxHeight.call(gallery)});this.attachGalleryEvents()}}};window.loadGallery=function(sel){$(sel).each(function(){var $gallery=$(this),key=this.id,data=window[key+'Content'];if(!data){$gallery.hide();return} 30var gallery=new Galleries($gallery,data);gallery.init()})};$(document).ready(function(){window.loadGallery('[data-gallery]')})})(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.