PageSourceSearch

https://reteteculinare.ro/js/utils.js?112

js reteteculinare.ro collected 2026-10-02 13:22:10 UTC 4,876 bytes, 120 lines download raw bytes

1//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2
3$(document).ready(function(){
4
5	if ( xWado >= 1020 && $(".calup-stiri--articol .C1").length ) {
6		//$(".culinare-ingrediente__ad div").first().detach().addClass( "culinare-body-articol__ad" ).insertBefore(".culinare-ingrediente");
7		//$(".culinare-ingrediente__ad").hide();
8		//$(".ads.ads--top .banner").detach().removeClass( "banner" ).addClass( "culinare-body-articol__ad" ).insertAfter(".news-item__info:first p");	
9		//$(".ads.ads--top").hide();
10		
11		$(".C1 .culinare-body-articol__ad").first().detach().removeClass( "culinare-body-articol__ad" ).appendTo( ".ads.ads--top .banner" );
12		$(".ads.ads--top").show();
13	}		
14	
15	stateLikes();
16	$("body").on("click", ".__likeable", function(){
17		
18		var el = $(this);
19		if ( "undefined" === typeof $(this).attr("href") ) return false;
20
21		$.get( BASE_URL + "api/like.php", {id:$(this).data("id")}).done(function(response){
22			if ( response.success ){
23				el.find("img:first").attr( "src",  el.find("img:first").attr("src").replace("icon-heart.svg", "icon-heart-liked.svg") );
24				el.contents().filter(function(){
25					return this.nodeType == 3;
26				}).first().replaceWith( response.likes );
27				el.removeAttr("href");
28			}
29		});
30		
31	});
32	
33	$("#__content a").each(function(){$(this).attr("target", "_blank");})
34	
35	$("#comments").on("submit", function(e){
36		e.preventDefault();
37		if ( !document.getElementById('g-recaptcha-response') || !document.getElementById('g-recaptcha-response').value ) return;
38		
39		data = {id:$("#comments").data("id"),name:$("#field1").val(), text:$("#field3").val(), token:document.getElementById('g-recaptcha-response').value};
40		if ( !data.name ){ alert("Completati numele");$("#field1").focus();return;}
41		if ( !data.text ){ $("#field3").focus();return;}
42		
43		$.post( BASE_URL + "api/comment.post.php", data).done(function(response){
44			if ( response.success ){
45				$("#__comments").append( response.html );
46				grecaptcha.reset();		
47			}
48			
49		});
50		
51		$("#field3").val("");
52	});	
53	
54	$("body").on("click", ".__deleteable_comment", function(e){
55		e.preventDefault();
56		var data = {id:$(this).closest(".comment").data("id")};
57		
58		$.post( BASE_URL + "api/comment.delete.php", data).done(function(response){
59			
60			if ( response.success ){
61				$("#comment" + data.id ).remove();	
62			}
63			
64		});
65	});	
66	
67});
68
69function stateLikes(){
70	
71	var ids = [];
72	
73	$(".__likeable").filter(function(){
74		return !$(this).data("stated");
75	}).each(function(){
76		ids.push( $(this).data("id") );
77	});
78
79	$.get( BASE_URL + "api/like.state.php", {ids:ids.join()}).done(function(response){
80
81-		$(".__likeable").filter(function(){
82			return !$(this).data("stated");
83		}).each(function(){
84
85			$(this).data("stated", "1");
86			
87			//if ( response.includes( $(this).data("id") ) ){
88			if ( typeof response[ $(this).data("id") ]  !== "undefined" ){
89				
90				$(this).data("likes", response[ $(this).data("id") ].likes );
91				
92				if( response[ $(this).data("id") ].liked ){
93					$(this).find("img:first").attr( "src",  $(this).find("img:first").attr("src").replace("icon-heart.svg", "icon-heart-liked.svg") );
94					$(this).contents().filter(function(){
95						return this.nodeType == 3;
96					}).first().replaceWith( $(this).data("likes") );
97					$(this).removeAttr("href");
98				}
99			}
100			
101		});
102		
103	});
104}
105/******************************************************************************************************************************************************************************/
106function isValidEmail(email) {
107	var pattern = /^([a-z\d!#$%&'*+\-\/=?^_`{|}~\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+(\.[a-z\d!#$%&'*+\-\/=?^_`{|}~\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+)*|"((([ \t]*\r\n)?[ \t]+)?([\x01-\x08\x0b\x0c\x0e-\x1f\x7f\x21\x23-\x5b\x5d-\x7e\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]|\\[\x01-\x09\x0b\x0c\x0d-\x7f\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))*(([ \t]*\r\n)?[ \t]+)?")@(([a-z\d\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]|[a-z\d\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF][a-z\d\-._~\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]*[a-z\d\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])\.)+([a-z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]|[a-z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF][a-z\d\-._~\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]*[a-z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])\.?$/i;
108	return pattern.test(email);
109};
110
111function parseYoutubeUrl(url){
112    	var pattern = /^(?:https?:\/\/)?(?:m\.|www\.)?(?:youtu\.be\/|youtube\.com\/(?:embed\/|v\/|watch\?v=|watch\?.+&v=))((\w|-){11})(\?\S*)?$/;
113    	if(url.match(pattern)){
114        		return url.match(pattern)[1];
115    	}
116    	return false;	
117}
118/******************************************************************************************************************************************************************************/
119
120

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.