PageSourceSearch

https://www.village-justice.com/articles/local/cache-js/jsdyn-_js_cibloc_js-95be996e.js?1790850621

js village-justice.com collected 2026-10-01 10:38:07 UTC 12,280 bytes, 301 lines download raw bytes

1/* #PRODUIRE{fond=_js/cibloc.js}
2   md5:a7a917d44d26c5887260577959f3d6d8 */
3
4 //;(function($mikavar){
5 //})(jQuery);
6// mika noConflict
7var $ = jQuery.noConflict(); 
8// fin 
9var $mikavar = jQuery.noConflict();
10
11var cibloc_accordeon_id = 0;
12var cibloc_question_id = 0;
13var cibloc_ancre = window.location.hash;
14var cibloc_ancre_existe = false;
15
16
17function cibloc_accordeon_replier_tout(id_question_click) {
18    var bloc_id = '';
19    var tableau = '';
20    var tableau_click = id_question_click.split('-');
21    var id_bloc_click = '';
22    if (typeof tableau_click[0] !== 'undefined' && typeof tableau_click[1] !== 'undefined') {
23        id_bloc_click = tableau_click[0] + '-' + tableau_click[1];
24    }
25
26    var lesLiens = $mikavar('.cibloc_accordeon a.accordeon_lien');
27    for (var i=0; i < lesLiens.length; i++) {
28        bloc_id = '';
29        question_id = $mikavar(lesLiens[i]).attr('aria-controls');
30        tableau = question_id.split('-');
31        if (typeof tableau[0] !== 'undefined' && typeof tableau[1] !== 'undefined') {
32            bloc_id = tableau[0] + '-' + tableau[1];
33        }
34        if (bloc_id == id_bloc_click){
35            $mikavar(lesLiens[i]).attr('aria-expanded', 'false');
36            $mikavar(lesLiens[i]).removeClass('expanded');
37            $mikavar('#' + question_id).attr('aria-hidden', 'true');
38            $mikavar('#' + question_id).css('display', 'none');
39        }
40    }
41};
42
43function cibloc_init_js() {
44    
45    var intertitre = "h3";    
46    
47    // chaque question doit etre un intertitre dans le bloc accordeon
48    // la premiere question est depliee par defaut
49    // (et une question est deplie si l'URL contient l'ancre de cette question)
50    $mikavar('.cibloc_accordeon').each(function() {
51        cibloc_accordeon_id++;
52        cibloc_question_id = 0;
53
54        $mikavar(this).find(intertitre).each(function() {
55            var $mikavarthis = $mikavar(this);
56
57            // index de l'element dans la collection
58            cibloc_question_id++;
59            var prefixe = 'accordeon-' + cibloc_accordeon_id + '-';
60            var id = prefixe + cibloc_question_id;
61
62            // masquer au demarrage ...
63            var style = ' style="display:none;"';
64            var ariahidden = ' aria-hidden="true"';
65            var ariaexpanded = ' aria-expanded="false"';
66            var lienclass = ' class="accordeon_lien"';
67
68            // ... sauf si l'URL contient l'ancre de la question
69            if (cibloc_ancre){
70                if (cibloc_ancre=='#'+id){
71                    style = '';
72                    ariahidden = ' aria-hidden="false"';
73                    ariaexpanded = ' aria-expanded="true"';
74                    lienclass = ' class="accordeon_lien expanded"';
75                    cibloc_ancre_existe = true;
76                } else if (cibloc_ancre.substring(1,prefixe.length+1)==prefixe){
77                    cibloc_ancre_existe = true;
78                }
79            }
80
81            // ... sinon sauf la premiere reponse
82            if (!cibloc_ancre_existe && cibloc_question_id==1) {
83                style = '';
84                ariahidden = ' aria-hidden="false"';
85                ariaexpanded = ' aria-expanded="true"'
86                lienclass = ' class="accordeon_lien expanded"';
87            }
88
89            // enlever un eventuel lien de retour au sommaire
90            $mikavarthis.children( "a.sommaire-back" ).css( "display", "none" );
91
92            // entourer la reponse avec un div
93            $mikavarthis.nextUntil(intertitre).wrapAll('< div id="'+ id +'"' + ariahidden + style +' class="cibloc_reponse">');
94            var reponse = $mikavarthis.next();
95
96            // Cas de l'affichage de la liste des blocs : ne pas activer le clic 
97            if ($mikavarthis.parents().hasClass("cibloc_sans_vignette")){
98                // ajouter un lien
99                $mikavarthis.wrapInner('< span>');
100                $mikavarthis.wrapInner('< span role="button" '+ lienclass + ariaexpanded + ' aria-controls="'+ id +'">');
101
102            // Cas classique    
103            } else {
104                // ajouter un lien
105                $mikavarthis.wrapInner('< span>');
106                $mikavarthis.wrapInner('< a href="#'+ id +'" role="button" '+ lienclass + ariaexpanded + ' aria-controls="'+ id +'">');
107                var lien = $mikavarthis.children('a');
108
109                // affecter au lien l'evenement click
110                lien.on('click', function(event) {
111                    if ($mikavar(this).attr('aria-expanded') === 'false'){
112                        cibloc_accordeon_replier_tout($mikavar(this).attr('aria-controls'));
113                        $mikavar(this).attr('aria-expanded', 'true');
114                        $mikavar(this).addClass('expanded');
115                        reponse.attr('aria-hidden', 'false');
116                        reponse.css('display', 'block');
117                        event.preventDefault();
118                        event.stopPropagation();
119                    } else {
120                        $mikavar(this).attr('aria-expanded', 'false');
121                        $mikavar(this).removeClass('expanded');
122                        reponse.attr('aria-hidden', 'true');
123                        reponse.css('display', 'none');
124                        event.preventDefault();
125                        event.stopPropagation();
126                    }
127                });
128            }
129        });
130    });
131
132
133    // variante avec un comportement plus classique
134    // chaque question doit etre un intertitre dans le bloc accordeon2
135    // (et elle deplie une question si l'URL contient l'ancre de cette question)
136    $mikavar('.cibloc_accordeon2').each(function() {
137        cibloc_accordeon_id++;
138        cibloc_question_id = 0;
139
140        $mikavar(this).find(intertitre).each(function() {
141            var $mikavarthis = $mikavar(this);
142
143            // index de l'element dans la collection
144            cibloc_question_id++;
145            var id = 'accordeon-' + cibloc_accordeon_id + '-' +cibloc_question_id;
146
147            // masquer au demarrage ...
148            var style = ' style="display:none;"';
149            var ariahidden = ' aria-hidden="true"';
150            var ariaexpanded = ' aria-expanded="false"';
151            var lienclass = ' class="accordeon_lien"';
152
153            // ... sauf si l'URL contient l'ancre de la question
154            if (cibloc_ancre && cibloc_ancre=='#'+id){
155                style = '';
156                ariahidden = ' aria-hidden="false"';
157                ariaexpanded = ' aria-expanded="true"';
158                lienclass = ' class="accordeon_lien expanded"';
159                cibloc_ancre_existe = true;
160            }
161
162            // enlever un eventuel lien de retour au sommaire
163            $mikavarthis.children( "a.sommaire-back" ).css( "display", "none" );
164
165            // entourer la reponse avec un div
166            $mikavarthis.nextUntil(intertitre).wrapAll('< div id="'+ id +'"' + ariahidden + style +' class="cibloc_reponse">');
167            var reponse = $mikavarthis.next();
168
169            // Cas de l'affichage de la liste des blocs : ne pas activer le clic 
170            if ($mikavarthis.parents().hasClass("cibloc_sans_vignette")){
171                // ajouter un lien
172                $mikavarthis.wrapInner('< span>');
173                $mikavarthis.wrapInner('< span role="button" '+ lienclass + ariaexpanded + ' aria-controls="'+ id +'">');
174
175            // Cas classique    
176            } else {
177                // ajouter un lien
178                $mikavarthis.wrapInner('< span>');
179                $mikavarthis.wrapInner('< a href="#'+ id +'" role="button" '+ lienclass + ariaexpanded + ' aria-controls="'+ id +'">');
180                var lien = $mikavarthis.children('a');
181
182                // affecter au lien l'evenement click
183                lien.on('click', function(event) {
184                    if ($mikavar(this).attr('aria-expanded') === 'false'){
185                        $mikavar(this).attr('aria-expanded', 'true');
186                        $mikavar(this).addClass('expanded');
187                        reponse.attr('aria-hidden', 'false');
188                        reponse.css('display', 'block');
189                        event.preventDefault();
190                        event.stopPropagation();
191                    } else {
192                        $mikavar(this).attr('aria-expanded', 'false');
193                        $mikavar(this).removeClass('expanded');
194                        reponse.attr('aria-hidden', 'true');
195                        reponse.css('display', 'none');
196                        event.preventDefault();
197                        event.stopPropagation();
198                    }
199                });
200            }
201        });
202    });
203
204    // variante qui ne se replie pas
205    // chaque question doit etre un intertitre dans le bloc accordeon3
206    $mikavar('.cibloc_accordeon3').each(function() {
207        cibloc_accordeon_id++;
208        cibloc_question_id = 0;
209        var lienclass = ' class="accordeon_lien expanded"';
210
211        $mikavar(this).find(intertitre).each(function() {
212            var $mikavarthis = $mikavar(this);
213
214            // index de l'element dans la collection
215            cibloc_question_id++;
216            var id = 'accordeon-' + cibloc_accordeon_id + '-' +cibloc_question_id;
217
218            // enlever un eventuel lien de retour au sommaire
219            $mikavarthis.children( "a.sommaire-back" ).css( "display", "none" );
220
221            // entourer la reponse avec un div
222            $mikavarthis.nextUntil(intertitre).wrapAll('< div id="'+ id +'" class="cibloc_reponse">');
223
224            // Cas de l'affichage de la liste des blocs : ne pas activer le clic 
225            if ($mikavarthis.parents().hasClass("cibloc_sans_vignette")){
226                // ajouter un lien
227                $mikavarthis.wrapInner('< span>');
228                $mikavarthis.wrapInner('< span '+ lienclass + '>');
229
230            // Cas classique    
231            } else {
232                // ajouter un lien
233                $mikavarthis.wrapInner('< span>');
234                $mikavarthis.wrapInner('< a href="#'+ id +'" '+ lienclass + '>');
235            }
236        });
237    });
238};
239
240 
241
242
243
244
245jQuery(document).ready(function(){
246
247    /* Initialiser */
248
249    cibloc_init_js();
250    
251    
252    /* Cas d'un ancre */
253    if (cibloc_ancre_existe){
254        $mikavar('html, body')
255       // arrete toutes les animations en cours 
256       .stop()
257       /* scrollTop vers la nouvelle ancre  */
258       .animate({scrollTop: $mikavar(cibloc_ancre).offset().top}, 500 );                        
259    }
260
261    if ("onhashchange" in window){
262        window.onhashchange = function () {
263            var nouvelle_ancre = window.location.hash;
264            var cible_id;
265            var reponse2;
266
267            if (nouvelle_ancre.substring(0,11)=='#accordeon-'){
268                cible_id = nouvelle_ancre.substring(1);
269            } else {
270                // cas d'un sommaire automatique avec un identifiant pour l'intertitre
271                cible_id = $mikavar(nouvelle_ancre).children( "a.accordeon_lien" ).attr('aria-controls');
272            }
273
274            if (cible_id){
275                // replier l'ancienne ancre
276                cibloc_accordeon_replier_tout(cible_id);
277
278                // deplier la nouvelle ancre
279                var lesLiens2 = $mikavar('.cibloc_accordeon a.accordeon_lien, .cibloc_accordeon2 a.accordeon_lien');
280                for (var i=0; i < lesLiens2.length; i++) {
281                    if ($mikavar(lesLiens2[i]).attr('aria-controls') === cible_id){
282                        reponse2 = $mikavar('#' + cible_id);
283                        $mikavar(lesLiens2[i]).attr('aria-expanded', 'true');
284                        $mikavar(lesLiens2[i]).addClass('expanded');
285                        reponse2.attr('aria-hidden', 'false');
286                        reponse2.css('display', 'block');
287                        $mikavar('html, body')
288                       // arrete toutes les animations en cours 
289                       .stop()
290                       /* scrollTop vers la nouvelle ancre  */
291                       .animate({scrollTop: $mikavar(reponse2).offset().top}, 500 );                        
292                    }
293                }
294            }
295
296            // memoriser la nouvelle ancre
297            cibloc_ancre = nouvelle_ancre;
298        };
299    }
300
301});

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.