PageSourceSearch

https://www.laraf.fr/global/module/friends/ressources/javascript/friends.js?v=20260909_20230509-0

js laraf.fr collected 2026-09-24 15:01:01 UTC 9,159 bytes, 285 lines download raw bytes

1var uid = false;
2
3function addOnePending(uid)
4{
5	var pending_tab = $('.modFriend a[href="#sentRequest"]');
6	
7	var re = /(.*)(\d+)(.*)/
8	var match = pending_tab.html().match(re);
9
10	var current = parseInt(match[2]) + 1;
11	
12	pending_tab.html(match[1] + current + match[3]);
13}
14
15/**
16 * function sendRequest
17 * Aucun paramètre.
18 * 
19 * Cette fonction valide la demande d'ajout et l'envoi.
20 */
21function  sendRequest() {
22     
23    $('.messageArea').fadeOut('fast', function() {
24        $(this).prev('.requestSent').fadeIn('fast');
25    });
26    
27	$.post("/global/module/friends/ajax/ajax_friendAdd.php", { 'uid' : $("#uid").val(), 'message' : $(".cartmanMessages").val() }, function(data) { 
28		
29		$('.friendBlock#' + uid).animate({
30			width: 0
31		}, 'fast', function() { $(this).remove(); });
32		
33		uid = false;
34		
35    	if ($(".searchFriendResult #" + uid).size())
36			$(".searchFriendResult #" + uid).fadeOut("slow").remove();
37		
38		if ($("#sentRequest").size())
39			$("#sentRequest div:first").append(data);
40		
41		initDeleteRequestLink();
42		initSendMailLink();
43		initShowMessageJoinedLink();
44		addOnePending($("#uid").val());
45	});
46}
47
48function initFriendAddLink()
49{
50    if( $(".friendBlockAddLink").length ) {
51        $(".friendBlockAddLink").unbind("click").click(function() {
52            uid = $(this).closest("div").attr("id");
53        }); // How to retrieve UID
54
55        $(".friendBlockAddLink").fancybox({
56	'scrolling': 'no',	
57	onComplete: function() {
58                $(".makeButton").each(function() {
59                    $(this).button({
60                        icons: {
61                            primary: $(this).attr("icon"),
62                            secondary: $(this).attr("iconRight")
63                        },
64                        text : $(this).html()
65                    }).removeAttr("icon").removeAttr("iconRight").removeClass("makeButton");
66                });
67            },
68            showCloseButton: false
69        }); // FancyStyle the link
70    }
71}
72
73function initFriendBlockDeleteLink()
74{
75	if ($(".friendBlockDeleteLink").size())
76	{
77		$(".friendBlockDeleteLink").unbind("click").click(function() {
78			if (confirm(polyglot.t("friends.confirm_operation")))
79			{
80				var idRelation = $(this).closest("div").attr("id").substr(1, $(this).closest("div").attr("id").length - 1);
81				$.post("/global/module/friends/ajax/ajax_deleteFriend.php", { 'idRelation' :  idRelation }, function() {
82					$("div#F" + idRelation).animate({
83						'width': 0
84					}, 'fast', function() {
85						$(this).remove();
86					});
87				});
88			}
89		});
90	}
91		
92}
93
94function initDeleteRequestLink()
95{
96	$(".friendBlockCancelAdd").unbind("click").click(function() {
97		if (confirm(polyglot.t("friends.confirm_delete")))
98		{
99				var idRequest = $(this).closest("div").attr("id");
100				$.post("/global/module/friends/ajax/ajax_friendDeleteRequest.php", { "request" : idRequest }, function() {
101					$("div#" + idRequest).animate({
102						'width': 0
103					}, 'fast', function() { $(this).remove() });
104				});		
105		}
106	});
107}
108
109function initRefuseRequestLink()
110{
111	$(".friendBlockRefuseAdd").unbind("click").click(function() {
112		if (confirm(polyglot.t("friends.confirm_refuse")))
113		{
114			var idRequest = $(this).closest("div").attr("id");
115			$.post("/global/module/friends/ajax/ajax_friendRefuseRequest.php", { "request" : idRequest }, function() {
116				$("div#" + idRequest).fadeOut("slow").remove();
117                location.reload();
118                return false;
119			});
120            
121            
122		}
123	});
124}
125
126function initAcceptRequestLink()
127{
128	$(".friendBlockAcceptAdd").unbind("click").click(function() {
129		if (confirm(polyglot.t("friends.confirm_accept")))
130		{
131			var idRequest = $(this).closest("div").attr("id");
132			$.post("/global/module/friends/ajax/ajax_friendAcceptRequest.php", 
133					{ "request" : idRequest }, 
134					function(data) 
135					{
136						$("div#" + idRequest).fadeOut("slow").remove();
137						$(".friendList").html($(".friendList").html() + data);
138						initFriendBlockDeleteLink();
139						
140						location.reload();
141						
142						return false;
143					}
144			);
145		}
146	});
147}
148
149function initSendMailLink()
150{
151	$(".friendBlockResend").unbind("click").click(function() {
152		var idRequest = $(this).closest("div").attr("id");
153		$.post("/global/module/friends/ajax/ajax_sendFriendInvitation.php", { 'request' :  idRequest }, function() {
154			alert(polyglot.t("friends.reminder_email_send"));
155		});	
156	});
157}
158
159function initSuggestionCloseButton()
160{
161	$(".friendBlockRejectSuggest").unbind("click").click(function() {
162		if (confirm(polyglot.t("friends.confirm_no_add")))
163		{
164			var idSuggestion = $(this).closest(".friendBlockSuggestion").attr("id").substr(1, $(this).closest(".friendBlockSuggestion").attr("id").length - 1);
165			$.post("/global/module/friends/ajax/ajax_FriendCloseSuggestion.php", { 'idSuggestion' : idSuggestion });
166			$(this).closest("div.friendBlockSuggestion").slideUp("slow", function() { 
167				$(this).remove(); 
168				if ($("div.friendBlockSuggestion").size() == 0)
169					$(".renewSuggestButton").slideDown(); });
170		}
171	});
172}
173
174function initSuggestionAddButton() {
175	$(".friendBlockAddLinkFromSuggestion").unbind("click").click(function() {
176        
177        if(!$('.addFriendPersonnalMessage').size()) {
178            $('body').append("<div class='addFriendPersonnalMessage'><table class='tableau_formulaire'><tr><th valign='top'>"+polyglot.t("friends.add_personal_message")+"</th><td><textarea cols='55' rows='5'></textarea></td></tr></table></div>");
179        }
180        
181		var idSuggestion = $(this).closest(".friendBlockSuggestion").attr("id").substr(1, $(this).closest(".friendBlockSuggestion").attr("id").length - 1);
182		
183		$(".addFriendPersonnalMessage").find("textarea").val("");
184		
185		$(".addFriendPersonnalMessage").dialog("destroy");
186		$(".addFriendPersonnalMessage").dialog({
187			"title" : $(this).attr("title"),
188			"width" : 600,
189			"buttons" : { [polyglot.t("friends.send_request")] : function() {
190				$.post("/global/module/friends/ajax/ajax_friendAddFromSuggestion.php", { 'idSuggestion' : idSuggestion, 'message' : $(this).find('textarea').val() }, function(data) { 
191					$(".addFriendPersonnalMessage").dialog("close");
192					$("#s" + idSuggestion).slideUp("slow", function() { 
193						$(this).remove(); 
194						if ($("div.friendBlockSuggestion").size() == 0)
195							$(".renewSuggestButton").slideDown(); 
196						alert(polyglot.t("friends.find_demand_in_friendslist", {data: data}));
197                    });
198					
199				});
200			},
201			[polyglot.t("core.cancel")] : function() { $(this).dialog("close"); }}
202		});
203		$(".renewSuggestButton").slideDown();
204	});
205}
206
207function getNewSuggest()
208{
209	$.get("/global/module/friends/ajax/ajax_friendGenerateSuggest.php", {}, function(data) {
210		if (data != "")
211		{
212			$("#noSuggest").remove();
213			$("#widgetSuggestContent").html(data).css("height", "340px").css("width" , "100%").css("overflow-y", "scroll").css("overflow-x", "hidden");
214			
215			initSuggestionCloseButton();
216			initSuggestionAddButton();
217			
218			$('.renewSuggestButton').trigger('done');
219		}
220		$(".renewSuggestButton").slideUp();
221	});
222}
223
224function initShowMessageJoinedLink() {
225    $('a.friendBlockShowJoinedMessage').each(function() {
226        $(this).unbind('click').click(function() {
227            $(this).closest('.friendBlock').find('p.joinedMessage').slideDown('fast').delay(1500).slideUp();
228        });
229    });
230}
231
232$(document).ready(function() {
233	$(".searchFriend").unbind("click").click(function() {
234		$(".searchFriendResult").html('<div class="uiLoader"><i class="fas fa-spinner fa-spin fa-3x fa-fw"></i></div>');
235		$.post(
236			"/global/module/friends/ajax/ajax_searchFriend.php",
237			{
238				'nom' : $(this).closest("form").find("#nom").val(),
239				'prenom' : $(this).closest("form").find("#prenom").val(),
240				'ville' : $(this).closest("form").find("#ville").val(),
241				'dept' : $(this).closest("form").find("#dept").val(),
242				'pays' : $(this).closest("form").find("#pays").val()
243			},
244			function(data) {
245				$(".searchFriendResult").html(data);
246				initFriendAddLink();
247			}
248		);
249		return false;
250	});
251	
252	initFriendBlockDeleteLink();
253	initDeleteRequestLink();
254	initRefuseRequestLink();
255	initAcceptRequestLink();
256	initSendMailLink();
257	initFriendAddLink();
258    initShowMessageJoinedLink();
259    initSuggestionCloseButton();
260	initSuggestionAddButton();
261    
262});
263
264
265function loadRankingFriends(id) {
266    if(id) {
267        $('#zone_ranking_asso'+id).html("<center><img src='/global/images/ajax-loader.gif'></center>");
268        $.post("/global/module/friends/ajax/recupFriendsAjaxNiveau.php", { 'longeur' : id }, function(data) {
269			$('#zone_ranking_asso'+id).html(data);
270		});
271    }
272}
273
274
275function showFriends_niveau(id) {
276    if( $('#zone_ranking_asso'+id).length) {
277        
278        if( $('#zone_ranking_asso'+id).is(':visible') ) {
279            $('#zone_ranking_asso'+id).fadeOut();
280        } else {
281            loadRankingFriends(id);
282            $('#zone_ranking_asso'+id).fadeIn();
283        }
284    }
285}

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.