PageSourceSearch

https://itirando.bzh/wp-content/plugins/itirando-explorer-v2/js/func_load_flux_json.js?ver=5.9.19

js itirando.bzh collected 2026-10-07 23:50:36 UTC 13,683 bytes, 292 lines download raw bytes

1jQuery( document ).ready(function( $ ) {
2	//flux json ville+hébergement
3	
4	//recuperer la valeur $_GET dans l'url
5    function $_GET(param) {
6        var vars = 'randonnees';
7        window.location.href.replace( location.hash, '' ).replace( 
8            /[?&]+([^=&]+)=?([^&]*)?/gi, // regexp
9            function( m, key, value ) { // callback
10                // console.log(key);
11                vars= key;      
12            }
13        );      
14        return vars;
15    }
16    
17	window.loadJsonVilleEtHebergement=function(){
18
19		//charge hébergement
20		var Hebergement = '/wp-content/uploads/hebergement.json';
21		var fluxHebergement = {}; //stock le hébérgements
22		 $.getJSON(Hebergement).then(function(data) { //charge le flux
23		    data.sort(function(a, b) { //tri par ordre de num_ville_etape
24		        return a.num_H - b.num_H;
25		    });
26		    window.fluxHebergement = data;
27		 	
28		});
29		 //charge ville étape
30		var villeEtape = '/wp-content/uploads/ville-etape.json';
31		var fluxVilleEtape = {}; //stock le flux ville etape
32		$.getJSON(villeEtape).then(function(data) { //charge le flux
33	        data.sort(function(a, b) { //tri par ordre de num_ville_etape
34	            return a.num_ville_etape - b.num_ville_etape;
35	        });
36	        window.fluxVilleEtape = data;
37	        if($_GET()=='villes-etapes'){
38	            setTimeout(function() {
39	                window.initItirando(window.fluxVilleEtape);
40	                $('#villEtape').trigger('click');
41	            });
42	        }else if($_GET()=='hebergement'){
43                setTimeout(function() {
44                    window.initItirando(window.fluxVilleEtape);
45                    $('#hebergement').trigger('click');
46                });
47
48            }
49        });
50
51	}
52
53	//flux json equipements (toilettes,picnic,eau)
54    window.loadJsonEquipement=function(){
55        //charge les équipements
56         var IconeToilette = L.icon({
57            iconUrl: '/wp-content/plugins/itirando-explorer-v2/img/marker-toilette.png',
58            iconSize:     [20, 20], // size of the icon
59            iconAnchor:   [10, 10], // point of the icon which will correspond to marker's location                   
60            popupAnchor:  [10, 0] // point from which the popup should open relative to the iconAnchor
61        });
62         var IconeEau = L.icon({
63            iconUrl: '/wp-content/plugins/itirando-explorer-v2/img/marker-pointeau.png',
64            iconSize:     [20, 20], // size of the icon
65            iconAnchor:   [10, 10], // point of the icon which will correspond to marker's location                   
66            popupAnchor:  [10, 0] // point from which the popup should open relative to the iconAnchor
67        });
68          var IconePicnic = L.icon({
69            iconUrl: '/wp-content/plugins/itirando-explorer-v2/img/marker-picnic.png',
70            iconSize:     [20, 20], // size of the icon
71            iconAnchor:   [10, 10], // point of the icon which will correspond to marker's location                   
72            popupAnchor:  [10, 0] // point from which the popup should open relative to the iconAnchor
73        });
74       
75        $.getJSON("/wp-content/uploads/equipements.json", function(data) {  
76            // console.log(data);
77           
78            window.toilette = L.geoJson(data, {
79                filter: function(feature, layer) {
80                    if(feature.properties.category[0]){
81                        return (feature.properties.category[0].slug === "toilettes");
82                    }else{
83                        console.log('erreur category equipement : '+feature.properties.title[0]);
84                    }
85                },
86                onEachFeature: function (feature, layer) {
87                    layer.bindTooltip('<p>'+feature.properties.title[0]+'</p>',{direction: "bottom", className: "equipements",opacity: 1});//+feature.properties.category[0].name+'<br>'
88                },
89                pointToLayer: function (feature, latlng) {
90                    return L.marker(latlng,{icon: IconeToilette});
91                }
92            });
93
94            window.pointeau = L.geoJson(data, {
95                filter: function(feature, layer) {
96                    if(feature.properties.category[0]){
97                        return (feature.properties.category[0].slug === "point-deau");
98                    }
99                },
100                onEachFeature: function (feature, layer) {
101                    layer.bindTooltip('<p>'+feature.properties.title[0]+'</p>',{direction: "bottom", className: "equipements",opacity: 1});//+feature.properties.category[0].name+'<br>'
102                },
103                pointToLayer: function (feature, latlng) {
104                    return L.marker(latlng,{icon: IconeEau});
105                }
106            });
107
108            window.picnic = L.geoJson(data, {
109                filter: function(feature, layer) {
110                    if(feature.properties.category[0]){
111                        return (feature.properties.category[0].slug === "table-de
111-pique-nique");
112                    }
113                },
114                onEachFeature: function (feature, layer) {
115                    layer.bindTooltip('<p>'+feature.properties.title[0]+'</p>',{direction: "bottom", className: "equipements",opacity: 1});//+feature.properties.category[0].name+'<br>'
116                },
117                pointToLayer: function (feature, latlng) {
118                    return L.marker(latlng,{icon: IconePicnic});
119                }
120            });           
121            fluxEquipement=data;
122           
123            // console.log("fini");
124        });
125
126    }
127    
128    //flux json equipements (toilettes,picnic,eau) pour filtrer par catégorie et ville etape pour le planificateur
129    window.loadJsonEquipementFiltrer=function(arrayIdville){
130
131        //charge les équipements
132         var IconeToilette = L.icon({
133            iconUrl: '/wp-content/plugins/itirando-explorer-v2/img/marker-toilette.png',
134            iconSize:     [20, 20], // size of the icon
135            iconAnchor:   [10, 10], // point of the icon which will correspond to marker's location                   
136            popupAnchor:  [10, 0] // point from which the popup should open relative to the iconAnchor
137        });
138         var IconeEau = L.icon({
139            iconUrl: '/wp-content/plugins/itirando-explorer-v2/img/marker-pointeau.png',
140            iconSize:     [20, 20], // size of the icon
141            iconAnchor:   [10, 10], // point of the icon which will correspond to marker's location                   
142            popupAnchor:  [10, 0] // point from which the popup should open relative to the iconAnchor
143        });
144          var IconePicnic = L.icon({
145            iconUrl: '/wp-content/plugins/itirando-explorer-v2/img/marker-picnic.png',
146            iconSize:     [20, 20], // size of the icon
147            iconAnchor:   [10, 10], // point of the icon which will correspond to marker's location                   
148            popupAnchor:  [10, 0] // point from which the popup should open relative to the iconAnchor
149        });
150          
151            const data = JSON.parse(JSON.stringify(fluxEquipement));//copy le flux equipement sans l'écraser;
152//             console.log(arrayIdville);
153            // console.log(data.features.length);
154            for (var i = data.features.length - 1; i >= 0; i--) {
155                if(! arrayIdville.find(element => element == parseInt(data.features[i].properties.villeEtape[0]))){
156                    data.features.splice(i,1);                                
157                 }
158            }
159            // console.log(data);
160            // console.log(fluxEquipement);
161               
162            window.toiletteF = L.geoJson(data, {
163                filter: function(feature, layer) {
164                    if(feature.properties.category[0]){
165                       return (feature.properties.category[0].slug === "toilettes");
166                    }else{
167                        console.log('erreur category equipement : '+feature.properties.title[0]);
168                    }
169                },
170                onEachFeature: function (feature, layer) {
171                    layer.bindTooltip('<p>'+feature.properties.title[0]+'</p>',{direction: "bottom", className: "equipements",opacity: 1});//+feature.properties.category[0].name+'<br>'
172                },
173                pointToLayer: function (feature, latlng) {
174                    return L.marker(latlng,{icon: IconeToilette});
175                }
176            });
177
178            window.pointeauF = L.geoJson(data, {
179                filter: function(feature, layer) {
180                    if(feature.properties.category[0]){
181                        return (feature.properties.category[0].slug === "point-deau");
182                    }
183                },
184                onEachFeature: function (feature, layer) {
185                    layer.bindTooltip('<p>'+feature.properties.title[0]+'</p>',{direction: "bottom", className: "equipements",opacity: 1});//+feature.properties.category[0].name+'<br>'
186                },
187                pointToLayer: function (feature, latlng) {
188                    return L.marker(latlng,{icon: IconeEau});
189                }
190            });
191
192            window.picnicF = L.geoJson(data, {
193                filter: function(feature, layer) {
194                    if(feature.properties.category[0]){
195                        return (feature.properties.category[0].slug === "table-de
195-pique-nique");
196                    }
197                },
198                onEachFeature: function (feature, layer) {
199                    layer.bindTooltip('<p>'+feature.properties.title[0]+'</p>',{direction: "bottom", className: "equipements",opacity: 1});//+feature.properties.category[0].name+'<br>'
200                },
201                pointToLayer: function (feature, latlng) {
202                    return L.marker(latlng,{icon: IconePicnic});
203                }
204            });
205            // console.log("fini filtrer");     
206        
207
208    }
209
210    //Ajout ville de depart
211    // function onClickVilleDepart(e){
212    window.PlanificateurItems=[];
213    window.onClickVilleDepart=function(e,u){
214        //e = formulaire if e!=false alors u
215        //u = bouton app-carte 
216        // console.log(e);
217        if(e!=false){
218             N = $(e).data('bm');
219         }
220       
221        
222        var ob = localStorage.getItem('itirandoPlanificateur');
223        // console.log(ob.length);
224
225        if (ob) {
226            // console.log(ob);
227            if(ob.length !=2 ){
228                // console.log(ob.length);
229                if (confirm('Souhaitez-vous changer votre ville de départ ?')) {
230                    //oui
231                    window.PlanificateurItems=[];//on purge la base
232                    localStorage.setItem('itirandoPlanificateur', '');
233                    if($('.accountPremium.planificateur').data('username')!=null){
234                        window.saveDataUserInCloud($('.accountPremium.planificateur').data('username'),'','planificateur'); 
235                    }
236                } else {
237                  // non
238                  return;
239                }  
240            }else{
241                window.PlanificateurItems=[];//on purge la base
242            }               
243        }
244        if(e!=false){
245            data=window.fluxVilleEtape;            
246            // console.log(data);
247            dataSens=$('.btnSens.on').data('sens'); 
248            // console.log(dataSens);
249
250            // console.log(data[N]); 
251            // [0=post type, 1=titre, 2=département, 3=lien, 4=id du post,5=gps,6=index de array ville etape,7=info hotel,8=nouvelle distance,9=distance msm,10=distance sn,11=gpx ville SN, 12 = gpx ville MSM,13 = sens,14 = NOTE (MESSAGE)] 
252            window.PlanificateurItems.push([data[N].type, data[N].title, data[N].departement[0].name, data[N].lien, data[N].id,data[N].geometry,N,0,0,data[N].dist_msm[0],data[N].dist_sn[0],data[N].gpx_ville_sn[0],data[N].gpx_ville_msm[0],dataSens,0]);               
253           
254            localStorage.setItem('itirandoPlanificateur', JSON.stringify(window.PlanificateurItems));
255           // localStorage.setItem('itirandoUndo', JSON.stringify(window.PlanificateurItems));
256            //Sauvegarde si loggé
257            if($('.accountPremium.planificateur').data('username')!=null){
258                window.saveDataUserInCloud($('.accountPremium.planificateur').data('username'),JSON.stringify(window.PlanificateurItems),'planificateur'); 
259            }
260        }else{
261            function htmlDecode(input) {
262              var doc = new DOMParser().parseFromString(input, "text/html");
263              return doc.documentElement.textContent;
264            }
265            $("#vDepart").val(htmlDecode(window.fluxVilleEtape[$(u).data('bm')].title));
266            $("#vId").data('bm',$(u).data('bm'));
267            $('#vId').addClass('ok1');
268            $('#vId').trigger('click');
269        }
270        if(e==false){
271            $('.bt_voir_Planificateur').addClass('go');
272            setTimeout(function() {
273                // toggle another class
274                $('.bt_voir_Planificateur').removeClass('go');
275                    
276                    $('#mapP').css('display','none');
277                    window.buildingListPlanificateur();
278                    $('.Planificateur-lightbox').css("display","block");
279
280                    $( ".Planificateur-widget-content" ).animate({
281                        right: '0px'}, {
282                        easing: 'swing',
283                        duration: 300,
284                        complete: function() {  }
285                    });
286            }, 1000);
287        }else{          
288            window.buildingListPlanificateur();
289        }
290    }
291
292});

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.