1angular.module("YepCom").directive("forudyngallery",function($state,Layout,$compile,ThemeLayer,$timeout,$ocLazyLoad,$sce){return{restrict:"EA",replace:!0,template:'<div class="forudyngallery extrablockngnew" extraname="forudyngallery" elementid="elforudyngalleryouter" ng-style="sitecontent.elforudyngalleryouter.style" ng-class="sitecontent.elforudyngalleryouter.classes"></div>',link:function(scope,element,attrs){var galleryIndex,galleryItem,staticHost,templ,html,wrap;function prefixGalleryUrl(url,host){url=(url=>{var matched;return url&&"string"==typeof url?(matched=url.match(/^(?:https?:)?\/\/[^/]+(\/system\/useruploads\/.*)$/i))?matched[1]:url.replace(/https?:\/\/editor\.fo\.ru/gi,""):url})(url);return host&&"string"==typeof url&&/^\/system\/useruploads/.test(url)?host+url:url}function rewriteGalleryImages(){var images=scope.sitecontent&&scope.sitecontent.galleryimages;if(images&&images.length)for(staticHost=(()=>{for(var host="",cursor=scope;cursor;){if(cursor.statichost){host=cursor.statichost;break}cursor=cursor.$parent}return host=(host=!host&&scope.$root&&scope.$root.statichost?scope.$root.statichost:host)||"//uploads.static.fo.vin"})(),galleryIndex=0;galleryIndex<images.length;galleryIndex++)(galleryItem=images[galleryIndex])&&(galleryItem.url&&(galleryItem.url=prefixGalleryUrl(galleryItem.url,staticHost)),galleryItem.fullImageUrl)&&(galleryItem.fullImageUrl=prefixGalleryUrl(galleryItem.fullImageUrl,staticHost))}function bindGalleryText(html){return html?(html=(html=(html=(html=html.replace(/ng-model="sitecontent\[([^>]*?)\]\['text'\]"/g,'fomce="true" yepview-text-bind="sitecontent[$1][\'text\']"')).replace(/ng-model="sitecontent\.([A-Za-z0-9_]+)\.text"/g,'fomce="true" yepview-text-bind="sitecontent.$1.text"')).replace(/ng-model="image\.text"/g,'fomce="true" yepview-text-bind="image.text"')).replace(/ng-bind-html="trustAsHtml\(([^"]+)\)"/g,'yepview-text-bind="$1"')).replace(/<([a-zA-Z0-9]+)([^>]*?)>/g,function(match,tag,attrs){return!/\bimg-item\b/.test(attrs)&&!/\bforudyngallery-item\b/.test(attrs)||/\bimg-item-container\b/.test(attrs)||(attrs=attrs.replace(/\s*(?:ng-bind-html|yepview-text-bind)\s*=\s*["'][^"']*["']/g,"")),/(?:ng-bind-html|yepview-text-bind)\s*=/.test(attrs)?"<"+tag+attrs.replace(/\s*ui-tinymce\s*=\s*["']tinymceOptions["']/g,"")+">":"<"+tag+attrs+">"}):""}function paintGalleryItems(innerHtml){var childScope,host,image,img,index,items,node,prepared,url,images=scope.sitecontent&&scope.sitecontent.galleryimages;if(images&&images.length&&element[0]){for(items=element[0].querySelectorAll(".img-item, .forudyngallery-item"),prepared=innerHtml?bindGalleryText(innerHtml):"",index=0;index<items.length;index++)if(node=items[index],image=images[index]){if(url=image.url||image.fullImageUrl||"",!(img=node.querySelector("img"))&&prepared){(childScope=scope.$new()).image=image,childScope.$index=index,host=node;try{$compile(prepared)(childScope,function(newelem){for(;host.firstChild;)host.removeChild(host.firstChild);angular.forEach(newelem,function(pieceNode){host.appendChild(pieceNode)})})}catch(e){img=null}img=node.querySelector("img")}!img&&url&&((img=document.createElement("img")).className="img-responsive f-btn",img.setAttribute("alt",image.name||""),node.insertBefore(img,node.firstChild)),img&&url&&(img.loading="eager",img.removeAttribute("loading"),img.setAttribute("src",url),img.getAttribute("data-gallery-fit")||(img.setAttribute("data-gallery-fit","1"),img.addEventListener("load",releaseGalleryClip))),node&&node.classList&&node.classList.remove("ng-enter-prepare")}releaseGalleryClip()}}function releaseGalleryClip(){var node=element[0],outer=scope.sitecontent&&scope.sitecontent.elforudyngalleryouter;node&&outer&&outer.style&&(node.scrollHeight<=node.clientHeight+2||(outer.style.height="auto",outer.style["min-height"]="0px",outer.style["overflow-y"]="visible"))}scope.trustAsHtml=function(value){return null!=value&&"string"!=typeof value&&(value=$sce.valueOf(value)),$sce.trustAsHtml(value||"")},scope.posTop=0,scope.previewState=!1,"preview2"!==$state.current.name&&"localpreview"!==$state.current.name&&"templatepreview"!==$state.current.name&&"previewimage"!==$state.current.name||(scope.previewState=!0),scope.previewState&&rewriteGalleryImages(),staticHost=staticHost||"",scope.sitecontent&&scope.sitecontent.galleryimages&&scope.sitecontent.galleryimages.length&&(scope.mainimgsrc=scope.sitecontent.galleryimages[0].fullImageUrl||scope.sitecontent.galleryimages[0].url),"owneditor"===$state.current.name&&scope.$on("setDeviceType",function(evt,data){!scope.currentViewType||"mobile"!=scope.currentViewType&&"tablet"!=scope.currentViewType?scope.sitecontent.enablemasonary&&scope.enableMasonry():$timeout(function(){scope.disableMasonry()},100)}),scope.previewState&&!scope.yeid&&(scope.yeid=scope.myyelemid),$ocLazyLoad.load("/assets/exif.min.js"),scope.$on("openFancyBox",function(event,data){EXIF.getData(data,function(){var orientation=EXIF.getTag(this,"Orientation");6===orientation&&$(data).css("transform","rotate(90deg)"),8===orientation&&$(data).css("transform","rotate(270deg)"),3===orientation&&$(data).css("transform","rotate(180deg)")})}),scope.reloadFancybox=function(){$("[yelemid="+scope.yeid+"]").find(".fancybox").fancybox({hash:!1,arrows:!0})},$timeout(function(){scope.reloadFancybox()},500),scope.$on("reloadFancybox",function(event){$timeout(function(){scope.reloadFancybox()},100)}),$timeout(function(){scope.sitecontent.enablemasonary&&scope.enableMasonry()},5e3),scope.$on("loadedBlock",function(event,data){data&&data.toString()==scope.myyelemid.toString()&&$timeout(function(){scope.sitecontent.enablemasonary&&scope.enableMasonry()},1e3)}),scope.$on("enableMasonry",function(event){$timeout(function(){scope.enableMasonry()},100)}),scope.$on("disableMasonry",function(event){$timeout(function(){scope.disableMasonry()},100)}
1),scope.$on("setDynGalleryImage",function(event,incomingelement,imgPrev,wi,he,fullimage,imgclass){scope.UpdateImageInArray(incomingelement,imgPrev,wi,he,fullimage,imgclass)}),scope.UpdateImageInArray=function(incomingelement,imgPrev,wi,he,fullimage,imgclass){var yelem=$("[yelemid="+incomingelement.yelemid+"]");0<yelem.length&&0<(yelem=yelem.find("[elementid="+incomingelement.elementid+"]")).length&&(incomingelement=$(yelem).attr("index"),scope.sitecontent.galleryimages[incomingelement].url=imgPrev,scope.sitecontent.galleryimages[incomingelement].fullImageUrl=fullimage,scope.mainimgsrc=scope.sitecontent.galleryimages[0].fullImageUrl||scope.sitecontent.galleryimages[0].url)},element.bind("click",function(event){$(event.target).attr("elementid")||0<$(event.target).parents("[ui-tinymce]").length||0<$(event.target).parents("[ng-bind-html]").length||$(event.target).attr("ui-tinymce")||$(event.target).attr("ng-bind-html")||(event.preventDefault(),event.stopPropagation())}),scope.setMainImg=function(url){scope.mainimgsrc=url},scope.forucovernav=!1,scope.enableMasonry=function(){scope.currentViewType&&("mobile"==scope.currentViewType||"tablet"==scope.currentViewType)||(window.Masonry?(scope.dynContainer=$("[yelemid="+scope.yeid+"]").find("[dyngallerycontainer]")[0],scope.dynContainer&&(scope.msnry?scope.msnry.layout():scope.msnry=new Masonry(scope.dynContainer,{itemSelector:".img-item"}))):$ocLazyLoad.load("/assets/js/masonry.pkgd.min.js").then(function(){scope.dynContainer=$("[yelemid="+scope.yeid+"]").find("[dyngallerycontainer]")[0],scope.dynContainer&&(scope.msnry?scope.msnry.layout():scope.msnry=new Masonry(scope.dynContainer,{itemSelector:".img-item"}))}))},scope.disableMasonry=function(){scope.msnry&&scope.msnry.destroy(),scope.msnry=void 0},scope.showhidenav=function(){scope.forucovernav=!0},scope.updateExtraTemplate=function(name){var id=scope.elemdata.extrablock_id.$oid;Layout.updateTemplate(id,name).then(function(templ){element.html(""),scope.elemdata.templatename=name,scope.elemdata.templatehtml=templ,$compile(ThemeLayer.rewriteNgStyle(templ,scope.elemdata.templatename,scope.sitecontent,scope))(scope,function(newelem){element.html(newelem),scope.initBaseDropZone()})})},scope.previewState?(templ=(templ=scope.elemdata&&scope.elemdata.templatehtml?scope.elemdata.templatehtml:"").replace(/\&\#39\;/g,"'"),scope._galleryRepeatInner=(html=templ)&&"undefined"!=typeof document&&((wrap=document.createElement("div")).innerHTML=html,html=wrap.querySelector(".img-item")||wrap.querySelector(".forudyngallery-item"))?html.innerHTML:"",templ=bindGalleryText(templ),$compile(ThemeLayer.rewriteNgStyle(templ,scope.elemdata&&scope.elemdata.templatename,scope.sitecontent,scope))(scope,function(newelem){element.html(newelem),scope.initBaseDropZone&&scope.initBaseDropZone(),$timeout(function(){paintGalleryItems(scope._galleryRepeatInner)},0),$timeout(function(){paintGalleryItems(scope._galleryRepeatInner)},400),scope.$watchCollection("sitecontent.galleryimages",function(){rewriteGalleryImages(),paintGalleryItems(scope._galleryRepeatInner)})})):scope.elemdata&&scope.elemdata.templatename&&(scope.updateExtraTemplate(scope.elemdata.templatename),scope.sitecontent.elforucover)&&(scope.sitecontent.elforucover.template=scope.elemdata.templatename)}}});
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.