PageSourceSearch

https://www.antena3.ro/static/js/common.js?v=3

js antena3.ro collected 2026-10-01 10:29:09 UTC 13,756 bytes, 566 lines download raw bytes

1/*-------------------------------------------STICKY VIDEO--------------------------------*/
2var _playbackStarted = false,
3	_playbackBoxNewsStarted = false,
4	_showFloating = true,
5	_evClose = false;
6var show_p=0;
7var window_width = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
8
9function _throttleEvent(delay, no_trailing, callback, debounce_mode) {
10
11	var timeout_id,
12		last_exec = 0;
13	if (typeof no_trailing !== "boolean") {
14		debounce_mode = callback;
15		callback = no_trailing;
16		no_trailing = undefined;
17	}
18	function wrapper() {
19		var that = this,
20			elapsed = +new Date() - last_exec,
21			args = arguments;
22		function exec() {
23			last_exec = +new Date();
24			callback.apply(that, args);
25		}
26		function clear() {
27			timeout_id = undefined;
28		}
29		if (debounce_mode && !timeout_id) {
30			exec();
31		}
32		timeout_id && clearTimeout(timeout_id);
33		if (debounce_mode === undefined && elapsed > delay) {
34			exec();
35		} else if (no_trailing !== true) {
36			timeout_id = setTimeout(debounce_mode ? clear : exec, debounce_mode === undefined ? delay - elapsed : delay);
37		}
38	}
39	return wrapper;
40}
41function _isElementInViewport(el, headerHeight) {
42	var rect = el.getBoundingClientRect();
43	return rect.top >= headerHeight && rect.left >= 0 && rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) && Math.floor(rect.right) <= (window.innerWidth || document.documentElement.clientWidth);
44}
45function _isUnderElement(el, headerHeight) {
46	var rect = el.getBoundingClientRect();
47	return rect.top <= headerHeight;
48}
49
50var lastScrollTop = 0;
51
52function decidePlayerPosition() {
53	var scrollTop = $(window).scrollTop();
54	if(scrollTop>1000 && show_p==0)
55	{
56		show_p = 1;
57		$('#slidebox').animate({'right':'0px'},300);
58	}
59	if(window_width<=700) {
60		if (scrollTop > 500) {
61			$("#preview-video").hide();
62			if($("#__ivm0").hasClass("sticky-video")){
63				$("#__ivm0").css('top', "61px");
64			}
65		} else {
66			$("#preview-video").show();
67
68			if($("#__ivm0").hasClass("sticky-video")){
69				$("#__ivm0").css('top', "106px");
70			}
71		}
72	}
73
74	if(typeof home!==undefined && home===1)
75	{
76
77	}else {
78
79		if (scrollTop > lastScrollTop){
80			if ($("#prev_art").hasClass("show"))
81			{
82				$("#prev_art").removeClass("show");
83			}
84			if ($("#next_art").hasClass("show"))
85			{
86				$("#next_art").removeClass("show");
87			}
88		} else {
89			if (!$("#prev_art").hasClass("show"))
90			{
91				$("#prev_art").addClass("show");
92			}
93			if (!$("#next_art").hasClass("show"))
94			{
95				$("#next_art").addClass("show");
96			}
97		}
98		lastScrollTop = scrollTop;
99
100
101		var tmp = document.getElementById("__ivm0");
102		if (tmp) {
103
104			var el = tmp.parentNode,
105				hh = $("#header").height();
106
107			if (_isElementInViewport(el, hh)) {
108
109				if (!_playbackStarted) {
110					var _playerID = $("#__ivm0 .video-js").attr("id"),
111						_player = videojs(_playerID);
112
113					 if ($("#__ivm0").hasClass("no-autoplay")) {}else {
114						_player
115							.play()
116							.then(function () {
117								_playbackStarted = true;
118							})
119							.catch(function (error) {
120								_player.volume(0);
121								_player
122									.play()
123									.then(function () {
124										_playbackStarted = true;
125									})
126									.catch(function (error2) {
127									});
128							});
129					 }
130					_player.one("play", function () {
131						if (_playbackStarted === false) {
132							_playbackStarted = true;
133						}
134					});
135				}
136
137
138
139				if ($("#__ivm0").hasClass("sticky-video")) {
140					$("#__ivm0").removeClass("sticky-video");
141					//$("#video-placeholder").hide();
142				}
143			} else {
144				if (_isUnderElement(el, hh) && _showFloating && _playbackStarted && !$("#__ivm0").hasClass("sticky-video")) {
145
146					if(new_website==1 && 0)
147					{
148						var _playerID = $("#__ivm0 .video-js").attr("id"),
149							_player = videojs(_playerID);
150						_player.requestPictureInPicture();
151					}else {
152
153
154						$("#__ivm0").addClass("sticky-video");
155						if (!_evClose) {
156							_evClose = true;
157							$("#__ivm0 .close").click(function (ev) {
158								_showFloating = false;
159								$(this).parent().removeClass("sticky-video");
160								//$("#video-placeholder").hide();
161								var _playerID = $("#__ivm0 .video-js").attr("id"),
162									_player = videojs(_playerID);
163								_player.pause();
164							});
165						}
166					}
167
168					// $("#video-placeholder").show();
169				}
170			}
171		}
172
173		var tmpNews = document.getElementById("ivmBoxNews");
174		if (tmpNews) {
175			var elNews = tmpNews.parentNode,
176				hh = $("#header").height();
177			if (_isElementInViewport(elNews, hh)) {
178				if (!_playbackBoxNewsStarted) {
179
180					var _playerID = $("#ivmBoxNews .video-js").attr("id"),
181						_player = videojs(_playerID);
182					_player
183						.play()
184						.then(function () {
185							_playbackBoxNewsStarted = true;
186						})
187						.catch(function (error) {
188							_player.volume(0);
189							_player
190								.play()
191								.then(function () {
192									_playbackBoxNewsStarted = true;
193								})
194								.catch(function (error2) {
195								});
196						});
197				}
198			}
199		}
200	}
201}
202/*-------------------------------------------STICKY VIDEO--------------------------------*/
203
204function CloseNotification()
205{
206	var pushButton = document.querySelector('.push-notification');
207	pushButton.style.display = 'none';
208	$.ajax({
209		  type: "GET",
210		  url: "/framework/notification/cookie.php"
211	});
212}
213
214window.addEventListener("scroll", _throttleEvent(100, decidePlayerPosition));
215setTimeout(decidePlayerPosition,1000);
216
217$(function() {
218
219
220	$(window).bind('scroll', function() {
221		/* when reaching the element with id "last" we want to show the slidebox. Let's get the distance from the top to the element */
222		//var distanceTop = $('#last').offset().top - $(window).height();
223
224
225		//sticky viudeo
226		//_throttleEvent(100, decidePlayerPosition);
227	});
228	
229	/* remove the slidebox when clicking the cross */
230	$('#slidebox .close').bind('click',function(){
231		$(this).parent().hide();
232        $('#minimized').show();
233	});
234    $('#minimized').click(function(){
235        $('#slidebox').show();
236        $('#minimized').hide(); 
237    });
238
239
240	$("#harta path").each(function (index) {
241		var id  = this.getAttribute("id");
242		var st = $(this)[0];
243
244		$(this).hover(
245			function(){
246				this.setAttribute("class", "over");
247			},
248			function(){
249				this.setAttribute("class", this.defaultClass);
250			}
251		)
252			.click(function(){
253				ClickPath(id);
254			});
255
256		// unde punem numele prescurtate ale județelor
257		var	w = this.getBBox().width,
258			h = this.getBBox().height,
259			svg_l = $('#harta').offset().left,
260			svg_t = $('#harta').offset().top,
261			off = $(this).offset(),
262			ol = off.left,
263			ot = off.top,
264			stg = ol - svg_l,
265			sus = ot - svg_t,
266			left = stg + w / 2,
267			top =  sus + h / 2;
268
269		// we don't live in a perfect world
270
271		if (id == 'MH') left = left * 1.1
272		if (id == 'CT') left = left * 1.015
273		if (id == 'CJ') top  = top  * 1.15;
274		if (id == 'IF') top  = top  * 0.98;
275		if (id == 'B')  {top  = top  * 1.01; this.setAttribute("class", "buc");}
276		if (id == 'IL') {top = top  * 1.01; left = left * 1}
277
278
279		var t = SVG('text');
280		var textNode = document.createTextNode(id);
281		t.appendChild(textNode);
282		var t2	= $(t)
283			.attr('x', left)
284			.attr('y', top)
285
286			.attr({
287				fill: '#FFFFFF',
288				font: 'bold 14px arial,helvetica,sans-serif'
289
290			});
291		$("#harta svg").append(t2);
292
293
294		this.defaultClass = this.getAttribute("class");
295
296	});
297
298	$("#harta svg").attr('width', '100%');
299	$("#harta svg").attr('height', 'auto');
300
301
302
303});
304
305
306function SVG(tag) {
307	return document.createElementNS('http://www.w3.org/2000/svg', tag);
308}
309
310function ClickPath(id)
311{
312	document.location.href= $("#harta").data('path')+id;
313}
314function CheckFormAskQuestion()
315{
316	var email_reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
317	var phone_reg = /^([0-9]{6,20})$/;
318
319	$.ajax({
320		type: "POST",
321		url: "/framework/outside/ask_question.php",
322		data: $('#ask-question').serialize(),
323		success: function(data,text) {
324			if (data!=''){
325				$("#results").html(data);
326
327				var aTag =  $('#ask-question');
328				$('html,body').animate({scrollTop: aTag.offset().top},'slow');
329			}
330		}
331	})
332
333	return false;
334}
335function Voteaza()
336{
337	$.ajax({   
338	  type: "GET",   
339	  url: "/framework/poll/ajax.php",   
340	  data: $('#formpoll').serialize(),
341	  success: function(data,text) {
342		if (data!=''){
343			$("#results").html(data);
344
345			var aTag =  $('#formpoll');
346			$('html,body').animate({scrollTop: aTag.offset().top},'slow');
347		}
348	  }
349	})
350		
351//	alert(($('#formpoll').serialize()))
352}
353
354function Voteaza2(id,obj)
355{
356	$.ajax({
357		type: "GET",
358		url: "/framework/poll/ajax2.php?item="+id,
359		success: function(data,text) {
360			console.log(data);
361
362			var items = JSON.parse(data);
363			for (let i = 0; i < items.length; i++) {
364				$("#item_"+items[i].id+" .bar").css("animation", "none");
365				$("#item_"+items[i].id+" .bar").width(items[i].procent+"%");
366				$("#item_"+items[i].id+" .votes").html(items[i].procent+"%");
367			}
368
369		}
370	})
371
372//	alert(($('#formpoll').serialize()))
373}
374
375function openMenuNew()
376{
377	var h = $("#header");
378	h.toggleClass('submenu');
379	/*
380	if(h.hasClass('active')) {
381		h.prop('class',"");
382	}else{
383		h.prop('class',"active");
384	}
385
386	 */
387}
388function openMenu()
389{
390	var h = $("#header");
391	h.toggleClass('active');
392	/*
393	if(h.hasClass('active')) { 
394		h.prop('class',""); 
395	}else{
396		h.prop('class',"active"); 
397	}
398
399	 */
400}
401function openSearch()
402{
403	var h = $("#header");
404	h.toggleClass('search');
405	console.log($("#q"));
406
407
408	if(h.hasClass('search')) { 
409		$("#header #q").focus();
410	}
411}
412
413
414function OpenBox(url){
415	$('#overlay').css('display','block');
416	$("#box_email_body").load(url);
417	 
418	ttop=0;
419	if( typeof( window.innerWidth ) == 'number' ) {
420		//Non-IE
421		myWidth = window.innerWidth;
422		myHeight = window.innerHeight;
423		ttop=window.pageYOffset;
424	} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
425		//IE 6+ in 'standards compliant mode'
426		myWidth = document.documentElement.clientWidth;
427		myHeight = document.documentElement.clientHeight;
428		ttop=document.documentElement.scrollTop;
429	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
430		//IE 4 compatible
431		myWidth = document.body.clientWidth;
432		myHeight = document.body.clientHeight;
433		ttop=document.body.scrollTop;
434	}
435
436	l = (myWidth-700)/2;
437	t = (myHeight-250)/2+ttop ; 
438	
439	 $('#box_email').css('left',l+'px');
440	 $('#box_email').css('top' , t+'px'); 
441	 
442	 $('#box_email').css('display','block');
443}
444
445function Close(name){
446	$('#overlay').css('display','none');	
447	$('#'+name).css('display','none');
448} 
449
450function ChangeCalendar(url)
451{
452	$("#box_calendar").load(url);
453}
454
455function ChangeMonthCalendar(year,month)
456{
457	$("#box_calendar").load('/calendar_show.php?year='+year+"&month="+month);
458}
459
460function countChar(text,div,numar_caractere) {	
461	val = text.value;
462	if (val.length > numar_caractere) {
463		alert('Textul dumneavoastra depaseste limita de '+numar_caractere+' de caractere!');
464		text.value = val.substring(0,numar_caractere);
465		text.focus();
466	}
467	document.getElementById(div).innerHTML = parseInt(val.length);
468}
469
470function  ShowMore(obj)
471{
472	var button = $(obj);
473	if (button.hasClass("active"))
474	{
475		button.html("» Citește mai mult");
476		button.removeClass("active");
477		$(".more-desc").removeClass("active");
478	}else {
479		button.html("» Închide text");
480		button.addClass("active");
481		$(".more-desc").addClass("active");
482	}
483}
484
485function CopyUrl(obj) {
486	var $temp = $("<input>");
487	var $url = $(location).attr('href');
488
489	$("body").append($temp);
490	$temp.val($url).select();
491	document.execCommand("copy");
492	$temp.remove();
493
494	var saving = $("<span class='copy-url'>URL copiat!</span>")
495	$(obj).parent().append(saving);
496
497	setTimeout(function(){ saving.remove() }, 3000);
498}
499
500/*;(function($) {
501
502	$.fn.unveil_a3 = function(threshold, callback) {
503
504		var $w = $(window),
505			th = threshold || 150,
506			retina = window.devicePixelRatio > 1,
507			attrib = retina? "data-src-retina" : "data-src",
508			images = this,
509			loaded;
510
511		this.one("unveil", function() {
512			var source = this.getAttribute(attrib);
513			source = source || this.getAttribute("data-src");
514			if (source) {
515				this.setAttribute("src", source);
516				if (typeof callback === "function") callback.call(this);
517			}
518
519			if(window_width<=700) {
520				if(this.getAttribute("data-background-small")) {
521					this.style.backgroundImage = 'url("' + this.getAttribute("data-background-small") + '")';
522				}else if(this.getAttribute("data-background")) {
523					this.style.backgroundImage = 'url("' + this.getAttribute("data-background") + '")';
524				}
525			}else{
526				if(this.getAttribute("data-background")) {
527					this.style.backgroundImage = 'url("' + this.getAttribute("data-background") + '")';
528				}
529			}
530
531			this.classList.remove("lazy");
532		});
533
534		function unveil() {
535			var inview = images.filter(function() {
536				var $e = $(this);
537				if ($e.is(":hidden")) return;
538
539				var wt = $w.scrollTop(),
540					wb = wt + $w.height(),
541					et = $e.offset().top,
542					eb = et + $e.height();
543
544				return eb >= wt - th && et <= wb + th;
545			});
546
547			loaded = inview.trigger("unveil");
548			images = images.not(loaded);
549		}
550
551		$w.on("scroll.unveil resize.unveil lookup.unveil", unveil);
552
553		unveil();
554
555		return this;
556
557	};
558
559})(window.jQuery || window.Zepto);
560
561jQuery(function($){
562	$(".lazy").unveil_a3();
563})*/
564
565
566

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.