%PDF- %PDF-
Direktori : /home/bitrix/www/bitrix/components/bitrix/iblock.tv/templates/section_list/ |
Current File : //home/bitrix/www/bitrix/components/bitrix/iblock.tv/templates/section_list/script.min.js |
if(!jsPublicTVCollector)var jsPublicTVCollector={tv:[],list:[],add:[],files:[],StatEvent:function(e,t,i){if(t=="BUFFERING"&&i=="PLAYING"||t=="Closed"&&i=="Playing"||t=="Opening"&&i=="Playing"){var s=e.getPlaylistItem?e.getPlaylistItem().file:e.getConfig().file;for(var o in this.files){if(o==s){BX.ajax.post("/bitrix/components/bitrix/iblock.tv/stat.php",{id:this.files[o]},function(e){});delete this.files[o]}}}}};function jsPublicTV(){this.DescriptionBlockID=null;this.DescriptionValues={title:true,description:true,duration:true,file:true};this.Sections=[];this.Prefix="";this.LanguagePhrases={};this.TreeBlockID=null;this.TreeNodes=null;this.TreeStyleCodes={};this.TreeRoll={id:"-roll",styles:["bitrix-tv-section-closed","bitrix-tv-section-title"]};this.ShowPreviewImage=true;this.ShowPreviewImageSize=[64,48];this.Player={wmv_state_listener_added:false};this.PlayerConfig={};this.PlayOrder=false;this.CurrentItem=false;this.GatherStatistics=false;this.SavedState="";this.ArListeners=[];this.EffectOverlay=null;this.EffectTvBlock=null;this.EffectTvBlockPadding=[15,15];this.Inited=null;this.MaxWaitTime=1e3}jsPublicTV.prototype.Init=function(e,t,i,s){this.PlayerListeners("BEFORE_INIT");this.TreeStyleCodes={description_start:'<div class="player_description_text">',description_end:"</div>",tree_image_start:'<div class="bitrix-tv-small-image">',tree_image_end:"</div>",tree_description_start:'<div class="bitrix-tv-tree-item-description">',tree_description_end:"</div>",description_file_start:'<a target="_blank" href="',description_file_end:'">'+this.LanguagePhrases.download+"</a>"};this.Sections=e;this.TreeBlockID=BX(t);this.DescriptionBlockID=BX(i);if(this.CurrentItem===false){var o=this.GetNextItem();if(o)this.CurrentItem={Section:o.Section,Item:o.Item}}if(this.CurrentItem!==false){this.PlayerConfig.file=this["Sections"][this.CurrentItem.Section]["Items"][this.CurrentItem.Item].File;this.PlayerConfig.image=this["Sections"][this.CurrentItem.Section]["Items"][this.CurrentItem.Item].BigImage;this.PlayerConfig.link=this["Sections"][this.CurrentItem.Section]["Items"][this.CurrentItem.Item].File;this.PlayerConfig.autostart="false";this.PlayerConfig.width=s.width>0?s.width:640;this.PlayerConfig.height=s.height>0?s.height:480;this.PlayerConfig.block_id=s.block_id;this.PlayerConfig.obj_id=s.obj_id;this.PlayerConfig.logo=s.logo;this.PlayerConfig.windowless="true";this.GeneratePlayer();this.SetDescription(this.CurrentItem.Section,this.CurrentItem.Item);this.Inited=true}};jsPublicTV.prototype.GeneratePlayer=function(){var e=this;var t=this["Sections"][this.CurrentItem.Section]["Items"][this.CurrentItem.Item];if(this.PlayerConfig.width&&this.PlayerConfig.height&&this.PlayerConfig.obj_id[t.Type]){if(t.Type=="wmv"){BX.ready(function(){var t=BX(e.PlayerConfig.block_id.wmv);var i=BX(e.PlayerConfig.block_id.flv);t.style.display="block";if(i)i.style.display="none"});this.PlayerConfig.height-=4;this.Player.wmv=new jeroenwijering.Player(BX(this.PlayerConfig.obj_id.wmv),"/bitrix/components/bitrix/player/wmvplayer/wmvplayer.xaml",this.PlayerConfig);this.PlayerConfig.height+=4;this.RunDelayFunction(function(){e.SetListener("STATE",function(t,i){e.StateListener(t,i)},"wmv")},50,0)}else if(t.Type=="flv"){BX.ready(function(){var t=BX(e.PlayerConfig.block_id.wmv);var i=BX(e.PlayerConfig.block_id.flv);if(t)t.style.display="none";i.style.display="block"});var i=function(){if(window.jwplayer){e.Player.oJw=jwplayer(e.PlayerConfig.obj_id.flv);if(e.GatherStatistics){e.RunDelayFunction(function(){e.Player.oJw.onPlay(function(t){jsPublicTVCollector.StatEvent(e.Player.oJw,t.oldstate,"PLAYING")})},50,0)}}else{setTimeout(i,200)}};i()}}};jsPublicTV.prototype.RunDelayFunction=function(e,t,i,s){if(i>=this.MaxWaitTime)return;var o=this;if(0<s)return setTimeout(function(){o.RunDelayFunction(e,t,i)},s);try{e()}catch(l){setTimeout(function(){o.RunDelayFunction(e,t,i+t)},t)}};jsPublicTV.prototype.BuildTree=function(e){if(e)this.KillTree();for(i=0;i<this.Sections.length;i++)this.BuildBlock(i)};jsPublicTV.prototype.KillTree=function(){this.TreeNodes=null;this.CurrentItem=false;for(i=0,n=this.TreeBlockID.childNodes.length;i<n;i++)this.TreeBlockID.removeChild(this.TreeBlockID.childNodes[0])};jsPublicTV.prototype.BuildBlock=function(e){var t=this["Sections"][e]["Depth"]?this["Sections"][e]["Depth"]:0,i=this,s,o,l,n;if(t==1||t==0)s=this.TreeBlockID;else if(this["Sections"][e]["Depth"]==this["Sections"][e-1]["Depth"])s=BX(this.Prefix+"bx-tv-section-"+(e-1)).parentNode;else s=BX(this.Prefix+"bx-tv-section-"+(e-1));if(t>0){o=s.appendChild(document.createElement("DIV"));o.innerHTML='<div style="clear:both"></div>'+this["Sections"][e]["Name"];o.onclick=function(){i.TreeExpand(e)};o.className="bitrix-tv-section-title";l=s.appendChild(document.createElement("DIV"));l.id=this.Prefix+"bx-tv-section-"+e;l.className="bitrix-tv-section-closed"}if(this["Sections"][e]["Items"].length>0){for(n=0;n<this["Sections"][e]["Items"].length;n++)this.BuildItem(e,n)}};jsPublicTV.prototype.BuildItem=function(e,t){var i=this;var s=this["Sections"][e]["Depth"]==0?this.TreeBlockID:BX(this.Prefix+"bx-tv-section-"+e);if(s){var o=s.appendChild(document.createElement("DIV"));o.id=this.Prefix+"bx-tv-s"+e+"i"+t;o.className="bitrix-tv-tree-item";var l=this.TreeStyleCodes.tree_description_start+"<a>"+this["Sections"][e]["Items"][t]["Name"]+"</a><br>"+(this.LanguagePhrases["duration"]?this.LanguagePhrases["duration"]:"")+this["Sections"][e]["Items"][t]["Duration"]+this.TreeStyleCodes.tree_description_end;if(this["Sections"][e]["Items"][t]["SmallImage"]!=""&&this.ShowPreviewImage)l=this.TreeStyleCodes.tree_image_start+'<img width="'+this.ShowPreviewImageSize[0]+'px" height="'+this.ShowPreviewImageSize[1]+'px" src="'+this["Sections"][e]["Items"][t]["SmallImage"]+'">'+this.TreeStyleCodes.tree_image_end+l;var n=this.PlayerListeners("BUILD_ITEM",[l,e,t]);if(typeof n!="undefined"&&n!=""){o.innerHTML=n;return}o.innerHTML=l;o.onclick=function(){i.SetDescription(e,t);i.PlayFile(e,t,true)}}};jsPublicTV.prototype.TreeExpand=function(e){var t=BX(this.Prefix+"bx-tv-section-"+e);if(t){if(t.style.display=="block")t.style.display="none";else t.style.display="block"}};jsPublicTV.prototype.TreeExpandUp=function(e){var t=BX(this.Prefix+"bx-tv-section-"+e),i;if(t){i=0;while(this.TreeBlockID.id!=t.id){t.style.display="block";t=t.parentNode;if(i++>25)break}}};jsPublicTV.prototype.PlayFile=function(e,t,i,s){this.SavedState="";if("undefined"==typeof this["Sections"][e]["Items"][t])return;var o={file:this["Sections"][e]["Items"][t]["File"],image:this["Sections"][e]["Items"][t]["BigImage"],link:this["Sections"][e]["Items"][t]["File"],width:this["Sections"][e]["Items"][t]["Width"],height:this["Sections"][e]["Items"][t]["Height"],type:this["Sections"][e]["Items"][t]["Type"]};var l=this.CurrentItem.Section;var n=this.CurrentItem.Item;this.CurrentItem={Section:e,Item:t};if(l==e&&n==t&&s!==true)return;var r=this.PlayerListeners("BEFORE_PLAY_FILE",[e,t,l,n]);if(typeof r!="undefined"&&r!="")return;this.TreeExpandUp(e);var a=this,c=BX(this.PlayerConfig.block_id.wmv),h=BX(this.PlayerConfig.block_id.flv);if(o.type=="wmv"){if(this.Player.oJw&&h.style.display!="none")this.Player.oJw.stop();this.PlayerConfig.image=o.image;this.PlayerConfig.link=o.link;this.PlayerConfig.file=o.file;this.PlayerConfig.autostart=i?"true":"false";this.GeneratePlayer();if(h)h.style.display="none"}else if(o.type=="flv"){if(this.Player.wmv&&c.style.display!="none")this.RunDelayFunction(function(){a.Player.wmv.sendEvent("STOP")},50,0);if(!this.Player.oJw)this.GeneratePlayer();if(this.Player.oJw){if(h.style.display!="block"){if(c)c.style.display="none";if(h)h.style.display="block"}var f={file:o.file,link:o.file,image:o.image};this.Player.oJw.onPlaylist(function(){a.Player.oJw.play(!!i)});this.Player.oJw.load(f)}}};jsPublicTV.prototype.SetPlayOrder=function(e){this.PlayOrder=e};jsPublicTV.prototype.SetDescription=function(e,t){if(this.DescriptionBlockID){var i=this.TreeStyleCodes.description_start;if(this.DescriptionValues.title===true)i+=(this.LanguagePhrases["title"]?this.LanguagePhrases["title"]:"")+this["Sections"][e]["Items"][t]["Name"]+"<br>\n";if(this.DescriptionValues.description===true)i+=(this.LanguagePhrases["description"]?this.LanguagePhrases["description"]:"")+this["Sections"][e]["Items"][t]["Description"]+"<br>\n";if(this.DescriptionValues.duration===true)i+=(this.LanguagePhrases["duration"]?this.LanguagePhrases["duration"]:"")+this["Sections"][e]["Items"][t]["Duration"]+"<br>\n";if(this.DescriptionValues.file===true)i+=(this.LanguagePhrases["file"]?this.LanguagePhrases["file"]:"")+this.TreeStyleCodes.description_file_start+this["Sections"][e]["Items"][t]["File"]+this.TreeStyleCodes.description_file_end+"<br>\n";i+=this.TreeStyleCodes.description_end;var s=this.PlayerListeners("SET_DESCRIPTION",[i,e,t]);if(typeof s!="undefined"&&s!="")i=s;this.DescriptionBlockID.innerHTML=i}};jsPublicTV.prototype.Roll=function(){if(!this.TreeNodes)this.TreeNodes=this.TreeBlockID.getElementsByTagName("DIV");for(i=0;i<this.TreeNodes.length;i++){for(j=0;j<this.TreeRoll.styles.length;j++){if(this.TreeNodes[i].className.indexOf(this.TreeRoll.styles[j]+this.TreeRoll.id)!=-1){this.TreeNodes[i].className=this.TreeNodes[i].className.replace(this.TreeRoll.styles[j]+this.TreeRoll.id,this.TreeRoll.styles[j]);break}else if(this.TreeNodes[i].className.indexOf(this.TreeRoll.styles[j])!=-1){this.TreeNodes[i].className=this.TreeNodes[i].className.replace(this.TreeRoll.styles[j],this.TreeRoll.styles[j]+this.TreeRoll.id);break}}}};jsPublicTV.prototype.GetNextItem=function(e){if(!this.CurrentItem){for(i=0;i<this.Sections.length;i++){if(this["Sections"][i]["Items"].length>0)return{Section:i,Item:0}}}else{if(this["Sections"][this.CurrentItem.Section]["Items"].length>this.CurrentItem.Item+1)return{Section:this.CurrentItem.Section,Item:this.CurrentItem.Item+1};else if(true!=e){for(i=this.CurrentItem.Section+1;i<this.Sections.length;i++){if(this["Sections"][i]["Items"].length>0)return{Section:i,Item:0}}}}this.PlayerListeners("END_PLAY_LIST");return false};jsPublicTV.prototype.PlayNextItem=function(){var e=this.GetNextItem();var t=this;if(e===false)return;if(this.CurrentItem!==false){setTimeout(function(){t.PlayFile(e.Section,e.Item,true);t.SetDescription(e.Section,e.Item)},1e3)}};jsPublicTV.prototype.SeekByRealParams=function(e,t){if(typeof e!="undefined"&&typeof t!="undefined"&&false!=e){for(i=0,n=this.Sections.length;i<n;i++){if(e==this.Sections[i].Id){for(ii=0,nn=this.Sections[i]["Items"].length;ii<nn;ii++){if(t==this.Sections[i]["Items"][ii].Id)return{section:i,element:ii}}}}}else if(typeof e!="undefined"&&false!=e){for(i=0,n=this.Sections.length;i<n;i++){if(e==this.Sections[i].Id)return{section:i,element:false}}}else if(typeof t!="undefined"){for(i=0,n=this.Sections.length;i<n;i++){for(ii=0,nn=this.Sections[i]["Items"].length;ii<nn;ii++){if(t==this.Sections[i]["Items"][ii].Id)return{section:i,element:ii}}}}return{section:false,element:false}};jsPublicTV.prototype.TreeMerge=function(e){if(e.length<=0)return false};jsPublicTV.prototype.SetListener=function(e,t,i){if("wmv"==i){if(this.Player.wmv){if(this.Player.wmv.view){this.Player.wmv.addListener(e,t);this.Player.wmv_state_listener_added=true}else{throw"NotReady"}}}else if("flv"==i){if(this.Player[i])this.Player[i].addModelListener(e,t)}};jsPublicTV.prototype.StateListener=function(e,t){var i=e+"+"+t;if("Completed"==t&&this.SavedState!=i){if(this.PlayOrder!==false){if(this.PlayOrder=="section"||this.PlayOrder=="all")this.PlayNextItem()}}if(this.GatherStatistics&&this.Player.wmv&&this.SavedState!=i)jsPublicTVCollector.StatEvent(this.Player.wmv,e,t);this.SavedState=i};jsPublicTV.prototype.PlayerListeners=function(e,t){for(var i=0;i<this.ArListeners.length;i++){if(this.ArListeners[i]["type"].toUpperCase()==e)return this.ArListeners[i]["func"].apply(null,t)}};jsPublicTV.prototype.AddPlayerListener=function(e,t){if(typeof e!="undefined"&&typeof t!="undefined")this.ArListeners.push({type:e,func:t})};jsPublicTV.prototype.EffectCreateOverlay=function(){var e=this.EffectGetWindowScrollSize();var t=this.EffectGetWindowScrollPos();if(this.EffectTvBlock){this.EffectTvBlock.style.display="block";this.EffectTvBlock.style.top=this.EffectTvBlockPadding[1]+t.scrollTop+"px";this.EffectTvBlock.style.left=this.EffectTvBlockPadding[0]+"px"}if(!this.EffectOverlay&&this.EffectGetOpacityProperty()){var i=this.EffectTvBlock?this.EffectTvBlock.parentNode:document.body;this.EffectOverlay=i.appendChild(document.createElement("DIV"));this.EffectOverlay.className="bitrix-tv-overlay";this.EffectOverlay.id="bitrix-tv-overlay";this.EffectOverlay.style.width=e.scrollWidth+"px";this.EffectOverlay.style.height=e.scrollHeight+"px";this.EffectOverlay.style.display="block"}if(this.Inited==true&&!BX.browser.IsIE()&&this["Sections"][this.CurrentItem.Section]["Items"][this.CurrentItem.Item].Type=="flv"){var s=this;this.RunDelayFunction(function(){s.Player.oJw.load(s["Sections"][s.CurrentItem.Section]["Items"][s.CurrentItem.Item].File)},50,0,50+(BX.browser.IsSafari()?100:0))}var s=this;BX.bind(document,"keydown",function(e){s.escEffectRemoveOverlay(e)})};jsPublicTV.prototype.escEffectRemoveOverlay=function(e){if(!e)e=window.event;if(!e)return;if(e.keyCode==27){this.EffectRemoveOverlay();var t=this;BX.unbind(document,"keydown",t.escEffectRemoveOverlay)}};jsPublicTV.prototype.EffectRemoveOverlay=function(){if(this.Player.wmv&&BX(this.PlayerConfig.block_id.wmv).style.display!="none")this.Player.wmv.sendEvent("STOP");if(this.EffectTvBlock)this.EffectTvBlock.style.display="none";if(this.EffectOverlay){this.EffectOverlay.parentNode.removeChild(this.EffectOverlay);this.EffectOverlay=null}};jsPublicTV.prototype.EffectGetWindowScrollSize=function(e){var t,i;if(!e)e=document;if(e.compatMode&&e.compatMode=="CSS1Compat"){t=e.documentElement.scrollWidth;i=e.documentElement.scrollHeight}else{if(e.body.scrollHeight>e.body.offsetHeight)i=e.body.scrollHeight;else i=e.body.offsetHeight;if(e.body.scrollWidth>e.body.offsetWidth||e.compatMode&&e.compatMode=="BackCompat"||e.documentElement&&!e.documentElement.clientWidth)t=e.body.scrollWidth;else t=e.body.offsetWidth}return{scrollWidth:t,scrollHeight:i}};jsPublicTV.prototype.EffectGetWindowScrollPos=function(e){var t,i;if(!e)e=document;if(self.pageYOffset){t=self.pageXOffset;i=self.pageYOffset}else if(e.documentElement&&e.documentElement.scrollTop){t=document.documentElement.scrollLeft;i=document.documentElement.scrollTop}else if(e.body){t=e.body.scrollLeft;i=e.body.scrollTop}return{scrollLeft:t,scrollTop:i}};jsPublicTV.prototype.EffectGetOpacityProperty=function(){if(typeof document.body.style.opacity=="string")return"opacity";else if(typeof document.body.style.MozOpacity=="string")return"MozOpacity";else if(typeof document.body.style.KhtmlOpacity=="string")return"KhtmlOpacity";else if(document.body.filters&&navigator.appVersion.match(/MSIE ([\d.]+);/)[1]>=5.5)return"filter";return false};if(!window.JCFloatDiv){JCFloatDiv=function(){var e=this;this.floatDiv=null;this.x=this.y=0;this.Show=function(e,t,i,s,o){var l=parseInt(e.style.zIndex);if(l<=0||isNaN(l))l=100;e.style.zIndex=l;if(t<0)t=0;if(i<0)i=0;e.style.left=t+"px";e.style.top=i+"px";if(BX.browser.IsIE()){var n=BX(e.id+"_frame");if(!n){n=document.createElement("IFRAME");n.src="javascript:''";n.id=e.id+"_frame";n.style.position="absolute";n.style.zIndex=l-1;document.body.appendChild(n)}n.style.width=e.offsetWidth+"px";n.style.height=e.offsetHeight+"px";n.style.left=e.style.left;n.style.top=e.style.top;n.style.visibility="visible"}e.restrictDrag=o||false;if(isNaN(s))s=5;if(s>0){var r=BX(e.id+"_shadow");if(!r){if(BX.browser.IsIE()){r=document.createElement("DIV");r.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/bitrix/themes/"+phpVars.ADMIN_THEME_ID+"/images/shadow.png',sizingMethod='scale')"}else{r=document.createElement("IMG");r.src="/bitrix/themes/"+phpVars.ADMIN_THEME_ID+"/images/shadow.png"}r.id=e.id+"_shadow";r.style.position="absolute";r.style.zIndex=l-2;r.style.left="-1000px";r.style.top="-1000px";r.style.lineHeight="normal";document.body.appendChild(r)}r.style.width=e.offsetWidth+"px";r.style.height=e.offsetHeight+"px";r.style.left=parseInt(e.style.left)+s+"px";r.style.top=parseInt(e.style.top)+s+"px";r.style.visibility="visible"}e.dxShadow=s};this.Close=function(e){if(!e)return;var t=BX(e.id+"_shadow");if(t)t.style.visibility="hidden";var i=BX(e.id+"_frame");if(i)i.style.visibility="hidden"};this.Move=function(e,t,i){if(!e)return;var s=e.dxShadow;var o=parseInt(e.style.left)+t;var l=parseInt(e.style.top)+i;if(e.restrictDrag){if(o<0)o=0;if(document.compatMode&&document.compatMode=="CSS1Compat")windowWidth=document.documentElement.scrollWidth;else{if(document.body.scrollWidth>document.body.offsetWidth||document.compatMode&&document.compatMode=="BackCompat"||document.documentElement&&!document.documentElement.clientWidth)windowWidth=document.body.scrollWidth;else windowWidth=document.body.offsetWidth}var n=e.offsetWidth;if(o>windowWidth-n-s)o=windowWidth-n-s;if(l<0)l=0}e.style.left=o+"px";e.style.top=l+"px";this.AdjustShadow(e)};this.HideShadow=function(e){var t=BX(e.id+"_shadow");t.style.visibility="hidden"};this.UnhideShadow=function(e){var t=BX(e.id+"_shadow");t.style.visibility="visible"};this.AdjustShadow=function(e){var t=BX(e.id+"_shadow");if(t&&t.style.visibility!="hidden"){var i=e.dxShadow;t.style.width=e.offsetWidth+"px";t.style.height=e.offsetHeight+"px";t.style.left=parseInt(e.style.left)+i+"px";t.style.top=parseInt(e.style.top)+i+"px"}var s=BX(e.id+"_frame");if(s){s.style.width=e.offsetWidth+"px";s.style.height=e.offsetHeight+"px";s.style.left=e.style.left;s.style.top=e.style.top}};this.StartDrag=function(t,i){if(!t)t=window.event;this.x=t.clientX+document.body.scrollLeft;this.y=t.clientY+document.body.scrollTop;this.floatDiv=i;BX.bind(document,"mousemove",this.MoveDrag);document.onmouseup=this.StopDrag;if(document.body.setCapture)document.body.setCapture();var s=document.body;s.ondrag=BX.False;s.onselectstart=BX.False;s.style.MozUserSelect=e.floatDiv.style.MozUserSelect="none";s.style.cursor="move"};this.StopDrag=function(t){if(document.body.releaseCapture)document.body.releaseCapture();BX.unbind(document,"mousemove",e.MoveDrag);document.onmouseup=null;this.floatDiv=null;var i=document.body;i.ondrag=null;i.onselectstart=null;i.style.MozUserSelect=e.floatDiv.style.MozUserSelect="";i.style.cursor=""};this.MoveDrag=function(t){var i=t.clientX+document.body.scrollLeft;var s=t.clientY+document.body.scrollTop;if(e.x==i&&e.y==s)return;e.Move(e.floatDiv,i-e.x,s-e.y);e.x=i;e.y=s}}}var jsPlayerFloatDiv=new JCFloatDiv; //# sourceMappingURL=script.map.js