PageSourceSearch

http://admdubovka.ru/bitrix/templates/.default/components/bitrix/iblock.tv/.default/script.js

js admdubovka.ru collected 2026-10-02 08:05:08 UTC 26,164 bytes, 983 lines download raw bytes

1if(!jsPublicTVCollector)
2	var jsPublicTVCollector = {
3		tv: [],
4		list: [],
5		add: [],
6		files: [],
7
8		StatEvent: function(player, oldstate, newstate)
9		{
10			if(
11				(oldstate == 'BUFFERING' && newstate == 'PLAYING') //flv
12				|| (oldstate == 'Closed' && newstate == 'Playing') //wmv
13				|| (oldstate == 'Opening' && newstate == 'Playing') //wmv
14			)
15			{
16				var cur_file = player.getPlaylistItem ? player.getPlaylistItem().file/*flv*/ : player.getConfig().file/*wmv*/;
17				for(var file in this.files)
18				{
19					if(file == cur_file)
20					{
21						var TID = CPHttpRequest.InitThread();
22						CPHttpRequest.SetAction(TID, function(data){});
23						CPHttpRequest.Send(TID, '/bitrix/components/bitrix/iblock.tv/stat.php', {id: this.files[file]});
24						delete this.files[file];
25					}
26				}
27			}
28		}
29	}
30
31function jsPublicTV()
32{
33	this.DescriptionBlockID = null;
34	this.DescriptionValues =
35	{
36		title: true,
37		description: true,
38		duration: true,
39		file: true
40	};
41
42	this.Sections = [];
43
44	this.Prefix = '';
45
46	this.LanguagePhrases = {};
47
48	this.TreeBlockID = null;
49	this.TreeNodes = null;
50
51	this.TreeStyleCodes = {};
52	this.TreeRoll =
53	{
54			id:'-roll',
55			styles:['bitrix-tv-section-closed','bitrix-tv-section-title']
56	};
57
58	this.ShowPreviewImage = true;
59	this.ShowPreviewImageSize = [64, 48];
60
61	this.Player = {wmv_state_listener_added: false};
62	this.PlayerConfig = {};
63	this.PlayOrder = false;
64
65	this.CurrentItem = false;
66	this.GatherStatistics = false;
67	this.SavedState = '';
68
69	this.ArListeners = [];
70
71	//effect variables
72	this.EffectOverlay = null;
73	this.EffectTvBlock = null;
74	this.EffectTvBlockPadding = [15,15];
75
76	//init sign
77	this.Inited = null;
78
79	//delay functions
80	this.MaxWaitTime = 1000;
81}
82
83/* Work With Player */
84jsPublicTV.prototype.Init = function(arValues, TBID, DBID, arStart)
85{
86	this.PlayerListeners('BEFORE_INIT'); //handler to set own element in Init
87
88	this.TreeStyleCodes =
89	{
90		description_start:'<div class="player_description_text">',
91		description_end:'</div>',
92		tree_image_start:'<div class="bitrix-tv-small-image">',
93		tree_image_end:'</div>',
94		tree_description_start:'<div class="bitrix-tv-tree-item-description">',
95		tree_description_end:'</div>',
96		description_file_start:'<a target="_blank" href="',
97		description_file_end:'">' + this.LanguagePhrases.download + '</a>'
98	};
99
100	this.Sections = arValues;
101	this.TreeBlockID = BX(TBID);
102	this.DescriptionBlockID = BX(DBID);
103
104	//prepare player params
105	if(this.CurrentItem===false)
106	{
107		var nextItem = this.GetNextItem();
108		if(nextItem)
109			this.CurrentItem = {Section:nextItem.Section, Item:nextItem.Item};
110	}	
111
112	if(this.CurrentItem !== false)
113	{
114		this.PlayerConfig.file = this['Sections'][this.CurrentItem.Section]['Items'][this.CurrentItem.Item].File;
115		this.PlayerConfig.image = this['Sections'][this.CurrentItem.Section]['Items'][this.CurrentItem.Item].BigImage;
116		this.PlayerConfig.link = this['Sections'][this.CurrentItem.Section]['Items'][this.CurrentItem.Item].File;
117		this.PlayerConfig.autostart = 'false';
118		this.PlayerConfig.width = (arStart.width>0)?arStart.width:640;
119		this.PlayerConfig.height = (arStart.height>0)?arStart.height:480;
120		this.PlayerConfig.block_id = arStart.block_id;
121		this.PlayerConfig.obj_id = arStart.obj_id;
122		this.PlayerConfig.logo = arStart.logo;
123		
124		//create player
125		this.GeneratePlayer();
126
127		//set description
128		this.SetDescription(this.CurrentItem.Section, this.CurrentItem.Item);
129
130		//set inited
131		this.Inited = true;
132	}
133}
134
135jsPublicTV.prototype.GeneratePlayer = function()
136{
137	var _this = this;
138	var curItem = this['Sections'][this.CurrentItem.Section]['Items'][this.CurrentItem.Item];
139
140	if(this.PlayerConfig.width && this.PlayerConfig.height && this.PlayerConfig.obj_id[curItem.Type])
141	{
142		if(curItem.Type == 'wmv') //WMV
143		{
144			this.PlayerConfig.height -=4; //height fix
145			this.Player.wmv = new jeroenwijering.Player(BX(this.PlayerConfig.obj_id.wmv), '/bitrix/components/bitrix/player/wmvplayer/wmvplayer.xaml',  this.PlayerConfig);
146			this.PlayerConfig.height +=4; //height fix
147
148			//state listener
149			this.RunDelayFunction(function(){_this.SetListener('STATE', function(oldstate, newstate){_this.StateListener(oldstate, newstate);}, 'wmv')}, 50, 0);
150		}
151		else if(curItem.Type == 'flv') //FLW
152		{
153			if (window.jwplayer)
154			{
155				this.Player.oJw = jwplayer(this.PlayerConfig.obj_id.flv);
156
157				// Add onplay event handler for statistic
158				if (this.GatherStatistics)
159				{
160					this.RunDelayFunction(function(){
161						_this.Player.oJw.onPlay(function(state){jsPublicTVCollector.StatEvent(_this.Player.oJw, state.oldstate, 'PLAYING');});
162					}, 50, 0);
163				}
164			}
165		}
166	}
167}
168
169jsPublicTV.prototype.RunDelayFunction = function(func, repeatTime, CurrentTime, delay)
170{
171	if(CurrentTime >= this.MaxWaitTime)
172		return;
173
174	var _this = this;
175
176	if(0 < delay) //delay func
177		return setTimeout(function(){_this.RunDelayFunction(func, repeatTime, CurrentTime);}, delay);
178
179	try
180	{
181		func();
182	}
183	catch(e)
184	{
185		setTimeout(function(){_this.RunDelayFunction(func, repeatTime, (CurrentTime + repeatTime));}, repeatTime);
186	}
187}
188
189/* Work With Item List */
190jsPublicTV.prototype.BuildTree = function(kill)
191{
192	if(kill)
193		this.KillTree();
194	//build
195	for(i=0; i<this.Sections.length; i++)
196		this.BuildBlock(i);
197}
198
199jsPublicTV.prototype.KillTree = function()
200{
201	this.TreeNodes = null;
202	this.CurrentItem = false;
203	for(i=0, n=this.TreeBlockID.childNodes.length; i<n; i++)
204		this.TreeBlockID.removeChild(this.TreeBlockID.childNodes[0]);
205}
206
207jsPublicTV.prototype.BuildBlock = function(i)
208{
209	var CurLevel = this['Sections'][i]['Depth'] ?this['Sections'][i]['Depth'] :0;
210	var _this = this;
211
212	//get parent
213	if(CurLevel==1 || CurLevel==0)
214		var ParentBlock = this.TreeBlockID;
215	else if(this['Sections'][i]['Depth'] == this['Sections'][i-1]['Depth'])
216		var ParentBlock = BX(this.Prefix + 'bx-tv-section-' + (i-1)).parentNode;
217	else
218		var ParentBlock = BX(this.Prefix + 'bx-tv-section-' + (i-1));
219
220	//build block
221	if(CurLevel>0)
222	{
223		//title
224		var block = ParentBlock.appendChild(document.createElement('DIV'));
225		block.innerHTML = '<div style="clear:both"></div>' + this['Sections'][i]['Name'];
226		block.onclick = function(){_this.TreeExpand(i)};
227		block.className = 'bitrix-tv-section-title';
228		//block
229		var block = ParentBlock.appendChild(document.createElement('DIV'));
230		block.id = this.Prefix + 'bx-tv-section-' + i;
231		//set style
232		block.className = 'bitrix-tv-section-closed';
233	}
234
235	//build items
236	if(this['Sections'][i]['Items'].length >0)
237	{
238		for(j=0;j<this['Sections'][i]['Items'].length;j++)
239				this.BuildItem(i,j);
240	}
241}
242
243jsPublicTV.prototype.BuildItem = function(i,j)
244{
245	var _this = this;
246	var ParentBlock = (this['Sections'][i]['Depth']==0) ? this.TreeBlockID : BX(this.Prefix + 'bx-tv-section-' + i);
247
248	if(ParentBlock)
249	{
250		var item = ParentBlock.appendChild(document.createElement('DIV'));
251		item.id = this.Prefix + 'bx-tv-s' + i + 'i' + j;
252		item.className = 'bitrix-tv-tree-item';
253		var txt =
254			this.TreeStyleCodes.tree_description_start
255			+ '<a>' + this['Sections'][i]['Items'][j]['Name'] + '</a><br>'
256			+ (this.LanguagePhrases['duration'] ? this.LanguagePhrases['duration'] : '') + this['Sections'][i]['Items'][j]['Duration']
257			+ this.TreeStyleCodes.tree_description_end;
258
259		if(this['Sections'][i]['Items'][j]['SmallImage']!='' && this.ShowPreviewImage)
260			txt = this.TreeStyleCodes.tree_image_start + '<img width="' + this.ShowPreviewImageSize[0] + 'px" height="' + this.ShowPreviewImageSize[1] + 'px" src="' + this['Sections'][i]['Items'][j]['SmallImage'] + '">' + this.TreeStyleCodes.tree_image_end + txt;
261
262		var listen = this.PlayerListeners('BUILD_ITEM', [txt, i, j]);
263		if(typeof listen != "undefined" && listen!='')
264		{
265			item.innerHTML = listen;
266			return;
267		}
268
269		item.innerHTML = txt;
270		item.onclick = function(){_this.SetDescription(i,j); _this.PlayFile(i,j,true);};
271	}
272}
273
274jsPublicTV.prototype.TreeExpand = function(i)
275{
276	var block = BX(this.Prefix + 'bx-tv-section-' + (i));
277	if(block)
278	{
279		if(block.style.display == 'block')
280			block.style.display = 'none';
281		else
282			block.style.display = 'block';
283	}
284}
285
286jsPublicTV.prototype.TreeExpandUp = function(i)
287{
288		var block = BX(this.Prefix + 'bx-tv-section-' + (i));
289		if(block)
290		{
291			var i=0; //max_depth 25
292			while(this.TreeBlockID.id != block.id)
293			{
294				block.style.display = 'block';
295				block = block.parentNode;
296				if(i++>25)
297					break;
298			}
299		}
300}
301
302/* Play File From List */
303jsPublicTV.prototype.PlayFile = function(i, j, autoplay, handle)
304{
305	this.SavedState = '';
306
307	if("undefined" == typeof(this['Sections'][i]['Items'][j]))
308		return;
309
310	//prepare params
311	var params =
312	{
313		file: this['Sections'][i]['Items'][j]['File'],
314		image: this['Sections'][i]['Items'][j]['BigImage'],
315		link: this['Sections'][i]['Items'][j]['File'],
316		width: this['Sections'][i]['Items'][j]['Width'],
317		height: this['Sections'][i]['Items'][j]['Height'],
318		type: this['Sections'][i]['Items'][j]['Type']
319	};
320
321	//old values
322	var old_i = this.CurrentItem.Section;
323	var old_j = this.CurrentItem.Item;
324
325	//set current item
326	this.CurrentItem = {Section:i, Item:j};
327
328	if(old_i==i && old_j==j && handle!==true) // dublicate call
329		return;
330
331	//event
332	var listen = this.PlayerListeners('BEFORE_PLAY_FILE', [i, j, old_i, old_j]);
333	if(typeof listen != "undefined" && listen!='')
334		return;
335
336	//expand menu
337	this.TreeExpandUp(i);
338
339	var
340		_this = this,
341		wmv = BX(this.PlayerConfig.block_id.wmv),
342		flv = BX(this.PlayerConfig.block_id.flv);
343
344	if(params.type == 'wmv')
345	{
346		if(this.Player.oJw && flv.style.display != 'none') //if current not wmv, stop flv
347			this.Player.oJw.stop();
348
349		if(!this.Player.wmv) //generate WMV if not exists
350			this.GeneratePlayer(); //Opera want to regenerate? O.o
351
352		if(this.Player.wmv)
353		{
354			var _player  = this.Player.wmv;
355			_player.configuration.image = params.image; // \\only once???<<<
356			_player.configuration.link = params.link; //modify link
357
358			if(wmv.style.display != 'block') //wmv hidden
359			{
360				if(flv)
361					flv.style.display = 'none';
362				if(wmv)
363					wmv.style.display = 'block';
364			}
365
366			if(!this.Player.wmv_state_listener_added)
367			{
368				//state listener
369				this.RunDelayFunction(function(){_this.SetListener('STATE', function(oldstate, newstate){_this.StateListener(oldstate, newstate);}, 'wmv')}, 50, 0);
370			}
371
372			if(autoplay == true)
373				this.RunDelayFunction(function()
374				{
375					_player.sendEvent('LOAD', params.file);
376					_this.RunDelayFunction(function()
377					{
378						_player.sendEvent('PLAY');
379					}, 50, 0, 50);
380				}, 50, 0, BX.browser.IsSafari() ? 100 : 0); //Safari +100
381			else
382				this.RunDelayFunction(function(){_player.sendEvent('LOAD', params.file);}, 50, 0);
383		}
384	}
385	else if (params.type == 'flv')
386	{
387		if(this.Player.wmv && wmv.style.display != 'none') //if current not flv, stop wmv
388			this.RunDelayFunction(function(){_this.Player.wmv.sendEvent("STOP");}, 50, 0);
389
390		if(!this.Player.oJw) //generate FLV if not exists
391			this.GeneratePlayer();
392
393		if(this.Player.oJw)
394		{
395			if(flv.style.display != 'block') //flv hidden
396			{
397				if(wmv)
398					wmv.style.display = 'none';
399				if(flv)
400					flv.style.display = 'block';
401			}
402
403			var flvparams = {
404				file: params.file,
405				link: params.file,
406				image: params.image
407			};
408
409			this.Player.oJw.load(flvparams);
410			setTimeout(function()
411			{
412				_this.Player.oJw.play(!!autoplay);
413			}, 500);
414		}
415	}	
416}
417
418/* Play Order */
419jsPublicTV.prototype.SetPlayOrder = function(order)
420{
421	this.PlayOrder = order;
422}
423
424/* Set Description */
425jsPublicTV.prototype.SetDescription = function(i,j)
426{
427	if(this.DescriptionBlockID)
428	{
429		var txt = this.TreeStyleCodes.description_start;
430
431		if(this.DescriptionValues.title===true)
432			txt += (this.LanguagePhrases['title'] ? this.LanguagePhrases['title'] : '') + this['Sections'][i]['Items'][j]['Name'] + "<br>\n";
433		if(this.DescriptionValues.description===true)
434			txt += (this.LanguagePhrases['description'] ? this.LanguagePhrases['description'] : '') + this['Sections'][i]['Items'][j]['Description'] + "<br>\n";
435		if(this.DescriptionValues.duration===true)
436			txt += (this.LanguagePhrases['duration'] ? this.LanguagePhrases['duration'] : '') + this['Sections'][i]['Items'][j]['Duration'] + "<br>\n";
437		if(this.DescriptionValues.file===true)
438			txt += (this.LanguagePhrases['file'] ? this.LanguagePhrases['file'] : '') + this.TreeStyleCodes.description_file_start + this['Sections'][i]['Items'][j]['File'] + this.TreeStyleCodes.description_file_end + "<br>\n";
439
440		txt += this.TreeStyleCodes.description_end;
441
442		var listen = this.PlayerListeners('SET_DESCRIPTION', [txt, i, j]);
443		if(typeof listen != "undefined" && listen!='')
444			txt = listen;
445
446		this.DescriptionBlockID.innerHTML = txt;
447	}
448}
449
450/* Roll List */
451jsPublicTV.prototype.Roll = function()
452{
453	if(!this.TreeNodes)
454		this.TreeNodes = this.TreeBlockID.getElementsByTagName('DIV');
455
456	for(i=0; i<this.TreeNodes.length; i++)
457	{
458		for(j=0; j<this.TreeRoll.styles.length; j++)
459		{
460			if (this.TreeNodes[i].className.indexOf(this.TreeRoll.styles[j] + this.TreeRoll.id)!=-1)
461			{
462				this.TreeNodes[i].className = this.TreeNodes[i].className.replace(this.TreeRoll.styles[j] + this.TreeRoll.id, this.TreeRoll.styles[j]);
463				break;
464			}
465			else if (this.TreeNodes[i].className.indexOf(this.TreeRoll.styles[j])!=-1)
466			{
467				this.TreeNodes[i].className = this.TreeNodes[i].className.replace(this.TreeRoll.styles[j], this.TreeRoll.styles[j] + this.TreeRoll.id);
468				break;
469			}
470		}
471	}
472}
473
474/* Walk By Items */
475jsPublicTV.prototype.GetNextItem = function(in_section)
476{
477	if(!this.CurrentItem) //GetFirst
478	{
479		for(i=0; i<this.Sections.length; i++)
480		{
481			if(this['Sections'][i]['Items'].length > 0)
482				return {Section:i, Item:0};
483		}
484	}
485	else //GetNext
486	{
487		if(this['Sections'][this.CurrentItem.Section]['Items'].length > this.CurrentItem.Item + 1) //inside section
488			return {Section:this.CurrentItem.Section, Item:this.CurrentItem.Item+1};
489		else if(true!=in_section) //at all
490		{
491			for(i = this.CurrentItem.Section + 1; i < this.Sections.length; i++)
492			{
493				if(this['Sections'][i]['Items'].length>0)
494					return {Section:i, Item:0};
495			}
496		}
497	}
498
499	this.PlayerListeners('END_PLAY_LIST');
500	return false;
501}
502
503jsPublicTV.prototype.PlayNextItem = function()
504{
505	var nextItem = this.GetNextItem();
506	if(nextItem===false)
507		return;
508
509	if(this.CurrentItem!==false)
510	{
511		this.PlayFile(nextItem.Section, nextItem.Item, true);
512		this.SetDescription(nextItem.Section, nextItem.Item);
513	}
514}
515
516jsPublicTV.prototype.SeekByRealParams = function(section_id, element_id)
517{
518	if(typeof(section_id) != 'undefined' && typeof(element_id) != 'undefined' && false != section_id) // look by section&element id
519	{
520		for(i=0, n=this.Sections.length; i<n; i++)
521		{
522			if(section_id == this.Sections[i].Id)
523			{
524				for (ii=0, nn=this.Sections[i]['Items'].length; ii<nn; ii++)
525				{
526					if(element_id == this.Sections[i]['Items'][ii].Id)
527						return {section:i, element:ii};
528				}
529			}
530		}
531	}
532	else if(typeof(section_id) != 'undefined' && false != section_id) //look by section -> return only section
533	{
534		for(i=0, n=this.Sections.length; i<n; i++)
535		{
536			if(section_id == this.Sections[i].Id)
537				return {section:i, element:false};
538		}
539	}
540	else if(typeof(element_id) != 'undefined') //look by elementID in blind
541	{
542		for(i=0, n=this.Sections.length; i<n; i++)
543		{
544			for (ii=0, nn=this.Sections[i]['Items'].length; ii<nn; ii++)
545			{
546				if(element_id == this.Sections[i]['Items'][ii].Id)
547					return {section:i, element:ii};
548			}
549		}
550	}
551
552	return {section:false, element:false};
553}
554
555jsPublicTV.prototype.TreeMerge = function(arrToMerge)
556{
557	if(arrToMerge.length<=0)
558		return false;
559}
560
561/* Listeners */
562jsPublicTV.prototype.SetListener = function(type, func, playertype)
563{
564	if('wmv' == playertype)
565	{
566		if(this.Player.wmv)
567		{
568			if(this.Player.wmv.view)
569			{
570				this.Player.wmv.addListener(type, func);
571				this.Player.wmv_state_listener_added = true;
572			}
573			else
574			{
575				throw 'NotReady';
576			}
577		}
578	}
579	else if('flv' == playertype)
580	{
581		if(this.Player[playertype])
582			this.Player[playertype].addModelListener(type, func);
583	}
584}
585
586jsPublicTV.prototype.StateListener = function(oldstate, newstate)
587{
588	var complState = oldstate + '+' + newstate;
589	if('Completed' == newstate && this.SavedState != complState)
590	{
591		if(this.PlayOrder !== false)
592		{
593			if(this.PlayOrder == 'section' || this.PlayOrder=='all')
594				this.PlayNextItem();
595		}
596	}
597
598	if(this.GatherStatistics && this.Player.wmv && this.SavedState != complState)
599		jsPublicTVCollector.StatEvent(this.Player.wmv, oldstate, newstate);
600
601	this.SavedState = complState;
602}
603
604/* Own Listenerss */
605//END_PLAY_LIST
606//BEFORE_INIT
607//SET_DESCRIPTION, in\out text of description
608//BUILD_ITEM
609//BEFORE_PLAY_FILE
610jsPublicTV.prototype.PlayerListeners = function(type, args)
611{
612	for(var i=0; i<this.ArListeners.length; i++)
613	{
614		if(this.ArListeners[i]['type'].toUpperCase() == type)
615			return this.ArListeners[i]['func'].apply(null, args);
616	}
617}
618
619jsPublicTV.prototype.AddPlayerListener = function(type, func)
620{
621	if(typeof type != "undefined" && typeof func != "undefined")
622		this.ArListeners.push({type:type,func:func});
623}
624
625/*Effects*/
626jsPublicTV.prototype.EffectCreateOverlay = function()
627{
628	var windowSize = this.EffectGetWindowScrollSize();
629	var posSize = this.EffectGetWindowScrollPos();
630
631	if(this.EffectTvBlock)
632	{
633		this.EffectTvBlock.style.display = "block";
634		this.EffectTvBlock.style.top = this.EffectTvBlockPadding[1] + posSize.scrollTop + 'px';
635		this.EffectTvBlock.style.left = this.EffectTvBlockPadding[0] + 'px';
636	}
637
638	if (!this.EffectOverlay && this.EffectGetOpacityProperty())
639	{
640		var doc = this.EffectTvBlock ? this.EffectTvBlock.parentNode : document.body;
641		this.EffectOverlay = doc.appendChild(document.createElement("DIV"));
642		this.EffectOverlay.className = "bitrix-tv-overlay";
643		this.EffectOverlay.id = 'bitrix-tv-overlay';
644
645		this.EffectOverlay.style.width = windowSize.scrollWidth + "px";
646		this.EffectOverlay.style.height = windowSize.scrollHeight + "px";
647		this.EffectOverlay.style.display = "block";
648	}
649
650	if(this.Inited==true && !BX.browser.IsIE() && this['Sections'][this.CurrentItem.Section]['Items'][this.CurrentItem.Item].Type == 'flv') //for FF,Safari
651	{
652		var _this = this;
653		this.RunDelayFunction(function(){_this.Player.oJw.load(_this['Sections'][_this.CurrentItem.Section]['Items'][_this.CurrentItem.Item].File);}, 50, 0, 50 + (BX.browser.IsSafari() ? 100 : 0)); //FF +50, Safari +150
654	}
655
656	//prepare close esc
657	var _this = this;
658	BX.bind(document, 'keydown', function(e){_this.escEffectRemoveOverlay(e);});
659}
660
661jsPublicTV.prototype.escEffectRemoveOverlay = function(e)
662{
663	if (!e) e = window.event
664	if (!e) return;
665	if (e.keyCode == 27)
666	{
667		this.EffectRemoveOverlay();
668		var _this = this;
669		BX.unbind(document, 'keydown', _this.escEffectRemoveOverlay);
670	}
671}
672
673jsPublicTV.prototype.EffectRemoveOverlay = function()
674{
675	if(this.Player.wmv && BX(this.PlayerConfig.block_id.wmv).style.display!='none')
676		this.Player.wmv.sendEvent('STOP');
677
678	if(this.EffectTvBlock)
679		this.EffectTvBlock.style.display = "none";
680
681	if(this.EffectOverlay)
682	{
683		this.EffectOverlay.parentNode.removeChild(this.EffectOverlay);
684		this.EffectOverlay = null;
685	}
686}
687
688jsPublicTV.prototype.EffectGetWindowScrollSize = function(pDoc)
689{
690	var width, height;
691	if (!pDoc)
692		pDoc = document;
693
694	if ( (pDoc.compatMode && pDoc.compatMode == "CSS1Compat"))
695	{
696		width = pDoc.documentElement.scrollWidth;
697		height = pDoc.documentElement.scrollHeight;
698	}
699	else
700	{
701		if (pDoc.body.scrollHeight > pDoc.body.offsetHeight)
702			height = pDoc.body.scrollHeight;
703		else
704			height = pDoc.body.offsetHeight;
705
706		if (pDoc.body.scrollWidth > pDoc.body.offsetWidth ||
707			(pDoc.compatMode && pDoc.compatMode == "BackCompat") ||
708			(pDoc.documentElement && !pDoc.documentElement.clientWidth)
709		)
710			width = pDoc.body.scrollWidth;
711		else
712			width = pDoc.body.offsetWidth;
713	}
714	return {scrollWidth : width, scrollHeight : height};
715}
716
717jsPublicTV.prototype.EffectGetWindowScrollPos = function(pDoc)
718{
719	var left, top;
720	if (!pDoc)
721		pDoc = document;
722
723	if (self.pageYOffset)
724	{
725		left = self.pageXOffset;
726		top = self.pageYOffset;
727	}
728	else if (pDoc.documentElement && pDoc.documentElement.scrollTop)
729	{
730		left = document.documentElement.scrollLeft;
731		top = document.documentElement.scrollTop;
732	}
733	else if (pDoc.body)
734	{
735		left = pDoc.body.scrollLeft;
736		top = pDoc.body.scrollTop;
737	}
738	return {scrollLeft : left, scrollTop : top};
739}
740
741jsPublicTV.prototype.EffectGetOpacityProperty = function()
742{
743	if (typeof document.body.style.opacity == 'string')
744		return 'opacity';
745	else if (typeof document.body.style.MozOpacity == 'string')
746		return 'MozOpacity';
747	else if (typeof document.body.style.KhtmlOpacity == 'string')
748		return 'KhtmlOpacity';
749	else if (document.body.filters && navigator.appVersion.match(/MSIE ([\d.]+);/)[1]>=5.5)
750		return 'filter';
751
752	return false;
753}
754
755/*float class*/
756//add if not exists
757if(!window.JCFloatDiv)
758{
759	JCFloatDiv = function ()
760	{
761		var _this = this;
762		this.floatDiv = null;
763		this.x = this.y = 0;
764
765		this.Show = function(div, left, top, dxShadow, restrictDrag)
766		{
767			var zIndex = parseInt(div.style.zIndex);
768			if(zIndex <= 0 || isNaN(zIndex))
769				zIndex = 100;
770
771			div.style.zIndex = zIndex;
772
773			if (left < 0)
774				left = 0;
775
776			if (top < 0)
777				top = 0;
778
779			div.style.left = left + "px";
780			div.style.top = top + "px";
781
782			if(BX.browser.IsIE())
783			{
784				var frame = BX(div.id+"_frame");
785				if(!frame)
786				{
787					frame = document.createElement("IFRAME");
788					frame.src = "javascript:''";
789					frame.id = div.id+"_frame";
790					frame.style.position = 'absolute';
791					frame.style.zIndex = zIndex-1;
792					document.body.appendChild(frame);
793				}
794				frame.style.width = div.offsetWidth + "px";
795				frame.style.height = div.offsetHeight + "px";
796				frame.style.left = div.style.left;
797				frame.style.top = div.style.top;
798				frame.style.visibility = 'visible';
799			}
800
801			/*Restrict drag*/
802			div.restrictDrag = restrictDrag || false;
803
804			/*shadow*/
805			if(isNaN(dxShadow))
806				dxShadow = 5;
807
808			if(dxShadow > 0)
809			{
810				var img = BX(div.id+'_shadow');
811				if(!img)
812				{
813					if(BX.browser.IsIE())
814					{
815			 			img = document.createElement("DIV");
816			 			img.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/bitrix/themes/"+phpVars.ADMIN_THEME_ID+"/images/shadow.png',sizingMethod='scale')";
817					}
818					else
819					{
820			 			img = document.createElement("IMG");
821						img.src = '/bitrix/themes/'+phpVars.ADMIN_THEME_ID+'/images/shadow.png';
822					}
823					img.id = div.id+'_shadow';
824					img.style.position = 'absolute';
825					img.style.zIndex = zIndex-2;
826					img.style.left = '-1000px';
827					img.style.top = '-1000px';
828					img.style.lineHeight = 'normal';
829					document.body.appendChild(img);
830				}
831				img.style.width = div.offsetWidth+'px';
832				img.style.height = div.offsetHeight+'px';
833				img.style.left = parseInt(div.style.left)+dxShadow+'px';
834				img.style.top = parseInt(div.style.top)+dxShadow+'px';
835				img.style.visibility = 'visible';
836			}
837			div.dxShadow = dxShadow;
838		}
839
840		this.Close = function(div)
841		{
842			if(!div)
843				return;
844			var sh = BX(div.id+"_shadow");
845			if(sh)
846				sh.style.visibility = 'hidden';
847
848			var frame = BX(div.id+"_frame");
849			if(frame)
850				frame.style.visibility = 'hidden';
851		}
852
853		this.Move = function(div, x, y)
854		{
855			if(!div)
856				return;
857
858			var dxShadow = div.dxShadow;
859			var left = parseInt(div.style.left)+x;
860			var top = parseInt(div.style.top)+y;
861
862			if (div.restrictDrag)
863			{
864				//Left side
865				if (left < 0)
866					left = 0;
867
868				//Right side
869				if ( (document.compatMode && document.compatMode == "CSS1Compat"))
870					windowWidth = document.documentElement.scrollWidth;
871				else
872				{
873					if (document.body.scrollWidth > document.body.offsetWidth ||
874						(document.compatMode && document.compatMode == "BackCompat") ||
875						(document.documentElement && !document.documentElement.clientWidth)
876					)
877						windowWidth = document.body.scrollWidth;
878					else
879						windowWidth = document.body.offsetWidth;
880				}
881
882				var floatWidth = div.offsetWidth;
883				if (left > (windowWidth - floatWidth - dxShadow))
884					left = windowWidth - floatWidth - dxShadow;
885
886				//Top side
887				if (top < 0)
888					top = 0;
889			}
890
891			div.style.left = left+'px';
892			div.style.top = top+'px';
893
894			this.AdjustShadow(div);
895		}
896
897		this.HideShadow = function(div)
898		{
899			var sh = BX(div.id + "_shadow");
900			sh.style.visibility = 'hidden';
901		}
902
903		this.UnhideShadow = function(div)
904		{
905			var sh = BX(div.id + "_shadow");
906			sh.style.visibility = 'visible';
907		}
908
909		this.AdjustShadow = function(div)
910		{
911			var sh = BX(div.id + "_shadow");
912			if(sh && sh.style.visibility != 'hidden')
913			{
914				var dxShadow = div.dxShadow;
915
916				sh.style.width = div.offsetWidth+'px';
917				sh.style.height = div.offsetHeight+'px';
918				sh.style.left = parseInt(div.style.left)+dxShadow+'px';
919				sh.style.top = parseInt(div.style.top)+dxShadow+'px';
920			}
921
922			var frame = BX(div.id+"_frame");
923			if(frame)
924			{
925				frame.style.width = div.offsetWidth + "px";
926				frame.style.height = div.offsetHeight + "px";
927				frame.style.left = div.style.left;
928				frame.style.top = div.style.top;
929			}
930		}
931
932		this.StartDrag = function(e, div)
933		{
934			if(!e)
935				e = window.event;
936			this.x = e.clientX + document.body.scrollLeft;
937			this.y = e.clientY + document.body.scrollTop;
938			this.floatDiv = div;
939
940			BX.bind(document, "mousemove", this.MoveDrag);
941			document.onmouseup = this.StopDrag;
942			if(document.body.setCapture)
943				document.body.setCapture();
944
945			var b = document.body;
946		    b.ondrag = BX.False;
947		    b.onselectstart = BX.False;
948		    b.style.MozUserSelect = _this.floatDiv.style.MozUserSelect = 'none';
949		    b.style.cursor = 'move';
950	    }
951
952		this.StopDrag = function(e)
953		{
954			if(document.body.releaseCapture)
955				document.body.releaseCapture();
956
957			BX.unbind(document, "mousemove", _this.MoveDrag);
958			document.onmouseup = null;
959
960			this.floatDiv = null;
961
962			var b = document.body;
963			b.ondrag = null;
964			b.onselectstart = null;
965			b.style.MozUserSelect = _this.floatDiv.style.MozUserSelect = '';
966		    b.style.cursor = '';
967		}
968
969		this.MoveDrag = function(e)
970		{
971			var x = e.clientX + document.body.scrollLeft;
972			var y = e.clientY + document.body.scrollTop;
973
974			if(_this.x == x && _this.y == y)
975				return;
976
977			_this.Move(_this.floatDiv, (x - _this.x), (y - _this.y));
978			_this.x = x;
979			_this.y = y;
980		}
981	}
982}
983var jsPlayerFloatDiv = new JCFloatDiv();

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.