PageSourceSearch

https://black-book-editions.fr/javascripts_v2.2.js?v=140

js black-book-editions.fr collected 2026-09-24 19:15:15 UTC 14,377 bytes, 570 lines download raw bytes

1
2// Variables globales
3var chrono 				= null;
4var chrono_special		= null;
5var quest_event_click 	= false;
6var do_reporting 		= true;
7var xml_script_url 		= 'xml_request.php';
8var xml_process 		= false;
9var xml_msg 			= '';
10var quick_search_active = false;
11var global_event 		= null;
12
13/* AVATAR */
14
15function preview_avatar()
16{
17	var img_src_to_preview=$("#avatar_public").val();
18	if (img_src_to_preview!='') $("#avatar_preview").attr("src", "contenu/image/avatar/"+img_src_to_preview);
19	else $("#avatar_preview").attr("src", img_src_original);
20}
21
22/* Fil info pour actu & home */
23
24function show_fil_info(id)
25{
26	$("#fil_info_filtre a").removeClass("actif");
27	$("#fim"+id).addClass("actif");
28	$("#fil_info_content").html('<i class="fa fa-spinner fa-spin"></i>');
29	$.post( xml_script_url, 
30				{ a: 'get_fil_info', id: id }, 
31				function(data) { 
32					eval(data);
33					if (xml_process) $("#fil_info_content").html(html);
34				});
35}
36
37/* QUICK SEARCH */
38
39function quick_search(evenement)
40{
41	window.clearTimeout(chrono);
42	global_event = evenement;
43
44	// On attend 1 demi seconde avant de lancer la recherche
45	// pour permettre à l'internaute de finir de taper sur son clavier
46
47	chrono       = setTimeout(do_quick_search, 500);
48}
49
50function show_quick_search()
51{
52	var str=$("#str_to_search").val();
53	if (!quick_search_active)
54	{
55		quick_search_active = true;
56		$("#quick_search_main").addClass('search_active');
57	}
58	if (str!='') $("#quick_search").show();
59	else $("#quick_search").hide();
60}
61
62function hide_quick_search()
63{
64	if (quick_search_active)
65	{
66		quick_search_active = false;
67		$("#quick_search_main").removeClass('search_active');
68		$("#quick_search").hide();
69	}
70}
71
72function do_quick_search()
73{
74	window.clearTimeout(chrono);
75	
76	var str=$("#str_to_search").val();
77	var touche = window.event ? global_event.keyCode : global_event.which;
78	if (touche==13 && str.length>2) do_search();
79	else if (str.length>2)
80	{
81		show_quick_search();
82		//$("#btn_search").html('<i class="fa fa-spinner fa-spin"></i>');
83		$.post( xml_script_url, 
84				{ a: 'quick_search', q: str }, 
85				function(data) { 
86					eval(data);
87					if (xml_process)
88					{
89						$("#quick_search").html(html);
90					}
91					//$("#btn_search").html('<i class="fa fa-search"></i>');
92		});
93	}
94}
95
96function do_search()
97{
98	var search_string=$("#str_to_search").val();
99
100	if (window.isBetaCatalogRoutingActive) {
101		go_to( window.cortexUrl + '/catalogue/recherche?searchText=' + encodeURIComponent(search_string) );
102	} else {
103		go_to( 'recherche.php?q=' + encodeURIComponent(search_string) );
104	}
105
106	return false;
107}
108
109/* Filtre */
110
111function do_filter(obj)
112{
113	var filter_name  = obj.id;
114	var filter_value = obj.options[obj.selectedIndex].value;
115	var a  = getQuerystring('a','');
116	var id = getQuerystring('id','');
117
118	var url = window.location.pathname + "?";
119
120	if (a!='') url += "a=" + a + '&';
121	if (id!='') url += "id=" + id + '&';
122	url += filter_name + "=" + filter_value;
123	window.location.href = url + '#hp_catalogue_select';
124}
125
126function do_text_filter(obj)
127{
128	var filter_name  = obj.id;
129	var filter_value = obj.value;
130	var a  = getQuerystring('a','');
131	var id = getQuerystring('id','');
132
133	var url = window.location.pathname + "?";
134
135	if (a!='') url += "a=" + a + '&';
136	if (id!='') url += "id=" + id + '&';
137	url += filter_name + "=" + filter_value;
138	window.location.href = url + '#hp_catalogue_select';
139}
140
141function getQuerystring(key, default_)
142{
143	if (default_==null) default_=""; 
144
145	key = key.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
146
147	var regex = new RegExp("[\\?&]"+key+"=([^&#]*)");
148	var qs = regex.exec(window.location.href);
149
150	if (qs == null) return default_; else return qs[1];
151}
152
153/* Redirection */
154
155function go_to(url)
156{
157	document.location.href = url ;
158}
159
160function formate_nombre(nombre)
161{
162	var str=nombre.toFixed(2)+'';
163	return str.replace('.',',');
164}
165
166/* ************************* */
167/*       SELECT MEMBER       */
168/* ************************* */
169
170var focus_on_search_member = new Array(false,false);
171
172function search_member(evenement)
173{
174	window.clearTimeout(chrono);
175	global_event = evenement;
176
177	chrono       = setTimeout(do_search_member, 500);
178}
179
180function show_suggestion()
181{
182	$("#member_suggestion").show();
183}
184
185function hide_suggestion()
186{
187	if (!focus_on_search_member[0] && !focus_on_search_member[1])
188	{
189		window.clearTimeout(chrono);
190		chrono = setTimeout(do_hide_suggestion, 200);
191	}
192}
193
194function do_hide_suggestion()
195{
196	$("#member_suggestion").hide();
197}
198
199/* ****************** */
200/*       Forums       */
201/* ****************** */
202
203var displayed_author_id = -1;
204var displayed_actions   = 0;
205var use_ckeditor        = true;
206
207function confirm_forum_all_read()
208{
209	alertify.confirm().setting({
210		'labels':{ok:'Confirmer', cancel:'Annuler'},
211		'closable': false,
212		'message': 'Etes-vous sur de vouloir marquer tout le forum comme ayant été lu ?' ,
213		'onok': function(){
214			go_to('forums.php?a=forum_all_read');
215		},
216		'onclose': function(){}
217	}).show();
218}
219
220function confirm_board_all_read(board_id)
221{
222	alertify.confirm().setting({
223		'labels':{ok:'Confirmer', cancel:'Annuler'},
224		'closable': false,
225		'message': 'Etes-vous sur de vouloir marquer tout les sujets de ce forum comme ayant été lus ?' ,
226		'onok': function(){
227			go_to('forums.php?a=board_all_read&board_id='+board_id);
228		},
229		'onclose': function(){}
230	}).show();
231}
232
233function confirm_board_hide(board_id)
234{
235	alertify.confirm().setting({
236		'labels':{ok:'Masquer', cancel:'Annuler'},
237		'closable': false,
238		'message': 'Masquer cette section ? Vous ne la verrez plus dans la liste des forums.',
239		'onok': function(){
240			go_to('forums.php?a=board_hide&board_id='+board_id);
241		},
242		'onclose': function(){}
243	}).show();
244}
245
246function confirm_board_unhide(board_id)
247{
248	alertify.confirm().setting({
249		'labels':{ok:'Réafficher', cancel:'Annuler'},
250		'closable': false,
251		'message': 'Réafficher cette section dans la liste des forums ?',
252		'onok': function(){
253			go_to('forums.php?a=board_unhide&board_id='+board_id);
254		},
255		'onclose': function(){}
256	}).show();
257}
258
259function cancel_reply()
260{
261	if (use_ckeditor) CKEDITOR.instances['commentaire'].setData('');
262	else $("#commentaire").text('');
263	$("#commentaire_info").html('');
264	$("#form_id").val(0);
265	$("#form_parent_id").val(0);
266	$("#form_parent_auteur_id").val(0);
267	switch_form_reply();
268}
269
270function reply(id, topic_id, copy_content, auteur)
271{
272	var html = '';
273
274	if ($("#form_reply").hasClass('off')) switch_form_reply();
275
276	$("#form_id").val(0);
277
278	if (copy_content) 						// Citer
279	{
280		$("#form_parent_id").val(0);
281		$("#form_parent_auteur_id").val(0);
282	}
283	else 									// Répondre
284	{
285		$("#form_parent_id").val(id);
286		$("#form_parent_auteur_id").val(auteur);
287	}
288	
289	$.post( xml_script_url, 
290		{ a: 'get_message_content', id: id, methode: 'quote' }, 
291		function(data) { 
292			eval(data);
293			if (xml_process)
294			{
295				if (use_ckeditor)
296				{
297					if (!copy_content) html='<p> </p>';
298					CKEDITOR.instances['commentaire'].setData(html);
299				}
300				else
301				{
302					if (!copy_content) html='';
303					$("#commentaire").text(html);
304				}
305
306				$("#commentaire_info").html('<a href="#msg'+id+'"><i class="fa fa-chevron-circle-up"></i></a>'
307					+' Rédigez une réponse au commentaire n°'+id
308					+' <a href="javascript:cancel_reply()" class="btn btn-sm btn-link"><i class="fa fa-close"></i> Annuler</a>');
309			}
310			
311			var offsetTop = parseInt(window.getComputedStyle(document.getElementById("html"), null).getPropertyValue('scroll-padding-top'))
312			$('html').animate({scrollTop: ($("#form_reply").offset().top - offsetTop) }, 500);
313	});
314}
315
316function edit(id, topic_id)
317{
318	var html = '';
319
320	if ($("#form_reply").hasClass('off')) switch_form_reply();
321
322	$("#form_id").val(id);
323	$("#form_parent_id").val(0);
324	$("#form_parent_auteur_id").val(0);
325	
326	$.post( xml_script_url, 
327		{ a: 'get_message_content', id: id, methode: 'edit' }, 
328		function(data) { 
329			eval(data);
330			if (xml_process)
331			{
332				if (use_ckeditor) CKEDITOR.instances['commentaire'].setData(html);
333				else $("#commentaire").text(html);
334
335				$("#commentaire_info").html('<a href="#msg'+id+'"><i class="fa fa-chevron-circle-up"></i></a>'
336					+' Editez le commentaire n°'+id
337					+' <a href="javascript:cancel_reply()" class="btn btn-sm btn-link"><i class="fa fa-close"></i> Annuler</a>');
338			}
339			$('html,body').animate( {scrollTop: $("#form_reply").offset().top }, 500);
340	});
341}
342
343function switch_form_reply()
344{
345	if ($("#form_reply").hasClass('on')) // Masquage
346	{
347		$("#form_reply").slideUp(300, function(){
348			$("#form_reply").removeClass('on').addClass('off');
349		});
350		$("#switch_reply").html('<i class="fa fa-pencil"></i> Rédiger une réponse...');
351	}
352	else // Affichage
353	{
354		$("#form_reply").slideDown(300, function(){
355			$("#form_reply").removeClass('off').addClass('on');
356		});
357		$("#switch_reply").html('<i class="fa fa-close"></i> Masquer le formulaire');
358	}
359}
360
361function follow(id)
362{
363	$.post( xml_script_url, 
364		{ a: 'follow_topic', id: id }, 
365		function(data) { 
366			eval(data);
367			if (xml_process)
368			{
369				if (xml_msg=='subscribed')
370				{
371					$('.btn_follow_topic').removeClass('btn-default').addClass('btn-warning').html('<i class="fa fa-star"></i> Vous suivez ce sujet');
372					alertify.success('Vous suivez désormais ce sujet');
373				}
374				else
375				{
376					$('.btn_follow_topic').removeClass('btn-warning').addClass('btn-default').html('<i class="fa fa-star-o"></i> Suivre ce sujet');
377					alertify.warning('Vous ne suivez plus ce sujet');
378				}
379			}
380	});
381}
382
383function report(id)
384{
385	alertify.confirm().setting({
386		'labels':{ok:'Signaler', cancel:'Annuler'},
387		'closable': false,
388		'message': 'Etes-vous sur de vouloir signaler ce message ?' ,
389		'onok': function(){
390			$.post( xml_script_url, 
391				{ a: 'message_report', id: id }, 
392				function(data) { 
393					eval(data);
394					if (xml_process)
395					{
396						if (xml_msg!='') alertify.warning( xml_msg );
397						else alertify.success( 'Message signalé au modérateur' );
398					}
399			});
400		},
401		'onclose': function(){}
402	}).show();
403}
404
405function like(id)
406{
407	var nb_like 	= $('#msg'+id).data("like");
408	var nb_dislike 	= $('#msg'+id).data("dislike");
409	var current 	= $('#msg'+id).data("current");
410
411	$.post( xml_script_url, 
412		{ a: 'message_like', id: id }, 
413		function(data) { 
414			eval(data);
415			if (xml_process)
416			{
417				if (current=='like')
418				{
419					$('#msg'+id).data("current",'none');
420					$('#msg'+id).data("like",nb_like-1);
421					$('#msg'+id+' .like').removeClass('selected');
422					$('#msg'+id+' .like').html( html_compteur(id,'like') );
423				}
424				else
425				{
426					if (current=='dislike')
427					{
428						$('#msg'+id).data("dislike",nb_dislike-1);
429						$('#msg'+id+' .dislike').removeClass('selected');
430						$('#msg'+id+' .dislike').html( html_compteur(id,'dislike') );
431					}
432					$('#msg'+id+' .like').addClass('selected');
433					$('#msg'+id).data("like",nb_like+1);
434					$('#msg'+id).data("current",'like');
435
436					$('#msg'+id+' .like').html( html_compteur(id,'like') );
437				}
438			}
439	});
440}
441
442function dislike(id)
443{
444	var nb_like 	= $('#msg'+id).data("like");
445	var nb_dislike 	= $('#msg'+id).data("dislike");
446	var current 	= $('#msg'+id).data("current");
447
448	$.post( xml_script_url, 
449		{ a: 'message_dislike', id: id }, 
450		function(data) { 
451			eval(data);
452			if (xml_process)
453			{
454				if (current=='dislike')
455				{
456					$('#msg'+id).data("current",'none');
457					$('#msg'+id).data("dislike",nb_dislike-1);
458					$('#msg'+id+' .dislike').removeClass('selected');
459					$('#msg'+id+' .dislike').html( html_compteur(id,'dislike') );
460				}
461				else
462				{
463					if (current=='like')
464					{
465						$('#msg'+id).data("like",nb_like-1);
466						$('#msg'+id+' .like').removeClass('selected');
467						$('#msg'+id+' .like').html( html_compteur(id,'like') );
468					}
469					$('#msg'+id+' .dislike').addClass('selected');
470					$('#msg'+id).data("dislike",nb_dislike+1);
471					$('#msg'+id).data("current",'dislike');
472					$('#msg'+id+' .dislike').html( html_compteur(id,'dislike') );
473				}
474			}
475	});
476}
477
478function html_compteur(id,action)
479{
480	var thumb='down';
481	var nb = $('#msg'+id).data(action);
482	if (action=='like') thumb='up';
483	return '<i class="fa fa-thumbs-o-'+thumb+'"></i> ' + (nb>0?nb:'');
484}
485
486/* QUICK VIEW : Affiche le détail */
487
488function produit_show_detail(id)
489{
490	$("#produit_"+id+" .pr_lib").hide();
491	$("#produit_"+id+" .pr_detail").show();
492}
493
494function produit_hide_detail(id)
495{
496	$("#produit_"+id+" .pr_lib").show();
497	$("#produit_"+id+" .pr_detail").hide();
498}
499
500/* EVENT QUEST : The Rabbit Curse */
501
502function show_rabbit(x,y)
503{
504	$('#rabbit').animate(
505		{ opacity: 1, top: x, left: y }, 
506		2000, 
507		function() { 
508			chrono_special = setTimeout(auto_hide_rabbit, 5000); 
509		}
510	);
511}
512
513function auto_hide_rabbit()
514{
515	quest_event_click=true;
516	window.clearTimeout(chrono_special);
517	$('#rabbit').css('background-image', 'url("img/rabbit_curse.png")');  
518	chrono_special = setTimeout(rabbit_end, 2000);
519	$.post( xml_script_url, 
520			{ a: 'event_quest_rabbit_curse', action: 'curse' }, 
521			function(data) {}
522	);
523}
524
525function kill_the_rabbit()
526{
527	if (!quest_event_click)
528	{
529		quest_event_click=true;
530		window.clearTimeout(chrono_special);
531		$('#rabbit').css('background-image', 'url("img/rabbit_splash.png")');
532		chrono_special = setTimeout(rabbit_end, 500);
533		$.post( xml_script_url, 
534			{ a: 'event_quest_rabbit_curse', action: 'kill' }, 
535			function(data) {}
536	);
537	}
538}
539
540function rabbit_end()
541{
542	window.clearTimeout(chrono_special);
543	$('#rabbit').animate( { opacity: 0 }, 1000, function() { 
544		$('#rabbit').remove();
545	});
546}
547
548/* EVENT QUEST : DRAGON wants you */
549
550function dragon_do(action)
551{
552	if (action=='note')
553	{
554		go_to(xml_script_url+'?a=event_quest_dragon&action=note')
555	}
556	else if (action=='close')
557	{
558		$.post( xml_script_url, 
559			{ a: 'event_quest_dragon', action: 'close' }, 
560			function(data) {
561				$('#dragon_ask').remove();
562			}
563		);
564	}
565	else if (action=='only_close')
566	{
567		$('#dragon_ask').remove();
568	}
569	else alertify.error('Ne réveillez pas le dragon...');
570}

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.